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

@@ -58,13 +58,21 @@ public class BuildTool
[MenuItem("Tools/Build Android")]
public static void BuildAndroid()
{
ChannelBuildTool.Build_GooglePlay();
ChannelBuildTool.SwitchChannel("GooglePlay");
BuildAndroid(new BuildParams
{
outPath = "../Bin/tysdkTest_GooglePlay.apk"
});
}
[MenuItem("Tools/Build Android With Debug")]
public static void BuildAndroidWithDebug()
{
ChannelBuildTool.Build_GooglePlay_Debug();
ChannelBuildTool.SwitchChannel("GooglePlay");
BuildAndroid(new BuildParams
{
outPath = "../Bin/tysdkTest_GooglePlay_debug.apk"
}, BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.WaitForPlayerConnection);
}
public static void CIBuildAndroid()

View File

@@ -1,103 +1,71 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEditor.AddressableAssets;
using UnityEngine;
public class ChannelBuildTool
{
public static readonly string[] SupportedChannels = { "GooglePlay", "Rustore", "Flexion", "EnjoyPay" };
private const string DefaultChannel = "GooglePlay";
private const string DefaultAndroidBundleIdentifier = "com.arkgame.ft";
private const string ExtraCfgRoot = "../ExtraPluginCfgs/Android";
private const string TysdkPlugins = "Packages/tysdk/Plugins/Android";
private const string TysdkFiles = "Packages/tysdk/Files";
private const string AssetsPlugins = "Assets/Plugins/Android";
private static readonly string[] GradleFiles =
{
"mainTemplate.gradle",
"launcherTemplate.gradle",
"settingsTemplate.gradle",
"gradleTemplate.properties",
"AndroidManifest.xml"
};
private const string AddressablesContentState = "AddressableAssetsData/Android/addressables_content_state.bin";
private const string AndroidAddressablesContentState = "Assets/AddressableAssetsData/Android/addressables_content_state.bin";
private const string DefaultProductName = "Fishing Travel";
private const string EnjoyPayProductName = "Fishing Travel: Hook & Explore";
// ==================== Channel Switching ====================
private static void SwitchChannel(string channel)
public static void SwitchChannel(string channel)
{
var channelDir = channel.ToLower();
var cfgDir = Path.Combine(ExtraCfgRoot, channelDir);
channel = NormalizeChannelName(channel);
var cfgDir = Path.Combine(ExtraCfgRoot, channel.ToLowerInvariant());
if (!Directory.Exists(cfgDir))
{
Debug.LogError($"[ChannelSwitch] Channel config not found: {cfgDir}");
return;
throw new DirectoryNotFoundException($"[ChannelSwitch] Channel config not found: {cfgDir}");
}
Debug.Log($"[ChannelSwitch] Switching to {channel}...");
currentChannel = channel;
// 1. Sync AAR
var srcAarDir = Path.Combine(cfgDir, "Plugins/Android");
if (Directory.Exists(srcAarDir))
{
foreach (var oldAar in Directory.GetFiles(TysdkPlugins, "tuyoosdk_*.aar"))
File.Delete(oldAar);
foreach (var oldJar in Directory.GetFiles(TysdkPlugins, "tuyoosdk_*.jar"))
File.Delete(oldJar);
foreach (var aar in Directory.GetFiles(srcAarDir, "*.aar"))
{
var dest = Path.Combine(TysdkPlugins, Path.GetFileName(aar));
File.Copy(aar, dest, true);
Debug.Log($"[ChannelSwitch] AAR: {aar} → {dest}");
}
}
// 1. Sync root Android config files
SyncRootAndroidConfigFiles(cfgDir);
// 2. Clean up previous channel Java files
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "ChannelHelpers.java"))
File.Delete(oldJava);
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "ChannelEntry.java"))
File.Delete(oldJava);
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "*SDKHelper.java"))
File.Delete(oldJava);
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "*SDKService.java"))
File.Delete(oldJava);
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "*SDKAdapter.java"))
File.Delete(oldJava);
var oldConfig = Path.Combine(TysdkPlugins, "ConfigManager.java");
if (File.Exists(oldConfig)) File.Delete(oldConfig);
// 2. Sync channel SDK adapter Java files to tysdk package
SyncChannelAdapterFiles(cfgDir);
// 3. Sync Gradle + Manifest
foreach (var fileName in GradleFiles)
{
var src = Path.Combine(cfgDir, fileName);
if (File.Exists(src))
{
var dest = Path.Combine(AssetsPlugins, fileName);
File.Copy(src, dest, true);
Debug.Log($"[ChannelSwitch] Config: {src} → {dest}");
}
}
// 4. Sync channel Java files to tysdk package
foreach (var javaFile in Directory.GetFiles(cfgDir, "*.java"))
{
var fileName = Path.GetFileName(javaFile);
var dest = Path.Combine(TysdkPlugins, fileName);
File.Copy(javaFile, dest, true);
Debug.Log($"[ChannelSwitch] Java: {javaFile} → {dest}");
}
// 5. Sync google-services.json (fallback to GooglePlay default)
// 3. Sync google-services.json
var srcGoogleServices = Path.Combine(cfgDir, "Files/google-services.json");
if (!File.Exists(srcGoogleServices))
srcGoogleServices = Path.Combine(ExtraCfgRoot, "googleplay/Files/google-services.json");
var destGoogleServices = Path.Combine(TysdkFiles, "google-services.json");
File.Copy(srcGoogleServices, destGoogleServices, true);
Debug.Log($"[ChannelSwitch] google-services.json: {srcGoogleServices} → {destGoogleServices}");
if (File.Exists(srcGoogleServices))
{
var destDir = Path.Combine(TysdkFiles);
if (!Directory.Exists(destDir)) Directory.CreateDirectory(destDir);
var destGoogleServices = Path.Combine(destDir, "google-services.json");
File.Copy(srcGoogleServices, destGoogleServices, true);
Debug.Log($"[ChannelSwitch] google-services.json -> {destGoogleServices}");
}
// 6. Set Bundle Identifier per channel
// 4. Sync channel plugin files (.aar, .jar, etc.) to tysdk package
var pluginsSrcDir = Path.Combine(cfgDir, "Plugins/Android");
var pluginsDestDir = TysdkPlugins;
if (Directory.Exists(pluginsSrcDir))
{
foreach (var oldPlugin in Directory.GetFiles(pluginsDestDir, "tuyoosdk_*.aar"))
File.Delete(oldPlugin);
foreach (var pluginFile in Directory.GetFiles(pluginsSrcDir))
{
if (pluginFile.EndsWith(".meta")) continue;
var fileName = Path.GetFileName(pluginFile);
var dest = Path.Combine(pluginsDestDir, fileName);
File.Copy(pluginFile, dest, true);
Debug.Log($"[ChannelSwitch] Plugin: {pluginFile} -> {dest}");
}
}
// 5. Set Bundle Identifier per channel
var bundleId = channel switch
{
"Flexion" => "com.arkgame.ft.flexion",
@@ -105,25 +73,38 @@ public class ChannelBuildTool
_ => "com.arkgame.ft"
};
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, bundleId);
Debug.Log($"[CHANNEL-VERIFY] Bundle Identifier {bundleId}");
Debug.Log($"[ChannelSwitch] Bundle Identifier -> {bundleId}");
// 7. Set runtime channel
var productName = channel == "EnjoyPay" ? EnjoyPayProductName : DefaultProductName;
PlayerSettings.productName = productName;
Debug.Log($"[ChannelSwitch] Product Name -> {productName}");
// 6. Set runtime channel
tysdk.ChannelConfig.SetChannel(channel);
// 7. Set Addressables profile and optional channel content state
SetAddressablesProfile(channel);
SyncAddressablesContentState(channel, cfgDir);
AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
Debug.Log($"[ChannelSwitch] Done. Channel: {channel}");
}
// ==================== Build ====================
// ==================== Menu ====================
private static void RestoreDefaultChannel()
{
Debug.Log($"[ChannelBuild] Restore default channel -> {DefaultChannel}");
SwitchChannel(DefaultChannel);
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, DefaultAndroidBundleIdentifier);
Debug.Log($"[ChannelBuild] Restore bundle identifier -> {DefaultAndroidBundleIdentifier}");
AssetDatabase.SaveAssets();
}
[MenuItem("Tools/Channel/Switch Channel/GooglePlay", false, 10000)]
public static void Switch_GooglePlay() => SwitchChannel("GooglePlay");
[MenuItem("Tools/Channel/Switch Channel/Flexion", false, 10001)]
public static void Switch_Flexion() => SwitchChannel("Flexion");
[MenuItem("Tools/Channel/Switch Channel/Rustore", false, 10002)]
public static void Switch_Rustore() => SwitchChannel("Rustore");
[MenuItem("Tools/Channel/Switch Channel/EnjoyPay", false, 10003)]
public static void Switch_EnjoyPay() => SwitchChannel("EnjoyPay");
// ==================== Build ====================
private static void BuildAndroidForChannel(string channel, bool debug)
{
@@ -131,8 +112,8 @@ public class ChannelBuildTool
{
SwitchChannel(channel);
string fileName = debug ? $"tysdkTest_{channel}_debug.apk" : $"tysdkTest_{channel}.apk";
string outPath = $"../Bin/{fileName}";
var fileName = debug ? $"tysdkTest_{channel}_debug.apk" : $"tysdkTest_{channel}.apk";
var outPath = $"../Bin/{fileName}";
var buildOptions = debug
? BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.WaitForPlayerConnection
: BuildOptions.None;
@@ -145,7 +126,7 @@ public class ChannelBuildTool
options = buildOptions,
};
Debug.Log($"[ChannelBuild] Building {channel} {outPath}");
Debug.Log($"[ChannelBuild] Building {channel} -> {outPath}");
var buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);
if (buildReport?.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
@@ -160,49 +141,157 @@ public class ChannelBuildTool
}
finally
{
RestoreDefaultChannel();
SwitchChannel("GooglePlay");
AssetDatabase.SaveAssets();
}
}
private static string currentChannel = "";
// ==================== Menu: Switch Channel ====================
[MenuItem("Tools/Switch Channel/GooglePlay")]
public static void Switch_GooglePlay() => SwitchChannel("GooglePlay");
[MenuItem("Tools/Switch Channel/Rustore")]
public static void Switch_Rustore() => SwitchChannel("Rustore");
[MenuItem("Tools/Switch Channel/Flexion")]
public static void Switch_Flexion() => SwitchChannel("Flexion");
[MenuItem("Tools/Switch Channel/EnjoyPay")]
public static void Switch_EnjoyPay() => SwitchChannel("EnjoyPay");
// ==================== Menu: Build ====================
[MenuItem("Tools/Build Android (Channel)/GooglePlay")]
[MenuItem("Tools/Channel/Build Android (Channel)/GooglePlay", false, 10100)]
public static void Build_GooglePlay() => BuildAndroidForChannel("GooglePlay", false);
[MenuItem("Tools/Build Android (Channel)/GooglePlay Debug")]
[MenuItem("Tools/Channel/Build Android (Channel)/GooglePlay Debug", false, 10101)]
public static void Build_GooglePlay_Debug() => BuildAndroidForChannel("GooglePlay", true);
[MenuItem("Tools/Build Android (Channel)/Rustore")]
[MenuItem("Tools/Channel/Build Android (Channel)/Rustore", false, 10102)]
public static void Build_Rustore() => BuildAndroidForChannel("Rustore", false);
[MenuItem("Tools/Build Android (Channel)/Rustore Debug")]
[MenuItem("Tools/Channel/Build Android (Channel)/Rustore Debug", false, 10103)]
public static void Build_Rustore_Debug() => BuildAndroidForChannel("Rustore", true);
[MenuItem("Tools/Build Android (Channel)/Flexion")]
[MenuItem("Tools/Channel/Build Android (Channel)/Flexion", false, 10104)]
public static void Build_Flexion() => BuildAndroidForChannel("Flexion", false);
[MenuItem("Tools/Build Android (Channel)/Flexion Debug")]
[MenuItem("Tools/Channel/Build Android (Channel)/Flexion Debug", false, 10105)]
public static void Build_Flexion_Debug() => BuildAndroidForChannel("Flexion", true);
[MenuItem("Tools/Build Android (Channel)/EnjoyPay")]
[MenuItem("Tools/Channel/Build Android (Channel)/EnjoyPay", false, 10106)]
public static void Build_EnjoyPay() => BuildAndroidForChannel("EnjoyPay", false);
[MenuItem("Tools/Build Android (Channel)/EnjoyPay Debug")]
[MenuItem("Tools/Channel/Build Android (Channel)/EnjoyPay Debug", false, 10107)]
public static void Build_EnjoyPay_Debug() => BuildAndroidForChannel("EnjoyPay", true);
private static string NormalizeChannelName(string channel)
{
if (string.IsNullOrEmpty(channel))
return channel;
switch (channel.Trim().ToLowerInvariant())
{
case "googleplay":
return "GooglePlay";
case "flexion":
return "Flexion";
case "enjoypay":
return "EnjoyPay";
case "rustore":
return "Rustore";
default:
return channel.Trim();
}
}
private static void SyncRootAndroidConfigFiles(string cfgDir)
{
CopyRootConfigFiles(cfgDir, "*.gradle");
CopyRootConfigFiles(cfgDir, "*.properties");
CopyRootConfigFile(cfgDir, "AndroidManifest.xml");
}
private static void SyncChannelAdapterFiles(string cfgDir)
{
// ChannelAdapterManager, ChannelAdapterBase, ConfigManager and SDKManager
// are fixed platform files and are not copied per channel.
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "*Adapter.java"))
{
File.Delete(oldJava);
}
foreach (var javaFile in Directory.GetFiles(cfgDir, "*Adapter.java"))
{
var fileName = Path.GetFileName(javaFile);
var dest = Path.Combine(TysdkPlugins, fileName);
File.Copy(javaFile, dest, true);
Debug.Log($"[ChannelSwitch] Adapter: {javaFile} -> {dest}");
}
}
private static void CopyRootConfigFiles(string cfgDir, string searchPattern)
{
foreach (var src in Directory.GetFiles(cfgDir, searchPattern, SearchOption.TopDirectoryOnly))
{
CopyRootConfigFile(src);
}
}
private static void CopyRootConfigFile(string cfgDir, string fileName)
{
var src = Path.Combine(cfgDir, fileName);
if (File.Exists(src))
{
CopyRootConfigFile(src);
}
}
private static void CopyRootConfigFile(string src)
{
var fileName = Path.GetFileName(src);
var dest = Path.Combine(AssetsPlugins, fileName);
File.Copy(src, dest, true);
Debug.Log($"[ChannelSwitch] Config: {src} -> {dest}");
}
private static void SetAddressablesProfile(string channel)
{
var settings = AddressableAssetSettingsDefaultObject.Settings;
if (settings == null)
{
Debug.LogWarning("[ChannelSwitch] Addressables settings not found.");
return;
}
var profileName = UsesRustoreAddressablesProfile(channel) ? "arksgameru" : "arksgamecos";
var profileId = settings.profileSettings.GetProfileId(profileName);
if (string.IsNullOrEmpty(profileId))
{
Debug.LogError($"[ChannelSwitch] Addressables profile not found: {profileName}");
return;
}
settings.activeProfileId = profileId;
var remoteLoadPath = settings.RemoteCatalogLoadPath.GetValue(settings);
var remoteBuildPath = settings.RemoteCatalogBuildPath.GetValue(settings);
Debug.Log($"[ChannelSwitch] Addressables profile -> {profileName}, profileId={profileId}, Remote.LoadPath={remoteLoadPath}, Remote.BuildPath={remoteBuildPath}");
}
private static void SyncAddressablesContentState(string channel, string cfgDir)
{
var src = Path.Combine(cfgDir, AddressablesContentState);
if (!File.Exists(src) && UsesRustoreAddressablesContentState(channel))
{
Debug.Log($"[ChannelSwitch] Channel content state not found, try legacy Rustore content state path. Channel={channel}, checked={src}");
src = Path.Combine("../ExtraPluginCfgs", AddressablesContentState);
}
if (!File.Exists(src))
{
Debug.Log($"[ChannelSwitch] Addressables content state not copied. Channel={channel}, checked={src}");
return;
}
var destDir = Path.GetDirectoryName(AndroidAddressablesContentState);
if (!Directory.Exists(destDir)) Directory.CreateDirectory(destDir);
File.Copy(src, AndroidAddressablesContentState, true);
Debug.Log($"[ChannelSwitch] Addressables content state: {src} -> {AndroidAddressablesContentState}");
}
private static bool UsesRustoreAddressablesContentState(string channel)
{
return channel == "Rustore" || channel == "EnjoyPay";
}
private static bool UsesRustoreAddressablesProfile(string channel)
{
return channel == "Rustore" || channel == "EnjoyPay";
}
}

