update:更新flexion 以及sdk 接入

This commit is contained in:
2026-04-29 20:43:16 +08:00
parent c0b6ccf7ed
commit 66aa7a931b
52 changed files with 2100 additions and 568 deletions

View File

@@ -1,62 +1,14 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
namespace tysdk
{
public enum EAccoutType
{
hwGoogle,
hwFacebook,
hwGuest,
hwVkid,
Apple,
none
}
public static class AccountString
{
public const string hwVkid = "vk.global.app";
}
public class LoginInfo
{
public bool isSuccess;
public int userId;
public string StrUserId => userId.ToString();
public string msg;
public int code;
}
public class LinkResult
{
// 0: success, 1: fail, -1 exists
public int code;
// when success and fail userId is current user
// when exists userId is 0
public int userId;
// not none when exists
public Dictionary<string, string> bindInfo;
}
public class ChangeLinkResult
{
public int code;
public int userId;
public string msg;
}
public class LinkCheckInfo
{
public int code;
}
public class PaymentInfo
{
public bool isSuccessFromSdk => code == "0";
public bool isSuccess => isSuccessFromSdk && confirmed;
private bool confirmed {get; set;} = false;
private bool confirmed { get; set; } = false;
public int count;
public string orderId;
public string productId;
@@ -65,21 +17,26 @@ namespace tysdk
public string code;
public string msg;
// Flexion: purchase.getOriginalJson(), used by server for RSA signature verification
public string purchaseJson;
// Flexion: purchase.getSignature(), used by server for RSA signature verification
public string signature;
public bool Check(string orderId, string productId)
{
confirmed = orderId == this.orderId && productId == this.productId;
if(!confirmed)
if (!confirmed)
UnityEngine.Debug.LogWarning("[TYSdk Pay] order not confirmed");
return confirmed;
}
public override string ToString()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
return JsonConvert.SerializeObject(this);
}
}
public class ProductListInfo
{
public int code = 1;
@@ -103,7 +60,6 @@ namespace tysdk
products = prodList;
}
#endif
}
#if UNITY_IOS
@@ -124,7 +80,7 @@ namespace tysdk
public override string ToString()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
return JsonConvert.SerializeObject(this);
}
}
#else
@@ -132,28 +88,30 @@ namespace tysdk
{
public string description;
public string ourProductId;
public string productId;
public string price;
public string price_amount_micros;
public string price_currency_code;
public string productId;
public string title;
public string type;
public override string ToString()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}
// RuStore specific
public string currency;
public string price_amount;
public string ProdPriceStr => price;
public float ProdPrice => float.Parse(price_amount_micros) / 1000000;
public string ProdPriceStr => ChannelConfig.Channel == "Rustore"
? $"₽{ProdPrice}"
: price;
public float ProdPrice => ChannelConfig.Channel == "Rustore"
? float.Parse(price) / 100
: float.Parse(price_amount_micros) / 1000000;
public string ProdID => ourProductId;
public string ProdKey => productId;
public override string ToString()
{
return JsonConvert.SerializeObject(this);
}
}
#endif
public class ATTInfo
{
public bool isAccepted;
}
}