123 lines
3.4 KiB
C#
123 lines
3.4 KiB
C#
using System;
|
|
|
|
using DG.Tweening;
|
|
using Newtonsoft.Json;
|
|
using Spine.Unity;
|
|
using UnityEngine;
|
|
|
|
namespace BallKingdomCrush
|
|
{
|
|
public class OpenGameUI : BaseUI
|
|
{
|
|
private OpenGameUICtrl ctrl;
|
|
private OpenGameModel model;
|
|
private FGUI.ZM_Game_04.com_open ui;
|
|
|
|
public OpenGameUI(OpenGameUICtrl ctrl) : base(ctrl)
|
|
{
|
|
uiName = UIConst.OpenGameUI;
|
|
this.ctrl = ctrl;
|
|
}
|
|
|
|
protected override void SetUIInfo(UIInfo uiInfo)
|
|
{
|
|
uiInfo.packageName = "ZM_Game_04";
|
|
uiInfo.assetName = "com_open";
|
|
uiInfo.layerType = UILayerType.Highest;
|
|
uiInfo.isNeedOpenAnim = false;
|
|
uiInfo.isNeedCloseAnim = false;
|
|
uiInfo.isNeedUIMask = false;
|
|
}
|
|
|
|
#region 生命周期
|
|
protected override void OnInit()
|
|
{
|
|
// model = ModuleManager.Instance.GetModel(ModelConst.OpenGameModel) as OpenGameModel;
|
|
}
|
|
|
|
protected override void OnClose()
|
|
{
|
|
|
|
}
|
|
|
|
protected override void OnBind()
|
|
{
|
|
ui = baseUI as FGUI.ZM_Game_04.com_open;
|
|
}
|
|
|
|
protected override void OnOpenBefore(object args)
|
|
{
|
|
Debug.Log(JsonConvert.SerializeObject(DataMgr.LevelUnlockList.Value));
|
|
DOVirtual.DelayedCall(0.7f, () =>
|
|
{
|
|
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, args);
|
|
});
|
|
InitView();
|
|
|
|
if (GameHelper.IsGiftSwitch())
|
|
{
|
|
DOVirtual.DelayedCall(0.2f, () =>
|
|
{
|
|
Debug.Log($"open 1 game------------------{GameHelper.GetLevel() - 1}");
|
|
|
|
if (GameHelper.GetLevel() - 1 < ConfigSystem.GetConfig<LevelUnlock>().Count)
|
|
{
|
|
LevelUnlock levelUnlock_ = ConfigSystem.GetConfig<LevelUnlock>()[GameHelper.GetLevel() - 1];
|
|
|
|
Debug.Log($"open 2 game------------------{levelUnlock_.LeveType}");
|
|
if (levelUnlock_.LeveType != 0)
|
|
{
|
|
Debug.Log($"open 3 game------------------{DataMgr.LevelUnlockList.Value.Count}");
|
|
if (!DataMgr.LevelUnlockList.Value.Contains(GameHelper.GetLevel() - 1))
|
|
{
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelUI_Open, GameHelper.GetLevel() - 1);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
ui.t0.Play();
|
|
|
|
if (AudioManager.Instance.IsOpenEffect)
|
|
{
|
|
AudioManager.Instance.PlayDynamicEffect(AudioConst.game_open);
|
|
}
|
|
}
|
|
|
|
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 Action closeCallback;
|
|
//初始化页面逻辑
|
|
private void InitView()
|
|
{
|
|
|
|
string stage = Language.GetContentParams("need_lv_text", GameHelper.GetLevel());
|
|
|
|
ui.text_level.text = stage;
|
|
|
|
DOVirtual.DelayedCall(1.2f, () => { CtrlCloseUI(); });
|
|
}
|
|
}
|
|
} |