View File

@@ -36,7 +36,7 @@
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="true" />
</activity>
<meta-data android:name="CHANNEL" android:value="GooglePlay" />
<meta-data android:name="com.arkgame.ft.channel" android:value="GooglePlay" />
</application>
<queries>
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->

View File

@@ -3,8 +3,8 @@ apply plugin: 'com.google.gms.google-services'
dependencies {
implementation project(':unityLibrary')
implementation(platform("com.google.firebase:firebase-bom:33.6.0"))
implementation("com.google.firebase:firebase-analytics")
implementation platform('com.google.firebase:firebase-bom:34.6.0')
implementation 'com.google.firebase:firebase-analytics'
}
android {
@@ -17,7 +17,6 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {

View File

@@ -60,18 +60,24 @@ dependencies {
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
// Android Resolver Dependencies Start
implementation 'androidx.recyclerview:recyclerview:1.2.1' // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:9
implementation 'com.android.installreferrer:installreferrer:2.1' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:7
implementation 'com.applovin.mediation:bytedance-adapter:8.1.0.3.0' // Assets/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml:8
implementation 'com.applovin.mediation:facebook-adapter:[6.18.0.1]' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:8
implementation 'com.applovin.mediation:fyber-adapter:8.4.2.0' // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:4
implementation 'com.applovin.mediation:google-adapter:[23.6.0.1]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5
implementation 'com.applovin.mediation:ironsource-adapter:8.6.1.0.0' // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
implementation 'com.applovin.mediation:mintegral-adapter:17.1.61.0' // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:8
implementation 'com.applovin.mediation:moloco-adapter:4.9.0.0' // Assets/MaxSdk/Mediation/Moloco/Editor/Dependencies.xml:4
implementation 'com.applovin.mediation:unityads-adapter:4.12.3.0' // Assets/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml:4
implementation 'com.applovin.mediation:vungle-adapter:7.4.2.2' // Assets/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml:4
implementation 'com.applovin.mediation:yandex-adapter:8.1.0.0' // Assets/MaxSdk/Mediation/Yandex/Editor/Dependencies.xml:4
implementation 'com.applovin:applovin-sdk:13.5.1' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:4
implementation 'com.appsflyer:af-android-sdk:6.17.3' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:5
implementation 'com.appsflyer:purchase-connector:2.2.0' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:8
implementation 'com.appsflyer:unity-wrapper:6.17.7' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:6
implementation 'com.google.android.ump:user-messaging-platform:2.1.0' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:5
implementation 'com.tapjoy:tapjoy-android-unitybridge:14.5.0' // Packages/com.unity.package-offerwall/Editor/TJPluginDependencies.xml:10
// Android Resolver Dependencies End
**DEPS**}

View File

@@ -18,9 +18,18 @@ dependencyResolutionManagement {
mavenCentral()
// Android Resolver Repos Start
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
maven {
url "https://sdk.tapjoy.com/" // Packages/com.unity.package-offerwall/Editor/TJPluginDependencies.xml:9
}
maven {
url "https://artifact.bytedance.com/repository/pangle" // Assets/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml:8
}
maven {
url "https://android-sdk.is.com/" // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
}
maven {
url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:8
}
mavenLocal()
// Android Resolver Repos End
flatDir {

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