2024-11-13 18:01:18 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class TextBox : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Text numText;
|
|
|
|
|
public Transform ParentHouse;
|
|
|
|
|
public Transform Parent;
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
transform.SetParent(Parent);//<2F>ı丸<C4B1>ڵ㣬<DAB5><E3A3AC>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
numText = transform.Find("Text").GetComponent<Text>();
|
|
|
|
|
SetText(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetText(float add)
|
2024-11-15 23:31:54 +08:00
|
|
|
|
{
|
|
|
|
|
float start = ParentHouse.GetComponent<HouseInfo>().Money;
|
|
|
|
|
ParentHouse.GetComponent<HouseInfo>().Money = add;
|
|
|
|
|
|
|
|
|
|
StartCoroutine(Tools.AnimateText(start, ParentHouse.GetComponent<HouseInfo>().Money, 0.5f, numText));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddText(float add)
|
2024-11-13 18:01:18 +08:00
|
|
|
|
{
|
2024-11-13 21:45:48 +08:00
|
|
|
|
float start = ParentHouse.GetComponent<HouseInfo>().Money;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
ParentHouse.GetComponent<HouseInfo>().Money += add;
|
2024-11-13 21:45:48 +08:00
|
|
|
|
|
|
|
|
|
StartCoroutine(Tools.AnimateText(start, ParentHouse.GetComponent<HouseInfo>().Money,0.5f,numText));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float ReturnText()
|
|
|
|
|
{
|
|
|
|
|
return ParentHouse.GetComponent<HouseInfo>().Money;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlayAni()
|
|
|
|
|
{
|
|
|
|
|
ParentHouse.GetComponent<MoneyAnimation>().PlayCoinAnimation();
|
2024-11-13 18:01:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|