Compare commits
3 Commits
dev_enjoyp
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c0509da0fc | |||
| c9fe482c8c | |||
| 92d04aba61 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -5,13 +5,3 @@ sdk-intergration/.vscode
|
|||||||
sdk-intergration/'
|
sdk-intergration/'
|
||||||
sdk-intergration/Assets/.claude/settings.json
|
sdk-intergration/Assets/.claude/settings.json
|
||||||
sdk-intergration/.idea
|
sdk-intergration/.idea
|
||||||
.worktrees/*
|
|
||||||
.docs/*
|
|
||||||
.claude/*
|
|
||||||
sdk-intergration/Assets/Plugins/Android/channel_gradle/
|
|
||||||
sdk-intergration/Assets/Plugins/Android/channel_gradle.meta
|
|
||||||
sdk-intergration/Assets/Plugins/Android/channel_manifest_lib/build/
|
|
||||||
sdk-intergration/Assets/Plugins/Android/channel_manifest_lib/build.meta
|
|
||||||
ChannelConfigs/Android/*/Plugins/Android/gradle/.gradle/
|
|
||||||
ChannelConfigs/Android/*/Plugins/Android/gradle/build/
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<application>
|
|
||||||
<!-- Put channel manifest increment here. -->
|
|
||||||
</application>
|
|
||||||
</manifest>
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package com.unity3d.player;
|
|
||||||
|
|
||||||
public class ChannelAdapter extends ChannelAdapterBase {
|
|
||||||
private static class Config {
|
|
||||||
public String SDK_CLIENTID = "ReplaceWithChannelClientId";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# Files
|
|
||||||
|
|
||||||
可选目录。
|
|
||||||
|
|
||||||
如果渠道提供 `google-services.json`,放在这里:
|
|
||||||
|
|
||||||
```text
|
|
||||||
Files/google-services.json
|
|
||||||
```
|
|
||||||
|
|
||||||
没有渠道专用文件时可以保持为空。
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
# Plugins/Android
|
|
||||||
|
|
||||||
可选目录。
|
|
||||||
|
|
||||||
渠道 SDK 的 `.aar` / `.jar` 放在这里。切渠道时,这里的第一层插件文件会同步到:
|
|
||||||
|
|
||||||
```text
|
|
||||||
sdk-intergration/Packages/tysdk/Plugins/Android
|
|
||||||
```
|
|
||||||
|
|
||||||
Gradle 增量放到:
|
|
||||||
|
|
||||||
```text
|
|
||||||
Plugins/Android/gradle/
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
// Applied to :unityLibrary from mainTemplate.gradle.
|
|
||||||
// Put channel dependencies and android module config here.
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// implementation "group:name:version"
|
|
||||||
// api "group:name:version"
|
|
||||||
// coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
// compileOptions {
|
|
||||||
// coreLibraryDesugaringEnabled true
|
|
||||||
// }
|
|
||||||
|
|
||||||
// packagingOptions {
|
|
||||||
// exclude "**/unused.file"
|
|
||||||
// pickFirst "**/duplicated.file"
|
|
||||||
// }
|
|
||||||
|
|
||||||
// defaultConfig {
|
|
||||||
// manifestPlaceholders += [
|
|
||||||
// key: "value"
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Applied from settingsTemplate.gradle.
|
|
||||||
// Put channel Maven repositories or extra module includes here.
|
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
|
||||||
repositories {
|
|
||||||
// maven {
|
|
||||||
// url "https://example.maven.repo/"
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# Android 渠道接入模板
|
|
||||||
|
|
||||||
复制 `_template` 为新渠道目录,例如:
|
|
||||||
|
|
||||||
```text
|
|
||||||
ChannelConfigs/Android/mychannel
|
|
||||||
```
|
|
||||||
|
|
||||||
然后按需填写下列文件。
|
|
||||||
|
|
||||||
## 目录说明
|
|
||||||
|
|
||||||
```text
|
|
||||||
AndroidManifest.xml
|
|
||||||
ChannelAdapter.java
|
|
||||||
Files/
|
|
||||||
README.md
|
|
||||||
Plugins/
|
|
||||||
Android/
|
|
||||||
README.md
|
|
||||||
gradle/
|
|
||||||
main.gradle
|
|
||||||
settings.gradle
|
|
||||||
```
|
|
||||||
|
|
||||||
## 新增渠道步骤
|
|
||||||
|
|
||||||
1. 复制 `_template` 并改名为渠道小写目录名。
|
|
||||||
2. 将 `ChannelAdapter.java` 改名为真实 Adapter,例如 `MyChannelAdapter.java`。
|
|
||||||
3. 修改 Adapter 类名,并按渠道 SDK 文档实现需要的接口。
|
|
||||||
4. `AndroidManifest.xml` 只写渠道 Manifest 增量,不复制主 Manifest。
|
|
||||||
5. 渠道有 `google-services.json` 时放到 `Files/`。
|
|
||||||
6. 渠道有 `.aar` / `.jar` 时放到 `Plugins/Android/`。
|
|
||||||
7. 渠道要求添加依赖或 `android {}` 配置时,写到 `Plugins/Android/gradle/main.gradle`。
|
|
||||||
8. 渠道要求添加 Maven 仓库或额外 module 时,写到 `Plugins/Android/gradle/settings.gradle`。
|
|
||||||
|
|
||||||
## 不要复制这些文件
|
|
||||||
|
|
||||||
不要在渠道目录放整份 Unity Gradle 模板:
|
|
||||||
|
|
||||||
```text
|
|
||||||
mainTemplate.gradle
|
|
||||||
settingsTemplate.gradle
|
|
||||||
launcherTemplate.gradle
|
|
||||||
baseProjectTemplate.gradle
|
|
||||||
gradleTemplate.properties
|
|
||||||
```
|
|
||||||
|
|
||||||
主模板由 `sdk-intergration/Assets/Plugins/Android/` 统一维护,渠道只提供增量。
|
|
||||||
Binary file not shown.
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<application>
|
|
||||||
<meta-data
|
|
||||||
android:name="com.sensorsdata.analytics.android.MainProcessName"
|
|
||||||
android:value="${applicationId}"
|
|
||||||
tools:replace="android:value" />
|
|
||||||
</application>
|
|
||||||
</manifest>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.unity3d.player;
|
|
||||||
|
|
||||||
public class EnjoyPayAdapter extends ChannelAdapterBase {
|
|
||||||
private static class Config {
|
|
||||||
public String SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
{
|
|
||||||
"project_info": {
|
|
||||||
"project_number": "550846874481",
|
|
||||||
"project_id": "fishing-travel-ep",
|
|
||||||
"storage_bucket": "fishing-travel-ep.firebasestorage.app"
|
|
||||||
},
|
|
||||||
"client": [
|
|
||||||
{
|
|
||||||
"client_info": {
|
|
||||||
"mobilesdk_app_id": "1:550846874481:android:800f3c713738b6b51d2cd0",
|
|
||||||
"android_client_info": {
|
|
||||||
"package_name": "com.arkgame.ft.ep"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "550846874481-8thf5tv2gm5n7b7uui3kts0kajuddhn7.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"api_key": [
|
|
||||||
{
|
|
||||||
"current_key": "AIzaSyDw8YISM6R6vtHC4IfJtNBFijrKqgxlfcw"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"services": {
|
|
||||||
"appinvite_service": {
|
|
||||||
"other_platform_oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "550846874481-8thf5tv2gm5n7b7uui3kts0kajuddhn7.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"configuration_version": "1"
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
dependencies {
|
|
||||||
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileOptions {
|
|
||||||
coreLibraryDesugaringEnabled true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<application>
|
|
||||||
<meta-data
|
|
||||||
android:name="com.sensorsdata.analytics.android.MainProcessName"
|
|
||||||
android:value="${applicationId}"
|
|
||||||
tools:replace="android:value" />
|
|
||||||
|
|
||||||
<meta-data android:name="com.flexionmobile.fdk.apptoken" android:value="fishingtravel" />
|
|
||||||
<meta-data android:name="com.flexionmobile.fdk.sdk-type" android:value="unity" />
|
|
||||||
|
|
||||||
<provider
|
|
||||||
android:name="com.facebook.FacebookContentProvider"
|
|
||||||
android:authorities="com.facebook.app.FacebookContentProvider162066986963808.${applicationId}"
|
|
||||||
android:exported="true"
|
|
||||||
tools:replace="android:authorities" />
|
|
||||||
</application>
|
|
||||||
</manifest>
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
{
|
|
||||||
"project_info": {
|
|
||||||
"project_number": "481260393117",
|
|
||||||
"project_id": "fishing-travel",
|
|
||||||
"storage_bucket": "fishing-travel.firebasestorage.app"
|
|
||||||
},
|
|
||||||
"client": [
|
|
||||||
{
|
|
||||||
"client_info": {
|
|
||||||
"mobilesdk_app_id": "1:481260393117:android:4e8da50d0ee3b5c207fa74",
|
|
||||||
"android_client_info": {
|
|
||||||
"package_name": "com.arkgame.ft"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "481260393117-jhq50gh6n2p6pat1bjhcgj3th1ke19jg.apps.googleusercontent.com",
|
|
||||||
"client_type": 1,
|
|
||||||
"android_info": {
|
|
||||||
"package_name": "com.arkgame.ft",
|
|
||||||
"certificate_hash": "c9cf2f5eaba383cbdd5b968d0342c49afabc32a2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_id": "481260393117-vfn1jueugjqjach8kgc0kfi54g085q6l.apps.googleusercontent.com",
|
|
||||||
"client_type": 1,
|
|
||||||
"android_info": {
|
|
||||||
"package_name": "com.arkgame.ft",
|
|
||||||
"certificate_hash": "53fd6ff623712411792a4665163e4cbf4a7a22ec"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_id": "481260393117-0ah0ekk7lu5r44ko2uqlfoebgak8dmhj.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"api_key": [
|
|
||||||
{
|
|
||||||
"current_key": "AIzaSyBU6gAwu0O28jg7-TRd_Vx2YMCH_Baa8Bw"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"services": {
|
|
||||||
"appinvite_service": {
|
|
||||||
"other_platform_oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "481260393117-0ah0ekk7lu5r44ko2uqlfoebgak8dmhj.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_id": "481260393117-88n0v3ht8ashhk0r5ri47hced7o5qj62.apps.googleusercontent.com",
|
|
||||||
"client_type": 2,
|
|
||||||
"ios_info": {
|
|
||||||
"bundle_id": "com.arkgame.ft",
|
|
||||||
"app_store_id": "6505145935"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_info": {
|
|
||||||
"mobilesdk_app_id": "1:481260393117:android:eafec4a060b0224907fa74",
|
|
||||||
"android_client_info": {
|
|
||||||
"package_name": "com.arkgame.ft.flexion"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "481260393117-0ah0ekk7lu5r44ko2uqlfoebgak8dmhj.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"api_key": [
|
|
||||||
{
|
|
||||||
"current_key": "AIzaSyBU6gAwu0O28jg7-TRd_Vx2YMCH_Baa8Bw"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"services": {
|
|
||||||
"appinvite_service": {
|
|
||||||
"other_platform_oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "481260393117-0ah0ekk7lu5r44ko2uqlfoebgak8dmhj.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"client_id": "481260393117-88n0v3ht8ashhk0r5ri47hced7o5qj62.apps.googleusercontent.com",
|
|
||||||
"client_type": 2,
|
|
||||||
"ios_info": {
|
|
||||||
"bundle_id": "com.arkgame.ft",
|
|
||||||
"app_store_id": "6505145935"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"configuration_version": "1"
|
|
||||||
}
|
|
||||||
@@ -1,815 +0,0 @@
|
|||||||
package com.unity3d.player;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.flexionmobile.ddpx.listener.ConnectionStateListener;
|
|
||||||
import com.flexionmobile.ddpx.listener.PurchasesUpdateListener;
|
|
||||||
import com.flexionmobile.ddpx.model.BillingResult;
|
|
||||||
import com.flexionmobile.ddpx.model.BillingResults;
|
|
||||||
import com.flexionmobile.ddpx.model.Purchase;
|
|
||||||
import com.flexionmobile.ddpx.model.ProductDetails;
|
|
||||||
import com.flexionmobile.ddpx.model.params.BillingFlowParams;
|
|
||||||
import com.flexionmobile.ddpx.model.params.ConsumeParams;
|
|
||||||
import com.flexionmobile.ddpx.model.params.QueryPurchasesParams;
|
|
||||||
import com.flexionmobile.ddpx.model.params.ProductDetailsParams;
|
|
||||||
import com.flexionmobile.ddpx.service.BillingService;
|
|
||||||
import com.flexionmobile.fdk.FLX;
|
|
||||||
|
|
||||||
import com.tuyoo.gamesdk.api.SDKAPI;
|
|
||||||
import com.tuyoo.gamesdk.model.InitParam;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
public class FlexionAdapter extends ChannelAdapterBase implements
|
|
||||||
SDKManager.IPaymentAdapter,
|
|
||||||
SDKManager.IProductQueryAdapter,
|
|
||||||
SDKManager.IPendingPurchaseAdapter,
|
|
||||||
SDKManager.IBillingLifecycleAdapter,
|
|
||||||
SDKManager.IChannelInfoAdapter,
|
|
||||||
SDKManager.IReviewAdapter {
|
|
||||||
private static final String TAG = "FlexionAdapter";
|
|
||||||
private static final int FLX_INIT_MAX_ATTEMPTS = 3;
|
|
||||||
private static final int QUERY_PURCHASES_SUCCESS_CODE = 5000;
|
|
||||||
private static BillingService billingService;
|
|
||||||
private static boolean billingConnected = false;
|
|
||||||
private static boolean billingConnecting = false;
|
|
||||||
private static boolean tuyooSdkInitialized = false;
|
|
||||||
private static boolean flexionInitialized = false;
|
|
||||||
private static boolean flexionScreensStarted = false;
|
|
||||||
private static boolean flexionScreensShown = false;
|
|
||||||
private static Activity billingActivity;
|
|
||||||
private static final Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
||||||
private static final List<String> pendingPurchases = new ArrayList<>();
|
|
||||||
private static final List<PendingBillingOperation> pendingBillingOperations = new ArrayList<>();
|
|
||||||
private static final Object pendingQueryLock = new Object();
|
|
||||||
private static boolean pendingPurchaseQueryInProgress = false;
|
|
||||||
private static boolean pendingPurchaseCacheReady = false;
|
|
||||||
private static boolean pendingPurchaseUnityCallbackWaiting = false;
|
|
||||||
private static final ExecutorService billingExecutor = Executors.newSingleThreadExecutor(r -> new Thread(r, "FlexionBillingThread"));
|
|
||||||
|
|
||||||
private interface BillingReadyOperation {
|
|
||||||
void run(BillingService service);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class Config {
|
|
||||||
public String SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.flexion.FishingMaster";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class PendingBillingOperation {
|
|
||||||
final String operation;
|
|
||||||
final BillingReadyOperation onReady;
|
|
||||||
final Runnable onFail;
|
|
||||||
|
|
||||||
PendingBillingOperation(String operation, BillingReadyOperation onReady, Runnable onFail) {
|
|
||||||
this.operation = operation;
|
|
||||||
this.onReady = onReady;
|
|
||||||
this.onFail = onFail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final PurchasesUpdateListener purchasesListener = (billingResult, purchase) -> {
|
|
||||||
// Log.w(TAG, "[PAY-FLOW] PurchasesUpdateListener: code=" + billingResult.getResponseCode()
|
|
||||||
// + " hasPurchase=" + (purchase != null));
|
|
||||||
if (billingResult.getResponseCode() == BillingResults.ResultCode.PURCHASE_SUCCESS_CODE) {
|
|
||||||
if (purchase != null) handlePurchase(purchase);
|
|
||||||
} else if (billingResult.getResponseCode() == BillingResults.ResultCode.PURCHASE_USER_CANCELLED_CODE) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] user cancelled");
|
|
||||||
sendPayCallback(1, "user_cancelled", null, null, null, null);
|
|
||||||
} else {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] purchase failed: code=" + billingResult.getResponseCode());
|
|
||||||
sendPayCallback(1, "purchase_failed_" + billingResult.getResponseCode(), null, null, null, null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
// Log.i(TAG, "[FLX-INIT] adapter init flexionInitialized=" + flexionInitialized
|
|
||||||
// + " flexionScreensStarted=" + flexionScreensStarted
|
|
||||||
// + " flexionScreensShown=" + flexionScreensShown);
|
|
||||||
activity.runOnUiThread(() -> {
|
|
||||||
SDKAPI.getIns().lightModeEnable();
|
|
||||||
if (ensureTuYooSdkInitialized(activity)) {
|
|
||||||
if (flexionInitialized) {
|
|
||||||
notifyFlexionInitResult(true, "ok");
|
|
||||||
showFlexionScreensThenInitBilling(activity);
|
|
||||||
} else {
|
|
||||||
initFlexionWithRetry(activity, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean ensureTuYooSdkInitialized(Activity activity) {
|
|
||||||
if (tuyooSdkInitialized) {
|
|
||||||
// Log.i(TAG, "[FLX-INIT] TuYoo SDK already initialized, skip SDKAPI.init");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Log.i(TAG, "[FLX-INIT] TuYoo SDK init start");
|
|
||||||
SDKAPI.getIns().init(new InitParam.Builder()
|
|
||||||
.withActivity(activity)
|
|
||||||
.withAppId(ConfigManager.SDK_APPID)
|
|
||||||
.withClientId(ConfigManager.SDK_CLIENTID)
|
|
||||||
.withServerUrl(ConfigManager.SDK_LOGIN_SERVER_URL)
|
|
||||||
.build());
|
|
||||||
SDKAPI.getIns().onActivityStart(activity);
|
|
||||||
SDKAPI.getIns().onActivityResume(activity);
|
|
||||||
tuyooSdkInitialized = true;
|
|
||||||
// Log.i(TAG, "[FLX-INIT] TuYoo SDK init success");
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "TuYoo SDK init failed, skip FLX init: " + e);
|
|
||||||
TYUnityActivity.setSdkInited();
|
|
||||||
SDKManager.notifyInitResult(false, "tuyoo_init_failed: " + e.getMessage());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void initFlexionWithRetry(Activity activity, int attempt) {
|
|
||||||
if (!isActivityAlive(activity)) {
|
|
||||||
Log.w(TAG, "FLX.init skipped: activity not alive");
|
|
||||||
SDKManager.notifyInitResult(false, "flx_init_activity_not_alive");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log.i(TAG, "[FLX-INIT] FLX.init start attempt=" + attempt + "/" + FLX_INIT_MAX_ATTEMPTS);
|
|
||||||
try {
|
|
||||||
FLX.init(activity, (initCode, initMsg) -> {
|
|
||||||
// Log.i(TAG, "[FLX-INIT] FLX.init result=" + initCode
|
|
||||||
// + " msg=" + initMsg
|
|
||||||
// + " attempt=" + attempt + "/" + FLX_INIT_MAX_ATTEMPTS);
|
|
||||||
if (initCode == 0) {
|
|
||||||
flexionInitialized = true;
|
|
||||||
notifyFlexionInitResult(true, "ok");
|
|
||||||
showFlexionScreensThenInitBilling(activity);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
onFlexionInitFailed(activity, attempt, "code=" + initCode + " msg=" + initMsg);
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "FLX.init exception attempt=" + attempt + "/" + FLX_INIT_MAX_ATTEMPTS
|
|
||||||
+ " error=" + e.getMessage());
|
|
||||||
onFlexionInitFailed(activity, attempt, "exception=" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void onFlexionInitFailed(Activity activity, int attempt, String detail) {
|
|
||||||
if (attempt < FLX_INIT_MAX_ATTEMPTS) {
|
|
||||||
long delayMs = attempt * 1000L;
|
|
||||||
Log.w(TAG, "FLX.init failed, retry after " + delayMs + "ms"
|
|
||||||
+ " attempt=" + attempt + "/" + FLX_INIT_MAX_ATTEMPTS
|
|
||||||
+ " detail=" + detail);
|
|
||||||
mainHandler.postDelayed(() -> initFlexionWithRetry(activity, attempt + 1), delayMs);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.e(TAG, "FLX.init failed after retry: " + detail);
|
|
||||||
TYUnityActivity.setSdkInited();
|
|
||||||
SDKManager.notifyInitResult(false, "flx_init_failed_after_retry: " + detail);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void showFlexionScreensThenInitBilling(Activity activity) {
|
|
||||||
if (flexionScreensShown) {
|
|
||||||
// Log.i(TAG, "[FLX-INIT] showFlexionScreens skipped, already shown");
|
|
||||||
initBillingServiceAfterScreens(activity);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flexionScreensStarted) {
|
|
||||||
Log.w(TAG, "[FLX-INIT] showFlexionScreens already started without result, skip duplicate show");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log.i(TAG, "[FLX-INIT] showFlexionScreens start");
|
|
||||||
flexionScreensStarted = true;
|
|
||||||
FLX.showFlexionScreens(activity, (screenCode, screenMsg) -> {
|
|
||||||
// Log.i(TAG, "[FLX-INIT] showFlexionScreens result=" + screenCode
|
|
||||||
// + " msg=" + screenMsg);
|
|
||||||
flexionScreensShown = true;
|
|
||||||
initBillingServiceAfterScreens(activity);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void initBillingServiceAfterScreens(Activity activity) {
|
|
||||||
// Log.i(TAG, "[FLX-INIT] initBillingServiceAfterScreens start");
|
|
||||||
initBillingService(activity,
|
|
||||||
() -> {
|
|
||||||
// Log.i(TAG, "[FLX-INIT] initBillingServiceAfterScreens success");
|
|
||||||
},
|
|
||||||
() -> {
|
|
||||||
Log.w(TAG, "[FLX-INIT] initBillingServiceAfterScreens failed");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void notifyFlexionInitResult(boolean success, String msg) {
|
|
||||||
TYUnityActivity.setSdkInited();
|
|
||||||
SDKManager.notifyInitResult(success, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isActivityAlive(Activity activity) {
|
|
||||||
return activity != null && !activity.isFinishing() && !activity.isDestroyed();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void pay(Activity activity, String productId, String productPrice,
|
|
||||||
String productName, String productCount, String prodorderId,
|
|
||||||
String appInfo) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] pay called: productId=" + productId + " billingConnected=" + billingConnected);
|
|
||||||
String developerPayload = "";
|
|
||||||
try {
|
|
||||||
byte[] decoded = Base64.getDecoder().decode(appInfo);
|
|
||||||
JSONObject json = new JSONObject(new String(decoded, StandardCharsets.UTF_8));
|
|
||||||
JSONObject payload = new JSONObject();
|
|
||||||
String customData = json.optString("customData", "");
|
|
||||||
payload.put("orderId", prodorderId);
|
|
||||||
payload.put("userId", json.optString("userId", ""));
|
|
||||||
payload.put("pfid", json.optString("pfid", ""));
|
|
||||||
if (!customData.isEmpty()) {
|
|
||||||
payload.put("customData", customData);
|
|
||||||
}
|
|
||||||
payload.put("prodPrice", productPrice);
|
|
||||||
payload.put("prodCount", productCount);
|
|
||||||
developerPayload = Base64.getEncoder().encodeToString(payload.toString().getBytes(StandardCharsets.UTF_8));
|
|
||||||
// Log.i(TAG, "[PAY-CUSTOMDATA] customData length=" + customData.length()
|
|
||||||
// + " developerPayload length=" + developerPayload.length());
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.w(TAG, "Failed to extract payload fields from appInfo: " + e.getMessage());
|
|
||||||
}
|
|
||||||
String finalPayload = developerPayload;
|
|
||||||
ensureBillingReady(activity, "pay", bs ->
|
|
||||||
billingExecutor.execute(() -> {
|
|
||||||
try {
|
|
||||||
if (bs == null || !bs.isReady()) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] billingService became null or not ready");
|
|
||||||
sendPayCallback(1, "billing_not_ready", null, null, null, null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] launching billing flow for: " + productId + " payload=" + finalPayload);
|
|
||||||
BillingResult result = bs.launchBillingFlow(activity,
|
|
||||||
new BillingFlowParams(productId, "inapp", finalPayload));
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] launchBillingFlow result: code=" + result.getResponseCode()
|
|
||||||
// + " debugMsg=" + result.getDebugMessage());
|
|
||||||
if (result.getResponseCode() != 2000) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] launchBillingFlow error: code=" + result.getResponseCode()
|
|
||||||
+ " debugMsg=" + result.getDebugMessage());
|
|
||||||
sendPayCallback(1, "billing_flow_error_" + result.getResponseCode()
|
|
||||||
+ "_" + result.getDebugMessage(), null, null, null, null);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] launchBillingFlow exception: " + e.getClass().getName()
|
|
||||||
+ " msg=" + e.getMessage());
|
|
||||||
sendPayCallback(1, "launch_billing_failed: " + e.getMessage(), null, null, null, null);
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
() -> sendPayCallback(1, "billing_not_ready", null, null, null, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void queryProducts() {
|
|
||||||
// Flexion 渠道不通过 thirdExtend 获取商品列表,由 queryProducts(String) 替代
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void queryProducts(String productIds) {
|
|
||||||
List<String> ids = Arrays.asList(productIds.split(","));
|
|
||||||
Log.i(TAG, "[FLEXION-SKU-PRICE] queryProducts productIds=" + productIds
|
|
||||||
+ " count=" + ids.size()
|
|
||||||
+ " billingConnected=" + billingConnected
|
|
||||||
+ " billingReady=" + (billingService != null && billingService.isReady()));
|
|
||||||
ensureBillingReady(null, "queryProducts",
|
|
||||||
bs -> queryProductDetails(bs, ids),
|
|
||||||
() -> sendExtensionError("billing_not_ready"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void initBillingService(Activity activity) {
|
|
||||||
initBillingService(activity, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void initBillingService(Activity activity, Runnable onReady, Runnable onFail) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] initBillingService");
|
|
||||||
ensureBillingReady(activity, "initBillingService",
|
|
||||||
bs -> {
|
|
||||||
queryPendingPurchases(false);
|
|
||||||
if (onReady != null) onReady.run();
|
|
||||||
},
|
|
||||||
() -> {
|
|
||||||
Log.w(TAG, "[PAY-FLOW] initBillingService failed: billing not ready");
|
|
||||||
if (onFail != null) onFail.run();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ensureBillingReady(Activity activity, String operation,
|
|
||||||
BillingReadyOperation onReady, Runnable onFail) {
|
|
||||||
ensureBillingReady(activity, operation, onReady, onFail, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ensureBillingReady(Activity activity, String operation,
|
|
||||||
BillingReadyOperation onReady, Runnable onFail,
|
|
||||||
boolean forceReconnect) {
|
|
||||||
if (activity != null) {
|
|
||||||
billingActivity = activity;
|
|
||||||
}
|
|
||||||
Activity targetActivity = activity != null ? activity : billingActivity;
|
|
||||||
if (targetActivity == null) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] ensureBillingReady failed: activity is null operation=" + operation);
|
|
||||||
if (onFail != null) onFail.run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
targetActivity.runOnUiThread(() -> {
|
|
||||||
try {
|
|
||||||
if (billingService == null) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] create BillingService operation=" + operation);
|
|
||||||
billingService = FLX.createBillingService(targetActivity, purchasesListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean ready = billingService != null && billingService.isReady();
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] ensureBillingReady operation=" + operation
|
|
||||||
// + " connected=" + billingConnected
|
|
||||||
// + " ready=" + ready
|
|
||||||
// + " connecting=" + billingConnecting
|
|
||||||
// + " forceReconnect=" + forceReconnect);
|
|
||||||
|
|
||||||
if (ready && !forceReconnect) {
|
|
||||||
billingConnected = true;
|
|
||||||
if (onReady != null) onReady.run(billingService);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pendingBillingOperations.add(new PendingBillingOperation(operation, onReady, onFail));
|
|
||||||
if (billingConnecting) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] billing connection already in progress, queued operation=" + operation);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
billingConnecting = true;
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] billing reconnect start operation=" + operation);
|
|
||||||
billingService.startConnection(targetActivity, new ConnectionStateListener() {
|
|
||||||
@Override
|
|
||||||
public void onBillingSetupFinished(BillingResult result) {
|
|
||||||
int code = result.getResponseCode();
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] onBillingSetupFinished: code=" + code);
|
|
||||||
billingConnecting = false;
|
|
||||||
billingConnected = code == BillingResults.ResultCode.CONNECTION_SUCCESS_CODE;
|
|
||||||
drainBillingOperations(billingConnected);
|
|
||||||
if (billingConnected) {
|
|
||||||
queryPendingPurchases(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBillingServiceDisconnected() {
|
|
||||||
Log.w(TAG, "[PAY-FLOW] billing service disconnected");
|
|
||||||
billingConnected = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mainHandler.postDelayed(() -> {
|
|
||||||
if (!billingConnecting) return;
|
|
||||||
boolean timeoutReady = billingService != null && billingService.isReady();
|
|
||||||
Log.w(TAG, "[PAY-FLOW] billing reconnect timeout operation=" + operation
|
|
||||||
+ " ready=" + timeoutReady);
|
|
||||||
billingConnecting = false;
|
|
||||||
billingConnected = timeoutReady;
|
|
||||||
drainBillingOperations(timeoutReady);
|
|
||||||
}, 10000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] ensureBillingReady exception operation=" + operation
|
|
||||||
+ " msg=" + e.getMessage());
|
|
||||||
billingConnecting = false;
|
|
||||||
billingConnected = false;
|
|
||||||
drainBillingOperations(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void drainBillingOperations(boolean success) {
|
|
||||||
List<PendingBillingOperation> operations = new ArrayList<>(pendingBillingOperations);
|
|
||||||
pendingBillingOperations.clear();
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] drainBillingOperations success=" + success
|
|
||||||
// + " count=" + operations.size());
|
|
||||||
for (PendingBillingOperation operation : operations) {
|
|
||||||
if (success) {
|
|
||||||
if (operation.onReady != null) operation.onReady.run(billingService);
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "[PAY-FLOW] billing operation failed operation=" + operation.operation);
|
|
||||||
if (operation.onFail != null) operation.onFail.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void handlePurchase(Purchase purchase) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] handlePurchase: state=" + purchase.getPurchaseState()
|
|
||||||
// + " orderId=" + purchase.getOrderId()
|
|
||||||
// + " token=" + purchase.getToken());
|
|
||||||
if (purchase.getPurchaseState() == 0) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] purchase success, sending to Unity for verification");
|
|
||||||
sendPayCallback(0, "success", purchase.getOrderId(),
|
|
||||||
purchase.getPurchaseJson(), purchase.getSignature(), purchase.getToken());
|
|
||||||
} else if (purchase.getPurchaseState() == 2) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] purchase state=2 (pending), skip");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void queryPendingPurchases(boolean sendUnityCallback) {
|
|
||||||
if (sendUnityCallback) {
|
|
||||||
JSONArray cached = drainCachedPendingPurchases();
|
|
||||||
boolean cacheReady = isPendingPurchaseCacheReady();
|
|
||||||
if (cached.length() > 0 || cacheReady) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] queryPendingPurchases use cached result count=" + cached.length()
|
|
||||||
// + " cacheReady=" + cacheReady);
|
|
||||||
markPendingPurchaseCacheConsumed(cached);
|
|
||||||
sendPendingPurchasesCallback(0, null, cached);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (pendingQueryLock) {
|
|
||||||
if (sendUnityCallback) {
|
|
||||||
pendingPurchaseUnityCallbackWaiting = true;
|
|
||||||
}
|
|
||||||
if (pendingPurchaseQueryInProgress) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] queryPendingPurchases wait running query"
|
|
||||||
// + " sendUnityCallback=" + sendUnityCallback
|
|
||||||
// + " cacheReady=" + pendingPurchaseCacheReady);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pendingPurchaseQueryInProgress = true;
|
|
||||||
pendingPurchaseCacheReady = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] queryPendingPurchases start: billingService=" + billingService
|
|
||||||
// + " billingConnected=" + billingConnected
|
|
||||||
// + " sendUnityCallback=" + sendUnityCallback);
|
|
||||||
ensureBillingReady(null, "queryPendingPurchases",
|
|
||||||
bs -> {
|
|
||||||
billingExecutor.execute(() -> {
|
|
||||||
try {
|
|
||||||
bs.queryPurchasesAsync(
|
|
||||||
new QueryPurchasesParams("inapp"),
|
|
||||||
(result, purchases) -> {
|
|
||||||
int responseCode = result == null ? -1 : result.getResponseCode();
|
|
||||||
String debugMessage = result == null ? "billing_result_null" : result.getDebugMessage();
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] queryPendingPurchases result: code=" + responseCode
|
|
||||||
// + " debugMsg=" + debugMessage
|
|
||||||
// + " count=" + (purchases == null ? 0 : purchases.size()));
|
|
||||||
if (responseCode != QUERY_PURCHASES_SUCCESS_CODE) {
|
|
||||||
boolean shouldCallback = finishPendingQueryFailed();
|
|
||||||
if (shouldCallback) {
|
|
||||||
sendPendingPurchasesCallback(1,
|
|
||||||
"query_pending_failed_" + responseCode + ": " + debugMessage,
|
|
||||||
new JSONArray());
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONArray response = new JSONArray();
|
|
||||||
if (purchases != null) {
|
|
||||||
for (Purchase p : purchases) {
|
|
||||||
JSONObject item = pendingPurchaseToJson(p);
|
|
||||||
if (item != null) response.put(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean shouldCallback = finishPendingQuerySuccess(response);
|
|
||||||
if (shouldCallback) {
|
|
||||||
sendPendingPurchasesCallback(0, null, response);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] queryPendingPurchases exception: " + e.getMessage());
|
|
||||||
boolean shouldCallback = finishPendingQueryFailed();
|
|
||||||
if (shouldCallback) {
|
|
||||||
sendPendingPurchasesCallback(1, "query_pending_exception: " + e.getMessage(), new JSONArray());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
() -> {
|
|
||||||
// Log.w(TAG, "[PAY-FLOW] queryPendingPurchases skipped: billing not connected");
|
|
||||||
boolean shouldCallback = finishPendingQueryFailed();
|
|
||||||
if (shouldCallback) sendPendingPurchasesCallback(1, "billing_not_ready", new JSONArray());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void queryPendingPurchases() {
|
|
||||||
queryPendingPurchases(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean finishPendingQuerySuccess(JSONArray purchases) {
|
|
||||||
synchronized (pendingQueryLock) {
|
|
||||||
boolean shouldCallback = pendingPurchaseUnityCallbackWaiting;
|
|
||||||
if (shouldCallback) {
|
|
||||||
clearCachedPendingPurchases();
|
|
||||||
} else {
|
|
||||||
replaceCachedPendingPurchases(purchases);
|
|
||||||
}
|
|
||||||
pendingPurchaseQueryInProgress = false;
|
|
||||||
pendingPurchaseCacheReady = !shouldCallback || purchases == null || purchases.length() == 0;
|
|
||||||
pendingPurchaseUnityCallbackWaiting = false;
|
|
||||||
return shouldCallback;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean finishPendingQueryFailed() {
|
|
||||||
synchronized (pendingQueryLock) {
|
|
||||||
pendingPurchaseQueryInProgress = false;
|
|
||||||
pendingPurchaseCacheReady = false;
|
|
||||||
boolean shouldCallback = pendingPurchaseUnityCallbackWaiting;
|
|
||||||
pendingPurchaseUnityCallbackWaiting = false;
|
|
||||||
return shouldCallback;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isPendingPurchaseCacheReady() {
|
|
||||||
synchronized (pendingQueryLock) {
|
|
||||||
return pendingPurchaseCacheReady;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void markPendingPurchaseCacheConsumed(JSONArray purchases) {
|
|
||||||
if (purchases == null || purchases.length() == 0) return;
|
|
||||||
synchronized (pendingQueryLock) {
|
|
||||||
pendingPurchaseCacheReady = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static JSONObject pendingPurchaseToJson(Purchase purchase) {
|
|
||||||
if (purchase == null || purchase.getPurchaseState() != 0) return null;
|
|
||||||
try {
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
if (purchase.getOrderId() != null) result.put("orderId", purchase.getOrderId());
|
|
||||||
if (purchase.getPurchaseJson() != null) result.put("purchaseJson", purchase.getPurchaseJson());
|
|
||||||
if (purchase.getSignature() != null) result.put("signature", purchase.getSignature());
|
|
||||||
if (purchase.getToken() != null) result.put("purchaseToken", purchase.getToken());
|
|
||||||
return result;
|
|
||||||
} catch (JSONException e) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] pendingPurchaseToJson error: " + e.getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static JSONArray drainCachedPendingPurchases() {
|
|
||||||
synchronized (pendingPurchases) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] drainCachedPendingPurchases start cachedCount=" + pendingPurchases.size()
|
|
||||||
// + " queryInProgress=" + pendingPurchaseQueryInProgress
|
|
||||||
// + " cacheReady=" + pendingPurchaseCacheReady);
|
|
||||||
JSONArray result = new JSONArray();
|
|
||||||
for (String item : pendingPurchases) {
|
|
||||||
try {
|
|
||||||
result.put(new JSONObject(item));
|
|
||||||
} catch (JSONException e) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] drainCachedPendingPurchases json error: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pendingPurchases.clear();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void replaceCachedPendingPurchases(JSONArray purchases) {
|
|
||||||
synchronized (pendingPurchases) {
|
|
||||||
pendingPurchases.clear();
|
|
||||||
if (purchases == null) return;
|
|
||||||
for (int i = 0; i < purchases.length(); i++) {
|
|
||||||
JSONObject item = purchases.optJSONObject(i);
|
|
||||||
if (item != null) pendingPurchases.add(item.toString());
|
|
||||||
}
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] replaceCachedPendingPurchases count=" + pendingPurchases.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void clearCachedPendingPurchases() {
|
|
||||||
synchronized (pendingPurchases) {
|
|
||||||
pendingPurchases.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sendPendingPurchasesCallback(int code, String errStr, JSONArray purchases) {
|
|
||||||
try {
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
result.put("code", code);
|
|
||||||
if (errStr != null) result.put("errStr", errStr);
|
|
||||||
result.put("respObj", purchases == null ? "[]" : purchases.toString());
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] PendingPurchasesResult callback: code=" + code
|
|
||||||
// + " count=" + (purchases == null ? 0 : purchases.length()));
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
"PendingPurchasesResult", result.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] sendPendingPurchasesCallback json error: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void refreshBilling() {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] refreshBilling requested");
|
|
||||||
billingConnected = false;
|
|
||||||
ensureBillingReady(null, "refreshBilling",
|
|
||||||
bs -> {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] refreshBilling ready");
|
|
||||||
},
|
|
||||||
() -> Log.w(TAG, "[PAY-FLOW] refreshBilling failed"),
|
|
||||||
true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void queryProductDetails(BillingService service, List<String> productIds) {
|
|
||||||
final AtomicBoolean completed = new AtomicBoolean(false);
|
|
||||||
Log.i(TAG, "[FLEXION-SKU-PRICE] queryProductDetails start count=" + productIds.size()
|
|
||||||
+ " productIds=" + productIds
|
|
||||||
+ " serviceReady=" + (service != null && service.isReady()));
|
|
||||||
mainHandler.postDelayed(() -> {
|
|
||||||
if (!completed.compareAndSet(false, true)) return;
|
|
||||||
Log.w(TAG, "[PAY-FLOW] queryProductDetails timeout count=" + productIds.size());
|
|
||||||
sendExtensionError("flexion_query_timeout");
|
|
||||||
}, 30000);
|
|
||||||
|
|
||||||
billingExecutor.execute(() -> {
|
|
||||||
try {
|
|
||||||
service.queryProductDetailsAsync(
|
|
||||||
new ProductDetailsParams("inapp", productIds),
|
|
||||||
(billingResult, productDetails) -> {
|
|
||||||
if (!completed.compareAndSet(false, true)) {
|
|
||||||
Log.w(TAG, "[PAY-FLOW] queryProductDetails callback ignored after timeout");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.i(TAG, "[FLEXION-SKU-PRICE] queryProductDetails callback code="
|
|
||||||
+ (billingResult == null ? "null" : billingResult.getResponseCode())
|
|
||||||
+ " debugMsg="
|
|
||||||
+ (billingResult == null ? "billing_result_null" : billingResult.getDebugMessage())
|
|
||||||
+ " count=" + (productDetails == null ? 0 : productDetails.size()));
|
|
||||||
try {
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
if (billingResult != null
|
|
||||||
&& billingResult.getResponseCode() == BillingResults.ResultCode.QUERY_PRODUCT_DETAILS_SUCCESS_CODE
|
|
||||||
&& productDetails != null) {
|
|
||||||
JSONArray arr = new JSONArray();
|
|
||||||
for (ProductDetails detail : productDetails) {
|
|
||||||
JSONObject item = new JSONObject();
|
|
||||||
item.put("productId", detail.getId());
|
|
||||||
item.put("ourProductId", detail.getId());
|
|
||||||
item.put("title", detail.getTitle());
|
|
||||||
item.put("description", detail.getDescription());
|
|
||||||
item.put("price", detail.getPrice());
|
|
||||||
item.put("price_amount_micros", detail.getPriceAmountMicros());
|
|
||||||
item.put("price_currency_code", detail.getPriceCurrencyCode());
|
|
||||||
item.put("type", detail.getType());
|
|
||||||
Log.i(TAG, "[FLEXION-SKU-PRICE] sdk product id=" + detail.getId()
|
|
||||||
+ " title=" + detail.getTitle()
|
|
||||||
+ " price=" + detail.getPrice()
|
|
||||||
+ " priceAmountMicros=" + detail.getPriceAmountMicros()
|
|
||||||
+ " currency=" + detail.getPriceCurrencyCode()
|
|
||||||
+ " type=" + detail.getType());
|
|
||||||
arr.put(item);
|
|
||||||
}
|
|
||||||
result.put("code", 0);
|
|
||||||
result.put("respObj", arr.toString());
|
|
||||||
Log.i(TAG, "[FLEXION-SKU-PRICE] send Unity SKUListResult respObj=" + arr.toString());
|
|
||||||
} else {
|
|
||||||
result.put("code", 1);
|
|
||||||
result.put("thirdExtend_errStr",
|
|
||||||
"flexion_query_failed: " + (billingResult == null ? "billing_result_null" : billingResult.getDebugMessage()));
|
|
||||||
}
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, result.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!completed.compareAndSet(false, true)) return;
|
|
||||||
Log.e(TAG, "[PAY-FLOW] queryProductDetails exception: " + e.getMessage());
|
|
||||||
sendExtensionError("flexion_query_exception: " + e.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sendPayCallback(int code, String errStr, String storeOrderId,
|
|
||||||
String purchaseJson, String signature, String purchaseToken) {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] sendPayCallback: code=" + code + " errStr=" + errStr
|
|
||||||
// + " storeOrderId=" + storeOrderId
|
|
||||||
// + " hasPurchaseJson=" + (purchaseJson != null) + " hasSignature=" + (signature != null)
|
|
||||||
// + " hasToken=" + (purchaseToken != null));
|
|
||||||
try {
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
result.put("code", code);
|
|
||||||
result.put("errStr", errStr != null ? errStr : "");
|
|
||||||
if (storeOrderId != null) result.put("orderId", storeOrderId);
|
|
||||||
if (purchaseJson != null) result.put("purchaseJson", purchaseJson);
|
|
||||||
if (signature != null) result.put("signature", signature);
|
|
||||||
if (purchaseToken != null) result.put("purchaseToken", purchaseToken);
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] UnitySendMessage callback: " + result.toString());
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
ConfigManager.PAY_CALLBACK_FUNCTION_NAME, result.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
ConfigManager.PAY_CALLBACK_FUNCTION_NAME, "{\"code\":1,\"errStr\":\"json_error\"}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void consume(String token) {
|
|
||||||
consumePurchase(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void consumePurchase(String token) {
|
|
||||||
if (token == null || token.isEmpty()) {
|
|
||||||
Log.w(TAG, "[PAY-FLOW] consumePurchase: token is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] consumePurchase: token=" + token);
|
|
||||||
ensureBillingReady(null, "consumePurchase",
|
|
||||||
bs -> billingExecutor.execute(() -> {
|
|
||||||
try {
|
|
||||||
bs.consumeAsync(
|
|
||||||
new ConsumeParams(token),
|
|
||||||
r -> {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] consume result: " +
|
|
||||||
// (r.getResponseCode() == BillingResults.ResultCode.CONSUME_SUCCESS_CODE ? "ok" : "fail"));
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "[PAY-FLOW] consumePurchase exception: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
() -> Log.w(TAG, "[PAY-FLOW] consumePurchase skipped: billing not connected"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void cancelPurchase() {
|
|
||||||
// Log.i(TAG, "[PAY-FLOW] cancelPurchase: TODO - dismiss billing dialog");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void review(Activity activity) {
|
|
||||||
String storePageUri = getStorePageUri(activity);
|
|
||||||
Log.w(TAG, "[ReviewDebug] review uri=" + storePageUri);
|
|
||||||
if (TextUtils.isEmpty(storePageUri)) {
|
|
||||||
Log.w(TAG, "review skipped: store page uri is empty");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Activity targetActivity = activity != null ? activity : billingActivity;
|
|
||||||
if (targetActivity == null) targetActivity = UnityPlayer.currentActivity;
|
|
||||||
if (targetActivity == null) {
|
|
||||||
Log.w(TAG, "review skipped: activity is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
targetActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(storePageUri)));
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Log.w(TAG, "review exception: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStorePageUri(Activity activity) {
|
|
||||||
try {
|
|
||||||
Activity targetActivity = activity != null ? activity : billingActivity;
|
|
||||||
if (targetActivity == null) targetActivity = UnityPlayer.currentActivity;
|
|
||||||
if (targetActivity == null) {
|
|
||||||
Log.w(TAG, "getStorePageUri skipped: activity is null");
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
Object storePageUri = FLX.createChannelInfoService(targetActivity)
|
|
||||||
.getCurrentChannelInfo(targetActivity)
|
|
||||||
.getStorePageUri();
|
|
||||||
return storePageUri != null ? storePageUri.toString() : "";
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Log.w(TAG, "getStorePageUri exception: " + e.getMessage());
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sendExtensionError(String errStr) {
|
|
||||||
try {
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
result.put("code", 1);
|
|
||||||
result.put("thirdExtend_errStr", errStr);
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, result.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
dependencies {
|
|
||||||
implementation("com.flexionmobile:sdk:4.0.1")
|
|
||||||
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileOptions {
|
|
||||||
coreLibraryDesugaringEnabled true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
dependencyResolutionManagement {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url = uri("https://maven.pkg.github.com/FlexionSDK/JavaSDK")
|
|
||||||
credentials {
|
|
||||||
username = "FlexionSDK"
|
|
||||||
password = "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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<application tools:overrideLibrary="com.tuyoo.gamesdk">
|
|
||||||
</application>
|
|
||||||
</manifest>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
dependencies {
|
|
||||||
implementation(platform("ru.rustore.sdk:bom:2025.11.01"))
|
|
||||||
implementation("ru.rustore.sdk:pay")
|
|
||||||
implementation "ru.rustore.sdk:review:10.0.0"
|
|
||||||
implementation "com.vk.id:vkid:2.5.1"
|
|
||||||
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileOptions {
|
|
||||||
coreLibraryDesugaringEnabled true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
dependencyResolutionManagement {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url "https://artifactory-external.vkpartner.ru/artifactory/vkid-sdk-android/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url "https://artifactory-external.vkpartner.ru/artifactory/maven/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url "https://artifactory-external.vkpartner.ru/artifactory/vk-id-captcha/android/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -1,46 +0,0 @@
|
|||||||
package com.unity3d.player;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class RustoreAdapter extends ChannelAdapterBase {
|
|
||||||
private static final String TAG = "RustoreAdapter";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String normalizeSkuList(String msg) {
|
|
||||||
if (msg == null || msg.isEmpty()) {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
JSONArray products = new JSONArray(msg);
|
|
||||||
for (int i = 0; i < products.length(); i++) {
|
|
||||||
JSONObject p = products.getJSONObject(i);
|
|
||||||
|
|
||||||
String price = p.optString("price", "0");
|
|
||||||
long micros = Long.parseLong(price) * 10000;
|
|
||||||
p.put("price_amount_micros", String.valueOf(micros));
|
|
||||||
|
|
||||||
String currency = p.optString("currency", "");
|
|
||||||
if (!currency.isEmpty()) {
|
|
||||||
p.put("price_currency_code", currency);
|
|
||||||
}
|
|
||||||
|
|
||||||
float rubles = Float.parseFloat(price) / 100;
|
|
||||||
p.put("price", String.format(Locale.US, "RUB %.2f", rubles));
|
|
||||||
}
|
|
||||||
return products.toString();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "normalizeSkuList error: " + e.getMessage());
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class Config {
|
|
||||||
public String SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.rustore.FishingTravel";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<application>
|
|
||||||
|
|
||||||
<!-- TW 渠道,程序内部用来区分 -->
|
|
||||||
<meta-data android:name="com.arkgame.ft.channel" android:value="TW" />
|
|
||||||
<!-- AppsFlyer 用来区分 -->
|
|
||||||
<meta-data android:name="CHANNEL" android:value="TW" />
|
|
||||||
</application>
|
|
||||||
</manifest>
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
{
|
|
||||||
"project_info": {
|
|
||||||
"project_number": "679771497905",
|
|
||||||
"project_id": "fishing-travel-tw",
|
|
||||||
"storage_bucket": "fishing-travel-tw.firebasestorage.app"
|
|
||||||
},
|
|
||||||
"client": [
|
|
||||||
{
|
|
||||||
"client_info": {
|
|
||||||
"mobilesdk_app_id": "1:679771497905:android:062e2b39ee6613ad210990",
|
|
||||||
"android_client_info": {
|
|
||||||
"package_name": "com.arkgame.ft.tw"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "679771497905-9d8ht9dnuhbn70p72hhc5ld29lfbqhpr.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"api_key": [
|
|
||||||
{
|
|
||||||
"current_key": "AIzaSyCvYkrDG0tMViVdQ28VGQJ1NpgwkROm_9U"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"services": {
|
|
||||||
"appinvite_service": {
|
|
||||||
"other_platform_oauth_client": [
|
|
||||||
{
|
|
||||||
"client_id": "679771497905-9d8ht9dnuhbn70p72hhc5ld29lfbqhpr.apps.googleusercontent.com",
|
|
||||||
"client_type": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"configuration_version": "1"
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
dependencies {
|
|
||||||
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileOptions {
|
|
||||||
coreLibraryDesugaringEnabled true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -1,16 +0,0 @@
|
|||||||
# TW Android 渠道配置
|
|
||||||
|
|
||||||
当前 TW 渠道先按 GooglePlay 派生包整理,只保留渠道目录和 Manifest 增量入口。
|
|
||||||
|
|
||||||
如果 TW 后续有独立配置,按需补充:
|
|
||||||
|
|
||||||
```text
|
|
||||||
Files/google-services.json
|
|
||||||
Plugins/Android/tuyoosdk_1.0.0.aar
|
|
||||||
Plugins/Android/gradle/main.gradle
|
|
||||||
Plugins/Android/gradle/settings.gradle
|
|
||||||
AddressableAssetsData/Android/addressables_content_state.bin
|
|
||||||
TWAdapter.java
|
|
||||||
```
|
|
||||||
|
|
||||||
不要在此目录放整份 Unity Gradle 模板文件,只放渠道增量。
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.unity3d.player;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
// Tw 渠道
|
|
||||||
public class TWAdapter extends ChannelAdapterBase {
|
|
||||||
|
|
||||||
private static final String TAG = "TWAdapter";
|
|
||||||
|
|
||||||
//- tw包
|
|
||||||
private static class Config {
|
|
||||||
//-
|
|
||||||
public String SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.rustore.FishingTravelTw";
|
|
||||||
|
|
||||||
//-
|
|
||||||
public static String SDK_LOGIN_SERVER_URL = "https://128-hwsfsdk-sdk-ts02.sdk-k8s-us-gcp.arksgame.com";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"permissions": {
|
|
||||||
"allow": [
|
|
||||||
"WebSearch"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
# EnjoyPay 本次接入改动记录
|
|
||||||
|
|
||||||
## 本次目标
|
|
||||||
|
|
||||||
为 Android 测试工程增加 EnjoyPay 渠道切换与打包配置,使 Unity 菜单可以切换到 EnjoyPay 并使用俄罗斯包参数进行打包测试。
|
|
||||||
|
|
||||||
## 参数来源
|
|
||||||
|
|
||||||
- wiki MCP 文档:
|
|
||||||
- `https://wiki.bamboogames.top/doc/5oqa5pyv5rkf6yca-dF8FesCMt3`
|
|
||||||
- `https://wiki.bamboogames.top/doc/sdk-PiMyYd30k5`
|
|
||||||
- PDF 参数文档:
|
|
||||||
- `D:/.devup/【128-FishingTravel】【Google俄罗斯】接入支持.pdf`
|
|
||||||
- Firebase 配置:
|
|
||||||
- `D:/.devup/google-services (1).json`
|
|
||||||
- `D:/.devup/google-services (2).json`
|
|
||||||
|
|
||||||
两份 `google-services` 文件经 `fc` 对比完全一致,已使用其中一份作为 EnjoyPay 渠道配置。
|
|
||||||
|
|
||||||
## 已确认参数
|
|
||||||
|
|
||||||
- 渠道名:`EnjoyPay`
|
|
||||||
- Android 包名:`com.arkgame.ft.ep`
|
|
||||||
- 客户端支付类型:`enjoypay.global.h5.web`
|
|
||||||
- clientId:`Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia`
|
|
||||||
- Firebase project id:`fishing-travel-ep-1ab1e`
|
|
||||||
- Firebase package name:`com.arkgame.ft.ep`
|
|
||||||
|
|
||||||
## 代码改动
|
|
||||||
|
|
||||||
### 1. 增加 EnjoyPay 切渠道入口
|
|
||||||
|
|
||||||
文件:
|
|
||||||
|
|
||||||
- `sdk-intergration/Assets/Editor/ChannelBuildTool.cs`
|
|
||||||
|
|
||||||
改动:
|
|
||||||
|
|
||||||
- `SupportedChannels` 增加 `EnjoyPay`。
|
|
||||||
- 增加菜单 `Tools/Switch Channel/EnjoyPay`。
|
|
||||||
- 增加菜单 `Tools/Build Android (Channel)/EnjoyPay`。
|
|
||||||
- 增加菜单 `Tools/Build Android (Channel)/EnjoyPay Debug`。
|
|
||||||
- `SwitchChannel("EnjoyPay")` 设置 Android bundle id 为 `com.arkgame.ft.ep`。
|
|
||||||
|
|
||||||
### 2. 增加 EnjoyPay 支付类型映射
|
|
||||||
|
|
||||||
文件:
|
|
||||||
|
|
||||||
- `sdk-intergration/Packages/tysdk/Runtime/ChannelConfig.cs`
|
|
||||||
|
|
||||||
改动:
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
"EnjoyPay" => "enjoypay.global.h5.web",
|
|
||||||
```
|
|
||||||
|
|
||||||
说明:
|
|
||||||
|
|
||||||
- 客户端传给 SDK 的 `paytype` 使用 `enjoypay.global.h5.web`。
|
|
||||||
- PDF 中的 `enj` 是后台支付方式配置类型,不作为客户端 `paytype`。
|
|
||||||
|
|
||||||
### 3. 增加 EnjoyPay 渠道配置目录
|
|
||||||
|
|
||||||
目录:
|
|
||||||
|
|
||||||
- `ExtraPluginCfgs/Android/enjoypay`
|
|
||||||
|
|
||||||
包含:
|
|
||||||
|
|
||||||
- `AndroidManifest.xml`
|
|
||||||
- `ChannelEntry.java`
|
|
||||||
- `ConfigManager.java`
|
|
||||||
- `launcherTemplate.gradle`
|
|
||||||
- `mainTemplate.gradle`
|
|
||||||
- `settingsTemplate.gradle`
|
|
||||||
- `gradleTemplate.properties`
|
|
||||||
- `Files/google-services.json`
|
|
||||||
- `Plugins/Android/tuyoosdk_1.0.0.aar`
|
|
||||||
|
|
||||||
关键配置:
|
|
||||||
|
|
||||||
- `AndroidManifest.xml`
|
|
||||||
- package:`com.arkgame.ft.ep`
|
|
||||||
- `CHANNEL = EnjoyPay`
|
|
||||||
- `ChannelEntry.java`
|
|
||||||
- `CHANNEL = "EnjoyPay"`
|
|
||||||
- 不创建专用 adapter,继续走默认 Tuyoo SDK 流程。
|
|
||||||
- `ConfigManager.java`
|
|
||||||
- `SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia"`
|
|
||||||
- `Files/google-services.json`
|
|
||||||
- 来自 `D:/.devup/google-services (1).json`
|
|
||||||
- package name:`com.arkgame.ft.ep`
|
|
||||||
|
|
||||||
### 4. Firebase / Gradle 配置核对
|
|
||||||
|
|
||||||
Unity Gradle 模板对应关系:
|
|
||||||
|
|
||||||
- 项目级 Gradle:
|
|
||||||
- `sdk-intergration/Assets/Plugins/Android/baseProjectTemplate.gradle`
|
|
||||||
- 当前已有 `com.google.gms.google-services` 插件版本声明。
|
|
||||||
- 应用模块 Gradle:
|
|
||||||
- `ExtraPluginCfgs/Android/enjoypay/launcherTemplate.gradle`
|
|
||||||
- 当前已应用 `com.google.gms.google-services` 插件。
|
|
||||||
- UnityLibrary 模块 Gradle:
|
|
||||||
- `ExtraPluginCfgs/Android/enjoypay/mainTemplate.gradle`
|
|
||||||
- 当前包含 Firebase Analytics 依赖。
|
|
||||||
|
|
||||||
## 未改动 / 延后项
|
|
||||||
|
|
||||||
- 当前测试工程不新增 EnjoyPay 商品列表逻辑。
|
|
||||||
- 正式项目接入时,再从正式项目本地 json table / 商品表构造 SKU。
|
|
||||||
- 当前不新增 EnjoyPay 专用 Billing adapter。
|
|
||||||
- 当前不复用 Flexion / RuStore 的 pending、consume、receipt 验签逻辑。
|
|
||||||
- 后台支付方式无需本次配置。
|
|
||||||
|
|
||||||
## 打包前检查
|
|
||||||
|
|
||||||
在 Unity 执行 `Tools/Switch Channel/EnjoyPay` 后,检查:
|
|
||||||
|
|
||||||
1. `sdk-intergration/Packages/tysdk/Plugins/Android/ChannelEntry.java`
|
|
||||||
- `CHANNEL = "EnjoyPay"`
|
|
||||||
2. `sdk-intergration/Packages/tysdk/Plugins/Android/ConfigManager.java`
|
|
||||||
- `SDK_CLIENTID` 为俄罗斯包 clientId。
|
|
||||||
3. `sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml`
|
|
||||||
- package 为 `com.arkgame.ft.ep`
|
|
||||||
- `CHANNEL = EnjoyPay`
|
|
||||||
4. `sdk-intergration/Packages/tysdk/Files/google-services.json`
|
|
||||||
- package name 为 `com.arkgame.ft.ep`
|
|
||||||
5. `sdk-intergration/Packages/tysdk/Plugins/Android/tuyoosdk_1.0.0.aar`
|
|
||||||
- 应同步为 EnjoyPay 目录中的新版 AAR。
|
|
||||||
|
|
||||||
## 打包步骤
|
|
||||||
|
|
||||||
1. 打开 Unity 工程:`sdk-intergration`
|
|
||||||
2. 执行菜单:`Tools/Switch Channel/EnjoyPay`
|
|
||||||
3. 执行菜单:`Tools/Build Android (Channel)/EnjoyPay Debug`
|
|
||||||
4. 安装生成的 APK。
|
|
||||||
5. 验证初始化、登录、支付拉起和 SDK 回调。
|
|
||||||
|
|
||||||
## 已知注意点
|
|
||||||
|
|
||||||
- `google-services.json` 的 package name 是 `com.arkgame.ft.ep`,所以 EnjoyPay 包名必须与其一致。
|
|
||||||
- 已删除历史脚本 `ExtraPluginCfgs/Android/switch-channel.sh`,正式入口是 Unity 菜单中的 `ChannelBuildTool.SwitchChannel`。
|
|
||||||
- 当前仓库内 `SDKTest.cs` 存在行尾状态提示;忽略行尾后无业务差异。
|
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
# EnjoyPay Android 接入开发步骤
|
|
||||||
|
|
||||||
## 资料来源
|
|
||||||
|
|
||||||
- 主要依据:通过 `wiki` MCP 读取的文档
|
|
||||||
- `https://wiki.bamboogames.top/doc/5oqa5pyv5rkf6yca-dF8FesCMt3`
|
|
||||||
- `https://wiki.bamboogames.top/doc/sdk-PiMyYd30k5`
|
|
||||||
- 辅助参考:`D:/.devup/【Enjoypay三方支付】接入指引.pdf`
|
|
||||||
- 参数来源:`D:/.devup/【128-FishingTravel】【Google俄罗斯】接入支持.pdf`
|
|
||||||
|
|
||||||
## 参数读取规则
|
|
||||||
|
|
||||||
- EnjoyPay / Google 俄罗斯包相关参数统一从 `【128-FishingTravel】【Google俄罗斯】接入支持.pdf` 读取。
|
|
||||||
- 当前代码侧只写入打包和 SDK 初始化必需、且文档中已经明确给出的参数。
|
|
||||||
- PDF 中覆盖的参数范围包括:
|
|
||||||
- 基础信息:包名、clientId、服务器地址等。
|
|
||||||
- EnjoyPay:EnjoyPay 应用 AppId、商户号、AppSecret、计费点配置、发货通知地址、退款通知地址等。
|
|
||||||
- AppsFlyer:`af_appid`、`devkey`。
|
|
||||||
- Firebase:`google-services.json`、Gradle / Firebase 依赖说明。
|
|
||||||
- AIHelp:App key、domain、Android platform 配置。
|
|
||||||
- 设备指纹:businessId、secretId、secretKey。
|
|
||||||
- 广告变现:按平台申请对应参数。
|
|
||||||
|
|
||||||
## 已确认结论
|
|
||||||
|
|
||||||
- 渠道名:`EnjoyPay`
|
|
||||||
- Android 包名:`com.arkgame.ft.ep`
|
|
||||||
- 俄罗斯包 clientId:`Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia`
|
|
||||||
- 客户端支付类型:`enjoypay.global.h5.web`
|
|
||||||
- 支付入口:复用现有 Tuyoo SDK `SDKAPI.payNew` 支付链路。
|
|
||||||
- SDK 依赖:需要替换为支持 EnjoyPay 的新版 Tuyoo AAR。
|
|
||||||
- 商品列表:当前测试工程不处理;接入正式项目时再从正式项目本地 json table / 表格数据构造 SKU。
|
|
||||||
- 服务端发货:复用现有 OrderFunc / `WaitForSvrOrder` / `ConfirmOrder` 流程。
|
|
||||||
- 不新增独立 EnjoyPay Billing adapter。
|
|
||||||
- 不复用 Flexion / RuStore 的 pending、consume、receipt 验签逻辑。
|
|
||||||
- 后台支付方式无需本次配置。
|
|
||||||
|
|
||||||
## 开发步骤
|
|
||||||
|
|
||||||
### 1. 在 ChannelBuildTool 中增加 EnjoyPay 渠道
|
|
||||||
|
|
||||||
文件:
|
|
||||||
|
|
||||||
- `sdk-intergration/Assets/Editor/ChannelBuildTool.cs`
|
|
||||||
|
|
||||||
改动:
|
|
||||||
|
|
||||||
- `SupportedChannels` 增加 `EnjoyPay`。
|
|
||||||
- 增加菜单 `Tools/Switch Channel/EnjoyPay`。
|
|
||||||
- 增加菜单 `Tools/Build Android (Channel)/EnjoyPay`。
|
|
||||||
- 增加菜单 `Tools/Build Android (Channel)/EnjoyPay Debug`。
|
|
||||||
- `SwitchChannel` 中为 `EnjoyPay` 设置 bundle id:`com.arkgame.ft.ep`。
|
|
||||||
- 已删除历史脚本 `ExtraPluginCfgs/Android/switch-channel.sh`;真实入口是 `ChannelBuildTool.SwitchChannel`。
|
|
||||||
|
|
||||||
### 2. 增加 EnjoyPay 渠道配置目录
|
|
||||||
|
|
||||||
目录:
|
|
||||||
|
|
||||||
- `ExtraPluginCfgs/Android/enjoypay`
|
|
||||||
|
|
||||||
需要包含:
|
|
||||||
|
|
||||||
- `ChannelEntry.java`
|
|
||||||
- `ConfigManager.java`
|
|
||||||
- `AndroidManifest.xml`
|
|
||||||
- `mainTemplate.gradle`
|
|
||||||
- `launcherTemplate.gradle`
|
|
||||||
- `settingsTemplate.gradle`
|
|
||||||
- `gradleTemplate.properties`
|
|
||||||
- `Plugins/Android/<新版 Tuyoo AAR>`
|
|
||||||
- 可选:`Files/google-services.json`,仅在 EnjoyPay / Appsflyer / Firebase 需要独立配置时添加。
|
|
||||||
|
|
||||||
关键配置:
|
|
||||||
|
|
||||||
- `ChannelEntry.CHANNEL = "EnjoyPay"`
|
|
||||||
- Manifest package:`com.arkgame.ft.ep`
|
|
||||||
- Manifest 渠道标识:`CHANNEL = EnjoyPay`
|
|
||||||
- `ConfigManager.SDK_CLIENTID` 使用参数文档中的俄罗斯包 clientId:`Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia`。
|
|
||||||
|
|
||||||
### 3. 配置 Unity 侧支付类型
|
|
||||||
|
|
||||||
文件:
|
|
||||||
|
|
||||||
- `sdk-intergration/Packages/tysdk/Runtime/ChannelConfig.cs`
|
|
||||||
|
|
||||||
增加映射:
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
"EnjoyPay" => "enjoypay.global.h5.web",
|
|
||||||
```
|
|
||||||
|
|
||||||
说明:
|
|
||||||
|
|
||||||
- `enj` 是 SDK 后台“支付方式配置”使用的类型。
|
|
||||||
- `enj` 不是客户端传给 `SDKAPI.payNew` 的 `paytype`。
|
|
||||||
|
|
||||||
### 4. Java 支付链路保持默认实现
|
|
||||||
|
|
||||||
文件:
|
|
||||||
|
|
||||||
- `sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java`
|
|
||||||
|
|
||||||
预期行为:
|
|
||||||
|
|
||||||
- EnjoyPay 不新增专用 `IPaymentAdapter`。
|
|
||||||
- `UnityKnowNew(...)` 走现有默认支付链路:
|
|
||||||
|
|
||||||
```java
|
|
||||||
SDKAPI.getIns().payNew(payData, payType, mPay);
|
|
||||||
```
|
|
||||||
|
|
||||||
其中 `payType.paytype` 由 Unity 传入,值为 `enjoypay.global.h5.web`。
|
|
||||||
|
|
||||||
### 5. 商品列表接入延后到正式项目
|
|
||||||
|
|
||||||
当前测试工程:
|
|
||||||
|
|
||||||
- 不新增 EnjoyPay 商品列表逻辑。
|
|
||||||
- 不改 `SDKTest` 的商品列表测试流程。
|
|
||||||
|
|
||||||
正式项目接入时:
|
|
||||||
|
|
||||||
- EnjoyPay 不调用渠道商品列表查询接口。
|
|
||||||
- 客户端从正式项目本地 table / json 构造 SKU 列表。
|
|
||||||
- `productId` 和 `ourProductId` 使用同一个商品具体 ID。
|
|
||||||
- 如果 `TbIAPItemList.ProductId1` 就是 EnjoyPay 支付所需的商品具体 ID,则直接使用 `ProductId1` 构造 SKU,并复用现有 `SKUDetail.ProdID -> TYSdkFacade.Pay -> SDKAPI.payNew` 链路。
|
|
||||||
|
|
||||||
### 6. 替换新版 Tuyoo AAR
|
|
||||||
|
|
||||||
预期行为:
|
|
||||||
|
|
||||||
- 将支持 EnjoyPay 的新版 Tuyoo AAR 放入:
|
|
||||||
|
|
||||||
```text
|
|
||||||
ExtraPluginCfgs/Android/enjoypay/Plugins/Android/
|
|
||||||
```
|
|
||||||
|
|
||||||
- `ChannelBuildTool.SwitchChannel("EnjoyPay")` 会同步到:
|
|
||||||
|
|
||||||
```text
|
|
||||||
sdk-intergration/Packages/tysdk/Plugins/Android/
|
|
||||||
```
|
|
||||||
|
|
||||||
### 7. 后台与配置系统工作
|
|
||||||
|
|
||||||
这些工作在代码外完成:
|
|
||||||
|
|
||||||
- 配置 EnjoyPay AppId、商户号、AppSecret。
|
|
||||||
- 配置 EnjoyPay 计费点。
|
|
||||||
- 配置途游商品 ID 与 EnjoyPay 计费点 ID 映射。
|
|
||||||
- 确认 Appsflyer 是否需要与 RuStore 分开统计,以及是否需要独立 Appsflyer 配置。
|
|
||||||
|
|
||||||
## 验证清单
|
|
||||||
|
|
||||||
1. 在 Unity 执行 `Tools/Switch Channel/EnjoyPay`。
|
|
||||||
2. 确认 `sdk-intergration/Packages/tysdk/Plugins/Android/ChannelEntry.java` 中 `CHANNEL = "EnjoyPay"`。
|
|
||||||
3. 确认 Android bundle id 为 `com.arkgame.ft.ep`。
|
|
||||||
4. 确认 `ChannelConfig.PayType` 在 EnjoyPay 渠道下返回 `enjoypay.global.h5.web`。
|
|
||||||
5. 确认 `SDKManager.UnityKnowNew` 使用默认 `SDKAPI.payNew` 链路。
|
|
||||||
6. 确认 EnjoyPay 未启用 Flexion / RuStore 的 pending、consume、receipt 逻辑。
|
|
||||||
7. 构建 `Tools/Build Android (Channel)/EnjoyPay Debug`。
|
|
||||||
8. 测试支付拉起与 SDK 回调。
|
|
||||||
9. 确认 OrderFunc 匹配和发货流程复用现有逻辑。
|
|
||||||
|
|
||||||
## 待确认项
|
|
||||||
|
|
||||||
- 新版 Tuyoo AAR 的具体文件名和版本。
|
|
||||||
- EnjoyPay / Google 俄罗斯包是否需要独立 `google-services.json`,以参数 PDF 中最新文件为准。
|
|
||||||
- 外链支付回跳是否需要新增 Android `scheme / host / path / intent-filter`。
|
|
||||||
- 正式项目接入时的本地商品表字段映射。
|
|
||||||
- 是否必须展示 RUB 价格;如果需要,确认 RUB 金额来自哪张表、哪个字段。
|
|
||||||
- 参数 PDF 与 `google-services.json` 中的包名均为 `com.arkgame.ft.ep`;当前代码按 `com.arkgame.ft.ep` 执行。
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
# 合并记录: dev_rustore 测试内容 → dev_flexion
|
|
||||||
|
|
||||||
**日期:** 2026-04-30
|
|
||||||
**源分支:** dev_rustore (c105818)
|
|
||||||
**目标分支:** dev_flexion (66aa7a9)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 已合并的文件
|
|
||||||
|
|
||||||
### 1. sdk-intergration/Assets/Scripts/SDKTest.cs
|
|
||||||
|
|
||||||
新增 VK 登录/绑定/检查 和 Review 测试按钮及事件处理:
|
|
||||||
|
|
||||||
**新增字段:**
|
|
||||||
- `_loginVkBtn` — VK 登录按钮
|
|
||||||
- `_linkVkBtn` — VK 绑定按钮
|
|
||||||
- `_checkVkBtn` — VK 检查绑定按钮
|
|
||||||
- `_reviewBtn` — 应用评价按钮
|
|
||||||
|
|
||||||
**新增监听 (Start):**
|
|
||||||
```csharp
|
|
||||||
_loginVkBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwVkid));
|
|
||||||
_linkVkBtn.onClick.AddListener(OnLinkVkId);
|
|
||||||
_checkVkBtn.onClick.AddListener(OnCheckVKId);
|
|
||||||
_reviewBtn.onClick.AddListener(OnReview);
|
|
||||||
```
|
|
||||||
|
|
||||||
**新增方法:**
|
|
||||||
```csharp
|
|
||||||
private async void OnLinkVkId() // VK 绑定 → TYSdkFacade.Instance.LinkAccount(EAccoutType.hwVkid)
|
|
||||||
private async void OnCheckVKId() // VK 检查 → TYSdkFacade.Instance.LinkCheck(EAccoutType.hwVkid)
|
|
||||||
private void OnReview() // 评价 → UnityBridgeFunc.Review()
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. sdk-intergration/Assets/Scenes/SampleScene.unity
|
|
||||||
|
|
||||||
直接从 dev_rustore 检出完整文件,包含新增 UI 按钮 GameObject:
|
|
||||||
- VK Login 按钮
|
|
||||||
- VK Link 按钮
|
|
||||||
- VK Check 按钮
|
|
||||||
- Review 按钮
|
|
||||||
|
|
||||||
### 3. sdk-intergration/ProjectSettings/ProjectSettings.asset
|
|
||||||
|
|
||||||
修复构建错误,将 `AndroidMinSdkVersion` 从 25 提升到 26:
|
|
||||||
- **原因:** `tuyoosdk_1.0.0.aar` 声明 minSdkVersion 26,低于此版本会 manifest 合并失败
|
|
||||||
- **影响:** 全局生效,所有渠道统一 minSdk 26
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 跳过的文件 (dev_flexion 已有更完善的实现)
|
|
||||||
|
|
||||||
### TYSdkModel.cs — 跳过
|
|
||||||
- dev_rustore: 硬编码 `AccountInfo.hwPayType = "rustore.global.app"`, SKUDetail 写死 Rustore 格式
|
|
||||||
- dev_flexion: 使用 `ChannelConfig.Channel` 动态区分渠道,同时兼容 Google/Rustore/Flexion
|
|
||||||
- **理由:** dev_flexion 的 `ChannelConfig` 抽象更成熟,无需降级
|
|
||||||
|
|
||||||
### TYSdkFacade.cs — 跳过
|
|
||||||
- dev_rustore: 硬编码 `Channel = "hwVkid"`, 超时 120s
|
|
||||||
- dev_flexion: 已有 `Channel => ChannelConfig.Channel`, 动态 `LoginTimeoutSeconds`
|
|
||||||
- **理由:** dev_flexion 已包含 VK 映射 `{"vk.global.app", EAccoutType.hwVkid}`, 且抽象更优
|
|
||||||
|
|
||||||
### TYSdkFacade_Pay.cs — 跳过
|
|
||||||
- dev_rustore: `var pType = tysdk.AccountInfo.hwPayType` (硬编码 rustore)
|
|
||||||
- dev_flexion: `var pType = ChannelConfig.PayType` (动态配置)
|
|
||||||
- **理由:** dev_flexion 的方案已覆盖 rustore 支付类型
|
|
||||||
|
|
||||||
### UnityBridgeFunc.cs — 跳过
|
|
||||||
- dev_rustore: 仅代码格式重排,无功能变更
|
|
||||||
- dev_flexion: 已包含 `Review()` 等方法声明
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 构建错误修复
|
|
||||||
|
|
||||||
```
|
|
||||||
Error: uses-sdk:minSdkVersion 25 cannot be smaller than version 26
|
|
||||||
declared in library [:tuyoosdk_1.0.0:]
|
|
||||||
```
|
|
||||||
|
|
||||||
**修复:** `ProjectSettings.asset` → `AndroidMinSdkVersion: 25` → `26`
|
|
||||||
|
|
||||||
**替代方案分析:**
|
|
||||||
- `tools:overrideLibrary="com.tuyoo.gamesdk"` (rustore AndroidManifest 已有) 只能绕过 manifest 合并冲突
|
|
||||||
- 无法绕过 gradle 层 `processReleaseMainManifest` task 的 minSdkVersion 检查
|
|
||||||
- 改 ProjectSettings 是唯一可行方案
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## SKU 列表格式统一
|
|
||||||
|
|
||||||
**问题:** Rustore 和 GooglePlay 返回的商品列表 JSON 字段不同,C# 端用同一个 `SKUDetail` 类反序列化。
|
|
||||||
|
|
||||||
**方案:** 在 Java 端 `ChannelHelpers.normalizeSkuList()` 中统一格式,C# 端不做渠道判断。
|
|
||||||
|
|
||||||
### 数据流
|
|
||||||
|
|
||||||
```
|
|
||||||
SDK API → defaultThirdExtend() → ChannelHelpers.normalizeSkuList(msg) → Unity SKUListResult → DeserializeObject<List<SKUDetail>>
|
|
||||||
```
|
|
||||||
|
|
||||||
### 变更文件
|
|
||||||
|
|
||||||
#### 1. ExtraPluginCfgs/Android/rustore/ChannelHelpers.java — 新增 normalizeSkuList
|
|
||||||
|
|
||||||
```java
|
|
||||||
// 将 Rustore 原始格式转为统一格式:
|
|
||||||
// price: "199" (戈比) → "₽1.99"
|
|
||||||
// 新增 price_amount_micros: "199" * 10000 = "1990000"
|
|
||||||
// 新增 price_currency_code: ← currency 字段
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. ExtraPluginCfgs/Android/googleplay/ChannelHelpers.java — 新增 normalizeSkuList
|
|
||||||
|
|
||||||
```java
|
|
||||||
// GooglePlay 格式已是标准,直接原样返回
|
|
||||||
public static String normalizeSkuList(String msg) { return msg; }
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3. ExtraPluginCfgs/Android/flexion/ChannelHelpers.java — 新增 normalizeSkuList
|
|
||||||
|
|
||||||
```java
|
|
||||||
// Flexion 有自己的 SDKHelper.queryProducts(),不走 defaultThirdExtend,编译需要方法存在
|
|
||||||
public static String normalizeSkuList(String msg) { return msg; }
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 4. SDKManager.java — defaultThirdExtend 调用 normalizeSkuList
|
|
||||||
|
|
||||||
```java
|
|
||||||
// 回调成功时: result.put("respObj", ChannelHelpers.normalizeSkuList(msg));
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 5. TYSdkModel.cs — SKUDetail 简化
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
// 去掉 Normalize() 方法和 normalized 字段
|
|
||||||
// 属性直接用统一字段:
|
|
||||||
// ProdPrice => float.Parse(price_amount_micros) / 1000000
|
|
||||||
// ProdPriceStr => price
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 6. TYSdkFacade_Pay.cs — SKUListResult 去掉 Normalize 调用
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
// 反序列化后直接赋值,不再调 sku.Normalize()
|
|
||||||
```
|
|
||||||
|
|
||||||
### 扩展新渠道
|
|
||||||
|
|
||||||
添加新渠道时只需:
|
|
||||||
1. 创建 `ExtraPluginCfgs/Android/{channel}/ChannelHelpers.java`
|
|
||||||
2. 实现 `normalizeSkuList()` 将该渠道 SKU JSON 转为统一格式
|
|
||||||
3. C# 端无需改动
|
|
||||||
7
sdk-intergration/.gitignore
vendored
7
sdk-intergration/.gitignore
vendored
@@ -19,12 +19,6 @@
|
|||||||
# Asset meta data should only be ignored when the corresponding asset is also ignored
|
# Asset meta data should only be ignored when the corresponding asset is also ignored
|
||||||
!/[Aa]ssets/**/*.meta
|
!/[Aa]ssets/**/*.meta
|
||||||
|
|
||||||
# Channel build generated files
|
|
||||||
/[Aa]ssets/Plugins/Android/channel_gradle/
|
|
||||||
/[Aa]ssets/Plugins/Android/channel_gradle.meta
|
|
||||||
/[Aa]ssets/Plugins/Android/channel_manifest_lib/build/
|
|
||||||
/[Aa]ssets/Plugins/Android/channel_manifest_lib/build.meta
|
|
||||||
|
|
||||||
/AssetsBammbooooooGameShare.PNG
|
/AssetsBammbooooooGameShare.PNG
|
||||||
|
|
||||||
# Uncomment this line if you wish to ignore the asset store tools plugin
|
# Uncomment this line if you wish to ignore the asset store tools plugin
|
||||||
@@ -99,4 +93,3 @@ crashlytics-build.properties
|
|||||||
|
|
||||||
/Assets/StreamingAssets/*.bundle
|
/Assets/StreamingAssets/*.bundle
|
||||||
/Assets/StreamingAssets/*.bundle.meta
|
/Assets/StreamingAssets/*.bundle.meta
|
||||||
.claude/*
|
|
||||||
|
|||||||
@@ -55,25 +55,31 @@ public class BuildTool
|
|||||||
BuildiOS(bparams);
|
BuildiOS(bparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("Tools/Build Android")]
|
[MenuItem("Tools/Build Android")]
|
||||||
public static void BuildAndroid()
|
public static void BuildAndroid()
|
||||||
{
|
{
|
||||||
ChannelBuildTool.SwitchChannel("GooglePlay");
|
|
||||||
BuildAndroid(new BuildParams
|
BuildParams bparams = new BuildParams()
|
||||||
{
|
{
|
||||||
outPath = "../Bin/tysdkTest_GooglePlay.apk"
|
outPath = "../Bin/tysdkTest.apk"
|
||||||
});
|
};
|
||||||
}
|
|
||||||
|
BuildAndroid(bparams);
|
||||||
[MenuItem("Tools/Build Android With Debug")]
|
}
|
||||||
public static void BuildAndroidWithDebug()
|
|
||||||
{
|
[MenuItem("Tools/Build Android With Debug")]
|
||||||
ChannelBuildTool.SwitchChannel("GooglePlay");
|
public static void BuildAndroidWithDebug()
|
||||||
BuildAndroid(new BuildParams
|
{
|
||||||
{
|
|
||||||
outPath = "../Bin/tysdkTest_GooglePlay_debug.apk"
|
BuildParams bparams = new BuildParams()
|
||||||
}, BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.WaitForPlayerConnection);
|
{
|
||||||
}
|
outPath = "../Bin/tysdkTest_debug.apk",
|
||||||
|
};
|
||||||
|
|
||||||
|
var buildOptions = BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.WaitForPlayerConnection;
|
||||||
|
|
||||||
|
BuildAndroid(bparams, buildOptions);
|
||||||
|
}
|
||||||
|
|
||||||
public static void CIBuildAndroid()
|
public static void CIBuildAndroid()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,571 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEditor.AddressableAssets;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class ChannelBuildTool
|
|
||||||
{
|
|
||||||
private const string ChannelConfigRoot = "../ChannelConfigs/Android";
|
|
||||||
private const string TysdkPlugins = "Packages/tysdk/Plugins/Android";
|
|
||||||
private const string TysdkFiles = "Packages/tysdk/Files";
|
|
||||||
private const string AssetsPlugins = "Assets/Plugins/Android";
|
|
||||||
|
|
||||||
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";
|
|
||||||
private const string ChannelManifestLib = "channel_manifest_lib";
|
|
||||||
private const string ChannelGradle = "channel_gradle";
|
|
||||||
private const string ChannelMetaName = "com.arkgame.ft.channel";
|
|
||||||
private const string EmptyManifest = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" />\n";
|
|
||||||
private static readonly XNamespace AndroidNamespace = "http://schemas.android.com/apk/res/android";
|
|
||||||
private static readonly XNamespace ToolsNamespace = "http://schemas.android.com/tools";
|
|
||||||
|
|
||||||
// ==================== Channel Switching ====================
|
|
||||||
|
|
||||||
public static void SwitchChannel(string channel)
|
|
||||||
{
|
|
||||||
channel = NormalizeChannelName(channel);
|
|
||||||
var cfgDir = Path.Combine(ChannelConfigRoot, channel.ToLowerInvariant());
|
|
||||||
|
|
||||||
Debug.Log($"[ChannelSwitch] Switching to {channel}...");
|
|
||||||
CleanChannelManifestLibBuildArtifacts();
|
|
||||||
|
|
||||||
// 1. Sync root Android config files
|
|
||||||
SyncRootAndroidConfigFiles(channel, cfgDir);
|
|
||||||
|
|
||||||
// 2. Sync channel SDK adapter Java files to tysdk package
|
|
||||||
SyncChannelAdapterFiles(cfgDir);
|
|
||||||
|
|
||||||
// 3. Sync google-services.json
|
|
||||||
SyncGoogleServices(cfgDir);
|
|
||||||
|
|
||||||
// 4. Sync channel plugin files (.aar, .jar, etc.) to tysdk package
|
|
||||||
SyncChannelPluginFiles(cfgDir);
|
|
||||||
|
|
||||||
// 5. Set Bundle Identifier per channel
|
|
||||||
var bundleId = GetBundleId(channel);
|
|
||||||
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, bundleId);
|
|
||||||
Debug.Log($"[ChannelSwitch] Bundle Identifier -> {bundleId}");
|
|
||||||
|
|
||||||
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}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==================== Menu ====================
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Switch Channel/GooglePlay", false, 10000)]
|
|
||||||
public static void Switch_GooglePlay() => SwitchChannelTo("GooglePlay");
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Switch Channel/Flexion", false, 10001)]
|
|
||||||
public static void Switch_Flexion() => SwitchChannelTo("Flexion");
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Switch Channel/Rustore", false, 10002)]
|
|
||||||
public static void Switch_Rustore() => SwitchChannelTo("Rustore");
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Switch Channel/EnjoyPay", false, 10003)]
|
|
||||||
public static void Switch_EnjoyPay() => SwitchChannelTo("EnjoyPay");
|
|
||||||
|
|
||||||
private static void SwitchChannelTo(string channel)
|
|
||||||
{
|
|
||||||
RestoreChannelWorkspace(skipOnCi: true);
|
|
||||||
SwitchChannel(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==================== Build ====================
|
|
||||||
|
|
||||||
private static void BuildAndroidForChannel(string channel, bool debug)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
RestoreChannelWorkspace(skipOnCi: true);
|
|
||||||
CleanChannelManifestLibBuildArtifacts();
|
|
||||||
SwitchChannel(channel);
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
var buildPlayerOptions = new BuildPlayerOptions
|
|
||||||
{
|
|
||||||
scenes = EditorBuildSettings.scenes.Select(x => x.path).ToArray(),
|
|
||||||
locationPathName = outPath,
|
|
||||||
target = BuildTarget.Android,
|
|
||||||
options = buildOptions,
|
|
||||||
};
|
|
||||||
|
|
||||||
Debug.Log($"[ChannelBuild] Building {channel} -> {outPath}");
|
|
||||||
var buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
|
||||||
|
|
||||||
if (buildReport?.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
|
||||||
{
|
|
||||||
Debug.Log($"[ChannelBuild] Success: {Path.GetFullPath(outPath)}");
|
|
||||||
AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogError($"[ChannelBuild] Failed: {buildReport?.summary}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
RestoreChannelWorkspace(skipOnCi: true);
|
|
||||||
AssetDatabase.SaveAssets();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Build Android (Channel)/GooglePlay", false, 10100)]
|
|
||||||
public static void Build_GooglePlay() => BuildAndroidForChannel("GooglePlay", false);
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Build Android (Channel)/GooglePlay Debug", false, 10101)]
|
|
||||||
public static void Build_GooglePlay_Debug() => BuildAndroidForChannel("GooglePlay", true);
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Build Android (Channel)/Rustore", false, 10102)]
|
|
||||||
public static void Build_Rustore() => BuildAndroidForChannel("Rustore", false);
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Build Android (Channel)/Rustore Debug", false, 10103)]
|
|
||||||
public static void Build_Rustore_Debug() => BuildAndroidForChannel("Rustore", true);
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Build Android (Channel)/Flexion", false, 10104)]
|
|
||||||
public static void Build_Flexion() => BuildAndroidForChannel("Flexion", false);
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Build Android (Channel)/Flexion Debug", false, 10105)]
|
|
||||||
public static void Build_Flexion_Debug() => BuildAndroidForChannel("Flexion", true);
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Build Android (Channel)/EnjoyPay", false, 10106)]
|
|
||||||
public static void Build_EnjoyPay() => BuildAndroidForChannel("EnjoyPay", false);
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Build Android (Channel)/EnjoyPay Debug", false, 10107)]
|
|
||||||
public static void Build_EnjoyPay_Debug() => BuildAndroidForChannel("EnjoyPay", true);
|
|
||||||
|
|
||||||
[MenuItem("Tools/Channel/Restore Workspace (Git Checkout)", false, 10200)]
|
|
||||||
public static void RestoreChannelWorkspaceWithGitCheckoutMenu()
|
|
||||||
{
|
|
||||||
RestoreChannelWorkspace(skipOnCi: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 string GetBundleId(string channel)
|
|
||||||
{
|
|
||||||
return channel switch
|
|
||||||
{
|
|
||||||
"Flexion" => "com.arkgame.ft.flexion",
|
|
||||||
"EnjoyPay" => "com.arkgame.ft.ep",
|
|
||||||
_ => "com.arkgame.ft"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void RestoreChannelWorkspace(bool skipOnCi)
|
|
||||||
{
|
|
||||||
if (skipOnCi && IsCiBuild())
|
|
||||||
{
|
|
||||||
Debug.Log("[ChannelSwitch] Skip git checkout restore on CI.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RunCommand("git", "checkout -- .");
|
|
||||||
RunCommand("git", "clean -fd -- .");
|
|
||||||
AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
|
|
||||||
Debug.Log("[ChannelSwitch] Workspace restored from git index.");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsCiBuild()
|
|
||||||
{
|
|
||||||
return !string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("JENKINS_URL")) ||
|
|
||||||
!string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("JENKINS_HOME")) ||
|
|
||||||
!string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("BUILD_NUMBER"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void RunCommand(string fileName, string arguments)
|
|
||||||
{
|
|
||||||
var startInfo = new System.Diagnostics.ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = fileName,
|
|
||||||
Arguments = arguments,
|
|
||||||
UseShellExecute = false,
|
|
||||||
RedirectStandardOutput = true,
|
|
||||||
RedirectStandardError = true,
|
|
||||||
CreateNoWindow = true
|
|
||||||
};
|
|
||||||
|
|
||||||
using (var process = System.Diagnostics.Process.Start(startInfo))
|
|
||||||
{
|
|
||||||
var output = process.StandardOutput.ReadToEnd();
|
|
||||||
var error = process.StandardError.ReadToEnd();
|
|
||||||
process.WaitForExit();
|
|
||||||
|
|
||||||
if (process.ExitCode != 0)
|
|
||||||
{
|
|
||||||
throw new System.InvalidOperationException($"{fileName} {arguments} failed.\n{output}\n{error}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SyncRootAndroidConfigFiles(string channel, string cfgDir)
|
|
||||||
{
|
|
||||||
SyncChannelGradleFiles(channel, cfgDir);
|
|
||||||
SetMainManifestChannel(channel);
|
|
||||||
SyncChannelManifestLib(channel, cfgDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Directory.Exists(cfgDir))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 SyncGoogleServices(string cfgDir)
|
|
||||||
{
|
|
||||||
var dest = Path.Combine(TysdkFiles, "google-services.json");
|
|
||||||
var src = Path.Combine(cfgDir, "Files", "google-services.json");
|
|
||||||
if (!File.Exists(src))
|
|
||||||
{
|
|
||||||
Debug.Log($"[ChannelSwitch] google-services.json not copied. Checked={src}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var destDir = Path.GetDirectoryName(dest);
|
|
||||||
if (!Directory.Exists(destDir)) Directory.CreateDirectory(destDir);
|
|
||||||
File.Copy(src, dest, true);
|
|
||||||
Debug.Log($"[ChannelSwitch] google-services.json -> {dest}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SyncChannelPluginFiles(string cfgDir)
|
|
||||||
{
|
|
||||||
var pluginsSrcDir = Path.Combine(cfgDir, "Plugins", "Android");
|
|
||||||
if (!Directory.Exists(pluginsSrcDir))
|
|
||||||
{
|
|
||||||
Debug.Log($"[ChannelSwitch] Plugin directory not found. Checked={pluginsSrcDir}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var oldPlugin in Directory.GetFiles(TysdkPlugins, "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(TysdkPlugins, fileName);
|
|
||||||
File.Copy(pluginFile, dest, true);
|
|
||||||
Debug.Log($"[ChannelSwitch] Plugin: {pluginFile} -> {dest}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SyncChannelManifestLib(string channel, string cfgDir)
|
|
||||||
{
|
|
||||||
var dest = Path.Combine(AssetsPlugins, ChannelManifestLib, "src");
|
|
||||||
if (channel == "GooglePlay" || !Directory.Exists(cfgDir))
|
|
||||||
{
|
|
||||||
WriteEmptyChannelManifestLib(dest);
|
|
||||||
Debug.Log($"[ChannelSwitch] Manifest lib reset to empty default. Channel={channel}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var srcManifest = Path.Combine(cfgDir, "AndroidManifest.xml");
|
|
||||||
if (!File.Exists(srcManifest))
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException($"[ChannelSwitch] Channel manifest not found: {srcManifest}");
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteChannelManifestLib(srcManifest, Path.Combine(cfgDir, "res"), dest);
|
|
||||||
Debug.Log($"[ChannelSwitch] Manifest: {srcManifest} -> {Path.Combine(dest, "main", "AndroidManifest.xml")}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SyncChannelGradleFiles(string channel, string cfgDir)
|
|
||||||
{
|
|
||||||
var src = Path.Combine(cfgDir, "Plugins", "Android", "gradle");
|
|
||||||
var dest = Path.Combine(AssetsPlugins, ChannelGradle);
|
|
||||||
if (Directory.Exists(dest))
|
|
||||||
{
|
|
||||||
Directory.Delete(dest, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var destMeta = dest + ".meta";
|
|
||||||
if (File.Exists(destMeta))
|
|
||||||
{
|
|
||||||
File.Delete(destMeta);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Directory.Exists(src))
|
|
||||||
{
|
|
||||||
Debug.Log($"[ChannelSwitch] Gradle increment reset to empty default. Channel={channel}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CopyDirectoryClean(src, dest);
|
|
||||||
Debug.Log($"[ChannelSwitch] Gradle increment: {src} -> {dest}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SetMainManifestChannel(string channel)
|
|
||||||
{
|
|
||||||
var manifestPath = Path.Combine(AssetsPlugins, "AndroidManifest.xml");
|
|
||||||
if (!File.Exists(manifestPath))
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException($"[ChannelSwitch] Main AndroidManifest not found: {manifestPath}");
|
|
||||||
}
|
|
||||||
|
|
||||||
var doc = XDocument.Load(manifestPath);
|
|
||||||
var root = doc.Root;
|
|
||||||
var application = root?.Elements().FirstOrDefault(x => x.Name.LocalName == "application");
|
|
||||||
if (application == null)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException($"[ChannelSwitch] Main AndroidManifest application node not found: {manifestPath}");
|
|
||||||
}
|
|
||||||
|
|
||||||
root.SetAttributeValue("package", GetBundleId(channel));
|
|
||||||
SetMainManifestChannelMeta(application, channel);
|
|
||||||
SetMainManifestBackupRules(application, channel);
|
|
||||||
doc.Save(manifestPath);
|
|
||||||
AssetDatabase.ImportAsset(manifestPath, ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);
|
|
||||||
Debug.Log($"[ChannelSwitch] Main manifest channel -> {channel}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SetMainManifestChannelMeta(XElement application, string channel)
|
|
||||||
{
|
|
||||||
var channelMeta = application.Elements()
|
|
||||||
.FirstOrDefault(x => x.Name.LocalName == "meta-data" &&
|
|
||||||
(string)x.Attribute(AndroidNamespace + "name") == ChannelMetaName);
|
|
||||||
|
|
||||||
if (channelMeta == null)
|
|
||||||
{
|
|
||||||
channelMeta = new XElement("meta-data",
|
|
||||||
new XAttribute(AndroidNamespace + "name", ChannelMetaName));
|
|
||||||
application.Add(channelMeta);
|
|
||||||
}
|
|
||||||
|
|
||||||
channelMeta.SetAttributeValue(AndroidNamespace + "name", ChannelMetaName);
|
|
||||||
channelMeta.SetAttributeValue(AndroidNamespace + "value", channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SetMainManifestBackupRules(XElement application, string channel)
|
|
||||||
{
|
|
||||||
const string fullBackupContent = "android:fullBackupContent";
|
|
||||||
var replaceAttr = application.Attribute(ToolsNamespace + "replace");
|
|
||||||
var replaceItems = replaceAttr?.Value
|
|
||||||
.Split(',')
|
|
||||||
.Select(x => x.Trim())
|
|
||||||
.Where(x => !string.IsNullOrEmpty(x))
|
|
||||||
.ToList() ?? new List<string>();
|
|
||||||
|
|
||||||
if (channel == "Flexion")
|
|
||||||
{
|
|
||||||
application.SetAttributeValue(AndroidNamespace + "fullBackupContent", "@xml/flexion_backup_rules");
|
|
||||||
if (!replaceItems.Contains(fullBackupContent))
|
|
||||||
{
|
|
||||||
replaceItems.Add(fullBackupContent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
application.SetAttributeValue(AndroidNamespace + "fullBackupContent", null);
|
|
||||||
replaceItems.RemoveAll(x => x == fullBackupContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
application.SetAttributeValue(ToolsNamespace + "replace",
|
|
||||||
replaceItems.Count > 0 ? string.Join(",", replaceItems) : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void WriteEmptyChannelManifestLib(string dest)
|
|
||||||
{
|
|
||||||
if (Directory.Exists(dest))
|
|
||||||
{
|
|
||||||
Directory.Delete(dest, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var manifestDir = Path.Combine(dest, "main");
|
|
||||||
Directory.CreateDirectory(manifestDir);
|
|
||||||
File.WriteAllText(Path.Combine(manifestDir, "AndroidManifest.xml"), EmptyManifest);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void CleanChannelManifestLibBuildArtifacts()
|
|
||||||
{
|
|
||||||
var buildDir = Path.Combine(AssetsPlugins, ChannelManifestLib, "build");
|
|
||||||
if (Directory.Exists(buildDir))
|
|
||||||
{
|
|
||||||
Directory.Delete(buildDir, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var buildMeta = buildDir + ".meta";
|
|
||||||
if (File.Exists(buildMeta))
|
|
||||||
{
|
|
||||||
File.Delete(buildMeta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void WriteChannelManifestLib(string srcManifest, string srcResDir, string dest)
|
|
||||||
{
|
|
||||||
if (Directory.Exists(dest))
|
|
||||||
{
|
|
||||||
Directory.Delete(dest, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var manifestDir = Path.Combine(dest, "main");
|
|
||||||
Directory.CreateDirectory(manifestDir);
|
|
||||||
File.Copy(srcManifest, Path.Combine(manifestDir, "AndroidManifest.xml"), true);
|
|
||||||
|
|
||||||
if (Directory.Exists(srcResDir))
|
|
||||||
{
|
|
||||||
CopyDirectoryClean(srcResDir, Path.Combine(manifestDir, "res"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void CopyDirectoryClean(string src, string dest)
|
|
||||||
{
|
|
||||||
if (Directory.Exists(dest))
|
|
||||||
{
|
|
||||||
Directory.Delete(dest, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Directory.CreateDirectory(dest);
|
|
||||||
foreach (var srcFile in Directory.GetFiles(src, "*", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
if (srcFile.EndsWith(".meta")) continue;
|
|
||||||
|
|
||||||
var relativePath = srcFile.Substring(src.Length).TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
|
||||||
var destFile = Path.Combine(dest, relativePath);
|
|
||||||
var destDir = Path.GetDirectoryName(destFile);
|
|
||||||
if (!Directory.Exists(destDir)) Directory.CreateDirectory(destDir);
|
|
||||||
|
|
||||||
File.Copy(srcFile, destFile, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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("../ChannelConfigs", AddressablesContentState);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!File.Exists(src))
|
|
||||||
{
|
|
||||||
ClearAddressablesContentState(channel);
|
|
||||||
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 void ClearAddressablesContentState(string channel)
|
|
||||||
{
|
|
||||||
if (File.Exists(AndroidAddressablesContentState))
|
|
||||||
{
|
|
||||||
File.Delete(AndroidAddressablesContentState);
|
|
||||||
}
|
|
||||||
|
|
||||||
var meta = AndroidAddressablesContentState + ".meta";
|
|
||||||
if (File.Exists(meta))
|
|
||||||
{
|
|
||||||
File.Delete(meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
var dir = Path.GetDirectoryName(AndroidAddressablesContentState);
|
|
||||||
if (Directory.Exists(dir) && !Directory.EnumerateFileSystemEntries(dir).Any())
|
|
||||||
{
|
|
||||||
Directory.Delete(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
var dirMeta = dir + ".meta";
|
|
||||||
if (File.Exists(dirMeta) && !Directory.Exists(dir))
|
|
||||||
{
|
|
||||||
File.Delete(dirMeta);
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log($"[ChannelSwitch] Addressables content state cleared. Channel={channel}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool UsesRustoreAddressablesContentState(string channel)
|
|
||||||
{
|
|
||||||
return channel == "Rustore" || channel == "EnjoyPay";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool UsesRustoreAddressablesProfile(string channel)
|
|
||||||
{
|
|
||||||
return channel == "Rustore" || channel == "EnjoyPay";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c7bad621141fb304caceb22ea91d7db3
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,42 +1,38 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.arkgame.ft" xmlns:tools="http://schemas.android.com/tools">
|
<manifest
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
package="com.arkgame.ft"
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp" android:usesCleartextTraffic="true">
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<activity android:name="com.unity3d.player.TYUnityActivity" android:theme="@style/UnityThemeSelector">
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||||
<intent-filter>
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp" android:usesCleartextTraffic="true">
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<activity android:name="com.unity3d.player.TYUnityActivity"
|
||||||
</intent-filter>
|
android:theme="@style/UnityThemeSelector">
|
||||||
<intent-filter android:autoVerify="true">
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
</intent-filter>
|
||||||
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q" />
|
|
||||||
</intent-filter>
|
<intent-filter android:autoVerify="true">
|
||||||
<intent-filter>
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q"/>
|
||||||
<data android:host="mainactivity" android:scheme="zzft" />
|
</intent-filter>
|
||||||
</intent-filter>
|
|
||||||
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
<intent-filter>
|
||||||
<meta-data android:name="google_analytics_default_allow_analytics_storage" android:value="true" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<meta-data android:name="google_analytics_default_allow_ad_storage" android:value="true" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<meta-data android:name="google_analytics_default_allow_ad_user_data" android:value="true" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="true" />
|
<data android:host="mainactivity" android:scheme="zzft" />
|
||||||
</activity>
|
</intent-filter>
|
||||||
<meta-data android:name="com.arkgame.ft.channel" android:value="tw" />
|
|
||||||
<meta-data android:name="CHANNEL" android:value="tw" />
|
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
||||||
</application>
|
</activity>
|
||||||
<queries>
|
</application>
|
||||||
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
|
<queries>
|
||||||
<!-- allows app to access Facebook app features -->
|
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
|
||||||
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" />
|
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" /> <!-- allows sharing to Messenger app -->
|
||||||
<!-- allows sharing to Messenger app -->
|
</queries>
|
||||||
<intent>
|
</manifest>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
</intent>
|
|
||||||
</queries>
|
|
||||||
</manifest>
|
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ad9923efa7716e24a9eacfdeaba25735
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
apply plugin: 'com.android.library'
|
|
||||||
|
|
||||||
evaluationDependsOn(':unityLibrary')
|
|
||||||
def unityAndroid = project(':unityLibrary').extensions.getByName('android')
|
|
||||||
|
|
||||||
android {
|
|
||||||
namespace 'com.arkgame.ft.channelmanifest'
|
|
||||||
compileSdkVersion unityAndroid.compileSdkVersion
|
|
||||||
buildToolsVersion unityAndroid.buildToolsVersion
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion unityAndroid.defaultConfig.minSdkVersion.apiLevel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6b1864b7c14c2874290c96b313f016da
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0c6d5688cdd2a434fae148ccc076e1ee
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 4835437bf5f97d548abb765917c4873c
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<application>
|
|
||||||
</application>
|
|
||||||
</manifest>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f8101f5c11c019f45843819fd0a0aec8
|
|
||||||
TextScriptImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
|
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
unityStreamingAssets=**STREAMING_ASSETS**
|
unityStreamingAssets=**STREAMING_ASSETS**
|
||||||
|
android.useAndroidX=true
|
||||||
|
android.enableJetifier=true
|
||||||
# Android Resolver Properties Start
|
# Android Resolver Properties Start
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
# Android Resolver Properties End
|
# Android Resolver Properties End
|
||||||
|
|
||||||
android.suppressUnsupportedCompileSdk=35
|
|
||||||
|
|
||||||
**ADDITIONAL_PROPERTIES**
|
**ADDITIONAL_PROPERTIES**
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':unityLibrary')
|
implementation project(':unityLibrary')
|
||||||
implementation platform('com.google.firebase:firebase-bom:34.6.0')
|
implementation(platform("com.google.firebase:firebase-bom:33.6.0"))
|
||||||
implementation 'com.google.firebase:firebase-analytics'
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|||||||
@@ -13,12 +13,11 @@ android {
|
|||||||
}
|
}
|
||||||
// Android Resolver Exclusions End
|
// Android Resolver Exclusions End
|
||||||
android {
|
android {
|
||||||
namespace "com.unity3d.player"
|
namespace "com.unity3d.player"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation project(':channel_manifest_lib')
|
|
||||||
|
|
||||||
api "com.android.support:support-v4:28.0.0"
|
api "com.android.support:support-v4:28.0.0"
|
||||||
api "com.android.support:appcompat-v7:28.0.0"
|
api "com.android.support:appcompat-v7:28.0.0"
|
||||||
@@ -37,7 +36,7 @@ dependencies {
|
|||||||
implementation 'net.aihelp:android-aihelp-aar:5.3.+'
|
implementation 'net.aihelp:android-aihelp-aar:5.3.+'
|
||||||
|
|
||||||
implementation 'com.google.android.gms:play-services-auth:20.2.0'
|
implementation 'com.google.android.gms:play-services-auth:20.2.0'
|
||||||
implementation('com.android.billingclient:billing:7.0.0')
|
implementation('com.android.billingclient:billing:6.0.1')
|
||||||
|
|
||||||
implementation 'com.google.android.gms:play-services-basement:18.2.0'
|
implementation 'com.google.android.gms:play-services-basement:18.2.0'
|
||||||
implementation 'androidx.fragment:fragment:1.3.6'
|
implementation 'androidx.fragment:fragment:1.3.6'
|
||||||
@@ -49,7 +48,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'com.miui.referrer:homereferrer:1.0.0.6'
|
implementation 'com.miui.referrer:homereferrer:1.0.0.6'
|
||||||
|
|
||||||
implementation platform('com.google.firebase:firebase-bom:34.6.0')
|
implementation platform('com.google.firebase:firebase-bom:32.7.4')
|
||||||
implementation 'com.google.firebase:firebase-analytics'
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
|
|
||||||
implementation('com.facebook.android:facebook-android-sdk:16.2.0')
|
implementation('com.facebook.android:facebook-android-sdk:16.2.0')
|
||||||
@@ -61,32 +60,38 @@ dependencies {
|
|||||||
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
||||||
|
|
||||||
// Android Resolver Dependencies Start
|
// 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.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: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: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: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: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: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: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.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: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: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.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.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
|
// Android Resolver Dependencies End
|
||||||
**DEPS**}
|
**DEPS**}
|
||||||
|
|
||||||
|
// Android Resolver Exclusions Start
|
||||||
|
android {
|
||||||
|
packagingOptions {
|
||||||
|
exclude ('/lib/armeabi/*' + '*')
|
||||||
|
exclude ('/lib/mips/*' + '*')
|
||||||
|
exclude ('/lib/mips64/*' + '*')
|
||||||
|
exclude ('/lib/x86/*' + '*')
|
||||||
|
exclude ('/lib/x86_64/*' + '*')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Android Resolver Exclusions End
|
||||||
android {
|
android {
|
||||||
ndkPath "**NDKPATH**"
|
ndkPath "**NDKPATH**"
|
||||||
|
|
||||||
compileSdkVersion **APIVERSION**
|
compileSdkVersion **APIVERSION**
|
||||||
buildToolsVersion '**BUILDTOOLS**'
|
buildToolsVersion '**BUILDTOOLS**'
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
@@ -115,9 +120,3 @@ android {
|
|||||||
**IL_CPP_BUILD_SETUP**
|
**IL_CPP_BUILD_SETUP**
|
||||||
**SOURCE_BUILD_SETUP**
|
**SOURCE_BUILD_SETUP**
|
||||||
**EXTERNAL_SOURCES**
|
**EXTERNAL_SOURCES**
|
||||||
|
|
||||||
def channelUnityProjectPath = $/**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
|
||||||
def channelGradleMain = new File(channelUnityProjectPath, 'Assets/Plugins/Android/channel_gradle/main.gradle')
|
|
||||||
if (channelGradleMain.exists()) {
|
|
||||||
apply from: channelGradleMain
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -10,15 +10,6 @@ pluginManagement {
|
|||||||
include ':launcher', ':unityLibrary'
|
include ':launcher', ':unityLibrary'
|
||||||
**INCLUDES**
|
**INCLUDES**
|
||||||
|
|
||||||
def channelUnityProjectPath = $/**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
|
||||||
include ':channel_manifest_lib'
|
|
||||||
project(':channel_manifest_lib').projectDir = new File(channelUnityProjectPath, 'Assets/Plugins/Android/channel_manifest_lib')
|
|
||||||
|
|
||||||
def channelGradleSettings = new File(channelUnityProjectPath, 'Assets/Plugins/Android/channel_gradle/settings.gradle')
|
|
||||||
if (channelGradleSettings.exists()) {
|
|
||||||
apply from: channelGradleSettings
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
repositories {
|
repositories {
|
||||||
@@ -27,18 +18,9 @@ dependencyResolutionManagement {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
// Android Resolver Repos Start
|
// Android Resolver Repos Start
|
||||||
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
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 {
|
maven {
|
||||||
url "https://android-sdk.is.com/" // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
|
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()
|
mavenLocal()
|
||||||
// Android Resolver Repos End
|
// Android Resolver Repos End
|
||||||
flatDir {
|
flatDir {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -16,8 +16,6 @@ public class SDKTest : MonoBehaviour
|
|||||||
private Button _loginGuestBtn;
|
private Button _loginGuestBtn;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Button _loginGoogleBtn;
|
private Button _loginGoogleBtn;
|
||||||
[SerializeField] // VK登录
|
|
||||||
private Button _loginVkBtn;
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Button _loginFbBtn;
|
private Button _loginFbBtn;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
@@ -25,10 +23,6 @@ public class SDKTest : MonoBehaviour
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Button _loginTokenBtn;
|
private Button _loginTokenBtn;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Button _linkVkBtn;
|
|
||||||
[SerializeField]
|
|
||||||
private Button _checkVkBtn;
|
|
||||||
[SerializeField]
|
|
||||||
private Button _linkGoogleBtn;
|
private Button _linkGoogleBtn;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Button _checkGoogleBtn;
|
private Button _checkGoogleBtn;
|
||||||
@@ -56,15 +50,8 @@ public class SDKTest : MonoBehaviour
|
|||||||
private Button _fbShareLinkBtn;
|
private Button _fbShareLinkBtn;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Button _mfbShareLinkBtn;
|
private Button _mfbShareLinkBtn;
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private Button _reviewBtn;
|
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Text _messageTxt;
|
private Text _messageTxt;
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private Text _titleText;
|
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@@ -73,8 +60,7 @@ public class SDKTest : MonoBehaviour
|
|||||||
IConfig config = new Config(serializer);
|
IConfig config = new Config(serializer);
|
||||||
GContext.container.RegisterInstance<IConfig>(config);
|
GContext.container.RegisterInstance<IConfig>(config);
|
||||||
|
|
||||||
Debug.Log("SDKTest Start");
|
Debug.Log("SDKTest Start");
|
||||||
ClearChannelTitle();
|
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
//====================== Test Server ===========================
|
//====================== Test Server ===========================
|
||||||
// UnityBridgeFunc.UnityResetServerUrl("https://128-hwsfsdk-sdk-test01.qijihdhk.com");
|
// UnityBridgeFunc.UnityResetServerUrl("https://128-hwsfsdk-sdk-test01.qijihdhk.com");
|
||||||
@@ -82,16 +68,10 @@ public class SDKTest : MonoBehaviour
|
|||||||
//====================== Test Server ===========================
|
//====================== Test Server ===========================
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
//
|
//
|
||||||
_InitBtn.onClick.AddListener(Init);
|
_InitBtn.onClick.AddListener(Init);
|
||||||
TYSdkFacade.OnInitComplete += (success, msg) =>
|
_loginGuestBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGuest));
|
||||||
{
|
|
||||||
_messageTxt.text = success ? $"Init OK: {msg}" : $"Init Failed: {msg}";
|
|
||||||
UpdateChannelTitle();
|
|
||||||
};
|
|
||||||
_loginGuestBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGuest));
|
|
||||||
_loginGoogleBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGoogle));
|
_loginGoogleBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGoogle));
|
||||||
_loginFbBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwFacebook));
|
_loginFbBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwFacebook));
|
||||||
_loginVkBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwVkid));
|
|
||||||
#if UNITY_IOS
|
#if UNITY_IOS
|
||||||
_loginAppleBtn.onClick.AddListener(() => OnLogin(EAccoutType.Apple));
|
_loginAppleBtn.onClick.AddListener(() => OnLogin(EAccoutType.Apple));
|
||||||
#endif
|
#endif
|
||||||
@@ -99,8 +79,6 @@ public class SDKTest : MonoBehaviour
|
|||||||
_logOutBtn.onClick.AddListener(OnLogout);
|
_logOutBtn.onClick.AddListener(OnLogout);
|
||||||
_linkGoogleBtn.onClick.AddListener(OnLinkGoogle);
|
_linkGoogleBtn.onClick.AddListener(OnLinkGoogle);
|
||||||
_checkGoogleBtn.onClick.AddListener(OncheckGoogle);
|
_checkGoogleBtn.onClick.AddListener(OncheckGoogle);
|
||||||
_linkVkBtn.onClick.AddListener(OnLinkVkId);
|
|
||||||
_checkVkBtn.onClick.AddListener(OnCheckVKId);
|
|
||||||
_linkFacbookBtn.onClick.AddListener(OnLinkFacebook);
|
_linkFacbookBtn.onClick.AddListener(OnLinkFacebook);
|
||||||
_linkAppleBtn.onClick.AddListener(OnLinkApple);
|
_linkAppleBtn.onClick.AddListener(OnLinkApple);
|
||||||
_checkFacbookBtn.onClick.AddListener(OncheckFacebook);
|
_checkFacbookBtn.onClick.AddListener(OncheckFacebook);
|
||||||
@@ -112,13 +90,11 @@ public class SDKTest : MonoBehaviour
|
|||||||
_signoutBtn.onClick.AddListener(OnSignoutBtn);
|
_signoutBtn.onClick.AddListener(OnSignoutBtn);
|
||||||
_fbShareLinkBtn.onClick.AddListener(OnFBShareLinkBtn);
|
_fbShareLinkBtn.onClick.AddListener(OnFBShareLinkBtn);
|
||||||
_mfbShareLinkBtn.onClick.AddListener(OnMessengerShareLinkBtn);
|
_mfbShareLinkBtn.onClick.AddListener(OnMessengerShareLinkBtn);
|
||||||
_reviewBtn.onClick.AddListener(OnReview);
|
Debug.Log("SDKTest Started");
|
||||||
Debug.Log("SDKTest Started");
|
}
|
||||||
}
|
|
||||||
|
void Init()
|
||||||
void Init()
|
|
||||||
{
|
{
|
||||||
_messageTxt.text = "Initializing...";
|
|
||||||
TYSdkFacade.Instance.Init();
|
TYSdkFacade.Instance.Init();
|
||||||
TDAnalytics.Init("0caf287574bd4a9bb08be8995705ef6f", "https://122-slg-online01.qijihdhk.com:8991");
|
TDAnalytics.Init("0caf287574bd4a9bb08be8995705ef6f", "https://122-slg-online01.qijihdhk.com:8991");
|
||||||
|
|
||||||
@@ -138,24 +114,9 @@ public class SDKTest : MonoBehaviour
|
|||||||
Debug.Log($"customId = {customId}, customId_2 = {customId_2}");
|
Debug.Log($"customId = {customId}, customId_2 = {customId_2}");
|
||||||
|
|
||||||
UnityBridgeFunc.UnityResetServerUrl("https://128-hwsfsdk-sdk-test01.qijihdhk.com");
|
UnityBridgeFunc.UnityResetServerUrl("https://128-hwsfsdk-sdk-test01.qijihdhk.com");
|
||||||
GContext.container.Resolve<IConfig>().Set("PAY_VERIFY_URL", "https://192.168.9.91:7036/api/FlexionCallback");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateChannelTitle()
|
int retryAttempt;
|
||||||
{
|
|
||||||
#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()
|
public void InitializeRewardedAds()
|
||||||
{
|
{
|
||||||
@@ -186,7 +147,6 @@ public class SDKTest : MonoBehaviour
|
|||||||
_messageTxt.text = $"Login: {info.isSuccess}";
|
_messageTxt.text = $"Login: {info.isSuccess}";
|
||||||
if (info.isSuccess)
|
if (info.isSuccess)
|
||||||
{
|
{
|
||||||
_messageTxt.text += $" UserId:{info.userId}";
|
|
||||||
_messageTxt.text += $"\n{info.msg}";
|
_messageTxt.text += $"\n{info.msg}";
|
||||||
_messageTxt.text += $"\n{TYSdkFacade.TYAccountInfo.token}";
|
_messageTxt.text += $"\n{TYSdkFacade.TYAccountInfo.token}";
|
||||||
}
|
}
|
||||||
@@ -213,45 +173,13 @@ public class SDKTest : MonoBehaviour
|
|||||||
public async void OnPayTestBtn()
|
public async void OnPayTestBtn()
|
||||||
{
|
{
|
||||||
_messageTxt.text = "";
|
_messageTxt.text = "";
|
||||||
|
if (sku == null){
|
||||||
|
_messageTxt.text = "no product";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var channel = ChannelConfig.Channel;
|
#if !UNITY_EDITOR && UNITY_IOS
|
||||||
if (string.Equals(channel, "Flexion"))
|
sku.productId = "comarkgameftpack0199";
|
||||||
{
|
|
||||||
sku = new SKUDetail
|
|
||||||
{
|
|
||||||
productId = "com.arkgame.ft.pack0199",
|
|
||||||
ourProductId = "com.arkgame.ft.pack0199",
|
|
||||||
price = "1.99",
|
|
||||||
price_amount_micros = "1990000",
|
|
||||||
title = "Flexion Test Pack",
|
|
||||||
type = "inapp"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else if (string.Equals(channel, "EnjoyPay"))
|
|
||||||
{
|
|
||||||
sku = new SKUDetail
|
|
||||||
{
|
|
||||||
productId = "comarkgameftpack0199",
|
|
||||||
ourProductId = "comarkgameftpack0199",
|
|
||||||
price = "1.99",
|
|
||||||
price_amount_micros = "1990000",
|
|
||||||
title = "EnjoyPay Test Pack",
|
|
||||||
type = "inapp"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
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.title = "商店-体力直充1.99" ;
|
||||||
sku.price = "1.99";
|
sku.price = "1.99";
|
||||||
#endif
|
#endif
|
||||||
@@ -259,22 +187,11 @@ public class SDKTest : MonoBehaviour
|
|||||||
var purchaseInfo = new JObject();
|
var purchaseInfo = new JObject();
|
||||||
purchaseInfo["pfid"] = "TestPlayer";
|
purchaseInfo["pfid"] = "TestPlayer";
|
||||||
purchaseInfo["customData"] = "{\"test\":\"test\"}";
|
purchaseInfo["customData"] = "{\"test\":\"test\"}";
|
||||||
// purchaseInfo["customData"] ="{\"BuyType\":{\"type\":1,\"ID\":100502,\"key\":null,\"endDay\":0,\"extraPurcheData\":null,\"IsHide\":false},\"IAPID\":302,\"ItemData\":[{\"id\":1005,\"curCount\":22728,\"count\":260}],\"ShowType\":8,\"CONTENT_ID\":\"com.arkgame.ft.pack0499\",\"PRICE\":4.99,\"CURRENCY\":\"USD\",\"ProdPrice\":4.99,\"extraPurcheData\":{\"purchase_count\":9,\"trade_name\":\"商店-钻石直充4.99\",\"trade_type\":\"商店-钻石直充\",\"usd_price\":4.99,\"iap_id\":302,\"drop_id\":1005,\"trade_group\":\"商店\",\"item_1005\":260},\"orderId\":null,\"time\":\"5/20/2026 3:59:07 AM\"}";
|
|
||||||
purchaseInfo["userId"] = TYSdkFacade.TYAccountInfo.strUserId;
|
|
||||||
|
|
||||||
PaymentInfo payResult = await TYSdkFacade.Instance.Pay(sku, 1, sku.ProdPrice, purchaseInfo);
|
PaymentInfo payResult = await TYSdkFacade.Instance.Pay(sku, 1, sku.ProdPrice, purchaseInfo);
|
||||||
_messageTxt.text = "\n" + $"Success : {payResult.isSuccess}";
|
_messageTxt.text = "\n" + $"Success : {payResult.isSuccess}";
|
||||||
_messageTxt.text += "\n" + $"message : {payResult.msg}";
|
_messageTxt.text += "\n" + $"message : {payResult.msg}";
|
||||||
_messageTxt.text += "\n" + $"orderId : {payResult.orderId}";
|
|
||||||
_messageTxt.text += "\n" + $"storeOrderId : {payResult.storeOrderId}";
|
|
||||||
var consumeToken = payResult.Receipt?.PurchaseToken ?? payResult.purchaseToken;
|
|
||||||
_messageTxt.text += "\n" + $"hasToken : {!string.IsNullOrEmpty(consumeToken)}";
|
|
||||||
if (!string.IsNullOrEmpty(consumeToken))
|
|
||||||
{
|
|
||||||
Debug.Log($"[SDKTest] Consume purchase token after pay result token={consumeToken}");
|
|
||||||
UnityBridgeFunc.ConsumePurchase(consumeToken);
|
|
||||||
_messageTxt.text += "\nconsume requested";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SKUDetail sku = null;
|
SKUDetail sku = null;
|
||||||
@@ -289,7 +206,6 @@ public class SDKTest : MonoBehaviour
|
|||||||
_messageTxt.text = "products count:::" + result.products.Count;
|
_messageTxt.text = "products count:::" + result.products.Count;
|
||||||
_messageTxt.text += "\n" + result.products[0].ToString();
|
_messageTxt.text += "\n" + result.products[0].ToString();
|
||||||
sku = result.products[0];
|
sku = result.products[0];
|
||||||
Debug.Log($"Sku -> {sku}");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -420,13 +336,6 @@ eb68f93a08156e04
|
|||||||
_messageTxt.text = $"\n link google account : {isSuccess}";
|
_messageTxt.text = $"\n link google account : {isSuccess}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnLinkVkId()
|
|
||||||
{
|
|
||||||
_messageTxt.text = string.Empty;
|
|
||||||
var isSuccess = await TYSdkFacade.Instance.LinkAccount(EAccoutType.hwVkid);
|
|
||||||
_messageTxt.text = $"\n link VkId account : {isSuccess} {isSuccess.code}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OnLinkFacebook()
|
private async void OnLinkFacebook()
|
||||||
{
|
{
|
||||||
_messageTxt.text = string.Empty;
|
_messageTxt.text = string.Empty;
|
||||||
@@ -448,13 +357,6 @@ eb68f93a08156e04
|
|||||||
_messageTxt.text = $"\n google account linked : {isSuccess}";
|
_messageTxt.text = $"\n google account linked : {isSuccess}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnCheckVKId()
|
|
||||||
{
|
|
||||||
_messageTxt.text = string.Empty;
|
|
||||||
var isSuccess = await TYSdkFacade.Instance.LinkCheck(EAccoutType.hwVkid);
|
|
||||||
_messageTxt.text = $"\n vk account linked : {isSuccess}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OncheckFacebook()
|
private async void OncheckFacebook()
|
||||||
{
|
{
|
||||||
_messageTxt.text = string.Empty;
|
_messageTxt.text = string.Empty;
|
||||||
@@ -477,11 +379,6 @@ eb68f93a08156e04
|
|||||||
UnityBridgeFunc.MessengerShareLink("title", "content", "https://www.baidu.com");
|
UnityBridgeFunc.MessengerShareLink("title", "content", "https://www.baidu.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnReview()
|
|
||||||
{
|
|
||||||
UnityBridgeFunc.Review();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public void OnTaBtn()
|
public void OnTaBtn()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
package com.unity3d.player;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
public class ChannelAdapterBase implements SDKManager.IChannelSDKAdapter {
|
|
||||||
private static final String TAG = "ChannelAdapterBase";
|
|
||||||
protected Activity activity;
|
|
||||||
protected String channel = "GooglePlay";
|
|
||||||
|
|
||||||
final ChannelAdapterBase setup(Activity activity, String channel) {
|
|
||||||
this.activity = activity;
|
|
||||||
this.channel = channel;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final SDKManager.IChannelSDKAdapter loadConfig() {
|
|
||||||
applyConfig();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void applyConfig() {
|
|
||||||
applyConfigObject(createConfig());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getChannel() {
|
|
||||||
return channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
SDKManager.initDefault(activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void applyConfigObject(Object source) {
|
|
||||||
if (source == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Field sourceField : source.getClass().getDeclaredFields()) {
|
|
||||||
sourceField.setAccessible(true);
|
|
||||||
try {
|
|
||||||
Object value = sourceField.get(source);
|
|
||||||
if (value == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Field targetField = ConfigManager.class.getDeclaredField(sourceField.getName());
|
|
||||||
targetField.setAccessible(true);
|
|
||||||
targetField.set(null, value);
|
|
||||||
Log.i(TAG, "apply config: " + sourceField.getName() + "=" + value);
|
|
||||||
} catch (NoSuchFieldException ignored) {
|
|
||||||
try {
|
|
||||||
Object value = sourceField.get(source);
|
|
||||||
Log.w(TAG, "ignore extra config: " + sourceField.getName() + "=" + value);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.w(TAG, "ignore extra config: " + sourceField.getName());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "apply config failed: " + sourceField.getName(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object createConfig() {
|
|
||||||
try {
|
|
||||||
Class<?> configClass = Class.forName(this.getClass().getName() + "$Config");
|
|
||||||
Constructor<?> constructor = configClass.getDeclaredConstructor();
|
|
||||||
constructor.setAccessible(true);
|
|
||||||
return constructor.newInstance();
|
|
||||||
} catch (ClassNotFoundException ignored) {
|
|
||||||
return null;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "create config failed: " + this.getClass().getName(), e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 045e7597d96519641ae97bf542955d42
|
|
||||||
PluginImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
iconMap: {}
|
|
||||||
executionOrder: {}
|
|
||||||
defineConstraints: []
|
|
||||||
isPreloaded: 0
|
|
||||||
isOverridable: 1
|
|
||||||
isExplicitlyReferenced: 0
|
|
||||||
validateReferences: 1
|
|
||||||
platformData:
|
|
||||||
- first:
|
|
||||||
Android: Android
|
|
||||||
second:
|
|
||||||
enabled: 1
|
|
||||||
settings: {}
|
|
||||||
- first:
|
|
||||||
Any:
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings: {}
|
|
||||||
- first:
|
|
||||||
Editor: Editor
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
DefaultValueInitialized: true
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
package com.unity3d.player;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.pm.ApplicationInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
|
|
||||||
public class ChannelAdapterManager {
|
|
||||||
private static final String TAG = "ChannelAdapterManager";
|
|
||||||
private static final String DEFAULT_CHANNEL = "GooglePlay";
|
|
||||||
private static final String META_CHANNEL = "com.arkgame.ft.channel";
|
|
||||||
|
|
||||||
private static SDKManager.IChannelSDKAdapter adapter;
|
|
||||||
|
|
||||||
public static SDKManager.IChannelSDKAdapter createSdkAdapter(Activity activity) {
|
|
||||||
String channel = readChannel(activity);
|
|
||||||
adapter = createAdapter(channel);
|
|
||||||
if (adapter instanceof ChannelAdapterBase) {
|
|
||||||
((ChannelAdapterBase) adapter).setup(activity, channel);
|
|
||||||
}
|
|
||||||
return adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String normalizeSkuList(String msg) {
|
|
||||||
if (adapter == null) {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
return adapter.normalizeSkuList(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SDKManager.IChannelSDKAdapter createAdapter(String channel) {
|
|
||||||
if (TextUtils.isEmpty(channel) || DEFAULT_CHANNEL.equals(channel)) {
|
|
||||||
return new ChannelAdapterBase();
|
|
||||||
}
|
|
||||||
|
|
||||||
SDKManager.IChannelSDKAdapter adapter = tryCreateAdapter(
|
|
||||||
"com.unity3d.player." + channel + "Adapter");
|
|
||||||
if (adapter != null) {
|
|
||||||
return adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ChannelAdapterBase();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SDKManager.IChannelSDKAdapter tryCreateAdapter(String adapterClassName) {
|
|
||||||
try {
|
|
||||||
Class<?> adapterClass = Class.forName(adapterClassName);
|
|
||||||
Constructor<?> constructor = adapterClass.getDeclaredConstructor();
|
|
||||||
constructor.setAccessible(true);
|
|
||||||
Object instance = constructor.newInstance();
|
|
||||||
if (instance instanceof SDKManager.IChannelSDKAdapter) {
|
|
||||||
return (SDKManager.IChannelSDKAdapter) instance;
|
|
||||||
}
|
|
||||||
Log.e(TAG, "adapter does not implement IChannelSDKAdapter: " + adapterClassName);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "create adapter failed: " + adapterClassName, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String readChannel(Activity activity) {
|
|
||||||
if (activity == null) {
|
|
||||||
return DEFAULT_CHANNEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
ApplicationInfo appInfo = activity.getPackageManager().getApplicationInfo(
|
|
||||||
activity.getPackageName(),
|
|
||||||
PackageManager.GET_META_DATA);
|
|
||||||
Bundle metaData = appInfo.metaData;
|
|
||||||
if (metaData == null) {
|
|
||||||
return DEFAULT_CHANNEL;
|
|
||||||
}
|
|
||||||
String value = metaData.getString(META_CHANNEL);
|
|
||||||
return TextUtils.isEmpty(value) ? DEFAULT_CHANNEL : value;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "read channel failed", e);
|
|
||||||
return DEFAULT_CHANNEL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: eac9aa9954e93c54fbafd3974ca30a5b
|
|
||||||
PluginImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
iconMap: {}
|
|
||||||
executionOrder: {}
|
|
||||||
defineConstraints: []
|
|
||||||
isPreloaded: 0
|
|
||||||
isOverridable: 1
|
|
||||||
isExplicitlyReferenced: 0
|
|
||||||
validateReferences: 1
|
|
||||||
platformData:
|
|
||||||
- first:
|
|
||||||
Android: Android
|
|
||||||
second:
|
|
||||||
enabled: 1
|
|
||||||
settings: {}
|
|
||||||
- first:
|
|
||||||
Any:
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings: {}
|
|
||||||
- first:
|
|
||||||
Editor: Editor
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
DefaultValueInitialized: true
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
package com.unity3d.player;
|
package com.unity3d.player;
|
||||||
|
|
||||||
public class ConfigManager {
|
public class ConfigManager {
|
||||||
// Common SDK parameters
|
//通用参数
|
||||||
public static int SDK_APPID = 20587;
|
public static int SDK_APPID = 20587;
|
||||||
public static String SDK_GAMEID = "20587";
|
public static String SDK_GAMEID = "20587";
|
||||||
public static String SDK_PROJECTID = "20587";
|
public static String SDK_PROJECTID = "20587";
|
||||||
@@ -10,12 +11,14 @@ public class ConfigManager {
|
|||||||
|
|
||||||
public static String SDK_LOGIN_SERVER_URL = "https://128-hwsfsdk-sdk-online01.qijihdhk.com";
|
public static String SDK_LOGIN_SERVER_URL = "https://128-hwsfsdk-sdk-online01.qijihdhk.com";
|
||||||
|
|
||||||
// FCM (anti-addiction system)
|
// 防沉迷 - nameSpace
|
||||||
public static String FCM_NAMESPACE = "128";
|
public static String FCM_NAMESPACE = "128";
|
||||||
|
// 防沉迷 - 长连接服务地址+端口
|
||||||
public static String FCM_IAM_HOST = "tcp://fcmtcp.tuyoo.com:3563";
|
public static String FCM_IAM_HOST = "tcp://fcmtcp.tuyoo.com:3563";
|
||||||
|
// 防沉迷 - 防沉迷服务地址
|
||||||
public static String FCM_ANTISERVERURL = "https://fcmapi.tuyoo.com";
|
public static String FCM_ANTISERVERURL = "https://fcmapi.tuyoo.com";
|
||||||
|
|
||||||
// Unity Facade callback names
|
|
||||||
public static final String UNITY_FACADE_NAME = "TYSdkFacade";
|
public static final String UNITY_FACADE_NAME = "TYSdkFacade";
|
||||||
public static final String LOGIN_CALLBACK_FUNCTION_NAME = "LoginResult";
|
public static final String LOGIN_CALLBACK_FUNCTION_NAME = "LoginResult";
|
||||||
public static final String LINKACCOUT_CALLBACK_FUNCTION_NAME = "LinkAccoutResult";
|
public static final String LINKACCOUT_CALLBACK_FUNCTION_NAME = "LinkAccoutResult";
|
||||||
@@ -25,5 +28,4 @@ public class ConfigManager {
|
|||||||
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "SKUListResult";
|
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "SKUListResult";
|
||||||
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
|
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
|
||||||
public static final String FCM_REALNAME_CALLBACK_FUNCTION_NAME = "RealNameCallback";
|
public static final String FCM_REALNAME_CALLBACK_FUNCTION_NAME = "RealNameCallback";
|
||||||
public static final String INIT_CALLBACK_FUNCTION_NAME = "InitResult";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ PluginImporter:
|
|||||||
executionOrder: {}
|
executionOrder: {}
|
||||||
defineConstraints: []
|
defineConstraints: []
|
||||||
isPreloaded: 0
|
isPreloaded: 0
|
||||||
isOverridable: 1
|
isOverridable: 0
|
||||||
isExplicitlyReferenced: 0
|
isExplicitlyReferenced: 0
|
||||||
validateReferences: 1
|
validateReferences: 1
|
||||||
platformData:
|
platformData:
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
package com.unity3d.player;
|
package com.unity3d.player;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -16,8 +17,6 @@ import com.barton.log.logapi.IGASDK;
|
|||||||
import com.facebook.share.model.ShareLinkContent;
|
import com.facebook.share.model.ShareLinkContent;
|
||||||
import com.facebook.share.widget.MessageDialog;
|
import com.facebook.share.widget.MessageDialog;
|
||||||
import com.facebook.share.widget.ShareDialog;
|
import com.facebook.share.widget.ShareDialog;
|
||||||
import com.google.android.gms.common.ConnectionResult;
|
|
||||||
import com.google.android.gms.common.GoogleApiAvailability;
|
|
||||||
import com.google.android.gms.tasks.Task;
|
import com.google.android.gms.tasks.Task;
|
||||||
import com.google.android.play.core.review.ReviewException;
|
import com.google.android.play.core.review.ReviewException;
|
||||||
import com.google.android.play.core.review.ReviewInfo;
|
import com.google.android.play.core.review.ReviewInfo;
|
||||||
@@ -30,7 +29,10 @@ import com.tuyoo.gamesdk.api.SDKAPI;
|
|||||||
import com.tuyoo.gamesdk.api.SDKCallBack;
|
import com.tuyoo.gamesdk.api.SDKCallBack;
|
||||||
import com.tuyoo.gamesdk.api.SDKWrapper;
|
import com.tuyoo.gamesdk.api.SDKWrapper;
|
||||||
import com.tuyoo.gamesdk.api.TuYooClientID;
|
import com.tuyoo.gamesdk.api.TuYooClientID;
|
||||||
|
import com.tuyoo.gamesdk.event.EventBus;
|
||||||
|
import com.tuyoo.gamesdk.event.EventConsts;
|
||||||
import com.tuyoo.gamesdk.event.data.PayEventData;
|
import com.tuyoo.gamesdk.event.data.PayEventData;
|
||||||
|
import com.tuyoo.gamesdk.event.data.WeixinShareData;
|
||||||
import com.tuyoo.gamesdk.login.model.SnsInfo;
|
import com.tuyoo.gamesdk.login.model.SnsInfo;
|
||||||
import com.tuyoo.gamesdk.model.InitParam;
|
import com.tuyoo.gamesdk.model.InitParam;
|
||||||
import com.tuyoo.gamesdk.pay.model.PayType;
|
import com.tuyoo.gamesdk.pay.model.PayType;
|
||||||
@@ -42,161 +44,14 @@ import org.json.JSONObject;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
|
||||||
* Unified SDKManager for all channels (GooglePlay / Flexion / RuStore).
|
|
||||||
* C# passes the channel string via InitSDK(activity, channel); Java dispatches
|
|
||||||
* internally via switch. All login/link/GA/share logic is shared.
|
|
||||||
* Channel-specific behaviour is limited to: Init, Pay, thirdExtend, Review.
|
|
||||||
*/
|
|
||||||
public class SDKManager {
|
public class SDKManager {
|
||||||
|
|
||||||
private static final Handler handler = new Handler(Looper.getMainLooper());
|
private final static Handler handler = new Handler(Looper.getMainLooper());
|
||||||
private static IGASDK gasdk;
|
private static IGASDK gasdk;
|
||||||
private static final String TAG = SDKManager.class.getSimpleName();
|
private static final String TAG = com.unity3d.player.SDKManager.class.getSimpleName();
|
||||||
private static String curType = TuYooClientID.tyGuest;
|
private static String curType = TuYooClientID.tyGuest;
|
||||||
private static SnsInfo tmpSnsInfo;
|
public static void InitSDK(Activity activity)
|
||||||
private static String channel = "GooglePlay";
|
{
|
||||||
|
|
||||||
// Channel SDK adapter
|
|
||||||
public interface IChannelSDKAdapter {
|
|
||||||
default IChannelSDKAdapter loadConfig() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getChannel();
|
|
||||||
|
|
||||||
void init();
|
|
||||||
|
|
||||||
default String normalizeSkuList(String msg) {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IPaymentAdapter {
|
|
||||||
void pay(Activity activity, String productId, String productPrice,
|
|
||||||
String productName, String productCount, String prodorderId,
|
|
||||||
String appInfo);
|
|
||||||
void consume(String token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IProductQueryAdapter {
|
|
||||||
void queryProducts();
|
|
||||||
void queryProducts(String productIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IPendingPurchaseAdapter {
|
|
||||||
void queryPendingPurchases();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IBillingLifecycleAdapter {
|
|
||||||
void refreshBilling();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IChannelInfoAdapter {
|
|
||||||
String getStorePageUri(Activity activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IReviewAdapter {
|
|
||||||
void review(Activity activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IChannelSDKAdapter sdkAdapter;
|
|
||||||
|
|
||||||
public static void queryProductsByIDs(String productIds) {
|
|
||||||
Log.i(TAG, "[FLEXION-SKU-PRICE] queryProductsByIDs productIds=" + productIds
|
|
||||||
+ " adapter=" + (sdkAdapter != null ? sdkAdapter.getClass().getName() : "null"));
|
|
||||||
if (sdkAdapter instanceof IProductQueryAdapter) {
|
|
||||||
((IProductQueryAdapter) sdkAdapter).queryProducts(productIds);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.e(TAG, "queryProductsByIDs: no product query adapter");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ConsumePurchase(String token) {
|
|
||||||
// Log.i(TAG, "ConsumePurchase: token=" + token);
|
|
||||||
if (sdkAdapter instanceof IPaymentAdapter) {
|
|
||||||
((IPaymentAdapter) sdkAdapter).consume(token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void QueryPendingPurchases() {
|
|
||||||
Log.i(TAG, "QueryPendingPurchases");
|
|
||||||
if (sdkAdapter instanceof IPendingPurchaseAdapter) {
|
|
||||||
((IPendingPurchaseAdapter) sdkAdapter).queryPendingPurchases();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
result.put("code", 0);
|
|
||||||
result.put("respObj", "[]");
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
"PendingPurchasesResult", result.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
Log.e(TAG, "QueryPendingPurchases fallback json error: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RefreshBillingService() {
|
|
||||||
// Log.i(TAG, "RefreshBillingService");
|
|
||||||
if (sdkAdapter instanceof IBillingLifecycleAdapter) {
|
|
||||||
((IBillingLifecycleAdapter) sdkAdapter).refreshBilling();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CancelBillingFlow() {
|
|
||||||
Log.w(TAG, "CancelBillingFlow");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String GetStorePageUri() {
|
|
||||||
if (sdkAdapter instanceof IChannelInfoAdapter) {
|
|
||||||
try {
|
|
||||||
return ((IChannelInfoAdapter) sdkAdapter).getStorePageUri(UnityPlayer.currentActivity);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Log.w(TAG, "GetStorePageUri exception: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean IsGooglePlayServicesAvailable() {
|
|
||||||
try {
|
|
||||||
Activity activity = UnityPlayer.currentActivity;
|
|
||||||
if (activity == null) {
|
|
||||||
Log.w(TAG, "IsGooglePlayServicesAvailable: activity is null");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activity);
|
|
||||||
boolean available = resultCode == ConnectionResult.SUCCESS;
|
|
||||||
Log.i(TAG, "IsGooglePlayServicesAvailable: available=" + available + " resultCode=" + resultCode);
|
|
||||||
return available;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.w(TAG, "IsGooglePlayServicesAvailable exception: " + e.getMessage());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// Init with channel helper support
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
public static void InitSDK(Activity activity, String ch) {
|
|
||||||
sdkAdapter = ChannelAdapterManager.createSdkAdapter(activity);
|
|
||||||
sdkAdapter.loadConfig();
|
|
||||||
|
|
||||||
channel = sdkAdapter.getChannel();
|
|
||||||
|
|
||||||
Log.i(TAG, "[CHANNEL-VERIFY] Java InitSDK channel=" + channel
|
|
||||||
+ " fromCSharp=" + ch
|
|
||||||
+ " adapter=" + sdkAdapter.getClass().getName());
|
|
||||||
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
"SetChannelFromNative", channel);
|
|
||||||
|
|
||||||
sdkAdapter.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void initDefault(Activity activity) {
|
|
||||||
activity.runOnUiThread(() -> {
|
activity.runOnUiThread(() -> {
|
||||||
SDKAPI.getIns().lightModeEnable();
|
SDKAPI.getIns().lightModeEnable();
|
||||||
try {
|
try {
|
||||||
@@ -209,29 +64,12 @@ public class SDKManager {
|
|||||||
TYUnityActivity.setSdkInited();
|
TYUnityActivity.setSdkInited();
|
||||||
SDKAPI.getIns().onActivityStart(activity);
|
SDKAPI.getIns().onActivityStart(activity);
|
||||||
SDKAPI.getIns().onActivityResume(activity);
|
SDKAPI.getIns().onActivityResume(activity);
|
||||||
notifyInitResult(true, "ok");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("initSDK Exception " + e);
|
System.out.println("initSDK Exception " + e);
|
||||||
notifyInitResult(false, e.getMessage());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void notifyInitResult(boolean success, String msg) {
|
|
||||||
try {
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
result.put("code", success ? 0 : 1);
|
|
||||||
result.put("msg", msg);
|
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
ConfigManager.INIT_CALLBACK_FUNCTION_NAME, result.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
Log.e(TAG, "notifyInitResult error: " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// Login / Callbacks (shared)
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
public static void parseLoginInfo(int i, String s) {
|
public static void parseLoginInfo(int i, String s) {
|
||||||
try {
|
try {
|
||||||
@@ -240,21 +78,21 @@ public class SDKManager {
|
|||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
JSONObject serverResponse = new JSONObject(s);
|
JSONObject serverResponse = new JSONObject(s);
|
||||||
JSONObject userInfo = serverResponse.getJSONObject("result");
|
JSONObject userInfo = serverResponse.getJSONObject("result");
|
||||||
result.put("loginData", userInfo);
|
result.put("loginData", userInfo );
|
||||||
} else {
|
} else {
|
||||||
result.put("errStr", s);
|
result.put("errStr", s);
|
||||||
}
|
}
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
|
||||||
ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, result.toString());
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, result.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "SDKManager-parseLoginInfo-Exception" + e);
|
Log.e(TAG,"SDKManager-parseLoginInfo-Exception" + e);
|
||||||
SDKLog.e("SDKManager-parseLoginInfo-Exception" + e);
|
SDKLog.e("SDKManager-parseLoginInfo-Exception" + e);
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
||||||
ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static SDKCallBack.Login mLogin = new SDKCallBack.Login() {
|
//登录回调-统一的回调方法(保持回调仅有一个,否则可能会出现多次回调的情况)
|
||||||
|
static SDKCallBack.Login mLogin = new SDKCallBack.Login() {
|
||||||
@Override
|
@Override
|
||||||
public void callback(int i, String s) {
|
public void callback(int i, String s) {
|
||||||
SDKLog.i("SDKCallBack.Login callback: " + i + " \n" + s);
|
SDKLog.i("SDKCallBack.Login callback: " + i + " \n" + s);
|
||||||
@@ -263,22 +101,21 @@ public class SDKManager {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected static SDKCallBack.Pay mPay = new SDKCallBack.Pay() {
|
static SDKCallBack.Pay mPay = new SDKCallBack.Pay() {
|
||||||
@Override
|
@Override
|
||||||
public void callback(int i, String s) {
|
public void callback(int i, String s) {
|
||||||
|
|
||||||
SDKLog.i("SDKCallBack.Pay callback: " + i + " \n" + s);
|
SDKLog.i("SDKCallBack.Pay callback: " + i + " \n" + s);
|
||||||
try {
|
try {
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("code", i);
|
result.put("code", i);
|
||||||
result.put("respObj", s);
|
result.put("respObj", s);
|
||||||
result.put("errStr", s);
|
result.put("errStr", s);
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.PAY_CALLBACK_FUNCTION_NAME, result.toString());
|
||||||
ConfigManager.PAY_CALLBACK_FUNCTION_NAME, result.toString());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "SDKManager-SDKCallBack.Pay-Exception" + e);
|
Log.e(TAG,"SDKManager-SDKCallBack.Pay-Exception" + e);
|
||||||
SDKLog.e("SDKManager-SDKCallBack.Pay-Exception" + e);
|
SDKLog.e("SDKManager-SDKCallBack.Pay-Exception" + e);
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.PAY_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
||||||
ConfigManager.PAY_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -294,15 +131,18 @@ public class SDKManager {
|
|||||||
handler.post(() -> SDKAPI.getIns().loginByToken(token, mLogin));
|
handler.post(() -> SDKAPI.getIns().loginByToken(token, mLogin));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String UnityLoginBySnsInfo() {
|
public static String UnityLoginBySnsInfo()
|
||||||
if (tmpSnsInfo == null) {
|
{
|
||||||
handler.post(() -> UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
if(tmpSnsInfo == null)
|
||||||
ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, "{\"code\":1}"));
|
{
|
||||||
|
handler.post(() -> UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, "{\"code\":1}"));
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
SDKLog.i("UnityLoginBySns : " + tmpSnsInfo);
|
SDKLog.i("UnityLoginBySns : " + tmpSnsInfo);
|
||||||
handler.post(() -> SDKAPI.getIns().loginBySnsInfo(tmpSnsInfo, mLogin));
|
handler.post(() -> SDKAPI.getIns().loginBySnsInfo(tmpSnsInfo, mLogin));
|
||||||
return tmpSnsInfo.type;
|
return tmpSnsInfo.type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnityGetIdentityFun(String type) {
|
public static void UnityGetIdentityFun(String type) {
|
||||||
@@ -320,15 +160,15 @@ public class SDKManager {
|
|||||||
handler.post(() -> SDKAPI.getIns().logout(type));
|
handler.post(() -> SDKAPI.getIns().logout(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
private static SnsInfo tmpSnsInfo;
|
||||||
// Account linking (shared)
|
public static void LinkAccount(String type, String userId)
|
||||||
// -------------------------------------------------------------------------
|
{
|
||||||
|
SDKAPI.getIns().getSnsInfo(type, (snscode, snsInfo, snsmsg) ->{
|
||||||
public static void LinkAccount(String type, String userId) {
|
if(snscode == SDKCallBack.CODE_SUCCESS && snsInfo !=null)
|
||||||
SDKAPI.getIns().getSnsInfo(type, (snscode, snsInfo, snsmsg) -> {
|
{
|
||||||
if (snscode == SDKCallBack.CODE_SUCCESS && snsInfo != null) {
|
SDKAPI.getIns().bindBySnsId(snsInfo, userId, (bindcode, bindmsg)->{
|
||||||
SDKAPI.getIns().bindBySnsId(snsInfo, userId, (bindcode, bindmsg) -> {
|
if(bindcode == SDKCallBack.CODE_SUCCESS)
|
||||||
if (bindcode == SDKCallBack.CODE_SUCCESS) {
|
{
|
||||||
try {
|
try {
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("code", bindcode);
|
result.put("code", bindcode);
|
||||||
@@ -337,28 +177,41 @@ public class SDKManager {
|
|||||||
JSONObject serverResponse = new JSONObject(bindmsg);
|
JSONObject serverResponse = new JSONObject(bindmsg);
|
||||||
JSONObject userInfo = serverResponse.getJSONObject("result");
|
JSONObject userInfo = serverResponse.getJSONObject("result");
|
||||||
result.put("loginData", userInfo);
|
result.put("loginData", userInfo);
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, result.toString());
|
||||||
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, result.toString());
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
String msg = "{\"code\":1, \"userId\": 0}";
|
String msg = "{\"code\":1, \"userId\": 0}";
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
}
|
}
|
||||||
} else if (bindcode == SDKCallBack.CODE_FAILED) {
|
}
|
||||||
try {
|
else if(bindcode == SDKCallBack.CODE_FAILED)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
JSONObject bindMsgObj = new JSONObject(bindmsg);
|
JSONObject bindMsgObj = new JSONObject(bindmsg);
|
||||||
JSONObject bindMsgResult = bindMsgObj.getJSONObject("result");
|
JSONObject bindMsgResult = bindMsgObj.getJSONObject("result");
|
||||||
int bindMsgResultCode = bindMsgResult.getInt("code");
|
int bindMsgResultCode = bindMsgResult.getInt("code");
|
||||||
if (bindMsgResultCode == 4) {
|
if(bindMsgResultCode == 4)
|
||||||
SDKAPI.getIns().checkSnsInfo(snsInfo, (checkcode, checkMsg) -> {
|
{
|
||||||
if (checkcode != SDKCallBack.CODE_SUCCESS) {
|
SDKAPI.getIns().checkSnsInfo(snsInfo, (checkcode, checkMsg ) -> {
|
||||||
|
if(checkcode != SDKCallBack.CODE_SUCCESS)
|
||||||
|
{
|
||||||
Log.w(TAG, checkMsg);
|
Log.w(TAG, checkMsg);
|
||||||
String msg = "{\"code\":1, \"userId\": 0}";
|
String msg = "{\"code\":1, \"userId\": 0}";
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
//{
|
||||||
|
// "track":"128:10:28654792:1766569516",
|
||||||
|
// "result":{
|
||||||
|
// "bindInfo":"{ // \"guest\": \"guest:devidmap3:bf12a8a28b663548e368ebe8742368b7\", // \"google\": \"google:118182347502471840780\" // }",
|
||||||
|
// "code":0,
|
||||||
|
// "info":"user exist",
|
||||||
|
// "exist":1,
|
||||||
|
// "userId":10030
|
||||||
|
// }
|
||||||
|
// }
|
||||||
tmpSnsInfo = snsInfo;
|
tmpSnsInfo = snsInfo;
|
||||||
JSONObject checkMsgObj = new JSONObject(checkMsg);
|
JSONObject checkMsgObj = new JSONObject(checkMsg);
|
||||||
JSONObject checkResult = checkMsgObj.getJSONObject("result");
|
JSONObject checkResult = checkMsgObj.getJSONObject("result");
|
||||||
@@ -368,219 +221,208 @@ public class SDKManager {
|
|||||||
callbackMsg.put("code", -1);
|
callbackMsg.put("code", -1);
|
||||||
callbackMsg.put("userId", bindUserId);
|
callbackMsg.put("userId", bindUserId);
|
||||||
callbackMsg.put("bindInfo", bindInfo);
|
callbackMsg.put("bindInfo", bindInfo);
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, callbackMsg.toString());
|
||||||
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME,
|
|
||||||
callbackMsg.toString());
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Log.i(TAG, e.toString());
|
Log.i(TAG, e.toString());
|
||||||
String msg = "{\"code\":1, \"userId\": 0}";
|
String msg = "{\"code\":1, \"userId\": 0}";
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Log.w(TAG, bindmsg);
|
Log.w(TAG, bindmsg);
|
||||||
String msg = "{\"code\":1, \"userId\": 0}";
|
String msg = "{\"code\":1, \"userId\": 0}";
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
}
|
||||||
|
catch (JSONException e)
|
||||||
|
{
|
||||||
Log.i(TAG, e.toString());
|
Log.i(TAG, e.toString());
|
||||||
String msg = "{\"code\":1, \"userId\": 0}";
|
String msg = "{\"code\":1, \"userId\": 0}";
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Log.w(TAG, bindmsg);
|
Log.w(TAG, bindmsg);
|
||||||
String msg = "{\"code\":1, \"userId\": 0}";
|
String msg = "{\"code\":1, \"userId\": 0}";
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Log.w(TAG, snsmsg);
|
Log.w(TAG, snsmsg);
|
||||||
String msg = "{\"code\":1, \"userId\": 0}";
|
String msg = "{\"code\":1, \"userId\": 0}";
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void CleanLinkTmpSnsInfo()
|
||||||
|
{
|
||||||
|
tmpSnsInfo = null;
|
||||||
|
}
|
||||||
|
|
||||||
public static void CleanLinkTmpSnsInfo() {
|
public static void ChangeLinkAccount(String type, int oldUserId, int newUserId)
|
||||||
tmpSnsInfo = null;
|
{
|
||||||
}
|
if(tmpSnsInfo == null)
|
||||||
|
{
|
||||||
public static void ChangeLinkAccount(String type, int oldUserId, int newUserId) {
|
|
||||||
if (tmpSnsInfo == null) {
|
|
||||||
String msg = "{\"code\":1, \"userId\": 0, \"msg\": \"tmpSnsInfo is null\"}";
|
String msg = "{\"code\":1, \"userId\": 0, \"msg\": \"tmpSnsInfo is null\"}";
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDKAPI.getIns().unbindBySnsId(tmpSnsInfo, String.valueOf(oldUserId), (unbindCode, unbindMsg) -> {
|
SDKAPI.getIns().unbindBySnsId(tmpSnsInfo, String.valueOf(oldUserId), (unbindCode, unbindMsg) -> {
|
||||||
Log.i(TAG, "unbindBySnsId code: " + unbindCode + " msg: " + unbindMsg);
|
Log.i(TAG, "unbindBySnsId code: " + unbindCode + " msg: " + unbindMsg);
|
||||||
if (unbindCode == SDKCallBack.CODE_SUCCESS) {
|
if(unbindCode == SDKCallBack.CODE_SUCCESS)
|
||||||
|
{
|
||||||
SDKAPI.getIns().bindBySnsId(tmpSnsInfo, String.valueOf(newUserId), (bindCode, bindMsg) -> {
|
SDKAPI.getIns().bindBySnsId(tmpSnsInfo, String.valueOf(newUserId), (bindCode, bindMsg) -> {
|
||||||
Log.i(TAG, "bindBySnsId code: " + bindCode + " msg: " + bindMsg);
|
Log.i(TAG, "bindBySnsId code: " + bindCode + " msg: " + bindMsg);
|
||||||
if (bindCode == SDKCallBack.CODE_SUCCESS) {
|
if(bindCode == SDKCallBack.CODE_SUCCESS)
|
||||||
|
{
|
||||||
String msg = "{\"code\":0, \"userId\": " + newUserId + ", \"msg\": \"success\"}";
|
String msg = "{\"code\":0, \"userId\": " + newUserId + ", \"msg\": \"success\"}";
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
}
|
||||||
} else {
|
else
|
||||||
|
{
|
||||||
String msg = String.format("{\"code\":-1, \"userId\": 0, \"msg\": \"%s\"}", bindMsg);
|
String msg = String.format("{\"code\":-1, \"userId\": 0, \"msg\": \"%s\"}", bindMsg);
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
String msg = String.format("{\"code\":1, \"userId\": 0, \"msg\": \"%s\"}", unbindMsg);
|
String msg = String.format("{\"code\":1, \"userId\": 0, \"msg\": \"%s\"}", unbindMsg);
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
||||||
ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LinkCheck(String type) {
|
public static void LinkCheck(String type)
|
||||||
|
{
|
||||||
SDKAPI.getIns().getSnsInfo(type, (code, snsInfo, msg) -> {
|
SDKAPI.getIns().getSnsInfo(type, (code, snsInfo, msg) -> {
|
||||||
if (code == SDKCallBack.CODE_SUCCESS && snsInfo != null) {
|
if(code == SDKCallBack.CODE_SUCCESS && snsInfo != null){
|
||||||
SDKAPI.getIns().checkSnsInfo(snsInfo, (code1, msg1) -> {
|
SDKAPI.getIns().checkSnsInfo(snsInfo, (code1, msg1) -> {
|
||||||
if (code1 == SDKCallBack.CODE_SUCCESS && !TextUtils.isEmpty(msg1)) {
|
if(code1 == SDKCallBack.CODE_SUCCESS && !TextUtils.isEmpty(msg1)){
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = new JSONObject(msg1).optJSONObject("result");
|
JSONObject jsonObject = new JSONObject(msg1).optJSONObject("result");
|
||||||
if (jsonObject.optString("code").equals("0")
|
//返回信息中code为0时表示服务端查询成功,exit为1表示此渠道用户信息已产生过途游账号,可直接进行登录,exit为0表示此渠道用户信息未产生过途游账号,可以进行绑定
|
||||||
&& jsonObject.optString("exist").equals("0")) {
|
if(jsonObject.optString("code").equals("0")
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
&& jsonObject.optString("exist").equals("0")){
|
||||||
ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "0");
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "0");
|
||||||
} else {
|
}
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
else
|
||||||
ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "1");
|
{
|
||||||
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "1");
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
||||||
ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
else
|
||||||
ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
{
|
||||||
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
else
|
||||||
ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
{
|
||||||
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
public static void UnityKnow(String productId, String productName, String productCount, String prodorderId, String appInfo) {
|
||||||
// Payment channel dispatch
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
public static void UnityKnow(String productId, String productName, String productCount,
|
|
||||||
String prodorderId, String appInfo) {
|
|
||||||
SDKLog.i("UnityKnow : " + productId);
|
SDKLog.i("UnityKnow : " + productId);
|
||||||
HashMap<String, String> extraInfo = new HashMap<String, String>();
|
HashMap<String, String> extraInfo = new HashMap<String, String>();
|
||||||
extraInfo.put("appInfo", appInfo);
|
extraInfo.put("appInfo", appInfo);
|
||||||
SDKAPI.getIns().pay(productId, productName, productCount,
|
SDKAPI.getIns().pay(productId, productName, productCount, Integer.parseInt(ConfigManager.SDK_GAMEID), mPay, prodorderId, extraInfo);
|
||||||
Integer.parseInt(ConfigManager.SDK_GAMEID), mPay, prodorderId, extraInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnityKnowNew(String productId, String productPrice, String productName,
|
public static void UnityGetKnowTypeList(String productId)
|
||||||
String productCount, String prodorderId, String appInfo,
|
{
|
||||||
String ptype) {
|
Log.e(TAG,"UnityGetKnowTypeList:" + productId );
|
||||||
String currentChannel = getCurrentChannelForLog();
|
final PayEventData.PayReq mPayReq = new PayEventData.PayReq();
|
||||||
SDKLog.i("[SDKManager.UnityKnowNew] channel=" + currentChannel
|
mPayReq.prodId = productId;
|
||||||
+ ", adapter=" + (sdkAdapter != null ? sdkAdapter.getClass().getName() : "null")
|
SDKAPI.getIns().charge(mPayReq , new SDKCallBack.Base1() {
|
||||||
+ ", ptype=" + ptype
|
@Override
|
||||||
+ ", productId=" + productId
|
public void callback(int code, String msg) {
|
||||||
+ ", productPrice=" + productPrice
|
SDKLog.e("====> code= " + code + " msg= " + msg);
|
||||||
+ ", productName=" + productName
|
try {
|
||||||
+ ", productCount=" + productCount
|
JSONObject result = new JSONObject();
|
||||||
+ ", orderId=" + prodorderId);
|
result.put("code", code);
|
||||||
if (sdkAdapter instanceof IPaymentAdapter) {
|
if(code == 0){
|
||||||
((IPaymentAdapter) sdkAdapter).pay(UnityPlayer.currentActivity, productId, productPrice, productName, productCount, prodorderId, appInfo);
|
result.put("respObj", msg);
|
||||||
return;
|
}else {
|
||||||
}
|
result.put("errStr", msg);
|
||||||
|
}
|
||||||
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, result.toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
SDKLog.e("SDKManager-UnityGetKnowTypeList-Exception" + e);
|
||||||
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UnityKnowNew(String productId, String productPrice, String productName, String productCount, String prodorderId, String appInfo, String ptype)
|
||||||
|
{
|
||||||
PayEventData.PayData payData = new PayEventData.PayData();
|
PayEventData.PayData payData = new PayEventData.PayData();
|
||||||
final PayEventData.PayReq mPayReq = new PayEventData.PayReq();
|
final PayEventData.PayReq mPayReq = new PayEventData.PayReq();
|
||||||
mPayReq.prodId = productId;
|
mPayReq.prodId = productId;
|
||||||
mPayReq.prodPrice = productPrice;
|
mPayReq.prodPrice = productPrice;
|
||||||
mPayReq.prodName = productName;
|
mPayReq.prodName = productName;
|
||||||
mPayReq.prodCount = productCount;
|
mPayReq.prodCount = productCount;
|
||||||
|
// 此字段与服务端回调接口内的appInfo不对应,与orderId相对应
|
||||||
mPayReq.appInfo = prodorderId;
|
mPayReq.appInfo = prodorderId;
|
||||||
HashMap<String, String> map = new HashMap<String, String>();
|
HashMap<String, String> map = new HashMap<String, String>();
|
||||||
|
// 此字段(appInfo)可用于传递透传信息(此信息与服务端回调接口内的appInfo相对应)
|
||||||
map.put("appInfo", appInfo);
|
map.put("appInfo", appInfo);
|
||||||
mPayReq.extra = map;
|
mPayReq.extra = map;
|
||||||
payData.payReq = mPayReq;
|
payData.payReq = mPayReq;
|
||||||
PayType payType = new PayType();
|
PayType payType = new PayType();
|
||||||
payType.paytype = ptype;
|
payType.paytype = ptype;
|
||||||
SDKLog.i("[SDKManager.UnityKnowNew] payNew payType.paytype=" + payType.paytype);
|
|
||||||
SDKAPI.getIns().payNew(payData, payType, mPay);
|
SDKAPI.getIns().payNew(payData, payType, mPay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getCurrentChannelForLog() {
|
|
||||||
try {
|
|
||||||
if (sdkAdapter != null && !TextUtils.isEmpty(sdkAdapter.getChannel())) {
|
|
||||||
return sdkAdapter.getChannel();
|
|
||||||
}
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return TextUtils.isEmpty(channel) ? "GooglePlay" : channel;
|
public static void thirdExtend()
|
||||||
}
|
{
|
||||||
|
Log.e(TAG,"====>java thirdExtend");
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// thirdExtend with channel helper support
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
public static void thirdExtend() {
|
|
||||||
Log.e(TAG, "thirdExtend called, sdkAdapter=" + (sdkAdapter != null ? sdkAdapter.getClass().getSimpleName() : "null"));
|
|
||||||
if (sdkAdapter instanceof IProductQueryAdapter) {
|
|
||||||
((IProductQueryAdapter) sdkAdapter).queryProducts();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
defaultThirdExtend();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void defaultThirdExtend() {
|
|
||||||
Log.e(TAG, "====>java thirdExtend");
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
try {
|
try {
|
||||||
jsonObject.put("action", "ACTION_GET_SKU_DETAILS_LIST");
|
jsonObject.put("action","ACTION_GET_SKU_DETAILS_LIST");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
SDKAPI.getIns().thirdExtend(jsonObject.toString(), new SDKCallBack.Extend() {
|
SDKAPI.getIns().thirdExtend(jsonObject.toString(), new SDKCallBack.Extend() {
|
||||||
@Override
|
@Override public void callback(int code, String msg) {
|
||||||
public void callback(int code, String msg) {
|
|
||||||
Log.e(TAG, "====>thirdExtend code= " + code + " msg= " + msg);
|
Log.e(TAG,"====>thirdExtend code= " + code + " msg= " + msg );
|
||||||
try {
|
try {
|
||||||
|
//获取成功,msg即为对应的json字符串
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("code", code);
|
result.put("code", code);
|
||||||
if (code == SDKCallBack.Extend.EXTEND_CODE_SUCCESS) {
|
if(code == SDKCallBack.Extend.EXTEND_CODE_SUCCESS){
|
||||||
result.put("respObj", ChannelAdapterManager.normalizeSkuList(msg));
|
result.put("respObj", msg);
|
||||||
} else {
|
}else {
|
||||||
Log.e(TAG, "thirdExtend failed: " + msg);
|
Log.e(TAG,"获取商品列表失败啦:" + msg);
|
||||||
result.put("thirdExtend_errStr", msg);
|
result.put("thirdExtend_errStr", msg);
|
||||||
}
|
}
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, result.toString());
|
||||||
ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, result.toString());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SDKLog.e("SDKManager-thirdExtend-Exception" + e);
|
SDKLog.e("SDKManager-UnityGetKnowTypeList-Exception" + e);
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
||||||
ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
private static IGASDK GetGameGa(){
|
||||||
// GA (shared)
|
if(gasdk == null){
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected static IGASDK GetGameGa() {
|
|
||||||
if (gasdk == null) {
|
|
||||||
GAConfiguration.Builder builder = new GAConfiguration.Builder()
|
GAConfiguration.Builder builder = new GAConfiguration.Builder()
|
||||||
.withBaseUrl(BaseUrl.INTERNATIONAL)
|
.withBaseUrl(BaseUrl.INTERNATIONAL)
|
||||||
.withContext(SDKWrapper.getInstance().getContext())
|
.withContext(SDKWrapper.getInstance().getContext())
|
||||||
@@ -592,68 +434,82 @@ public class SDKManager {
|
|||||||
return gasdk;
|
return gasdk;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetGaUserInfo(String userId) {
|
public static void SetGaUserInfo(String userId)
|
||||||
Log.e(TAG, "SetGaUserInfo : " + userId);
|
{
|
||||||
// SDKLog.i("SetGaUserInfo : " + userId);
|
Log.e(TAG,"SetGaUserInfo : " + userId);
|
||||||
|
SDKLog.i("SetGaUserInfo : " + userId);
|
||||||
GetGameGa().setUserId(userId);
|
GetGameGa().setUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetGaCommonInfo(String SetGaCommonInfo) {
|
public static void SetGaCommonInfo(String SetGaCommonInfo)
|
||||||
Log.e(TAG, "SetGaCommonInfo : " + SetGaCommonInfo);
|
{
|
||||||
// SDKLog.i("SetGaCommonInfo : " + SetGaCommonInfo);
|
Log.e(TAG,"SetGaCommonInfo : " + SetGaCommonInfo);
|
||||||
|
SDKLog.i("SetGaCommonInfo : " + SetGaCommonInfo);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Map<String, Object> map = gson.fromJson(SetGaCommonInfo,
|
Map<String, Object> map = gson.fromJson(SetGaCommonInfo, new TypeToken<Map<String, Object>>(){}.getType());
|
||||||
new TypeToken<Map<String, Object>>() {}.getType());
|
|
||||||
for (String key : map.keySet()) {
|
for (String key : map.keySet()) {
|
||||||
if (!TextUtils.isEmpty(key) && map.get(key) != null) {
|
System.out.println("Key = " + key + ", Value = " + map.get(key));
|
||||||
|
if(!TextUtils.isEmpty(key) && map.get(key) != null){
|
||||||
GetGameGa().addCommonParameter(key, map.get(key).toString());
|
GetGameGa().addCommonParameter(key, map.get(key).toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GAReportParams(int type, String eventstr, String paramstr) {
|
public static void GAReportParams(int type, String eventstr, String paramstr)
|
||||||
|
{
|
||||||
ParamsBuilder paramsBuilder = ParamsBuilder.newInstance();
|
ParamsBuilder paramsBuilder = ParamsBuilder.newInstance();
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Map<String, Object> map = gson.fromJson(paramstr,
|
Map<String, Object> map = gson.fromJson(paramstr, new TypeToken<Map<String, Object>>(){}.getType());
|
||||||
new TypeToken<Map<String, Object>>() {}.getType());
|
|
||||||
for (String key : map.keySet()) {
|
for (String key : map.keySet()) {
|
||||||
if (!TextUtils.isEmpty(key) && map.get(key) != null) {
|
if(!TextUtils.isEmpty(key) && map.get(key) != null){
|
||||||
paramsBuilder.append(key, map.get(key).toString());
|
paramsBuilder.append(key, map.get(key).toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (type) {
|
// GA_TRACK = 1, //默认类型
|
||||||
case 2: GetGameGa().track(EventType.COIN, eventstr, paramsBuilder); break;
|
// GA_CION = 2, //金流相关事件
|
||||||
case 3: GetGameGa().track(EventType.PAY, eventstr, paramsBuilder); break;
|
// GA_PAY = 3, //支付相关事件
|
||||||
case 4: GetGameGa().track(EventType.GAME, eventstr, paramsBuilder); break;
|
// GA_GAME = 4, //游戏行为
|
||||||
case 5: GetGameGa().track(EventType.LOGIN, eventstr, paramsBuilder); break;
|
// GA_LOGIN = 5, //登录注册相关事件
|
||||||
case 6: GetGameGa().track(EventType.PUSH, eventstr, paramsBuilder); break;
|
// GA_PUSH = 6, //推送相关事件
|
||||||
case 7: GetGameGa().track(EventType.ADBOX, eventstr, paramsBuilder); break;
|
// GA_ADBOX = 7, //adbox相关事件
|
||||||
case 8: GetGameGa().track(EventType.PREFORMANCE, eventstr, paramsBuilder); break;
|
// GA_PREFORMANCE = 8, //性能上报相关事件
|
||||||
case 9: GetGameGa().track(EventType.SDK, eventstr, paramsBuilder); break;
|
// GA_SDK = 9, //SDK相关事件
|
||||||
default: GetGameGa().track(EventType.TRACK, eventstr, paramsBuilder); break;
|
// GA_ABTest = 10, //abtest相关事件
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
GetGameGa().track(EventType.COIN , eventstr, paramsBuilder);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
GetGameGa().track(EventType.PAY , eventstr, paramsBuilder);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
GetGameGa().track(EventType.GAME , eventstr, paramsBuilder);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
GetGameGa().track(EventType.LOGIN , eventstr, paramsBuilder);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
GetGameGa().track(EventType.PUSH , eventstr, paramsBuilder);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
GetGameGa().track(EventType.ADBOX , eventstr, paramsBuilder);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
GetGameGa().track(EventType.PREFORMANCE , eventstr, paramsBuilder);
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
GetGameGa().track(EventType.SDK , eventstr, paramsBuilder);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
GetGameGa().track(EventType.TRACK , eventstr, paramsBuilder);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
public static void Review()
|
||||||
// Review channel dispatch
|
{
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
public static void Review() {
|
|
||||||
Log.w(TAG, "[ReviewDebug] Review called channel=" + channel);
|
|
||||||
if ("Rustore".equals(channel)) {
|
|
||||||
RuStoreReview();
|
|
||||||
} else if ("Flexion".equals(channel)) {
|
|
||||||
if (sdkAdapter instanceof IReviewAdapter) {
|
|
||||||
((IReviewAdapter) sdkAdapter).review(UnityPlayer.currentActivity);
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Review skipped: no Flexion review adapter");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
GooglePlayReview();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void GooglePlayReview() {
|
|
||||||
ReviewManager manager = ReviewManagerFactory.create(SDKWrapper.getInstance().getContext());
|
ReviewManager manager = ReviewManagerFactory.create(SDKWrapper.getInstance().getContext());
|
||||||
Task<ReviewInfo> request = manager.requestReviewFlow();
|
Task<ReviewInfo> request = manager.requestReviewFlow();
|
||||||
request.addOnCompleteListener(reqTask -> {
|
request.addOnCompleteListener(reqTask -> {
|
||||||
@@ -662,59 +518,16 @@ public class SDKManager {
|
|||||||
Activity activity = UnityPlayer.currentActivity;
|
Activity activity = UnityPlayer.currentActivity;
|
||||||
manager.launchReviewFlow(activity, reviewInfo);
|
manager.launchReviewFlow(activity, reviewInfo);
|
||||||
} else {
|
} else {
|
||||||
@ReviewErrorCode int reviewErrorCode =
|
@ReviewErrorCode int reviewErrorCode = ((ReviewException) request.getException()).getErrorCode();
|
||||||
((ReviewException) request.getException()).getErrorCode();
|
Log.e(TAG,"Review Error code: " + reviewErrorCode);
|
||||||
Log.e(TAG, "Review Error code: " + reviewErrorCode);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// RuStore two-step review
|
public static void FBShareLink(String title, String content, String url)
|
||||||
public interface ReviewResultCallback {
|
{
|
||||||
void onReviewSuccess(JSONObject result);
|
Log.e(TAG,"FBShareLink : " + title + " " + content + " " + url);
|
||||||
void onReviewError(int code, String msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RequestRustoreReView(ReviewResultCallback callback) {
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
try { json.put("action", "ACTION_REQUEST_REVIEW"); } catch (JSONException e) { throw new RuntimeException(e); }
|
|
||||||
SDKAPI.getIns().thirdExtend(json.toString(), (code, msg) -> {
|
|
||||||
Log.e(TAG, "RequestRustoreReView code=" + code + " msg=" + msg);
|
|
||||||
try {
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
result.put("code", code);
|
|
||||||
if (code == SDKCallBack.Extend.EXTEND_CODE_SUCCESS) {
|
|
||||||
if (callback != null) callback.onReviewSuccess(result);
|
|
||||||
} else {
|
|
||||||
result.put("thirdExtend_errStr", msg);
|
|
||||||
if (callback != null) callback.onReviewError(code, msg);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
SDKLog.e("RequestRustoreReView Exception: " + e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void LaunchRustoreView() {
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
try { json.put("action", "ACTION_LAUNCH_REVIEW"); } catch (JSONException e) { throw new RuntimeException(e); }
|
|
||||||
SDKAPI.getIns().thirdExtend(json.toString(), (code, msg) ->
|
|
||||||
Log.e(TAG, "LaunchRustoreView code=" + code + " msg=" + msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RuStoreReview() {
|
|
||||||
RequestRustoreReView(new ReviewResultCallback() {
|
|
||||||
@Override public void onReviewSuccess(JSONObject result) { LaunchRustoreView(); }
|
|
||||||
@Override public void onReviewError(int code, String msg) { }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// Facebook / Messenger share (shared)
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
public static void FBShareLink(String title, String content, String url) {
|
|
||||||
Log.e(TAG, "FBShareLink : " + title + " " + content + " " + url);
|
|
||||||
if (ShareDialog.canShow(ShareLinkContent.class)) {
|
if (ShareDialog.canShow(ShareLinkContent.class)) {
|
||||||
Activity activity = UnityPlayer.currentActivity;
|
Activity activity = UnityPlayer.currentActivity;
|
||||||
ShareDialog dialog = new ShareDialog(activity);
|
ShareDialog dialog = new ShareDialog(activity);
|
||||||
@@ -723,52 +536,42 @@ public class SDKManager {
|
|||||||
.setContentUrl(Uri.parse(url))
|
.setContentUrl(Uri.parse(url))
|
||||||
.build();
|
.build();
|
||||||
dialog.show(linkContent);
|
dialog.show(linkContent);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Log.e(TAG, "FBShareDialog can not show");
|
Log.e(TAG, "FBShareDialog can not show");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MessengerShareLink(String title, String content, String url) {
|
public static void MessengerShareLink(String title, String content, String url)
|
||||||
Log.e(TAG, "MessengerShareLink : " + title + " " + content + " " + url);
|
{
|
||||||
|
Log.e(TAG,"MessengerShareLink : " + title + " " + content + " " + url);
|
||||||
if (MessageDialog.canShow(ShareLinkContent.class)) {
|
if (MessageDialog.canShow(ShareLinkContent.class)) {
|
||||||
Activity activity = UnityPlayer.currentActivity;
|
Activity activity = UnityPlayer.currentActivity;
|
||||||
ShareLinkContent linkContent = new ShareLinkContent.Builder()
|
ShareLinkContent linkContent = new ShareLinkContent.Builder()
|
||||||
.setQuote(content)
|
.setQuote(content)
|
||||||
.setContentUrl(Uri.parse(url))
|
.setContentUrl(Uri.parse(url))
|
||||||
.build();
|
.build();
|
||||||
MessageDialog.show(activity, linkContent);
|
MessageDialog.show(activity,linkContent);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Log.e(TAG, "Messenger ShareDialog can not show");
|
Log.e(TAG, "Messenger ShareDialog can not show");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetDNSIPsEnable(boolean enable) {
|
public static void SetDNSIPsEnable(boolean enable) {
|
||||||
if ("Flexion".equals(channel)) {
|
SDKAPI.enableDoh(enable);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(enable) {
|
if(enable) {
|
||||||
SetDNSIPs(true, new String[]{
|
SDKAPI.setHttpDnsIps(new String[]{
|
||||||
"34.111.1.231",
|
"34.111.1.231",
|
||||||
"2600:1901:0:c31b::"
|
"2600:1901:0:c31b::"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
SetDNSIPs(false, new String[0]);
|
SDKAPI.setHttpDnsIps(new String[0]);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SetDNSIPs(boolean enable, String[] ips) {
|
|
||||||
InvokeSDKAPIStaticMethod("enableDoh", new Class[]{boolean.class}, new Object[]{enable});
|
|
||||||
InvokeSDKAPIStaticMethod("setHttpDnsIps", new Class[]{String[].class}, new Object[]{ips});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void InvokeSDKAPIStaticMethod(String methodName, Class<?>[] parameterTypes, Object[] args) {
|
|
||||||
try {
|
|
||||||
SDKAPI.class.getMethod(methodName, parameterTypes).invoke(null, args);
|
|
||||||
} catch (NoSuchMethodException ignored) {
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 1f7e4cbb67a383441bd126c06021a072
|
guid: b4630fc5c78457748a2f763ac5168df6
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
namespace tysdk
|
|
||||||
{
|
|
||||||
public static class ChannelConfig
|
|
||||||
{
|
|
||||||
public static string Channel { get; private set; } = "GooglePlay";
|
|
||||||
|
|
||||||
public static string PayType => Channel switch
|
|
||||||
{
|
|
||||||
"Rustore" => "rustore.global.app",
|
|
||||||
"Flexion" => "flexion.global.app",
|
|
||||||
"EnjoyPay" => "enjoypay.global.h5.web",
|
|
||||||
_ => "googleiab.global.app"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static int LoginTimeoutSeconds => Channel == "Rustore" ? 120 : 30;
|
|
||||||
|
|
||||||
public static void SetChannel(string channel) { Channel = channel; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6dcc4e666f5907a47b1843de49da6f67
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: cca93fc1d8dde744a86aff3c3a1b73ed
|
guid: 292a655e788d84d34aac4f83c57706ff
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@@ -105,12 +105,6 @@ namespace tysdk
|
|||||||
public static AccountInfo TYAccountInfo => _accountInfo;
|
public static AccountInfo TYAccountInfo => _accountInfo;
|
||||||
|
|
||||||
private static TYSdkFacade _instance;
|
private static TYSdkFacade _instance;
|
||||||
public static bool IsSdkInited { get; private set; }
|
|
||||||
public static bool IsInitStarted { get; private set; }
|
|
||||||
public static bool HasInitResult { get; private set; }
|
|
||||||
public static string LastInitMessage { get; private set; }
|
|
||||||
public static event System.Action<bool, string> OnInitComplete;
|
|
||||||
|
|
||||||
public static TYSdkFacade Instance
|
public static TYSdkFacade Instance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -125,46 +119,12 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
Debug.Log("[FLX-INIT] TYSdkFacade Init");
|
|
||||||
IsInitStarted = true;
|
|
||||||
HasInitResult = false;
|
|
||||||
LastInitMessage = string.Empty;
|
|
||||||
#if UNITY_ANDROID
|
#if UNITY_ANDROID
|
||||||
UnityBridgeFunc.InitSDK(ChannelConfig.Channel);
|
UnityBridgeFunc.InitSDK();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetChannelFromNative(string channel)
|
|
||||||
{
|
|
||||||
// Debug.Log($"[TYSdkFacade] SetChannelFromNative: {channel}");
|
|
||||||
ChannelConfig.SetChannel(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InitResult(string json)
|
|
||||||
{
|
|
||||||
Debug.Log($"[FLX-INIT] TYSdkFacade InitResult: {json}");
|
|
||||||
var success = false;
|
|
||||||
var msg = string.Empty;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var data = JObject.Parse(json);
|
|
||||||
success = (int)data["code"] == 0;
|
|
||||||
msg = (string)data["msg"];
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
msg = e.Message;
|
|
||||||
Debug.LogWarning($"[TYSdkFacade] InitResult parse failed: {e}");
|
|
||||||
}
|
|
||||||
|
|
||||||
IsSdkInited = success;
|
|
||||||
HasInitResult = true;
|
|
||||||
LastInitMessage = msg;
|
|
||||||
OnInitComplete?.Invoke(success, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*================================================
|
/*================================================
|
||||||
|
|
||||||
@@ -181,7 +141,7 @@ namespace tysdk
|
|||||||
|
|
||||||
public void Logout()
|
public void Logout()
|
||||||
{
|
{
|
||||||
// UnityEngine.Debug.Log("Logout");
|
UnityEngine.Debug.Log("Logout");
|
||||||
if (_accountInfo != null)
|
if (_accountInfo != null)
|
||||||
{
|
{
|
||||||
UnityBridgeFunc.UnityLogOutByChannel(_accountInfo.channel);
|
UnityBridgeFunc.UnityLogOutByChannel(_accountInfo.channel);
|
||||||
@@ -261,7 +221,7 @@ namespace tysdk
|
|||||||
|
|
||||||
public async Task<LoginInfo> LoginBySns()
|
public async Task<LoginInfo> LoginBySns()
|
||||||
{
|
{
|
||||||
// Debug.Log("[TYSdkFacade] LoginBySns");
|
Debug.Log("[TYSdkFacade] LoginBySns");
|
||||||
|
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(30));
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(30));
|
||||||
|
|
||||||
@@ -294,7 +254,7 @@ namespace tysdk
|
|||||||
|
|
||||||
public void LoginResult(string json)
|
public void LoginResult(string json)
|
||||||
{
|
{
|
||||||
// Debug.Log("[TYSdkFacade] Login callback:");
|
Debug.Log("[TYSdkFacade] Login callback:");
|
||||||
var result = new LoginInfo();
|
var result = new LoginInfo();
|
||||||
var data = JObject.Parse(json);
|
var data = JObject.Parse(json);
|
||||||
var code = (int)data["code"];
|
var code = (int)data["code"];
|
||||||
@@ -330,9 +290,6 @@ namespace tysdk
|
|||||||
result.isSuccess = true;
|
result.isSuccess = true;
|
||||||
result.userId = _accountInfo.userId;
|
result.userId = _accountInfo.userId;
|
||||||
SetUserInfo();
|
SetUserInfo();
|
||||||
#if UNITY_ANDROID
|
|
||||||
UnityBridgeFunc.RefreshBillingService();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
||||||
@@ -425,9 +382,6 @@ namespace tysdk
|
|||||||
{
|
{
|
||||||
_accountInfo.AddLinkedAccount(accoutType);
|
_accountInfo.AddLinkedAccount(accoutType);
|
||||||
_accountInfo.Save();
|
_accountInfo.Save();
|
||||||
#if UNITY_ANDROID
|
|
||||||
UnityBridgeFunc.RefreshBillingService();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -561,7 +515,7 @@ namespace tysdk
|
|||||||
//对sign进行MD5加密
|
//对sign进行MD5加密
|
||||||
string signMd5 = CalculateMD5Hash(sign);
|
string signMd5 = CalculateMD5Hash(sign);
|
||||||
string url = $"{tycs}?{listStr}&sign={signMd5}&isAbroad=1&lan=en";
|
string url = $"{tycs}?{listStr}&sign={signMd5}&isAbroad=1&lan=en";
|
||||||
// Debug.Log($"[TYSdkFacade:Signout] url \n{url}");
|
Debug.Log($"[TYSdkFacade:Signout] url \n{url}");
|
||||||
Application.OpenURL(url);
|
Application.OpenURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,4 +542,4 @@ namespace tysdk
|
|||||||
return sBuilder.ToString();
|
return sBuilder.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: f2fa4b960a2b4594d80ea8b8caa2912d
|
guid: db12db58fbcc54046aa4dac203cd4971
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 280d33ff6fcb3a342ab9683a01841b78
|
guid: 8f92075f5f98490ca94ae4984ac0aa21
|
||||||
MonoImporter:
|
timeCreated: 1722855901
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,11 +1,3 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: aa58ede4826973c4bbe3a5ebfdcd4b43
|
guid: 18459dcf8d5a40dc80ffae5333a6b0c9
|
||||||
MonoImporter:
|
timeCreated: 1722855439
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -32,11 +32,10 @@ namespace tysdk
|
|||||||
if(purchaseInfo == null)
|
if(purchaseInfo == null)
|
||||||
purchaseInfo = new JObject();
|
purchaseInfo = new JObject();
|
||||||
|
|
||||||
purchaseInfo["orderId"] = orderId;
|
|
||||||
string extraInfo = purchaseInfo.ToString(Newtonsoft.Json.Formatting.None);
|
string extraInfo = purchaseInfo.ToString(Newtonsoft.Json.Formatting.None);
|
||||||
//to base64
|
//to base64
|
||||||
extraInfo = Convert.ToBase64String(Encoding.UTF8.GetBytes(extraInfo));
|
extraInfo = Convert.ToBase64String(Encoding.UTF8.GetBytes(extraInfo));
|
||||||
// Debug.Log("[TYSdk] extraInfo: " + extraInfo);
|
Debug.Log("[TYSdk] extraInfo: " + extraInfo);
|
||||||
var prodId = prod.ProdID;
|
var prodId = prod.ProdID;
|
||||||
var prodPrice = usdprice.ToString();
|
var prodPrice = usdprice.ToString();
|
||||||
var prodName = prod.title;
|
var prodName = prod.title;
|
||||||
@@ -58,12 +57,15 @@ namespace tysdk
|
|||||||
return result;
|
return result;
|
||||||
#elif UNITY_ANDROID
|
#elif UNITY_ANDROID
|
||||||
|
|
||||||
var pType = ChannelConfig.PayType;
|
var pType = "googleiab.global.app";
|
||||||
Debug.Log($"[TYSdkFacade::Pay] Channel={ChannelConfig.Channel}, PayType={pType}, prodId={prodId}, price={prodPrice}, orderId={orderId}");
|
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<PaymentInfo>(TimeSpan.FromSeconds(90));
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<PaymentInfo>(TimeSpan.FromSeconds(30));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//UnityBridgeFunc.UnityKnow(prodId, prodName, count.ToString(), orderId, extraInfo);
|
||||||
UnityBridgeFunc.UnityKnowNew(prodId, prodPrice, prodName, count.ToString(), orderId, extraInfo,pType);
|
UnityBridgeFunc.UnityKnowNew(prodId, prodPrice, prodName, count.ToString(), orderId, extraInfo,pType);
|
||||||
|
|
||||||
var result = await task;
|
var result = await task;
|
||||||
result.count = count;
|
result.count = count;
|
||||||
result.orderId = orderId;
|
result.orderId = orderId;
|
||||||
@@ -109,29 +111,11 @@ namespace tysdk
|
|||||||
//支付的回调
|
//支付的回调
|
||||||
public void PayResult(string json)
|
public void PayResult(string json)
|
||||||
{
|
{
|
||||||
// Debug.Log("[TYSdkFacade] pay callback:" + json);
|
Debug.Log("[TYSdkFacade] pay callback:" + json);
|
||||||
var jresult = JObject.Parse(json);
|
var jresult = JObject.Parse(json);
|
||||||
var result = new PaymentInfo();
|
var result = new PaymentInfo();
|
||||||
result.code = jresult["code"].ToString();
|
result.code = jresult["code"].ToString();
|
||||||
result.msg = jresult["errStr"].ToString();
|
result.msg = jresult["errStr"].ToString();
|
||||||
var purchaseJson = jresult["purchaseJson"]?.ToString();
|
|
||||||
var signature = jresult["signature"]?.ToString();
|
|
||||||
var purchaseToken = jresult["purchaseToken"]?.ToString();
|
|
||||||
result.purchaseJson = purchaseJson;
|
|
||||||
result.signature = signature;
|
|
||||||
result.purchaseToken = purchaseToken;
|
|
||||||
if (!string.IsNullOrEmpty(purchaseJson) || !string.IsNullOrEmpty(purchaseToken))
|
|
||||||
{
|
|
||||||
result.Receipt = new PaymentReceipt
|
|
||||||
{
|
|
||||||
Provider = PaymentReceiptProvider.Flexion,
|
|
||||||
PurchaseJson = purchaseJson,
|
|
||||||
Signature = signature,
|
|
||||||
PurchaseToken = purchaseToken
|
|
||||||
};
|
|
||||||
}
|
|
||||||
result.storeOrderId = jresult["orderId"]?.ToString();
|
|
||||||
result.userId = _accountInfo?.strUserId;
|
|
||||||
if(result.code == "-1")
|
if(result.code == "-1")
|
||||||
{
|
{
|
||||||
if (!_payFirstNegativeHandled)
|
if (!_payFirstNegativeHandled)
|
||||||
@@ -160,115 +144,30 @@ namespace tysdk
|
|||||||
var result = new ProductListInfo();
|
var result = new ProductListInfo();
|
||||||
return result;
|
return result;
|
||||||
#elif UNITY_ANDROID || UNITY_IOS
|
#elif UNITY_ANDROID || UNITY_IOS
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<ProductListInfo>(TimeSpan.FromSeconds(45));
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<ProductListInfo>();
|
||||||
UnityBridgeFunc.GetSKUList();
|
UnityBridgeFunc.GetSKUList();
|
||||||
try
|
var result = await task;
|
||||||
{
|
return result;
|
||||||
var result = await task;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
catch (TaskCanceledException e)
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[TYSdkFacade] GetSKUList timeout: {e.Message}");
|
|
||||||
return new ProductListInfo() { code = 1, msg = "sku_callback_timeout" };
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//通过商品ID列表获取商品详情(Flexion 渠道使用)
|
|
||||||
public async Task<ProductListInfo> GetSKUListByIapIds(string productIds)
|
|
||||||
{
|
|
||||||
if (!IsLoggedIn) return new ProductListInfo() { code = -1, msg = "未登录" };
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
await Task.Yield();
|
|
||||||
return new ProductListInfo();
|
|
||||||
#elif UNITY_ANDROID
|
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<ProductListInfo>(TimeSpan.FromSeconds(45));
|
|
||||||
UnityBridgeFunc.GetSKUListByIapIds(productIds);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = await task;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
catch (TaskCanceledException e)
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[TYSdkFacade] GetSKUListByIapIds timeout: {e.Message}");
|
|
||||||
return new ProductListInfo() { code = 1, msg = "sku_callback_timeout" };
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return new ProductListInfo() { code = -1, msg = "unsupported platform" };
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//商品列表的回调
|
//商品列表的回调
|
||||||
public void SKUListResult(string json)
|
public void SKUListResult(string json)
|
||||||
{
|
{
|
||||||
// Debug.Log("[TYSdkFacade] GetSKUList callback");
|
Debug.Log("[TYSdkFacade] GetSKUList callback");
|
||||||
|
var jresult = JObject.Parse(json);
|
||||||
|
int code = int.Parse(jresult["code"].ToString());
|
||||||
var result = new ProductListInfo();
|
var result = new ProductListInfo();
|
||||||
try
|
if (code == 0)
|
||||||
{
|
{
|
||||||
var jresult = JObject.Parse(json);
|
string productStr = jresult["respObj"].ToString();
|
||||||
int code = jresult["code"]?.Value<int>() ?? 1;
|
|
||||||
result.code = code;
|
result.code = code;
|
||||||
if (code == 0)
|
|
||||||
{
|
|
||||||
string productStr = jresult["respObj"]?.ToString();
|
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
||||||
result.products = jsonObjList;
|
result.products = jsonObjList;
|
||||||
#elif UNITY_IOS && !UNITY_EDITOR
|
#elif UNITY_IOS && !UNITY_EDITOR
|
||||||
result.ReadSKUFromJson(productStr);
|
result.ReadSKUFromJson(productStr);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[TYSdkFacade] SKUListResult parse failed: {e.Message}");
|
|
||||||
result.code = 1;
|
|
||||||
result.msg = e.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<PendingPurchaseListInfo> QueryPendingPurchases()
|
|
||||||
{
|
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<PendingPurchaseListInfo>(TimeSpan.FromSeconds(30));
|
|
||||||
UnityBridgeFunc.QueryPendingPurchases();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return await task;
|
|
||||||
}
|
|
||||||
catch (TaskCanceledException e)
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[TYSdkFacade] QueryPendingPurchases timeout: {e.Message}");
|
|
||||||
return new PendingPurchaseListInfo { code = 1, msg = "pending_purchase_callback_timeout" };
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
await Task.Yield();
|
|
||||||
return new PendingPurchaseListInfo { code = 0, purchasesJson = "[]" };
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PendingPurchasesResult(string json)
|
|
||||||
{
|
|
||||||
Debug.Log($"[TYSdkFacade] PendingPurchasesResult: {json}");
|
|
||||||
var result = new PendingPurchaseListInfo();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var jresult = JObject.Parse(json);
|
|
||||||
result.code = jresult["code"]?.Value<int>() ?? 1;
|
|
||||||
result.msg = jresult["errStr"]?.ToString() ?? string.Empty;
|
|
||||||
result.purchasesJson = jresult["respObj"]?.ToString() ?? "[]";
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"[TYSdkFacade] PendingPurchasesResult parse failed: {e.Message}");
|
|
||||||
result.code = 1;
|
|
||||||
result.msg = e.Message;
|
|
||||||
result.purchasesJson = "[]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e05900a4aa124d746bfe9c15328fd0e9
|
guid: 41b6dc16dbab43388317bf9ff032cdca
|
||||||
MonoImporter:
|
timeCreated: 1722855703
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace tysdk
|
namespace tysdk
|
||||||
{
|
{
|
||||||
@@ -15,31 +14,6 @@ namespace tysdk
|
|||||||
none
|
none
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PaymentReceiptProvider
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
Flexion
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PaymentReceipt
|
|
||||||
{
|
|
||||||
public PaymentReceiptProvider Provider;
|
|
||||||
public string PurchaseJson;
|
|
||||||
public string Signature;
|
|
||||||
public string PurchaseToken;
|
|
||||||
|
|
||||||
public bool HasPayload => !string.IsNullOrEmpty(PurchaseJson);
|
|
||||||
public bool CanConsume => !string.IsNullOrEmpty(PurchaseToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PaymentReceiptVerification
|
|
||||||
{
|
|
||||||
public bool Verified;
|
|
||||||
public string ServerOrderId;
|
|
||||||
public int ProviderCode;
|
|
||||||
public string ProviderMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LoginInfo
|
public class LoginInfo
|
||||||
{
|
{
|
||||||
public bool isSuccess;
|
public bool isSuccess;
|
||||||
@@ -85,38 +59,6 @@ namespace tysdk
|
|||||||
public string code;
|
public string code;
|
||||||
public string msg;
|
public string msg;
|
||||||
|
|
||||||
// Compatibility fields for legacy server payload and existing call sites.
|
|
||||||
// New payment flow should read receipt data from Receipt.
|
|
||||||
// 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;
|
|
||||||
// Flexion: purchase token, used to consume after server verification
|
|
||||||
public string purchaseToken;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public PaymentReceipt Receipt;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public PaymentReceiptVerification ReceiptVerification;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool HasReceipt => Receipt != null && Receipt.HasPayload;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool CanConsumeReceipt => Receipt != null && Receipt.CanConsume;
|
|
||||||
|
|
||||||
// Store order ID from Flexion SDK (e.g. GPA.xxx)
|
|
||||||
public string storeOrderId;
|
|
||||||
|
|
||||||
public bool verified;
|
|
||||||
|
|
||||||
// Server-side order ID returned from verification
|
|
||||||
public string serverOrderId;
|
|
||||||
|
|
||||||
// Player ID for server-side verification
|
|
||||||
public string userId;
|
|
||||||
|
|
||||||
public bool Check(string orderId, string productId)
|
public bool Check(string orderId, string productId)
|
||||||
{
|
{
|
||||||
confirmed = orderId == this.orderId && productId == this.productId;
|
confirmed = orderId == this.orderId && productId == this.productId;
|
||||||
@@ -158,13 +100,6 @@ namespace tysdk
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PendingPurchaseListInfo
|
|
||||||
{
|
|
||||||
public int code = 1;
|
|
||||||
public string msg = string.Empty;
|
|
||||||
public string purchasesJson = "[]";
|
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_IOS
|
#if UNITY_IOS
|
||||||
public class SKUDetail
|
public class SKUDetail
|
||||||
{
|
{
|
||||||
@@ -197,8 +132,6 @@ namespace tysdk
|
|||||||
public string productId;
|
public string productId;
|
||||||
public string title;
|
public string title;
|
||||||
public string type;
|
public string type;
|
||||||
public string currency;
|
|
||||||
public string price_amount;
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
@@ -217,11 +150,4 @@ namespace tysdk
|
|||||||
{
|
{
|
||||||
public bool isAccepted;
|
public bool isAccepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FlexionOrderResult
|
|
||||||
{
|
|
||||||
public int code { get; set; }
|
|
||||||
public string info { get; set; }
|
|
||||||
public string orderId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: ebabed604bd06e44099073951d667658
|
guid: b94c8e87cc23b4053a4cbf592ff14db3
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ namespace tysdk
|
|||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
//初始化sdk
|
//初始化sdk
|
||||||
public static void InitSDK(string channel){}
|
public static void InitSDK(){}
|
||||||
|
|
||||||
//更新登录支付域名
|
//更新登录支付域名
|
||||||
public static void UnityResetServerUrl(string url){}
|
public static void UnityResetServerUrl(string url){}
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ namespace tysdk
|
|||||||
public static void UnityLogin(EAccoutType accoutType){}
|
public static void UnityLogin(EAccoutType accoutType){}
|
||||||
|
|
||||||
public static void CleanLinkTmpSnsInfo() { }
|
public static void CleanLinkTmpSnsInfo() { }
|
||||||
|
|
||||||
|
|
||||||
public static void LinkAccount(EAccoutType accoutType){}
|
public static void LinkAccount(EAccoutType accoutType){}
|
||||||
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId){}
|
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId){}
|
||||||
@@ -44,16 +44,10 @@ namespace tysdk
|
|||||||
//获取商品列表
|
//获取商品列表
|
||||||
public static void GetSKUList() { }
|
public static void GetSKUList() { }
|
||||||
|
|
||||||
public static void ConsumePurchase(string token) { }
|
|
||||||
|
|
||||||
public static void QueryPendingPurchases() { }
|
|
||||||
|
|
||||||
public static void RefreshBillingService() { }
|
|
||||||
|
|
||||||
public static bool IsGooglePlayServicesAvailable() { return true; }
|
|
||||||
|
|
||||||
//打点
|
//打点
|
||||||
public static void SetGaUserInfo(string userId){}
|
public static void SetGaUserInfo(string userId){}
|
||||||
|
|
||||||
|
|
||||||
public static void SetGaCommonInfo(string SetGaCommonInfo){}
|
public static void SetGaCommonInfo(string SetGaCommonInfo){}
|
||||||
|
|
||||||
public static void GAReportParams(int type, string eventstr, string paramstr){}
|
public static void GAReportParams(int type, string eventstr, string paramstr){}
|
||||||
@@ -75,13 +69,13 @@ namespace tysdk
|
|||||||
private static string SDK_CLASS = "com.unity3d.player.SDKManager";
|
private static string SDK_CLASS = "com.unity3d.player.SDKManager";
|
||||||
|
|
||||||
//初始化sdk
|
//初始化sdk
|
||||||
public static void InitSDK(string channel){
|
public static void InitSDK(){
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
using(var activityCls = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
|
using(var activityCls = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
|
||||||
{
|
{
|
||||||
var activity = activityCls.GetStatic<AndroidJavaObject>("currentActivity");
|
var activity = activityCls.GetStatic<AndroidJavaObject>("currentActivity");
|
||||||
sdkManager.CallStatic("InitSDK", activity, channel);
|
sdkManager.CallStatic("InitSDK", activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,58 +196,6 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//通过商品ID列表获取商品详情(Flexion 渠道使用)
|
|
||||||
public static void GetSKUListByIapIds(string productIds)
|
|
||||||
{
|
|
||||||
UnityEngine.Debug.Log("UnityBridgeFunc.GetSKUListByIapIds(productIds)");
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
|
||||||
sdkManager.CallStatic("queryProductsByIDs", productIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ConsumePurchase(string token)
|
|
||||||
{
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
|
||||||
sdkManager.CallStatic("ConsumePurchase", token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void QueryPendingPurchases()
|
|
||||||
{
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
|
||||||
sdkManager.CallStatic("QueryPendingPurchases");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RefreshBillingService()
|
|
||||||
{
|
|
||||||
UnityEngine.Debug.Log("UnityBridgeFunc.RefreshBillingService");
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
|
||||||
sdkManager.CallStatic("RefreshBillingService");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CancelBillingFlow()
|
|
||||||
{
|
|
||||||
UnityEngine.Debug.Log("UnityBridgeFunc.CancelBillingFlow");
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
|
||||||
sdkManager.CallStatic("CancelBillingFlow");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsGooglePlayServicesAvailable()
|
|
||||||
{
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
|
||||||
return sdkManager.CallStatic<bool>("IsGooglePlayServicesAvailable");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//打点
|
//打点
|
||||||
public static void SetGaUserInfo(string userId)
|
public static void SetGaUserInfo(string userId)
|
||||||
{
|
{
|
||||||
@@ -487,14 +429,6 @@ namespace tysdk
|
|||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
public static extern void MessengerShareLink(string title, string content, string url);
|
public static extern void MessengerShareLink(string title, string content, string url);
|
||||||
|
|
||||||
public static void ConsumePurchase(string token) { }
|
|
||||||
|
|
||||||
public static void QueryPendingPurchases() { }
|
|
||||||
|
|
||||||
public static void RefreshBillingService() { }
|
|
||||||
|
|
||||||
public static bool IsGooglePlayServicesAvailable() { return true; }
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e24b3b915d94468419519a81bb69e269
|
guid: 16335dd05906d48bf81e297920aecf31
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@@ -14,4 +14,4 @@
|
|||||||
"defineConstraints": [],
|
"defineConstraints": [],
|
||||||
"versionDefines": [],
|
"versionDefines": [],
|
||||||
"noEngineReferences": false
|
"noEngineReferences": false
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,16 @@
|
|||||||
{
|
{
|
||||||
"MonoBehaviour": {
|
"MonoBehaviour": {
|
||||||
"Version": 5,
|
"Version": 3,
|
||||||
"EnableBurstCompilation": true,
|
"EnableBurstCompilation": true,
|
||||||
"EnableOptimisations": true,
|
"EnableOptimisations": true,
|
||||||
"EnableSafetyChecks": false,
|
"EnableSafetyChecks": false,
|
||||||
"EnableDebugInAllBuilds": false,
|
"EnableDebugInAllBuilds": false,
|
||||||
"DebugDataKind": 0,
|
"UsePlatformSDKLinker": false,
|
||||||
"EnableArmv9SecurityFeatures": false,
|
|
||||||
"CpuMinTargetX32": 0,
|
"CpuMinTargetX32": 0,
|
||||||
"CpuMaxTargetX32": 0,
|
"CpuMaxTargetX32": 0,
|
||||||
"CpuMinTargetX64": 0,
|
"CpuMinTargetX64": 0,
|
||||||
"CpuMaxTargetX64": 0,
|
"CpuMaxTargetX64": 0,
|
||||||
"CpuTargetsX32": 6,
|
"CpuTargetsX32": 6,
|
||||||
"CpuTargetsX64": 72,
|
"CpuTargetsX64": 72
|
||||||
"OptimizeFor": 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ PlayerSettings:
|
|||||||
tvOS: 0
|
tvOS: 0
|
||||||
overrideDefaultApplicationIdentifier: 1
|
overrideDefaultApplicationIdentifier: 1
|
||||||
AndroidBundleVersionCode: 1
|
AndroidBundleVersionCode: 1
|
||||||
AndroidMinSdkVersion: 26
|
AndroidMinSdkVersion: 25
|
||||||
AndroidTargetSdkVersion: 35
|
AndroidTargetSdkVersion: 35
|
||||||
AndroidPreferredInstallLocation: 1
|
AndroidPreferredInstallLocation: 1
|
||||||
aotOptions:
|
aotOptions:
|
||||||
@@ -932,4 +932,4 @@ PlayerSettings:
|
|||||||
hmiLoadingImage: {fileID: 0}
|
hmiLoadingImage: {fileID: 0}
|
||||||
platformRequiresReadableAssets: 0
|
platformRequiresReadableAssets: 0
|
||||||
virtualTexturingSupportEnabled: 0
|
virtualTexturingSupportEnabled: 0
|
||||||
insecureHttpOption: 2
|
insecureHttpOption: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user