fix:1、添加支付,使用sdk的支付方案
This commit is contained in:
@@ -182,13 +182,13 @@ namespace RedHotRoast
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
GameDispatcher.Instance.AddListener(GameMsg.apple_pay_success, pay_success);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.IAP_PAY_SUCCESS, pay_success);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.BuyVip, InitView);
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.apple_pay_success, pay_success);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.IAP_PAY_SUCCESS, pay_success);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.BuyVip, InitView);
|
||||
}
|
||||
|
||||
@@ -221,6 +221,8 @@ namespace RedHotRoast
|
||||
ui.btn_restore.visible = !GameHelper.IsGiftSwitch();
|
||||
ui.btn_restore.SetClick(() =>
|
||||
{
|
||||
IAPPayManager.Instance.OnRestoreButtonClicked();
|
||||
|
||||
// ApplePayManager.Instance.AppleRestore((success, message) =>
|
||||
// {
|
||||
// Debug.Log($"[barry] restore success message: {message}---- {JsonConvert.SerializeObject(message)}");
|
||||
@@ -258,7 +260,7 @@ namespace RedHotRoast
|
||||
ApplePayClass maxPayData = new ApplePayClass
|
||||
{
|
||||
amount = (int)System.Math.Round(vip_list[_level].DiscountPrice * 100),
|
||||
sku = PurchasingManager.GetPaySku(GetTypeByIndex(_level)),
|
||||
sku = GetTypeByIndex(_level),
|
||||
currency = "USD",
|
||||
shopName = _type
|
||||
};
|
||||
@@ -278,14 +280,14 @@ namespace RedHotRoast
|
||||
ui.vip_icon_loader.url = $"ui://LG_Common/vip_{lv}";
|
||||
}
|
||||
|
||||
private PayType GetTypeByIndex(int index)
|
||||
private string GetTypeByIndex(int index)
|
||||
{
|
||||
return index switch
|
||||
{
|
||||
0 => PayType.weekly_subscription,
|
||||
1 => PayType.monthly_subscription,
|
||||
2 => PayType.yearly_subscription,
|
||||
_ => PayType.weekly_subscription
|
||||
0 => IAPPayManager.PRODUCT_VIP_WEEK,
|
||||
1 => IAPPayManager.PRODUCT_VIP_MONTH,
|
||||
2 => IAPPayManager.PRODUCT_VIP_YEAR,
|
||||
_ => IAPPayManager.PRODUCT_VIP_WEEK
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user