备份CatanBuilding瘦身独立工程
This commit is contained in:
99
Assets/Scripts/UI/SmallGame/EventBankHeistRewardPanel.cs
Normal file
99
Assets/Scripts/UI/SmallGame/EventBankHeistRewardPanel.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
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;
|
||||
RewardItemNew reward_extra;
|
||||
GameObject bg_extra;
|
||||
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>();
|
||||
bg_extra = transform.Find("root/reward/bonus").gameObject;
|
||||
reward_extra = transform.Find("root/reward/bonus/reward").GetComponent<RewardItemNew>();
|
||||
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)
|
||||
{
|
||||
//superCashBonus = 0.5f;
|
||||
FishingEventData _fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
bool isRankInit = _fishingEventData.rankInit != null;
|
||||
if (isRankInit && addRankCount > 0)
|
||||
{
|
||||
reward_extra.SetData(new ItemData() { id = _fishingEventData.rankInit.TokenID, count = addRankCount });
|
||||
//GContext.container.Resolve<SmallGameData>().image_extra_pos = bg_extra.transform.position;
|
||||
bg_extra.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_extra.SetActive(false);
|
||||
}
|
||||
//this.multiple = multiple;
|
||||
add = glod;
|
||||
if (superCashBonus > 0.001f)
|
||||
{
|
||||
text_num.color = Color.black;
|
||||
text_num_buff.color = Color.white;
|
||||
}
|
||||
GContext.Publish(new TargetAddData(1002, 0, add));
|
||||
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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user