feat(channel): 同步渠道构建配置

This commit is contained in:
2026-07-08 17:38:36 +08:00
parent 3da65b8cbd
commit 833f68f601
39 changed files with 870 additions and 359 deletions

View File

@@ -73,8 +73,8 @@ public class SDKTest : MonoBehaviour
IConfig config = new Config(serializer);
GContext.container.RegisterInstance<IConfig>(config);
Debug.Log("SDKTest Start");
UpdateChannelTitle();
Debug.Log("SDKTest Start");
ClearChannelTitle();
//===============================================================================
//====================== Test Server ===========================
// UnityBridgeFunc.UnityResetServerUrl("https://128-hwsfsdk-sdk-test01.qijihdhk.com");
@@ -82,12 +82,13 @@ public class SDKTest : MonoBehaviour
//====================== Test Server ===========================
//===============================================================================
//
_InitBtn.onClick.AddListener(Init);
TYSdkFacade.OnInitComplete += (success, msg) =>
{
_messageTxt.text = success ? $"Init OK: {msg}" : $"Init Failed: {msg}";
};
_loginGuestBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGuest));
_InitBtn.onClick.AddListener(Init);
TYSdkFacade.OnInitComplete += (success, msg) =>
{
_messageTxt.text = success ? $"Init OK: {msg}" : $"Init Failed: {msg}";
UpdateChannelTitle();
};
_loginGuestBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGuest));
_loginGoogleBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGoogle));
_loginFbBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwFacebook));
_loginVkBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwVkid));
@@ -111,11 +112,11 @@ public class SDKTest : MonoBehaviour
_signoutBtn.onClick.AddListener(OnSignoutBtn);
_fbShareLinkBtn.onClick.AddListener(OnFBShareLinkBtn);
_mfbShareLinkBtn.onClick.AddListener(OnMessengerShareLinkBtn);
_reviewBtn.onClick.AddListener(OnReview);
Debug.Log("SDKTest Started");
}
void Init()
_reviewBtn.onClick.AddListener(OnReview);
Debug.Log("SDKTest Started");
}
void Init()
{
_messageTxt.text = "Initializing...";
TYSdkFacade.Instance.Init();
@@ -140,19 +141,21 @@ public class SDKTest : MonoBehaviour
GContext.container.Resolve<IConfig>().Set("PAY_VERIFY_URL", "https://192.168.9.91:7036/api/FlexionCallback");
}
private void UpdateChannelTitle()
{
#if UNITY_ANDROID
using (var cls = new AndroidJavaClass("com.unity3d.player.ChannelEntry"))
{
string channel = cls.GetStatic<string>("CHANNEL");
Debug.Log($"[SDKTest] Channel from Java: {channel}");
_titleText.text = $" {channel}";
}
#endif
}
int retryAttempt;
private void UpdateChannelTitle()
{
#if UNITY_ANDROID
string channel = ChannelConfig.Channel;
Debug.Log($"[SDKTest] Channel from ChannelConfig: {channel}");
_titleText.text = $" {channel}";
#endif
}
private void ClearChannelTitle()
{
_titleText.text = string.Empty;
}
int retryAttempt;
public void InitializeRewardedAds()
{
@@ -211,10 +214,11 @@ public class SDKTest : MonoBehaviour
{
_messageTxt.text = "";
if (ChannelConfig.Channel.Equals("Flexion"))
{
sku = new SKUDetail
{
var channel = ChannelConfig.Channel;
if (string.Equals(channel, "Flexion"))
{
sku = new SKUDetail
{
productId = "com.arkgame.ft.pack0199",
ourProductId = "com.arkgame.ft.pack0199",
price = "1.99",
@@ -223,10 +227,10 @@ public class SDKTest : MonoBehaviour
type = "inapp"
};
}
else if (ChannelConfig.Channel.Equals("EnjoyPay"))
{
sku = new SKUDetail
{
else if (string.Equals(channel, "EnjoyPay"))
{
sku = new SKUDetail
{
productId = "comarkgameftpack0199",
ourProductId = "comarkgameftpack0199",
price = "1.99",
@@ -235,13 +239,19 @@ public class SDKTest : MonoBehaviour
type = "inapp"
};
}
if (sku == null){
_messageTxt.text = "no product";
return;
}
#if !UNITY_EDITOR && UNITY_IOS
sku.productId = "comarkgameftpack0199";
if (sku == null){
_messageTxt.text = "no product";
return;
}
if (!TYSdkFacade.IsLoggedIn)
{
_messageTxt.text = "not logged in";
return;
}
#if !UNITY_EDITOR && UNITY_IOS
sku.productId = "comarkgameftpack0199";
sku.title = "商店-体力直充1.99" ;
sku.price = "1.99";
#endif