bingo 项目提交
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user