tuyou sdk
This commit is contained in:
13
sdk-intergration/.idea/.idea.sdk-intergration/.idea/.gitignore
generated
vendored
Normal file
13
sdk-intergration/.idea/.idea.sdk-intergration/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/contentModel.xml
|
||||
/projectSettingsUpdater.xml
|
||||
/.idea.sdk-intergration.iml
|
||||
/modules.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
4
sdk-intergration/.idea/.idea.sdk-intergration/.idea/encodings.xml
generated
Normal file
4
sdk-intergration/.idea/.idea.sdk-intergration/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
8
sdk-intergration/.idea/.idea.sdk-intergration/.idea/indexLayout.xml
generated
Normal file
8
sdk-intergration/.idea/.idea.sdk-intergration/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
6
sdk-intergration/.idea/.idea.sdk-intergration/.idea/vcs.xml
generated
Normal file
6
sdk-intergration/.idea/.idea.sdk-intergration/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
8
sdk-intergration/Assets/Plugins.meta
Normal file
8
sdk-intergration/Assets/Plugins.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de38137d567d12045bbe1372bc888de6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
sdk-intergration/Assets/Plugins/Android.meta
Normal file
8
sdk-intergration/Assets/Plugins/Android.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fdee26ffb417244da1c9778ddaf7e90
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml
Normal file
18
sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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"/>
|
||||
<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>
|
||||
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 339beab439a427b4b9e96b2accf2e146
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,5 @@
|
||||
unityStreamingAssets=.unity3d**STREAMING_ASSETS**
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
android.suppressUnsupportedCompileSdk=33
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86d31d9e59f392d4b8538e7dcf812ec3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
92
sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle
Normal file
92
sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle
Normal file
@@ -0,0 +1,92 @@
|
||||
apply plugin: 'com.android.library'
|
||||
**APPLY_PLUGINS**
|
||||
|
||||
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"
|
||||
|
||||
//GA依赖
|
||||
// implementation 'com.tuyoo.component:growsdk-gasdk:2.4.22_0115-RELEASE'
|
||||
implementation 'net.aihelp:android-aihelp-aar:4.6.+'
|
||||
|
||||
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.appsflyer:af-android-sdk:6.12.5'
|
||||
implementation 'com.android.installreferrer:installreferrer:2.2'
|
||||
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')
|
||||
|
||||
// Android Resolver Dependencies Start
|
||||
// implementation 'com.applovin:applovin-sdk:12.6.0'
|
||||
// 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
|
||||
}
|
||||
|
||||
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**
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edc76530d8406f74787197e56949feb3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
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("\\", "/")
|
||||
mavenLocal()
|
||||
// Android Resolver Repos End
|
||||
flatDir {
|
||||
dirs "${project(':unityLibrary').projectDir}/libs"
|
||||
}
|
||||
|
||||
maven {
|
||||
url "http://sdkck.tuyoo.com/artifactory/tuyoo-component/"
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2f880703e7cd08469817aea47e80830
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
package com.unity3d.player;
|
||||
|
||||
public class ConfigManager {
|
||||
//通用参数
|
||||
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";
|
||||
|
||||
// 防沉迷 - nameSpace
|
||||
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";
|
||||
|
||||
|
||||
public static final String UNITY_FACADE_NAME = "TYSdkFacade";
|
||||
public static final String LOGIN_CALLBACK_FUNCTION_NAME = "LoginResult";
|
||||
public static final String PAY_CALLBACK_FUNCTION_NAME = "PayResult";
|
||||
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "PayTypeResult";
|
||||
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
|
||||
public static final String FCM_REALNAME_CALLBACK_FUNCTION_NAME = "RealNameCallback";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1db5fda501403f6488b08a37aebd8a80
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
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:
|
||||
303
sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java
Normal file
303
sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java
Normal file
@@ -0,0 +1,303 @@
|
||||
|
||||
package com.unity3d.player;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
//import com.barton.log.GASDKFactory;
|
||||
//import com.barton.log.builder.GAConfiguration;
|
||||
//import com.barton.log.builder.ParamsBuilder;
|
||||
//import com.barton.log.ebarton.BaseUrl;
|
||||
//import com.barton.log.ebarton.EventType;
|
||||
//import com.barton.log.logapi.IGASDK;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tuyoo.gamesdk.api.SDKAPI;
|
||||
import com.tuyoo.gamesdk.api.SDKCallBack;
|
||||
import com.tuyoo.gamesdk.api.SDKWrapper;
|
||||
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.WeixinShareData;
|
||||
import com.tuyoo.gamesdk.model.InitParam;
|
||||
import com.tuyoo.gamesdk.pay.model.PayType;
|
||||
import com.tuyoo.gamesdk.util.SDKLog;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SDKManager {
|
||||
|
||||
private final static Handler handler = new Handler(Looper.getMainLooper());
|
||||
// private static IGASDK gasdk;
|
||||
private static final String TAG = com.unity3d.player.SDKManager.class.getSimpleName();
|
||||
private static String curType = TuYooClientID.tyGuest;
|
||||
public static void InitSDK(Activity activity)
|
||||
{
|
||||
Log.e(TAG,"SDKManager:::InitSDK");
|
||||
Log.e(TAG,"SDK_APPID:::" + ConfigManager.SDK_APPID);
|
||||
Log.e(TAG,"SDK_CLIENTID:::" + ConfigManager.SDK_CLIENTID);
|
||||
Log.e(TAG,"SDK_LOGIN_SERVER_URL:::" + ConfigManager.SDK_LOGIN_SERVER_URL);
|
||||
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());
|
||||
TYUnityActivity.setSdkInited();
|
||||
SDKAPI.getIns().onActivityStart(activity);
|
||||
SDKAPI.getIns().onActivityResume(activity);
|
||||
} catch (Exception e) {
|
||||
System.out.println("initSDK Exception " + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void parseLoginInfo(int i, String s) {
|
||||
Log.e(TAG,"parseLoginInfo!!" );
|
||||
try {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", i);
|
||||
if (i == 0) {
|
||||
JSONObject serverResponse = new JSONObject(s);
|
||||
JSONObject userInfo = serverResponse.getJSONObject("result");
|
||||
JSONObject userInfoReorganization = new JSONObject();
|
||||
userInfoReorganization.put("userId", userInfo.optString("userId"));
|
||||
userInfoReorganization.put("authorCode", userInfo.optString("authorCode"));
|
||||
userInfoReorganization.put("token", userInfo.optString("token"));
|
||||
userInfoReorganization.put("jwttoken", userInfo.optString("jwttoken"));
|
||||
JSONObject userInfoResult = new JSONObject();
|
||||
userInfoResult.put("result", userInfoReorganization);
|
||||
result.put("respObj", userInfoResult);
|
||||
|
||||
Log.e(TAG,"userId:::::" + userInfo.optString("userId"));
|
||||
Log.e(TAG,"token:::::" + userInfo.optString("token"));
|
||||
} else {
|
||||
Log.e(TAG,"errStr:::::" +s);
|
||||
result.put("errStr", s);
|
||||
Log.e(TAG,"errStrInfo:::::" +result.toString());
|
||||
}
|
||||
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, result.toString());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG,"SDKManager-parseLoginInfo-Exception" + e);
|
||||
SDKLog.e("SDKManager-parseLoginInfo-Exception" + e);
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.LOGIN_CALLBACK_FUNCTION_NAME, "{\"code\":1}}");
|
||||
}
|
||||
}
|
||||
|
||||
//登录回调-统一的回调方法(保持回调仅有一个,否则可能会出现多次回调的情况)
|
||||
static SDKCallBack.Login mLogin = new SDKCallBack.Login() {
|
||||
@Override
|
||||
public void callback(int i, String s) {
|
||||
SDKLog.i("SDKCallBack.Login callback: " + i + " \n" + s);
|
||||
parseLoginInfo(i, s);
|
||||
}
|
||||
};
|
||||
|
||||
static SDKCallBack.Pay mPay = new SDKCallBack.Pay() {
|
||||
@Override
|
||||
public void callback(int i, String s) {
|
||||
|
||||
Log.e(TAG,"SDKCallBack.Pay callback: " + i + " \n" + s);
|
||||
SDKLog.i("SDKCallBack.Pay callback: " + i + " \n" + s);
|
||||
try {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", i);
|
||||
result.put("respObj", s);
|
||||
result.put("errStr", s);
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.PAY_CALLBACK_FUNCTION_NAME, result.toString());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG,"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}}");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static void UnityResetServerUrl(String url) {
|
||||
SDKLog.i("UnityResetServerUrl : " + url);
|
||||
SDKAPI.getIns().updateServer(url);
|
||||
}
|
||||
|
||||
public static void UnityLoginByTokenFun(String token) {
|
||||
SDKLog.i("UnityLoginByTokenFun : " + token);
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SDKAPI.getIns().loginByToken(token, mLogin);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void UnityGetIdentityFun(String type) {
|
||||
curType = type;
|
||||
Log.e(TAG,"UnityGetIdentityFun : " + type);
|
||||
SDKLog.i("UnityGetIdentityFun : " + type);
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SDKAPI.getIns().loginByType(type, mLogin);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void UnityLoginOut() {
|
||||
// Log.e(TAG,"UnityLoginOut!!!");
|
||||
SDKLog.i("UnityLoginOut : ");
|
||||
handler.post(() -> SDKAPI.getIns().logout(curType));
|
||||
}
|
||||
|
||||
public static void UnityKnow(String userId, String productId, String productPrice, String productName, String productCount, String prodorderId, String appInfo) {
|
||||
SDKLog.i("UnityKnow : " + productId);
|
||||
HashMap<String, String> extraInfo = new HashMap<String, String>();
|
||||
extraInfo.put("appInfo", appInfo);
|
||||
SDKAPI.getIns().pay(productId, productName, productCount, Integer.parseInt(ConfigManager.SDK_GAMEID), mPay, prodorderId, extraInfo);
|
||||
}
|
||||
|
||||
public static void UnityGetKnowTypeList(String productId)
|
||||
{
|
||||
Log.e(TAG,"UnityGetKnowTypeList:" + productId );
|
||||
final PayEventData.PayReq mPayReq = new PayEventData.PayReq();
|
||||
mPayReq.prodId = productId;
|
||||
SDKAPI.getIns().charge(mPayReq , new SDKCallBack.Base1() {
|
||||
@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)
|
||||
{
|
||||
Log.e(TAG,"开始支付-----"+ "productId:" + productId+" "+ "productPrice:" + productPrice+" "+ "productName:" + productName +" "+ "prodorderId:" + prodorderId +" "+ "appInfo:" + appInfo +" "+ "ptype:" + ptype);
|
||||
|
||||
PayEventData.PayData payData = new PayEventData.PayData();
|
||||
final PayEventData.PayReq mPayReq = new PayEventData.PayReq();
|
||||
mPayReq.prodId = productId;
|
||||
mPayReq.prodPrice = productPrice;
|
||||
mPayReq.prodName = productName;
|
||||
mPayReq.prodCount = productCount;
|
||||
// 此字段与服务端回调接口内的appInfo不对应,与orderId相对应
|
||||
mPayReq.appInfo = prodorderId;
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
// 此字段(appInfo)可用于传递透传信息(此信息与服务端回调接口内的appInfo相对应)
|
||||
map.put("appInfo", appInfo);
|
||||
mPayReq.extra = map;
|
||||
payData.payReq = mPayReq;
|
||||
PayType payType = new PayType();
|
||||
payType.paytype = ptype;
|
||||
SDKAPI.getIns().payNew(payData, payType, mPay);
|
||||
}
|
||||
|
||||
|
||||
public static void thirdExtend()
|
||||
{
|
||||
Log.e(TAG,"====>java thirdExtend");
|
||||
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) {
|
||||
|
||||
Log.e(TAG,"====>thirdExtend code= " + code + " msg= " + msg );
|
||||
try {
|
||||
//获取成功,msg即为对应的json字符串
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", code);
|
||||
if(code == SDKCallBack.Extend.EXTEND_CODE_SUCCESS){
|
||||
result.put("respObj", msg);
|
||||
}else {
|
||||
Log.e(TAG,"获取商品列表失败啦:" + msg);
|
||||
result.put("thirdExtend_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}}");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// private static IGASDK GetGameGa(){
|
||||
// if(gasdk == null){
|
||||
// GAConfiguration.Builder builder = new GAConfiguration.Builder()
|
||||
// .withBaseUrl(BaseUrl.INTERNAL)
|
||||
// .withContext(SDKWrapper.getInstance().getContext())
|
||||
// .withClientId(ConfigManager.SDK_CLIENTID)
|
||||
// .withGameId(ConfigManager.SDK_GAMEID)
|
||||
// .withProjectId(ConfigManager.SDK_PROJECTID);
|
||||
// gasdk = GASDKFactory.createGASDK(builder.build());
|
||||
// }
|
||||
// return gasdk;
|
||||
// }
|
||||
|
||||
public static void SetGaUserInfo(String userId)
|
||||
{
|
||||
// Log.e(TAG,"SetGaUserInfo : " + userId);
|
||||
// SDKLog.i("SetGaUserInfo : " + userId);
|
||||
// GetGameGa().setUserId(userId);
|
||||
}
|
||||
|
||||
public static void SetGaCommonInfo(String SetGaCommonInfo)
|
||||
{
|
||||
// Log.e(TAG,"SetGaCommonInfo : " + SetGaCommonInfo);
|
||||
// SDKLog.i("SetGaCommonInfo : " + SetGaCommonInfo);
|
||||
// Gson gson = new Gson();
|
||||
// Map<String, Object> map = gson.fromJson(SetGaCommonInfo, new TypeToken<Map<String, Object>>(){}.getType());
|
||||
// for (String key : map.keySet()) {
|
||||
// System.out.println("Key = " + key + ", Value = " + map.get(key));
|
||||
// if(!TextUtils.isEmpty(key) && map.get(key) != null){
|
||||
// GetGameGa().addCommonParameter(key, map.get(key).toString());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public static void GAReportParams(int type, String eventstr, String paramstr)
|
||||
{
|
||||
// Log.e(TAG,"GAReportParams : " + type + " \n" + eventstr + " \n" + paramstr);
|
||||
//
|
||||
// SDKLog.i("GAReportParams : " + type + " \n" + eventstr + " \n" + paramstr);
|
||||
// ParamsBuilder paramsBuilder = ParamsBuilder.newInstance();
|
||||
// Gson gson = new Gson();
|
||||
// Map<String, Object> map = gson.fromJson(paramstr, new TypeToken<Map<String, Object>>(){}.getType());
|
||||
// for (String key : map.keySet()) {
|
||||
// System.out.println("Key = " + key + ", Value = " + map.get(key));
|
||||
// if(!TextUtils.isEmpty(key) && map.get(key) != null){
|
||||
// paramsBuilder.append(key, map.get(key).toString());
|
||||
// }
|
||||
// }
|
||||
// GetGameGa().track(EventType.TRACK, eventstr, paramsBuilder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 876959024d9e251429915310f08e77fa
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
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:
|
||||
22
sdk-intergration/Packages/tysdk/Plugins/Android/TYApp.java
Normal file
22
sdk-intergration/Packages/tysdk/Plugins/Android/TYApp.java
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
package com.unity3d.player;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import com.tuyoo.gamesdk.api.SDKAPI;
|
||||
|
||||
public class TYApp extends Application {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
SDKAPI.getIns().onApplicationCreate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
SDKAPI.getIns().onAttachBaseContext(base, this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a1ea679ceb0eb1408aea268c324d5ee
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
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:
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.unity3d.player;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.tuyoo.gamesdk.api.SDKAPI;
|
||||
|
||||
public class TYUnityActivity extends UnityPlayerActivity
|
||||
{
|
||||
private static boolean sdkInited = false;
|
||||
|
||||
public static void setSdkInited() {
|
||||
sdkInited = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
if(sdkInited)
|
||||
{
|
||||
SDKAPI.getIns().onActivityStart(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
if(sdkInited)
|
||||
{
|
||||
SDKAPI.getIns().onNewIntent(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
if(sdkInited)
|
||||
{
|
||||
SDKAPI.getIns().onActivityRestart(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if(sdkInited)
|
||||
{
|
||||
SDKAPI.getIns().onActivityResume(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if(sdkInited)
|
||||
{
|
||||
SDKAPI.getIns().onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if(sdkInited)
|
||||
{
|
||||
SDKAPI.getIns().onActivityPause(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if(sdkInited)
|
||||
{
|
||||
SDKAPI.getIns().onActivityStop(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(sdkInited)
|
||||
{
|
||||
SDKAPI.getIns().onActivityDestroy(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a7f18d54c9627847a164308babb45d1
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
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:
|
||||
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f428771db6e5c94290a685844f7b531
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
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,4 +1,5 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace tysdk
|
||||
{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"name": "tysdk",
|
||||
"rootNamespace": "tysdk",
|
||||
"references": [],
|
||||
"references": [
|
||||
"GUID:a4cfc1a18fa3a469b96d885db522f42e"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"MonoBehaviour": {
|
||||
"Version": 4,
|
||||
"EnableBurstCompilation": true,
|
||||
"EnableOptimisations": true,
|
||||
"EnableSafetyChecks": false,
|
||||
"EnableDebugInAllBuilds": false,
|
||||
"DebugDataKind": 1,
|
||||
"EnableArmv9SecurityFeatures": false,
|
||||
"CpuMinTargetX32": 0,
|
||||
"CpuMaxTargetX32": 0,
|
||||
"CpuMinTargetX64": 0,
|
||||
"CpuMaxTargetX64": 0,
|
||||
"CpuTargetsArm64": 512,
|
||||
"OptimizeFor": 0
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ PlayerSettings:
|
||||
androidSupportedAspectRatio: 1
|
||||
androidMaxAspectRatio: 2.1
|
||||
applicationIdentifier:
|
||||
Android: com.UnityTechnologies.com.unity.template.urpblank
|
||||
Android: com.arkgame.ft
|
||||
Standalone: com.Unity-Technologies.com.unity.template.urp-blank
|
||||
iPhone: com.arkgame.ft
|
||||
buildNumber:
|
||||
@@ -249,20 +249,20 @@ PlayerSettings:
|
||||
clonedFromGUID: 3c72c65a16f0acb438eed22b8b16c24a
|
||||
templatePackageId: com.unity.template.urp-blank@14.0.0
|
||||
templateDefaultScene: Assets/Scenes/SampleScene.unity
|
||||
useCustomMainManifest: 0
|
||||
useCustomMainManifest: 1
|
||||
useCustomLauncherManifest: 0
|
||||
useCustomMainGradleTemplate: 0
|
||||
useCustomMainGradleTemplate: 1
|
||||
useCustomLauncherGradleManifest: 0
|
||||
useCustomBaseGradleTemplate: 0
|
||||
useCustomGradlePropertiesTemplate: 0
|
||||
useCustomGradlePropertiesTemplate: 1
|
||||
useCustomGradleSettingsTemplate: 0
|
||||
useCustomProguardFile: 0
|
||||
AndroidTargetArchitectures: 1
|
||||
AndroidTargetArchitectures: 3
|
||||
AndroidTargetDevices: 0
|
||||
AndroidSplashScreenScale: 0
|
||||
androidSplashScreen: {fileID: 0}
|
||||
AndroidKeystoreName:
|
||||
AndroidKeyaliasName:
|
||||
AndroidKeystoreName: '{inproject}: keystore/bamboogame.keystore'
|
||||
AndroidKeyaliasName: fishing
|
||||
AndroidEnableArmv9SecurityFeatures: 0
|
||||
AndroidBuildApkPerCpuArchitecture: 0
|
||||
AndroidTVCompatibility: 0
|
||||
@@ -270,7 +270,7 @@ PlayerSettings:
|
||||
AndroidEnableTango: 0
|
||||
androidEnableBanner: 1
|
||||
androidUseLowAccuracyLocation: 0
|
||||
androidUseCustomKeystore: 0
|
||||
androidUseCustomKeystore: 1
|
||||
m_AndroidBanners:
|
||||
- width: 320
|
||||
height: 180
|
||||
@@ -802,10 +802,12 @@ PlayerSettings:
|
||||
webGLMemoryGeometricGrowthStep: 0.2
|
||||
webGLMemoryGeometricGrowthCap: 96
|
||||
webGLPowerPreference: 2
|
||||
scriptingDefineSymbols: {}
|
||||
scriptingDefineSymbols:
|
||||
Android: UNITY_POST_PROCESSING_STACK_V2;CREST_OCEAN;AGG
|
||||
additionalCompilerArguments: {}
|
||||
platformArchitecture: {}
|
||||
scriptingBackend: {}
|
||||
scriptingBackend:
|
||||
Android: 1
|
||||
il2cppCompilerConfiguration: {}
|
||||
il2cppCodeGeneration: {}
|
||||
managedStrippingLevel:
|
||||
@@ -825,7 +827,7 @@ PlayerSettings:
|
||||
tvOS: 1
|
||||
incrementalIl2cppBuild: {}
|
||||
suppressCommonWarnings: 1
|
||||
allowUnsafeCode: 0
|
||||
allowUnsafeCode: 1
|
||||
useDeterministicCompilation: 1
|
||||
additionalIl2CppArgs:
|
||||
scriptingRuntimeVersion: 1
|
||||
@@ -907,7 +909,7 @@ PlayerSettings:
|
||||
embeddedLinuxEnableGamepadInput: 1
|
||||
hmiLogStartupTiming: 0
|
||||
hmiCpuConfiguration:
|
||||
apiCompatibilityLevel: 6
|
||||
apiCompatibilityLevel: 3
|
||||
activeInputHandler: 0
|
||||
windowsGamepadBackendHint: 0
|
||||
cloudProjectId:
|
||||
|
||||
BIN
sdk-intergration/keystore/bamboogame.keystore
Normal file
BIN
sdk-intergration/keystore/bamboogame.keystore
Normal file
Binary file not shown.
Reference in New Issue
Block a user