diff --git a/sdk-intergration/.idea/.idea.sdk-intergration/.idea/.gitignore b/sdk-intergration/.idea/.idea.sdk-intergration/.idea/.gitignore new file mode 100644 index 0000000..73e002a --- /dev/null +++ b/sdk-intergration/.idea/.idea.sdk-intergration/.idea/.gitignore @@ -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/ diff --git a/sdk-intergration/.idea/.idea.sdk-intergration/.idea/encodings.xml b/sdk-intergration/.idea/.idea.sdk-intergration/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/sdk-intergration/.idea/.idea.sdk-intergration/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/sdk-intergration/.idea/.idea.sdk-intergration/.idea/indexLayout.xml b/sdk-intergration/.idea/.idea.sdk-intergration/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/sdk-intergration/.idea/.idea.sdk-intergration/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/sdk-intergration/.idea/.idea.sdk-intergration/.idea/vcs.xml b/sdk-intergration/.idea/.idea.sdk-intergration/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/sdk-intergration/.idea/.idea.sdk-intergration/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/sdk-intergration/Assets/Plugins.meta b/sdk-intergration/Assets/Plugins.meta new file mode 100644 index 0000000..bc3d2ff --- /dev/null +++ b/sdk-intergration/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: de38137d567d12045bbe1372bc888de6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdk-intergration/Assets/Plugins/Android.meta b/sdk-intergration/Assets/Plugins/Android.meta new file mode 100644 index 0000000..35362c4 --- /dev/null +++ b/sdk-intergration/Assets/Plugins/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3fdee26ffb417244da1c9778ddaf7e90 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml b/sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml new file mode 100644 index 0000000..10a1048 --- /dev/null +++ b/sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml.meta b/sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml.meta new file mode 100644 index 0000000..544dbed --- /dev/null +++ b/sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 339beab439a427b4b9e96b2accf2e146 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdk-intergration/Assets/Plugins/Android/gradleTemplate.properties b/sdk-intergration/Assets/Plugins/Android/gradleTemplate.properties new file mode 100644 index 0000000..e8f66b5 --- /dev/null +++ b/sdk-intergration/Assets/Plugins/Android/gradleTemplate.properties @@ -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 diff --git a/sdk-intergration/Assets/Plugins/Android/gradleTemplate.properties.meta b/sdk-intergration/Assets/Plugins/Android/gradleTemplate.properties.meta new file mode 100644 index 0000000..8d18021 --- /dev/null +++ b/sdk-intergration/Assets/Plugins/Android/gradleTemplate.properties.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 86d31d9e59f392d4b8538e7dcf812ec3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle b/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle new file mode 100644 index 0000000..863fd67 --- /dev/null +++ b/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle @@ -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** diff --git a/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle.meta b/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle.meta new file mode 100644 index 0000000..4dd0559 --- /dev/null +++ b/sdk-intergration/Assets/Plugins/Android/mainTemplate.gradle.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: edc76530d8406f74787197e56949feb3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdk-intergration/Assets/Plugins/Android/settingsTemplate.gradle b/sdk-intergration/Assets/Plugins/Android/settingsTemplate.gradle new file mode 100644 index 0000000..25391fb --- /dev/null +++ b/sdk-intergration/Assets/Plugins/Android/settingsTemplate.gradle @@ -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 + } + } +} diff --git a/sdk-intergration/Assets/Plugins/Android/settingsTemplate.gradle.meta b/sdk-intergration/Assets/Plugins/Android/settingsTemplate.gradle.meta new file mode 100644 index 0000000..458d615 --- /dev/null +++ b/sdk-intergration/Assets/Plugins/Android/settingsTemplate.gradle.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d2f880703e7cd08469817aea47e80830 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/ConfigManager.java b/sdk-intergration/Packages/tysdk/Plugins/Android/ConfigManager.java new file mode 100644 index 0000000..0b3e05e --- /dev/null +++ b/sdk-intergration/Packages/tysdk/Plugins/Android/ConfigManager.java @@ -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"; + +} diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/ConfigManager.java.meta b/sdk-intergration/Packages/tysdk/Plugins/Android/ConfigManager.java.meta new file mode 100644 index 0000000..2235402 --- /dev/null +++ b/sdk-intergration/Packages/tysdk/Plugins/Android/ConfigManager.java.meta @@ -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: diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java b/sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java new file mode 100644 index 0000000..bcf2844 --- /dev/null +++ b/sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java @@ -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 extraInfo = new HashMap(); + 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 map = new HashMap(); + // 此字段(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 map = gson.fromJson(SetGaCommonInfo, new TypeToken>(){}.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 map = gson.fromJson(paramstr, new TypeToken>(){}.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); + } + +} + + diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java.meta b/sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java.meta new file mode 100644 index 0000000..ae90c5f --- /dev/null +++ b/sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java.meta @@ -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: diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/TYApp.java b/sdk-intergration/Packages/tysdk/Plugins/Android/TYApp.java new file mode 100644 index 0000000..979c7e7 --- /dev/null +++ b/sdk-intergration/Packages/tysdk/Plugins/Android/TYApp.java @@ -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); + } +} diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/TYApp.java.meta b/sdk-intergration/Packages/tysdk/Plugins/Android/TYApp.java.meta new file mode 100644 index 0000000..1e7530a --- /dev/null +++ b/sdk-intergration/Packages/tysdk/Plugins/Android/TYApp.java.meta @@ -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: diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/TYUnityActivity.java b/sdk-intergration/Packages/tysdk/Plugins/Android/TYUnityActivity.java new file mode 100644 index 0000000..8a5d97b --- /dev/null +++ b/sdk-intergration/Packages/tysdk/Plugins/Android/TYUnityActivity.java @@ -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); + } + } +} diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/TYUnityActivity.java.meta b/sdk-intergration/Packages/tysdk/Plugins/Android/TYUnityActivity.java.meta new file mode 100644 index 0000000..4170046 --- /dev/null +++ b/sdk-intergration/Packages/tysdk/Plugins/Android/TYUnityActivity.java.meta @@ -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: diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/tuyoosdk_1.0.0.aar b/sdk-intergration/Packages/tysdk/Plugins/Android/tuyoosdk_1.0.0.aar new file mode 100644 index 0000000..f45174f Binary files /dev/null and b/sdk-intergration/Packages/tysdk/Plugins/Android/tuyoosdk_1.0.0.aar differ diff --git a/sdk-intergration/Packages/tysdk/Plugins/Android/tuyoosdk_1.0.0.aar.meta b/sdk-intergration/Packages/tysdk/Plugins/Android/tuyoosdk_1.0.0.aar.meta new file mode 100644 index 0000000..836828e --- /dev/null +++ b/sdk-intergration/Packages/tysdk/Plugins/Android/tuyoosdk_1.0.0.aar.meta @@ -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: diff --git a/sdk-intergration/Packages/tysdk/Runtime/UnityBridgeFunc.cs b/sdk-intergration/Packages/tysdk/Runtime/UnityBridgeFunc.cs index f5d3e1a..aebb40a 100644 --- a/sdk-intergration/Packages/tysdk/Runtime/UnityBridgeFunc.cs +++ b/sdk-intergration/Packages/tysdk/Runtime/UnityBridgeFunc.cs @@ -1,4 +1,5 @@ using System.Runtime.InteropServices; +using UnityEngine; namespace tysdk { diff --git a/sdk-intergration/Packages/tysdk/Runtime/tysdk.asmdef b/sdk-intergration/Packages/tysdk/Runtime/tysdk.asmdef index 96408a6..5b2d559 100644 --- a/sdk-intergration/Packages/tysdk/Runtime/tysdk.asmdef +++ b/sdk-intergration/Packages/tysdk/Runtime/tysdk.asmdef @@ -1,7 +1,9 @@ { "name": "tysdk", "rootNamespace": "tysdk", - "references": [], + "references": [ + "GUID:a4cfc1a18fa3a469b96d885db522f42e" + ], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, diff --git a/sdk-intergration/ProjectSettings/BurstAotSettings_Android.json b/sdk-intergration/ProjectSettings/BurstAotSettings_Android.json new file mode 100644 index 0000000..ce2d8aa --- /dev/null +++ b/sdk-intergration/ProjectSettings/BurstAotSettings_Android.json @@ -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 + } +} diff --git a/sdk-intergration/ProjectSettings/ProjectSettings.asset b/sdk-intergration/ProjectSettings/ProjectSettings.asset index 809aa4e..64a66c1 100644 --- a/sdk-intergration/ProjectSettings/ProjectSettings.asset +++ b/sdk-intergration/ProjectSettings/ProjectSettings.asset @@ -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: diff --git a/sdk-intergration/keystore/bamboogame.keystore b/sdk-intergration/keystore/bamboogame.keystore new file mode 100644 index 0000000..8bfe59b Binary files /dev/null and b/sdk-intergration/keystore/bamboogame.keystore differ