56 lines
1.2 KiB
C#
56 lines
1.2 KiB
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using TMPro;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
/// <summary>
|
||
|
/// 结算ui
|
||
|
/// </summary>
|
||
|
public class SettlementPanel : MonoBehaviour
|
||
|
{
|
||
|
[SerializeField] private TextMeshProUGUI textPro;
|
||
|
[SerializeField] private Button _button;
|
||
|
[SerializeField] private Button _videoButton;
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
_button = GetComponent<Button>();
|
||
|
}
|
||
|
|
||
|
private void OnEnable()
|
||
|
{
|
||
|
_button.onClick.AddListener(OnButtonEvent);
|
||
|
_videoButton.onClick.AddListener(DoubleGold);
|
||
|
}
|
||
|
|
||
|
private void OnDisable()
|
||
|
{
|
||
|
_button.onClick.RemoveListener(OnButtonEvent);
|
||
|
_videoButton.onClick.RemoveListener(DoubleGold);
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 显示获得金币
|
||
|
/// </summary>
|
||
|
public void SettlementEvent()
|
||
|
{
|
||
|
textPro.text ="+"+ GameSystem.ins.playingGold.ToString();
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 默认获得金币
|
||
|
/// </summary>
|
||
|
private void OnButtonEvent()
|
||
|
{
|
||
|
gameObject.SetActive(false);
|
||
|
GameSystem.ins.GoldRest();
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 双倍获得金币
|
||
|
/// </summary>
|
||
|
private void DoubleGold()
|
||
|
{
|
||
|
gameObject.SetActive(false);
|
||
|
GameSystem.ins.DoubleGoldRest();
|
||
|
}
|
||
|
}
|