提交项目
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
using FGUI.ZM_Common_01;
|
||||
|
||||
namespace ZooMatch
|
||||
{
|
||||
public class PassunlockUI : BaseUI
|
||||
{
|
||||
private PassunlockUICtrl ctrl;
|
||||
private PassunlockModel model;
|
||||
private FGUI.ZM_Pack_16.com_passunlock ui;
|
||||
|
||||
public btn_watchAd btn_WatchAd;
|
||||
|
||||
public PassunlockUI(PassunlockUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.PassunlockUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_Pack_16";
|
||||
uiInfo.assetName = "com_passunlock";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.PassunlockModel) as PassunlockModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
AdRedeemManager.Instance.Destroy();
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.ZM_Pack_16.com_passunlock;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
if (GameHelper.IsAdModelOfPay()) {
|
||||
ui.pay_type.selectedIndex = 0;
|
||||
AdRedeemManager.Instance.SetWatchAd(AdRedeemManager.battle_pass, ui.btn_buypass as btn_watchAd,SetTextString);
|
||||
|
||||
AdRedeemManager.Instance.Start();
|
||||
SetTextString();
|
||||
|
||||
} else {
|
||||
ui.pay_type.selectedIndex = 1;
|
||||
decimal price = (decimal)GameHelper.GetCommonModel().Passportgift2;
|
||||
ui.btn_max_pay.title = GameHelper.Get102Str(price);
|
||||
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1) (ui.btn_max_pay.GetChild("img_saveingpot") as GImage).visible = true;
|
||||
ui.btn_max_pay.SetClick(() => {
|
||||
MaxPayClass maxPayData = new MaxPayClass
|
||||
{
|
||||
amount = (int)Math.Round(price * 100),
|
||||
sku = MaxPayManager.battle_pass,
|
||||
currency = "USD"
|
||||
};
|
||||
MaxPayManager.Instance.Buy(maxPayData);
|
||||
});
|
||||
}
|
||||
|
||||
InitView();
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pass_show, 1);
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
GameDispatcher.Instance.AddListener(GameMsg.apple_pay_success, pay_success);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.apple_pay_success, pay_success);
|
||||
}
|
||||
#endregion
|
||||
void pay_success(object str)
|
||||
{
|
||||
string type = (string)str;
|
||||
string purch_number = "";
|
||||
|
||||
if (type == AdRedeemManager.battle_pass)
|
||||
{
|
||||
CtrlCloseUI();
|
||||
}
|
||||
// if (purch_number != "")
|
||||
// {
|
||||
// GameHelper.SendRevenueToAF(purch_number);
|
||||
// }
|
||||
}
|
||||
//初始化页面逻辑
|
||||
private void InitView()
|
||||
{
|
||||
ui.btn_close.SetClick(CtrlCloseUI);
|
||||
int gold = 0;
|
||||
|
||||
List<Passportrewards> Passportrewards_list = ConfigSystem.GetConfig<PassportrewardsModel>().dataList;
|
||||
for (int i = 0; i < Passportrewards_list.Count; i++)
|
||||
{
|
||||
|
||||
if (Passportrewards_list[i].Paid_rewards_type == 0) gold += Passportrewards_list[i].Paid_rewards_num;
|
||||
|
||||
}
|
||||
ui.text_allgold.text = GameHelper.Get101Str(gold);
|
||||
// ui.btn_buypass.GetChild("title").text = "$" + ConfigSystem.GetConfig<CommonModel>().Passportgift;
|
||||
|
||||
}
|
||||
|
||||
public void SetTextString()
|
||||
{
|
||||
var need = AdRedeemManager.Instance.GetCeilingNeedAds(AdRedeemManager.battle_pass);
|
||||
var myAd = AdRedeemManager.Instance.GetLookRewardADNum();
|
||||
|
||||
ui.tips.SetVar("num", need.ToString()).FlushVars();
|
||||
ui.ads.SetVar("num", myAd.ToString()).FlushVars();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user