update:更新flexion 以及sdk 接入
This commit is contained in:
62
ExtraPluginCfgs/Android/flexion/AndroidManifest.xml
Normal file
62
ExtraPluginCfgs/Android/flexion/AndroidManifest.xml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.arkgame.ft.flexion"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp"
|
||||||
|
tools:replace="android:usesCleartextTraffic,android:fullBackupContent"
|
||||||
|
android:usesCleartextTraffic="true">
|
||||||
|
<activity android:name="com.unity3d.player.TYUnityActivity"
|
||||||
|
android:theme="@style/UnityThemeSelector">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q"/>
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:host="mainactivity" android:scheme="zzft" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<!-- 渠道标识,ChannelManager 读取此值以识别 Flexion 渠道 -->
|
||||||
|
<meta-data android:name="CHANNEL" android:value="Flexion" />
|
||||||
|
|
||||||
|
<!-- Flexion SDK 应用标识,从 DropPoint 获取 -->
|
||||||
|
<meta-data android:name="com.flexionmobile.fdk.apptoken" android:value="fishingtravel" />
|
||||||
|
|
||||||
|
<!-- 告知 Flexion SDK 当前为 Unity 项目,必须声明 -->
|
||||||
|
<meta-data android:name="com.flexionmobile.fdk.sdk-type" android:value="unity" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
覆盖 tuyoosdk AAR 中硬编码的 Facebook ContentProvider authority。
|
||||||
|
AAR 原值:com.facebook.app.FacebookContentProvider162066986963808
|
||||||
|
追加 ${applicationId}(Flexion 包名)作为后缀后,与 GP 版 authority 不同,
|
||||||
|
两个渠道包可同时安装在同一设备上,不会触发 INSTALL_FAILED_CONFLICTING_PROVIDER。
|
||||||
|
参考:Flexion 官方文档《Unique package name - follow-on requirements》
|
||||||
|
-->
|
||||||
|
<provider
|
||||||
|
android:name="com.facebook.FacebookContentProvider"
|
||||||
|
android:authorities="com.facebook.app.FacebookContentProvider162066986963808.${applicationId}"
|
||||||
|
android:exported="true"
|
||||||
|
tools:replace="android:authorities" />
|
||||||
|
</application>
|
||||||
|
<queries>
|
||||||
|
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
|
||||||
|
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" />
|
||||||
|
</queries>
|
||||||
|
</manifest>
|
||||||
9
ExtraPluginCfgs/Android/flexion/ChannelHelpers.java
Normal file
9
ExtraPluginCfgs/Android/flexion/ChannelHelpers.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package com.unity3d.player;
|
||||||
|
|
||||||
|
public class ChannelHelpers {
|
||||||
|
public static final String CHANNEL = "Flexion";
|
||||||
|
|
||||||
|
static void register() {
|
||||||
|
SDKManager.registerHelper(CHANNEL, new FlexionSDKHelper());
|
||||||
|
}
|
||||||
|
}
|
||||||
28
ExtraPluginCfgs/Android/flexion/ConfigManager.java
Normal file
28
ExtraPluginCfgs/Android/flexion/ConfigManager.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.unity3d.player;
|
||||||
|
|
||||||
|
public class ConfigManager {
|
||||||
|
// Common SDK parameters
|
||||||
|
public static int SDK_APPID = 20587;
|
||||||
|
public static String SDK_GAMEID = "20587";
|
||||||
|
public static String SDK_PROJECTID = "20587";
|
||||||
|
public static String SDK_CLOUDID = "128";
|
||||||
|
public static String SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMaster";
|
||||||
|
|
||||||
|
public static String SDK_LOGIN_SERVER_URL = "https://128-hwsfsdk-sdk-online01.qijihdhk.com";
|
||||||
|
|
||||||
|
// FCM (anti-addiction system)
|
||||||
|
public static String FCM_NAMESPACE = "128";
|
||||||
|
public static String FCM_IAM_HOST = "tcp://fcmtcp.tuyoo.com:3563";
|
||||||
|
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 LOGIN_CALLBACK_FUNCTION_NAME = "LoginResult";
|
||||||
|
public static final String LINKACCOUT_CALLBACK_FUNCTION_NAME = "LinkAccoutResult";
|
||||||
|
public static final String CHANGELINK_CALLBACK_FUNCTION_NAME = "ChangeLinkAccountResult";
|
||||||
|
public static final String CHECKLINK_CALLBACK_FUNCTION_NAME = "CheckLinkResult";
|
||||||
|
public static final String PAY_CALLBACK_FUNCTION_NAME = "PayResult";
|
||||||
|
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "SKUListResult";
|
||||||
|
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
|
||||||
|
public static final String FCM_REALNAME_CALLBACK_FUNCTION_NAME = "RealNameCallback";
|
||||||
|
}
|
||||||
231
ExtraPluginCfgs/Android/flexion/FlexionSDKHelper.java
Normal file
231
ExtraPluginCfgs/Android/flexion/FlexionSDKHelper.java
Normal file
@@ -0,0 +1,231 @@
|
|||||||
|
package com.unity3d.player;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
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.fdk.FLX;
|
||||||
|
|
||||||
|
import com.tuyoo.gamesdk.api.SDKAPI;
|
||||||
|
import com.tuyoo.gamesdk.api.SDKCallBack;
|
||||||
|
import com.tuyoo.gamesdk.model.InitParam;
|
||||||
|
import com.tuyoo.gamesdk.util.SDKLog;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FlexionSDKHelper implements SDKManager.ISDKHelper {
|
||||||
|
private static final String TAG = "FlexionSDKHelper";
|
||||||
|
private static BillingService billingService;
|
||||||
|
private static boolean billingConnected = false;
|
||||||
|
|
||||||
|
private static final PurchasesUpdateListener purchasesListener = (billingResult, purchase) -> {
|
||||||
|
if (billingResult.getResponseCode() == BillingResults.ResultCode.PURCHASE_SUCCESS_CODE) {
|
||||||
|
if (purchase != null) handlePurchase(purchase);
|
||||||
|
} else if (billingResult.getResponseCode() == BillingResults.ResultCode.PURCHASE_USER_CANCELLED_CODE) {
|
||||||
|
sendPayCallback(1, "user_cancelled", null, null);
|
||||||
|
} else {
|
||||||
|
sendPayCallback(1, "purchase_failed_" + billingResult.getResponseCode(), null, null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Activity activity) {
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
|
SDKAPI.getIns().lightModeEnable();
|
||||||
|
try {
|
||||||
|
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);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "TuYoo SDK init Exception: " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
FLX.init(activity, (initCode, initMsg) -> {
|
||||||
|
Log.i(TAG, "FLX.init result=" + initCode);
|
||||||
|
if (initCode == 0) {
|
||||||
|
FLX.showFlexionScreens(activity, (screenCode, screenMsg) -> {
|
||||||
|
Log.i(TAG, "FLX.showFlexionScreens result=" + screenCode);
|
||||||
|
initBillingService(activity);
|
||||||
|
TYUnityActivity.setSdkInited();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "FLX.init failed: " + initCode);
|
||||||
|
TYUnityActivity.setSdkInited();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pay(Activity activity, String productId, String productName,
|
||||||
|
String productCount, String prodorderId, String appInfo) {
|
||||||
|
Log.i(TAG, "pay: " + productId);
|
||||||
|
if (billingService == null || !billingConnected) {
|
||||||
|
sendPayCallback(1, "billing_not_ready", null, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
activity.runOnUiThread(() ->
|
||||||
|
billingService.launchBillingFlow(activity,
|
||||||
|
new BillingFlowParams(productId, "inapp", "")));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void queryProducts() {
|
||||||
|
if (billingService == null || !billingConnected) {
|
||||||
|
sendExtensionError("billing_not_ready");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
try {
|
||||||
|
jsonObject.put("action", "ACTION_GET_SKU_DETAILS_LIST");
|
||||||
|
} catch (JSONException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
SDKAPI.getIns().thirdExtend(jsonObject.toString(), new SDKCallBack.Extend() {
|
||||||
|
@Override
|
||||||
|
public void callback(int code, String msg) {
|
||||||
|
if (code == SDKCallBack.Extend.EXTEND_CODE_SUCCESS && msg != null) {
|
||||||
|
try {
|
||||||
|
JSONArray products = new JSONArray(msg);
|
||||||
|
List<String> productIds = new java.util.ArrayList<>();
|
||||||
|
for (int i = 0; i < products.length(); i++) {
|
||||||
|
JSONObject p = products.getJSONObject(i);
|
||||||
|
String pid = p.optString("productId", "");
|
||||||
|
if (!pid.isEmpty()) productIds.add(pid);
|
||||||
|
}
|
||||||
|
queryProductDetails(productIds);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
sendExtensionError("parse_error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sendExtensionError("tuyoo_query_failed: " + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Billing Infrastructure ----
|
||||||
|
|
||||||
|
private static void initBillingService(Activity activity) {
|
||||||
|
billingService = FLX.createBillingService(activity, purchasesListener);
|
||||||
|
billingService.startConnection(activity, new ConnectionStateListener() {
|
||||||
|
@Override
|
||||||
|
public void onBillingSetupFinished(BillingResult result) {
|
||||||
|
if (result.getResponseCode() == BillingResults.ResultCode.CONNECTION_SUCCESS_CODE) {
|
||||||
|
billingConnected = true;
|
||||||
|
queryPendingPurchases();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onBillingServiceDisconnected() {
|
||||||
|
billingConnected = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handlePurchase(Purchase purchase) {
|
||||||
|
if (purchase.getPurchaseState() == 0) {
|
||||||
|
sendPayCallback(0, "success", purchase.getPurchaseJson(), purchase.getSignature());
|
||||||
|
billingService.consumeAsync(
|
||||||
|
new ConsumeParams(purchase.getToken()),
|
||||||
|
r -> Log.i(TAG, "Consume " +
|
||||||
|
(r.getResponseCode() == BillingResults.ResultCode.CONSUME_SUCCESS_CODE ? "ok" : "fail")));
|
||||||
|
} else if (purchase.getPurchaseState() == 2) {
|
||||||
|
sendPayCallback(2, "pending", null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void queryPendingPurchases() {
|
||||||
|
if (billingService == null || !billingConnected) return;
|
||||||
|
billingService.queryPurchasesAsync(
|
||||||
|
new QueryPurchasesParams("inapp"),
|
||||||
|
(result, purchases) -> {
|
||||||
|
if (purchases != null) for (Purchase p : purchases) handlePurchase(p);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void queryProductDetails(List<String> productIds) {
|
||||||
|
billingService.queryProductDetailsAsync(
|
||||||
|
new ProductDetailsParams("inapp", productIds),
|
||||||
|
(billingResult, productDetails) -> {
|
||||||
|
try {
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
if (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());
|
||||||
|
arr.put(item);
|
||||||
|
}
|
||||||
|
result.put("code", 0);
|
||||||
|
result.put("respObj", arr.toString());
|
||||||
|
} else {
|
||||||
|
result.put("code", 1);
|
||||||
|
result.put("thirdExtend_errStr",
|
||||||
|
"flexion_query_failed: " + 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}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Callbacks to Unity ----
|
||||||
|
|
||||||
|
private static void sendPayCallback(int code, String errStr, String purchaseJson, String signature) {
|
||||||
|
try {
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("code", code);
|
||||||
|
result.put("errStr", errStr != null ? errStr : "");
|
||||||
|
if (purchaseJson != null) result.put("purchaseJson", purchaseJson);
|
||||||
|
if (signature != null) result.put("signature", signature);
|
||||||
|
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\"}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
11
ExtraPluginCfgs/Android/flexion/gradleTemplate.properties
Normal file
11
ExtraPluginCfgs/Android/flexion/gradleTemplate.properties
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
|
||||||
|
org.gradle.parallel=true
|
||||||
|
unityStreamingAssets=**STREAMING_ASSETS**
|
||||||
|
# Android Resolver Properties Start
|
||||||
|
android.useAndroidX=true
|
||||||
|
android.enableJetifier=true
|
||||||
|
# Android Resolver Properties End
|
||||||
|
|
||||||
|
android.suppressUnsupportedCompileSdk=35
|
||||||
|
|
||||||
|
**ADDITIONAL_PROPERTIES**
|
||||||
67
ExtraPluginCfgs/Android/flexion/launcherTemplate.gradle
Normal file
67
ExtraPluginCfgs/Android/flexion/launcherTemplate.gradle
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
// 临时注销掉,打完包之后就打开
|
||||||
|
// apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':unityLibrary')
|
||||||
|
implementation(platform("com.google.firebase:firebase-bom:33.6.0"))
|
||||||
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace "**NAMESPACE**"
|
||||||
|
ndkPath "**NDKPATH**"
|
||||||
|
|
||||||
|
compileSdkVersion **APIVERSION**
|
||||||
|
buildToolsVersion '**BUILDTOOLS**'
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion **MINSDKVERSION**
|
||||||
|
targetSdkVersion **TARGETSDKVERSION**
|
||||||
|
applicationId '**APPLICATIONID**'
|
||||||
|
ndk {
|
||||||
|
abiFilters **ABIFILTERS**
|
||||||
|
}
|
||||||
|
versionCode **VERSIONCODE**
|
||||||
|
versionName '**VERSIONNAME**'
|
||||||
|
}
|
||||||
|
|
||||||
|
aaptOptions {
|
||||||
|
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
|
||||||
|
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
|
||||||
|
}**SIGN**
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
minifyEnabled **MINIFY_DEBUG**
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
|
||||||
|
jniDebuggable true
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
minifyEnabled **MINIFY_RELEASE**
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
|
||||||
|
}
|
||||||
|
}**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS**
|
||||||
|
**BUILT_APK_LOCATION**
|
||||||
|
bundle {
|
||||||
|
language {
|
||||||
|
enableSplit = false
|
||||||
|
}
|
||||||
|
density {
|
||||||
|
enableSplit = false
|
||||||
|
}
|
||||||
|
abi {
|
||||||
|
enableSplit = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP**
|
||||||
139
ExtraPluginCfgs/Android/flexion/mainTemplate.gradle
Normal file
139
ExtraPluginCfgs/Android/flexion/mainTemplate.gradle
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
**APPLY_PLUGINS**
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
namespace "com.unity3d.player"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flexion 渠道专用:排除不需要的 AppsFlyer 模块
|
||||||
|
// - purchase-connector: 基于 Google Play Billing,Flexion 不走 GP 计费,没用还增大包
|
||||||
|
// 即使 Unity Android Resolver 下次又把 implementation 行写回来,这里的 exclude 也兜底排除
|
||||||
|
configurations.all {
|
||||||
|
exclude group: 'com.appsflyer', module: 'purchase-connector'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
api "com.android.support:support-v4:28.0.0"
|
||||||
|
api "com.android.support:appcompat-v7:28.0.0"
|
||||||
|
|
||||||
|
api "com.google.code.gson:gson:2.8.6"
|
||||||
|
api "com.squareup.okio:okio:1.15.0"
|
||||||
|
api "com.squareup.okhttp3:okhttp:3.12.13"
|
||||||
|
api "com.squareup.retrofit2:retrofit:2.3.0"
|
||||||
|
api "com.squareup.retrofit2:converter-gson:2.2.0"
|
||||||
|
api "com.squareup.retrofit2:adapter-rxjava:2.1.0"
|
||||||
|
api "io.reactivex:rxandroid:1.2.1"
|
||||||
|
api "io.reactivex:rxjava:1.1.9"
|
||||||
|
|
||||||
|
// Google Play In-App Review
|
||||||
|
implementation 'com.google.android.play:review:2.0.1'
|
||||||
|
implementation 'net.aihelp:android-aihelp-aar:5.3.+'
|
||||||
|
|
||||||
|
implementation 'com.google.android.gms:play-services-auth:20.2.0'
|
||||||
|
// NOTE: Google Play BillingClient NOT included — Flexion SDK provides its own billing wrapper
|
||||||
|
// implementation('com.android.billingclient:billing:6.0.1')
|
||||||
|
|
||||||
|
// Flexion SDK (includes wrapped billing)
|
||||||
|
implementation("com.flexionmobile:sdk:4.0.1")
|
||||||
|
|
||||||
|
implementation 'com.google.android.gms:play-services-basement:18.2.0'
|
||||||
|
implementation 'androidx.fragment:fragment:1.3.6'
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.41"
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.41'
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.41'
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.41'
|
||||||
|
implementation 'androidx.core:core:1.8.0'
|
||||||
|
|
||||||
|
implementation 'com.miui.referrer:homereferrer:1.0.0.6'
|
||||||
|
|
||||||
|
implementation platform('com.google.firebase:firebase-bom:32.7.4')
|
||||||
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
|
|
||||||
|
implementation('com.facebook.android:facebook-android-sdk:16.2.0')
|
||||||
|
|
||||||
|
implementation 'com.google.android.play:asset-delivery:2.2.2'
|
||||||
|
|
||||||
|
implementation "androidx.credentials:credentials:1.3.0"
|
||||||
|
implementation "androidx.credentials:credentials-play-services-auth:1.3.0"
|
||||||
|
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
||||||
|
|
||||||
|
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"
|
||||||
|
|
||||||
|
// Android Resolver Dependencies Start
|
||||||
|
implementation 'com.android.installreferrer:installreferrer:2.1' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:7
|
||||||
|
implementation 'com.applovin.mediation:facebook-adapter:[6.18.0.1]' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:8
|
||||||
|
implementation 'com.applovin.mediation:fyber-adapter:8.4.2.0' // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:4
|
||||||
|
implementation 'com.applovin.mediation:google-adapter:[23.6.0.1]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5
|
||||||
|
implementation 'com.applovin.mediation:ironsource-adapter:8.6.1.0.0' // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
|
||||||
|
implementation 'com.applovin.mediation: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: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
|
||||||
|
// Flexion: purchase-connector removed — Flexion does not use Google Play Billing.
|
||||||
|
// Also covered by top-level `configurations.all { exclude ... }` as a safety net.
|
||||||
|
// implementation 'com.appsflyer:purchase-connector:2.2.0' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:8
|
||||||
|
implementation 'com.appsflyer:unity-wrapper:6.17.7' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:6
|
||||||
|
implementation 'com.google.android.ump:user-messaging-platform:2.1.0' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:5
|
||||||
|
// Android Resolver Dependencies End
|
||||||
|
**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 {
|
||||||
|
ndkPath "**NDKPATH**"
|
||||||
|
|
||||||
|
compileSdkVersion **APIVERSION**
|
||||||
|
buildToolsVersion '**BUILDTOOLS**'
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
coreLibraryDesugaringEnabled true
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion **MINSDKVERSION**
|
||||||
|
targetSdkVersion **TARGETSDKVERSION**
|
||||||
|
ndk {
|
||||||
|
abiFilters **ABIFILTERS**
|
||||||
|
}
|
||||||
|
|
||||||
|
versionCode **VERSIONCODE**
|
||||||
|
versionName '**VERSIONNAME**'
|
||||||
|
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
aaptOptions {
|
||||||
|
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
|
||||||
|
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
|
||||||
|
}**PACKAGING_OPTIONS**
|
||||||
|
}
|
||||||
|
**IL_CPP_BUILD_SETUP**
|
||||||
|
**SOURCE_BUILD_SETUP**
|
||||||
|
**EXTERNAL_SOURCES**
|
||||||
46
ExtraPluginCfgs/Android/flexion/settingsTemplate.gradle
Normal file
46
ExtraPluginCfgs/Android/flexion/settingsTemplate.gradle
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
**ARTIFACTORYREPOSITORY**
|
||||||
|
gradlePluginPortal()
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include ':launcher', ':unityLibrary'
|
||||||
|
**INCLUDES**
|
||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
|
repositories {
|
||||||
|
**ARTIFACTORYREPOSITORY**
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
// Flexion SDK Maven Repository
|
||||||
|
maven {
|
||||||
|
url = uri("https://maven.pkg.github.com/FlexionSDK/JavaSDK")
|
||||||
|
credentials {
|
||||||
|
username = "FlexionSDK"
|
||||||
|
// Replace with your actual Flexion PAT from DropPoint
|
||||||
|
password = "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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Android Resolver Repos Start
|
||||||
|
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
||||||
|
maven {
|
||||||
|
url "https://android-sdk.is.com/" // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
|
||||||
|
}
|
||||||
|
mavenLocal()
|
||||||
|
// Android Resolver Repos End
|
||||||
|
flatDir {
|
||||||
|
dirs "${project(':unityLibrary').projectDir}/libs"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url "http://sdkck.tuyoo.com/artifactory/tuyoo-component/"
|
||||||
|
allowInsecureProtocol = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
48
ExtraPluginCfgs/Android/googleplay/AndroidManifest.xml
Normal file
48
ExtraPluginCfgs/Android/googleplay/AndroidManifest.xml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?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">
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp" android:usesCleartextTraffic="true">
|
||||||
|
<activity android:name="com.unity3d.player.TYUnityActivity"
|
||||||
|
android:theme="@style/UnityThemeSelector">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q"/>
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:host="mainactivity" android:scheme="zzft" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
||||||
|
|
||||||
|
<meta-data android:name="google_analytics_default_allow_analytics_storage" android:value="true" />
|
||||||
|
<meta-data android:name="google_analytics_default_allow_ad_storage" android:value="true" />
|
||||||
|
<meta-data android:name="google_analytics_default_allow_ad_user_data" android:value="true" />
|
||||||
|
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="true" />
|
||||||
|
|
||||||
|
</activity>
|
||||||
|
<meta-data android:name="CHANNEL" android:value="GooglePlay" />
|
||||||
|
</application>
|
||||||
|
<queries>
|
||||||
|
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
|
||||||
|
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" /> <!-- allows sharing to Messenger app -->
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
</intent>
|
||||||
|
</queries>
|
||||||
|
</manifest>
|
||||||
9
ExtraPluginCfgs/Android/googleplay/ChannelHelpers.java
Normal file
9
ExtraPluginCfgs/Android/googleplay/ChannelHelpers.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package com.unity3d.player;
|
||||||
|
|
||||||
|
public class ChannelHelpers {
|
||||||
|
public static final String CHANNEL = "GooglePlay";
|
||||||
|
|
||||||
|
static void register() {
|
||||||
|
// GooglePlay uses default behavior, no additional SDKHelper
|
||||||
|
}
|
||||||
|
}
|
||||||
28
ExtraPluginCfgs/Android/googleplay/ConfigManager.java
Normal file
28
ExtraPluginCfgs/Android/googleplay/ConfigManager.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.unity3d.player;
|
||||||
|
|
||||||
|
public class ConfigManager {
|
||||||
|
// Common SDK parameters
|
||||||
|
public static int SDK_APPID = 20587;
|
||||||
|
public static String SDK_GAMEID = "20587";
|
||||||
|
public static String SDK_PROJECTID = "20587";
|
||||||
|
public static String SDK_CLOUDID = "128";
|
||||||
|
public static String SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMaster";
|
||||||
|
|
||||||
|
public static String SDK_LOGIN_SERVER_URL = "https://128-hwsfsdk-sdk-online01.qijihdhk.com";
|
||||||
|
|
||||||
|
// FCM (anti-addiction system)
|
||||||
|
public static String FCM_NAMESPACE = "128";
|
||||||
|
public static String FCM_IAM_HOST = "tcp://fcmtcp.tuyoo.com:3563";
|
||||||
|
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 LOGIN_CALLBACK_FUNCTION_NAME = "LoginResult";
|
||||||
|
public static final String LINKACCOUT_CALLBACK_FUNCTION_NAME = "LinkAccoutResult";
|
||||||
|
public static final String CHANGELINK_CALLBACK_FUNCTION_NAME = "ChangeLinkAccountResult";
|
||||||
|
public static final String CHECKLINK_CALLBACK_FUNCTION_NAME = "CheckLinkResult";
|
||||||
|
public static final String PAY_CALLBACK_FUNCTION_NAME = "PayResult";
|
||||||
|
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "SKUListResult";
|
||||||
|
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
|
||||||
|
public static final String FCM_REALNAME_CALLBACK_FUNCTION_NAME = "RealNameCallback";
|
||||||
|
}
|
||||||
Binary file not shown.
11
ExtraPluginCfgs/Android/googleplay/gradleTemplate.properties
Normal file
11
ExtraPluginCfgs/Android/googleplay/gradleTemplate.properties
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
|
||||||
|
org.gradle.parallel=true
|
||||||
|
unityStreamingAssets=**STREAMING_ASSETS**
|
||||||
|
# Android Resolver Properties Start
|
||||||
|
android.useAndroidX=true
|
||||||
|
android.enableJetifier=true
|
||||||
|
# Android Resolver Properties End
|
||||||
|
|
||||||
|
android.suppressUnsupportedCompileSdk=35
|
||||||
|
|
||||||
|
**ADDITIONAL_PROPERTIES**
|
||||||
66
ExtraPluginCfgs/Android/googleplay/launcherTemplate.gradle
Normal file
66
ExtraPluginCfgs/Android/googleplay/launcherTemplate.gradle
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':unityLibrary')
|
||||||
|
implementation(platform("com.google.firebase:firebase-bom:33.6.0"))
|
||||||
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace "**NAMESPACE**"
|
||||||
|
ndkPath "**NDKPATH**"
|
||||||
|
|
||||||
|
compileSdkVersion **APIVERSION**
|
||||||
|
buildToolsVersion '**BUILDTOOLS**'
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion **MINSDKVERSION**
|
||||||
|
targetSdkVersion **TARGETSDKVERSION**
|
||||||
|
applicationId '**APPLICATIONID**'
|
||||||
|
ndk {
|
||||||
|
abiFilters **ABIFILTERS**
|
||||||
|
}
|
||||||
|
versionCode **VERSIONCODE**
|
||||||
|
versionName '**VERSIONNAME**'
|
||||||
|
}
|
||||||
|
|
||||||
|
aaptOptions {
|
||||||
|
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
|
||||||
|
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
|
||||||
|
}**SIGN**
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
minifyEnabled **MINIFY_DEBUG**
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
|
||||||
|
jniDebuggable true
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
minifyEnabled **MINIFY_RELEASE**
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
|
||||||
|
}
|
||||||
|
}**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS**
|
||||||
|
**BUILT_APK_LOCATION**
|
||||||
|
bundle {
|
||||||
|
language {
|
||||||
|
enableSplit = false
|
||||||
|
}
|
||||||
|
density {
|
||||||
|
enableSplit = false
|
||||||
|
}
|
||||||
|
abi {
|
||||||
|
enableSplit = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP**
|
||||||
111
ExtraPluginCfgs/Android/googleplay/mainTemplate.gradle
Normal file
111
ExtraPluginCfgs/Android/googleplay/mainTemplate.gradle
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
**APPLY_PLUGINS**
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
namespace "com.unity3d.player"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
api "com.android.support:support-v4:28.0.0"
|
||||||
|
api "com.android.support:appcompat-v7:28.0.0"
|
||||||
|
|
||||||
|
api "com.google.code.gson:gson:2.8.6"
|
||||||
|
api "com.squareup.okio:okio:1.15.0"
|
||||||
|
api "com.squareup.okhttp3:okhttp:3.12.13"
|
||||||
|
api "com.squareup.retrofit2:retrofit:2.3.0"
|
||||||
|
api "com.squareup.retrofit2:converter-gson:2.2.0"
|
||||||
|
api "com.squareup.retrofit2:adapter-rxjava:2.1.0"
|
||||||
|
api "io.reactivex:rxandroid:1.2.1"
|
||||||
|
api "io.reactivex:rxjava:1.1.9"
|
||||||
|
|
||||||
|
// Google Play In-App Review
|
||||||
|
implementation 'com.google.android.play:review:2.0.1'
|
||||||
|
implementation 'net.aihelp:android-aihelp-aar:5.3.+'
|
||||||
|
|
||||||
|
implementation 'com.google.android.gms:play-services-auth:20.2.0'
|
||||||
|
implementation('com.android.billingclient:billing:7.0.0')
|
||||||
|
|
||||||
|
implementation 'com.google.android.gms:play-services-basement:18.2.0'
|
||||||
|
implementation 'androidx.fragment:fragment:1.3.6'
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.41"
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.41'
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.41'
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.41'
|
||||||
|
implementation 'androidx.core:core:1.8.0'
|
||||||
|
|
||||||
|
implementation 'com.miui.referrer:homereferrer:1.0.0.6'
|
||||||
|
|
||||||
|
implementation platform('com.google.firebase:firebase-bom:34.6.0')
|
||||||
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
|
|
||||||
|
implementation('com.facebook.android:facebook-android-sdk:16.2.0')
|
||||||
|
|
||||||
|
implementation 'com.google.android.play:asset-delivery:2.2.2'
|
||||||
|
|
||||||
|
implementation "androidx.credentials:credentials:1.3.0"
|
||||||
|
implementation "androidx.credentials:credentials-play-services-auth:1.3.0"
|
||||||
|
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
||||||
|
|
||||||
|
// Android Resolver Dependencies Start
|
||||||
|
implementation 'com.android.installreferrer:installreferrer:2.1' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:7
|
||||||
|
implementation 'com.applovin.mediation:facebook-adapter:[6.18.0.1]' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:8
|
||||||
|
implementation 'com.applovin.mediation:fyber-adapter:8.4.2.0' // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:4
|
||||||
|
implementation 'com.applovin.mediation:google-adapter:[23.6.0.1]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5
|
||||||
|
implementation 'com.applovin.mediation:ironsource-adapter:8.6.1.0.0' // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
|
||||||
|
implementation 'com.applovin.mediation: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:applovin-sdk:13.5.1' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:4
|
||||||
|
implementation 'com.appsflyer:af-android-sdk:6.17.3' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:5
|
||||||
|
implementation 'com.appsflyer:purchase-connector:2.2.0' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:8
|
||||||
|
implementation 'com.appsflyer:unity-wrapper:6.17.7' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:6
|
||||||
|
implementation 'com.google.android.ump:user-messaging-platform:2.1.0' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:5
|
||||||
|
implementation 'com.tapjoy:tapjoy-android-unitybridge:14.5.0' // Packages/com.unity.package-offerwall/Editor/TJPluginDependencies.xml:10
|
||||||
|
// Android Resolver Dependencies End
|
||||||
|
**DEPS**}
|
||||||
|
|
||||||
|
android {
|
||||||
|
ndkPath "**NDKPATH**"
|
||||||
|
|
||||||
|
compileSdkVersion **APIVERSION**
|
||||||
|
buildToolsVersion '**BUILDTOOLS**'
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion **MINSDKVERSION**
|
||||||
|
targetSdkVersion **TARGETSDKVERSION**
|
||||||
|
ndk {
|
||||||
|
abiFilters **ABIFILTERS**
|
||||||
|
}
|
||||||
|
versionCode **VERSIONCODE**
|
||||||
|
versionName '**VERSIONNAME**'
|
||||||
|
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
aaptOptions {
|
||||||
|
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
|
||||||
|
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
|
||||||
|
}**PACKAGING_OPTIONS**
|
||||||
|
}
|
||||||
|
**IL_CPP_BUILD_SETUP**
|
||||||
|
**SOURCE_BUILD_SETUP**
|
||||||
|
**EXTERNAL_SOURCES**
|
||||||
38
ExtraPluginCfgs/Android/googleplay/settingsTemplate.gradle
Normal file
38
ExtraPluginCfgs/Android/googleplay/settingsTemplate.gradle
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
**ARTIFACTORYREPOSITORY**
|
||||||
|
gradlePluginPortal()
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include ':launcher', ':unityLibrary'
|
||||||
|
**INCLUDES**
|
||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
|
repositories {
|
||||||
|
**ARTIFACTORYREPOSITORY**
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
// Android Resolver Repos Start
|
||||||
|
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
||||||
|
maven {
|
||||||
|
url "https://sdk.tapjoy.com/" // Packages/com.unity.package-offerwall/Editor/TJPluginDependencies.xml:9
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url "https://android-sdk.is.com/" // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
|
||||||
|
}
|
||||||
|
mavenLocal()
|
||||||
|
// Android Resolver Repos End
|
||||||
|
flatDir {
|
||||||
|
dirs "${project(':unityLibrary').projectDir}/libs"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url "http://sdkck.tuyoo.com/artifactory/tuyoo-component/"
|
||||||
|
allowInsecureProtocol = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
41
ExtraPluginCfgs/Android/rustore/AndroidManifest.xml
Normal file
41
ExtraPluginCfgs/Android/rustore/AndroidManifest.xml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?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">
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp"
|
||||||
|
tools:replace="android:usesCleartextTraffic"
|
||||||
|
android:usesCleartextTraffic="true">
|
||||||
|
<activity android:name="com.unity3d.player.TYUnityActivity"
|
||||||
|
android:theme="@style/UnityThemeSelector">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q"/>
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:host="mainactivity" android:scheme="zzft" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
||||||
|
</activity>
|
||||||
|
<meta-data android:name="CHANNEL" android:value="Rustore" />
|
||||||
|
</application>
|
||||||
|
<queries>
|
||||||
|
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
|
||||||
|
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" /> <!-- allows sharing to Messenger app -->
|
||||||
|
</queries>
|
||||||
|
</manifest>
|
||||||
9
ExtraPluginCfgs/Android/rustore/ChannelHelpers.java
Normal file
9
ExtraPluginCfgs/Android/rustore/ChannelHelpers.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package com.unity3d.player;
|
||||||
|
|
||||||
|
public class ChannelHelpers {
|
||||||
|
public static final String CHANNEL = "Rustore";
|
||||||
|
|
||||||
|
static void register() {
|
||||||
|
// Rustore uses default behavior, no additional SDKHelper yet
|
||||||
|
}
|
||||||
|
}
|
||||||
28
ExtraPluginCfgs/Android/rustore/ConfigManager.java
Normal file
28
ExtraPluginCfgs/Android/rustore/ConfigManager.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.unity3d.player;
|
||||||
|
|
||||||
|
public class ConfigManager {
|
||||||
|
// Common SDK parameters
|
||||||
|
public static int SDK_APPID = 20587;
|
||||||
|
public static String SDK_GAMEID = "20587";
|
||||||
|
public static String SDK_PROJECTID = "20587";
|
||||||
|
public static String SDK_CLOUDID = "128";
|
||||||
|
public static String SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.rustore.FishingTravel";
|
||||||
|
|
||||||
|
public static String SDK_LOGIN_SERVER_URL = "https://128-hwsfsdk-sdk-online01.qijihdhk.com";
|
||||||
|
|
||||||
|
// FCM (anti-addiction system)
|
||||||
|
public static String FCM_NAMESPACE = "128";
|
||||||
|
public static String FCM_IAM_HOST = "tcp://fcmtcp.tuyoo.com:3563";
|
||||||
|
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 LOGIN_CALLBACK_FUNCTION_NAME = "LoginResult";
|
||||||
|
public static final String LINKACCOUT_CALLBACK_FUNCTION_NAME = "LinkAccoutResult";
|
||||||
|
public static final String CHANGELINK_CALLBACK_FUNCTION_NAME = "ChangeLinkAccountResult";
|
||||||
|
public static final String CHECKLINK_CALLBACK_FUNCTION_NAME = "CheckLinkResult";
|
||||||
|
public static final String PAY_CALLBACK_FUNCTION_NAME = "PayResult";
|
||||||
|
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "SKUListResult";
|
||||||
|
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
|
||||||
|
public static final String FCM_REALNAME_CALLBACK_FUNCTION_NAME = "RealNameCallback";
|
||||||
|
}
|
||||||
Binary file not shown.
11
ExtraPluginCfgs/Android/rustore/gradleTemplate.properties
Normal file
11
ExtraPluginCfgs/Android/rustore/gradleTemplate.properties
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
|
||||||
|
org.gradle.parallel=true
|
||||||
|
unityStreamingAssets=**STREAMING_ASSETS**
|
||||||
|
# Android Resolver Properties Start
|
||||||
|
android.useAndroidX=true
|
||||||
|
android.enableJetifier=true
|
||||||
|
# Android Resolver Properties End
|
||||||
|
|
||||||
|
android.suppressUnsupportedCompileSdk=35
|
||||||
|
|
||||||
|
**ADDITIONAL_PROPERTIES**
|
||||||
74
ExtraPluginCfgs/Android/rustore/launcherTemplate.gradle
Normal file
74
ExtraPluginCfgs/Android/rustore/launcherTemplate.gradle
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':unityLibrary')
|
||||||
|
implementation(platform("com.google.firebase:firebase-bom:33.6.0"))
|
||||||
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace "**NAMESPACE**"
|
||||||
|
ndkPath "**NDKPATH**"
|
||||||
|
|
||||||
|
compileSdkVersion **APIVERSION**
|
||||||
|
buildToolsVersion '**BUILDTOOLS**'
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion **MINSDKVERSION**
|
||||||
|
targetSdkVersion **TARGETSDKVERSION**
|
||||||
|
applicationId '**APPLICATIONID**'
|
||||||
|
ndk {
|
||||||
|
abiFilters **ABIFILTERS**
|
||||||
|
}
|
||||||
|
versionCode **VERSIONCODE**
|
||||||
|
versionName '**VERSIONNAME**'
|
||||||
|
|
||||||
|
// ↓↓↓ 这里放你的 VK ID 占位符 ↓↓↓
|
||||||
|
manifestPlaceholders = [
|
||||||
|
VKIDRedirectHost : "vk.ru",
|
||||||
|
VKIDRedirectScheme: "vk54432404",
|
||||||
|
VKIDClientID : "54432404",
|
||||||
|
VKIDClientSecret : "WD6BO0CwPXsKMaaFX8Qq"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
aaptOptions {
|
||||||
|
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
|
||||||
|
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
|
||||||
|
}**SIGN**
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
minifyEnabled **MINIFY_DEBUG**
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
|
||||||
|
jniDebuggable true
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
minifyEnabled **MINIFY_RELEASE**
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
|
||||||
|
}
|
||||||
|
}**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS**
|
||||||
|
**BUILT_APK_LOCATION**
|
||||||
|
bundle {
|
||||||
|
language {
|
||||||
|
enableSplit = false
|
||||||
|
}
|
||||||
|
density {
|
||||||
|
enableSplit = false
|
||||||
|
}
|
||||||
|
abi {
|
||||||
|
enableSplit = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP**
|
||||||
131
ExtraPluginCfgs/Android/rustore/mainTemplate.gradle
Normal file
131
ExtraPluginCfgs/Android/rustore/mainTemplate.gradle
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
**APPLY_PLUGINS**
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
namespace "com.unity3d.player"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
api "com.android.support:support-v4:28.0.0"
|
||||||
|
api "com.android.support:appcompat-v7:28.0.0"
|
||||||
|
|
||||||
|
api "com.google.code.gson:gson:2.8.6"
|
||||||
|
api "com.squareup.okio:okio:1.15.0"
|
||||||
|
api "com.squareup.okhttp3:okhttp:3.12.13"
|
||||||
|
api "com.squareup.retrofit2:retrofit:2.3.0"
|
||||||
|
api "com.squareup.retrofit2:converter-gson:2.2.0"
|
||||||
|
api "com.squareup.retrofit2:adapter-rxjava:2.1.0"
|
||||||
|
api "io.reactivex:rxandroid:1.2.1"
|
||||||
|
api "io.reactivex:rxjava:1.1.9"
|
||||||
|
|
||||||
|
// Google Play In-App Review
|
||||||
|
implementation 'com.google.android.play:review:2.0.1'
|
||||||
|
implementation 'net.aihelp:android-aihelp-aar:5.3.+'
|
||||||
|
|
||||||
|
implementation 'com.google.android.gms:play-services-auth:20.2.0'
|
||||||
|
implementation('com.android.billingclient:billing:6.0.1')
|
||||||
|
|
||||||
|
implementation 'com.google.android.gms:play-services-basement:18.2.0'
|
||||||
|
implementation 'androidx.fragment:fragment:1.3.6'
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.41"
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.41'
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.41'
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.41'
|
||||||
|
implementation 'androidx.core:core:1.8.0'
|
||||||
|
|
||||||
|
implementation 'com.miui.referrer:homereferrer:1.0.0.6'
|
||||||
|
|
||||||
|
implementation platform('com.google.firebase:firebase-bom:32.7.4')
|
||||||
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
|
|
||||||
|
implementation('com.facebook.android:facebook-android-sdk:16.2.0')
|
||||||
|
|
||||||
|
implementation 'com.google.android.play:asset-delivery:2.2.2'
|
||||||
|
|
||||||
|
implementation "androidx.credentials:credentials:1.3.0"
|
||||||
|
implementation "androidx.credentials:credentials-play-services-auth:1.3.0"
|
||||||
|
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
||||||
|
|
||||||
|
|
||||||
|
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 Resolver Dependencies Start
|
||||||
|
implementation 'com.android.installreferrer:installreferrer:2.1' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:7
|
||||||
|
implementation 'com.applovin.mediation:facebook-adapter:[6.18.0.1]' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:8
|
||||||
|
implementation 'com.applovin.mediation:fyber-adapter:8.4.2.0' // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:4
|
||||||
|
implementation 'com.applovin.mediation:google-adapter:[23.6.0.1]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5
|
||||||
|
implementation 'com.applovin.mediation:ironsource-adapter:8.6.1.0.0' // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
|
||||||
|
implementation 'com.applovin.mediation: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:applovin-sdk:13.5.1' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:4
|
||||||
|
implementation 'com.appsflyer:af-android-sdk:6.17.3' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:5
|
||||||
|
implementation 'com.appsflyer:purchase-connector:2.2.0' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:8
|
||||||
|
implementation 'com.appsflyer:unity-wrapper:6.17.7' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:6
|
||||||
|
implementation 'com.google.android.ump:user-messaging-platform:2.1.0' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:5
|
||||||
|
// Android Resolver Dependencies End
|
||||||
|
**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 {
|
||||||
|
ndkPath "**NDKPATH**"
|
||||||
|
|
||||||
|
compileSdkVersion **APIVERSION**
|
||||||
|
buildToolsVersion '**BUILDTOOLS**'
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
coreLibraryDesugaringEnabled true
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion **MINSDKVERSION**
|
||||||
|
targetSdkVersion **TARGETSDKVERSION**
|
||||||
|
ndk {
|
||||||
|
abiFilters **ABIFILTERS**
|
||||||
|
}
|
||||||
|
|
||||||
|
versionCode **VERSIONCODE**
|
||||||
|
versionName '**VERSIONNAME**'
|
||||||
|
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
aaptOptions {
|
||||||
|
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
|
||||||
|
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
|
||||||
|
}**PACKAGING_OPTIONS**
|
||||||
|
}
|
||||||
|
**IL_CPP_BUILD_SETUP**
|
||||||
|
**SOURCE_BUILD_SETUP**
|
||||||
|
**EXTERNAL_SOURCES**
|
||||||
46
ExtraPluginCfgs/Android/rustore/settingsTemplate.gradle
Normal file
46
ExtraPluginCfgs/Android/rustore/settingsTemplate.gradle
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
**ARTIFACTORYREPOSITORY**
|
||||||
|
gradlePluginPortal()
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include ':launcher', ':unityLibrary'
|
||||||
|
**INCLUDES**
|
||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
|
repositories {
|
||||||
|
**ARTIFACTORYREPOSITORY**
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
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/"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Android Resolver Repos Start
|
||||||
|
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
||||||
|
maven {
|
||||||
|
url "https://android-sdk.is.com/" // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
|
||||||
|
}
|
||||||
|
mavenLocal()
|
||||||
|
// Android Resolver Repos End
|
||||||
|
flatDir {
|
||||||
|
dirs "${project(':unityLibrary').projectDir}/libs"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url "http://sdkck.tuyoo.com/artifactory/tuyoo-component/"
|
||||||
|
allowInsecureProtocol = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
43
ExtraPluginCfgs/Android/switch-channel.sh
Normal file
43
ExtraPluginCfgs/Android/switch-channel.sh
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Usage: ./switch-channel.sh <channel>
|
||||||
|
# channel: googleplay | flexion | rustore
|
||||||
|
#
|
||||||
|
# 切换渠道后重新用 Unity 打 Android 包即可打出对应渠道的 APK。
|
||||||
|
# 脚本会同步:AAR、Gradle 配置、AndroidManifest、Java 文件(ConfigManager、ChannelHelpers 等)
|
||||||
|
|
||||||
|
CHANNEL=${1:-googleplay}
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
CHANNEL_DIR="$SCRIPT_DIR/$CHANNEL"
|
||||||
|
PROJ_DIR="$SCRIPT_DIR/../../sdk-intergration"
|
||||||
|
|
||||||
|
TYSDK_PLUGINS="$PROJ_DIR/Packages/tysdk/Plugins/Android"
|
||||||
|
ASSETS_PLUGINS="$PROJ_DIR/Assets/Plugins/Android"
|
||||||
|
|
||||||
|
# 校验渠道目录
|
||||||
|
if [ ! -d "$CHANNEL_DIR" ]; then
|
||||||
|
echo "ERROR: Unknown channel '$CHANNEL'. Available: googleplay, flexion, rustore"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "=== Switching to channel: $CHANNEL ==="
|
||||||
|
|
||||||
|
# 1. Sync channel AAR to tysdk package (only tuyoosdk, gasdk stays permanently)
|
||||||
|
echo "[AAR] Syncing tuyoosdk to $TYSDK_PLUGINS"
|
||||||
|
find "$TYSDK_PLUGINS" -maxdepth 1 -name "tuyoosdk_*.aar" -delete
|
||||||
|
cp "$CHANNEL_DIR/Plugins/Android/"*.aar "$TYSDK_PLUGINS/" 2>/dev/null
|
||||||
|
|
||||||
|
# 2. Sync Gradle + Manifest to Assets/Plugins/Android
|
||||||
|
echo "[Config] Syncing gradle/manifest to $ASSETS_PLUGINS"
|
||||||
|
for f in "$CHANNEL_DIR"/*.gradle "$CHANNEL_DIR"/*.properties "$CHANNEL_DIR"/AndroidManifest.xml; do
|
||||||
|
[ -f "$f" ] && cp "$f" "$ASSETS_PLUGINS/"
|
||||||
|
done
|
||||||
|
|
||||||
|
# 3. Sync Java files to tysdk package
|
||||||
|
echo "[Java] Syncing ConfigManager + ChannelHelpers to $TYSDK_PLUGINS"
|
||||||
|
for f in "$CHANNEL_DIR"/*.java; do
|
||||||
|
[ -f "$f" ] && cp "$f" "$TYSDK_PLUGINS/"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "=== Done. Channel: $CHANNEL ==="
|
||||||
|
echo ""
|
||||||
|
echo "Next: Open Unity and build Android APK."
|
||||||
151
sdk-intergration/Assets/Editor/ChannelBuildTool.cs
Normal file
151
sdk-intergration/Assets/Editor/ChannelBuildTool.cs
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ChannelBuildTool
|
||||||
|
{
|
||||||
|
public static readonly string[] SupportedChannels = { "GooglePlay", "Rustore", "Flexion" };
|
||||||
|
|
||||||
|
private const string ExtraCfgRoot = "../ExtraPluginCfgs/Android";
|
||||||
|
private const string TysdkPlugins = "Packages/tysdk/Plugins/Android";
|
||||||
|
private const string AssetsPlugins = "Assets/Plugins/Android";
|
||||||
|
|
||||||
|
private static readonly string[] GradleFiles =
|
||||||
|
{
|
||||||
|
"mainTemplate.gradle",
|
||||||
|
"launcherTemplate.gradle",
|
||||||
|
"settingsTemplate.gradle",
|
||||||
|
"gradleTemplate.properties",
|
||||||
|
"AndroidManifest.xml"
|
||||||
|
};
|
||||||
|
|
||||||
|
// ==================== Channel Switching ====================
|
||||||
|
|
||||||
|
private static void SwitchChannel(string channel)
|
||||||
|
{
|
||||||
|
var channelDir = channel.ToLower();
|
||||||
|
var cfgDir = Path.Combine(ExtraCfgRoot, channelDir);
|
||||||
|
if (!Directory.Exists(cfgDir))
|
||||||
|
{
|
||||||
|
Debug.LogError($"[ChannelSwitch] Channel config not found: {cfgDir}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log($"[ChannelSwitch] Switching to {channel}...");
|
||||||
|
|
||||||
|
// 1. Sync AAR
|
||||||
|
var srcAarDir = Path.Combine(cfgDir, "Plugins/Android");
|
||||||
|
if (Directory.Exists(srcAarDir))
|
||||||
|
{
|
||||||
|
foreach (var oldAar in Directory.GetFiles(TysdkPlugins, "tuyoosdk_*.aar"))
|
||||||
|
File.Delete(oldAar);
|
||||||
|
foreach (var aar in Directory.GetFiles(srcAarDir, "*.aar"))
|
||||||
|
{
|
||||||
|
var dest = Path.Combine(TysdkPlugins, Path.GetFileName(aar));
|
||||||
|
File.Copy(aar, dest, true);
|
||||||
|
Debug.Log($"[ChannelSwitch] AAR: {aar} → {dest}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Clean up previous channel Java files
|
||||||
|
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "ChannelHelpers.java"))
|
||||||
|
File.Delete(oldJava);
|
||||||
|
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "*SDKHelper.java"))
|
||||||
|
File.Delete(oldJava);
|
||||||
|
var oldConfig = Path.Combine(TysdkPlugins, "ConfigManager.java");
|
||||||
|
if (File.Exists(oldConfig)) File.Delete(oldConfig);
|
||||||
|
|
||||||
|
// 3. Sync Gradle + Manifest
|
||||||
|
foreach (var fileName in GradleFiles)
|
||||||
|
{
|
||||||
|
var src = Path.Combine(cfgDir, fileName);
|
||||||
|
if (File.Exists(src))
|
||||||
|
{
|
||||||
|
var dest = Path.Combine(AssetsPlugins, fileName);
|
||||||
|
File.Copy(src, dest, true);
|
||||||
|
Debug.Log($"[ChannelSwitch] Config: {src} → {dest}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Sync channel Java files to tysdk package
|
||||||
|
foreach (var javaFile in Directory.GetFiles(cfgDir, "*.java"))
|
||||||
|
{
|
||||||
|
var fileName = Path.GetFileName(javaFile);
|
||||||
|
var dest = Path.Combine(TysdkPlugins, fileName);
|
||||||
|
File.Copy(javaFile, dest, true);
|
||||||
|
Debug.Log($"[ChannelSwitch] Java: {javaFile} → {dest}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Set runtime channel
|
||||||
|
tysdk.ChannelConfig.SetChannel(channel);
|
||||||
|
|
||||||
|
AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
|
||||||
|
Debug.Log($"[ChannelSwitch] Done. Channel: {channel}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== Build ====================
|
||||||
|
|
||||||
|
private static void BuildAndroidForChannel(string channel, bool debug)
|
||||||
|
{
|
||||||
|
SwitchChannel(channel);
|
||||||
|
|
||||||
|
string fileName = debug ? $"tysdkTest_{channel}_debug.apk" : $"tysdkTest_{channel}.apk";
|
||||||
|
string 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}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== Menu: Switch Channel ====================
|
||||||
|
|
||||||
|
[MenuItem("Tools/Switch Channel/GooglePlay")]
|
||||||
|
public static void Switch_GooglePlay() => SwitchChannel("GooglePlay");
|
||||||
|
|
||||||
|
[MenuItem("Tools/Switch Channel/Rustore")]
|
||||||
|
public static void Switch_Rustore() => SwitchChannel("Rustore");
|
||||||
|
|
||||||
|
[MenuItem("Tools/Switch Channel/Flexion")]
|
||||||
|
public static void Switch_Flexion() => SwitchChannel("Flexion");
|
||||||
|
|
||||||
|
// ==================== Menu: Build ====================
|
||||||
|
|
||||||
|
[MenuItem("Tools/Build Android (Channel)/GooglePlay")]
|
||||||
|
public static void Build_GooglePlay() => BuildAndroidForChannel("GooglePlay", false);
|
||||||
|
|
||||||
|
[MenuItem("Tools/Build Android (Channel)/GooglePlay Debug")]
|
||||||
|
public static void Build_GooglePlay_Debug() => BuildAndroidForChannel("GooglePlay", true);
|
||||||
|
|
||||||
|
[MenuItem("Tools/Build Android (Channel)/Rustore")]
|
||||||
|
public static void Build_Rustore() => BuildAndroidForChannel("Rustore", false);
|
||||||
|
|
||||||
|
[MenuItem("Tools/Build Android (Channel)/Rustore Debug")]
|
||||||
|
public static void Build_Rustore_Debug() => BuildAndroidForChannel("Rustore", true);
|
||||||
|
|
||||||
|
[MenuItem("Tools/Build Android (Channel)/Flexion")]
|
||||||
|
public static void Build_Flexion() => BuildAndroidForChannel("Flexion", false);
|
||||||
|
|
||||||
|
[MenuItem("Tools/Build Android (Channel)/Flexion Debug")]
|
||||||
|
public static void Build_Flexion_Debug() => BuildAndroidForChannel("Flexion", true);
|
||||||
|
}
|
||||||
11
sdk-intergration/Assets/Editor/ChannelBuildTool.cs.meta
Normal file
11
sdk-intergration/Assets/Editor/ChannelBuildTool.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c7bad621141fb304caceb22ea91d7db3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.unity3d.player;
|
||||||
|
|
||||||
|
public class ChannelHelpers {
|
||||||
|
public static final String CHANNEL = "GooglePlay";
|
||||||
|
|
||||||
|
static void register() {
|
||||||
|
// GooglePlay uses default behavior, no additional SDKHelper
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 576805d2d0194634b8d235fd6837195e
|
||||||
|
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,8 +1,7 @@
|
|||||||
|
|
||||||
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";
|
||||||
@@ -11,14 +10,12 @@ 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";
|
||||||
|
|
||||||
// 防沉迷 - nameSpace
|
// FCM (anti-addiction system)
|
||||||
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";
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ PluginImporter:
|
|||||||
executionOrder: {}
|
executionOrder: {}
|
||||||
defineConstraints: []
|
defineConstraints: []
|
||||||
isPreloaded: 0
|
isPreloaded: 0
|
||||||
isOverridable: 0
|
isOverridable: 1
|
||||||
isExplicitlyReferenced: 0
|
isExplicitlyReferenced: 0
|
||||||
validateReferences: 1
|
validateReferences: 1
|
||||||
platformData:
|
platformData:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package com.unity3d.player;
|
package com.unity3d.player;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -29,31 +28,71 @@ 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;
|
||||||
import com.tuyoo.gamesdk.util.SDKLog;
|
import com.tuyoo.gamesdk.util.SDKLog;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import kotlinx.serialization.json.Json;
|
/**
|
||||||
|
* 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 final static Handler handler = new Handler(Looper.getMainLooper());
|
private static final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
private static IGASDK gasdk;
|
private static IGASDK gasdk;
|
||||||
private static final String TAG = com.unity3d.player.SDKManager.class.getSimpleName();
|
private static final String TAG = SDKManager.class.getSimpleName();
|
||||||
private static String curType = TuYooClientID.tyGuest;
|
private static String curType = TuYooClientID.tyGuest;
|
||||||
public static void InitSDK(Activity activity)
|
private static SnsInfo tmpSnsInfo;
|
||||||
{
|
private static String channel = "GooglePlay";
|
||||||
|
|
||||||
|
// Channel helper registry
|
||||||
|
public interface ISDKHelper {
|
||||||
|
void init(Activity activity);
|
||||||
|
void pay(Activity activity, String productId, String productName,
|
||||||
|
String productCount, String prodorderId, String appInfo);
|
||||||
|
void queryProducts();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final java.util.Map<String, ISDKHelper> helperMap = new java.util.HashMap<>();
|
||||||
|
private static ISDKHelper sdkHelper;
|
||||||
|
|
||||||
|
public static void registerHelper(String ch, ISDKHelper helper) {
|
||||||
|
helperMap.put(ch, helper);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Init — with channel helper support
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public static void InitSDK(Activity activity, String ch) {
|
||||||
|
channel = ch != null ? ch : "GooglePlay";
|
||||||
|
ChannelHelpers.register();
|
||||||
|
if (!channel.equals(ChannelHelpers.CHANNEL)) {
|
||||||
|
Log.e(TAG, "Channel mismatch! Helpers=" + ChannelHelpers.CHANNEL + " expected=" + channel);
|
||||||
|
}
|
||||||
|
sdkHelper = helperMap.get(channel);
|
||||||
|
Log.i(TAG, "InitSDK channel=" + channel + " helper=" + (sdkHelper != null ? sdkHelper.getClass().getSimpleName() : "none"));
|
||||||
|
|
||||||
|
if (sdkHelper != null) {
|
||||||
|
sdkHelper.init(activity);
|
||||||
|
} else {
|
||||||
|
initDefault(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void initDefault(Activity activity) {
|
||||||
activity.runOnUiThread(() -> {
|
activity.runOnUiThread(() -> {
|
||||||
SDKAPI.getIns().lightModeEnable();
|
SDKAPI.getIns().lightModeEnable();
|
||||||
try {
|
try {
|
||||||
@@ -72,6 +111,9 @@ public class SDKManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Login / Callbacks (shared)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
public static void parseLoginInfo(int i, String s) {
|
public static void parseLoginInfo(int i, String s) {
|
||||||
try {
|
try {
|
||||||
@@ -80,21 +122,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,
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, result.toString());
|
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, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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);
|
||||||
@@ -103,21 +145,22 @@ public class SDKManager {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static SDKCallBack.Pay mPay = new SDKCallBack.Pay() {
|
protected 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, ConfigManager.PAY_CALLBACK_FUNCTION_NAME, result.toString());
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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, ConfigManager.PAY_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
ConfigManager.PAY_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -132,18 +175,15 @@ 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) {
|
||||||
if(tmpSnsInfo == null)
|
handler.post(() -> UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
{
|
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) {
|
||||||
@@ -161,15 +201,15 @@ public class SDKManager {
|
|||||||
handler.post(() -> SDKAPI.getIns().logout(type));
|
handler.post(() -> SDKAPI.getIns().logout(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SnsInfo tmpSnsInfo;
|
// -------------------------------------------------------------------------
|
||||||
public static void LinkAccount(String type, String userId)
|
// Account linking (shared)
|
||||||
{
|
// -------------------------------------------------------------------------
|
||||||
SDKAPI.getIns().getSnsInfo(type, (snscode, snsInfo, snsmsg) ->{
|
|
||||||
if(snscode == SDKCallBack.CODE_SUCCESS && snsInfo !=null)
|
public static void LinkAccount(String type, String userId) {
|
||||||
{
|
SDKAPI.getIns().getSnsInfo(type, (snscode, snsInfo, snsmsg) -> {
|
||||||
SDKAPI.getIns().bindBySnsId(snsInfo, userId, (bindcode, bindmsg)->{
|
if (snscode == SDKCallBack.CODE_SUCCESS && snsInfo != null) {
|
||||||
if(bindcode == SDKCallBack.CODE_SUCCESS)
|
SDKAPI.getIns().bindBySnsId(snsInfo, userId, (bindcode, bindmsg) -> {
|
||||||
{
|
if (bindcode == SDKCallBack.CODE_SUCCESS) {
|
||||||
try {
|
try {
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("code", bindcode);
|
result.put("code", bindcode);
|
||||||
@@ -178,41 +218,28 @@ 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, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, result.toString());
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
||||||
}
|
}
|
||||||
}
|
} else if (bindcode == SDKCallBack.CODE_FAILED) {
|
||||||
else if(bindcode == SDKCallBack.CODE_FAILED)
|
try {
|
||||||
{
|
|
||||||
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) -> {
|
||||||
SDKAPI.getIns().checkSnsInfo(snsInfo, (checkcode, checkMsg ) -> {
|
if (checkcode != SDKCallBack.CODE_SUCCESS) {
|
||||||
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, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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");
|
||||||
@@ -222,165 +249,143 @@ 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, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, callbackMsg.toString());
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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, ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
ConfigManager.LINKACCOUT_CALLBACK_FUNCTION_NAME, msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CleanLinkTmpSnsInfo()
|
public static void CleanLinkTmpSnsInfo() {
|
||||||
{
|
|
||||||
tmpSnsInfo = null;
|
tmpSnsInfo = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ChangeLinkAccount(String type, int oldUserId, int newUserId)
|
public static void ChangeLinkAccount(String type, int oldUserId, int newUserId) {
|
||||||
{
|
if (tmpSnsInfo == null) {
|
||||||
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, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
}
|
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, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
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");
|
||||||
//返回信息中code为0时表示服务端查询成功,exit为1表示此渠道用户信息已产生过途游账号,可直接进行登录,exit为0表示此渠道用户信息未产生过途游账号,可以进行绑定
|
if (jsonObject.optString("code").equals("0")
|
||||||
if(jsonObject.optString("code").equals("0")
|
&& jsonObject.optString("exist").equals("0")) {
|
||||||
&& jsonObject.optString("exist").equals("0")){
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "0");
|
ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "0");
|
||||||
}
|
} else {
|
||||||
else
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
{
|
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, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
{
|
ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHECKLINK_CALLBACK_FUNCTION_NAME, "-1");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
{
|
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) {
|
||||||
|
if (sdkHelper != null) {
|
||||||
|
sdkHelper.pay(UnityPlayer.currentActivity, productId, productName, productCount, prodorderId, appInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
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, Integer.parseInt(ConfigManager.SDK_GAMEID), mPay, prodorderId, extraInfo);
|
SDKAPI.getIns().pay(productId, productName, productCount,
|
||||||
|
Integer.parseInt(ConfigManager.SDK_GAMEID), mPay, prodorderId, extraInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnityGetKnowTypeList(String productId)
|
public static void UnityKnowNew(String productId, String productPrice, String productName,
|
||||||
{
|
String productCount, String prodorderId, String appInfo,
|
||||||
Log.e(TAG,"UnityGetKnowTypeList:" + productId );
|
String ptype) {
|
||||||
final PayEventData.PayReq mPayReq = new PayEventData.PayReq();
|
if (sdkHelper != null) {
|
||||||
mPayReq.prodId = productId;
|
sdkHelper.pay(UnityPlayer.currentActivity, productId, productName, productCount, prodorderId, appInfo);
|
||||||
SDKAPI.getIns().charge(mPayReq , new SDKCallBack.Base1() {
|
return;
|
||||||
@Override
|
|
||||||
public void callback(int code, String msg) {
|
|
||||||
SDKLog.e("====> code= " + code + " msg= " + msg);
|
|
||||||
try {
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
result.put("code", code);
|
|
||||||
if(code == 0){
|
|
||||||
result.put("respObj", msg);
|
|
||||||
}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;
|
||||||
@@ -389,41 +394,56 @@ public class SDKManager {
|
|||||||
SDKAPI.getIns().payNew(payData, payType, mPay);
|
SDKAPI.getIns().payNew(payData, payType, mPay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// thirdExtend — with channel helper support
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
public static void thirdExtend()
|
public static void thirdExtend() {
|
||||||
{
|
if (sdkHelper != null) {
|
||||||
Log.e(TAG,"====>java thirdExtend");
|
sdkHelper.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 public void callback(int code, String msg) {
|
@Override
|
||||||
|
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", msg);
|
result.put("respObj", msg);
|
||||||
}else {
|
} else {
|
||||||
Log.e(TAG,"获取商品列表失败啦:" + msg);
|
Log.e(TAG, "thirdExtend failed: " + msg);
|
||||||
result.put("thirdExtend_errStr", msg);
|
result.put("thirdExtend_errStr", msg);
|
||||||
}
|
}
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, result.toString());
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, result.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SDKLog.e("SDKManager-UnityGetKnowTypeList-Exception" + e);
|
SDKLog.e("SDKManager-thirdExtend-Exception" + e);
|
||||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
|
||||||
|
ConfigManager.PAY_TYPE_CALLBACK_FUNCTION_NAME, "{\"code\":1}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IGASDK GetGameGa(){
|
// -------------------------------------------------------------------------
|
||||||
if(gasdk == null){
|
// GA (shared)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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())
|
||||||
@@ -435,82 +455,61 @@ public class SDKManager {
|
|||||||
return gasdk;
|
return gasdk;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetGaUserInfo(String userId)
|
public static void SetGaUserInfo(String userId) {
|
||||||
{
|
Log.e(TAG, "SetGaUserInfo : " + userId);
|
||||||
Log.e(TAG,"SetGaUserInfo : " + userId);
|
|
||||||
SDKLog.i("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);
|
||||||
Log.e(TAG,"SetGaCommonInfo : " + SetGaCommonInfo);
|
|
||||||
SDKLog.i("SetGaCommonInfo : " + SetGaCommonInfo);
|
SDKLog.i("SetGaCommonInfo : " + SetGaCommonInfo);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Map<String, Object> map = gson.fromJson(SetGaCommonInfo, new TypeToken<Map<String, Object>>(){}.getType());
|
Map<String, Object> map = gson.fromJson(SetGaCommonInfo,
|
||||||
|
new TypeToken<Map<String, Object>>() {}.getType());
|
||||||
for (String key : map.keySet()) {
|
for (String key : map.keySet()) {
|
||||||
System.out.println("Key = " + key + ", Value = " + map.get(key));
|
if (!TextUtils.isEmpty(key) && map.get(key) != null) {
|
||||||
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, new TypeToken<Map<String, Object>>(){}.getType());
|
Map<String, Object> map = gson.fromJson(paramstr,
|
||||||
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// GA_TRACK = 1, //默认类型
|
switch (type) {
|
||||||
// GA_CION = 2, //金流相关事件
|
case 2: GetGameGa().track(EventType.COIN, eventstr, paramsBuilder); break;
|
||||||
// GA_PAY = 3, //支付相关事件
|
case 3: GetGameGa().track(EventType.PAY, eventstr, paramsBuilder); break;
|
||||||
// GA_GAME = 4, //游戏行为
|
case 4: GetGameGa().track(EventType.GAME, eventstr, paramsBuilder); break;
|
||||||
// GA_LOGIN = 5, //登录注册相关事件
|
case 5: GetGameGa().track(EventType.PAY, eventstr, paramsBuilder); break;
|
||||||
// GA_PUSH = 6, //推送相关事件
|
case 6: GetGameGa().track(EventType.PUSH, eventstr, paramsBuilder); break;
|
||||||
// GA_ADBOX = 7, //adbox相关事件
|
case 7: GetGameGa().track(EventType.ADBOX, eventstr, paramsBuilder); break;
|
||||||
// GA_PREFORMANCE = 8, //性能上报相关事件
|
case 8: GetGameGa().track(EventType.PREFORMANCE, eventstr, paramsBuilder); break;
|
||||||
// GA_SDK = 9, //SDK相关事件
|
case 9: GetGameGa().track(EventType.SDK, eventstr, paramsBuilder); break;
|
||||||
// GA_ABTest = 10, //abtest相关事件
|
default: GetGameGa().track(EventType.TRACK, eventstr, paramsBuilder); break;
|
||||||
|
|
||||||
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() {
|
||||||
|
if ("Rustore".equals(channel)) {
|
||||||
|
RuStoreReview();
|
||||||
|
} 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 -> {
|
||||||
@@ -519,16 +518,59 @@ public class SDKManager {
|
|||||||
Activity activity = UnityPlayer.currentActivity;
|
Activity activity = UnityPlayer.currentActivity;
|
||||||
manager.launchReviewFlow(activity, reviewInfo);
|
manager.launchReviewFlow(activity, reviewInfo);
|
||||||
} else {
|
} else {
|
||||||
@ReviewErrorCode int reviewErrorCode = ((ReviewException) request.getException()).getErrorCode();
|
@ReviewErrorCode int reviewErrorCode =
|
||||||
Log.e(TAG,"Review Error code: " + reviewErrorCode);
|
((ReviewException) request.getException()).getErrorCode();
|
||||||
|
Log.e(TAG, "Review Error code: " + reviewErrorCode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void FBShareLink(String title, String content, String url)
|
// RuStore two-step review
|
||||||
{
|
public interface ReviewResultCallback {
|
||||||
Log.e(TAG,"FBShareLink : " + title + " " + content + " " + url);
|
void onReviewSuccess(JSONObject result);
|
||||||
|
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);
|
||||||
@@ -537,30 +579,22 @@ 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: b4630fc5c78457748a2f763ac5168df6
|
guid: 1f7e4cbb67a383441bd126c06021a072
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
18
sdk-intergration/Packages/tysdk/Runtime/ChannelConfig.cs
Normal file
18
sdk-intergration/Packages/tysdk/Runtime/ChannelConfig.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
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",
|
||||||
|
_ => "googleiab.global.app"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static int LoginTimeoutSeconds => Channel == "Rustore" ? 120 : 30;
|
||||||
|
|
||||||
|
public static void SetChannel(string channel) { Channel = channel; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
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: 292a655e788d84d34aac4f83c57706ff
|
guid: cca93fc1d8dde744a86aff3c3a1b73ed
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
53
sdk-intergration/Packages/tysdk/Runtime/TYSdkCoreModel.cs
Normal file
53
sdk-intergration/Packages/tysdk/Runtime/TYSdkCoreModel.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace tysdk
|
||||||
|
{
|
||||||
|
// TYSdkFacade 的登录/链接/ATT 等方法要依赖这些 POCO。
|
||||||
|
|
||||||
|
public enum EAccoutType
|
||||||
|
{
|
||||||
|
hwGoogle,
|
||||||
|
hwFacebook,
|
||||||
|
hwGuest,
|
||||||
|
hwVkid,
|
||||||
|
Apple,
|
||||||
|
none
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LoginInfo
|
||||||
|
{
|
||||||
|
public bool isSuccess;
|
||||||
|
public int userId;
|
||||||
|
public string StrUserId => userId.ToString();
|
||||||
|
public string msg;
|
||||||
|
public int code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LinkResult
|
||||||
|
{
|
||||||
|
// 0: success, 1: fail, -1 exists
|
||||||
|
public int code;
|
||||||
|
// when success and fail userId is current user
|
||||||
|
// when exists userId is 0
|
||||||
|
public int userId;
|
||||||
|
// not none when exists
|
||||||
|
public Dictionary<string, string> bindInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChangeLinkResult
|
||||||
|
{
|
||||||
|
public int code;
|
||||||
|
public int userId;
|
||||||
|
public string msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LinkCheckInfo
|
||||||
|
{
|
||||||
|
public int code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ATTInfo
|
||||||
|
{
|
||||||
|
public bool isAccepted;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2d36f2094aa5783423ab1ef40a88ccbe
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -34,14 +34,20 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, EAccoutType> accoutTypeMap = new Dictionary<string, EAccoutType>(){
|
private static Dictionary<string, EAccoutType> accoutTypeMap = new Dictionary<string, EAccoutType>()
|
||||||
|
{
|
||||||
{"google", EAccoutType.hwGoogle},
|
{"google", EAccoutType.hwGoogle},
|
||||||
{"fb", EAccoutType.hwFacebook},
|
{"fb", EAccoutType.hwFacebook},
|
||||||
{"tyGuest", EAccoutType.hwGuest},
|
{"tyGuest", EAccoutType.hwGuest},
|
||||||
{"ios13", EAccoutType.Apple},
|
{"ios13", EAccoutType.Apple},
|
||||||
{AccountString.hwVkid, EAccoutType.hwVkid}
|
{"vk.global.app", EAccoutType.hwVkid},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static void AddAccoutType(string key, EAccoutType value)
|
||||||
|
{
|
||||||
|
accoutTypeMap[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
private static EAccoutType ConvertAccoutType(string accountType)
|
private static EAccoutType ConvertAccoutType(string accountType)
|
||||||
{
|
{
|
||||||
if (accoutTypeMap.ContainsKey(accountType))
|
if (accoutTypeMap.ContainsKey(accountType))
|
||||||
@@ -102,10 +108,11 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AccountInfo _accountInfo;
|
// ================== Singleton ==================
|
||||||
public static AccountInfo TYAccountInfo => _accountInfo;
|
|
||||||
|
|
||||||
private static TYSdkFacade _instance;
|
private static TYSdkFacade _instance;
|
||||||
|
public static AccountInfo TYAccountInfo => _accountInfo;
|
||||||
|
protected static AccountInfo _accountInfo;
|
||||||
|
|
||||||
public static TYSdkFacade Instance
|
public static TYSdkFacade Instance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -118,26 +125,27 @@ namespace tysdk
|
|||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string Channel => ChannelConfig.Channel;
|
||||||
|
|
||||||
|
private int LoginTimeoutSeconds => ChannelConfig.LoginTimeoutSeconds;
|
||||||
|
|
||||||
|
// ================== Init ==================
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
#if UNITY_ANDROID
|
#if UNITY_ANDROID
|
||||||
UnityBridgeFunc.InitSDK();
|
UnityBridgeFunc.InitSDK();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*================================================
|
/*================================================
|
||||||
|
|
||||||
_ _
|
_ _
|
||||||
/ \ ___ ___ ___ _ _ _ __ | |_
|
/ \ ___ ___ ___ _ _ _ __ | |_
|
||||||
/ _ \ / __/ __/ _ \| | | | '_ \| __|
|
/ _ \ / __/ __/ _ \| | | | '_ \| __|
|
||||||
/ ___ \ (_| (_| (_) | |_| | | | | |_
|
/ ___ \ (_| (_| (_) | |_| | | | | |_
|
||||||
/_/ \_\___\___\___/ \__,_|_| |_|\__|
|
/_/ \_\___\___\___/ \__,_|_| |_|\__|
|
||||||
|
|
||||||
=================================================*/
|
=================================================*/
|
||||||
|
|
||||||
|
|
||||||
public static bool IsLoggedIn => _accountInfo != null;
|
public static bool IsLoggedIn => _accountInfo != null;
|
||||||
|
|
||||||
public void Logout()
|
public void Logout()
|
||||||
@@ -172,14 +180,14 @@ namespace tysdk
|
|||||||
};
|
};
|
||||||
|
|
||||||
#elif UNITY_ANDROID || UNITY_IOS
|
#elif UNITY_ANDROID || UNITY_IOS
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(30));
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(LoginTimeoutSeconds));
|
||||||
|
|
||||||
UnityBridgeFunc.UnityLogin(accoutType);
|
UnityBridgeFunc.UnityLogin(accoutType);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var loginInfo = await task;
|
var loginInfo = await task;
|
||||||
if(loginInfo.isSuccess)
|
if (loginInfo.isSuccess)
|
||||||
{
|
{
|
||||||
_accountInfo.channel = accoutType;
|
_accountInfo.channel = accoutType;
|
||||||
_accountInfo.AddLinkedAccount(accoutType);
|
_accountInfo.AddLinkedAccount(accoutType);
|
||||||
@@ -187,10 +195,10 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
return loginInfo;
|
return loginInfo;
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[TYSdkFacade] Login failed: {e}");
|
Debug.LogWarning($"[TYSdkFacade] Login failed: {e}");
|
||||||
return new LoginInfo(){isSuccess = false};
|
return new LoginInfo() { isSuccess = false };
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -304,18 +312,17 @@ namespace tysdk
|
|||||||
UnityBridgeFunc.SetGaUserInfo(strUserId);
|
UnityBridgeFunc.SetGaUserInfo(strUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
public async Task<LinkResult> LinkAccount(EAccoutType accoutType)
|
public async Task<LinkResult> LinkAccount(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
await Task.Delay(300);
|
await Task.Delay(300);
|
||||||
return new LinkResult(){code = 1};
|
return new LinkResult() { code = 1 };
|
||||||
}
|
}
|
||||||
#elif UNITY_IOS || UNITY_ANDROID
|
#elif UNITY_IOS || UNITY_ANDROID
|
||||||
public async Task<LinkResult> LinkAccount(EAccoutType accoutType)
|
public async Task<LinkResult> LinkAccount(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
if (_accountInfo == null) return new LinkResult(){ code = 1};
|
if (_accountInfo == null) return new LinkResult() { code = 1 };
|
||||||
if (_accountInfo.linkedAccout.Contains(accoutType)) return new LinkResult(){ code = 0};
|
if (_accountInfo.linkedAccout.Contains(accoutType)) return new LinkResult() { code = 0 };
|
||||||
|
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LinkResult>(TimeSpan.FromMinutes(1));
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<LinkResult>(TimeSpan.FromMinutes(1));
|
||||||
UnityBridgeFunc.LinkAccount(accoutType);
|
UnityBridgeFunc.LinkAccount(accoutType);
|
||||||
@@ -337,6 +344,7 @@ namespace tysdk
|
|||||||
return new LinkResult() { code = 1 };
|
return new LinkResult() { code = 1 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public void LinkAccoutResult(string message)
|
public void LinkAccoutResult(string message)
|
||||||
{
|
{
|
||||||
@@ -359,7 +367,7 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
public void CleanLinkTempSnSInfo()
|
public void CleanLinkTempSnSInfo()
|
||||||
{
|
{
|
||||||
UnityBridgeFunc.CleanLinkTmpSnsInfo();
|
UnityBridgeFunc.CleanLinkTmpSnsInfo();
|
||||||
@@ -367,6 +375,10 @@ namespace tysdk
|
|||||||
|
|
||||||
public async Task<ChangeLinkResult> ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
public async Task<ChangeLinkResult> ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
||||||
{
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
await Task.Delay(300);
|
||||||
|
return new ChangeLinkResult() { code = 1 };
|
||||||
|
#else
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<ChangeLinkResult>(TimeSpan.FromSeconds(30));
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<ChangeLinkResult>(TimeSpan.FromSeconds(30));
|
||||||
UnityBridgeFunc.ChangeLinkAccount(accoutType, oldUserId, newUserId);
|
UnityBridgeFunc.ChangeLinkAccount(accoutType, oldUserId, newUserId);
|
||||||
try
|
try
|
||||||
@@ -388,6 +400,7 @@ namespace tysdk
|
|||||||
{
|
{
|
||||||
CleanLinkTempSnSInfo();
|
CleanLinkTempSnSInfo();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeLinkAccountResult(string message)
|
public void ChangeLinkAccountResult(string message)
|
||||||
@@ -402,14 +415,6 @@ namespace tysdk
|
|||||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 检查是否已经绑定
|
|
||||||
/// <returns>
|
|
||||||
/// 1 已经绑定
|
|
||||||
/// 0 未绑定
|
|
||||||
/// -1 失败
|
|
||||||
/// </returns>
|
|
||||||
/// </summary>
|
|
||||||
public async Task<bool> LinkCheck(EAccoutType accoutType)
|
public async Task<bool> LinkCheck(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
if (_accountInfo == null) return false;
|
if (_accountInfo == null) return false;
|
||||||
@@ -435,7 +440,7 @@ namespace tysdk
|
|||||||
|
|
||||||
return result.code == 1;
|
return result.code == 1;
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[TYSdkFacade] CheckLinkResult error: {e}");
|
Debug.LogWarning($"[TYSdkFacade] CheckLinkResult error: {e}");
|
||||||
return false;
|
return false;
|
||||||
@@ -457,7 +462,6 @@ namespace tysdk
|
|||||||
IConfig config = GContext.container.Resolve<IConfig>();
|
IConfig config = GContext.container.Resolve<IConfig>();
|
||||||
var tyurl = config.Get<string>("AGG_SERVER", defaultTyurl);
|
var tyurl = config.Get<string>("AGG_SERVER", defaultTyurl);
|
||||||
|
|
||||||
|
|
||||||
string tycs = tyurl == defaultTyurl ?
|
string tycs = tyurl == defaultTyurl ?
|
||||||
"https://hwcsh.tygameworld.com/template/appCancel/note.html"
|
"https://hwcsh.tygameworld.com/template/appCancel/note.html"
|
||||||
:
|
:
|
||||||
@@ -479,23 +483,12 @@ namespace tysdk
|
|||||||
string uid = $"uid={_accountInfo.userId}";
|
string uid = $"uid={_accountInfo.userId}";
|
||||||
list.Add(uid);
|
list.Add(uid);
|
||||||
|
|
||||||
string roleid = "roleid=0";
|
list.Add("roleid=0");
|
||||||
list.Add(roleid);
|
list.Add("gameid=20587");
|
||||||
|
list.Add("cloudid=128");
|
||||||
string gameid = "gameid=20587";
|
list.Add("gamename=FishingTravel");
|
||||||
list.Add(gameid);
|
list.Add("certification=0");
|
||||||
|
list.Add("ischannel=1");
|
||||||
string cloudid = "cloudid=128";
|
|
||||||
list.Add(cloudid);
|
|
||||||
|
|
||||||
string gamename = "gamename=FishingTravel";
|
|
||||||
list.Add(gamename);
|
|
||||||
|
|
||||||
string certification = "certification=0";
|
|
||||||
list.Add(certification);
|
|
||||||
|
|
||||||
string ischannel = "ischannel=1";
|
|
||||||
list.Add(ischannel);
|
|
||||||
|
|
||||||
string tysdktoken = $"tysdktoken={_accountInfo.token}";
|
string tysdktoken = $"tysdktoken={_accountInfo.token}";
|
||||||
list.Add(tysdktoken);
|
list.Add(tysdktoken);
|
||||||
@@ -505,7 +498,6 @@ namespace tysdk
|
|||||||
string listStr = string.Join("&", list.ToArray());
|
string listStr = string.Join("&", list.ToArray());
|
||||||
string sign = listStr +
|
string sign = listStr +
|
||||||
"csh-api-6dfa879490a249be9fbc92e97e4d898d-api-csh";
|
"csh-api-6dfa879490a249be9fbc92e97e4d898d-api-csh";
|
||||||
//对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}");
|
||||||
@@ -514,25 +506,16 @@ namespace tysdk
|
|||||||
|
|
||||||
private string CalculateMD5Hash(string input)
|
private string CalculateMD5Hash(string input)
|
||||||
{
|
{
|
||||||
// Create a new instance of the MD5CryptoServiceProvider object.
|
|
||||||
MD5 md5Hasher = MD5.Create();
|
MD5 md5Hasher = MD5.Create();
|
||||||
|
|
||||||
// Convert the input string to a byte array and compute the hash.
|
|
||||||
byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
|
byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
|
||||||
|
|
||||||
// Create a new Stringbuilder to collect the bytes
|
|
||||||
// and create a string.
|
|
||||||
StringBuilder sBuilder = new StringBuilder();
|
StringBuilder sBuilder = new StringBuilder();
|
||||||
|
|
||||||
// Loop through each byte of the hashed data
|
|
||||||
// and format each one as a hexadecimal string.
|
|
||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
{
|
{
|
||||||
sBuilder.Append(data[i].ToString("x2"));
|
sBuilder.Append(data[i].ToString("x2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the hexadecimal string.
|
|
||||||
return sBuilder.ToString();
|
return sBuilder.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: db12db58fbcc54046aa4dac203cd4971
|
guid: f2fa4b960a2b4594d80ea8b8caa2912d
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace tysdk
|
namespace tysdk
|
||||||
{
|
{
|
||||||
public partial class TYSdkFacade : MonoBehaviour
|
public partial class TYSdkFacade
|
||||||
{
|
{
|
||||||
/*================================================
|
/*================================================
|
||||||
|
|
||||||
@@ -25,25 +25,25 @@ namespace tysdk
|
|||||||
{
|
{
|
||||||
#if UNITY_EDITOR || UNITY_ANDROID
|
#if UNITY_EDITOR || UNITY_ANDROID
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
return new ATTInfo() { isAccepted = true };
|
||||||
return new ATTInfo(){isAccepted = true};
|
|
||||||
#elif UNITY_IOS
|
#elif UNITY_IOS
|
||||||
var task = tysdk.TYSDKCallbackManager.Instance.RegisterCallback<ATTInfo>();
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<ATTInfo>();
|
||||||
UnityBridgeFunc.RequestATT();
|
UnityBridgeFunc.RequestATT();
|
||||||
try{
|
try
|
||||||
|
{
|
||||||
return await task;
|
return await task;
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.LogWarning(e.Message);
|
Debug.LogWarning(e.Message);
|
||||||
return new ATTInfo(){isAccepted = false};
|
return new ATTInfo() { isAccepted = false };
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestATTResult(string r)
|
public void RequestATTResult(string r)
|
||||||
{
|
{
|
||||||
TYSDKCallbackManager.Instance.TryTriggerCallback(new ATTInfo(){isAccepted = r == "1"});
|
TYSDKCallbackManager.Instance.TryTriggerCallback(new ATTInfo() { isAccepted = r == "1" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8f92075f5f98490ca94ae4984ac0aa21
|
guid: 280d33ff6fcb3a342ab9683a01841b78
|
||||||
timeCreated: 1722855901
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace tysdk
|
namespace tysdk
|
||||||
{
|
{
|
||||||
public partial class TYSdkFacade : MonoBehaviour
|
public partial class TYSdkFacade
|
||||||
{
|
{
|
||||||
/*================================================
|
/*================================================
|
||||||
|
|
||||||
@@ -24,15 +24,15 @@ namespace tysdk
|
|||||||
|
|
||||||
public enum GATrackType
|
public enum GATrackType
|
||||||
{
|
{
|
||||||
GA_TRACK = 1, //默认类型
|
GA_TRACK = 1,
|
||||||
GA_CION = 2, //金流相关事件
|
GA_CION = 2,
|
||||||
GA_PAY = 3, //支付相关事件
|
GA_PAY = 3,
|
||||||
GA_GAME = 4, //游戏行为
|
GA_GAME = 4,
|
||||||
GA_LOGIN = 5, //登录注册相关事件
|
GA_LOGIN = 5,
|
||||||
GA_PUSH = 6, //推送相关事件
|
GA_PUSH = 6,
|
||||||
GA_ADBOX = 7, //adbox相关事件
|
GA_ADBOX = 7,
|
||||||
GA_PREFORMANCE = 8, //性能上报相关事件
|
GA_PREFORMANCE = 8,
|
||||||
GA_SDK = 9, //SDK相关事件
|
GA_SDK = 9,
|
||||||
GA_ABTest = 10, //abtest相关事件
|
GA_ABTest = 10,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 18459dcf8d5a40dc80ffae5333a6b0c9
|
guid: aa58ede4826973c4bbe3a5ebfdcd4b43
|
||||||
timeCreated: 1722855439
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace tysdk
|
namespace tysdk
|
||||||
{
|
{
|
||||||
public partial class TYSdkFacade : MonoBehaviour
|
public partial class TYSdkFacade
|
||||||
{
|
{
|
||||||
/*================================================
|
/*================================================
|
||||||
|
|
||||||
@@ -22,18 +22,16 @@ namespace tysdk
|
|||||||
|
|
||||||
private bool _payFirstNegativeHandled;
|
private bool _payFirstNegativeHandled;
|
||||||
|
|
||||||
//public async Task<PaymentInfo> Pay(string prodId, string prodPrice, string prodName, int count, string pType, string price_amount_micros =null)
|
|
||||||
public async Task<PaymentInfo> Pay(SKUDetail prod, int count, float usdprice, JObject purchaseInfo)
|
public async Task<PaymentInfo> Pay(SKUDetail prod, int count, float usdprice, JObject purchaseInfo)
|
||||||
{
|
{
|
||||||
if (!IsLoggedIn) return new PaymentInfo() { code = "-1", msg = "未登录" };
|
if (!IsLoggedIn) return new PaymentInfo() { code = "-1", msg = "未登录" };
|
||||||
|
|
||||||
var orderId = System.Guid.NewGuid().ToString();
|
var orderId = System.Guid.NewGuid().ToString();
|
||||||
|
|
||||||
if(purchaseInfo == null)
|
if (purchaseInfo == null)
|
||||||
purchaseInfo = new JObject();
|
purchaseInfo = new JObject();
|
||||||
|
|
||||||
string extraInfo = purchaseInfo.ToString(Newtonsoft.Json.Formatting.None);
|
string extraInfo = purchaseInfo.ToString(Newtonsoft.Json.Formatting.None);
|
||||||
//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;
|
||||||
@@ -57,14 +55,13 @@ namespace tysdk
|
|||||||
return result;
|
return result;
|
||||||
#elif UNITY_ANDROID
|
#elif UNITY_ANDROID
|
||||||
|
|
||||||
var pType = "googleiab.global.app";
|
var pType = ChannelConfig.PayType;
|
||||||
|
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<PaymentInfo>(TimeSpan.FromSeconds(30));
|
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;
|
||||||
@@ -108,7 +105,6 @@ namespace tysdk
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//支付的回调
|
|
||||||
public void PayResult(string json)
|
public void PayResult(string json)
|
||||||
{
|
{
|
||||||
Debug.Log("[TYSdkFacade] pay callback:" + json);
|
Debug.Log("[TYSdkFacade] pay callback:" + json);
|
||||||
@@ -116,7 +112,7 @@ namespace tysdk
|
|||||||
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();
|
||||||
if(result.code == "-1")
|
if (result.code == "-1")
|
||||||
{
|
{
|
||||||
if (!_payFirstNegativeHandled)
|
if (!_payFirstNegativeHandled)
|
||||||
{
|
{
|
||||||
@@ -133,7 +129,6 @@ namespace tysdk
|
|||||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Pay list
|
|
||||||
public async Task<ProductListInfo> GetSKUList()
|
public async Task<ProductListInfo> GetSKUList()
|
||||||
{
|
{
|
||||||
if (!IsLoggedIn) return new ProductListInfo() { code = -1, msg = "未登录" };
|
if (!IsLoggedIn) return new ProductListInfo() { code = -1, msg = "未登录" };
|
||||||
@@ -151,7 +146,6 @@ namespace tysdk
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//商品列表的回调
|
|
||||||
public void SKUListResult(string json)
|
public void SKUListResult(string json)
|
||||||
{
|
{
|
||||||
Debug.Log("[TYSdkFacade] GetSKUList callback");
|
Debug.Log("[TYSdkFacade] GetSKUList callback");
|
||||||
@@ -174,7 +168,3 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 41b6dc16dbab43388317bf9ff032cdca
|
guid: e05900a4aa124d746bfe9c15328fd0e9
|
||||||
timeCreated: 1722855703
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|||||||
@@ -1,62 +1,14 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace tysdk
|
namespace tysdk
|
||||||
{
|
{
|
||||||
public enum EAccoutType
|
|
||||||
{
|
|
||||||
hwGoogle,
|
|
||||||
hwFacebook,
|
|
||||||
hwGuest,
|
|
||||||
hwVkid,
|
|
||||||
Apple,
|
|
||||||
none
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class AccountString
|
|
||||||
{
|
|
||||||
public const string hwVkid = "vk.global.app";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class LoginInfo
|
|
||||||
{
|
|
||||||
public bool isSuccess;
|
|
||||||
public int userId;
|
|
||||||
public string StrUserId => userId.ToString();
|
|
||||||
public string msg;
|
|
||||||
public int code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LinkResult
|
|
||||||
{
|
|
||||||
// 0: success, 1: fail, -1 exists
|
|
||||||
public int code;
|
|
||||||
// when success and fail userId is current user
|
|
||||||
// when exists userId is 0
|
|
||||||
public int userId;
|
|
||||||
// not none when exists
|
|
||||||
public Dictionary<string, string> bindInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ChangeLinkResult
|
|
||||||
{
|
|
||||||
public int code;
|
|
||||||
public int userId;
|
|
||||||
public string msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LinkCheckInfo
|
|
||||||
{
|
|
||||||
public int code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PaymentInfo
|
public class PaymentInfo
|
||||||
{
|
{
|
||||||
public bool isSuccessFromSdk => code == "0";
|
public bool isSuccessFromSdk => code == "0";
|
||||||
public bool isSuccess => isSuccessFromSdk && confirmed;
|
public bool isSuccess => isSuccessFromSdk && confirmed;
|
||||||
private bool confirmed {get; set;} = false;
|
private bool confirmed { get; set; } = false;
|
||||||
public int count;
|
public int count;
|
||||||
public string orderId;
|
public string orderId;
|
||||||
public string productId;
|
public string productId;
|
||||||
@@ -65,18 +17,23 @@ namespace tysdk
|
|||||||
public string code;
|
public string code;
|
||||||
public string msg;
|
public string msg;
|
||||||
|
|
||||||
|
// Flexion: purchase.getOriginalJson(), used by server for RSA signature verification
|
||||||
|
public string purchaseJson;
|
||||||
|
// Flexion: purchase.getSignature(), used by server for RSA signature verification
|
||||||
|
public string signature;
|
||||||
|
|
||||||
public bool Check(string orderId, string productId)
|
public bool Check(string orderId, string productId)
|
||||||
{
|
{
|
||||||
confirmed = orderId == this.orderId && productId == this.productId;
|
confirmed = orderId == this.orderId && productId == this.productId;
|
||||||
|
|
||||||
if(!confirmed)
|
if (!confirmed)
|
||||||
UnityEngine.Debug.LogWarning("[TYSdk Pay] order not confirmed");
|
UnityEngine.Debug.LogWarning("[TYSdk Pay] order not confirmed");
|
||||||
return confirmed;
|
return confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
|
return JsonConvert.SerializeObject(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +60,6 @@ namespace tysdk
|
|||||||
products = prodList;
|
products = prodList;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_IOS
|
#if UNITY_IOS
|
||||||
@@ -124,7 +80,7 @@ namespace tysdk
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
|
return JsonConvert.SerializeObject(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -132,28 +88,30 @@ namespace tysdk
|
|||||||
{
|
{
|
||||||
public string description;
|
public string description;
|
||||||
public string ourProductId;
|
public string ourProductId;
|
||||||
|
public string productId;
|
||||||
public string price;
|
public string price;
|
||||||
public string price_amount_micros;
|
public string price_amount_micros;
|
||||||
public string price_currency_code;
|
public string price_currency_code;
|
||||||
public string productId;
|
|
||||||
public string title;
|
public string title;
|
||||||
public string type;
|
public string type;
|
||||||
|
|
||||||
public override string ToString()
|
// RuStore specific
|
||||||
{
|
public string currency;
|
||||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
|
public string price_amount;
|
||||||
}
|
|
||||||
|
|
||||||
public string ProdPriceStr => price;
|
public string ProdPriceStr => ChannelConfig.Channel == "Rustore"
|
||||||
public float ProdPrice => float.Parse(price_amount_micros) / 1000000;
|
? $"₽{ProdPrice}"
|
||||||
|
: price;
|
||||||
|
public float ProdPrice => ChannelConfig.Channel == "Rustore"
|
||||||
|
? float.Parse(price) / 100
|
||||||
|
: float.Parse(price_amount_micros) / 1000000;
|
||||||
public string ProdID => ourProductId;
|
public string ProdID => ourProductId;
|
||||||
public string ProdKey => productId;
|
public string ProdKey => productId;
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return JsonConvert.SerializeObject(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public class ATTInfo
|
|
||||||
{
|
|
||||||
public bool isAccepted;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: b94c8e87cc23b4053a4cbf592ff14db3
|
guid: ebabed604bd06e44099073951d667658
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@@ -4,64 +4,46 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace tysdk
|
namespace tysdk
|
||||||
{
|
{
|
||||||
|
|
||||||
public static class UnityBridgeFunc
|
public static class UnityBridgeFunc
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR || UNITY_ANDROID
|
|
||||||
private static string EAccountTypeToStr(EAccoutType accountType)
|
|
||||||
{
|
|
||||||
return accountType == EAccoutType.hwVkid ? AccountString.hwVkid : accountType.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
//初始化sdk
|
public static void InitSDK() { }
|
||||||
public static void InitSDK(){}
|
|
||||||
|
|
||||||
//更新登录支付域名
|
public static void UnityResetServerUrl(string url) { }
|
||||||
public static void UnityResetServerUrl(string url){}
|
|
||||||
|
|
||||||
//登录
|
public static void UnityLoginByTokenFun(string token) { }
|
||||||
public static void UnityLoginByTokenFun(string token){}
|
|
||||||
|
|
||||||
public static string UnityLoginBySnsInfoFun() => null;
|
public static string UnityLoginBySnsInfoFun() => null;
|
||||||
|
|
||||||
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 ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId) { }
|
||||||
|
public static void LinkCheck(EAccoutType accoutType) { }
|
||||||
|
|
||||||
public static void LinkAccount(EAccoutType accoutType){}
|
public static void UnityGetIdentityFun(string type) { }
|
||||||
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId){}
|
|
||||||
public static void LinkCheck(EAccoutType accoutType){}
|
|
||||||
|
|
||||||
public static void UnityGetIdentityFun(string type){}
|
public static void UnityLogOutByChannel(EAccoutType accoutType) { }
|
||||||
|
|
||||||
public static void UnityLogOutByChannel(EAccoutType accoutType){}
|
|
||||||
//支付new
|
|
||||||
public static void UnityKnowNew(string productId, string productPrice, string productName,
|
public static void UnityKnowNew(string productId, string productPrice, string productName,
|
||||||
string productCount, string prodorderId, string appInfo, string pType) { }
|
string productCount, string prodorderId, string appInfo, string pType) { }
|
||||||
|
|
||||||
//支付
|
|
||||||
|
|
||||||
public static void UnityKnow(String productId, String productName, String productCount,
|
public static void UnityKnow(String productId, String productName, String productCount,
|
||||||
String prodorderId, String appInfo) {}
|
String prodorderId, String appInfo) { }
|
||||||
|
|
||||||
//获取商品列表
|
|
||||||
public static void GetSKUList() { }
|
public static void GetSKUList() { }
|
||||||
|
|
||||||
//打点
|
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){}
|
public static void RequestATT() { }
|
||||||
|
|
||||||
//ATT
|
public static int GetATT() { return 1; }
|
||||||
public static void RequestATT(){}
|
|
||||||
|
|
||||||
public static int GetATT() {return 1;}
|
|
||||||
|
|
||||||
public static void Review() { }
|
public static void Review() { }
|
||||||
|
|
||||||
@@ -72,30 +54,34 @@ namespace tysdk
|
|||||||
|
|
||||||
private static string SDK_CLASS = "com.unity3d.player.SDKManager";
|
private static string SDK_CLASS = "com.unity3d.player.SDKManager";
|
||||||
|
|
||||||
//初始化sdk
|
private static string EAccountTypeToStr(EAccoutType accoutType)
|
||||||
public static void InitSDK(){
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
{
|
||||||
using(var activityCls = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
|
return accoutType == EAccoutType.hwVkid ? "vk.global.app" : accoutType.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InitSDK()
|
||||||
|
{
|
||||||
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
|
{
|
||||||
|
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);
|
sdkManager.CallStatic("InitSDK", activity, ChannelConfig.Channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//更新登录支付域名
|
|
||||||
public static void UnityResetServerUrl(string url)
|
public static void UnityResetServerUrl(string url)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("UnityResetServerUrl", url);
|
sdkManager.CallStatic("UnityResetServerUrl", url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//登录
|
|
||||||
public static void UnityLoginByTokenFun(string token)
|
public static void UnityLoginByTokenFun(string token)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("UnityLoginByTokenFun", token);
|
sdkManager.CallStatic("UnityLoginByTokenFun", token);
|
||||||
}
|
}
|
||||||
@@ -103,7 +89,7 @@ namespace tysdk
|
|||||||
|
|
||||||
public static String UnityLoginBySnsInfoFun()
|
public static String UnityLoginBySnsInfoFun()
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
return sdkManager.CallStatic<string>("UnityLoginBySnsInfo");
|
return sdkManager.CallStatic<string>("UnityLoginBySnsInfo");
|
||||||
}
|
}
|
||||||
@@ -112,16 +98,15 @@ namespace tysdk
|
|||||||
public static void UnityLogin(EAccoutType accoutType)
|
public static void UnityLogin(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
var accountInfo = EAccountTypeToStr(accoutType);
|
var accountInfo = EAccountTypeToStr(accoutType);
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("UnityLogin",accountInfo);
|
sdkManager.CallStatic("UnityLogin", accountInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnityGetIdentityFun(string type)
|
public static void UnityGetIdentityFun(string type)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("UnityGetIdentityFun", type);
|
sdkManager.CallStatic("UnityGetIdentityFun", type);
|
||||||
}
|
}
|
||||||
@@ -129,9 +114,8 @@ namespace tysdk
|
|||||||
|
|
||||||
public static void UnityLogOutByChannel(EAccoutType accoutType)
|
public static void UnityLogOutByChannel(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
|
|
||||||
var accountInfo = EAccountTypeToStr(accoutType);
|
var accountInfo = EAccountTypeToStr(accoutType);
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("UnityLogOutByChannel", accountInfo);
|
sdkManager.CallStatic("UnityLogOutByChannel", accountInfo);
|
||||||
}
|
}
|
||||||
@@ -140,22 +124,20 @@ namespace tysdk
|
|||||||
public static void LinkAccount(EAccoutType accoutType)
|
public static void LinkAccount(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
string userId = TYSdkFacade.TYAccountInfo.strUserId;
|
string userId = TYSdkFacade.TYAccountInfo.strUserId;
|
||||||
|
var accountInfo = EAccountTypeToStr(accoutType);
|
||||||
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
var accountInfo = EAccountTypeToStr(accoutType);
|
sdkManager.CallStatic("LinkAccount", accountInfo, userId);
|
||||||
sdkManager.CallStatic("LinkAccount",accountInfo,userId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CleanLinkTmpSnsInfo(){
|
public static void CleanLinkTmpSnsInfo()
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
{
|
||||||
using(var activityCls = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("CleanLinkTmpSnsInfo");
|
sdkManager.CallStatic("CleanLinkTmpSnsInfo");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
||||||
{
|
{
|
||||||
@@ -169,47 +151,42 @@ namespace tysdk
|
|||||||
public static void LinkCheck(EAccoutType accoutType)
|
public static void LinkCheck(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
var accountInfo = EAccountTypeToStr(accoutType);
|
var accountInfo = EAccountTypeToStr(accoutType);
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("LinkCheck",accountInfo);
|
sdkManager.CallStatic("LinkCheck", accountInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//支付new
|
|
||||||
public static void UnityKnowNew(string productId, string productPrice, string productName,
|
public static void UnityKnowNew(string productId, string productPrice, string productName,
|
||||||
string productCount, string prodorderId, string appInfo,string pType)
|
string productCount, string prodorderId, string appInfo, string pType)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("UnityKnowNew", productId, productPrice, productName,
|
sdkManager.CallStatic("UnityKnowNew", productId, productPrice, productName,
|
||||||
productCount, prodorderId, appInfo,pType);
|
productCount, prodorderId, appInfo, pType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//支付
|
|
||||||
|
|
||||||
public static void UnityKnow(String productId, String productName, String productCount, String prodorderId, String appInfo)
|
public static void UnityKnow(String productId, String productName, String productCount, String prodorderId, String appInfo)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("UnityKnow", productId, productName, productCount, prodorderId, appInfo);
|
sdkManager.CallStatic("UnityKnow", productId, productName, productCount, prodorderId, appInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取商品列表
|
|
||||||
public static void GetSKUList()
|
public static void GetSKUList()
|
||||||
{
|
{
|
||||||
UnityEngine.Debug.Log("UnityBridgeFunc.GetSKUList()");
|
UnityEngine.Debug.Log("UnityBridgeFunc.GetSKUList()");
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("thirdExtend");
|
sdkManager.CallStatic("thirdExtend");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//打点
|
|
||||||
public static void SetGaUserInfo(string userId)
|
public static void SetGaUserInfo(string userId)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("SetGaUserInfo", userId);
|
sdkManager.CallStatic("SetGaUserInfo", userId);
|
||||||
}
|
}
|
||||||
@@ -217,7 +194,7 @@ namespace tysdk
|
|||||||
|
|
||||||
public static void SetGaCommonInfo(string SetGaCommonInfo)
|
public static void SetGaCommonInfo(string SetGaCommonInfo)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("SetGaCommonInfo", SetGaCommonInfo);
|
sdkManager.CallStatic("SetGaCommonInfo", SetGaCommonInfo);
|
||||||
}
|
}
|
||||||
@@ -225,30 +202,27 @@ namespace tysdk
|
|||||||
|
|
||||||
public static void GAReportParams(int type, string eventstr, string paramstr)
|
public static void GAReportParams(int type, string eventstr, string paramstr)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("GAReportParams", type, eventstr, paramstr);
|
sdkManager.CallStatic("GAReportParams", type, eventstr, paramstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RequestATT() { }
|
||||||
|
|
||||||
//ATT
|
public static int GetATT() { return 1; }
|
||||||
public static void RequestATT(){}
|
|
||||||
|
|
||||||
public static int GetATT() {return 1;}
|
|
||||||
|
|
||||||
public static void Review()
|
public static void Review()
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("Review");
|
sdkManager.CallStatic("Review");
|
||||||
// sdkManager.CallStataic("RuStoreReview");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void FBShareLink(string title, string content, string url)
|
public static void FBShareLink(string title, string content, string url)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("FBShareLink", title, content, url);
|
sdkManager.CallStatic("FBShareLink", title, content, url);
|
||||||
}
|
}
|
||||||
@@ -256,7 +230,7 @@ namespace tysdk
|
|||||||
|
|
||||||
public static void MessengerShareLink(string title, string content, string url)
|
public static void MessengerShareLink(string title, string content, string url)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("MessengerShareLink", title, content, url);
|
sdkManager.CallStatic("MessengerShareLink", title, content, url);
|
||||||
}
|
}
|
||||||
@@ -264,11 +238,9 @@ namespace tysdk
|
|||||||
|
|
||||||
#elif UNITY_IOS
|
#elif UNITY_IOS
|
||||||
|
|
||||||
//更新登录支付域名
|
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
public static extern void UnityResetServerUrl(string url);
|
public static extern void UnityResetServerUrl(string url);
|
||||||
|
|
||||||
//登录
|
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
public static extern void UnityLoginByTokenFun(string token);
|
public static extern void UnityLoginByTokenFun(string token);
|
||||||
|
|
||||||
@@ -284,7 +256,6 @@ namespace tysdk
|
|||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert C string to C# string
|
|
||||||
string result = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(ptr);
|
string result = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(ptr);
|
||||||
return result ?? string.Empty;
|
return result ?? string.Empty;
|
||||||
}
|
}
|
||||||
@@ -375,7 +346,6 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[DllImport("__Internal")] private static extern void LinkGoogle(int userId);
|
[DllImport("__Internal")] private static extern void LinkGoogle(int userId);
|
||||||
[DllImport("__Internal")] private static extern void LinkFacebook(int userId);
|
[DllImport("__Internal")] private static extern void LinkFacebook(int userId);
|
||||||
[DllImport("__Internal")] private static extern void LinkApple(int userId);
|
[DllImport("__Internal")] private static extern void LinkApple(int userId);
|
||||||
@@ -393,31 +363,25 @@ namespace tysdk
|
|||||||
case EAccoutType.hwFacebook:
|
case EAccoutType.hwFacebook:
|
||||||
IsLinkedFacebook();
|
IsLinkedFacebook();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EAccoutType.Apple:
|
case EAccoutType.Apple:
|
||||||
IsLinkedApple();
|
IsLinkedApple();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[DllImport("__Internal")] public static extern void CleanLinkTmpSnsInfo();
|
[DllImport("__Internal")] public static extern void CleanLinkTmpSnsInfo();
|
||||||
|
|
||||||
[DllImport("__Internal")] private static extern void IsLinkedGoogle();
|
[DllImport("__Internal")] private static extern void IsLinkedGoogle();
|
||||||
[DllImport("__Internal")] private static extern void IsLinkedFacebook();
|
[DllImport("__Internal")] private static extern void IsLinkedFacebook();
|
||||||
[DllImport("__Internal")] private static extern void IsLinkedApple();
|
[DllImport("__Internal")] private static extern void IsLinkedApple();
|
||||||
|
|
||||||
|
|
||||||
//支付
|
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
public static extern void UnityKnow(string userId, string productId, string productPrice, string productName,
|
public static extern void UnityKnow(string userId, string productId, string productPrice, string productName,
|
||||||
string productCount, string prodorderId, string appInfo);
|
string productCount, string prodorderId, string appInfo);
|
||||||
|
|
||||||
//获取商品列表
|
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
public static extern void GetSKUList();
|
public static extern void GetSKUList();
|
||||||
|
|
||||||
//打点
|
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
public static extern void SetGaUserInfo(string userId);
|
public static extern void SetGaUserInfo(string userId);
|
||||||
|
|
||||||
@@ -427,7 +391,6 @@ namespace tysdk
|
|||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
public static extern void GAReportParams(int type, string eventstr, string paramstr);
|
public static extern void GAReportParams(int type, string eventstr, string paramstr);
|
||||||
|
|
||||||
//ATT
|
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
public static extern void RequestATT();
|
public static extern void RequestATT();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 16335dd05906d48bf81e297920aecf31
|
guid: e24b3b915d94468419519a81bb69e269
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
Reference in New Issue
Block a user