using System.Collections; using System.Collections.Generic; using UnityEngine; using FairyGUI; using BingoBrain.Core; using BingoBrain; using FGUI.G008_reward_animal; using DG.Tweening; namespace BingoBrain { public class AdcomingUI : BaseUI { private AdcomingUICtrl ctrl; private AdcomingModel model; private FGUI.G008_reward_animal.com_adcoming ui; public AdcomingUI(AdcomingUICtrl ctrl) : base(ctrl) { uiName = UIConst.AdcomingUI; this.ctrl = ctrl; } protected override void SetUIInfo(UIInfo uiInfo) { uiInfo.packageName = "G008_reward_animal"; uiInfo.assetName = "com_adcoming"; uiInfo.layerType = UILayerType.Popup; uiInfo.isNeedOpenAnim = false; uiInfo.isNeedCloseAnim = false; uiInfo.isNeedUIMask = true; } #region 生命周期 protected override void OnInit() { //model = ModuleManager.Instance.GetModel(ModelConst.AdcomingModel) as AdcomingModel; } protected override void OnClose() { } protected override void OnBind() { ui = baseUI as FGUI.G008_reward_animal.com_adcoming; } protected override void OnOpenBefore(object args) { InitView(); } protected override void OnOpen(object args) { } protected override void OnHide() { } protected override void OnDisplay(object args) { } #endregion #region 消息 protected override void AddListener() { GameDispatcher.Instance.AddListener(GameMsg.pack_close, playAni); } protected override void RemoveListener() { GameDispatcher.Instance.RemoveListener(GameMsg.pack_close, playAni); } #endregion private int time = 5; //初始化页面逻辑 private void InitView() { ui.time_text.text = time.ToString(); tweer = DOVirtual.Float(time, 0, time, value => { ui.time_text.text = ((int)value).ToString(); }); tweer.onComplete += () => { CtrlCloseUI(); GameHelper.ShowInterstitial("interstitial_gameend"); }; ui.btn_removead.SetClick(() => { PackRewardData param = new PackRewardData(); param.isAutoPop = false; param.isNeedScroll = true; UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open, param); tweer.Pause(); }); } private Tween tweer; void playAni(object a) { tweer.Play(); } } }