ball 项目提交
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class GameMenuCtrl : BaseCtrl
|
||||
{
|
||||
public static GameMenuCtrl Instance { get; private set; }
|
||||
|
||||
private GameMenuModel model;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc874adbeb7dc4277adacd0caec10231
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class GameMenuModel : BaseModel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 534b2234c4d8f4ca396b651aca10bc54
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c89cb67a1dee49d89456c2f107500d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class GameMenuUICtrl : BaseUICtrl
|
||||
{
|
||||
private GameMenuUI ui;
|
||||
private GameMenuModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.GameMenuUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.GameMenuUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
|
||||
ui = null;
|
||||
}
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new GameMenuUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df3db200512334b5e9b4850547bd7318
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user