fix:1、更换项目,使用winter来创建
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using FGUI.P01_Common;
|
||||
|
||||
namespace FlowerPower
|
||||
namespace LoveLegend
|
||||
{
|
||||
public class BuyPropUI : BaseUI
|
||||
{
|
||||
private BuyPropUICtrl ctrl;
|
||||
private BuyPropModel model;
|
||||
private FGUI.P09_ChooseProp.com_prop ui;
|
||||
private FGUI.ZM_Prop_09.com_prop ui;
|
||||
private int state_ = 0;
|
||||
|
||||
public BuyPropUI(BuyPropUICtrl ctrl) : base(ctrl)
|
||||
@@ -15,17 +12,15 @@ namespace FlowerPower
|
||||
uiName = UIConst.BuyPropUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
private btn_watchAd btn_watchAd;
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "P09_ChooseProp";
|
||||
uiInfo.packageName = "ZM_Prop_09";
|
||||
uiInfo.assetName = "com_prop";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
uiInfo.isNeedUIMask = false;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
@@ -37,40 +32,23 @@ namespace FlowerPower
|
||||
protected override void OnClose()
|
||||
{
|
||||
GameHelper.showGameUI = true;
|
||||
HallManager.Instance.UpdateSecondEvent -= SetWatchBtnCd;
|
||||
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.P09_ChooseProp.com_prop;
|
||||
ui = baseUI as FGUI.ZM_Prop_09.com_prop;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
btn_watchAd = ui.btn_watch as btn_watchAd;
|
||||
state_ = (int)args;
|
||||
ui.prop.selectedIndex = state_;
|
||||
ui.btn_buy.GetChild("text_gold").text = GameHelper.Get101Str(ConfigSystem.GetConfig<CommonModel>().Purchaseprops);
|
||||
ui.btn_buy.GetChild("text_gold").text = GameHelper.Get101Str(ConfigSystem.GetCommonConf().Purchaseprops);
|
||||
ui.btn_buy.SetClick(buyItem);
|
||||
|
||||
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1) btn_watchAd.img_saveingpot.visible = true;
|
||||
|
||||
btn_watchAd.SetClick(() =>
|
||||
{
|
||||
GameHelper.ShowVideoAd("buy_prop", isSuccess =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
GameHelper.SetWatchCd(state_);
|
||||
BuyPropSuccess();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
setBtnState(state_);
|
||||
InitView();
|
||||
|
||||
HallManager.Instance.UpdateSecondEvent += SetWatchBtnCd;
|
||||
SetWatchBtnCd();
|
||||
}
|
||||
void buyItem()
|
||||
{
|
||||
@@ -88,42 +66,23 @@ namespace FlowerPower
|
||||
|
||||
|
||||
}
|
||||
if (GameHelper.CheckGoldNumber(ConfigSystem.GetConfig<CommonModel>().Purchaseprops))
|
||||
if (GameHelper.CheckGoldNumber(ConfigSystem.GetCommonConf().Purchaseprops))
|
||||
{
|
||||
BuyPropSuccess();
|
||||
GameHelper.AddGoldNumber(-ConfigSystem.GetCommonConf().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("purchase_succ", true);
|
||||
CtrlCloseUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameHelper.ShowTips("Not enough gold");
|
||||
GameHelper.ShowTips("no_enough_gold", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void BuyPropSuccess()
|
||||
{
|
||||
GameHelper.AddGoldNumber(-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();
|
||||
}
|
||||
|
||||
private void SetWatchBtnCd()
|
||||
{
|
||||
if (GameHelper.GetWatchCd(state_) > Convert.ToInt32(GameHelper.GetNowTime()))
|
||||
{
|
||||
btn_watchAd.can_buy.selectedIndex = 1;
|
||||
btn_watchAd.btn_text.text = CommonHelper.TimeFormat(GameHelper.GetWatchCd(state_) - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour);
|
||||
btn_watchAd.enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_watchAd.enabled = true;
|
||||
btn_watchAd.can_buy.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
@@ -158,6 +117,35 @@ namespace FlowerPower
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SheepwindowUI_Close);
|
||||
});
|
||||
|
||||
// ui.btn_buy0.SetClick(() =>
|
||||
// {
|
||||
// state_ = 0;
|
||||
// ui.prop.selectedIndex = 0;
|
||||
// setBtnState(0);
|
||||
// });
|
||||
// ui.btn_buy1.SetClick(() =>
|
||||
// {
|
||||
// state_ = 1;
|
||||
|
||||
// ui.prop.selectedIndex = 1;
|
||||
// setBtnState(1);
|
||||
|
||||
// });
|
||||
// ui.btn_buy2.SetClick(() =>
|
||||
// {
|
||||
// state_ = 2;
|
||||
|
||||
// ui.prop.selectedIndex = 2;
|
||||
// setBtnState(2);
|
||||
|
||||
// });
|
||||
}
|
||||
|
||||
private void setBtnState(int index)
|
||||
{
|
||||
// ui.btn_buy0.tab_choose.selectedIndex = index == 0 ? 1 : 0;
|
||||
// ui.btn_buy1.tab_choose.selectedIndex = index == 1 ? 1 : 0;
|
||||
// ui.btn_buy2.tab_choose.selectedIndex = index == 2 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user