记录副本更新ui
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using Assets.MyGame.Scripts.Net.API;
|
||||
using Spine.Unity;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class SitPosData : MonoBehaviour
|
||||
{
|
||||
public UserToken user;
|
||||
public int posID;
|
||||
public TextMeshProUGUI tMP_TurretConsumeNum;
|
||||
public TextMeshProUGUI tMP_GoldNum;
|
||||
public int goldNum;
|
||||
public int consumeGoldNum;
|
||||
public Dictionary<string, TurretData> dic_Turrets=new Dictionary<string, TurretData>();
|
||||
public List<TurretData> list_Turrets=new List<TurretData>();
|
||||
public int currentTurretIndex = 0;
|
||||
public string currentTurretID = "";
|
||||
public TurretData currentTurret;
|
||||
|
||||
|
||||
public SkeletonGraphic skeletonAnimation;
|
||||
public Transform tra_CurrTurret;
|
||||
public Transform tra_CurrFly;
|
||||
public GameObject changeTurretList;
|
||||
public void Awake()
|
||||
{
|
||||
//list_Turrets.Sort((td1,td2) =>
|
||||
//{
|
||||
// return td1.turretID.CompareTo(td2.turretLevel);
|
||||
//});
|
||||
dic_Turrets = list_Turrets.ToDictionary(td => td.turretID);
|
||||
}
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
public void ChangeTurret(int n=0)
|
||||
{
|
||||
|
||||
if (currentTurretIndex>list_Turrets.Count|| currentTurretIndex<0)
|
||||
{
|
||||
//currentTurretIndex = currentTurretIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentTurretIndex = n;
|
||||
}
|
||||
if (currentTurret != null)
|
||||
{
|
||||
currentTurret.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
currentTurretID = list_Turrets[currentTurretIndex].turretID; //dic_Turrets[currentTurretID];
|
||||
currentTurret=dic_Turrets[currentTurretID];
|
||||
currentTurret.gameObject.SetActive(true);
|
||||
|
||||
|
||||
gameObject.SetActive(true);
|
||||
tra_CurrTurret =currentTurret.transform.GetChild(0);
|
||||
tra_CurrFly = currentTurret.transform.GetChild(1);
|
||||
skeletonAnimation = tra_CurrTurret.GetChild(0).GetComponent<SkeletonGraphic>();
|
||||
|
||||
}
|
||||
public void ChangeTurretConsumeNum(int n = 0)
|
||||
{
|
||||
consumeGoldNum = n;
|
||||
tMP_TurretConsumeNum.text = consumeGoldNum.ToString();
|
||||
|
||||
}
|
||||
public bool ConsumeGold(int bl=1)
|
||||
{
|
||||
int temp = goldNum - consumeGoldNum*bl;
|
||||
if (temp > 0)
|
||||
{
|
||||
goldNum = temp;
|
||||
tMP_GoldNum.text = goldNum.ToString();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user