提交小游戏项目
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using DG.Tweening;
|
||||
using Newtonsoft.Json;
|
||||
using Spine.Unity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TowerClimberChronicles
|
||||
{
|
||||
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);
|
||||
});
|
||||
SkeletonAnimation ske1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_parent, Fx_Type.fx_opengame, ref closeCallback);
|
||||
ske1.skeleton.SetLocalScale(new Vector2(1.25f, 1.25f));
|
||||
ske1.state.SetAnimation(0, "animation", false);
|
||||
ske1.state.Complete += (a) =>
|
||||
{
|
||||
CtrlCloseUI();
|
||||
};
|
||||
|
||||
InitView();
|
||||
|
||||
if (GameHelper.IsGiftSwitch())
|
||||
{
|
||||
DOVirtual.DelayedCall(0.2f, () =>
|
||||
{
|
||||
// if (GameHelper.GetLevel() < GameHelper.GetCommonModel().MultiModal)
|
||||
// {
|
||||
// if (GameHelper.GetLevel() - 1 < ConfigSystem.GetConfig<LevelUnlock>().Count)
|
||||
// {
|
||||
// LevelUnlock levelUnlock_ = ConfigSystem.GetConfig<LevelUnlock>()[GameHelper.GetLevel() - 1];
|
||||
// if (levelUnlock_.LeveType != 0)
|
||||
// {
|
||||
// if (!DataMgr.LevelUnlockList.Value.Contains(GameHelper.GetLevel() - 1))
|
||||
// {
|
||||
// // uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelUI_Open, GameHelper.GetLevel() - 1);
|
||||
// if (GameHelper.GetLevel() < GameHelper.GetCommonModel().MultiModal) uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelUI_Open, GameHelper.GetLevel() - 1);
|
||||
// else uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelNewUI_Open);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (!DataMgr.LevelUnlockListNew.Value.Any(x => x.level_ == GameHelper.GetLevel()))
|
||||
// {
|
||||
// uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelNewUI_Open);
|
||||
// }
|
||||
// }
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 = GameHelper.gameType == 0 ? Language.GetContentParams("need_lv_text", GameHelper.GetLevel()) : "";
|
||||
|
||||
// ui.text_level.text = stage;
|
||||
|
||||
DOVirtual.DelayedCall(2.5f, () => { });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user