Files
ArrowBeatTap-Gp/Assets/Scripts/ModuleUI/GameResult/GameResultUI.cs
T

119 lines
3.1 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using IgnoreOPS;
using FairyGUI;
using FGUI.Common_01;
using FGUI.GameResult_08;
using IgnoreOPS;
using Newtonsoft.Json;
using Spine.Unity;
using UnityEngine;
using btn_claim = FGUI.Common_01.btn_claim;
using Random = UnityEngine.Random;
namespace ChillConnect
{
public class GameResultUI : BaseUI
{
private GameResultUICtrl ctrl;
private GameResultModel model;
private com_arrow_end ui;
private Action closeCallback;
public GameResultUI(GameResultUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.GameResultUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "GameResult_08";
uiInfo.assetName = "com_arrow_end";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = true;
uiInfo.isNeedCloseAnim = true;
uiInfo.isNeedUIMask = true;
}
#region 生命周期
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.GameResultModel) as GameResultModel;
}
protected override void OnClose()
{
}
//
protected override void OnBind()
{
ui = baseUI as com_arrow_end;
}
private SuccessData successData_;
protected override void OnOpenBefore(object args)
{
((btn_claim)ui.btn_watchAd).state.selectedIndex = DataMgr.ArrowResultLevel.Value == 1 ? 1 : 0;
((btn_claim)ui.btn_watchAd).title = DataMgr.ArrowResultLevel.Value == 1 ? "Free Revive" : "Revive";
ui.btn_watchAd.SetClick(() =>
{
if (DataMgr.ArrowResultLevel.Value == 1)
{
DataMgr.ArrowResultLevel.Value = 0;
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, true);
}
else if (DataMgr.ArrowResultLevel.Value == 0)
{
GameHelper.ShowVideoAd("gameResult", success =>
{
if (success)
{
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, true);
}
});
}
CtrlCloseUI();
});
ui.btn_restart.SetClick(() =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameAgainUI_Open);
CtrlCloseUI();
});
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region 消息
protected override void AddListener()
{
}
protected override void RemoveListener()
{
}
#endregion
private int time_count;
}
}