85 lines
2.9 KiB
C#
85 lines
2.9 KiB
C#
using asap.core;
|
|
using DG.Tweening;
|
|
using game;
|
|
using GameCore;
|
|
using Spine;
|
|
using Spine.Unity;
|
|
using System.Collections;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class EventBankHeistRewardPanel : MonoBehaviour
|
|
{
|
|
public float PlaySpineDelay = 0.5f;
|
|
TMP_Text text_num;
|
|
TMP_Text text_num_buff;
|
|
Button btn_close;
|
|
GameObject fx_ui_blingbling_01;
|
|
BonusReward bonusReward;
|
|
SkeletonGraphic skeletonGraphic;
|
|
int add = 0;
|
|
private void Awake()
|
|
{
|
|
text_num = transform.Find("root/reward/text_num").GetComponent<TMP_Text>();
|
|
text_num_buff = transform.Find("root/reward/text_num/text_num_buff").GetComponent<TMP_Text>();
|
|
btn_close = transform.Find("root/reward/btn_play/btn_green").GetComponent<Button>();
|
|
bonusReward = transform.Find("root/reward/bonus").GetComponent<BonusReward>();
|
|
skeletonGraphic = transform.Find("root/spine").GetComponent<SkeletonGraphic>();
|
|
fx_ui_blingbling_01 = transform.Find("root/reward/fx_ui_blingbling_01").gameObject;
|
|
fx_ui_blingbling_01.gameObject.SetActive(false);
|
|
}
|
|
private void OnEnable()
|
|
{
|
|
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("EventBankHeistRewardPanel");
|
|
}
|
|
private void Start()
|
|
{
|
|
btn_close.onClick.AddListener(OnClickClose);
|
|
skeletonGraphic.AnimationState.Complete += HandleAnimationComplete;
|
|
}
|
|
void HandleAnimationComplete(TrackEntry trackEntry)
|
|
{
|
|
skeletonGraphic.AnimationState.SetAnimation(0, "Idle01", true);
|
|
}
|
|
public void SetData(int glod, float superCashBonus, int addRankCount)
|
|
{
|
|
add = glod;
|
|
if (superCashBonus > 0.001f)
|
|
{
|
|
text_num.color = Color.black;
|
|
text_num_buff.color = Color.white;
|
|
}
|
|
GContext.Publish(new TargetAddData(1002, 0, add));
|
|
bonusReward.Show();
|
|
StartCoroutine(ShowMoney());
|
|
StartCoroutine(PlaySpine(superCashBonus > 0.001f));
|
|
}
|
|
IEnumerator PlaySpine(bool isShow)
|
|
{
|
|
yield return new WaitForSeconds(PlaySpineDelay);
|
|
skeletonGraphic.AnimationState.SetAnimation(0, "Celebrate01", false);
|
|
fx_ui_blingbling_01.gameObject.SetActive(isShow);
|
|
}
|
|
IEnumerator ShowMoney()
|
|
{
|
|
//GameEventMgr.Instance.Raise(GameEvents.GoldAddAni, add);
|
|
text_num.text = "";
|
|
text_num_buff.text = "";
|
|
yield return new WaitForSeconds(0.2f);
|
|
int gold = 0;
|
|
DOTween.To(() => gold, x => gold = x, add, 1f).OnUpdate(() =>
|
|
{
|
|
text_num.text = ConvertTools.GetNumberString2(gold);
|
|
text_num_buff.text = text_num.text;
|
|
});
|
|
//yield return new WaitForSeconds(1.2f);
|
|
//text_num.text = ConvertTools.GetNumberString2(add * multiple);
|
|
}
|
|
private void OnClickClose()
|
|
{
|
|
UIManager.Instance.DestroyUI(UITypes.EventBankHeistRewardPanel);
|
|
GContext.Publish(new UnloadActToNextAct());
|
|
}
|
|
}
|