bingo 项目提交
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using FairyGUI;
|
||||
using BingoBrain.Core;
|
||||
|
||||
using BingoBrain;
|
||||
using FGUI.G006_menu_animal;
|
||||
using FGUI.Common_animal;
|
||||
using NSubstitute;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class SheepwindowUI : BaseUI
|
||||
{
|
||||
private SheepwindowUICtrl ctrl;
|
||||
private SheepwindowModel model;
|
||||
private FGUI.G006_menu_animal.com_sheepwindow ui;
|
||||
private int state_ = 0;
|
||||
|
||||
public SheepwindowUI(SheepwindowUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.SheepwindowUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "G006_menu_animal";
|
||||
uiInfo.assetName = "com_sheepwindow";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.SheepwindowModel) as SheepwindowModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
GameHelper.showGameUI = true;
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.G006_menu_animal.com_sheepwindow;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
GameHelper.showGameUI = false;
|
||||
state_ = (int)args;
|
||||
ui.window_state.selectedIndex = state_;
|
||||
btn_tabwhite buy_btn = (ui.btn_buy) as btn_tabwhite;
|
||||
buy_btn.number_text.text = ConfigSystem.GetConfig<CommonModel>().Purchaseprops.ToString();
|
||||
buy_btn.SetClick(buyItem);
|
||||
InitView();
|
||||
}
|
||||
void buyItem()
|
||||
{
|
||||
if (state_ == 0)
|
||||
{
|
||||
|
||||
}
|
||||
else if (state_ == 1)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if (state_ == 2)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
if (GameHelper.checkGoldNumber(ConfigSystem.GetConfig<CommonModel>().Purchaseprops))
|
||||
{
|
||||
PreferencesMgr.Instance.Currency101 -= ConfigSystem.GetConfig<CommonModel>().Purchaseprops;
|
||||
int numbers = GameHelper.GetItemNumber(state_);
|
||||
numbers++;
|
||||
GameHelper.SetItemNumber(state_, numbers);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Sheep_item_refresh);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
|
||||
GameHelper.ShowTips("The purchase was successful", true);
|
||||
CtrlCloseUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowTips("Not enough gold");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
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 void InitView()
|
||||
{
|
||||
ui.btn_close.SetClick(() =>
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SheepwindowUI_Close);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user