71 lines
2.1 KiB
C#
71 lines
2.1 KiB
C#
using Spine.Unity;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class Checkout_Mon : MonoBehaviour, IPointerClickHandler
|
|
{
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// 收入
|
|
/// </summary>
|
|
private int Income=0;
|
|
/// <summary>
|
|
/// 声望
|
|
/// </summary>
|
|
private int Fame = 0;
|
|
/// <summary>
|
|
/// 收入增加
|
|
/// </summary>
|
|
/// <param name="income_">增加收入值</param>
|
|
public void AddIncome(int income_)
|
|
{
|
|
this.Income += income_;
|
|
}
|
|
/// <summary>
|
|
/// 开始结算
|
|
/// </summary>
|
|
public void StartCheckout()
|
|
{
|
|
this.gameObject.SetActive(true);
|
|
this.transform.Find("金币结算").GetComponent<TextMeshProUGUI>().text = this.Income.ToString();
|
|
this.transform.Find("声望结算").GetComponent<TextMeshProUGUI>().text = this.Fame.ToString();
|
|
this.transform.Find("结算皇冠").GetComponent<SkeletonGraphic>().AnimationState.SetAnimation(0, "rc_1", false);
|
|
this.transform.Find("金币").GetComponent<SkeletonGraphic>().AnimationState.SetAnimation(0, "rc_1", false);
|
|
this.transform.Find("双倍金币").GetComponent<SkeletonGraphic>().AnimationState.SetAnimation(0, "rc_1", false);
|
|
this.transform.Find("返回店铺").GetComponent<SkeletonGraphic>().AnimationState.SetAnimation(0, "rc_1", false);
|
|
|
|
}
|
|
/// <summary>
|
|
/// 返回店铺
|
|
/// </summary>
|
|
public void ReturnStore()
|
|
{
|
|
this.gameObject.SetActive(false);
|
|
GameObject.Find("店铺状态").GetComponent<Door_Mon>().CloseDoor();
|
|
}
|
|
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
{
|
|
Debug.Log("点击对象" + eventData.pointerCurrentRaycast.gameObject.name);
|
|
string name_ = eventData.pointerCurrentRaycast.gameObject.name;
|
|
if (name_ == "返回店铺")
|
|
{
|
|
//this.transform.Find("返回店铺").GetComponent<SkeletonGraphic>().AnimationState.SetAnimation(0, "play_1", false);
|
|
this.ReturnStore();
|
|
}
|
|
}
|
|
}
|