Files
RedHotRoast-ios/Assets/Scripts/ModuleUI/SuperSpeedView/SuperSpeedViewUI.cs
T
2026-04-22 09:52:55 +08:00

118 lines
3.1 KiB
C#

using System;
using FGUI.P01_Common;
using FairyGUI;
using Spine.Unity;
using System.Collections.Generic;
using UnityEngine;
namespace FlowerPower
{
public class SuperSpeedViewUI : BaseUI
{
private SuperSpeedViewUICtrl ctrl;
private SuperSpeedViewModel model;
private FGUI.tixian.com_super_speed ui;
public int ad_cool_down = 120;
public btn_watchAd btn_WatchAd;
private Action closeCallback;
public SuperSpeedViewUI(SuperSpeedViewUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.SuperSpeedViewUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "tixian";
uiInfo.assetName = "com_super_speed";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.SuperSpeedViewModel) as SuperSpeedViewModel;
}
protected override void OnClose()
{
GameHelper.showGameUI = true;
}
protected override void OnBind()
{
ui = baseUI as FGUI.tixian.com_super_speed;
}
protected override void OnOpenBefore(object args)
{
InitView();
}
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;
if (type == PurchasingManager.buy_one)
{
CtrlCloseUI();
}
}
//初始化页面逻辑
private void InitView()
{
ui.btn_close.SetClick(() =>
{
CtrlCloseUI();
});
decimal price = (decimal)GameHelper.GetCommonModel().addspace2;
ui.btn_buy.title = GameHelper.Get102Str(price);
ui.btn_buy.visible = !SaveData.GetSaveobject().IsBuySpeedGift;
ui.btn_buy.SetClick(() =>
{
ApplePayClass maxPayData = new ApplePayClass
{
amount = (int)Math.Round(price * 100),
sku = PurchasingManager.buy_one,
currency = "USD"
};
MaxPayManager.Instance.Buy(maxPayData);
SuperSpeedViewUICtrl.IsBuySpeed = true;
});
}
}
}