fix:1、更换项目,使用winter来创建

This commit is contained in:
2026-04-22 11:13:16 +08:00
parent 173cfb2dc9
commit 83ff9f71ad
7375 changed files with 209752 additions and 157557 deletions
+239 -487
View File
@@ -1,528 +1,280 @@
using UnityEngine;
using System;
using FlowerPower;
using DG.Tweening;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEngine.Purchasing;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
using SGModule.ApplePay;
using SGModule.NetKit;
using UnityEngine;
using LoveLegend;
using UnityEngine.Purchasing;
using Newtonsoft.Json;
public class PurchasingManager : IStoreListener
public enum PayType
{
public static readonly PurchasingManager Instance = new PurchasingManager();
private IStoreController storeController;
private static IExtensionProvider extensionProvider;
private static IAppleExtensions appleExtension;
// private static IGooglePlayStoreExtensions googleExtension;
buy_one,
buy_one_off,
buy_gold_1,
buy_gold_2,
buy_gold_3,
buy_gold_4,
buy_gold_5,
remove_ad,
battle_pass,
pack_reward,
fail_pack,
three_days_gift,
weekly_subscription,
monthly_subscription,
yearly_subscription,
}
private Action<string> failedCallback;
private Action<Product> successedCallback;
public class PurchasingManager
{
private ApplePayClass applePayData;
private static readonly List<ApplePay> PayConfig = ConfigSystem.GetConfig<ApplePay>();
private static readonly List<ApplePay2> PayConfig2 = ConfigSystem.GetConfig<ApplePay2>();
PurchasingManager()
public static string GetPaySku(PayType key)
{
string keys = "";
}
/// <summary>
/// 初始化商品
/// 建议在游戏初始化完成的时候就去初始化商品
/// </summary>
public void InitProduct()
{
Debug.Log("[barry] InitProduct111;;;;;;;;;;;;;;;;;;;");
if (IsInitialized()) return;
Debug.Log("[barry] InitProduct222;;;;;;;;;;;;;;;;;;;");
var module = StandardPurchasingModule.Instance();
ConfigurationBuilder builder = ConfigurationBuilder.Instance(module);
builder.AddProduct(buy_one, ProductType.NonConsumable); //买格子
builder.AddProduct(buy_one_off, ProductType.NonConsumable);//买格子折扣
builder.AddProduct(buy_gold_1, ProductType.Consumable);//购买金币
builder.AddProduct(buy_gold_2, ProductType.Consumable);
builder.AddProduct(buy_gold_3, ProductType.Consumable);
builder.AddProduct(buy_gold_4, ProductType.Consumable);
builder.AddProduct(buy_gold_5, ProductType.Consumable);
builder.AddProduct(remove_ad, ProductType.Consumable);//移出广告
builder.AddProduct(battle_pass, ProductType.Consumable);//战令解锁
builder.AddProduct(pack_reward, ProductType.Consumable);//奖励礼包
builder.AddProduct(fail_pack, ProductType.Consumable);//失败礼包
builder.AddProduct(three_days_gift, ProductType.Consumable);//三天礼包
UnityPurchasing.Initialize(this, builder);
}
public const string buy_one = "com.flowerpower.space.24.99";
public const string buy_one_off = "com.flowerpower.space2.14.99";
public const string buy_gold_1 = "com.flowerpower.shop.1.99";
public const string buy_gold_2 = "com.flowerpower.shop.3.99";
public const string buy_gold_3 = "com.flowerpower.shop.9.99";
public const string buy_gold_4 = "com.flowerpower.shop.19.99";
public const string buy_gold_5 = "com.flowerpower.shop.39.99";
public const string remove_ad = "com.flowerpower.remove2.2.99";
public const string battle_pass = "com.flowerpower.pass2.9.99";
public const string pack_reward = "com.flowerpower.gift.1.99";
public const string fail_pack = "com.flowerpower.fail.1.99";
public const string three_days_gift = "com.flowerpower.threeday.3.99";
/// <summary>
/// 发起内购
/// </summary>
/// <param name="_productId">要购买的商品ID</param>
/// <param name="_successedCallback">购买成功回调</param>
/// <param name="_failedCallback">购买失败回调</param>/* */
public void Purchase(ApplePayClass data_)
{
string _productId = data_.sku;
Debug.Log($"[barry] Purchase;;;;;;;;;;;;;;;;;;;{_productId}\n data=== {JsonConvert.SerializeObject(data_)}");
// #if !UNITY_EDITOR
if (Time.time - SaveData.pay_time < 5)
if (PayConfig != null)
{
GameHelper.ShowTips("Clicks are too frequent");
return;
}
SaveData.pay_time = Time.time;
if (data_.sku == buy_one)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.buy_one_click, 1);
}
if (data_.sku == buy_one_off)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.BuyOneOffClick, 1);
}
else if (data_.sku == remove_ad)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.remove_ad_click, 1);
}
else if (data_.sku == pack_reward)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pack_click, 1);
}
else if (data_.shopName != null && data_.shopName.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = data_.shopName[startIndex..]; // 截取 "gold" 后的所有字符
string eventClickName = $"gold_click_{suffix}";
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, eventClickName, 1);
}
else if (data_.sku == battle_pass)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pass_click, 1);
}
else if (data_.sku == fail_pack)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.fail_click, 1);
}
else if (data_.sku == three_days_gift)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.three_days_gift_click, 1);
}
ApplePay(data_);
//#else
Debug.Log("[barry] Purchase;;;;;;;;;;;;;;;;;;;");
// GameDispatcher.Instance.Dispatch(GameMsg.apple_pay_success, data_.sku);
}
private void ApplePay(ApplePayClass data_)
{
string _productId = data_.sku;
if (applePayData != null)
{
GameHelper.ShowTips("There are payments that are being processed");
return;
}
if (!IsInitialized())
{
OnFailedCallback("Not initialized.");
return;
}
var product = storeController.products.WithID(_productId);
if (product == null || !product.availableToPurchase)
{
OnFailedCallback("Either is not found or is not available for purchase");
return;
}
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Open);
applePayData = data_;
NetworkKit.PostWithHeader<ApplePayClass>("shop/applePayCreate", applePayData, (isSuccess, obj) =>
{
if (isSuccess)
foreach (var data in PayConfig)
{
Debug.Log($"barry shop/applePayCreate ----{obj.innerOrderId}");
applePayData.innerOrderId = obj.innerOrderId;
storeController.InitiatePurchase(product);
} else {
Debug.Log("barry shop/applePayCreate ---- fail");
if (data.payKey != key.ToString()) continue;
keys = data.sku;
break;
}
}
return keys;
}
public static int GetVipLvFormConfig(string sku)
{
var lv = 1;
if (GetPaySku(PayType.weekly_subscription) == sku)
{
lv = 1;
}
else if (GetPaySku(PayType.monthly_subscription) == sku)
{
lv = 2;
}
else if (GetPaySku(PayType.yearly_subscription) == sku)
{
lv = 3;
}
return lv;
}
public static void Purchase(ApplePayData payData)
{
//本地测试
// TestIOSPay(payData);
// return;
Debug.Log($"[Apple Pay] unity Purchase--0-----: {payData.sku}");
ApplePayManager.Instance.Purchase(payData.sku, ApplePaySuccessCallback(payData), message =>
{
Debug.Log("purchase fail------- reason: " + message);
});
}
//private List<Product> product_list = new List<Product>();
/// <summary>
/// IOS恢复内购
/// 会在删除应用后,第一次安装是自动恢复
/// </summary>
/// <param name="restoreCallback">恢复回调</param>
public void IosRestore(Action<bool, string> restoreCallback)
public static Action<ApplePayBackType, AppleResponseData> ApplePaySuccessCallback(ApplePayData payData)
{
if (appleExtension != null)
return (backType, AppleResponseData) =>
{
appleExtension.RestoreTransactions((success, message) =>
Debug.Log($"[Apple Pay] unity Purchase--1-----: {backType.ToString()}");
switch (backType)
{
// var purchasedProducts = appleExtension.GetProductDetails();
// foreach (var product in purchasedProducts) {
// string productId = product.ProductId;
// }
restoreCallback(success, message);
if (!success)
{
Debug.LogWarning($"Restore transactions failed: {message}");
}
});
}
else
{
Debug.LogWarning("IAppleExtensions is null");
restoreCallback(false, "");
}
}
case ApplePayBackType.Create:
Debug.Log("[Apple Pay] Create");
var sku0 = SetSku(payData);
Debug.Log($"[Apple Pay] Create---11: {sku0}");
SendEventClickByName(sku0, "click");
break;
case ApplePayBackType.Check:
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
//======================================分割线=========================================
public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
{
Debug.Log("[barry] OnInitialized-----------w-");
storeController = controller;
extensionProvider = extensions;
appleExtension = extensions.GetExtension<IAppleExtensions>();
//googleExtension = extensions.GetExtension<IGooglePlayStoreExtensions>();
}
public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
{
Debug.Log("[barry] uuuuuuuuuuuuuuuuuuuu" + product.transactionID);
if (applePayData == null) return;
Debug.Log("[barry] applePayData.sku" + applePayData.sku);
if (applePayData.sku == buy_one)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.buy_one_open, 1);
}
if (applePayData.sku == buy_one_off)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.BuyOneOffOpen, 1);
}
else if (applePayData.sku == remove_ad)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.remove_ad_open, 1);
}
else if (applePayData.sku == pack_reward)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pack_open, 1);
}
else if (applePayData.shopName != null && applePayData.shopName.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = applePayData.shopName[startIndex..]; // 截取 "gold" 后的所有字符
string eventOpenName = $"gold_open_{suffix}";
// string eventSuccessName = $"gold_success_{suffix}";
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, eventOpenName, 1);
}
else if (applePayData.sku == battle_pass)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pass_open, 1);
}
else if (applePayData.sku == fail_pack)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.fail_open, 1);
}
else if (applePayData.sku == three_days_gift)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.three_days_gift_open, 1);
}
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
// Debug.LogWarning("[barry] OnPurchaseFailedproduct:" + product.transactionID + " failureReason:" + failureReason);
var failData = new checkData();
failData.innerOrderId = applePayData.innerOrderId;
NetworkKit.PostWithHeader<ApplePayClass>("shop/applePayCancel", failData, (isSuccess, obj) =>
{
Debug.Log("[barry] applePayCancel:" + isSuccess);
applePayData = null;
});
// 无网络时
applePayData = null;
}
public void SaveApplePayData(Dictionary<string, ApplePayClass> payData)
{
// 保存更新后的数据
string json = JsonConvert.SerializeObject(payData);
PlayerPrefs.SetString("apple_pay_data", json);
Debug.Log($"barry SaveApplePayData json========== {json}");
}
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs purchaseEvent)
{
Debug.Log("[barry] gggggggggggggggggggggggggggggggg" + purchaseEvent.purchasedProduct.transactionID);
var payDataJson = PlayerPrefs.GetString("apple_pay_data", "{}");
Debug.Log($"[barry]1111111 payDataJson ==== {payDataJson}");
var statusDictionary = JsonConvert.DeserializeObject<Dictionary<string, ApplePayClass>>(payDataJson);
if (!statusDictionary.ContainsKey(purchaseEvent.purchasedProduct.transactionID))
{
if (applePayData == null)
{
Debug.Log("[barry] applePayClass is null");
return PurchaseProcessingResult.Complete;
}
statusDictionary.Add(purchaseEvent.purchasedProduct.transactionID, applePayData);
SaveApplePayData(statusDictionary);
applePayData = null;
}
Debug.Log($"[barry]2222222 payDataJson ==== {JsonConvert.SerializeObject(statusDictionary)}");
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Open);
ApplePaySuccess(purchaseEvent.purchasedProduct.transactionID);
return PurchaseProcessingResult.Complete;
}
public void ApplePaySuccess(string transactionID)
{
Debug.Log("apple pay StartCoroutine------" + transactionID);
CrazyAsyKit.StartCoroutine(ProcessPayData(transactionID));
}
public void startPay()
{
var payDataJson = PlayerPrefs.GetString("apple_pay_data", "{}");
var statusDictionary = JsonConvert.DeserializeObject<Dictionary<string, ApplePayClass>>(payDataJson);
foreach (var entry in statusDictionary.OrderByDescending(pair => pair.Key))
{
DOVirtual.DelayedCall(1f, () =>
{
Debug.Log($"apple pay ProcessPayData0======{entry.Key} status:{entry.Value}");
CrazyAsyKit.StartCoroutine(ProcessPayData(entry.Key));
});
}
}
public IEnumerator ProcessPayData(string orderId)
{
// 发起请求
ApplePayRequest(orderId);
yield return null; // 等待本次请求完成
}
public void ApplePayRequest(string transactionID)
{
Debug.Log($"barry applePayRequest1 transactionID==: {transactionID}");
var payDataJson = PlayerPrefs.GetString("apple_pay_data", "{}");
Debug.Log($"barry applePayRequest2 payDataJson==: {payDataJson}");
var statusDictionary = JsonConvert.DeserializeObject<Dictionary<string, ApplePayClass>>(payDataJson);
Debug.Log($"barry applePayRequest3 is exist key==: {statusDictionary.ContainsKey(transactionID)}");
if (statusDictionary.ContainsKey(transactionID))
{
ApplePayClass data_ = statusDictionary[transactionID];
var test = new checkData();
test.signedPayload = Base64Kit.Encode(transactionID, true);
test.innerOrderId = data_.innerOrderId;
Debug.Log($"barry applePayRequest4 data: {JsonConvert.SerializeObject(test)}");
NetworkKit.PostWithHeader<orderData>("shop/applePayCheck", test, (isSuccess, obj) =>
{
Debug.Log("barry applePayRequest5");
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
if (isSuccess)
{
Debug.Log("barry applePayRequest6");
statusDictionary.Remove(transactionID);
// 保存更新后的数据
SaveApplePayData(statusDictionary);
SaveingPotClass taskData = SaveData.GetSaveobject().saveingpot_history.Last();
Makeup_2 makeupVo = ConfigSystem.GetConfig<MakeupModel_2>().GetData(taskData.tableId);
SaveData.GetSaveobject().saveingpot_ch += ((float)data_.amount) / 100 * makeupVo.PayIncrease;
GameDispatcher.Instance.Dispatch(GameMsg.RefreshSaveingPot);
if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1 && GameHelper.IsGiftSwitch())
if (AppleResponseData != null && AppleResponseData.sku.Contains("sub"))
{
if ((SaveData.GetSaveobject().saveingpot_ch > taskData.amount) && (!taskData.auto_show) && !UIManager.Instance.IsExistUI(UIConst.H5UI))
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SaveingPotUI_Open);
taskData.auto_show = true;
}
DataMgr.VipExpirationTime.Value = Math.Max(DataMgr.VipExpirationTime.Value, AppleResponseData.expires_time);
var level = GetVipLvFormConfig(AppleResponseData.sku);
DataMgr.VipLevel.Value = level;
payData.sku = AppleResponseData.sku;
payData.shopName = "vip_club" + (level - 1);
}
//
string sku = data_.sku.Contains("shop") ? data_.shopName : data_.sku;
var sku = SetSku(payData);
Debug.Log($"[Apple Pay] Check sku===2===== {sku}");
GameDispatcher.Instance.Dispatch(GameMsg.apple_pay_success, sku);
Debug.Log($"[Apple Pay] Check sku===3===== {sku}");
SendEventClickByName(sku, "open");
if (data_.sku == buy_one)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.buy_one_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.buy_one_success, 1);
}
if (data_.sku == buy_one_off)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.BuyOneOffOpen, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.BuyOneOffSuccess, 1);
}
else if (data_.sku == remove_ad)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.remove_ad_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.remove_ad_success, 1);
}
else if (data_.sku == pack_reward)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pack_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pack_success, 1);
}
else if (data_.shopName != null && data_.shopName.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = data_.shopName[startIndex..]; // 截取 "gold" 后的所有字符
string eventOpenName = $"gold_open_{suffix}";
string eventSuccessName = $"gold_success_{suffix}";
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, eventOpenName, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, eventSuccessName, 1);
}
else if (data_.sku == battle_pass)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pass_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.pass_success, 1);
}
else if (data_.sku == fail_pack)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.fail_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.fail_buy_success, 1);
}
else if (data_.sku == three_days_gift)
{
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.three_days_gift_open, 1);
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.three_days_gift_buy_success, 1);
}
}
else
{
//根据code 判断是否需要重试
Debug.Log($"barry apple pay code {obj}");
if (!new List<int>() { 1021, 1026, 1027, 1028 }.Contains(obj.code))
{
ApplePayRequest(transactionID);
}
else
{
statusDictionary.Remove(transactionID);
// 保存更新后的数据
SaveApplePayData(statusDictionary);
}
}
});
}
SendEventClickByName(sku, "success");
break;
case ApplePayBackType.Cancel:
Debug.Log("[Apple Pay] Cancel");
var sku1 = SetSku(payData);
SendEventClickByName(sku1, "open");
BIManager.Instance.TrackPurchase(payData.amount, payData.currency, "0", payData.sku, "paid_err");
break;
}
};
}
private bool IsInitialized()
private static void TestIOSPay(ApplePayData payData)
{
Debug.Log("[barry 10]IsInitialized======:");
return storeController != null && extensionProvider != null;
}
private void OnFailedCallback(string _reason)
{
Debug.Log("[barry 11]OnFailedCallback Reason:" + _reason);
if (failedCallback != null)
var tranId = "";
var types = ProductType.Consumable;
if (GetPaySku(PayType.battle_pass) == payData.sku)
{
failedCallback(_reason);
tranId = "2000000983625783";
}
}
public void OnInitializeFailed(InitializationFailureReason error, string message)
{
Debug.Log("[barry] OnInitializeFailed Reason:" + error);
// throw new NotImplementedException();
HandleInitializationFailure(error);
}
public void OnInitializeFailed(InitializationFailureReason error)
{
Debug.Log("[barry] OnInitializeFailed Reason:" + error);
// throw new NotImplementedException();
HandleInitializationFailure(error);
}
private int retryCount = 0;
private const int maxRetries = 3;
private const float retryDelay = 3f;
private void HandleInitializationFailure(InitializationFailureReason error)
{
if (retryCount < maxRetries)
else if (GetPaySku(PayType.weekly_subscription) == payData.sku)
{
retryCount++;
CrazyAsyKit.StartCoroutine(RetryInitialization());
tranId = "2000000984643029";
types = ProductType.Subscription;
}
if (tranId == "") return;
ApplePayManager.Instance.ApplePayTest(types, payData.sku, tranId, ApplePaySuccessCallback(payData));
}
private static string SetSku(ApplePayData data)
{
string sku = "";
if (data.type != null && data.type == GetPaySku(PayType.remove_ad))
{
sku = data.type;
}
else if (data.sku.Contains("shop"))
{
sku = data.shopName;
}
else if (data.sku.Contains("sub"))
{
sku = data.shopName;
}
else
{
Debug.LogError("Max retry attempts reached. Initialization failed.");
// 可以在这里添加其他处理逻辑,例如通知用户
throw new NotImplementedException();
sku = data.sku;
}
return sku;
}
private static void SendEventClickByName(string name, string type)
{
if (name == null)
{
return;
}
string clickTrackKey = null;
string successTrackKey = null;
string openTrackKey = null;
if (name == GetPaySku(PayType.pack_reward))
{
clickTrackKey = ADEventTrack.Property.lucky_gift_click;
successTrackKey = ADEventTrack.Property.lucky_gift_receive;
openTrackKey = ADEventTrack.Property.first_pack_show;
}
else if (name == GetPaySku(PayType.remove_ad))
{
clickTrackKey = ADEventTrack.Property.remove_ad_click;
successTrackKey = ADEventTrack.Property.remove_ad_receive;
openTrackKey = ADEventTrack.Property.gift_show;
}
else if (name == GetPaySku(PayType.battle_pass))
{
clickTrackKey = ADEventTrack.Property.master_pass_click;
successTrackKey = ADEventTrack.Property.master_pass_receive;
openTrackKey = ADEventTrack.Property.master_pass_show;
}
else if (name == GetPaySku(PayType.buy_one))
{
clickTrackKey = ADEventTrack.Property.buy_one_click;
successTrackKey = ADEventTrack.Property.buy_one_success;
openTrackKey = ADEventTrack.Property.buy_one_show;
}
else if (name == GetPaySku(PayType.buy_one_off))
{
// clickTrackKey = ADEventTrack.Property.BuyOneOffClick;
// successTrackKey = ADEventTrack.Property.BuyOneOffSuccess;
// openTrackKey = ADEventTrack.Property.BuyOneOffShow;
}
else if (name == GetPaySku(PayType.fail_pack))
{
clickTrackKey = ADEventTrack.Property.fail_click;
successTrackKey = ADEventTrack.Property.fail_buy_success;
openTrackKey = ADEventTrack.Property.fail_show;
}
else if (name == GetPaySku(PayType.three_days_gift))
{
clickTrackKey = ADEventTrack.Property.three_days_gift_click;
successTrackKey = ADEventTrack.Property.three_days_gift_buy_success;
openTrackKey = ADEventTrack.Property.three_days_gift_show;
}
if (name.StartsWith("buy_gold"))
{
int startIndex = "buy_gold".Length;
string suffix = name[startIndex..]; // 截取 "gold" 后的所有字符
clickTrackKey = ADEventTrack.Property.gold_click_ + suffix;
successTrackKey = ADEventTrack.Property.shop_receive_ + suffix;
openTrackKey = ADEventTrack.Property.shop_show;
}
if (name.StartsWith("vip_club"))
{
int startIndex = "vip_club".Length;
string suffix = name[startIndex..]; // 截取 "gold" 后的所有字符
clickTrackKey = ADEventTrack.Property.vip_click_ + suffix;
successTrackKey = ADEventTrack.Property.vip_success_ + suffix;
openTrackKey = ADEventTrack.Property.buy_one_show;
}
if (type == "success" && successTrackKey != null)
{
TrackKit.SendEvent(ADEventTrack.IOS_Pay_Event, successTrackKey);
}
else if (type == "click" && clickTrackKey != null)
{
TrackKit.SendEvent(ADEventTrack.IOS_Pay_Event, clickTrackKey);
}
else if (type == "open" && openTrackKey != null)
{
// TrackKit.SendEvent(ADEventTrack.IOS_Pay_Event, openTrackKey);
}
}
private IEnumerator RetryInitialization()
{
yield return new WaitForSeconds(retryDelay);
InitProduct();
}
}
public class ApplePayClass
public class SubscriptionList
{
public string innerOrderId;
public string transactionId;
public int amount;
[JsonProperty("renew_time")]
public long renew_time;
[JsonProperty("renew_sku")]
public string renew_sku;
[JsonProperty("sku")]
public string sku;
public string currency = "USD";
public int status;
public string shopName;
[JsonProperty("orig_tx_id")]
public string orig_tx_id;
}
public class checkData
public class HistoryObject
{
public string signedPayload;
public string innerOrderId;
[JsonProperty("id")]
public string id;
}