bingo 项目提交
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using BingoBrain.Core;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class MenuCtrl : BaseCtrl
|
||||
{
|
||||
public static MenuCtrl Instance { get; private set; }
|
||||
|
||||
private MenuModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.MenuModel) as MenuModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c51eb71050f964a8b943d064f9e9b786
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using BingoBrain.Core;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class MenuModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnReset()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d8fc9d7bf29343dcab8a64d87efbfdf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,160 @@
|
||||
using BingoBrain.Core;
|
||||
using BingoBrain.HotFix;
|
||||
using DontConfuse;
|
||||
using FairyGUI;
|
||||
using FGUI.ACommon;
|
||||
using FGUI.G006_menu_animal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class MenuUI : BaseUI
|
||||
{
|
||||
private MenuUICtrl ctrl;
|
||||
private MenuModel model;
|
||||
private FGUI.G006_menu_animal.com_edit ui;
|
||||
|
||||
public MenuUI(MenuUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.MenuUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "G006_menu_animal";
|
||||
uiInfo.assetName = "com_edit";
|
||||
uiInfo.layerType = UILayerType.Normal;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
|
||||
// loginModel = moduleManager.GetModel(ModelConst.LoginModel) as LoginModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
GameHelper.showGameUI=true;
|
||||
//GameHelper.FadeOut(ui);
|
||||
WebviewManager.Instance.SetDarkThough(true);
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.G006_menu_animal.com_edit;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
GameHelper.showGameUI = false;
|
||||
InitData();
|
||||
InitView();
|
||||
WebviewManager.Instance.SetDarkThough(false);
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
// GameHelper.FadeIn(ui);
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private int selectIndex;
|
||||
private int avatarTotal;
|
||||
private void InitData()
|
||||
{
|
||||
selectIndex = PreferencesMgr.Instance.PlayerAvatarId;
|
||||
|
||||
avatarTotal = 12;
|
||||
}
|
||||
|
||||
private void InitView()
|
||||
{
|
||||
// ui.closeButton.onClick.Set(OnCloseView);
|
||||
|
||||
GameHelper.SetName(ui.textp_name);
|
||||
|
||||
ui.btn_ok.onClick.Set(OnClickOK);
|
||||
|
||||
ui.list_avatar.itemRenderer = ItemRenderer;
|
||||
ui.list_avatar.numItems = 12;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void OnClickOK()
|
||||
{
|
||||
var name = ui.textp_name.text;
|
||||
OnCloseView();
|
||||
|
||||
if (selectIndex != -1)
|
||||
{
|
||||
PreferencesMgr.Instance.PlayerAvatarId = selectIndex;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(name) || name.IsNullOrWhiteSpace())
|
||||
{
|
||||
GameHelper.ShowTips("The input cannot be null", true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
PreferencesMgr.Instance.PlayerName = name;
|
||||
|
||||
}
|
||||
|
||||
private void ItemRenderer(int index, GObject item)
|
||||
{
|
||||
var btnImg = item as btn_img;
|
||||
var currentIndex = index ;
|
||||
Debug.Log(index);
|
||||
EyesHarmony.SetAvatarToLoader(currentIndex, btnImg.head_loader.GetChild("loader_avatar") as GLoader);
|
||||
btnImg.cont_select.selectedIndex = selectIndex == currentIndex
|
||||
? 1
|
||||
: 0;
|
||||
|
||||
btnImg.SetClick(() =>
|
||||
{
|
||||
selectIndex = currentIndex;
|
||||
ui.list_avatar.numItems = avatarTotal;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void OnCloseView()
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(SkinInfo.MenuUI_Close);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a20e7e34e2788415fa0621734f1443d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
using BingoBrain.Core;
|
||||
using BingoBrain.HotFix;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class MenuUICtrl : BaseUICtrl
|
||||
{
|
||||
private MenuUI ui;
|
||||
private MenuModel model;
|
||||
|
||||
private uint openUIMsg = SkinInfo.MenuUI_Open;
|
||||
private uint closeUIMsg = SkinInfo.MenuUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.MenuModel) as MenuModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new MenuUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#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);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3569920408554402da94b8c47f9621a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user