145 lines
4.7 KiB
C#
145 lines
4.7 KiB
C#
|
|
using FGUI.ZM_Common_01;
|
|
using UnityEngine;
|
|
using FairyGUI;
|
|
using SGModule.NetKit;
|
|
using Spine.Unity;
|
|
using System;
|
|
|
|
namespace BallKingdomCrush
|
|
{
|
|
public class SubUnlockUI : BaseUI
|
|
{
|
|
private SubUnlockUICtrl ctrl;
|
|
private SubUnlockModel model;
|
|
private FGUI.LG_Unlock.com_SubUnlock ui;
|
|
|
|
public SubUnlockUI(SubUnlockUICtrl ctrl) : base(ctrl)
|
|
{
|
|
uiName = UIConst.SubUnlockUI;
|
|
this.ctrl = ctrl;
|
|
}
|
|
|
|
protected override void SetUIInfo(UIInfo uiInfo)
|
|
{
|
|
uiInfo.packageName = "LG_Unlock";
|
|
uiInfo.assetName = "com_SubUnlock";
|
|
uiInfo.layerType = UILayerType.Popup;
|
|
uiInfo.isNeedOpenAnim = false;
|
|
uiInfo.isNeedCloseAnim = false;
|
|
uiInfo.isNeedUIMask = true;
|
|
}
|
|
|
|
#region 生命周期
|
|
protected override void OnInit()
|
|
{
|
|
//model = ModuleManager.Instance.GetModel(ModelConst.SubUnlockModel) as SubUnlockModel;
|
|
}
|
|
|
|
protected override void OnClose()
|
|
{
|
|
closeCallback?.Invoke();
|
|
}
|
|
|
|
protected override void OnBind()
|
|
{
|
|
ui = baseUI as FGUI.LG_Unlock.com_SubUnlock;
|
|
}
|
|
|
|
protected override void OnOpenBefore(object args)
|
|
{
|
|
InitView();
|
|
|
|
TrackKit.SendEvent(ADEventTrack.Subscription, ADEventTrack.Property.vip_show_sell);
|
|
|
|
}
|
|
|
|
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.BuyVip, refrsh);
|
|
}
|
|
protected override void RemoveListener()
|
|
{
|
|
GameDispatcher.Instance.RemoveListener(GameMsg.BuyVip, refrsh);
|
|
}
|
|
#endregion
|
|
private void refrsh(object a = null)
|
|
{
|
|
GameHelper.ShowTips("unlock_vip", true);
|
|
CtrlCloseUI();
|
|
}
|
|
private Action closeCallback;
|
|
//初始化页面逻辑
|
|
private void InitView()
|
|
{
|
|
ui.btn_close.SetClick(() =>
|
|
{
|
|
CtrlCloseUI();
|
|
});
|
|
|
|
SkeletonAnimation ske_pot = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_parent, Fx_Type.fx_chatphone, ref closeCallback);
|
|
ske_pot.state.SetAnimation(0, "animation", true);
|
|
var vip_list = ConfigSystem.GetConfig<VipClub>();
|
|
ui.text_unlockLive.SetVar("num", GameHelper.GetCommonModel().UnlockLive[1].ToString()).FlushVars();
|
|
ui.text_unlockAlbum.SetVar("num", GameHelper.GetCommonModel().UnlockSecret[1].ToString()).FlushVars();
|
|
ui.btn_vip0.text_price.text = GameHelper.getPrice((decimal)vip_list[0].DiscountPrice);
|
|
ui.btn_vip1.text_price.text = GameHelper.getPrice((decimal)vip_list[1].DiscountPrice);
|
|
ui.btn_vip2.text_price.text = GameHelper.getPrice((decimal)vip_list[2].DiscountPrice);
|
|
ui.btn_vip0.SetClick(() =>
|
|
{
|
|
string _type = "vip_club" + 0;
|
|
ApplePayClass maxPayData = new ApplePayClass
|
|
{
|
|
amount = (int)System.Math.Round(vip_list[0].DiscountPrice * 100),
|
|
sku = IAPPayManager.PRODUCT_VIP_WEEK,
|
|
currency = "USD",
|
|
shopName = _type
|
|
};
|
|
MaxPayManager.Instance.Buy(maxPayData);
|
|
});
|
|
|
|
ui.btn_vip1.SetClick(() =>
|
|
{
|
|
string _type = "vip_club" + 1;
|
|
ApplePayClass maxPayData = new ApplePayClass
|
|
{
|
|
amount = (int)System.Math.Round(vip_list[1].DiscountPrice * 100),
|
|
sku = IAPPayManager.PRODUCT_VIP_MONTH,
|
|
currency = "USD",
|
|
shopName = _type
|
|
};
|
|
MaxPayManager.Instance.Buy(maxPayData);
|
|
});
|
|
|
|
ui.btn_vip2.SetClick(() =>
|
|
{
|
|
string _type = "vip_club" + 2;
|
|
ApplePayClass maxPayData = new ApplePayClass
|
|
{
|
|
amount = (int)System.Math.Round(vip_list[2].DiscountPrice * 100),
|
|
sku = IAPPayManager.PRODUCT_VIP_YEAR,
|
|
currency = "USD",
|
|
shopName = _type
|
|
};
|
|
MaxPayManager.Instance.Buy(maxPayData);
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} |