ball 项目提交
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
using System;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using System.Globalization;
|
||||
|
||||
public class GameMenuUI : BaseUI
|
||||
{
|
||||
private GameMenuUICtrl ctrl;
|
||||
private GameMenuModel model;
|
||||
private FGUI.ZM_Game_04.com_game_menu ui;
|
||||
|
||||
private string content;
|
||||
|
||||
private bool isTerm;
|
||||
|
||||
public GameMenuUI(GameMenuUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.GameMenuUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_Game_04";
|
||||
uiInfo.assetName = "com_game_menu";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = false;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.ZM_Game_04.com_game_menu;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
if (args != null)
|
||||
{
|
||||
isTerm = (bool)args;
|
||||
}
|
||||
|
||||
InitView();
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
ui?.show.Play();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void HideAnim(Action callback = null)
|
||||
{
|
||||
ui.hide.Play(() =>
|
||||
{
|
||||
CtrlCloseUI();
|
||||
callback?.Invoke();
|
||||
});
|
||||
}
|
||||
|
||||
private void InitView()
|
||||
{
|
||||
ui.SetClick(() => { HideAnim(); });
|
||||
ui.btn_exit.SetClick(() =>
|
||||
{
|
||||
HideAnim();
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.ExitGame);
|
||||
});
|
||||
|
||||
ui.btn_settings.SetClick(() =>
|
||||
{
|
||||
HideAnim();
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MenuUI_Open, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user