commit 1feb0fbd3d875522002a9efe631f954c5c0495d6 Author: wsycarlos Date: Sat Dec 6 10:50:57 2025 +0800 First Version of Tuyoo SDK Package diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff03d40 --- /dev/null +++ b/.gitignore @@ -0,0 +1,106 @@ +# This .gitignore file should be placed at the root of your Unity project directory +# +# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore +# +.utmp/ +/[Ll]ibrary/ +/[Tt]emp/ +/[Oo]bj/ +/[Bb]uild/ +/[Bb]uilds/ +/[Ll]ogs/ +/[Uu]ser[Ss]ettings/ +*.log + +# By default unity supports Blender asset imports, *.blend1 blender files do not need to be commited to version control. +*.blend1 +*.blend1.meta + +# MemoryCaptures can get excessive in size. +# They also could contain extremely sensitive data +/[Mm]emoryCaptures/ + +# Recordings can get excessive in size +/[Rr]ecordings/ + +# Uncomment this line if you wish to ignore the asset store tools plugin +# /[Aa]ssets/AssetStoreTools* + +# Autogenerated Jetbrains Rider plugin +/[Aa]ssets/Plugins/Editor/JetBrains* +# Jetbrains Rider personal-layer settings +*.DotSettings.user + +# Visual Studio cache directory +.vs/ + +# Gradle cache directory +.gradle/ + +# Autogenerated VS/MD/Consulo solution and project files +ExportedObj/ +.consulo/ +*.csproj +*.unityproj +*.sln +*.suo +*.tmp +*.user +*.userprefs +*.pidb +*.booproj +*.svd +*.pdb +*.mdb +*.opendb +*.VC.db + +# Unity3D generated meta files +*.pidb.meta +*.pdb.meta +*.mdb.meta + +# Unity3D generated file on crash reports +sysinfo.txt + +# Mono auto generated files +mono_crash.* + +# Builds +*.apk +*.aab +*.unitypackage +*.unitypackage.meta + +# Crashlytics generated file +crashlytics-build.properties + +# TestRunner generated files +InitTestScene*.unity* + +# Addressables default ignores, before user customizations +/ServerData +/[Aa]ssets/StreamingAssets/aa* +/[Aa]ssets/AddressableAssetsData/link.xml* +/[Aa]ssets/Addressables_Temp* +# By default, Addressables content builds will generate addressables_content_state.bin +# files in platform-specific subfolders, for example: +# /Assets/AddressableAssetsData/OSX/addressables_content_state.bin +/[Aa]ssets/AddressableAssetsData/*/*.bin* + +# Visual Scripting auto-generated files +/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db +/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db.meta +/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers +/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers.meta + +# Auto-generated scenes by play mode tests +/[Aa]ssets/[Ii]nit[Tt]est[Ss]cene*.unity* + +.vsconfig + +Logs/ +[Aa]ssets/ +[Pp]ublish/ +.vscode/settings.json +*.dat \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor.meta b/Packages/com.bywaystudios.tuyoosdk/Editor.meta new file mode 100644 index 0000000..f820cfd --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c8e031ae3a7e0e4d8856244a1c6a5e4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android.meta new file mode 100644 index 0000000..ccf712e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1d566609b714d40508c148b67774735c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/growsdk-gasdk/2.4.24_0711-RELEASE/growsdk-gasdk-2.4.24_0711-RELEASE.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/growsdk-gasdk/2.4.24_0711-RELEASE/growsdk-gasdk-2.4.24_0711-RELEASE.aar new file mode 100644 index 0000000..0947cdb Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/growsdk-gasdk/2.4.24_0711-RELEASE/growsdk-gasdk-2.4.24_0711-RELEASE.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/growsdk-gasdk/2.4.24_0711-RELEASE/growsdk-gasdk-2.4.24_0711-RELEASE.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/growsdk-gasdk/2.4.24_0711-RELEASE/growsdk-gasdk-2.4.24_0711-RELEASE.pom new file mode 100644 index 0000000..53edded --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/growsdk-gasdk/2.4.24_0711-RELEASE/growsdk-gasdk-2.4.24_0711-RELEASE.pom @@ -0,0 +1,14 @@ + + + + + + + + 4.0.0 + com.tuyoo.component + growsdk-gasdk + 2.4.24_0711-RELEASE + aar + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-common/0.2.0/framework-common-0.2.0.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-common/0.2.0/framework-common-0.2.0.aar new file mode 100644 index 0000000..68f67d1 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-common/0.2.0/framework-common-0.2.0.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-common/0.2.0/framework-common-0.2.0.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-common/0.2.0/framework-common-0.2.0.pom new file mode 100644 index 0000000..142bd3e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-common/0.2.0/framework-common-0.2.0.pom @@ -0,0 +1,64 @@ + + + 4.0.0 + com.tuyoo.component.login + framework-common + 0.2.0 + aar + + + com.google.code.gson + gson + 2.8.6 + implementation + + + com.squareup.okio + okio + 1.15.0 + implementation + + + com.squareup.okhttp3 + okhttp + 3.12.13 + implementation + + + com.squareup.retrofit2 + retrofit + 2.3.0 + implementation + + + com.squareup.retrofit2 + converter-gson + 2.2.0 + implementation + + + com.squareup.retrofit2 + adapter-rxjava + 2.1.0 + implementation + + + io.reactivex + rxandroid + 1.2.1 + implementation + + + io.reactivex + rxjava + 1.1.9 + implementation + + + com.tuyoo.component + growsdk-gasdk + 2.4.24_0711-RELEASE + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-oversea/0.2.0/framework-oversea-0.2.0.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-oversea/0.2.0/framework-oversea-0.2.0.aar new file mode 100644 index 0000000..49b7f25 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-oversea/0.2.0/framework-oversea-0.2.0.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-oversea/0.2.0/framework-oversea-0.2.0.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-oversea/0.2.0/framework-oversea-0.2.0.pom new file mode 100644 index 0000000..fcbc6ba --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/framework-oversea/0.2.0/framework-oversea-0.2.0.pom @@ -0,0 +1,16 @@ + + + 4.0.0 + com.tuyoo.component.login + framework-oversea + 0.2.0 + aar + + + com.tuyoo.component.login + framework-common + 0.2.0 + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/appsflyer/0.2.0/appsflyer-0.2.0.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/appsflyer/0.2.0/appsflyer-0.2.0.aar new file mode 100644 index 0000000..d4b1c5b Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/appsflyer/0.2.0/appsflyer-0.2.0.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/appsflyer/0.2.0/appsflyer-0.2.0.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/appsflyer/0.2.0/appsflyer-0.2.0.pom new file mode 100644 index 0000000..63f1d8d --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/appsflyer/0.2.0/appsflyer-0.2.0.pom @@ -0,0 +1,34 @@ + + + 4.0.0 + com.tuyoo.component.login.third + appsflyer + 0.2.0 + aar + + + 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 + + + androidx.core + core + 1.3.0 + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwFacebook/0.2.0/hwFacebook-0.2.0.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwFacebook/0.2.0/hwFacebook-0.2.0.aar new file mode 100644 index 0000000..43e92ae Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwFacebook/0.2.0/hwFacebook-0.2.0.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwFacebook/0.2.0/hwFacebook-0.2.0.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwFacebook/0.2.0/hwFacebook-0.2.0.pom new file mode 100644 index 0000000..08eccf6 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwFacebook/0.2.0/hwFacebook-0.2.0.pom @@ -0,0 +1,22 @@ + + + 4.0.0 + com.tuyoo.component.login.third + hwFacebook + 0.2.0 + aar + + + com.tuyoo.component.login + framework-oversea + 0.2.0 + implementation + + + com.facebook.android + facebook-android-sdk + 16.2.0 + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGoogle/0.2.0/hwGoogle-0.2.0.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGoogle/0.2.0/hwGoogle-0.2.0.aar new file mode 100644 index 0000000..4f35711 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGoogle/0.2.0/hwGoogle-0.2.0.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGoogle/0.2.0/hwGoogle-0.2.0.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGoogle/0.2.0/hwGoogle-0.2.0.pom new file mode 100644 index 0000000..b63f073 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGoogle/0.2.0/hwGoogle-0.2.0.pom @@ -0,0 +1,40 @@ + + + 4.0.0 + com.tuyoo.component.login.third + hwGoogle + 0.2.0 + aar + + + com.tuyoo.component.login + framework-oversea + 0.2.0 + implementation + + + androidx.credentials + credentials + 1.5.0 + implementation + + + androidx.credentials + credentials-play-services-auth + 1.5.0 + implementation + + + com.google.android.libraries.identity.googleid + googleid + 1.1.1 + implementation + + + com.google.android.gms + play-services-auth + 21.4.0 + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGooglePlay/0.2.0/hwGooglePlay-0.2.0.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGooglePlay/0.2.0/hwGooglePlay-0.2.0.aar new file mode 100644 index 0000000..6562ee7 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGooglePlay/0.2.0/hwGooglePlay-0.2.0.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGooglePlay/0.2.0/hwGooglePlay-0.2.0.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGooglePlay/0.2.0/hwGooglePlay-0.2.0.pom new file mode 100644 index 0000000..f42b2e8 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGooglePlay/0.2.0/hwGooglePlay-0.2.0.pom @@ -0,0 +1,28 @@ + + + 4.0.0 + com.tuyoo.component.login.third + hwGooglePlay + 0.2.0 + aar + + + com.tuyoo.component.login + framework-oversea + 0.2.0 + implementation + + + com.tuyoo.component.login + framework-common + 0.2.0 + implementation + + + com.android.billingclient + billing + 7.1.1 + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGuest/0.2.0/hwGuest-0.2.0.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGuest/0.2.0/hwGuest-0.2.0.aar new file mode 100644 index 0000000..78cf254 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGuest/0.2.0/hwGuest-0.2.0.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGuest/0.2.0/hwGuest-0.2.0.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGuest/0.2.0/hwGuest-0.2.0.pom new file mode 100644 index 0000000..dbc1c1b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/login/third/hwGuest/0.2.0/hwGuest-0.2.0.pom @@ -0,0 +1,16 @@ + + + 4.0.0 + com.tuyoo.component.login.third + hwGuest + 0.2.0 + aar + + + com.tuyoo.component.login + framework-oversea + 0.2.0 + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer/0.6.1/sdk_inter_layer-0.6.1.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer/0.6.1/sdk_inter_layer-0.6.1.aar new file mode 100644 index 0000000..e5d78f1 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer/0.6.1/sdk_inter_layer-0.6.1.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer/0.6.1/sdk_inter_layer-0.6.1.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer/0.6.1/sdk_inter_layer-0.6.1.pom new file mode 100644 index 0000000..202cea4 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer/0.6.1/sdk_inter_layer-0.6.1.pom @@ -0,0 +1,9 @@ + + + 4.0.0 + com.tuyoo.component + sdk_inter_layer + 0.6.1 + aar + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_ga/0.6.1/sdk_inter_layer_ga-0.6.1.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_ga/0.6.1/sdk_inter_layer_ga-0.6.1.aar new file mode 100644 index 0000000..230a22b Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_ga/0.6.1/sdk_inter_layer_ga-0.6.1.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_ga/0.6.1/sdk_inter_layer_ga-0.6.1.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_ga/0.6.1/sdk_inter_layer_ga-0.6.1.pom new file mode 100644 index 0000000..be7f782 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_ga/0.6.1/sdk_inter_layer_ga-0.6.1.pom @@ -0,0 +1,22 @@ + + + 4.0.0 + com.tuyoo.component + sdk_inter_layer_ga + 0.6.1 + aar + + + com.tuyoo.component + sdk_inter_layer + 0.6.1 + implementation + + + com.tuyoo.component + growsdk-gasdk + 2.4.23_0618-RELEASE + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_login/0.6.1/sdk_inter_layer_login-0.6.1.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_login/0.6.1/sdk_inter_layer_login-0.6.1.aar new file mode 100644 index 0000000..6c66d91 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_login/0.6.1/sdk_inter_layer_login-0.6.1.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_login/0.6.1/sdk_inter_layer_login-0.6.1.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_login/0.6.1/sdk_inter_layer_login-0.6.1.pom new file mode 100644 index 0000000..f32f7fa --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_login/0.6.1/sdk_inter_layer_login-0.6.1.pom @@ -0,0 +1,22 @@ + + + 4.0.0 + com.tuyoo.component + sdk_inter_layer_login + 0.6.1 + aar + + + com.tuyoo.component + sdk_inter_layer + 0.6.1 + implementation + + + com.tuyoo.component.login + framework-common + 0.2.0 + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_unity/0.4.7/sdk_inter_layer_unity-0.4.7.aar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_unity/0.4.7/sdk_inter_layer_unity-0.4.7.aar new file mode 100644 index 0000000..5cf83d8 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_unity/0.4.7/sdk_inter_layer_unity-0.4.7.aar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_unity/0.4.7/sdk_inter_layer_unity-0.4.7.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_unity/0.4.7/sdk_inter_layer_unity-0.4.7.pom new file mode 100644 index 0000000..2904825 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/component/sdk_inter_layer_unity/0.4.7/sdk_inter_layer_unity-0.4.7.pom @@ -0,0 +1,28 @@ + + + 4.0.0 + com.tuyoo.component + sdk_inter_layer_unity + 0.4.7 + aar + + + com.tuyoo.component + sdk_inter_layer + 0.6.1 + implementation + + + com.tuyoo.component + sdk_inter_layer_ga + 0.6.1 + implementation + + + com.google.code.gson + gson + 2.8.6 + implementation + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/sdk_plugin/com.tuyoo.sdk_plugin.gradle.plugin/1.7.5.2/com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.jar b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/sdk_plugin/com.tuyoo.sdk_plugin.gradle.plugin/1.7.5.2/com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.jar new file mode 100644 index 0000000..289aeff Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/sdk_plugin/com.tuyoo.sdk_plugin.gradle.plugin/1.7.5.2/com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.jar differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/sdk_plugin/com.tuyoo.sdk_plugin.gradle.plugin/1.7.5.2/com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.module b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/sdk_plugin/com.tuyoo.sdk_plugin.gradle.plugin/1.7.5.2/com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.module new file mode 100644 index 0000000..1133c59 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/sdk_plugin/com.tuyoo.sdk_plugin.gradle.plugin/1.7.5.2/com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.module @@ -0,0 +1,69 @@ +{ + "formatVersion": "1.1", + "component": { + "group": "com.tuyoo.sdk_plugin", + "module": "com.tuyoo.sdk_plugin.gradle.plugin", + "version": "1.7.5.2", + "attributes": { + "org.gradle.status": "release" + } + }, + "createdBy": { + "gradle": { + "version": "8.5" + } + }, + "variants": [ + { + "name": "apiElements", + "attributes": { + "org.gradle.category": "library", + "org.gradle.dependency.bundling": "external", + "org.gradle.jvm.version": 8, + "org.gradle.libraryelements": "jar", + "org.gradle.usage": "java-api" + }, + "files": [ + { + "name": "com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.jar", + "url": "com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.jar", + "size": 359887, + "sha512": "b116df2f58b39cc7716238591bd0f7cd1cdfe2687b295917ae3332fbc8e5803b4252b7208bcbd65ec18fde2a1eff0f030f7265461c2c71cd7458ea82e081ca3e", + "sha256": "915293c3374fde81aecc6d63a88c986e0cc72e2263e38142f872dd69920f4504", + "sha1": "699288cce58dc3b79981eab728163af63ae73448", + "md5": "4683dece9f7fcbe1fd4ac02c984708d5" + } + ] + }, + { + "name": "runtimeElements", + "attributes": { + "org.gradle.category": "library", + "org.gradle.dependency.bundling": "external", + "org.gradle.jvm.version": 8, + "org.gradle.libraryelements": "jar", + "org.gradle.usage": "java-runtime" + }, + "dependencies": [ + { + "group": "com.google.code.gson", + "module": "gson", + "version": { + "requires": "2.8.9" + } + } + ], + "files": [ + { + "name": "com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.jar", + "url": "com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.jar", + "size": 359887, + "sha512": "b116df2f58b39cc7716238591bd0f7cd1cdfe2687b295917ae3332fbc8e5803b4252b7208bcbd65ec18fde2a1eff0f030f7265461c2c71cd7458ea82e081ca3e", + "sha256": "915293c3374fde81aecc6d63a88c986e0cc72e2263e38142f872dd69920f4504", + "sha1": "699288cce58dc3b79981eab728163af63ae73448", + "md5": "4683dece9f7fcbe1fd4ac02c984708d5" + } + ] + } + ] +} diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/sdk_plugin/com.tuyoo.sdk_plugin.gradle.plugin/1.7.5.2/com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.pom b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/sdk_plugin/com.tuyoo.sdk_plugin.gradle.plugin/1.7.5.2/com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.pom new file mode 100644 index 0000000..a172af4 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/.m2/repository/com/tuyoo/sdk_plugin/com.tuyoo.sdk_plugin.gradle.plugin/1.7.5.2/com.tuyoo.sdk_plugin.gradle.plugin-1.7.5.2.pom @@ -0,0 +1,21 @@ + + + + + + + + 4.0.0 + com.tuyoo.sdk_plugin + com.tuyoo.sdk_plugin.gradle.plugin + 1.7.5.2 + + + com.google.code.gson + gson + 2.8.9 + runtime + + + diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor.cs b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor.cs new file mode 100644 index 0000000..380f0a4 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor.cs @@ -0,0 +1,77 @@ + +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using UnityEngine; + +class BuildGradleProcessor +{ + private string launcherBuildGradle; + private string unityLibraryBuildGradle; + private string rootBuildGradle; + private string rootProjectPath; + private string settings; + + public BuildGradleProcessor(string rootProjectPath) + { + this.rootProjectPath = rootProjectPath; + this.launcherBuildGradle = Path.Combine(rootProjectPath, "launcher/build.gradle"); + this.unityLibraryBuildGradle = Path.Combine(rootProjectPath, "unityLibrary/build.gradle"); + this.rootBuildGradle = Path.Combine(rootProjectPath, "build.gradle"); + this.settings = Path.Combine(rootProjectPath, "settings.gradle"); + Debug.Log("BuildGradleProcessor, rootProjectPath:" + rootProjectPath + "\n,launcherBuildGradle:" + + launcherBuildGradle + "\n,unityLibraryBuildGradle:" + unityLibraryBuildGradle + "\n,settings:" + settings); + } + + public static string GetAGPVersion(string rootBuildGradle) + { + if (!File.Exists(rootBuildGradle)) + { + Debug.LogError("build.gradle 文件不存在: " + rootBuildGradle); + return null; + } + + string buildGradleContent = File.ReadAllText(rootBuildGradle); + string agpVersion = null; + + // 尝试匹配 id 'com.android.application' version 'x.y.z' + Match idVersionMatch = Regex.Match(buildGradleContent, @"id\s+['""]com\.android\.application['""]\s+version\s+['""](\d+\.\d+\.\d+)['""]"); + if (idVersionMatch.Success) + { + agpVersion = idVersionMatch.Groups[1].Value; + Debug.Log("AGP Version from id version: " + agpVersion); + } + else + { + // 如果 id version 未匹配,尝试匹配 classpath 'com.android.tools.build:gradle:x.y.z' + Match classpathMatch = Regex.Match(buildGradleContent, @"classpath\s+['""]com\.android\.tools\.build:gradle:(\d+\.\d+\.\d+)['""]"); + if (classpathMatch.Success) + { + agpVersion = classpathMatch.Groups[1].Value; + Debug.Log("AGP Version from classpath: " + agpVersion); + } + } + if (agpVersion == null) + { + Debug.LogError("AGP Version not found in build.gradle"); + } + + return agpVersion; + } + + public void process() + { + + string agpVersion = GetAGPVersion(rootBuildGradle); + Debug.Log("process, agpVersion:" + agpVersion); + + if (agpVersion.StartsWith("7.") || agpVersion.StartsWith("8.")) + { + (new BuildGradleProcessor7x(rootProjectPath)).process(); + } + else + { + (new BuildGradleProcessor4x(rootProjectPath)).process(); + } + } +} diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor.cs.meta new file mode 100644 index 0000000..e1dad96 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: feb747b7ceeb74a1393d78b94baccd48 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor4x.cs b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor4x.cs new file mode 100644 index 0000000..fe1dfac --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor4x.cs @@ -0,0 +1,155 @@ + +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using UnityEngine; + +class BuildGradleProcessor4x +{ + private string launcherBuildGradle; + private string unityLibraryBuildGradle; + private string rootBuildGradle; + + public BuildGradleProcessor4x(string rootProjectPath) + { + this.launcherBuildGradle = Path.Combine(rootProjectPath, "launcher/build.gradle"); + this.unityLibraryBuildGradle = Path.Combine(rootProjectPath, "unityLibrary/build.gradle"); + this.rootBuildGradle = Path.Combine(rootProjectPath, "build.gradle"); + Debug.Log("BuildGradleProcessor, rootProjectPath:" + rootProjectPath + "\n,launcherBuildGradle:" + + launcherBuildGradle + "\n,unityLibraryBuildGradle:" + unityLibraryBuildGradle); + } + + public void process() + { + Debug.Log("BuildGradleProcessor4x, process start...."); + //1. 添加maven仓库 + processMaven(); + + //3. 添加插件 ,apply + classpath + json文件 + 打包设置 + processPlugin(); + Debug.Log("BuildGradleProcessor4x, process end...."); + } + + private void processMaven() + { + string buildGradleContent = File.ReadAllText(rootBuildGradle); + List pluginMaven = new List(); + buildGradleContent = insertMaven(pluginMaven, buildGradleContent); + pluginMaven.Add("http://sdkck.tuyoo.com/artifactory/tuyoo-component/"); + pluginMaven.Add("https://jcenter.bintray.com/"); + // pluginMaven.Add("http://sdkck.tuyoo.com/artifactory/tuyoo-component-test/"); + pluginMaven.Add("https://developer.huawei.com/repo/"); + buildGradleContent = insertMaven(pluginMaven, buildGradleContent); + + // 保存修改后的内容回文件 + File.WriteAllText(rootBuildGradle, buildGradleContent); + } + + private string insertMaven(List maven, string buildGradleContent) + { + if (maven == null) + { + return buildGradleContent; + } + // 添加自定义的 Maven 仓库 + foreach (string url in maven) + { + if (!buildGradleContent.Contains(url)) + { + string mavenRepository = buildMavenString(url); + Debug.Log("mavenRepository: " + mavenRepository); + + // 在 repositories 块中添加自定义仓库 + buildGradleContent = buildGradleContent.Replace("repositories {", $"repositories {{\n{mavenRepository}"); + } + } + + return buildGradleContent; + } + + string buildMavenString(string url) + { + string mavenString = ""; + mavenString += $@" + maven {{ + allowInsecureProtocol = true + url '{url}' + }}"; + return mavenString; + } + + + private void processPlugin() + { + //root build gradle 处理 + string rootBuildGradleContent = File.ReadAllText(rootBuildGradle); + if (!rootBuildGradleContent.Contains("com.tuyoo.sdk_plugin")) + { + rootBuildGradleContent = rootBuildGradleContent.Replace("dependencies {", @"dependencies { + classpath 'com.tuyoo.sdk_plugin:com.tuyoo.sdk_plugin.gradle.plugin:1.7.5.2'"); + File.WriteAllText(rootBuildGradle, rootBuildGradleContent); + } + + //launcher build gradle 处理 + string launcherBuildGradleContent = File.ReadAllText(launcherBuildGradle); + // 正则表达式:匹配 #START1 到 #END1 之间的所有内容(包括换行) + string pattern = @"//START1[\s\S]*?//END1"; + // string replaceMent = @"import groovy.json.JsonSlurper + // // File tyConfigFileDir = project.rootProject.file('config') + // // File tyConfigFile = new File(tyConfigFileDir,'build.json') + // // // 使用 JsonSlurper 解析 JSON + // // def jsonSlurper = new JsonSlurper() + // // def jsonObject = jsonSlurper.parseText(tyConfigFile.text) + // buildscript { + // repositories { + // google { + // content { + // includeGroupByRegex(""com\\.android.*"") + // includeGroupByRegex(""com\\.google.*"") + // includeGroupByRegex(""androidx.*"") + // } + // } + // mavenCentral() + // gradlePluginPortal() + + // // 配置HMS Core SDK的Maven仓地址。 + // maven { url 'https://developer.huawei.com/repo/' } + // } + // dependencies { + // // 增加Android Gradle插件版本号配置,{version}为实际的Gradle插件版本号,例如7.1.1。 + // // 增加AGC插件配置,请您参见AGC插件依赖关系选择合适的AGC插件版本。 + // classpath 'com.huawei.agconnect:agcp:1.9.0.300' + + // // 增加Android Gradle插件版本号配置,{version}为实际的Gradle插件版本号,例如7.1.1。 + // classpath 'com.android.tools.build:gradle:7.4.2' + // } + // } + // apply plugin: 'com.tuyoo.sdk_plugin'"; + string replaceMent = @" +apply plugin: 'com.tuyoo.sdk_plugin'"; + string insertContent = $"//START1\n{replaceMent}\n//END1"; + // 执行替换 + string tmp = Regex.Replace(launcherBuildGradleContent, pattern, insertContent); + if (tmp.Equals(launcherBuildGradleContent)) + { + if (!tmp.Contains("apply plugin: 'com.tuyoo.sdk_plugin'")) + { + launcherBuildGradleContent = launcherBuildGradleContent + "\n" + insertContent; + } + } + else + { + launcherBuildGradleContent = tmp; + } + File.WriteAllText(launcherBuildGradle, launcherBuildGradleContent); + + //unity build gradle 处理 + string unityBuildGradleContent = File.ReadAllText(unityLibraryBuildGradle); + if (!unityBuildGradleContent.Contains("apply plugin: 'com.tuyoo.sdk_plugin'")) + { + unityBuildGradleContent = unityBuildGradleContent + "\n" + "apply plugin: 'com.tuyoo.sdk_plugin'"; + File.WriteAllText(unityLibraryBuildGradle, unityBuildGradleContent); + } + } + +} diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor4x.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor4x.cs.meta new file mode 100644 index 0000000..d50ac28 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor4x.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9e0134cd3b6c846b1b6f23f3a516680f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor7x.cs b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor7x.cs new file mode 100644 index 0000000..c130f1b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor7x.cs @@ -0,0 +1,133 @@ + +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using UnityEditor; +using UnityEngine; + +class BuildGradleProcessor7x +{ + private string launcherBuildGradle; + private string unityLibraryBuildGradle; + private string rootBuildGradle; + private string settings; + + public BuildGradleProcessor7x(string rootProjectPath) + { + this.launcherBuildGradle = Path.Combine(rootProjectPath, "launcher/build.gradle"); + this.unityLibraryBuildGradle = Path.Combine(rootProjectPath, "unityLibrary/build.gradle"); + this.rootBuildGradle = Path.Combine(rootProjectPath, "build.gradle"); + this.settings = Path.Combine(rootProjectPath, "settings.gradle"); + Debug.Log("BuildGradleProcessor, rootProjectPath:" + rootProjectPath + "\n,launcherBuildGradle:" + + launcherBuildGradle + "\n,unityLibraryBuildGradle:" + unityLibraryBuildGradle + "\n,settings:" + settings); + } + + public void process() + { + //1. 添加maven仓库 + processMaven(); + + //3. 添加插件 ,apply + classpath + json文件 + 打包设置 + processPlugin(); + } + + private void processMaven() + { + string buildGradleContent = File.ReadAllText(settings); + List pluginMaven = new List(); + buildGradleContent = insertMaven(pluginMaven, buildGradleContent); + //pluginMaven.Add("http://sdkck.tuyoo.com/artifactory/tuyoo-component/"); + pluginMaven.Add("file:///" + FileUtil.GetPhysicalPath("Packages/com.bywaystudios.tuyoosdk/Editor/Android") + "/.m2/repository"); + pluginMaven.Add("https://jcenter.bintray.com/"); + // pluginMaven.Add("http://sdkck.tuyoo.com/artifactory/tuyoo-component-test/"); + pluginMaven.Add("https://developer.huawei.com/repo/"); + buildGradleContent = insertMaven(pluginMaven, buildGradleContent); + // 保存修改后的内容回文件 + File.WriteAllText(settings, buildGradleContent); + } + + private string insertMaven(List maven, string buildGradleContent) + { + if (maven == null) + { + return buildGradleContent; + } + // 添加自定义的 Maven 仓库 + foreach (string url in maven) + { + if (!buildGradleContent.Contains(url)) + { + string mavenRepository = buildMavenString(url); + Debug.Log("mavenRepository: " + mavenRepository); + + // 在 repositories 块中添加自定义仓库 + buildGradleContent = buildGradleContent.Replace("repositories {", $"repositories {{\n{mavenRepository}"); + } + } + + return buildGradleContent; + } + + string buildMavenString(string url) + { + string mavenString = ""; + mavenString += $@" + maven {{ + allowInsecureProtocol = true + url '{url}' + }}"; + return mavenString; + } + + + private void processPlugin() + { + string projectPluginVersion = "1.7.5.2"; + string firebasePluginVersion = "4.3.15"; // AGP 7.x 适合用4.3.15版本, AGP 8.x 适合用4.4.x版本 + string crashPluginVersion = "2.9.5"; //支持AGP8以下 + // string crashPluginVersion = "3.0.2"; //支持AGP8 + + //root build gradle 处理 + string rootBuildGradleContent = File.ReadAllText(rootBuildGradle); + if (!rootBuildGradleContent.Contains("com.tuyoo.sdk_plugin")) + { + + rootBuildGradleContent = rootBuildGradleContent.Replace("plugins {", @"plugins { + id 'com.tuyoo.sdk_plugin' version '" + projectPluginVersion + @"' apply false + id 'com.google.gms.google-services' version '" + firebasePluginVersion + @"' apply false; + id 'com.google.firebase.crashlytics' version '" + crashPluginVersion + @"' apply false"); + File.WriteAllText(rootBuildGradle, rootBuildGradleContent); + } + + //launcher build gradle 处理 + string launcherBuildGradleContent = File.ReadAllText(launcherBuildGradle); + // 正则表达式:匹配 #START1 到 #END1 之间的所有内容(包括换行) + string pattern = @"//START1[\s\S]*?//END1"; + string replaceMent = @" +apply plugin: 'com.tuyoo.sdk_plugin'"; + string insertContent = $"//START1\n{replaceMent}\n//END1"; + // 执行替换 + string tmp = Regex.Replace(launcherBuildGradleContent, pattern, insertContent); + if (tmp.Equals(launcherBuildGradleContent)) + { + if (!tmp.Contains("apply plugin: 'com.tuyoo.sdk_plugin'")) + { + launcherBuildGradleContent = launcherBuildGradleContent + "\n" + insertContent; + } + } + else + { + launcherBuildGradleContent = tmp; + } + File.WriteAllText(launcherBuildGradle, launcherBuildGradleContent); + + //unity build gradle 处理 + string unityBuildGradleContent = File.ReadAllText(unityLibraryBuildGradle); + if (!unityBuildGradleContent.Contains("apply plugin: 'com.tuyoo.sdk_plugin'")) + { + unityBuildGradleContent = unityBuildGradleContent + "\n" + "apply plugin: 'com.tuyoo.sdk_plugin'"; + File.WriteAllText(unityLibraryBuildGradle, unityBuildGradleContent); + } + } + +} diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor7x.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor7x.cs.meta new file mode 100644 index 0000000..0d479b9 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/BuildGradleProcessor7x.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e72cb856786c2404f988cc074d9f1734 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/TySdkProjectGenerator.cs b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/TySdkProjectGenerator.cs new file mode 100644 index 0000000..86b74e3 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/TySdkProjectGenerator.cs @@ -0,0 +1,257 @@ +using System.IO; +using System.Xml; +using System.Collections.Generic; +using UnityEditor; +using System.Text.RegularExpressions; +using System; + +#if UNITY_EDITOR && UNITY_ANDROID +using UnityEngine; +using UnityEditor.Android; + +class TySdkProjectGenerator : IPostGenerateGradleAndroidProject +{ + public int callbackOrder { get { return 0; } } + + public static string sdkInUnityRootPath; + public static string rootProjectPath; + public static string assetsRootPath; + + /** + * 要做的事情: + * 1. AndroidManifest修改 + 1. activity \ applciatoin 修改 + 2. 添加插件 + 仓库、声明、脚本 + 3. 拷贝json配置文件 + * + **/ + public void OnPostGenerateGradleAndroidProject(string path) + { + Debug.Log("TySdkProjectGenerator.OnPostGenerateGradleAndroidProject at path " + path); + rootProjectPath = Directory.GetParent(path).FullName; + + //获取Assets根目录 + assetsRootPath = Application.dataPath; + + //获取sdk在unity中的路径 + //var stackTrace = new System.Diagnostics.StackTrace(true); + //var frame = stackTrace.GetFrame(0); + //string filePath = frame.GetFileName(); + //sdkInUnityRootPath = Path.GetDirectoryName(filePath); + sdkInUnityRootPath = FileUtil.GetPhysicalPath("Packages/com.bywaystudios.tuyoosdk/Editor/Android"); + Debug.Log("TySdkProjectGenerator.OnPostGenerateGradleAndroidProject sdkInUnityRootPath " + sdkInUnityRootPath); + + //处理androidMnifest + ManifestProcessor manifestProcessor = new ManifestProcessor(Path.Combine(path, "src/main/AndroidManifest.xml")); + manifestProcessor.process(); + + //处理build.gradle + BuildGradleProcessor buildGradleProcessor = new BuildGradleProcessor(rootProjectPath); + buildGradleProcessor.process(); + + //拷贝json文件 + copyJsonFile(); + } + + private void copyJsonFile() + { + Debug.Log("TySdkProjectGenerator.copyJsonFile start"); + //package gameConfig -> root/config/.. + CopyFile(Path.Combine(FileUtil.GetPhysicalPath("ProjectSettings/Packages/com.bywaystudios.tuyoosdk"), "gameconfig.json"), Path.Combine(rootProjectPath, "config", "gameconfig.json")); + CopyFile(Path.Combine(FileUtil.GetPhysicalPath("ProjectSettings/Packages/com.bywaystudios.tuyoosdk"), "gameconfig.json"), Path.Combine(rootProjectPath, "launcher", "gameconfig.json")); + //gameConfigs/.. -> root/config/.. + CopyFiles(Path.Combine(sdkInUnityRootPath, "gameConfigs"), Path.Combine(rootProjectPath, "config")); + CopyFiles(Path.Combine(sdkInUnityRootPath, "gameConfigs"), Path.Combine(rootProjectPath, "launcher")); + //兼容firebase crashlytics + CopyFile(Path.Combine(FileUtil.GetPhysicalPath("ProjectSettings/Packages/com.bywaystudios.firebase"), "google-services.json"), Path.Combine(rootProjectPath, "launcher","google-services.json")); + Debug.Log("TySdkProjectGenerator.copyJsonFile end"); + } + + public static void CopyFile(string sourceFile, string destinationFile) + { + // 检查源文件是否存在 + if (!File.Exists(sourceFile)) + { + Console.WriteLine("源文件不存在: " + sourceFile); + return; + } + + // 创建目标文件夹(如果不存在) + string destinationFolder = Path.GetDirectoryName(destinationFile); + if (!Directory.Exists(destinationFolder)) + { + Directory.CreateDirectory(destinationFolder); + Console.WriteLine("目标文件夹已创建: " + destinationFolder); + } + + // 复制文件到目标路径 + File.Copy(sourceFile, destinationFile, true); // 允许覆盖 + Console.WriteLine("已复制文件: " + sourceFile + " 到 " + destinationFile); + } + + public static void CopyFiles(string sourceFolder, string destinationFolder) + { + // 检查源文件夹是否存在 + if (!Directory.Exists(sourceFolder)) + { + Console.WriteLine("源文件夹不存在: " + sourceFolder); + return; + } + + // 创建目标文件夹(如果不存在) + if (!Directory.Exists(destinationFolder)) + { + Directory.CreateDirectory(destinationFolder); + Console.WriteLine("目标文件夹已创建: " + destinationFolder); + } + + // 获取源文件夹中的所有文件 + string[] files = Directory.GetFiles(sourceFolder); + + // 复制每个文件到目标文件夹 + foreach (string file in files) + { + if (!file.EndsWith("json")) + { + continue; + } + string fileName = Path.GetFileName(file); // 获取文件名 + string destFile = Path.Combine(destinationFolder, fileName); // 组合目标文件路径 + File.Copy(file, destFile, true); // 复制文件,允许覆盖 + Console.WriteLine("已复制文件: " + file + " 到 " + destFile); + } + } + + + internal class ManifestProcessor + { + + private string manifestPath; + + public ManifestProcessor(string manifestPath) + { + Debug.Log("ManifestProcessor, manifestPath:" + manifestPath); + this.manifestPath = manifestPath; + } + + + // 1. 处理Applicatioin + // 2. 处理Activity + public void process() + { + Debug.Log("ManifestProcessor, process start."); + + if (!File.Exists(manifestPath)) + { + Debug.LogError("manifestPath not exit!! manifestPath:" + manifestPath); + return; + } + + // 加载AndroidManifest.xml文件 + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(manifestPath); + + // 定义 Android 命名空间 + string androidNamespaceURI = "http://schemas.android.com/apk/res/android"; + + // 获取节点 + XmlNode manifestNode = xmlDoc.SelectSingleNode("/manifest"); + if (manifestNode == null) + { + Debug.LogError("manifestNode is NULL!!"); + return; + } + + // 获取节点 + XmlNode applicationNode = manifestNode.SelectSingleNode("application"); + if (applicationNode == null) + { + Debug.LogError("applicationNode is NULL!!"); + return; + } + + // 设置name属性 + XmlAttribute nameAttribute = applicationNode.Attributes["android:name"]; + var applicationName = "android.app.Application"; + if (nameAttribute == null || nameAttribute.Value.Equals(applicationName)) + { + //默认application,修改成sdk的application + Debug.Log("修改成SDK的application"); + // 修改已有的name属性 + if(nameAttribute == null){ + nameAttribute = xmlDoc.CreateAttribute("android:name", androidNamespaceURI); + nameAttribute.Value = "com.tuyoo.sdk.Application"; + applicationNode.Attributes.Append(nameAttribute); + }else{ + nameAttribute.Value = "com.tuyoo.sdk.Application"; + } + } + else + { + //游戏自定义了application,不做处理了 + Debug.Log("游戏自定义了application,不做处理了,需要游戏自行处理sdk接口调用"); + } + + // 复制sdk的application到游戏中。 + var tuyooJavaDir = Path.Combine(rootProjectPath, "unityLibrary/src/main/java/com/tuyoo/sdk"); + if (!Directory.Exists(tuyooJavaDir)) + { + Directory.CreateDirectory(tuyooJavaDir); + Console.WriteLine("文件夹创建成功: " + tuyooJavaDir); + } + //设置sdk的application继承游戏的applicaiton + var sdkApplicationContent = File.ReadAllText(Path.Combine(sdkInUnityRootPath, "sdkConfigs", "Application.txt")); + sdkApplicationContent = sdkApplicationContent.Replace(@"${0}", applicationName); + File.WriteAllText(Path.Combine(tuyooJavaDir, "Application.java"), sdkApplicationContent); + + + // 创建命名空间管理器,并添加命名空间 + XmlNamespaceManager nsManager = new XmlNamespaceManager(xmlDoc.NameTable); + nsManager.AddNamespace("android", androidNamespaceURI); + + // 查找主Activity:包含节点 + XmlNode mainActivity = xmlDoc.SelectSingleNode("/manifest/application/activity[meta-data[@android:name='unityplayer.UnityActivity' and @android:value='true']]", nsManager); + + Debug.Log("mainActivity :" + mainActivity.Attributes["android:name"]); + // 找到主Activity,修改android:name属性 + XmlAttribute nameAttribute1 = mainActivity.Attributes["android:name"]; + var activityName = "com.unity3d.player.UnityPlayerActivity"; + if (nameAttribute1 == null || nameAttribute1.Value.Equals(activityName)) + { + Debug.Log("游戏使用的默认Activity,插件替换成SDK的Activity"); + if(nameAttribute1 == null){ + nameAttribute1 = xmlDoc.CreateAttribute("android", "name", androidNamespaceURI); + nameAttribute1.Value = "com.tuyoo.sdk.Activity"; + mainActivity.Attributes.Append(nameAttribute1); + }else{ + nameAttribute1.Value = "com.tuyoo.sdk.Activity"; + } + } + else + { + Debug.Log("游戏自定义了MainActivity,因此插件不做处理,由游戏自行调用SDK声明周期接口"); + } + + //将SDK的activity引入的游戏 + if (!Directory.Exists(tuyooJavaDir)) + { + Directory.CreateDirectory(tuyooJavaDir); + Console.WriteLine("文件夹创建成功: " + tuyooJavaDir); + } + //设置sdk的application继承游戏的applicaiton + var sdkActivityContent = File.ReadAllText(Path.Combine(sdkInUnityRootPath, "sdkConfigs", "Activity.txt")); + sdkActivityContent = sdkActivityContent.Replace(@"${0}", activityName); + File.WriteAllText(Path.Combine(tuyooJavaDir, "Activity.java"), sdkActivityContent); + + + // 保存修改后的AndroidManifest.xml文件 + xmlDoc.Save(manifestPath); + UnityEngine.Debug.Log("AndroidManifest.xml 已修改,设置 application name 为 com.tuyoo.sdk.Application."); + UnityEngine.Debug.Log("AndroidManifest.xml 已修改,设置主Activity为 com.tuyoo.sdk.Activity."); + } + } + +} + +#endif \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/TySdkProjectGenerator.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/TySdkProjectGenerator.cs.meta new file mode 100644 index 0000000..ecfe671 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/TySdkProjectGenerator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6237c5592c4b446e3ab1ed8570bf7920 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/gameConfigs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/gameConfigs.meta new file mode 100644 index 0000000..3c7c7d2 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/gameConfigs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 69cd8b9b58430450f859954bc7dd1082 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/gameConfigs/engine_dep.json b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/gameConfigs/engine_dep.json new file mode 100644 index 0000000..4adbb74 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/gameConfigs/engine_dep.json @@ -0,0 +1,8 @@ +{ + "engine_sdk": "com.tuyoo.component:sdk_inter_layer_unity:0.4.7", + "com.tuyoo.component:sdk_inter_layer_login": "com.tuyoo.component:sdk_inter_layer_login:0.6.1", + "com.tuyoo.component:sdk_inter_layer_survey": "com.tuyoo.component:sdk_inter_layer_survey:0.6.1", + "com.tuyoo.component:sdk_inter_layer_push": "com.tuyoo.component:sdk_inter_layer_survey:0.6.1", + "com.tuyoo.component.login.third:alipayweb": "com.tuyoo.component.login.third:alipayweb:0.2.0", + "com.tuyoo.component.login.third:quickLogin": "com.tuyoo.component.login.third:quickLogin:0.2.0" +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/gameConfigs/engine_dep.json.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/gameConfigs/engine_dep.json.meta new file mode 100644 index 0000000..2f71733 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/gameConfigs/engine_dep.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bda52be9838704740ab7e2dc94aa3c87 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs.meta new file mode 100644 index 0000000..82c1168 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4cd2e24681bc744368dcd5a6979a3e7a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Activity.txt b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Activity.txt new file mode 100644 index 0000000..8ae5432 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Activity.txt @@ -0,0 +1,57 @@ +package com.tuyoo.sdk; + +import android.content.Intent; +import android.os.Bundle; + +import com.tuyoo.sdk.sdk_inter_layer_unity.UnityInterface; + +public class Activity extends ${0} { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + UnityInterface.onActivityCreate(this); + } + + @Override + protected void onResume() { + super.onResume(); + UnityInterface.onActivityResume(this); + + } + + @Override + protected void onStart() { + super.onStart(); + UnityInterface.onActivityStart(this); + + } + + @Override + protected void onStop() { + super.onStop(); + UnityInterface.onActivityStop(this); + + } + + @Override + protected void onPause() { + super.onPause(); + UnityInterface.onActivityPause(this); + + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + UnityInterface.onResult(this, requestCode, resultCode, data); + } + + @Override + protected void onNewIntent(Intent intent) { + super.onNewIntent(intent); + UnityInterface.onNewIntent(this, intent); + } + +} diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Activity.txt.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Activity.txt.meta new file mode 100644 index 0000000..21d6289 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Activity.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a471b5ba113ff40d89068a6751b8f789 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Application.txt b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Application.txt new file mode 100644 index 0000000..805c7e1 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Application.txt @@ -0,0 +1,20 @@ +package com.tuyoo.sdk; + +import android.content.Context; + +import com.tuyoo.sdk.sdk_inter_layer_unity.UnityInterface; + +public class Application extends ${0} { + + @Override + public void onCreate() { + super.onCreate(); + UnityInterface.onApplicationCreate(this); + } + + @Override + protected void attachBaseContext(Context base) { + super.attachBaseContext(base); + UnityInterface.onAttachBaseContext(this, base); + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Application.txt.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Application.txt.meta new file mode 100644 index 0000000..cf7a629 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/Android/sdkConfigs/Application.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: eba7b7f816a5c4b90bc1ce1019b97ec2 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL.meta new file mode 100644 index 0000000..ce3370b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7082721ea27c14ebab76f86ef86f8b3b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPostProcessWeb.cs b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPostProcessWeb.cs new file mode 100644 index 0000000..7b8c0dd --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPostProcessWeb.cs @@ -0,0 +1,105 @@ +using UnityEditor; +using UnityEditor.Build; +using UnityEditor.Build.Reporting; +using System.IO; +using UnityEngine; + +public class TYPostProcessWeb : IPostprocessBuildWithReport +{ + public int callbackOrder => int.MaxValue; + private string buildPath; + + // 导出完成后调用的方法 + public void OnPostprocessBuild(BuildReport report) + { + string platform = report.summary.platform.ToString(); + if (platform == "WebGL" || platform == "MiniGame") + { + buildPath = report.summary.outputPath; + Debug.Log("channel compile buildPath: " + buildPath); + CopyTyResouceFile(); + } + } + + private void CopyTyResouceFile() + { + string destinationDir = string.Empty; + string sourceDir = string.Empty; + string channelType = TYPreProcessWeb.GetBuildChannelType(); + Debug.Log("TYPostProcessWeb channelType: " + channelType); + + if (channelType == TYWebBuildConfig.MiniGameChannelType.ALI) + { + // 阿里小游戏 + destinationDir = ProcessDestinationDir("alipay"); + if (!Directory.Exists(destinationDir)) + { + destinationDir = ProcessDestinationDir("alipaygame"); + } + sourceDir = ProcessSourceDir("aliminigame"); + } + + if (!string.IsNullOrEmpty(destinationDir) && !string.IsNullOrEmpty(sourceDir)) + { + Debug.Log("TYPostProcessWeb CopyTyResouceFile, sourceDir: " + sourceDir); + Debug.Log("TYPostProcessWeb CopyTyResouceFile, destinationDir: " + destinationDir); + CopyFilesToDirectory(sourceDir, destinationDir); + } else { + Debug.Log("TYPostProcessWeb CopyTyResouceFile, current channel dont need copy resource file."); + } + + } + + private string ProcessDestinationDir(string finnalOutputPath) + { + return Path.Combine(Directory.GetParent(buildPath).FullName, finnalOutputPath); + } + + private string ProcessSourceDir(string ChannelResPath) + { + return Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, ChannelResPath); + } + + public static void CopyFilesToDirectory(string sourceDir, string destinationDir) + { + if (!Directory.Exists(destinationDir)) + { + Debug.LogError("目标文件目录不存在"); + return; + } + + // 获取源目录下的所有文件 + string[] files = Directory.GetFiles(sourceDir); + + foreach (string file in files) + { + // 获取文件的文件名(不包含路径) + string fileName = Path.GetFileName(file); + + // 跳过以 .meta 结尾的文件 + if (fileName.EndsWith(".meta")) + { + continue; + } + + if (fileName == "TyJsBridge.js") + { + continue; + } + + // 目标文件的完整路径 + string destFile = Path.Combine(destinationDir, fileName); + + try + { + // 复制文件到目标目录(如果目标文件已经存在,覆盖它) + File.Copy(file, destFile, true); + Debug.Log($"File copied: {fileName}"); + } + catch (System.Exception e) + { + Debug.Log($"Failed to copy file {fileName}: {e.Message}"); + } + } + } +} diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPostProcessWeb.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPostProcessWeb.cs.meta new file mode 100644 index 0000000..e2ad729 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPostProcessWeb.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c83ce3ffa42443eda040950dacbd36f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPreProcessWeb.cs b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPreProcessWeb.cs new file mode 100644 index 0000000..1b20eef --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPreProcessWeb.cs @@ -0,0 +1,432 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using EngineSdkConverter.Unity.Plugins.WebGL; +using UnityEditor; +using UnityEditor.Build; +using UnityEditor.Build.Reporting; +using UnityEngine; +public class TYPreProcessWeb : IPreprocessBuildWithReport +{ + // 定义回调的顺序 + public int callbackOrder => 0; + private string configFilePath; + private string configJsonString; + private ConfigData configData; + private static string channelType; + + // 构建前的回调方法 + public void OnPreprocessBuild(BuildReport report) + { + string platform = report.summary.platform.ToString(); + if (platform == "WebGL" || platform == "MiniGame") + { + configFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_GAMECONFIG_DIR); + configJsonString = File.ReadAllText(configFilePath); + configData = JsonUtility.FromJson(configJsonString); + channelType = configData.tuyooParam.channelType; + CopyTyConfigFile(); + CopyTyBridgeFile(); + if (channelType == TYWebBuildConfig.MiniGameChannelType.WeiXin) + { + CopyTywxToWXTemplate(); + if (configData.login.tywx.txAdSetId != 0 && !string.IsNullOrEmpty(configData.login.tywx.txAdSetKey)) + { + // copy 广点通归因上报sdk的资源 + CopyDnSdkResouce(); + } + InsertTywx(); + } + if (channelType == TYWebBuildConfig.MiniGameChannelType.BYTEDANCE) + { + // copy js sdk 资源到 StreamingAssets下,只有StreamingAssets的资源会被渠道打包zip包里 + CopyBytedanceResource(); + } + if (channelType == TYWebBuildConfig.MiniGameChannelType.JINGDONG) + { + string jdDirectoryPath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "jingdongminigame"); + string[] files = Directory.GetFiles(jdDirectoryPath, "tuyoosdk_jingdong*.js"); + string sourceFile = files[0]; + CopyTuyooSdkJdRes(sourceFile); + InsertJDTuyooSdk(sourceFile); + } + if (channelType == TYWebBuildConfig.MiniGameChannelType.OPPO) + { + string oppoDirectoryPath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "oppominigame"); + string[] files = Directory.GetFiles(oppoDirectoryPath, "tuyoosdk_oppo*.js"); + string sourceFile = files[0]; + CopyTuyooSdkOppoRes(sourceFile); + InsertOppoTuyooSdk(sourceFile); + } + if (channelType == TYWebBuildConfig.MiniGameChannelType.MEITUAN) + { + string mtDirectoryPath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "meituanminigame"); + string[] files = Directory.GetFiles(mtDirectoryPath, "tuyoosdk_meituan*.js"); + string sourceFile = files[0]; + CopyTuyooSdkMtRes(sourceFile); + InsertMtTuyooSdk(sourceFile); + } + if (channelType == TYWebBuildConfig.MiniGameChannelType.KUAISHOU) + { + string mtDirectoryPath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "kuaishouminigame"); + string[] files = Directory.GetFiles(mtDirectoryPath, "tuyoosdk_kuaishou*.js"); + string sourceFile = files[0]; + CopyTuyooSdkKSRes(sourceFile); + InsertKSTuyooSdk(sourceFile); + } + if (channelType == TYWebBuildConfig.MiniGameChannelType.XIAOMI) + { + string mtDirectoryPath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "xiaomiminigame"); + string[] files = Directory.GetFiles(mtDirectoryPath, "tuyoosdk_xiaomi*.js"); + string sourceFile = files[0]; + CopyTuyooSdkMIRes(sourceFile); + InsertMITuyooSdk(sourceFile); + } + } + } + + public static string GetBuildChannelType() + { + return channelType; + } + + private void CopyTyConfigFile() + { + string destinationPath = Path.Combine(Application.dataPath, "Resources/tygameconfig.json"); + CopyFileContent(configFilePath, destinationPath); + } + + private void CopyTyBridgeFile() + { + if (channelType == TYWebBuildConfig.MiniGameChannelType.ALI) + { + // 阿里小游戏 + CopyBridgeContent("aliminigame"); + } + else if (channelType == TYWebBuildConfig.MiniGameChannelType.WeiXin) + { + // 微信小游戏 + CopyBridgeContent("tywx"); + InsertTywx(); + } + else if (channelType == TYWebBuildConfig.MiniGameChannelType.BYTEDANCE) + { + // 字节小游戏 + CopyBridgeContent("zijieminigame"); + } + else if (channelType == TYWebBuildConfig.MiniGameChannelType.JINGDONG) + { + // 京东小游戏 + CopyBridgeContent("jingdongminigame"); + } + else if (channelType == TYWebBuildConfig.MiniGameChannelType.OPPO) + { + // oppo小游戏 + CopyBridgeContent("oppominigame"); + } + else if (channelType == TYWebBuildConfig.MiniGameChannelType.MEITUAN) + { + CopyBridgeContent("meituanminigame"); + } + else if (channelType == TYWebBuildConfig.MiniGameChannelType.KUAISHOU) + { + CopyBridgeContent("kuaishouminigame"); + } + else if (channelType == TYWebBuildConfig.MiniGameChannelType.XIAOMI) + { + CopyBridgeContent("xiaomiminigame"); + } + else + { + // 打一个的默认jslib,可以直接导出WebGL + CopyBridgeContent("tywx"); + } + } + + public void CopyBridgeContent(string filePath) + { + string sourceFile = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, filePath, "TyJsBridge.js"); + string targetFile = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_JSBRIDGE_DIR); + CopyFileContent(sourceFile, targetFile); + } + + // https://wechat-miniprogram.github.io/minigame-unity-webgl-transform/Design/BuildTemplate.html + private void CopyTywxToWXTemplate() + { + string sourceFile = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "tywx/tywx.js"); + string targetFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_WX_DEFULT_DIR, "tysdk"); + CheckAndDeletePath(targetFilePath); + string targetFile = Path.Combine(targetFilePath, Path.GetFileName(sourceFile)); + CopyFileContent(sourceFile, targetFile); + } + + private void CopyDnSdkResouce() + { + string sourcePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "tywx/dn-sdk-minigame-1.5.4"); + string targetPath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_WX_DEFULT_DIR, "tysdk/dn-sdk-minigame-1.5.4"); + CopyDirectoryAllFiles(sourcePath, targetPath); + } + + private void InsertTywx() + { + string wxGameJSFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_WX_DEFULT_DIR, "game.js"); + string content = "import { tywx } from \"./tysdk/tywx.js\";\nGameGlobal.tywx = tywx;"; + string[] keyword = new string[] { "GameGlobal.tywx = tywx;", "GameGlobal.TuyooSdk = TuyooSdk;" }; + InsertContentToFile(wxGameJSFilePath, 2, content, keyword); + } + + private void CopyBytedanceResource() + { + string directoryPath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "zijieminigame"); + string[] files = Directory.GetFiles(directoryPath, "tuyoosdk_zijiegame*.js"); + string sourceFile = files[0]; + string targetFilePath = Path.Combine(Application.streamingAssetsPath, "__cp_js_files/tysdk.js"); + CopyFileContent(sourceFile, targetFilePath); + } + + private void CopyTuyooSdkJdRes(string sourceFile) + { + string targetFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_JD_DEFULT_DIR, "tysdk"); + // 如果已经存在了,删除里面的tysdk,避免重复copy不同版本 + CheckAndDeletePath(targetFilePath); + string targetFile = Path.Combine(targetFilePath, Path.GetFileName(sourceFile)); + CopyFileContent(sourceFile, targetFile); + if (configData.login.jingdongminigame.packageType == "wasmsplit") + { + string tywxSourceFile = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "tywx/tywx.js"); + string tywxTargetFilePath = Path.Combine(targetFilePath, "tywx.js"); + CopyFileContent(tywxSourceFile, tywxTargetFilePath); + } + } + + private void InsertJDTuyooSdk(string sourceFile) + { + string jdGameJSDefaultFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_JD_DEFULT_DIR, "game.js"); + string tyfileName = "./tysdk/" + Path.GetFileName(sourceFile); + string content = $"var TuyooSdk = require(\"{tyfileName}\");\nGameGlobal.TuyooSdk = TuyooSdk;"; + string[] keyword = new string[] { "GameGlobal.tywx = tywx;", "GameGlobal.TuyooSdk = TuyooSdk;" }; + InsertContentToFile(jdGameJSDefaultFilePath, 2, content, keyword); + if (configData.login.jingdongminigame.packageType == "wasmsplit") + { + string tywxContent = "import { tywx } from \"./tysdk/tywx.js\";\nGameGlobal.tywx = tywx;"; + InsertContentToFile(jdGameJSDefaultFilePath, 2, tywxContent, new string[] { }); + } + } + + private void CopyTuyooSdkOppoRes(string sourceFile) + { + string targetFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_WX_DEFULT_DIR, "tysdk"); + // 如果已经存在了,删除里面的tysdk,避免重复copy不同版本 + CheckAndDeletePath(targetFilePath); + string targetFile = Path.Combine(targetFilePath, Path.GetFileName(sourceFile)); + CopyFileContent(sourceFile, targetFile); + if (configData.login.oppominigame.packageType == "wasmsplit") + // 因为oppo小游戏需要用微信小游戏的开发者工具跑分包,所以需要把微信的资源脚本也打到包里 + { + string tywxSourceFile = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_CHANNEL_RESOURCE_DIR, "tywx/tywx.js"); + string tywxTargetFilePath = Path.Combine(targetFilePath, "tywx.js"); + CopyFileContent(tywxSourceFile, tywxTargetFilePath); + } + } + + private void InsertOppoTuyooSdk(string sourceFile) + { + string gameJSDefaultFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_WX_DEFULT_DIR, "game.js"); + string tyfileName = "./tysdk/" + Path.GetFileName(sourceFile); + string content = $"var TuyooSdk = require(\"{tyfileName}\");\nGameGlobal.TuyooSdk = TuyooSdk;"; + string[] keyword = new string[] { "GameGlobal.tywx = tywx;", "GameGlobal.TuyooSdk = TuyooSdk;" }; + InsertContentToFile(gameJSDefaultFilePath, 2, content, keyword); + if (configData.login.oppominigame.packageType == "wasmsplit") + { + string tywxContent = "import { tywx } from \"./tysdk/tywx.js\";\nGameGlobal.tywx = tywx;"; + InsertContentToFile(gameJSDefaultFilePath, 2, tywxContent, new string[] { }); + } + } + + private void CopyTuyooSdkMtRes(string sourceFile) + { + string targetFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_MT_DEFULT_DIR, "tysdk"); + // 如果已经存在了,删除里面的tysdk,避免重复copy不同版本 + CheckAndDeletePath(targetFilePath); + string targetFile = Path.Combine(targetFilePath, Path.GetFileName(sourceFile)); + CopyFileContent(sourceFile, targetFile); + } + + private void InsertMtTuyooSdk(string sourceFile) + { + string tyfileName = "./tysdk/" + Path.GetFileName(sourceFile); + string mtGameJSFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_MT_DEFULT_DIR, "game.js"); + string content = $"var TuyooSdk = require(\"{tyfileName}\");\nGameGlobal.TuyooSdk = TuyooSdk;"; + string[] keyword = new string[] { "GameGlobal.TuyooSdk = TuyooSdk;" }; + InsertContentToFile(mtGameJSFilePath, 2, content, keyword); + } + + private void CopyTuyooSdkKSRes(string sourceFile) + { + string targetFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_KS_DEFULT_DIR, "tysdk"); + // 如果已经存在了,删除里面的tysdk,避免重复copy不同版本 + CheckAndDeletePath(targetFilePath); + string targetFile = Path.Combine(targetFilePath, Path.GetFileName(sourceFile)); + CopyFileContent(sourceFile, targetFile); + } + + private void InsertKSTuyooSdk(string sourceFile) + { + string tyfileName = "./tysdk/" + Path.GetFileName(sourceFile); + string ksGameJSFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_KS_DEFULT_DIR, "game.js"); + string content = $"var TuyooSdk = require(\"{tyfileName}\");\nGameGlobal.TuyooSdk = TuyooSdk;"; + string[] keyword = new string[] { "GameGlobal.TuyooSdk = TuyooSdk;" }; + InsertContentToFile(ksGameJSFilePath, 2, content, keyword); + } + + private void CopyTuyooSdkMIRes(string sourceFile) + { + string targetFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_MI_DEFULT_DIR, "tysdk"); + // 如果已经存在了,删除里面的tysdk,避免重复copy不同版本 + CheckAndDeletePath(targetFilePath); + string targetFile = Path.Combine(targetFilePath, Path.GetFileName(sourceFile)); + CopyFileContent(sourceFile, targetFile); + } + + private void InsertMITuyooSdk(string sourceFile) + { + string tyfileName = "./tysdk/" + Path.GetFileName(sourceFile); + string miGameJSFilePath = Path.Combine(Application.dataPath, TYWebBuildConfig.TY_WEB_MI_DEFULT_DIR, "game.js"); + string content = $"var TuyooSdk = require(\"{tyfileName}\");\nwindow.TuyooSdk = TuyooSdk;"; + string[] keyword = new string[] { "window.TuyooSdk = TuyooSdk;" }; + InsertContentToFile(miGameJSFilePath, 1, content, keyword); + } + + public void CheckAndDeletePath(string targetPath) + { + if (Directory.Exists(targetPath)) + { + string[] files = Directory.GetFiles(targetPath, "*", SearchOption.AllDirectories); + foreach (string file in files) + { + File.Delete(file); + } + } + } + + public void CopyDirectoryAllFiles(string sourcePath, string targetPath) + { + if (!Directory.Exists(targetPath)) + { + Directory.CreateDirectory(targetPath); + } + string[] files = Directory.GetFiles(sourcePath); + + foreach (string file in files) + { + string fileName = Path.GetFileName(file); + if (fileName.EndsWith(".meta")) + { + continue; + } + string destFile = Path.Combine(targetPath, fileName); + + try + { + File.Copy(file, destFile, true); + } + catch (System.Exception e) + { + Debug.Log($"Failed to copy file {fileName}: {e.Message}"); + } + } + } + + public void CopyFileContent(string sourceFile, string targetFile) + { + if (!File.Exists(sourceFile)) + { + Debug.LogError($"源文件不存在: {sourceFile}"); + return; + } + + // 确保目标目录存在 + string targetDirectory = Path.GetDirectoryName(targetFile); + if (!Directory.Exists(targetDirectory)) + { + Directory.CreateDirectory(targetDirectory); + } + + // 读取源文件内容并写入目标文件(覆盖方式) + File.Copy(sourceFile, targetFile, true); + + Debug.Log($"已复制 {sourceFile} 的内容到 {targetFile}"); + } + + public void InsertContentToFile(string filePath, int targetLine, string insertContent, string[] checkKeyword) + { + try + { + if (!File.Exists(filePath)) + { + Debug.LogError("文件不存在: " + filePath); + return; + } + + var fileLines = new List(File.ReadAllLines(filePath)); + + foreach (string keyword in checkKeyword) + { + int matchIndex = fileLines.FindIndex(line => line.Trim() == keyword); + if (matchIndex >= 1) + { + // 删除该行和它上面一行,如: "import { tywx } from \"./tysdk/tywx.js\";\nGameGlobal.tywx = tywx;"; + fileLines.RemoveAt(matchIndex); + fileLines.RemoveAt(matchIndex - 1); + } + } + + string[] lines = fileLines.ToArray(); + + // 插入内容 + if (targetLine > lines.Length) + { + // 如果目标行号超过文件行数,则追加 + File.AppendAllText(filePath, Environment.NewLine + insertContent + Environment.NewLine); + } + else + { + // 在指定行插入 + fileLines.Insert(targetLine - 1, insertContent); + File.WriteAllLines(filePath, fileLines); + } + + Debug.Log($"已修改文件: {filePath}"); + } + catch (System.Exception e) + { + Debug.LogError($"修改文件失败: {e.Message}"); + } + } + + public void RemoveTargetContent(string filePath, string target) + { + try + { + if (!File.Exists(filePath)) + { + Debug.LogError("文件不存在: " + filePath); + return; + } + // 读取文件内容 + string text = File.ReadAllText(filePath); + + // 删除目标内容 + string newText = text.Replace(target, ""); + + // 写回文件 + File.WriteAllText(filePath, newText); + } + catch (System.Exception e) + { + Debug.LogError($"删除指定内容失败: {e.Message}"); + } + } + +} diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPreProcessWeb.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPreProcessWeb.cs.meta new file mode 100644 index 0000000..bdfac99 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYPreProcessWeb.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bf40edd3df60c492981a79cb33398b5c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYWebBuildConfig.cs b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYWebBuildConfig.cs new file mode 100644 index 0000000..8a00d9d --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYWebBuildConfig.cs @@ -0,0 +1,39 @@ +public class TYWebBuildConfig +{ + + // gameconfig dir + public const string TY_WEB_GAMECONFIG_DIR = "EngineSdkConverter/Unity/Plugins/WebGL/gameconfig.json"; + + public const string TY_WEB_CHANNEL_RESOURCE_DIR = "EngineSdkConverter/Unity/Plugins/WebGL/ChannelResource"; + + public const string TY_WEB_JSBRIDGE_DIR = "EngineSdkConverter/Unity/Plugins/WebGL/TyJsBridge.jslib"; + + public const string TY_WEB_WX_TEMPLATE_DIR = "WX-WASM-SDK-V2/Editor/template/minigame"; + + public const string TY_WEB_WX_DEFULT_DIR = "WX-WASM-SDK-V2/Runtime/wechat-default"; + + public const string TY_WEB_JD_TEMPLATE_DIR = "WX-WASM-SDK-V2/Editor/template/minigame"; + + public const string TY_WEB_JD_DEFULT_DIR = "WX-WASM-SDK-V2/Runtime/wechat-default"; + + public const string TY_WEB_MT_TEMPLATE_DIR = "MGC-WASM-SDK/Editor/template/minigame"; + + public const string TY_WEB_MT_DEFULT_DIR = "MGC-WASM-SDK/Runtime/wechat-default"; + + public const string TY_WEB_KS_DEFULT_DIR = "KS-WASM-SDK-V2/Runtime/minigame-default"; + + public const string TY_WEB_MI_DEFULT_DIR = "XIAOMI-minigame/MiQGame"; + + public class MiniGameChannelType + { + public const string ALI = "ali.cn.minigame"; + public const string WeiXin = "wx.cn.minigame"; + public const string BYTEDANCE = "bytedance.cn.minigame"; + public const string JINGDONG = "jingdong.cn.minigame"; + public const string OPPO = "oppo.cn.minigame"; + public const string MEITUAN = "mt.cn.minigame"; + public const string KUAISHOU = "kuaishou.cn.minigame"; + public const string XIAOMI = "xiaomi.cn.minigame"; + } + +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYWebBuildConfig.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYWebBuildConfig.cs.meta new file mode 100644 index 0000000..57b5a93 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/WebGL/TYWebBuildConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 894b657888acb4a1d9a61ed5a1efd7db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/com.tuyoo.unitysdk.editor.asmdef b/Packages/com.bywaystudios.tuyoosdk/Editor/com.tuyoo.unitysdk.editor.asmdef new file mode 100644 index 0000000..86b2fc1 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/com.tuyoo.unitysdk.editor.asmdef @@ -0,0 +1,18 @@ +{ + "name": "com.tuyoo.unitysdk.editor", + "rootNamespace": "", + "references": [ + "GUID:2104153dbb22d46e89c9a1195f478f01" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/com.tuyoo.unitysdk.editor.asmdef.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/com.tuyoo.unitysdk.editor.asmdef.meta new file mode 100644 index 0000000..0bad51d --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/com.tuyoo.unitysdk.editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f232f093b6a904b4a84b64f3bac882ca +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/iOS.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS.meta new file mode 100644 index 0000000..8a46928 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5779445bed0ed4206a40991b635b0b0c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkConverterUtils.cs b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkConverterUtils.cs new file mode 100644 index 0000000..4f63e18 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkConverterUtils.cs @@ -0,0 +1,160 @@ +using System; +using System.IO; +using UnityEditor; +using System.Diagnostics; + +namespace EngineSdkConverter.Unity.Editor +{ + public class Result + { + /// + /// Standard output stream from command line. + /// + public string StandardOutput; + + /// + /// Standard error stream from command line. + /// + public string StandardError; + + /// + /// Exit code returned from command line. + /// + public int ExitCode; + + /// + /// The description of the result that can be used for error logging. + /// + public string Message; + } + + public class EngineSdkConverterUtils + { + const string TAG = "EnginSdkConverterUtils "; + + static public string GetFilePathByAssetName(string assetName) + { + var assetGuids = AssetDatabase.FindAssets(assetName); + string retPath = ""; + foreach (var guid in assetGuids) + { + retPath = AssetDatabase.GUIDToAssetPath(guid); + if (File.Exists(retPath)) + { + retPath = Path.Combine(retPath); + break; + } + else + { + retPath = ""; + } + } + return retPath; + } + + public static Result RunShell(string toolPath, string arguments, string workingDirectory) + { + var stdoutFileName = Path.GetTempFileName(); + var stderrFileName = Path.GetTempFileName(); + + var process = new Process(); + process.StartInfo.UseShellExecute = false; + process.StartInfo.CreateNoWindow = false; + process.StartInfo.RedirectStandardInput = false; + process.StartInfo.RedirectStandardOutput = false; + process.StartInfo.RedirectStandardError = false; + + process.StartInfo.EnvironmentVariables["LANG"] = "en_US.UTF-8"; + process.StartInfo.EnvironmentVariables["PATH"] = $"{Environment.GetEnvironmentVariable("PATH")}:/usr/local/bin"; + + process.StartInfo.WorkingDirectory = workingDirectory; + process.StartInfo.FileName = "bash"; + string argumentsFormat = string.Format("-l -c '\"{0}\" {1} 1> {2} 2> {3}'", toolPath, arguments, stdoutFileName, stderrFileName); + process.StartInfo.Arguments = argumentsFormat; + process.Start(); + + process.WaitForExit(); + + var stdout = File.ReadAllText(stdoutFileName); + var stderr = File.ReadAllText(stderrFileName); + + File.Delete(stdoutFileName); + File.Delete(stderrFileName); + + var result = new Result(); + result.StandardOutput = stdout; + result.StandardError = stderr; + result.ExitCode = process.ExitCode; + + var messagePrefix = result.ExitCode == 0 ? "Command executed successfully" : "Failed to run command"; + result.Message = string.Format("{0}: '{1} {2}'\nstdout: {3}\nstderr: {4}\nExit code: {5}", messagePrefix, toolPath, arguments, stdout, stderr, process.ExitCode); + + return result; + } + + public static Result RunPython(string scriptPath, string arguments, string workingDirectory) + { + var stdoutFileName = Path.GetTempFileName(); + var stderrFileName = Path.GetTempFileName(); + + var process = new Process(); + process.StartInfo.UseShellExecute = false; + process.StartInfo.CreateNoWindow = false; + process.StartInfo.RedirectStandardInput = false; + process.StartInfo.RedirectStandardOutput = false; + process.StartInfo.RedirectStandardError = false; + + process.StartInfo.EnvironmentVariables["LANG"] = "en_US.UTF-8"; + process.StartInfo.EnvironmentVariables["PATH"] = $"{Environment.GetEnvironmentVariable("PATH")}:/usr/local/bin"; + + process.StartInfo.WorkingDirectory = workingDirectory; + process.StartInfo.FileName = "bash"; + + // 直接调用 Python3 并保证参数安全 + string argumentsFormat = $"-l -c 'python3 \"{scriptPath}\" {arguments} 1> \"{stdoutFileName}\" 2> \"{stderrFileName}\"'"; + process.StartInfo.Arguments = argumentsFormat; + + process.Start(); + process.WaitForExit(); + + var stdout = File.ReadAllText(stdoutFileName); + var stderr = File.ReadAllText(stderrFileName); + + File.Delete(stdoutFileName); + File.Delete(stderrFileName); + + var result = new Result + { + StandardOutput = stdout, + StandardError = stderr, + ExitCode = process.ExitCode, + Message = $"{(process.ExitCode == 0 ? "Command executed successfully" : "Failed to run command")}: 'python3 {scriptPath} {arguments}'\nstdout: {stdout}\nstderr: {stderr}\nExit code: {process.ExitCode}" + }; + + return result; + } + + public static void CopyDirectory(string sourceDir, string destDir, bool replace) + { + // 确保目标文件夹存在 + if (!Directory.Exists(destDir)) + { + Directory.CreateDirectory(destDir); + } + + // 复制所有文件 + foreach (var file in Directory.GetFiles(sourceDir)) + { + string destFilePath = Path.Combine(destDir, Path.GetFileName(file)); + File.Copy(file, destFilePath, replace); // true 表示覆盖已有文件 + } + + // 递归复制子文件夹 + foreach (var subDir in Directory.GetDirectories(sourceDir)) + { + string newDestDir = Path.Combine(destDir, Path.GetFileName(subDir)); + CopyDirectory(subDir, newDestDir, replace); + } + } + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkConverterUtils.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkConverterUtils.cs.meta new file mode 100644 index 0000000..6c3ded5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkConverterUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d7ebf1247305d4ac3bd13cf3cc628e1c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkiOSBuildProcess.py b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkiOSBuildProcess.py new file mode 100644 index 0000000..91dda42 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkiOSBuildProcess.py @@ -0,0 +1,948 @@ +import os +import re +import json +import argparse +from pbxproj import XcodeProject +from pbxproj.pbxsections import PBXShellScriptBuildPhase +import subprocess +import plistlib + +#TODO:待修改字段 +IOSMINIVERSION = '12.0' +LOCAL_SOURCE_LINE = 'http://tygit.tuyoo.com/dev_platform/ios/frameworks/pods/private-pod-repo.git' +SOURCE_LINE = 'ssh://git@tygit.tuyoo.com:2222/dev_platform/ios/frameworks/pods/private-pod-repo.git' +CUSTOM_OSS_HTTP_PATH = 'https://sa201-ptsdk-res.oss-cn-beijing.aliyuncs.com' + +build_config = {} +build_package_config = {} +build_sdk_names_list = [] +dependencies = [] + +CHANNEL_AND_NAME_LIST = ["wechat", + "wangyiyidun", + "yidunloginv2", + "douyin", + "rongheguiyin", + "yidunzhiwen", + "yiduncaptcha", + "yidunlivedetect", + "appsflyer", + "firebaseanalytics", + "firebasecrashlytics", + "firebaseodm", + "yuenanlogin", + "facebook", + "google", + "line", + "twitter", + "idfa", + "haiwailogin", + "aihelp", + "bugly", + "push", + "fcm"] + +BUNDLE_SOURCE = { + "yidunloginv2":["NTESResource.bundle","TDKYiDunLoginV2Bundle.bundle"], + "yidunzhiwen":["FPSupport.bundle"], + "yiduncaptcha":["NTESVerifyCodeResources.bundle","TDKYidunCaptchaBundle.bundle"], + "yidunlivedetect":["NTESLiveDetectBundle.bundle","TDKYidunLiveDetectBundle.bundle"], + "haiwailogin":["TDKHaiWaiLoginSource.bundle"], + "aihelp":["AIHelpSupportSDK.bundle"] +} + +EMBEM_FRAMEWORK_SOURCE = { + "douyin":["UnionOpenPlatformCore.framework","UnionOpenPlatformCPS.framework"], + "yidunlivedetect":["NEYDnn.framework"] +} + +def parse_build_config_json(build_config_json_path, coustom_plist_path): + print(f"1️⃣ parse_build_config_json, path = {build_config_json_path} begin") + abs_build_config_json_path = os.path.abspath(build_config_json_path) + if os.path.isfile(abs_build_config_json_path): + with open(abs_build_config_json_path, 'r', encoding='utf-8') as json_file: + data = json.loads(json_file.read()) + # print(f"1️⃣ parse_build_config_json, json = {data} ing") + # 将数据写入 plist 文件 + with open(coustom_plist_path, 'wb') as plist_file: + plistlib.dump(data, plist_file) + global coustom_plist_file_path + coustom_plist_file_path = coustom_plist_path + global build_config + build_config = data + global build_package_config + build_package_config = data.get('buildConfig') + global build_sdk_names_list + names = data.get('login').get('sdks') + build_sdk_names_list = list(set([name for name in names if name])) + fcm = data.get('fcm') + push = data.get('push') + if fcm: + build_sdk_names_list.append('fcm') + if push: + build_sdk_names_list.append('push') + if ('firebasecrashlytics' in build_sdk_names_list or 'firebaseodm' in build_sdk_names_list) and 'firebaseanalytics' not in build_sdk_names_list: + build_sdk_names_list.append('firebaseanalytics') + else: + print(f"❌ parse_build_config_json file error") + exit(1) + +def get_add_project_capability_flag(): + if build_package_config and "addCapability" in build_package_config: + return build_package_config.get("addCapability") + else: + return False + +def get_git_access_method(): + if build_package_config and "gitAccessMethod" in build_package_config: + return build_package_config.get("gitAccessMethod") + else: + return "ssh" + +def get_sdk_source_method(): + if build_package_config and "getSourceMethod" in build_package_config: + return build_package_config.get("getSourceMethod") + else: + return "git" + +def add_file_to_project(project, file_path, skip_if_exsit=True, target_name = None): + print(f"💡 add_file_to_project {file_path}") + abs_file_path = os.path.abspath(file_path) + if os.path.exists(abs_file_path): + if not project.get_files_by_path(abs_file_path): + project.add_file(abs_file_path, target_name = target_name) + print(f"⚠️ add_file_to_project {abs_file_path} add") + elif not skip_if_exsit: + project.remove_files_by_path(abs_file_path) + print(f"🗑️ 已删除旧的 {abs_file_path}") + file_ref = project.add_file(abs_file_path, target_name = target_name) + print(f"✅ 已添加: {abs_file_path} -> {file_ref}") + else: + print(f"⚠️ add_file_to_project {abs_file_path} already exist") + else: + print(f"⚠️ add_file_to_project {abs_file_path} not exist") + +def set_library_search_paths(project, search_paths, target_name=None): + print(f"💡 set_library_search_paths {search_paths}") + library_search_paths = None + for target in project.objects.get_targets(): + build_configurations = project.objects.get_configurations_on_targets(target.name) + for config in build_configurations: + library_search_paths = config.buildSettings.get("LIBRARY_SEARCH_PATHS", []) + default_paths = ['$(inherited)'] + if library_search_paths: + if not isinstance(library_search_paths, list): + library_search_paths = [library_search_paths] + print(f"💡 set_library_search_paths {library_search_paths}") + library_search_paths = default_paths + list(dict.fromkeys(search_paths + library_search_paths)) + + library_search_paths = default_paths + [item for item in library_search_paths if item not in default_paths] + else: + library_search_paths = default_paths + config.buildSettings["LIBRARY_SEARCH_PATHS"] = library_search_paths + print(f"💡 set_library_search_paths {target.name} - {library_search_paths}") + else: + print(f"💡 set_library_search_paths fail") + return None + +# **处理 Info.plist Begin** +def add_bool_to_info_plist(plist_file_path, key, value, skip_existing_elements = True): + print(f"💡 add_bool_to_info_plist {plist_file_path} - {key} - {value}") + if not key and key == '': + print(f"⚠️ add_bool_to_info_plist {key} invalue") + return + if not isinstance(value, bool): + print(f"⚠️ add_bool_to_info_plist {value} invalue") + return + with open(plist_file_path, 'rb') as f: + plist_data = plistlib.load(f) + if not skip_existing_elements or key not in plist_data: + # 如果存在,但不跳过,则直接覆盖, 如果不存在,则创建一个新的列表并添加 schemes_to_add + plist_data[key] = value + + # 将修改后的数据写回 info.plist 文件 + with open(plist_file_path, 'wb') as f: + plistlib.dump(plist_data, f) + +def add_string_to_info_plist(plist_file_path, key, value, skip_existing_elements = True): + print(f"💡 add_string_to_info_plist {plist_file_path} - {key} - {value}") + if not key and key == '': + print(f"⚠️ add_string_to_info_plist {key} invalue") + return + if not isinstance(value, str): + print(f"⚠️ add_array_to_info_plist {value} invalue") + return + with open(plist_file_path, 'rb') as f: + plist_data = plistlib.load(f) + if not skip_existing_elements or key not in plist_data: + # 如果存在,但不跳过,则直接覆盖, 如果不存在,则创建一个新的列表并添加 schemes_to_add + plist_data[key] = value + + # 将修改后的数据写回 info.plist 文件 + with open(plist_file_path, 'wb') as f: + plistlib.dump(plist_data, f) + +def add_array_to_info_plist(plist_file_path, key, value, skip_existing_elements = True): + print(f"💡 add_array_to_info_plist {plist_file_path} - {key} - {value}") + if not os.path.exists(plist_file_path): + print(f"⚠️ add_array_to_info_plist {plist_file_path} invalue") + return + if not key or key == '': + print(f"⚠️ add_array_to_info_plist {key} invalue") + return + if not isinstance(value, list): + print(f"⚠️ add_array_to_info_plist {value} invalue") + return + + with open(plist_file_path, 'rb') as f: + plist_data = plistlib.load(f) + + # 检查 key 是否存在 + if key not in plist_data: + plist_data[key] = [] + current_array = plist_data[key] + for item in value: + if not skip_existing_elements or item not in current_array: + current_array.append(item) + with open(plist_file_path, 'wb') as f: + plistlib.dump(plist_data, f) + +def is_json(variable): + try: + json.loads(variable) + return True + except (json.JSONDecodeError, TypeError): + return False + +def add_dictionary_to_info_plist(plist_file_path, key, value, skip_existing_elements = True): + print(f"💡 add_dictionary_to_info_plist {plist_file_path} - {key} - {value}") + if not key and key == '': + print(f"⚠️ add_dictionary_to_info_plist {key} invalue") + return + if not is_json(value): + print(f"⚠️ add_dictionary_to_info_plist {value} invalue") + return + with open(plist_file_path, 'rb') as f: + plist_data = plistlib.load(f) + if not skip_existing_elements or key not in plist_data: + # 如果存在,但不跳过,则直接覆盖, 如果不存在,则创建一个新的列表并添加 schemes_to_add + plist_data[key] = value + + # 将修改后的数据写回 info.plist 文件 + with open(plist_file_path, 'wb') as f: + plistlib.dump(plist_data, f) +# **处理 Info.plist End** + +# **处理 BuildSetting-ShellScript Begin** +def normalize_script(script: str): + if not script: + return '' + return script.strip().strip('"').strip("'") + +def add_shell_script(project, run_script, input_files=None, output_files=None ,target_name=None, insert_before_compile=False, run_install_build=0): + # 检查是否已经存在该脚本,避免重复添加 + for target in project.objects.get_targets(target_name): + print(f'target = {target}') + for build_phase_id in target.buildPhases: + build_phase = project.objects[build_phase_id] + print(f'build_phase = {build_phase_id} = {build_phase}') + if not isinstance(build_phase, PBXShellScriptBuildPhase): + continue + shellScript = build_phase.shellScript or "" + print(f'build_phase = start1 {shellScript}') + print(f'build_phase = start2 {run_script}') + if normalize_script(shellScript) == normalize_script(run_script): + print("⚠️ 已存在 先删除 ") + del project.objects[build_phase_id] + target.remove_build_phase(build_phase) + project.add_run_script( + script=run_script, + input_files=input_files, + output_files=output_files, + target_name=target_name, + insert_before_compile=insert_before_compile, + run_install_build=run_install_build + ) + print("✅ 已添加 Run Script Phase。") + project.save() +# **处理 BuildSetting-ShellScript Begin** + +# **处理 entitlements Begin** +def get_entitlements_file_path(project, skip_file_not_exist=True, app_target_name=None): + print(f"💡 get_entitlements_file_path ") + entitlements_path = None + for target in project.objects.get_targets(): + build_configurations = project.objects.get_configurations_on_targets(target.name) + for config in build_configurations: + entitlements_path = config.buildSettings.get("CODE_SIGN_ENTITLEMENTS", "") + if entitlements_path: + print(f"💡 get_entitlements_file_path {entitlements_path}") + return os.path.abspath(entitlements_path) + if not skip_file_not_exist and app_target_name: + entitlements_file_path = f"{app_target_name}/{app_target_name}.entitlements" + with open(entitlements_file_path, "wb") as f: + plistlib.dump({}, f) + for target in project.objects.get_targets(): + build_configurations = project.objects.get_configurations_on_targets(target.name) + for config in build_configurations: + config.buildSettings["CODE_SIGN_ENTITLEMENTS"] = entitlements_file_path + project.save() + return os.path.abspath(entitlements_file_path) + else: + return None + +def add_sign_in_with_apple_capability(project, app_target_name): + print(f"💡 add_sign_in_with_apple_capability") + if not get_add_project_capability_flag(): + print(f"💡 add_sign_in_with_apple_capability skip") + return + entitlements_file_path = get_entitlements_file_path(project, False, app_target_name) + SIGNIN_KEY = "com.apple.developer.applesignin" + if os.path.exists(entitlements_file_path): + with open(entitlements_file_path, "rb") as f: + entitlements = plistlib.load(f) + if SIGNIN_KEY in entitlements: + print(f"✅ add_sign_in_with_apple_capability 已启用") + else: + print(f"➕ add_sign_in_with_apple_capability 新增 ") + entitlements[SIGNIN_KEY] = ["Default"] + with open(entitlements_file_path, "wb") as f: + plistlib.dump(entitlements, f) + print(f"✅ add_sign_in_with_apple_capability `.entitlements` 文件已更新") + else: + print(f"⚠️ add_sign_in_with_apple_capability `.entitlements` not exist") + +def add_notification_capability(project, app_target_name): + print(f"💡 add_notification_capability") + if not get_add_project_capability_flag(): + print(f"💡 add_notification_capability skip") + return + entitlements_file_path = get_entitlements_file_path(project, False, app_target_name) + APS_ENV_KEY = "aps-environment" + if os.path.exists(entitlements_file_path): + with open(entitlements_file_path, "rb") as f: + entitlements = plistlib.load(f) + if APS_ENV_KEY in entitlements: + print(f"✅ add_notification_capability 已启用") + else: + print(f"➕ add_notification_capability 新增 ") + entitlements[APS_ENV_KEY] = "production" + with open(entitlements_file_path, "wb") as f: + plistlib.dump(entitlements, f) + print(f"✅ add_notification_capability `.entitlements` 文件已更新") + else: + print(f"⚠️ add_notification_capability `.entitlements` not exist") + +def add_background_modes_capability(info_plist_path): + print(f"💡 add_background_modes_capability") + if not get_add_project_capability_flag(): + print(f"💡 add_background_modes_capability skip") + return + print(f"✅ `info.plist` 文件已更新 UIBackgroundModes 和 remote-notification 权限") + add_array_to_info_plist(info_plist_path, 'UIBackgroundModes', ['remote-notification']) + +def add_keychain_capability(project, app_target_name): + print(f"💡 add_keychain_capability") + if not get_add_project_capability_flag(): + print(f"💡 add_keychain_capability skip") + return + entitlements_file_path = get_entitlements_file_path(project, False, app_target_name) + KEY_CHANIN_KEY = "keychain-access-groups" + if os.path.exists(entitlements_file_path): + with open(entitlements_file_path, "rb") as f: + entitlements = plistlib.load(f) + if KEY_CHANIN_KEY in entitlements: + print(f"✅ add_keychain_capability 已启用") + else: + print(f"➕ add_keychain_capability 新增 ") + entitlements[KEY_CHANIN_KEY] = [""] + with open(entitlements_file_path, "wb") as f: + plistlib.dump(entitlements, f) + print(f"✅ add_keychain_capability `.entitlements` 文件已更新") + else: + print(f"⚠️ add_keychain_capability `.entitlements` not exist") + +def process_applinks(applinks): + """ + 处理 applinks 列表,确保每个 URL 被转换为符合 Apple Universal Links 规范的格式。 + """ + processed_applinks = [] + for url in applinks: + if url.startswith("http://"): + domain = url[len("http://"):] + elif url.startswith("https://"): + domain = url[len("https://"):] + else: + domain = url + + domain = domain.split('/')[0] + processed_applinks.append(f"applinks:{domain}") + + return processed_applinks + +def add_associated_domains_capability(project, applinks, app_target_name): + print(f"💡 add_associated_domains_capability") + if not get_add_project_capability_flag(): + print(f"💡 add_associated_domains_capability skip") + return + entitlements_file_path = get_entitlements_file_path(project, False, app_target_name) + DOMAINS_KEY = "com.apple.developer.associated-domains" + processed_applinks = process_applinks(applinks) + if os.path.exists(entitlements_file_path): + with open(entitlements_file_path, "rb") as f: + entitlements = plistlib.load(f) + if DOMAINS_KEY in entitlements: + print(f"✅ 已启用 Associated Domains,正在补充信息") + current_domains = entitlements[DOMAINS_KEY] + # 合并两个列表,去重 + updated_domains = list(set(current_domains + processed_applinks)) + entitlements[DOMAINS_KEY] = updated_domains + else: + print(f"➕ add_associated_domains_capability 新增 ") + entitlements[DOMAINS_KEY] = processed_applinks + with open(entitlements_file_path, "wb") as f: + plistlib.dump(entitlements, f) + print(f"✅ add_associated_domains_capability `.entitlements` 文件已更新") + else: + print(f"⚠️ add_associated_domains_capability `.entitlements` not exist") +# **处理 entitlements End** + +def add_dependencies_set(dependency): + if dependency and isinstance(dependency, list): + global dependencies + dependencies = list(set(dependencies+dependency)) + +def create_podfile(podfile_path, miniversion, app_target_name, target_name): + """创建一个新的 Podfile 文件""" + print(f"💡 create_podfile {podfile_path} - {target_name}") + with open(podfile_path, 'w') as f: + f.write(f"platform :ios, '{miniversion}'\n") + # if app_target_name != target_name: + # f.write(f"target '{app_target_name}' do\n") + # f.write(f" use_frameworks!\n") + # f.write(f" target '{target_name}' do\n") + # f.write(f" use_frameworks!\n") + # f.write(" end\n") + # f.write("end\n") + # else: + f.write(f"target '{target_name}' do\n") + f.write(f" use_frameworks!\n") + f.write("end\n") +def read_podfile(podfile_path): + """读取 Podfile 内容""" + with open(podfile_path, 'r') as f: + return f.readlines() + +def write_podfile(podfile_path, lines): + """写入更新后的 Podfile 内容""" + with open(podfile_path, 'w') as f: + f.writelines(lines) + +def extract_pod_info(pod_line): + # 正则表达式模式,处理可能的多个空格 + # 解释: + # \s* 匹配任意数量的空格(包括0个) + # '([^']+)' 匹配单引号内的内容(组件名和版本号) + pattern = r"pod\s+'([^']+)'\s*,\s*'([^']+)'" + + # 执行匹配 + match = re.match(pattern, pod_line.strip()) + + if match: + # 返回组件名和版本号 + return match.group(1), match.group(2) + else: + return None, None + +def update_dependencies(lines, app_target_name, target_name, dependencies): + """更新 Podfile 中的依赖项 - 根据目标名称判断更新方式""" + + # 检查 source 信息 + source_found = False + # 检查 source 获取方式 + if get_sdk_source_method() == 'http': + source_line = f"OSS_HTTP_PATH = '{CUSTOM_OSS_HTTP_PATH}'" + else: + if get_git_access_method() == 'ssh': + source_line = f"source '{SOURCE_LINE}'" + else: + source_line = f"source '{LOCAL_SOURCE_LINE}'" + for i, line in enumerate(lines): + if line.strip() == source_line.strip(): + source_found = True + break + + # 处理 target_name 和 app_target_name 是否相同的情况 + # if app_target_name == target_name: + print(f"🔄 Updating dependencies for target '{target_name}'") + + # 直接处理 target_name 闭包 + target_found = False + target_index = -1 + end_index = -1 + # 查找target闭包 + for i, line in enumerate(lines): + if f"target '{target_name}' do" in line: + target_found = True + target_index = i + # 在目标的 do 之前插入 source + if not source_found: + lines.insert(i, f'{source_line}\n') + target_index = target_index + 1 + break + + if not target_found: + print(f"➕ Adding new target '{target_name}'") + lines.append(f"\ntarget '{target_name}' do\n") + lines.append(" use_frameworks!\n") + lines.append("end\n") + target_index = len(lines) - 3 + end_index = len(lines) - 1 + else: + for j in range(target_index + 1, len(lines)): + if 'end' in lines[j]: + end_index = j + break + + # 查找依赖项并更新 + existing_deps = [ + dep.strip().split(',')[0].strip() for dep in lines[target_index + 1:end_index] + if dep.strip().lower().startswith("pod ") + ] + + dealDependencies = [] + # 处理 http 资源 + if get_sdk_source_method() == 'http': + # "pod 'TYWeChatHandle', '1.1.0'" + for dep in dependencies: + podName, podVersion = extract_pod_info(dep) + if podName != None and podVersion != None: + # TODO: 得把test改掉!! + dealDependencies.append(f"pod '{podName}', :podspec => \"#{{OSS_HTTP_PATH}}/{podName}/test/{podVersion}/{podName}.podspec\"") + else : + dealDependencies = dependencies + + new_lines = lines.copy() + for dep in dealDependencies: + dep_name = dep.strip().split(',')[0].strip() + if dep_name and dep_name not in existing_deps: + new_lines.insert(target_index + 1, f" {dep}\n") + end_index += 1 + else: + for i in range(len(new_lines)): + if i > target_index and i < end_index: + line = new_lines[i] + if line.strip().startswith('pod ') and line.strip().split(',')[0].strip() == dep_name: + new_lines[i] = f" {dep}\n" + + lines[:] = new_lines + return True + + # else: + # # 如果 target_name 和 app_target_name 不同,则嵌套 target_name 在 app_target_name 内部 + # print(f"🔄 Updating dependencies for target '{target_name}' inside the '{app_target_name}' target.") + + # # 处理 app_target_name 闭包 + # target_found = False + # app_target_index = -1 + # app_end_index = -1 + # for i, line in enumerate(lines): + # if f"target '{app_target_name}' do" in line: + # target_found = True + # app_target_index = i + # # 在目标的 do 之前插入 source + # if not source_found: + # lines.insert(i, f'{source_line}\n') + # break + + # if not target_found: + # print(f"➕ Adding new target '{app_target_name}'") + # lines.append(f"\ntarget '{app_target_name}' do\n") + # lines.append(" use_frameworks!\n") + # lines.append("end\n") + # app_target_index = len(lines) - 3 + # app_end_index = len(lines) - 1 + # else: + # for j in range(app_target_index + 1, len(lines)): + # if 'end' in lines[j]: + # app_end_index = j + # break + + # # 查找 app_target_name 下的子目标 target_name 的闭包 + # child_target_found = False + # child_target_index = -1 + # for i, line in enumerate(lines[app_target_index + 1: app_end_index]): + # if f"target '{target_name}' do" in line: + # child_target_found = True + # child_target_index = i + app_target_index + 1 + # break + + # if not child_target_found: + # print(f"➕ Adding target '{target_name}' inside '{app_target_name}'") + # lines.insert(app_end_index, f"\ntarget '{target_name}' do\n") + # lines.insert(app_end_index + 1, " use_frameworks!\n") + # lines.insert(app_end_index + 2, "end\n") + # child_target_index = app_end_index + 1 + + # # 在 target_name 的闭包中添加依赖项 + # for dep in dependencies: + # lines.insert(child_target_index + 1, f" {dep}\n") + # child_target_index += 1 + + # return True + +def process_podfile(podfile_path, app_target_name, target_name, miniversion, dependencies): + """处理 Podfile + 1. podfile_path:podfile文件的路径 + 2. target_name:项目名称 + 3. dependencies:pod依赖信息的列表(示例: ["pod 'XYSDK'", "pod 'TDKWechatHandle'"]) + """ + print(f"process_podfile {podfile_path} - {target_name} - {miniversion} - {dependencies}") + if not os.path.exists(podfile_path): + create_podfile(podfile_path, miniversion, app_target_name, target_name) + + lines = read_podfile(podfile_path) + + # 更新依赖项 + if update_dependencies(lines, app_target_name, target_name, dependencies): + write_podfile(podfile_path, lines) + +def install_podfile(project_dir): + # 执行 pod 命令 + print("执行 pod deintegrate && pod install") + result = subprocess.run(["pod", "deintegrate"], cwd=project_dir) + if result.returncode != 0: + print("❌ pod deintegrate 失败") + exit(4) + + result = subprocess.run(["pod", "install", "--repo-update"], cwd=project_dir) + if result.returncode != 0: + print("❌ pod install 失败") + exit(4) + + print("✅ Podfile 处理完成!") + +def find_app_target_names(project): + print(f"💡 find_app_targets ") + # 遍历所有的targets,找到主工程target + app_targets = [] + for target in project.objects.get_targets(): + if target.productType == "com.apple.product-type.application": + app_targets.append(target.name) + return app_targets + +def copy_bundle_to_main_projet(project, project_path): + print(f"💡 copy_bundle_to_main_projet {project_path}") + pod_source_path = os.path.join(project_path, "Pods") + if os.path.exists(pod_source_path): + bundle_paths = [] + bundle_sources = [bundle for bundles in BUNDLE_SOURCE.values() for bundle in bundles] + for root, dirs, files in os.walk(pod_source_path): + folder_name = os.path.basename(root) + if "Pods" in root and root.endswith(".bundle") and folder_name in bundle_sources: + bundle_paths.append(os.path.abspath(root)) + target_names = find_app_target_names(project) + print(f"💡 copy_bundle_to_main_projet target_names {target_names}") + for bundle in bundle_paths: + for target_name in target_names: + add_file_to_project(project, bundle, target_name=target_name, skip_if_exsit=False) + project.save() + +def add_file_to_embed_frameworks(project, project_path): + print(f"💡 add_file_to_embed_frameworks {project_path}") + pod_source_path = os.path.join(project_path, "Pods") + if os.path.exists(pod_source_path): + embed_framework_paths = [] + embed_framework_sources = [framework for frameworks in EMBEM_FRAMEWORK_SOURCE.values() for framework in frameworks] + for root, dirs, files in os.walk(pod_source_path): + folder_name = os.path.basename(root) + if "Pods" in root and (root.endswith(".framework") or root.endswith(".xcframework")) and folder_name in embed_framework_sources: + embed_framework_paths.append(os.path.abspath(root)) + target_names = find_app_target_names(project) + print(f"💡 add_file_to_embed_frameworks target_names {embed_framework_paths}") + print(f"💡 add_file_to_embed_frameworks target_names {target_names}") + for framework in embed_framework_paths: + for target_name in target_names: + add_file_to_project(project, framework, target_name=target_name, skip_if_exsit=False) + project.save() + +def process_wechat_setting(project,info_plist_path, app_target_name): + print(f"💡 process_wechat_setting ") + wechat_config = build_config.get('login').get('wechat') + if wechat_config.get('wxAppId') and wechat_config.get('wxUniversalLink'): + add_array_to_info_plist(info_plist_path, 'LSApplicationQueriesSchemes', ['weixin','weixinULAPI','weixinURLParamsAPI','wechat']) + url_scheme = { + 'CFBundleURLName': 'wx', + 'CFBundleURLSchemes': [wechat_config.get('wxAppId')] + } + add_array_to_info_plist(info_plist_path, 'CFBundleURLTypes', [url_scheme]) + add_associated_domains_capability(project, wechat_config.get('wxUniversalLink'), app_target_name) + else: + print(f"❌ process_wechat_setting configs are incomplete ") + +def process_yidunlivedetect_setting(project,info_plist_path): + print(f"💡 process_yidunlivedetect_setting ") + channel_config = build_config.get('login').get('yidunlivedetect') + if channel_config.get('businessId'): + add_string_to_info_plist(info_plist_path, 'kYiDunLiveDetectBusinessId', channel_config.get('businessId'), False) + if not channel_config.get('NSPhotoLibraryUsageDescription'): + add_string_to_info_plist(info_plist_path, 'NSPhotoLibraryUsageDescription', '相册权限文案') + else: + add_string_to_info_plist(info_plist_path, 'NSPhotoLibraryUsageDescription', channel_config.get('NSPhotoLibraryUsageDescription')) + if not channel_config.get('NSCameraUsageDescription'): + add_string_to_info_plist(info_plist_path, 'NSCameraUsageDescription', '相机权限文案') + else: + add_string_to_info_plist(info_plist_path, 'NSCameraUsageDescription', channel_config.get('NSCameraUsageDescription')) + else: + print(f"❌ process_yidunlivedetect_setting configs are incomplete ") + +def process_facebook_setting(project,info_plist_path): + print(f"💡 process_facebook_setting ") + channel_config = build_config.get('login').get('facebook') + if channel_config.get('facebookAppId') and channel_config.get('facebookClientToken') and channel_config.get('facebookDisplayName'): + facebookAppId = channel_config.get('facebookAppId') + add_string_to_info_plist(info_plist_path, 'FacebookAppID', facebookAppId, False) + add_string_to_info_plist(info_plist_path, 'FacebookClientToken', channel_config.get('facebookClientToken'), False) + add_string_to_info_plist(info_plist_path, 'FacebookDisplayName', channel_config.get('facebookDisplayName'), False) + add_array_to_info_plist(info_plist_path, 'LSApplicationQueriesSchemes', ['fb-messenger-share-api','fbapi']) + url_scheme = { + 'CFBundleURLName': 'fb', + 'CFBundleURLSchemes': [f'fb{facebookAppId}'] + } + add_array_to_info_plist(info_plist_path, 'CFBundleURLTypes', [url_scheme]) + else: + print(f"❌ process_facebook_setting configs are incomplete ") + +def process_google_setting(project,info_plist_path): + print(f"💡 process_google_setting ") + channel_config = build_config.get('login').get('google') + googleiOSClientId = channel_config.get('googleiOSClientId') + if googleiOSClientId: + add_string_to_info_plist(info_plist_path, 'GIDClientID', googleiOSClientId, False) + fanzhuan_google_client_id = ".".join(googleiOSClientId.split(".")[::-1]) + url_scheme = { + 'CFBundleURLName': 'google', + 'CFBundleURLSchemes': [fanzhuan_google_client_id] + } + add_array_to_info_plist(info_plist_path, 'CFBundleURLTypes', [url_scheme]) + else: + print(f"❌ process_google_setting configs are incomplete ") + +def process_line_setting(project,info_plist_path): + print(f"💡 process_line_setting ") + channel_config = build_config.get('login').get('line') + if channel_config.get('TYLineChannelID') and channel_config.get('TYLineLinkURL'): + add_string_to_info_plist(info_plist_path, 'TYLineChannelID', channel_config.get('TYLineChannelID'), False) + add_string_to_info_plist(info_plist_path, 'TYLineLinkURL', channel_config.get('TYLineLinkURL'), False) + add_array_to_info_plist(info_plist_path, 'LSApplicationQueriesSchemes', ['lineauth2']) + package = build_config.get('package') + url_scheme = { + 'CFBundleURLName': 'line', + 'CFBundleURLSchemes': [f'line3rdp.{package}'] + } + add_array_to_info_plist(info_plist_path, 'CFBundleURLTypes', [url_scheme]) + try: + result = subprocess.run(["where", "carthage"], capture_output=True, text=True, check=True) + carthage_path = result.stdout.strip().split("\n")[0] + shell_scrip = f"{carthage_path} copy-frameworks" + target_names = find_app_target_names(project) + add_shell_script(project, shell_scrip, target_name=target_names) + except subprocess.CalledProcessError: + print(f"❌ process_line_setting Carthage not exist ") + exit(1) + else: + print(f"❌ process_line_setting configs are incomplete ") + +def process_twitter_setting(project,info_plist_path): + print(f"💡 process_twitter_setting ") + channel_config = build_config.get('login').get('twitter') + if channel_config.get('twitterClientid') and channel_config.get('twitterSpoce'): + add_string_to_info_plist(info_plist_path, 'TYTwitterClientid', channel_config.get('twitterClientid'), False) + add_array_to_info_plist(info_plist_path, 'TYTwitterSpoce', list(channel_config.get('twitterSpoce'))) + else: + print(f"❌ process_twitter_setting configs are incomplete ") + +def process_rongheguiyin_setting(project, info_plist_path): + channel_config = build_config.get('login').get('rongheguiyin') + url_scheme = { + 'CFBundleURLName': 'rongheguiyin', + 'CFBundleURLSchemes': [build_config.get('package')] + } + add_array_to_info_plist(info_plist_path, 'CFBundleURLTypes', [url_scheme]) + if channel_config and 'RongHeGuiYinStrategy' in channel_config: + add_bool_to_info_plist(info_plist_path, "RongHeGuiYinStrategy", channel_config.get('RongHeGuiYinStrategy'), False) + +def process_aihelp_setting(project, info_plist_path): + channel_config = build_config.get('login').get('aihelp') + if channel_config.get('TYAIHelpAppID') and channel_config.get('TYAIHelpDomainName') and channel_config.get('TYAIHelpLanguage'): + add_string_to_info_plist(info_plist_path, 'TYAIHelpAppID', channel_config.get('TYAIHelpAppID'), False) + add_string_to_info_plist(info_plist_path, 'TYAIHelpDomainName', channel_config.get('TYAIHelpDomainName'), False) + add_string_to_info_plist(info_plist_path, 'TYAIHelpLanguage', channel_config.get('TYAIHelpLanguage'), False) + add_string_to_info_plist(info_plist_path, 'NSPhotoLibraryUsageDescription', channel_config.get('NSPhotoLibraryUsageDescription'), False) + add_bool_to_info_plist(info_plist_path, 'PHPhotoLibraryPreventAutomaticLimitedAccessAlert', channel_config.get('PHPhotoLibraryPreventAutomaticLimitedAccessAlert'), False) + else: + print(f"❌ process_aihelp_setting configs are incomplete ") + +def process_bugly_setting(project, info_plist_path): + channel_config = build_config.get('login').get('bugly') + if channel_config.get('BuglyAppID'): + add_string_to_info_plist(info_plist_path, 'BuglyAppID', channel_config.get('BuglyAppID'), False) + else: + print(f"❌ process_bugly_setting configs are incomplete ") + +def get_info_plist_path(project_path, target_name): + path = os.path.join(project_path, f'Info.plist') + if os.path.exists(path): + info_plist_path = path + else: + path = os.path.join(project_path, f'{target_name}/Info.plist') + if os.path.exists(path): + info_plist_path = path + print(f"💡 get_info_plist_path {info_plist_path}") + return info_plist_path + +def process_project_setting(project_path, project_name, miniversion, target_name): + print("2️⃣ process_project_setting") + project_pbxproj_path = os.path.join(project_path, f'{project_name}/project.pbxproj') + # 工程 + project = XcodeProject.load(project_pbxproj_path) + # plist文件 + info_plist_path = get_info_plist_path(project_path, target_name) + target_names = find_app_target_names(project) + if len(target_names) != 0: + app_target_name = target_names[0] + else: + app_target_name = None + # 基础设置: 钥匙串 apple登录 applink C++兼容 swift + add_file_to_project(project, coustom_plist_file_path, skip_if_exsit=False) + project.add_other_ldflags(['$(inherited)', '-ObjC', '-all_load']) + add_sign_in_with_apple_capability(project, app_target_name) + set_library_search_paths(project, []) + # add_keychain_capability(project, app_target_name) + + # 遍历设置每一个渠道所需信息 + print(f"2️⃣ process_project_setting {build_sdk_names_list}") + for channel_name in build_sdk_names_list: + if channel_name in CHANNEL_AND_NAME_LIST: + if channel_name == "fcm" or channel_name == "push": + print(f"💡 process_{channel_name}_setting ") + channel_config = build_config.get(channel_name) + add_dependencies_set(channel_config.get('podDependencies')) + if channel_name == "push": + add_notification_capability(project, app_target_name) + add_background_modes_capability(info_plist_path) + else: + channel_config = build_config.get('login').get(channel_name) + add_dependencies_set(channel_config.get('podDependencies')) + if channel_name == "wechat": + process_wechat_setting(project, info_plist_path, app_target_name) + elif channel_name == "wangyiyidun" or channel_name == "yidunloginv2": + if channel_config.get('unionSpecialLogo'): + union_special_logo_path = os.path.join(project_path, 'union_special_logo.png') + add_file_to_project(project, union_special_logo_path, skip_if_exsit=False) + project.add_other_ldflags(['$(inherited)', '-fprofile-instr-generate']) + elif channel_name == "yidunzhiwen": + add_string_to_info_plist(info_plist_path, 'kYiDunDeviceBusinessId', channel_config.get('businessId'), False) + elif channel_name == "yiduncaptcha": + add_string_to_info_plist(info_plist_path, 'kYiDunCaptchaBusinessId', channel_config.get('businessId'), False) + if channel_config.get('kYiDunCaptchaCloseBtn'): + add_string_to_info_plist(info_plist_path, 'kYiDunCaptchaCloseBtn', "1", False) + elif channel_name == "yidunlivedetect": + process_yidunlivedetect_setting(project, info_plist_path) + elif channel_name == "appsflyer": + add_string_to_info_plist(info_plist_path, 'TYAppsFlyerAppleAppId', channel_config.get('appsFlyerAppleAppId'), False) + add_string_to_info_plist(info_plist_path, 'TYAppsFlyerDevkey', channel_config.get('appsFlyerDevkey'), False) + elif channel_name == "firebaseanalytics": + google_plist_path = os.path.join(project_path, 'GoogleService-Info.plist') + add_file_to_project(project, google_plist_path, skip_if_exsit=False) + elif channel_name == "facebook": + process_facebook_setting(project, info_plist_path) + elif channel_name == "google": + process_google_setting(project, info_plist_path) + elif channel_name == "line": + process_line_setting(project, info_plist_path) + elif channel_name == "twitter": + process_twitter_setting(project, info_plist_path) + elif channel_name == "rongheguiyin": + process_rongheguiyin_setting(project, info_plist_path) + elif channel_name == "douyin": + douyin_config_path = os.path.join(project_path, 'UOPSDKConfig.json') + add_file_to_project(project, douyin_config_path, skip_if_exsit=False) + elif channel_name == "aihelp": + process_aihelp_setting(project, info_plist_path) + elif channel_name == "bugly": + process_bugly_setting(project, info_plist_path) + elif channel_name == "firebasecrashlytics": + input_files = [ + '${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}', + '$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)' + ] + shell_scrip = '"$SRCROOT/Pods/FirebaseCrashlyticsSDK/run"' + target_names = find_app_target_names(project) + print(f'✅ target_namestarget_namestarget_names = {target_names}') + add_shell_script(project, shell_scrip, target_name=target_names, input_files=input_files) + project.set_flags('DEBUG_INFORMATION_FORMAT', 'dwarf-with-dsym') + elif channel_name == "firebaseodm": + add_bool_to_info_plist(info_plist_path, 'kFirebaseODM', True, False) + + project.save() + # 处理pod文件,并install + podfile_path = os.path.join(project_path, "Podfile") + add_dependencies_set(build_config.get('tuyooParam').get('podDependencies')) + process_podfile(podfile_path, app_target_name, target_name, miniversion, dependencies) + install_podfile(project_path) + if app_target_name and app_target_name != target_name: + copy_bundle_to_main_projet(project, project_path) + add_file_to_embed_frameworks(project, project_path) + install_podfile(project_path) + +if __name__ == "__main__": + print(f'✅ input info {argparse}') + + parser = argparse.ArgumentParser(description="Process some integers.") + parser.add_argument('--configFile', type=str, required=True, help='build config json path') + parser.add_argument('--workspace', type=str, required=True, help='export ipa project path') + parser.add_argument('--minos', type=str, required=True, help='miniversion') + parser.add_argument('--targetName', type=str, help='target_name') + args = parser.parse_args() + print(f"args: {args}") + if args.configFile: + build_config_json_path = args.configFile + else: + print('❌ config json path not set') + exit(1) + + if args.workspace: + export_ipa_project_path = args.workspace + if not export_ipa_project_path or not os.path.isdir(export_ipa_project_path): + print('❌ project path not set') + exit(1) + xcodeproj_path = '' + project_name = '' + for file in os.listdir(export_ipa_project_path): + xcodeproj_path = os.path.join(export_ipa_project_path, file) + if os.path.exists(xcodeproj_path) and xcodeproj_path.endswith('.xcodeproj'): + project_name = os.path.basename(xcodeproj_path) + print(f"✅ project 文件存在: {project_name} - {xcodeproj_path}") + break + + if args.minos: + miniversion = args.minos + if args.targetName: + target_name = args.targetName + + if not miniversion: + miniversion = IOSMINIVERSION + if not target_name: + target_name = target_name = os.path.splitext(project_name)[0] + + print(f"✅ 打包基础信息:\n build_config_json_path - {build_config_json_path} \n export_ipa_project_path - {export_ipa_project_path} \n project_name - {project_name} \n miniversion - {miniversion} \n target_name - {target_name}") + if os.path.exists(xcodeproj_path) and project_name != '': + # 解析配置信息 + costom_plist_file_path = os.path.join(export_ipa_project_path, 'EngineSdkBaseInfo.plist') + parse_build_config_json(build_config_json_path, costom_plist_file_path) + # SDK+渠道配置 + process_project_setting(export_ipa_project_path, project_name, miniversion, target_name) + else: + print('❌ xcodeproj file not exist') + exit(1) \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkiOSBuildProcess.py.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkiOSBuildProcess.py.meta new file mode 100644 index 0000000..5e023b8 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/EngineSdkiOSBuildProcess.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 687db4b74404e453abf9203b736952a3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/TYPostProcessiOS.cs b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/TYPostProcessiOS.cs new file mode 100644 index 0000000..53fcd32 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/TYPostProcessiOS.cs @@ -0,0 +1,69 @@ +using System.IO; +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEngine; + +namespace EngineSdkConverter.Unity.Editor +{ + public class TYPostProcessiOS + { + const string TAG = "TYPostProcessiOS OnPostProcessBuild "; + const string ENGINE_SDK_CONVERTER_RESOURCE_FROM_UNITY_RELATIVE_PATH = "EngineSdkConverter/Unity/Editor/iOS"; + + const string ENGINE_SDK_CONVERTER_PLUGINS_FROM_UNITY_RELATIVE_PATH = "EngineSdkConverter/Unity/Plugins/iOS"; + const string ENGINE_SDK_CONVERTER_PYTHON_PACKAGE_SITE_PATH = "EngineSdkConverter/Unity/Plugins/iOS/python_sites"; + const string GAME_BUILD_CONFIG_FILE_PATH = "gameConfigs"; + const string GAME_BUILD_CONFIG_FILE_NAME = "gameconfig.json"; + + const string UNION_SPECIAL_LOGO = "union_special_logo.png"; + + // iOSSDK资源-脚本文件名称 + const string CUSTOMIZE_SCRIPT_FILE_NAME = "EngineSdkiOSBuildProcess.py"; + + // 项目Unity Traget Name + const string UNITY_TARGET_NAME = "Unity-iPhone"; + const string UNITY_FRAMEWORK_TARGET_NAME = "UnityFramework"; + + [PostProcessBuild(49)] + public static void OnPostProcessBuild(BuildTarget buildTarget, string path) + { + Debug.Log(TAG + " start " + path); + + if (buildTarget == BuildTarget.iOS) + { + Debug.Log(TAG + "start"); + // 移动脚本/配置 - 运行脚本 + string resourceOfUnityPluginsPath = Path.Combine(Application.dataPath, ENGINE_SDK_CONVERTER_RESOURCE_FROM_UNITY_RELATIVE_PATH); + string pythonPackageSitePath = Path.Combine(Application.dataPath, ENGINE_SDK_CONVERTER_PYTHON_PACKAGE_SITE_PATH); + string pluginsPath = Path.Combine(Application.dataPath, ENGINE_SDK_CONVERTER_PLUGINS_FROM_UNITY_RELATIVE_PATH); + + string unionSpecialLogoPath = Path.Combine(pluginsPath, UNION_SPECIAL_LOGO); + string targetUnionSpecialLogoPath = Path.Combine(path, UNION_SPECIAL_LOGO); + File.Copy(unionSpecialLogoPath, targetUnionSpecialLogoPath, true); + + string customScriptPath = Path.Combine(resourceOfUnityPluginsPath, CUSTOMIZE_SCRIPT_FILE_NAME); + string targetScriptPath = Path.Combine(path, CUSTOMIZE_SCRIPT_FILE_NAME); + File.Copy(customScriptPath, targetScriptPath, true); + // 资源 + string customGameConfigPath = Path.Combine(resourceOfUnityPluginsPath, GAME_BUILD_CONFIG_FILE_PATH); + string targetGameConfigPath = path; + EngineSdkConverterUtils.CopyDirectory(customGameConfigPath, targetGameConfigPath, true); + EngineSdkConverterUtils.CopyDirectory(pythonPackageSitePath, targetGameConfigPath, true); + string targetConfigPath = Path.Combine(path, GAME_BUILD_CONFIG_FILE_NAME); + TryRunBuildScript(path, targetScriptPath, targetConfigPath); + } + } + + static void TryRunBuildScript(string workspace, string scriptFilePath, string configFilePath) + { + Debug.Log(TAG + " TryRunBuildScript start " + workspace + " " + scriptFilePath); + string iosMinOSVersion = PlayerSettings.iOS.targetOSVersionString; + string arguments = $"--configFile \"{configFilePath}\" --workspace \"{workspace}\" --minos \"{iosMinOSVersion}\" --targetName \"{UNITY_FRAMEWORK_TARGET_NAME}\""; + Debug.Log(TAG + $"EngineSDKConverter RunPython arguments :{arguments} "); + Result buildResult = EngineSdkConverterUtils.RunPython(scriptFilePath, arguments, workspace); + Debug.Log(TAG + $"EngineSDKConverter buildResult error :{buildResult.ExitCode} "); + Debug.Log(TAG + $"EngineSDKConverter buildResult error :{buildResult.Message} "); + Debug.Log(TAG + "TryRunBuildScript finish"); + } + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/TYPostProcessiOS.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/TYPostProcessiOS.cs.meta new file mode 100644 index 0000000..e6a1ab7 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Editor/iOS/TYPostProcessiOS.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c05b2395d8b1438e9a2340e07356dff +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins.meta new file mode 100644 index 0000000..18e8e0f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df2ae868d776f465c971b79b02356948 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL.meta new file mode 100644 index 0000000..23253f3 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc6ad16c05bd04a12a8726fed4ef7a5b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource.meta new file mode 100644 index 0000000..1aec778 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6d4cdd383393d49448f34dc594d8d244 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame.meta new file mode 100644 index 0000000..9c91194 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3cbd9f85438a64df39f96a750daa1685 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/TyJsBridge.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/TyJsBridge.js new file mode 100644 index 0000000..73115da --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/TyJsBridge.js @@ -0,0 +1,228 @@ +var TuyooSdkBridge = { + + loadJsScriptToBridge: function (channelType) { + var channelTypeFromCS = UTF8ToString(channelType); + console.log("channelTypeFromCS:" + channelTypeFromCS); + var TuyooSdk; + if (channelTypeFromCS == "ali.cn.minigame") { + TuyooSdk = require("./tuyoosdk_aliminigame_1.0.4.250915_release.js"); + } + window.TuyooSdk = TuyooSdk; + }, + + InitToBridge: function (initEventInfo) { + try { + var initCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "InitResult", callbackString); + } + var initInfoFromCS = UTF8ToString(initEventInfo); + var initInfo = JSON.parse(initInfoFromCS); + var tyInitParams = {}; + tyInitParams.appId = initInfo.tuyooParam.appId; + tyInitParams.gameId = initInfo.tuyooParam.gameId; + tyInitParams.pay_version = "hall37"; + tyInitParams.baseurl = initInfo.tuyooParam.serverUrl.endsWith("/") ? initInfo.tuyooParam.serverUrl : initInfo.tuyooParam.serverUrl + "/"; + tyInitParams.bi_base_url = "https://cbi.tuyoo.com/"; + tyInitParams.cloudId = initInfo.tuyooParam.cloudId; + tyInitParams.packageName = initInfo.package; + tyInitParams.clientId = initInfo.tuyooParam.clientId; + tyInitParams.ali_appId = initInfo.login.aliminigame.ali_appId; + console.log("initInfo: " + JSON.stringify(initInfo)); + window.TuyooSdk.OnInit(initInfo.tuyooParam.channelType, tyInitParams, initCallback, this); + } catch (e) { + console.error("InitToBridge catch error: " + e); + } + }, + + // 切换SDK域名 + UpdateServerUrlToBridge: function (serverUrl) { + try { + var serverUrlFromCS = UTF8ToString(serverUrl); + window.TuyooSdk.baseuri = (serverUrlFromCS.substring(serverUrlFromCS.length - 1) === '/') ? serverUrlFromCS.substring(0, serverUrlFromCS.length - 1) : serverUrlFromCS; + console.log("update serverUrl to: " + window.TuyooSdk.baseuri); + } catch (e) { + console.error("UpdateServerUrlToBridge catch error: " + e); + } + }, + + LoginToBridge: function (loginEventInfo) { + try { + var loginCallback = function (code, result, error) { + var callbackResult = { + code: code, + result: result && result.logindata ? result.logindata : result, + error: error + }; + var callbackString = JSON.stringify(callbackResult); + SendMessage("NativeCallBack", "LoginResult", callbackString); + } + var loginInfoFromCS = UTF8ToString(loginEventInfo); + var loginInfo = JSON.parse(loginInfoFromCS); + var tyLoginParams = {}; + if (loginInfo.loginType) { + tyLoginParams.ChannelType = loginInfo.loginType; + } + if (loginInfo.extraParams) { + var extraParams = JSON.parse(loginInfo.extraParams); + tyLoginParams.extraParams = extraParams; + } + console.log("tyLoginParams: " + JSON.stringify(tyLoginParams)); + window.TuyooSdk.Login(tyLoginParams, loginCallback, this); + } catch (e) { + console.error("LoginToBridge catch error: " + e); + } + }, + + PayToBridge: function (payEventInfo) { + try { + var payCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "PayResult", callbackString); + } + var payInfoFromCS = UTF8ToString(payEventInfo); + var payInfo = JSON.parse(payInfoFromCS); + var tyPayParams = {}; + tyPayParams.prodCount = 1; + tyPayParams.appInfo = ""; + if (payInfo.chargeService) { + tyPayParams.ChargeType = payInfo.chargeService; + } + if (payInfo.productCount) { + tyPayParams.prodCount = payInfo.productCount; + } + if (payInfo.serverAppInfo) { + tyPayParams.appInfo = payInfo.serverAppInfo; + } + if (payInfo.gameOrderId) { + tyPayParams.prodOrderId = payInfo.gameOrderId; + } + if (payInfo.extraParams) { + var extraParams = JSON.parse(payInfo.extraParams); + tyPayParams.extraParams = extraParams; + } + tyPayParams.prodId = payInfo.productId; + tyPayParams.prodName = payInfo.productName; + tyPayParams.prodPrice = payInfo.productPrice; + console.log("tyPayParams: " + JSON.stringify(tyPayParams)); + window.TuyooSdk.Pay(tyPayParams, payCallback, this); + } catch (e) { + console.error("PayToBridge catch error: " + e); + } + }, + + SetShareInfoToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var shareInfoToJs = shareInfo.resource; + shareInfoToJs.callback = shareCallback; + console.log("shareInfoToJs: " + JSON.stringify(shareInfoToJs)); + window.TuyooSdk.SetDefaultShareInfo(shareInfoToJs); + } catch (e) { + console.error("SetShareInfoToBridge catch error: " + e); + } + }, + + ShareToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var shareInfoToJs = shareInfo.resource; + console.log("shareInfoToJs: " + JSON.stringify(shareInfoToJs)); + window.TuyooSdk.Share(shareInfoToJs, shareCallback); + } catch (e) { + console.error("ShareToBridge catch error: " + e); + } + }, + + GAEventTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + if (!reportInfo.typeName) { + reportInfo.typeName = "track"; + } + window.TuyooSdk.bi.trackWithType(reportInfo.typeName, reportInfo.eventName, reportInfo.reportEvent); + } catch (e) { + console.error("GAEventTrackToBridge catch error: " + e); + } + }, + + GAProfileTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + window.TuyooSdk.bi.profileTrack(reportInfo.profileType, reportInfo.profileSubjectType, reportInfo.profileSubjectPrimary, reportInfo.reportEvent); + } catch (e) { + console.error("GAProfileTrackToBridge catch error: " + e); + } + }, + + GetShareInfoBridge: function (shareEventInfo) { + console.error("current channel not support GetShareInfo function"); + }, + + GetAdInfoBridge: function () { + console.error("current channel not support GetAdInfo function"); + }, + + TxAdSDKReportToBridge: function (txAdReportInfo) { + console.error("current channel not support TxAdSDKReport function"); + }, + + CheckBindToBridge: function (bindEventInfo) { + console.error("current channel not support CheckBind function"); + }, + + SendSmsCodeToBridge: function (loginEventInfo) { + console.error("current channel not support SendSmsCode function"); + }, + + BindToBridge: function (bindEventInfo) { + console.error("current channel not support Bind function"); + }, + + SetWxUserInfoToBridge: function (type, userInfo) { + console.error("current channel not support SetWxUserInfo function"); + }, + + GetDeviceLevelToBridge: function() { + try { + var callback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "GetDeviceLevelResult", callbackString); + } + window.TuyooSdk.getDeviceBenchmarkLevel(callback, this); + } catch (error) { + console.error("GetDeviceLevelToBridge catch error: " + error); + } + }, + + CreatGridGamePanelToBridge: function(gridGameModule) { + console.error("current channel not support CreatGridGamePanel function"); + }, + + ShowGridGamePanelToBridge: function(panelId) { + console.error("current channel not support ShowGridGamePanel function"); + }, + + HideGridGamePanelToBridge: function(panelId) { + console.error("current channel not support HideGridGamePanel function"); + }, + + DestroyGridGamePanelToBridge: function(panelId) { + console.error("current channel not support DestroyGridGamePanel function"); + } + +} + +mergeInto(LibraryManager.library, TuyooSdkBridge); \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/TyJsBridge.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/TyJsBridge.js.meta new file mode 100644 index 0000000..19f554f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/TyJsBridge.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9ba02a912db5c43fe8d5e99add46e7e0 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/tuyoosdk_aliminigame_1.0.4.250915_release.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/tuyoosdk_aliminigame_1.0.4.250915_release.js new file mode 100644 index 0000000..60aa08f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/tuyoosdk_aliminigame_1.0.4.250915_release.js @@ -0,0 +1,3 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TuyooSdk=t():e.TuyooSdk=t()}(this,function(){return function(e){function t(i){if(o[i])return o[i].exports;var n=o[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,exports,t){function o(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var i,n,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=t(1),l=t(2),c=t(3),d=t(4),u=t(6),_=t(5),p=t(7),f=s.extend((r={baseuri:{get:function(){return this._baseuri},set:function(e){this._baseuri=e}},sdkRoute:{set:function(e){this._sdkRoute=e},get:function(){return void 0===this._sdkRoute||""===this.sdkRoute?"/open/v6/user/LoginBySnsIdNoVerify":this._sdkRoute}},payversion:{get:function(){return this._payversion},set:function(e){this._payversion=e}},clientId:{get:function(){return this._clientId},set:function(e){this._clientId=e}},packageName:{get:function(){return this._packageName},set:function(e){this._packageName=e}},appId:{get:function(){return this._appId},set:function(e){this._appId=e}},gameId:{get:function(){return this._gameId},set:function(e){this._gameId=e}},userId:{get:function(){return this._userId},set:function(e){this._userId=e}},token:{get:function(){return this._token},set:function(e){this._token=e}},logindata:{get:function(){return this._logindata},set:function(e){this._logindata=e}},ctor:function(){this.bi=new d},uuid:function(){if(this.IsNull(this._uuid))try{var e=this.LocalStorage().GetItem("ty_uuid");this.IsNull(e)?(this._uuid=this.CreateUUID(32,16),this.LocalStorage().SetItem("ty_uuid",this._uuid)):this._uuid=e}catch(e){return this.CreateUUID(32,16)}return this._uuid},CheckChannel:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t.tyPlatform))return t.tyPlatform}}return null},CheckParams:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t))return t}}return null},Decode:function(e){return c.decode(e)},IsNull:function(e){return void 0===e||null===e||""===e},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":a(t))||!t)}catch(e){return!1}},StartupParameter:function(){return this.platform().StartupParameter(this)},orderuri:function(){return"hall37"===this.payversion?this.baseuri+"/open/v4/pay/order":"hall51"===this.payversion?this.baseuri+"/open/v5/pay/order":this.baseuri+"/open/v4/pay/order"},platform:function(e){return this.IsNull(e)&&(e=this.type),p.tyLoginInterface[e]},platformPay:function(e){return p.tyPayInterface[e]},OnInitDebuger:function(e,t){var o="https://downqn.tuyoo.com/h5sdk/v100/js/vconsole.min.js";this.loadScript(o,function(o,i){if(0===o){new VConsole;console.log("----------tuyoosdk.OnInit-->initdebug:"),e.call(t,o,i,null)}else e.call(t,1005,null,"失败")})},OnInit:function(e,t,o,i){var n=this;console.log("----------tuyoosdk.OnInit-->channel:",e),t.debug&&n.OnInitDebuger(function(e,t,o){console.log(window.location.href,e,t,o)},n),n.TuyooInit(e,t,o,i)},SetDefaultShareInfo:function(e){this.IsNull(this.platform().SetDefaultShareInfo)||this.platform().SetDefaultShareInfo(this,e)},Share:function(e,t){this.IsNull(this.platform().Share)?t&&t.call(this,_.shareCode.fail,null,""+this.type+"不支持分享"):this.platform().Share(this,e,t)},CallMethod:function(e,t,o,i){var n=this.IsNull(t.ChannelType)?this.type:t.ChannelType;if(!this.IsNull(this.platform(n))&&"function"==typeof this.platform(n)[e]){var r=[this,t,o];return this.platform(n)[e].apply(i,r)}o&&o.call(this,_.initCode.fail,null,""+n+"不支持此功能("+e+")")},TuyooInit:function(e,t,o,i){var n=this;n.config=t;var r=(new Date).getTime(),a=function(e,t,a){0===e&&n.bi.ReportGAWithType(n,n.bi.GA_TYPE.TRACK,u.GAEvents.SDK_INIT_ENT,{sdk_init_duration_time:(new Date).getTime()-r});var s=[];for(var l in arguments)s.push(arguments[l]);o.apply(i,s)};if(n.IsNull(t.wxAppId)||(n.wxAppId=t.wxAppId),void 0===t.bi_base_url&&(t.bi_base_url="https://cbi.tuyoo.com/"),n.IsNull(t.pay_version)&&(t.pay_version="hall37"),"hall37"!==t.pay_version&&"hall51"!==t.pay_version)return void o.call(i,_.initCode.fail,null,"pay_version 必须为 hall37|hall51");if(this.IsNull(t.userId)?this.userId=0:this.userId=t.userId,console.log("----------tuyoosdk.OnInit-->config:",t),n.IsNull(t.clientId))if(n.IsNull(this.InitClientId())){if(!t.debug)return void o.call(i,_.initCode.fail,null,"clientId不能为空");t.clientId="Android_4.58_meitu.meitu.0-hall6.meitu.tu"}else t.clientId=this.InitClientId();this.type=e,this.appId=t.appId,this.gameId=t.gameId,this.clientId=t.clientId,this.payversion=t.pay_version,this.baseuri="/"===t.baseurl.substring(t.baseurl.length-1)?t.baseurl.substring(0,t.baseurl.length-1):t.baseurl,this.bi_base_uri="/"===t.bi_base_url.substring(t.bi_base_url.length-1)?t.bi_base_url.substring(0,t.bi_base_url.length-1):t.bi_base_url,this.packageName=t.packageName,console.log("----------tuyoosdk.OnInit-->clientId:",this.clientId),console.log("----------tuyoosdk.OnInit-->baseuri:",this.baseuri),console.log("----------tuyoosdk.OnInit-->platform:",this.platform()),this.bi.OnInit(this,t,function(r,s,l){0===r?(n.platform().OnInit(n,t,a,n),n.InitOtherThird(e,t,a,i)):o.call(i,r,s,l)},this)},InitOtherThird:function(e,t,o,i){for(var n in p.tyInitInterface)if(n!==e){var r=function(e,t,o){console.log("----------tuyoosdk.InitOtherThird-->type:",n," status: ",e)};p.tyInitInterface[n].OnInit(this,t,r,this)}},Is:function(e){var t=this.platform(e);return!this.IsNull(t)&&t.Is()},InitClientId:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(this.IsNull(e)===!1){var t=this.GetQueryToMap(e.substr(1,e.length));return this.IsNull(t.clientId)===!1?t.clientId:null}return null}return null},Login:function(e,t,o){var i=this;this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_login_track_id||""===e.extraParams.sdk_login_track_id?e.sdk_login_track_id=this.CreateUUID(32,16):e.sdk_login_track_id=e.extraParams.sdk_login_track_id:e.sdk_login_track_id=this.CreateUUID(32,16),this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),i.IsNull(i.platform(e.ChannelType).realLogin)?this.realLogin(e,t,o):i.platform(e.ChannelType).realLogin(i,e,t,o)},GetUserInfo:function(e,t,o){this.IsNull(this.platform().GetUserInfo)?console.error(this.platform().ChannelType+" not support GetUserInfo"):this.platform().GetUserInfo(this,e,t,o)},realLogin:function(e,t,o){var i=this,n={sdk_login_channel_type:i.platform(e.ChannelType).ChannelType,sdk_login_track_id:e.sdk_login_track_id};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_START,n);var r=function(r,a,s){var l=i.convertLoginServerResultCode(r);0===l?(i.userId=a.userId,i.token=a.token,i.userPwd=a.userPwd,i.logindata=a.logindata,i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_SUCC,n),t&&t.call(o,_.loginCode.success,a,s)):(n.sdk_error_code=r,n.sdk_error_msg=JSON.stringify(s),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_FAIL,n),t&&t.call(o,l,a,s));try{i.IsNull(i.platform(e.ChannelType).LoginEnd)||i.platform(e.ChannelType).LoginEnd(r,a,s)}catch(e){console.log("----------tuyoosdk.LoginEnd-->err:",e)}},a={retryMax:1,url:i.baseuri+this.sdkRoute.get(),postdata:{imei:"null",idfa:"",appId:i.appId,gameId:i.gameId,clientId:i.clientId,packageName:i.packageName,uuid:i.uuid(),sdk_session_id:i.bi.sessionId,original_deviceid:i.uuid(),sdk_login_track_id:e.sdk_login_track_id}};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)i.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,n,a){console.log("===========>snsHook",o,n),0===t?i.IsNull(i.platform(e.ChannelType).tuyooLogin)?i.tuyooLogin(o,r,a):i.platform(e.ChannelType).tuyooLogin(o,r,a):r.call(i,_.loginCode.fail,null,n)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(i,e,a,l)},tuyooLogin:function(e,t,o){var i=this;console.log("tuyoo-login-request",e);var n={sdk_login_channel_type:i.platform().ChannelType,sdk_login_track_id:e.postdata.sdk_login_track_id};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_START,n);try{this.HttpLib(e,function(e,r){console.log("tuyoo-login-response",e,r);var a=JSON.parse(r.data);if(i.IsNull(a.result))n.sdk_error_msg=JSON.stringify(a),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,_.loginCode.fail,null,a);else if(0===a.result.code){var s={userId:a.result.userId,token:a.result.token,userPwd:a.result.userPwd,logindata:a.result};if(!i.IsNull(o))for(var l in o)s[l]=o[l];i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_SUCC,n),t.call(i,a.result.code,s)}else n.sdk_error_code=a.result.code,n.sdk_error_msg=JSON.stringify(a.result),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,a.result.code,null,a.result.info)},function(e,o){n.sdk_error_code=e,n.sdk_error_msg=JSON.stringify(o),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,_.loginCode.fail,null,o)},i)}catch(e){n.sdk_error_msg=JSON.stringify(e),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),console.log("tuyoo-login-catch",e),t.call(i,_.loginCode.fail,null,e)}},convertLoginServerResultCode:function(e){switch(e){case 0:return _.loginCode.success;case 12010:return 100201;case 12017:case 12130:return 100206;case 10:return 100502;case 100504:return 100504;default:return _.loginCode.fail}},Logout:function(){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(this)}},o(r,"Logout",function(e,t){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(e,t)}),o(r,"Bind",function(e,t,o){this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),this.realBind(e,t,o)}),o(r,"realBind",function(e,t,o){var i=this,n={sdk_login_channel_type:i.platform(e.ChannelType).ChannelType};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_START,n);var r=function(e,r,a){var s=i.convertLoginServerResultCode(e);0===s?(i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_SUCC,n),t&&t.call(o,_.loginCode.success,r,a)):(n.sdk_error_code=e,n.sdk_error_msg=JSON.stringify(a),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_FAIL,n),t&&t.call(o,s,r,a))};if(i.IsNull(i.userId)||0===i.userId||"0"===i.userId)return void r(_.loginCode.fail,null,"Do not login");var a={retryMax:1,url:i.baseuri+"/open/v6/user/bindBySnsId",postdata:{imei:"null",appId:i.appId,gameId:i.gameId,clientId:i.clientId,packageName:i.packageName,uuid:i.uuid(),sdk_session_id:i.bi.sessionId,original_deviceid:i.uuid(),userId:i.userId,passwd:i.userPwd}};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)i.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,n,a){console.log("===========>snsHook",o,n),0===t?i.IsNull(i.platform(e.ChannelType).tuyooBind)?i.tuyooBind(o,r,a):i.platform(e.ChannelType).tuyooBind(o,r,a):r.call(i,_.loginCode.fail,null,n)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(i,e,a,l)}),o(r,"tuyooBind",function(e,t,o){var i=this;console.log("tuyoo-bind-request",e);try{this.HttpLib(e,function(e,o){console.log("tuyoo-bind-response",e,o);var n=JSON.parse(o.data);i.IsNull(n.result)?t.call(i,_.loginCode.fail,null,n):0===n.result.code?t.call(i,n.result.code,n.result):t.call(i,n.result.code,n.result,n.result.info)},function(e,o){t.call(i,_.loginCode.fail,null,o)},i)}catch(e){console.log("tuyoo-bind-catch",e),t.call(i,_.loginCode.fail,null,e)}}),o(r,"Pay",function(e,t,o){console.log("==========>start pay "),this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_order_track_id||""===e.extraParams.sdk_order_track_id?e.sdk_order_track_id=this.CreateUUID(32,16):e.sdk_order_track_id=e.extraParams.sdk_order_track_id:e.sdk_order_track_id=this.CreateUUID(32,16),this.IsNull(e.ChargeType)&&(e.ChargeType=this.platform().ChargeType),this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_START,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_pay_type:e.ChargeType}),"tuyoo"!==e.ChargeType?this.realPay(e,t,o,e.ChargeType):this.payui(e,t,o)}),o(r,"isString",function(e){return"[object String]"===Object.prototype.toString.call(e)}),o(r,"Order",function(e,t,o){var i=this;if(void 0===e.prodCount&&(e.prodCount=1),void 0===e.appInfo&&(e.appInfo=""),void 0===e.prodOrderId&&(e.prodOrderId=""),i.IsNull(i.wxAppId)||(e.wxAppId=i.wxAppId),console.log("------- self.platformPay(args.ChargeType) ----------",i.platformPay(e.ChargeType)),!i.IsNull(i.platformPay(e.ChargeType).Order))return i.platformPay(e.ChargeType).Order(i,e,t,o);if(i.IsNull(i.userId)||0===i.userId||"0"===i.userId)return this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:_.payCode.fail,sdk_error_msg:"用户信息不合法",sdk_pay_type:e.ChargeType}),void t.call(o,_.payCode.fail,null,"用户信息不合法");var n={imei:"null",chargeType:e.ChargeType,userId:i.userId,appId:i.appId,gameId:i.gameId,mustcharge:"1",uuid:i.uuid(),clientId:i.clientId,prodId:e.prodId,prodName:e.prodName,prodCount:e.prodCount,prodPrice:e.prodPrice,appInfo:e.appInfo,prodOrderId:e.prodOrderId,sdk_session_id:i.bi.sessionId,sdk_order_track_id:e.sdk_order_track_id,original_deviceid:i.uuid()};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var r in e.extraParams)i.IsNull(n[r])&&(n[r]=e.extraParams[r]);i.platformPay(e.ChargeType).ExtraOrderParams(i,e,n);var a={url:i.orderuri(),postdata:n};i.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_START,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId}),i.HttpLib(a,function(r,a){var s;if(s=i.isString(a.data)?JSON.parse(a.data):a.data,s&&null!==s.result)if(0===s.result.code){var l=s.result.chargeInfo;i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_SUCC,{sdk_pay_type:l.chargeType,sdk_order_id:l?l.platformOrderId:"DEFAULT",sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id});var c;try{c=s.result.payData}catch(e){c=null,console.log("=============> 没有paydata数据",e)}var d=function(n,r,a){var s={sdk_pay_type:l.chargeType,sdk_order_id:l.platformOrderId,sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id};0===n?i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_SUCC,s):n===_.payCode.navigatePayPageSucc?i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_LAUNCH_SUCC,s):(s.sdk_error_code=n,s.sdk_error_msg=a,i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,s));var c=[];for(var d in arguments)c.push(arguments[d]);t.apply(o,c)};console.log(e.ChargeType),l.sdk_order_track_id=e.sdk_order_track_id,i.platformPay(e.ChargeType).Pay(i,l,c,d,i)}else{if(i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:s.result.code,sdk_error_msg:JSON.stringify(s.result)}),!i.IsNull(i.platformPay(e.ChargeType).dealOrderFail)){var p=function(n,r,a){console.log("=============> dealOrderFail hook status",n),n===_.dealOrderFailCode.needReOrder?i.Order(e,t,o):this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,_.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)};return void i.platformPay(e.ChargeType).dealOrderFail(i,s.result,p)}this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,_.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)}else i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:"DEFAULT",sdk_error_msg:JSON.stringify(s)}),t.call(o,_.payCode.fail,null,s)},function(r,a){i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:r,sdk_error_msg:a}),t.call(o,_.payCode.fail,null,a)},i)}),o(r,"realNameAuth",function(e,t){var o=this,i=function(e,i,n){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("----------tuyoosdk.realNameAuth-->err:",e)}},n={retryMax:1,url:o.baseuri+"/open/v6/user/update/sync/third",postdata:{imei:"null",idfa:"",appId:o.appId,gameId:o.gameId,clientId:o.clientId,packageName:o.packageName,uuid:o.uuid(),userId:o.userId}},r=function(e,t,n){console.log("===========>snsHook",t,n),0===e?o.IsNull(o.platform().syncThird)?o.syncThird(t,i):o.platform().syncThird(t,i):i.call(o,_.verifyCode.fail,null,n)};o.IsNull(o.platform().realNameAuth)?t.call(o,_.verifyCode.fail,null,"无渠道实名方法"):this.platform().realNameAuth(o,e,n,r)}),o(r,"syncThird",function(e,t){var o=this;console.log("tuyoo-syncThird-request",e),o.HttpLib(e,function(e,i){if(o.isString(i.data))var n=JSON.parse(i.data);else var n=i.data;n.result&&null!==n.result?(console.log("syncThird=============> "+JSON.stringify(n.result)),0===n.result.code?t.call(o,_.verifyCode.success,n.result,null):t.call(o,_.verifyCode.fail,null,n.result.info)):t.call(o,_.verifyCode.fail,null,n)},function(e,i){t.call(o,_.verifyCode.fail,null,i)},o)}),o(r,"ShowBuoy",function(){this.platform().ShowBuoy()}),o(r,"HideBuoy",function(){this.platform().HideBuoy()}),o(r,"ShoutCat",function(){this.platform().ShoutCat()}),o(r,"OnExit",function(){this.platform().onExit()}),o(r,"onExit",function(e){this.platform().onExit(e)}),o(r,"HttpLib",function(e,t,o,i){var n=this;void 0===e.retry&&(e.retry=0),void 0===e.retryMax&&(e.retryMax=0),void 0===e.method&&(e.method="POST"),void 0===e.headers&&(e.headers={"content-type":"application/x-www-form-urlencoded"});var r=function(e){l.ajax(n,e)};try{var a=this.platform(),s=!1;if("dmm.global.h5"!==a.ChannelType?s=!0:e.url!==n.config.bi_base_url+"api/bilog5/ga"&&(s=!0),s){var c=a.HttpLib;this.IsNull(c)||(r=function(e){c.call(a,n,e)})}}catch(e){}r({url:e.url,type:e.method,dataType:"json",headers:e.headers,data:e.postdata,success:function(r){console.log(e.url,">>请求结果》》》",r);try{var a={data:r.responseText,status:r.status},s={};"string"==typeof a.data?s=JSON.parse(a.data):(s=a.data,a.data=JSON.stringify(a.data)),n.IsNull(s.error)===!1?o.call(i,1009,s):t.call(i,0,a)}catch(e){t.call(i,0,a)}},error:function(r){console.log("网络异常",e.url),e.retry

"+e.prodName+'

\t
  • 微信支付
  • \t
  • 支付宝支付
  • \t

    选择支付方式

    ¥ '+e.prodPrice+"

    "+e.prodName+'

    \t
    \t\t
    微信支付
    \t\t
    支付宝支付
    \t
    ',l=document.createElement("div");l.setAttribute("id","payui"),l.innerHTML=s,document.getElementsByTagName("body")[0].appendChild(l)}),o(r,"realPay",function(e,t,o,i,n){var r=this;if(!this.IsNull(n)){console.log("==========>start pay ");var a=n||event;a.stopPropagation()}e.ChargeType=i;var s=function(e,i,n){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("应用层代码出错了--->"),console.log(e)}};try{r.Order(e,s,r)}catch(e){console.log("order error--->",e.toString())}}),o(r,"hidePay",function(e){var t=document.getElementById("payui");document.getElementsByTagName("body")[0].removeChild(t)}),o(r,"LoginByToken",function(e,t){var o=this,i={appId:e.appId,clientId:e.clientId,token:e.token,imei:null},n={url:o.baseuri+"/open/v4/user/loginByToken",postdata:i};o.HttpLib(n,function(e,i,n){if(0===e){var r=JSON.parse(i.data);if(null!==r.result)if(console.log("--------->message",r),0===r.result.code){var a={userId:r.result.userId,token:r.result.token,logindata:r.result};o.userId=r.result.userId,t.call(o,_.loginCode.success,a,null)}else t.call(o,_.loginCode.fail,null,r.result)}})}),o(r,"QueryOrderStatus",function(e,t){var o=this,i={appId:o.config.appId,clientId:o.config.clientId,platformOrderId:e.platformOrderId,userId:o.userId},n={url:o.baseuri+"/open/v4/pay/query",postdata:i};o.HttpLib(n,function(e,i,n){if(0===e){var r=JSON.parse(i.data);if(void 0!==r.error&&t.call(o,_.payCode.fail,null,"orderId not exist"),void 0!==r.result){var a={status:"notPaid"},e=r.result.status;"41"===e.toString()&&(a.status="paid",t.call(o,_.payCode.success,a,null)),t.call(o,_.payCode.success,a,null)}}})}),o(r,"Ad",function(){return this.IsNull(this.platform().Ad)?void console.error(this.platform().ChannelType+" not support Ad"):this.platform().Ad()}),o(r,"getDeviceBenchmarkLevel",function(e,t){this.IsNull(this.platform().getDeviceBenchmarkLevel)?console.error(this.platform().ChannelType+" not support getDeviceBenchmarkLevel"):this.platform().getDeviceBenchmarkLevel(this,e,t)}),r)),h=new f;!function(o,r){"object"===a(exports)?e.exports=r():(i=r,n="function"==typeof i?i.call(exports,t,exports,e):i,!(void 0!==n&&(e.exports=n)))}(void 0,function(){return h})},function(e,exports,t){function o(e){function t(){}return t.prototype=e,new t}function i(e,t){var i;i="function"==typeof Object.create?Object.create(t.prototype):o.create(t.prototype),i.constructor=e,e.prototype=i}var n,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function e(t,o){return function(){function n(){if("undefined"==typeof n.prototype.ctor);else{var e=new Array;for(var t in arguments)e.push(arguments[t]);n.prototype.ctor.apply(this,e)}}var r=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/,_super=t.prototype;i(n,t);var a=n.prototype;"undefined"==typeof _super||"undefined"==typeof _super.ctor&&(_super.ctor=t),n.extend=function(t){return e(n,t)};for(var s in o)a[s]="function"==typeof o[s]&&"function"==typeof _super[s]&&r.test(o[s])?function(e,t){return function(){var o=this._super;this._super=_super[e];var i=new Array;for(var n in arguments)i.push(arguments[n]);var r=t.apply(this,i);return this._super=o,r}}(s,o[s]):o[s];return n}()},l=s(function(){},{});!function(o,i){"object"===a(exports)?e.exports=i():(n=i,r="function"==typeof n?n.call(exports,t,exports,e):n,!(void 0!==r&&(e.exports=r)))}(void 0,function(){return l})},function(e,exports,t){"use strict";var o=t(1),i=o.extend({IsWxApp:function(){try{if(void 0!==wx.request)return!0}catch(e){return!1}},IncludeWxChannel:function(e){return"xiaomi.cn.minigame"===e.type},ajax:function(e,t){if(t=t||{},t.cache=t.cache||!1,!t.url)throw new Error("参数不合法");if(this.IsWxApp()&&!this.IncludeWxChannel(e)){t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{};var o=this.formateParams(t.data,t.cache);"GET"===t.type?(t.url=o?t.url+"?"+o:t.url,wx.request({url:t.url,method:"GET",header:{Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})):wx.request({url:t.url,method:"POST",data:o,header:{"content-type":"application/x-www-form-urlencoded",Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})}else t.dataType=(t.dataType||"json").toLowerCase(),"jsonp"==t.dataType?this.ajaxJSONP(t):"json"==t.dataType&&this.ajaxJSON(t)},ajaxJSONP:function(e){e.data=e.data||{},e.jsonp=e.jsonp||"callback";var t="jsonp_"+(new Date).getTime();e.data[e.jsonp]=t;var o=this.formateParams(e.data,e.cache),i=document.getElementsByTagName("head")[0],n=document.createElement("script");i.appendChild(n),window[t]=function(o){i.removeChild(n),clearTimeout(n.timer),window[t]=null,e.success&&e.success(o)},n.src=o?e.url+"?"+o:e.url,e.time&&(n.timer=setTimeout(function(){window[t]=null,i.removeChild(n),e.error&&e.error({message:"超时"})},e.time))},ajaxJSON:function(e){e.type=(e.type||"GET").toUpperCase(),e.data=e.data||{};var t,o=this.formateParams(e.data,e.cache);if(t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),t.onreadystatechange=function(){4===t.readyState&&(200===t.status?e.success&&("string"==typeof t.responseText?e.success(t):e.success(t)):e.error&&e.error(t.status))},"GET"===e.type)t.open("GET",o?e.url+"?"+o:e.url,!0),t.send(null);else{if(e.headers&&"application/json"==e.headers["Content-Type"]){t.open("POST",e.url,!0);for(var i in e.headers)t.setRequestHeader(i,e.headers[i]);return void t.send(JSON.stringify(e.data))}t.open("POST",o?e.url+"?"+o:e.url,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(o)}},formateParams:function(e,t){var o=[];for(var i in e)o.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t&&o.push("v="+(new Date).getTime()),o.join("&")}});e.exports=new i},function(e,exports,t){var o,i,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=t(1),a=r.extend({_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",checkOs:function(){var e=navigator.userAgent,t=(navigator.appVersion,e.indexOf("Android")>-1||e.indexOf("Linux")>-1),o=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return t?"ANDROID":o?"IOS":void 0},getDeviceType:function(){return navigator&&navigator.userAgentData&&navigator.userAgentData.mobile?"Mobile":/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?"Mobile":"Browser"},encode:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},decode:function(e){return decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))},open_pay_url:function(e){this.showDetail(event,e)},pay_url:function(e){if("IOS"==s.checkOs()){console.log("pay ios ===>",e);var t=document.createElement("iframe");t.href=e,t.target="_self",top.location.href=location.href,t.click(),window.location.href=e,setTimeout(function(){document.body.removeChild(t)},3e3)}else{console.log("pay android ===>",e);var o=document.createElement("a");o.href=e,document.body.appendChild(o),o.click(),document.body.removeChild(o)}},showDetail:function(e,t){window.tysdk=this;var o=document.getElementsByTagName("head")[0],i="https://downqn.tuyoo.com/h5sdk/v100/src/css/style.css",n=document.createElement("link");n.href=i,n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css");var r=document.createElement("meta");r.setAttribute("name","viewport"),r.setAttribute("content","width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes"),o.appendChild(r),o.appendChild(n);var a='
    充值中心 X
    ',s=document.createElement("div");s.setAttribute("id","detailui"),s.innerHTML=a,document.getElementsByTagName("body")[0].appendChild(s)},fadeoutDetail:function(e){var t=e||event;t.stopPropagation();var o=document.getElementById("detailui");document.getElementsByTagName("body")[0].removeChild(o)},changeFrameHeight1:function(){var e=document.getElementById("myiframe");e.height=document.documentElement.clientHeight; +},Login_SIGN:function(e,t,o,i){var n=this.decode(i),r="userID="+e+"&clientID="+t+"&gameID="+o+"&signKey="+n;return this.signature(r)},signature:function(e){function t(e,t){var o,i,n,r,a;return n=2147483648&e,r=2147483648&t,o=1073741824&e,i=1073741824&t,a=(1073741823&e)+(1073741823&t),o&i?2147483648^a^n^r:o|i?1073741824&a?3221225472^a^n^r:1073741824^a^n^r:a^n^r}function o(e,o,i,n,r,a,s){return e=t(e,t(t(o&i|~o&n,r),s)),t(e<>>32-a,o)}function i(e,o,i,n,r,a,s){return e=t(e,t(t(o&n|i&~n,r),s)),t(e<>>32-a,o)}function n(e,o,i,n,r,a,s){return e=t(e,t(t(o^i^n,r),s)),t(e<>>32-a,o)}function r(e,o,i,n,r,a,s){return e=t(e,t(t(i^(o|~n),r),s)),t(e<>>32-a,o)}function a(e){var t,o="",i="";for(t=0;3>=t;t++)i=e>>>8*t&255,i="0"+i.toString(16),o+=i.substr(i.length-2,2);return o}var s,l,c,d,u,_,p,f,h=[];for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",o=0;oi?t+=String.fromCharCode(i):(127i?t+=String.fromCharCode(i>>6|192):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128)),t+=String.fromCharCode(63&i|128))}return t}(e),h=function(e){var t,o=e.length;t=o+8;for(var i=16*((t-t%64)/64+1),n=Array(i-1),r=0,a=0;a>>29,n}(e),u=1732584193,_=4023233417,p=2562383102,f=271733878,e=0;e>5]|=(e.charCodeAt(r/8)&o)<>2]>>8*(r%4)&255)<<16|(t[r+1>>2]>>8*((r+1)%4)&255)<<8|t[r+2>>2]>>8*((r+2)%4)&255,s=0;s<4;s++)n+=8*r+6*s>32*t.length?"":i.charAt(a>>6*(3-s)&63);return n}}),s=new a;!function(r,a){"object"===n(exports)?e.exports=a():(o=a,i="function"==typeof o?o.call(exports,t,exports,e):o,!(void 0!==i&&(e.exports=i)))}(void 0,function(){return s})},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;t0){var i=function(o){t.deleteCache(e),t.reportCacheData()};this.httpRequestWithLimit(o,i)}else this.reportCacheData()},processArray2String:function(e){if(e){var t="";return e.forEach(function(e){t+=e+"\n"}),t}},reportCacheData:function(){var e=this.getCacheWithLimitCount(this.gaLocalCacheData,10);e&&e.length>0&&this.reportGALog(e)},getCacheWithLimitCount:function(e,t){if(e){for(var o=[],i=Array.from(e),n=i.length>t?t:i.length,r=0;r100&&this.gaLocalCacheData.shift())},deleteCache:function(e){var t=this;e&&this.gaLocalCacheData&&e.forEach(function(e){t.gaLocalCacheData.indexOf(e)>-1&&t.gaLocalCacheData.splice(t.gaLocalCacheData.indexOf(e),1)})},httpRequest:function(e){var t=this;this.config&&this.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var o={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(o,function(e,o){t.tuyoo.config&&t.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+o)},function(e,t){console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})},httpRequestWithLimit:function(e,t){var o=this;if(!this.biLimitState){this.biLimitState=!0,this.tuyoo.config&&this.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var i={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(i,function(e,i){o.biLimitState=!1,200==i.status&&t&&t(i.data),o.tuyoo.config&&o.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+i)},function(e,t){o.biLimitState=!1,console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})}}});e.exports=a},function(e,exports){"use strict";var t=t||{};t.initCode={success:0,fail:-1},t.loginCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.payCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1001,navigatePayPageSucc:1e3},t.smsCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.biCode={success:0,fail:-1},t.verifyCode={success:t.initCode.success,fail:t.initCode.fail},t.shareCode={success:t.initCode.success,fail:t.initCode.fail},t.dealOrderFailCode={continue:t.initCode.success,needReOrder:t.initCode.fail},t.loginEvent={success:"登录成功",fail:"登录失败",cancle:"登录取消",sns_error:"snsId为undefined"},t.payEvent={success:"支付成功",fail:"支付失败",cancle:"支付取消",invalid:"支付方式无效"},t.initEvent={success:"初始化成功",fail:"初始化失败",url_null:"初始化URL为空"},t.biEvent={success:"上报成功",fail:"上报失败"},t.verifyEvent={success:"认证成功",fail:"认证失败"},e.exports=t},function(e,exports){"use strict";var t={GAEvents:{SDK_INIT_ENT:"sdk_c_init_end",SDK_LOGIN_START:"sdk_c_login_start",SDK_LOGIN_SUCC:"sdk_c_login_succ",SDK_LOGIN_FAIL:"sdk_c_login_fail",SDK_BIND_START:"sdk_c_bind_start",SDK_BIND_SUCC:"sdk_c_bind_succ",SDK_BIND_FAIL:"sdk_c_bind_fail",SDK_CHANNEL_INIT_START:"sdk_c_channel_init_start",SDK_CHANNEL_INIT_SUCC:"sdk_c_channel_init_succ",SDK_CHANNEL_INIT_FAIL:"sdk_c_channel_init_fail",SDK_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_LOGIN_BY_SDKSERVER_START:"sdk_c_login_by_sdkserver_start",SDK_LOGIN_BY_SDKSERVER_SUCC:"sdk_c_login_by_sdkserver_succ",SDK_LOGIN_BY_SDKSERVER_FAIL:"sdk_c_login_by_sdkserver_fail",SDK_PAY_START:"sdk_c_pay_start",SDK_PAY_SUCC:"sdk_c_pay_succ",SDK_PAY_FAIL:"sdk_c_pay_fail",SDK_PAY_LAUNCH_SUCC:"sdk_c_pay_launch_succ",SDK_C_ORDER_START:"sdk_c_order_start",SDK_C_ORDER_SUCC:"sdk_c_order_succ",SDK_C_ORDER_FAIL:"sdk_c_order_fail",SDK_C_REQUEST_CHANNEL_PAY_START:"sdk_c_request_channel_pay_start",SDK_C_REQUEST_CHANNEL_PAY_SUCC:"sdk_c_request_channel_pay_succ",SDK_C_REQUEST_CHANNEL_PAY_FAIL:"sdk_c_request_channel_pay_fail",SDK_C_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_C_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_C_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_SHARE_START:"sdk_c_share_start",SDK_SHARE_SUCC:"sdk_c_share_succ",SDK_SHARE_FAIL:"sdk_c_share_fail",SDK_C_GAME_LAUNCH:"sdk_c_game_launch",SDK_C_VERIFY:"sdk_c_verify"}};e.exports=t},function(e,exports,t){"use strict";var o=t(8),i=new o,n={"ali.cn.minigame":i},r={"ali.cn.minigame.iap":i},a={"ali.cn.minigame":i};e.exports={tyLoginInterface:n,tyPayInterface:r,tyInitInterface:a}},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;tstatus: "+e+" \n error : "+o),100504==e&&this.loginParams.isShowLimitToast!==!1&&(this.tuyoo.bi.ReportGAWithType(this.tuyoo,this.tuyoo.bi.GA_TYPE.LOGIN,"sdk_c_receive_gateway_limit_info",{gateway_info:o}),my.showModal?my.showModal({title:"温馨提示",content:o||"当前玩家过多,请稍后再试~",showCancel:!1,success:function(e){console.log(e)},fail:function(e){console.log(e)}}):console.error("my.showModal function is unAvailable"))}catch(e){console.error("aliminigame LoginEnd",e)}},ExtraOrderParams:function(e,t,o){var i=this;o.chargeType=this.payType,o.ch_app_id=this.config.ali_appId,o.osName=this.systemInfo.platform,o.sdk_channel_platform=this.systemInfo.pcPlatform?this.systemInfo.pcPlatform:"",this.sdk_game_zone_id=t.sdk_game_zone_id||"",this.sdk_game_role_id=t.sdk_game_role_id||"",o.os_version=i.systemInfo&&i.systemInfo.system||"",o.sdk_origin_device_level_info=i.systemInfo&&i.systemInfo.performance||"",o.sdk_device_brand=i.systemInfo&&i.systemInfo.brand||"",o.phone_model=i.systemInfo&&i.systemInfo.model||""},Pay:function(e,t,o,i,n){var r=this;e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_START,r.getGaParams(t,null)),"ali.cn.minigame.ios"===t.chargeType?this.iOSPay(e,t,i,n):this.AndroidPay(e,t,i,n)},AndroidPay:function(e,t,o,i){var n=this;if(!my.canIUse("requestGamePayment"))return void n.PayCallbackFail(e,o,i,t,900511,"当前客户端版本不支持内购",900511);var a=t.chargeData;my.requestGamePayment({buyQuantity:a.buyQuantity,customId:t.platformOrderId,extraInfo:a.extraInfo,success:function(a){console.log("ali pay success: ",JSON.stringify(a)),e.IsNull(a)||"9000"!=a.resultCode?n.PayCallbackFail(e,o,i,t,a.resultCode,JSON.stringify(a),r.payCode.fail):n.PayCallbackSucc(e,o,i,t,JSON.stringify(a))},fail:function(a){console.log("ali pay fail: ",JSON.stringify(a)),n.PayCallbackFail(e,o,i,t,a.error,JSON.stringify(a),r.payCode.fail)},complete:function(e){console.log("ali pay complete: ",JSON.stringify(e))}})},iOSPay:function(e,t,o,i){var n=this;if(!my.canIUse("requestGamePayCoinPayment"))return void n.PayCallbackFail(e,o,i,t,900511,"当前客户端版本不支持iOS支付",900511);var a=t.chargeData,s=this.sdk_game_zone_id&&this.sdk_game_role_id?this.sdk_game_zone_id+"_"+this.sdk_game_role_id:this.sdk_game_zone_id?this.sdk_game_zone_id:"1";my.requestGamePayCoinPayment({customId:a.customId,zoneId:s,buyQuantity:a.buyQuantity,goodsName:t.diamondName,extraInfo:a.extraInfo,success:function(a){console.log("ali pay success: ",JSON.stringify(a)),!e.IsNull(a)&&a.success?n.PayCallbackSucc(e,o,i,t,JSON.stringify(a)):n.PayCallbackFail(e,o,i,t,3,JSON.stringify(a),r.payCode.fail)},fail:function(a){console.log("ali pay fail: ",JSON.stringify(a)),n.PayCallbackFail(e,o,i,t,a.error,JSON.stringify(a),r.payCode.fail)},complete:function(e){console.log("ali pay complete: ",JSON.stringify(e))}})},PayCallbackSucc:function(e,t,o,i,n){e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_SUCC,this.getGaParams(i,null)),t.call(o,r.payCode.success,n,null)},PayCallbackFail:function(e,t,o,i,n,r,s){e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,this.getGaParams(i,{sdk_channel_error_code:n,sdk_channel_error_msg:r})),t.call(o,s,null,r)},SetDefaultShareInfo:function(e,t){this.shareInfo=t},initShare:function(e){var t=this;this.IsNull(this.shareInfo)&&(this.shareInfo={}),my.onShareAppMessage=function(){var o={sdk_c_share_track_id:e.CreateUUID(),sdk_share_user_id:e.userId};return e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_START,o),{title:t.shareInfo.title,desc:t.shareInfo.desc,path:t.shareInfo.path,content:t.shareInfo.content,bgImgUrl:t.shareInfo.bgImgUrl,scImgUrl:t.shareInfo.scImgUrl,imageUrl:t.shareInfo.imageUrl,query:"inviteCode="+e.userId+"&extraInfo="+(t.shareInfo.extraInfo?t.shareInfo.extraInfo:""),success:function(i){console.log("onShareAppMessage success:"+JSON.stringify(i)),i.shareResult?(e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_SUCC,o),t.shareInfo&&t.shareInfo.callback&&t.shareInfo.callback.call(e,r.shareCode.success,JSON.stringify(i),null)):(o.sdk_channel_error_msg=JSON.stringify(i),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_FAIL,o),t.shareInfo&&t.shareInfo.callback&&t.shareInfo.callback.call(e,r.shareCode.fail,null,JSON.stringify(i)))},fail:function(i){console.log("onShareAppMessage fail:"+JSON.stringify(i)),o.sdk_channel_error_msg=JSON.stringify(i),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_FAIL,o),t.shareInfo&&t.shareInfo.callback&&t.shareInfo.callback.call(e,r.shareCode.fail,null,JSON.stringify(i))},complete:function(e){console.log("onShareAppMessage complete:"+JSON.stringify(e))}}}},Share:function(e,t,o){this.IsNull(t)||(this.shareInfo=t),this.IsNull(o)||(this.shareInfo.callback=o),my.canIUse("showSharePanel")&&my.showSharePanel({success:function(e){console.log("showSharePanel success:"+JSON.stringify(e))},fail:function(e){console.log("showSharePanel fail:"+JSON.stringify(e))},complete:function(e){console.log("showSharePanel complete:"+JSON.stringify(e))}})},getGaParams:function(e,t){var o={sdk_pay_type:"ali.cn.minigame.iap"};return!this.IsNull(e)&&this.isJSON(JSON.stringify(e))&&(o.sdk_pay_type=e.chargeType,o.sdk_order_track_id=e.sdk_order_track_id,o.sdk_order_id=e.platformOrderId,o.sdk_game_order_id=e.prodOrderId,o.sdk_product_id=e.prodId),!this.IsNull(t)&&this.isJSON(JSON.stringify(t))&&(o=i(o,t)),o},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":o(t))||!t)}catch(e){return!1}return!1},Logout:function(){},onExit:function(){},IsNull:function(e){return void 0===e||null===e||""===e},HttpLib:function(e,t){t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{};var o=this.formateParams(t.data,t.cache);"GET"===t.type?(t.url=o?t.url+"?"+o:t.url,my.request({url:t.url,method:t.type,headers:{"Content-Type":"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(e){console.error("my.request error: ",e),t.error&&t.error(e)}})):my.request({url:t.url,method:t.type,headers:t.headers?t.headers:{"Content-Type":"application/x-www-form-urlencoded"},data:t.data,success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(e){console.error("ali HttpLib fail",e),e&&e.data&&e.data.result&&100504===e.data.result.code?t.success({responseText:e.data,status:e.statusCode}):(console.error("my.request error: ",e),t.error&&t.error(e))}})},formateParams:function(e,t){var o=[];for(var i in e)o.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t&&o.push("v="+(new Date).getTime()),o.join("&")},LocalStorage:function(){return this},SetItem:function(e,t){var o=my.setStorageSync({key:e,data:t});console.log("aligame SetItem: "+o.success+", key "+e)},RemoveItem:function(e){my.removeStorage({key:e})},GetItem:function(e){try{var t=my.getStorageSync({key:e});return console.log("aligame GetItem: "+t.success+", key: "+e+", value: "+t.data),t.success?t.data:""}catch(e){console.log(e)}return""},Clear:function(){my.clearStorage()},getDeviceBenchmarkLevel:function(e,t,o){this.systemInfo?this.getDeviceLevelFromServer(e,t,o):(this.systemInfo=this.getSystemInfo(),this.getDeviceLevelFromServer(e,t,o))},getDeviceLevelFromServer:function(e,t,o){try{var i="https://clip-dispatcher.ywdier.com/api/v1/device-level",n={sdk_device_type:"default",app_id:e.appId.toString(),client_id:e.clientId,cloud_id:this.config.cloudId.toString(),game_id:e.gameId.toString(),user_id:e.userId.toString(),uuid:e.uuid(),platform:this.ChannelType,os_name:this.systemInfo.platform||"Default",os_version:this.systemInfo.system,sdk_origin_device_level_info:this.systemInfo.performance,sdk_device_brand:this.systemInfo.brand,sdk_device_model:this.systemInfo.model},r={retryMax:2,url:i,postdata:n,headers:{"Content-Type":"application/json"}},a={sdk_platform_type:this.ChannelType};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,"sdk_c_receive_performance_class_level_start",a),e.HttpLib(r,function(i,n){console.log("getDeviceBenchmarkLevel from server success, params:"+JSON.stringify(n));var r=JSON.parse(n.data);r&&200===r.code&&r.data&&!e.IsNull(r.data.sdk_device_level)?(a.sdk_device_level=r.data.sdk_device_level,e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,"sdk_c_receive_performance_class_level_succ",a),t&&t.call(o,0,r.data.sdk_device_level,r.message)):(a.sdk_error_code=r&&r.code?r.code:"DEFULT_CODE",a.sdk_error_msg=JSON.stringify(r),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,"sdk_c_receive_performance_class_level_fail",a),t&&t.call(o,-1,"",r.message))},function(i,n){console.log("getDeviceBenchmarkLevel from server fail, params:"+JSON.stringify(n)),a.sdk_error_msg=JSON.stringify(n),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,"sdk_c_receive_performance_class_level_fail",a),t&&t.call(o,-2,"",JSON.stringify(n))},this)}catch(e){console.error("error:","getDeviceBenchmarkLevel"+JSON.stringify(e)),t&&t.call(1,"",JSON.stringify(e))}}});e.exports=l}])}); +//# sourceMappingURL=tuyoosdk_release.js.map \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/tuyoosdk_aliminigame_1.0.4.250915_release.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/tuyoosdk_aliminigame_1.0.4.250915_release.js.meta new file mode 100644 index 0000000..9f7805e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/aliminigame/tuyoosdk_aliminigame_1.0.4.250915_release.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b5a72e3fac2214d22b1626dcba46ba35 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame.meta new file mode 100644 index 0000000..6a59d89 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8778c3a0c2fd54bd79e6da7000b3f202 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/TyJsBridge.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/TyJsBridge.js new file mode 100644 index 0000000..22bd1c1 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/TyJsBridge.js @@ -0,0 +1,300 @@ +var TuyooSdkBridge = { + + loadJsScriptToBridge: function (channelType) { + var channelTypeFromCS = UTF8ToString(channelType); + console.log("channelTypeFromCS:" + channelTypeFromCS); + }, + + InitToBridge: function (initEventInfo) { + try { + var initCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "InitResult", callbackString); + } + var initInfoFromCS = UTF8ToString(initEventInfo); + var initInfo = JSON.parse(initInfoFromCS); + var tyInitParams = {}; + tyInitParams.appId = initInfo.tuyooParam.appId; + tyInitParams.gameId = initInfo.tuyooParam.gameId; + tyInitParams.pay_version = "hall37"; + tyInitParams.baseurl = initInfo.tuyooParam.serverUrl.endsWith("/") ? initInfo.tuyooParam.serverUrl : initInfo.tuyooParam.serverUrl + "/"; + tyInitParams.bi_base_url = "https://cbi.tuyoo.com/"; + tyInitParams.cloudId = initInfo.tuyooParam.cloudId; + tyInitParams.packageName = initInfo.package; + tyInitParams.clientId = initInfo.tuyooParam.clientId; + tyInitParams.jingdongAppId = initInfo.login.jingdongminigame.jingdongAppId; + console.log("initInfo: " + JSON.stringify(initInfo)); + if (initInfo.login.jingdongminigame.packageType === "wasmsplit" && GameGlobal.tywx) { + GameGlobal.tywx.StateInfo.debugMode = initInfo.debug.toLowerCase() === "true"; + GameGlobal.tywx.SystemInfo.loginUrl = initInfo.tuyooParam.serverUrl.endsWith("/") ? initInfo.tuyooParam.serverUrl : initInfo.tuyooParam.serverUrl + "/"; + GameGlobal.tywx.SystemInfo.clientId = initInfo.tuyooParam.clientId; + GameGlobal.tywx.SystemInfo.cloudId = initInfo.tuyooParam.cloudId; + GameGlobal.tywx.SystemInfo.appId = initInfo.tuyooParam.appId; + GameGlobal.tywx.SystemInfo.gameId = initInfo.tuyooParam.gameId; + GameGlobal.tywx.SystemInfo.wxAppId = initInfo.login.tywx.wx_appId; + GameGlobal.tywx.SystemInfo.packageName = initInfo.package; + } + GameGlobal.TuyooSdk.OnInit(initInfo.tuyooParam.channelType, tyInitParams, initCallback, this); + } catch (e) { + console.error("InitToBridge catch error: " + e); + } + }, + + // 切换SDK域名 + UpdateServerUrlToBridge: function (serverUrl) { + try { + var serverUrlFromCS = UTF8ToString(serverUrl); + window.TuyooSdk.baseuri = (serverUrlFromCS.substring(serverUrlFromCS.length - 1) === '/') ? serverUrlFromCS.substring(0, serverUrlFromCS.length - 1) : serverUrlFromCS; + console.log("update serverUrl to: " + window.TuyooSdk.baseuri); + } catch (e) { + console.error("UpdateServerUrlToBridge catch error: " + e); + } + }, + + LoginToBridge: function (loginEventInfo) { + try { + var loginCallback = function (code, result, error) { + var callbackResult = { + code: code, + result: result && result.logindata ? result.logindata : result, + error: error + }; + var callbackString = JSON.stringify(callbackResult); + SendMessage("NativeCallBack", "LoginResult", callbackString); + } + var loginInfoFromCS = UTF8ToString(loginEventInfo); + var loginInfo = JSON.parse(loginInfoFromCS); + if (loginInfo.loginType === "wx.cn.minigame" && GameGlobal.tywx) { + GameGlobal.tywx.TuyooSDK.login(loginCallback); + return; + } + var tyLoginParams = {}; + if (loginInfo.loginType) { + tyLoginParams.ChannelType = loginInfo.loginType; + } + if (loginInfo.extraParams) { + var extraParams = JSON.parse(loginInfo.extraParams); + tyLoginParams.extraParams = extraParams; + } + console.log("tyLoginParams: " + JSON.stringify(tyLoginParams)); + GameGlobal.TuyooSdk.Login(tyLoginParams, loginCallback, this); + } catch (e) { + console.error("LoginToBridge catch error: " + e); + } + }, + + PayToBridge: function (payEventInfo) { + try { + var payCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "PayResult", callbackString); + } + var payInfoFromCS = UTF8ToString(payEventInfo); + var payInfo = JSON.parse(payInfoFromCS); + var tyPayParams = {}; + tyPayParams.prodCount = 1; + tyPayParams.appInfo = ""; + if (payInfo.chargeService) { + tyPayParams.ChargeType = payInfo.chargeService; + } + if (payInfo.productCount) { + tyPayParams.prodCount = payInfo.productCount; + } + if (payInfo.serverAppInfo) { + tyPayParams.appInfo = payInfo.serverAppInfo; + } + if (payInfo.gameOrderId) { + tyPayParams.prodOrderId = payInfo.gameOrderId; + } + if (payInfo.extraParams) { + var extraParams = JSON.parse(payInfo.extraParams); + if(extraParams.jingdongCurrency) { + tyPayParams.jingdongCurrency = extraParams.jingdongCurrency; + delete extraParams.jingdongCurrency; + } + tyPayParams.extraParams = extraParams; + } + tyPayParams.prodId = payInfo.productId; + tyPayParams.prodName = payInfo.productName; + tyPayParams.prodPrice = payInfo.productPrice; + console.log("tyPayParams: " + JSON.stringify(tyPayParams)); + GameGlobal.TuyooSdk.Pay(tyPayParams, payCallback, this); + } catch (e) { + console.error("PayToBridge catch error: " + e); + } + }, + + SetShareInfoToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var shareInfoToJs = shareInfo.resource; + var tyShareParams = {}; + shareInfoToJs.title && (tyShareParams.title = shareInfoToJs.title); + shareInfoToJs.imageUrl && (tyShareParams.imageUrl = shareInfoToJs.imageUrl); + shareInfoToJs.desc && (tyShareParams.desc = shareInfoToJs.desc); + shareInfoToJs.type && (tyShareParams.type = shareInfoToJs.type); + if(shareInfoToJs.extraParams) { + var extraParams = JSON.parse(shareInfoToJs.extraParams); + if(extraParams.channel) { + tyShareParams.channel = extraParams.channel; + delete extraParams.channel; + } + if(extraParams.url) { + tyShareParams.url = extraParams.url; + delete extraParams.url; + } + if(extraParams.keyShareChannel) { + tyShareParams.keyShareChannel = extraParams.keyShareChannel; + delete extraParams.keyShareChannel; + } + if(extraParams.localImageUrl) { + tyShareParams.localImageUrl = extraParams.localImageUrl; + delete extraParams.localImageUrl; + } + if(extraParams.onlineImageUrl) { + tyShareParams.onlineImageUrl = extraParams.onlineImageUrl; + delete extraParams.onlineImageUrl; + } + tyShareParams.extraParams = extraParams; + } + tyShareParams.callback = shareCallback; + console.log("tyShareParams: " + JSON.stringify(tyShareParams)); + GameGlobal.TuyooSdk.SetDefaultShareInfo(tyShareParams); + } catch (e) { + console.error("SetShareInfoToBridge catch error: " + e); + } + }, + + ShareToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var shareInfoToJs = shareInfo.resource; + var tyShareParams = {}; + shareInfoToJs.title && (tyShareParams.title = shareInfoToJs.title); + shareInfoToJs.imageUrl && (tyShareParams.imageUrl = shareInfoToJs.imageUrl); + shareInfoToJs.desc && (tyShareParams.desc = shareInfoToJs.desc); + shareInfoToJs.type && (tyShareParams.type = shareInfoToJs.type); + if(shareInfoToJs.extraParams) { + var extraParams = JSON.parse(shareInfoToJs.extraParams); + if(extraParams.channel) { + tyShareParams.channel = extraParams.channel; + delete extraParams.channel; + } + if(extraParams.url) { + tyShareParams.url = extraParams.url; + delete extraParams.url; + } + if(extraParams.keyShareChannel) { + tyShareParams.keyShareChannel = extraParams.keyShareChannel; + delete extraParams.keyShareChannel; + } + if(extraParams.localImageUrl) { + tyShareParams.localImageUrl = extraParams.localImageUrl; + delete extraParams.localImageUrl; + } + if(extraParams.onlineImageUrl) { + tyShareParams.onlineImageUrl = extraParams.onlineImageUrl; + delete extraParams.onlineImageUrl; + } + tyShareParams.extraParams = extraParams; + } + console.log("tyShareParams: " + JSON.stringify(tyShareParams)); + GameGlobal.TuyooSdk.Share(tyShareParams, shareCallback); + } catch (e) { + console.error("ShareToBridge catch error: " + e); + } + }, + + GAEventTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + if (!reportInfo.typeName) { + reportInfo.typeName = "track"; + } + GameGlobal.TuyooSdk.bi.trackWithType(reportInfo.typeName, reportInfo.eventName, reportInfo.reportEvent); + } catch (e) { + console.error("GAEventTrackToBridge catch error: " + e); + } + }, + + GAProfileTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + GameGlobal.TuyooSdk.bi.profileTrack(reportInfo.profileType, reportInfo.profileSubjectType, reportInfo.profileSubjectPrimary, reportInfo.reportEvent); + } catch (e) { + console.error("GAProfileTrackToBridge catch error: " + e); + } + }, + + GetShareInfoBridge: function (shareEventInfo) { + console.error("current channel not support GetShareInfo function"); + }, + + GetAdInfoBridge: function () { + console.error("current channel not support GetAdInfo function"); + }, + + TxAdSDKReportToBridge: function (txAdReportInfo) { + console.error("current channel not support TxAdSDKReport function"); + }, + + CheckBindToBridge: function (bindEventInfo) { + console.error("current channel not support CheckBind function"); + }, + + SendSmsCodeToBridge: function (loginEventInfo) { + console.error("current channel not support SendSmsCode function"); + }, + + BindToBridge: function (bindEventInfo) { + console.error("current channel not support Bind function"); + }, + + SetWxUserInfoToBridge: function (type, userInfo) { + console.error("current channel not support SetWxUserInfo function"); + }, + + GetDeviceLevelToBridge: function() { + // try { + // var callback = function (code, result, error) { + // var callbackString = JSON.stringify({ code, result, error }); + // SendMessage("NativeCallBack", "GetDeviceLevelResult", callbackString); + // } + // GameGlobal.TuyooSdk.getDeviceBenchmarkLevel(callback, this); + // } catch (error) { + // console.error("GetDeviceLevelToBridge catch error: " + error); + // } + console.error("current channel not support GetDeviceLevelToBridge function"); + }, + + CreatGridGamePanelToBridge: function(gridGameModule) { + console.error("current channel not support CreatGridGamePanel function"); + }, + + ShowGridGamePanelToBridge: function(panelId) { + console.error("current channel not support ShowGridGamePanel function"); + }, + + HideGridGamePanelToBridge: function(panelId) { + console.error("current channel not support HideGridGamePanel function"); + }, + + DestroyGridGamePanelToBridge: function(panelId) { + console.error("current channel not support DestroyGridGamePanel function"); + } + +} + +mergeInto(LibraryManager.library, TuyooSdkBridge); \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/TyJsBridge.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/TyJsBridge.js.meta new file mode 100644 index 0000000..3bfbcfb --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/TyJsBridge.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5c3c4c83df2cf42639069d6e1e3bf76f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/tuyoosdk_jingdongminigame_1.0.1.251009_release.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/tuyoosdk_jingdongminigame_1.0.1.251009_release.js new file mode 100644 index 0000000..bb1bb4c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/tuyoosdk_jingdongminigame_1.0.1.251009_release.js @@ -0,0 +1,3 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TuyooSdk=t():e.TuyooSdk=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var i=o[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,exports,t){function o(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var n,i,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=t(1),l=t(2),c=t(3),d=t(4),u=t(6),p=t(5),_=t(7),f=s.extend((r={baseuri:{get:function(){return this._baseuri},set:function(e){this._baseuri=e}},sdkRoute:{set:function(e){this._sdkRoute=e},get:function(){return void 0===this._sdkRoute||""===this.sdkRoute?"/open/v6/user/LoginBySnsIdNoVerify":this._sdkRoute}},payversion:{get:function(){return this._payversion},set:function(e){this._payversion=e}},clientId:{get:function(){return this._clientId},set:function(e){this._clientId=e}},packageName:{get:function(){return this._packageName},set:function(e){this._packageName=e}},appId:{get:function(){return this._appId},set:function(e){this._appId=e}},gameId:{get:function(){return this._gameId},set:function(e){this._gameId=e}},userId:{get:function(){return this._userId},set:function(e){this._userId=e}},token:{get:function(){return this._token},set:function(e){this._token=e}},logindata:{get:function(){return this._logindata},set:function(e){this._logindata=e}},ctor:function(){this.bi=new d},uuid:function(){if(this.IsNull(this._uuid))try{var e=this.LocalStorage().GetItem("ty_uuid");this.IsNull(e)?(this._uuid=this.CreateUUID(32,16),this.LocalStorage().SetItem("ty_uuid",this._uuid)):this._uuid=e}catch(e){return this.CreateUUID(32,16)}return this._uuid},CheckChannel:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t.tyPlatform))return t.tyPlatform}}return null},CheckParams:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t))return t}}return null},Decode:function(e){return c.decode(e)},IsNull:function(e){return void 0===e||null===e||""===e},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":a(t))||!t)}catch(e){return!1}},StartupParameter:function(){return this.platform().StartupParameter(this)},orderuri:function(){return"hall37"===this.payversion?this.baseuri+"/open/v4/pay/order":"hall51"===this.payversion?this.baseuri+"/open/v5/pay/order":this.baseuri+"/open/v4/pay/order"},platform:function(e){return this.IsNull(e)&&(e=this.type),_.tyLoginInterface[e]},platformPay:function(e){return _.tyPayInterface[e]},OnInitDebuger:function(e,t){var o="https://downqn.tuyoo.com/h5sdk/v100/js/vconsole.min.js";this.loadScript(o,function(o,n){if(0===o){new VConsole;console.log("----------tuyoosdk.OnInit-->initdebug:"),e.call(t,o,n,null)}else e.call(t,1005,null,"失败")})},OnInit:function(e,t,o,n){var i=this;console.log("----------tuyoosdk.OnInit-->channel:",e),t.debug&&i.OnInitDebuger(function(e,t,o){console.log(window.location.href,e,t,o)},i),i.TuyooInit(e,t,o,n)},SetDefaultShareInfo:function(e){this.IsNull(this.platform().SetDefaultShareInfo)||this.platform().SetDefaultShareInfo(this,e)},Share:function(e,t){this.IsNull(this.platform().Share)?t&&t.call(this,p.shareCode.fail,null,""+this.type+"不支持分享"):this.platform().Share(this,e,t)},CallMethod:function(e,t,o,n){var i=this.IsNull(t.ChannelType)?this.type:t.ChannelType;if(!this.IsNull(this.platform(i))&&"function"==typeof this.platform(i)[e]){var r=[this,t,o];return this.platform(i)[e].apply(n,r)}o&&o.call(this,p.initCode.fail,null,""+i+"不支持此功能("+e+")")},TuyooInit:function(e,t,o,n){var i=this;i.config=t;var r=(new Date).getTime(),a=function(e,t,a){0===e&&i.bi.ReportGAWithType(i,i.bi.GA_TYPE.TRACK,u.GAEvents.SDK_INIT_ENT,{sdk_init_duration_time:(new Date).getTime()-r});var s=[];for(var l in arguments)s.push(arguments[l]);o.apply(n,s)};if(i.IsNull(t.wxAppId)||(i.wxAppId=t.wxAppId),void 0===t.bi_base_url&&(t.bi_base_url="https://cbi.tuyoo.com/"),i.IsNull(t.pay_version)&&(t.pay_version="hall37"),"hall37"!==t.pay_version&&"hall51"!==t.pay_version)return void o.call(n,p.initCode.fail,null,"pay_version 必须为 hall37|hall51");if(this.IsNull(t.userId)?this.userId=0:this.userId=t.userId,console.log("----------tuyoosdk.OnInit-->config:",t),i.IsNull(t.clientId))if(i.IsNull(this.InitClientId())){if(!t.debug)return void o.call(n,p.initCode.fail,null,"clientId不能为空");t.clientId="Android_4.58_meitu.meitu.0-hall6.meitu.tu"}else t.clientId=this.InitClientId();this.type=e,this.appId=t.appId,this.gameId=t.gameId,this.clientId=t.clientId,this.payversion=t.pay_version,this.baseuri="/"===t.baseurl.substring(t.baseurl.length-1)?t.baseurl.substring(0,t.baseurl.length-1):t.baseurl,this.bi_base_uri="/"===t.bi_base_url.substring(t.bi_base_url.length-1)?t.bi_base_url.substring(0,t.bi_base_url.length-1):t.bi_base_url,this.packageName=t.packageName,console.log("----------tuyoosdk.OnInit-->clientId:",this.clientId),console.log("----------tuyoosdk.OnInit-->baseuri:",this.baseuri),console.log("----------tuyoosdk.OnInit-->platform:",this.platform()),this.bi.OnInit(this,t,function(r,s,l){0===r?(i.platform().OnInit(i,t,a,i),i.InitOtherThird(e,t,a,n)):o.call(n,r,s,l)},this)},InitOtherThird:function(e,t,o,n){for(var i in _.tyInitInterface)if(i!==e){var r=function(e,t,o){console.log("----------tuyoosdk.InitOtherThird-->type:",i," status: ",e)};_.tyInitInterface[i].OnInit(this,t,r,this)}},Is:function(e){var t=this.platform(e);return!this.IsNull(t)&&t.Is()},InitClientId:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(this.IsNull(e)===!1){var t=this.GetQueryToMap(e.substr(1,e.length));return this.IsNull(t.clientId)===!1?t.clientId:null}return null}return null},Login:function(e,t,o){var n=this;this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_login_track_id||""===e.extraParams.sdk_login_track_id?e.sdk_login_track_id=this.CreateUUID(32,16):e.sdk_login_track_id=e.extraParams.sdk_login_track_id:e.sdk_login_track_id=this.CreateUUID(32,16),this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),n.IsNull(n.platform(e.ChannelType).realLogin)?this.realLogin(e,t,o):n.platform(e.ChannelType).realLogin(n,e,t,o)},GetUserInfo:function(e,t,o){this.IsNull(this.platform().GetUserInfo)?console.error(this.platform().ChannelType+" not support GetUserInfo"):this.platform().GetUserInfo(this,e,t,o)},realLogin:function(e,t,o){var n=this,i={sdk_login_channel_type:n.platform(e.ChannelType).ChannelType,sdk_login_track_id:e.sdk_login_track_id};n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_START,i);var r=function(r,a,s){var l=n.convertLoginServerResultCode(r);0===l?(n.userId=a.userId,n.token=a.token,n.userPwd=a.userPwd,n.logindata=a.logindata,n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_SUCC,i),t&&t.call(o,p.loginCode.success,a,s)):(i.sdk_error_code=r,i.sdk_error_msg=JSON.stringify(s),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_FAIL,i),t&&t.call(o,l,a,s));try{n.IsNull(n.platform(e.ChannelType).LoginEnd)||n.platform(e.ChannelType).LoginEnd(r,a,s)}catch(e){console.log("----------tuyoosdk.LoginEnd-->err:",e)}},a={retryMax:1,url:n.baseuri+this.sdkRoute.get(),postdata:{imei:"null",idfa:"",appId:n.appId,gameId:n.gameId,clientId:n.clientId,packageName:n.packageName,uuid:n.uuid(),sdk_session_id:n.bi.sessionId,original_deviceid:n.uuid(),sdk_login_track_id:e.sdk_login_track_id}};if(n.IsNull(e.extraParams)===!1&&n.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)n.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,i,a){console.log("===========>snsHook",o,i),0===t?n.IsNull(n.platform(e.ChannelType).tuyooLogin)?n.tuyooLogin(o,r,a):n.platform(e.ChannelType).tuyooLogin(o,r,a):r.call(n,p.loginCode.fail,null,i)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(n,e,a,l)},tuyooLogin:function(e,t,o){var n=this;console.log("tuyoo-login-request",e);var i={sdk_login_channel_type:n.platform().ChannelType,sdk_login_track_id:e.postdata.sdk_login_track_id};n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_START,i);try{this.HttpLib(e,function(e,r){console.log("tuyoo-login-response",e,r);var a=JSON.parse(r.data);if(n.IsNull(a.result))i.sdk_error_msg=JSON.stringify(a),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),t.call(n,p.loginCode.fail,null,a);else if(0===a.result.code){var s={userId:a.result.userId,token:a.result.token,userPwd:a.result.userPwd,logindata:a.result};if(!n.IsNull(o))for(var l in o)s[l]=o[l];n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_SUCC,i),t.call(n,a.result.code,s)}else i.sdk_error_code=a.result.code,i.sdk_error_msg=JSON.stringify(a.result),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),t.call(n,a.result.code,null,a.result.info)},function(e,o){i.sdk_error_code=e,i.sdk_error_msg=JSON.stringify(o),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),t.call(n,p.loginCode.fail,null,o)},n)}catch(e){i.sdk_error_msg=JSON.stringify(e),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),console.log("tuyoo-login-catch",e),t.call(n,p.loginCode.fail,null,e)}},convertLoginServerResultCode:function(e){switch(e){case 0:return p.loginCode.success;case 12010:return 100201;case 12017:case 12130:return 100206;case 10:return 100502;case 100504:return 100504;default:return p.loginCode.fail}},Logout:function(){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(this)}},o(r,"Logout",function(e,t){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(e,t)}),o(r,"Bind",function(e,t,o){this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),this.realBind(e,t,o)}),o(r,"realBind",function(e,t,o){var n=this,i={sdk_login_channel_type:n.platform(e.ChannelType).ChannelType};n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_START,i);var r=function(e,r,a){var s=n.convertLoginServerResultCode(e);0===s?(n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_SUCC,i),t&&t.call(o,p.loginCode.success,r,a)):(i.sdk_error_code=e,i.sdk_error_msg=JSON.stringify(a),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_FAIL,i),t&&t.call(o,s,r,a))};if(n.IsNull(n.userId)||0===n.userId||"0"===n.userId)return void r(p.loginCode.fail,null,"Do not login");var a={retryMax:1,url:n.baseuri+"/open/v6/user/bindBySnsId",postdata:{imei:"null",appId:n.appId,gameId:n.gameId,clientId:n.clientId,packageName:n.packageName,uuid:n.uuid(),sdk_session_id:n.bi.sessionId,original_deviceid:n.uuid(),userId:n.userId,passwd:n.userPwd}};if(n.IsNull(e.extraParams)===!1&&n.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)n.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,i,a){console.log("===========>snsHook",o,i),0===t?n.IsNull(n.platform(e.ChannelType).tuyooBind)?n.tuyooBind(o,r,a):n.platform(e.ChannelType).tuyooBind(o,r,a):r.call(n,p.loginCode.fail,null,i)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(n,e,a,l)}),o(r,"tuyooBind",function(e,t,o){var n=this;console.log("tuyoo-bind-request",e);try{this.HttpLib(e,function(e,o){console.log("tuyoo-bind-response",e,o);var i=JSON.parse(o.data);n.IsNull(i.result)?t.call(n,p.loginCode.fail,null,i):0===i.result.code?t.call(n,i.result.code,i.result):t.call(n,i.result.code,i.result,i.result.info)},function(e,o){t.call(n,p.loginCode.fail,null,o)},n)}catch(e){console.log("tuyoo-bind-catch",e),t.call(n,p.loginCode.fail,null,e)}}),o(r,"Pay",function(e,t,o){console.log("==========>start pay "),this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_order_track_id||""===e.extraParams.sdk_order_track_id?e.sdk_order_track_id=this.CreateUUID(32,16):e.sdk_order_track_id=e.extraParams.sdk_order_track_id:e.sdk_order_track_id=this.CreateUUID(32,16),this.IsNull(e.ChargeType)&&(e.ChargeType=this.platform().ChargeType),this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_START,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_pay_type:e.ChargeType}),"tuyoo"!==e.ChargeType?this.realPay(e,t,o,e.ChargeType):this.payui(e,t,o)}),o(r,"isString",function(e){return"[object String]"===Object.prototype.toString.call(e)}),o(r,"Order",function(e,t,o){var n=this;if(void 0===e.prodCount&&(e.prodCount=1),void 0===e.appInfo&&(e.appInfo=""),void 0===e.prodOrderId&&(e.prodOrderId=""),n.IsNull(n.wxAppId)||(e.wxAppId=n.wxAppId),console.log("------- self.platformPay(args.ChargeType) ----------",n.platformPay(e.ChargeType)),!n.IsNull(n.platformPay(e.ChargeType).Order))return n.platformPay(e.ChargeType).Order(n,e,t,o);if(n.IsNull(n.userId)||0===n.userId||"0"===n.userId)return this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:p.payCode.fail,sdk_error_msg:"用户信息不合法",sdk_pay_type:e.ChargeType}),void t.call(o,p.payCode.fail,null,"用户信息不合法");var i={imei:"null",chargeType:e.ChargeType,userId:n.userId,appId:n.appId,gameId:n.gameId,mustcharge:"1",uuid:n.uuid(),clientId:n.clientId,prodId:e.prodId,prodName:e.prodName,prodCount:e.prodCount,prodPrice:e.prodPrice,appInfo:e.appInfo,prodOrderId:e.prodOrderId,sdk_session_id:n.bi.sessionId,sdk_order_track_id:e.sdk_order_track_id,original_deviceid:n.uuid()};if(n.IsNull(e.extraParams)===!1&&n.isJSON(JSON.stringify(e.extraParams)))for(var r in e.extraParams)n.IsNull(i[r])&&(i[r]=e.extraParams[r]);n.platformPay(e.ChargeType).ExtraOrderParams(n,e,i);var a={url:n.orderuri(),postdata:i};n.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_START,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId}),n.HttpLib(a,function(r,a){var s;if(s=n.isString(a.data)?JSON.parse(a.data):a.data,s&&null!==s.result)if(0===s.result.code){var l=s.result.chargeInfo;n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_SUCC,{sdk_pay_type:l.chargeType,sdk_order_id:l?l.platformOrderId:"DEFAULT",sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id});var c;try{c=s.result.payData}catch(e){c=null,console.log("=============> 没有paydata数据",e)}var d=function(i,r,a){var s={sdk_pay_type:l.chargeType,sdk_order_id:l.platformOrderId,sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id};0===i?n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_SUCC,s):i===p.payCode.navigatePayPageSucc?n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_LAUNCH_SUCC,s):(s.sdk_error_code=i,s.sdk_error_msg=a,n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,s));var c=[];for(var d in arguments)c.push(arguments[d]);t.apply(o,c)};console.log(e.ChargeType),l.sdk_order_track_id=e.sdk_order_track_id,n.platformPay(e.ChargeType).Pay(n,l,c,d,n)}else{if(n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:s.result.code,sdk_error_msg:JSON.stringify(s.result)}),!n.IsNull(n.platformPay(e.ChargeType).dealOrderFail)){var _=function(i,r,a){console.log("=============> dealOrderFail hook status",i),i===p.dealOrderFailCode.needReOrder?n.Order(e,t,o):this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,p.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)};return void n.platformPay(e.ChargeType).dealOrderFail(n,s.result,_)}this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,p.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)}else n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:"DEFAULT",sdk_error_msg:JSON.stringify(s)}),t.call(o,p.payCode.fail,null,s)},function(r,a){n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:r,sdk_error_msg:a}),t.call(o,p.payCode.fail,null,a)},n)}),o(r,"realNameAuth",function(e,t){var o=this,n=function(e,n,i){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("----------tuyoosdk.realNameAuth-->err:",e)}},i={retryMax:1,url:o.baseuri+"/open/v6/user/update/sync/third",postdata:{imei:"null",idfa:"",appId:o.appId,gameId:o.gameId,clientId:o.clientId,packageName:o.packageName,uuid:o.uuid(),userId:o.userId}},r=function(e,t,i){console.log("===========>snsHook",t,i),0===e?o.IsNull(o.platform().syncThird)?o.syncThird(t,n):o.platform().syncThird(t,n):n.call(o,p.verifyCode.fail,null,i)};o.IsNull(o.platform().realNameAuth)?t.call(o,p.verifyCode.fail,null,"无渠道实名方法"):this.platform().realNameAuth(o,e,i,r)}),o(r,"syncThird",function(e,t){var o=this;console.log("tuyoo-syncThird-request",e),o.HttpLib(e,function(e,n){if(o.isString(n.data))var i=JSON.parse(n.data);else var i=n.data;i.result&&null!==i.result?(console.log("syncThird=============> "+JSON.stringify(i.result)),0===i.result.code?t.call(o,p.verifyCode.success,i.result,null):t.call(o,p.verifyCode.fail,null,i.result.info)):t.call(o,p.verifyCode.fail,null,i)},function(e,n){t.call(o,p.verifyCode.fail,null,n)},o)}),o(r,"ShowBuoy",function(){this.platform().ShowBuoy()}),o(r,"HideBuoy",function(){this.platform().HideBuoy()}),o(r,"ShoutCat",function(){this.platform().ShoutCat()}),o(r,"OnExit",function(){this.platform().onExit()}),o(r,"onExit",function(e){this.platform().onExit(e)}),o(r,"HttpLib",function(e,t,o,n){var i=this;void 0===e.retry&&(e.retry=0),void 0===e.retryMax&&(e.retryMax=0),void 0===e.method&&(e.method="POST"),void 0===e.headers&&(e.headers={"Content-Type":"application/x-www-form-urlencoded"});var r=function(e){l.ajax(i,e)};try{var a=this.platform(),s=!1;if("dmm.global.h5"!==a.ChannelType?s=!0:e.url!==i.config.bi_base_url+"api/bilog5/ga"&&(s=!0),s){var c=a.HttpLib;this.IsNull(c)||(r=function(e){c.call(a,i,e)})}}catch(e){}r({url:e.url,type:e.method,dataType:"json",headers:e.headers,data:e.postdata,success:function(r){console.log(e.url,">>请求结果》》》",r);try{var a={data:r.responseText,status:r.status},s={};"string"==typeof a.data?s=JSON.parse(a.data):(s=a.data,a.data=JSON.stringify(a.data)),i.IsNull(s.error)===!1?o.call(n,1009,s):t.call(n,0,a)}catch(e){t.call(n,0,a)}},error:function(r){console.log("网络异常",e.url),e.retry

    "+e.prodName+'

    \t
  • 微信支付
  • \t
  • 支付宝支付
  • \t

    选择支付方式

    ¥ '+e.prodPrice+"

    "+e.prodName+'

    \t
    \t\t
    微信支付
    \t\t
    支付宝支付
    \t
    ',l=document.createElement("div");l.setAttribute("id","payui"),l.innerHTML=s,document.getElementsByTagName("body")[0].appendChild(l)}),o(r,"realPay",function(e,t,o,n,i){var r=this;if(!this.IsNull(i)){console.log("==========>start pay ");var a=i||event;a.stopPropagation()}e.ChargeType=n;var s=function(e,n,i){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("应用层代码出错了--->"),console.log(e)}};try{r.Order(e,s,r)}catch(e){console.log("order error--->",e.toString())}}),o(r,"hidePay",function(e){var t=document.getElementById("payui");document.getElementsByTagName("body")[0].removeChild(t)}),o(r,"LoginByToken",function(e,t){var o=this,n={appId:e.appId,clientId:e.clientId,token:e.token,imei:null},i={url:o.baseuri+"/open/v4/user/loginByToken",postdata:n};o.HttpLib(i,function(e,n,i){if(0===e){var r=JSON.parse(n.data);if(null!==r.result)if(console.log("--------->message",r),0===r.result.code){var a={userId:r.result.userId,token:r.result.token,logindata:r.result};o.userId=r.result.userId,t.call(o,p.loginCode.success,a,null)}else t.call(o,p.loginCode.fail,null,r.result)}})}),o(r,"QueryOrderStatus",function(e,t){var o=this,n={appId:o.config.appId,clientId:o.config.clientId,platformOrderId:e.platformOrderId,userId:o.userId},i={url:o.baseuri+"/open/v4/pay/query",postdata:n};o.HttpLib(i,function(e,n,i){if(0===e){var r=JSON.parse(n.data);if(void 0!==r.error&&t.call(o,p.payCode.fail,null,"orderId not exist"),void 0!==r.result){var a={status:"notPaid"},e=r.result.status;"41"===e.toString()&&(a.status="paid",t.call(o,p.payCode.success,a,null)),t.call(o,p.payCode.success,a,null)}}})}),o(r,"Ad",function(){return this.IsNull(this.platform().Ad)?void console.error(this.platform().ChannelType+" not support Ad"):this.platform().Ad()}),o(r,"getDeviceBenchmarkLevel",function(e,t){this.IsNull(this.platform().getDeviceBenchmarkLevel)?console.error(this.platform().ChannelType+" not support getDeviceBenchmarkLevel"):this.platform().getDeviceBenchmarkLevel(this,e,t)}),r)),h=new f;!function(o,r){"object"===a(exports)?e.exports=r():(n=r,i="function"==typeof n?n.call(exports,t,exports,e):n,!(void 0!==i&&(e.exports=i)))}(void 0,function(){return h})},function(e,exports,t){function o(e){function t(){}return t.prototype=e,new t}function n(e,t){var n;n="function"==typeof Object.create?Object.create(t.prototype):o.create(t.prototype),n.constructor=e,e.prototype=n}var i,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function e(t,o){return function(){function i(){if("undefined"==typeof i.prototype.ctor);else{var e=new Array;for(var t in arguments)e.push(arguments[t]);i.prototype.ctor.apply(this,e)}}var r=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/,_super=t.prototype;n(i,t);var a=i.prototype;"undefined"==typeof _super||"undefined"==typeof _super.ctor&&(_super.ctor=t),i.extend=function(t){return e(i,t)};for(var s in o)a[s]="function"==typeof o[s]&&"function"==typeof _super[s]&&r.test(o[s])?function(e,t){return function(){var o=this._super;this._super=_super[e];var n=new Array;for(var i in arguments)n.push(arguments[i]);var r=t.apply(this,n);return this._super=o,r}}(s,o[s]):o[s];return i}()},l=s(function(){},{});!function(o,n){"object"===a(exports)?e.exports=n():(i=n,r="function"==typeof i?i.call(exports,t,exports,e):i,!(void 0!==r&&(e.exports=r)))}(void 0,function(){return l})},function(e,exports,t){"use strict";var o=t(1),n=o.extend({IsWxApp:function(){try{if(void 0!==wx.request)return!0}catch(e){return!1}},IncludeWxChannel:function(e){return"xiaomi.cn.minigame"===e.type},ajax:function(e,t){if(t=t||{},t.cache=t.cache||!1,!t.url)throw new Error("参数不合法");if(this.IsWxApp()&&!this.IncludeWxChannel(e)){t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{};var o=this.formateParams(t.data,t.cache);"GET"===t.type?(t.url=o?t.url+"?"+o:t.url,wx.request({url:t.url,method:"GET",header:{Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})):wx.request({url:t.url,method:"POST",data:o,header:{"content-type":"application/x-www-form-urlencoded",Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})}else t.dataType=(t.dataType||"json").toLowerCase(),"jsonp"==t.dataType?this.ajaxJSONP(t):"json"==t.dataType&&this.ajaxJSON(t)},ajaxJSONP:function(e){e.data=e.data||{},e.jsonp=e.jsonp||"callback";var t="jsonp_"+(new Date).getTime();e.data[e.jsonp]=t;var o=this.formateParams(e.data,e.cache),n=document.getElementsByTagName("head")[0],i=document.createElement("script");n.appendChild(i),window[t]=function(o){n.removeChild(i),clearTimeout(i.timer),window[t]=null,e.success&&e.success(o)},i.src=o?e.url+"?"+o:e.url,e.time&&(i.timer=setTimeout(function(){window[t]=null,n.removeChild(i),e.error&&e.error({message:"超时"})},e.time))},ajaxJSON:function(e){e.type=(e.type||"GET").toUpperCase(),e.data=e.data||{};var t,o=this.formateParams(e.data,e.cache);if(t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),t.onreadystatechange=function(){4===t.readyState&&(200===t.status?e.success&&("string"==typeof t.responseText?e.success(t):e.success(t)):429===t.status?e.success&&t.responseText&&("string"==typeof t.responseText?e.success(t):e.success(t)):e.error&&e.error(t.status))},"GET"===e.type)t.open("GET",o?e.url+"?"+o:e.url,!0),t.send(null);else{if(e.headers&&"application/json"==e.headers["Content-Type"]){t.open("POST",e.url,!0);for(var n in e.headers)t.setRequestHeader(n,e.headers[n]);return void t.send(JSON.stringify(e.data))}t.open("POST",o?e.url+"?"+o:e.url,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(o)}},formateParams:function(e,t){var o=[];for(var n in e)o.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t&&o.push("v="+(new Date).getTime()),o.join("&")}});e.exports=new n},function(e,exports,t){var o,n,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=t(1),a=r.extend({_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",checkOs:function(){var e=navigator.userAgent,t=(navigator.appVersion,e.indexOf("Android")>-1||e.indexOf("Linux")>-1),o=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return t?"ANDROID":o?"IOS":void 0},getDeviceType:function(){return navigator&&navigator.userAgentData&&navigator.userAgentData.mobile?"Mobile":/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?"Mobile":"Browser"},encode:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},decode:function(e){return decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))},open_pay_url:function(e){this.showDetail(event,e)},pay_url:function(e){if("IOS"==s.checkOs()){console.log("pay ios ===>",e);var t=document.createElement("iframe");t.href=e,t.target="_self",top.location.href=location.href,t.click(),window.location.href=e,setTimeout(function(){document.body.removeChild(t)},3e3)}else{console.log("pay android ===>",e);var o=document.createElement("a");o.href=e,document.body.appendChild(o),o.click(),document.body.removeChild(o)}},showDetail:function(e,t){window.tysdk=this;var o=document.getElementsByTagName("head")[0],n="https://downqn.tuyoo.com/h5sdk/v100/src/css/style.css",i=document.createElement("link");i.href=n,i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css");var r=document.createElement("meta");r.setAttribute("name","viewport"),r.setAttribute("content","width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes"),o.appendChild(r),o.appendChild(i);var a='
    充值中心 X
    ',s=document.createElement("div");s.setAttribute("id","detailui"),s.innerHTML=a,document.getElementsByTagName("body")[0].appendChild(s)},fadeoutDetail:function(e){var t=e||event;t.stopPropagation();var o=document.getElementById("detailui");document.getElementsByTagName("body")[0].removeChild(o)},changeFrameHeight1:function(){ +var e=document.getElementById("myiframe");e.height=document.documentElement.clientHeight},Login_SIGN:function(e,t,o,n){var i=this.decode(n),r="userID="+e+"&clientID="+t+"&gameID="+o+"&signKey="+i;return this.signature(r)},signature:function(e){function t(e,t){var o,n,i,r,a;return i=2147483648&e,r=2147483648&t,o=1073741824&e,n=1073741824&t,a=(1073741823&e)+(1073741823&t),o&n?2147483648^a^i^r:o|n?1073741824&a?3221225472^a^i^r:1073741824^a^i^r:a^i^r}function o(e,o,n,i,r,a,s){return e=t(e,t(t(o&n|~o&i,r),s)),t(e<>>32-a,o)}function n(e,o,n,i,r,a,s){return e=t(e,t(t(o&i|n&~i,r),s)),t(e<>>32-a,o)}function i(e,o,n,i,r,a,s){return e=t(e,t(t(o^n^i,r),s)),t(e<>>32-a,o)}function r(e,o,n,i,r,a,s){return e=t(e,t(t(n^(o|~i),r),s)),t(e<>>32-a,o)}function a(e){var t,o="",n="";for(t=0;3>=t;t++)n=e>>>8*t&255,n="0"+n.toString(16),o+=n.substr(n.length-2,2);return o}var s,l,c,d,u,p,_,f,h=[];for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",o=0;on?t+=String.fromCharCode(n):(127n?t+=String.fromCharCode(n>>6|192):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128)),t+=String.fromCharCode(63&n|128))}return t}(e),h=function(e){var t,o=e.length;t=o+8;for(var n=16*((t-t%64)/64+1),i=Array(n-1),r=0,a=0;a>>29,i}(e),u=1732584193,p=4023233417,_=2562383102,f=271733878,e=0;e>5]|=(e.charCodeAt(r/8)&o)<>2]>>8*(r%4)&255)<<16|(t[r+1>>2]>>8*((r+1)%4)&255)<<8|t[r+2>>2]>>8*((r+2)%4)&255,s=0;s<4;s++)i+=8*r+6*s>32*t.length?"":n.charAt(a>>6*(3-s)&63);return i},showModal:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.title,o=void 0===t?"":t,n=e.content,i=void 0===n?"":n,r=e.showCancel,a=void 0===r||r;return new Promise(function(e){var t="https://downqn.tuyoo.com/h5sdk/v100/src/css/modal.css";if(!document.querySelector('link[href="'+t+'"]')){var n=document.createElement("link");n.rel="stylesheet",n.href=t,document.head.appendChild(n)}var r=document.createElement("div");r.className="custom-modal",r.innerHTML='\n ',document.body.appendChild(r),r.querySelector(".ok-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!0,cancel:!1})}),a&&r.querySelector(".cancel-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!1,cancel:!0})})})}}),s=new a;!function(r,a){"object"===i(exports)?e.exports=a():(o=a,n="function"==typeof o?o.call(exports,t,exports,e):o,!(void 0!==n&&(e.exports=n)))}(void 0,function(){return s})},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=Object.assign||function(e){for(var t=1;t0){var n=function(o){t.deleteCache(e),t.reportCacheData()};this.httpRequestWithLimit(o,n)}else this.reportCacheData()},processArray2String:function(e){if(e){var t="";return e.forEach(function(e){t+=e+"\n"}),t}},reportCacheData:function(){var e=this.getCacheWithLimitCount(this.gaLocalCacheData,10);e&&e.length>0&&this.reportGALog(e)},getCacheWithLimitCount:function(e,t){if(e){for(var o=[],n=Array.from(e),i=n.length>t?t:n.length,r=0;r100&&this.gaLocalCacheData.shift())},deleteCache:function(e){var t=this;e&&this.gaLocalCacheData&&e.forEach(function(e){t.gaLocalCacheData.indexOf(e)>-1&&t.gaLocalCacheData.splice(t.gaLocalCacheData.indexOf(e),1)})},httpRequest:function(e){var t=this;this.config&&this.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var o={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(o,function(e,o){t.tuyoo.config&&t.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+o)},function(e,t){console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})},httpRequestWithLimit:function(e,t){var o=this;if(!this.biLimitState){this.biLimitState=!0,this.tuyoo.config&&this.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var n={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(n,function(e,n){o.biLimitState=!1,200==n.status&&t&&t(n.data),o.tuyoo.config&&o.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+n)},function(e,t){o.biLimitState=!1,console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})}}});e.exports=a},function(e,exports){"use strict";var t=t||{};t.initCode={success:0,fail:-1},t.loginCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.payCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1001,navigatePayPageSucc:1e3},t.smsCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.biCode={success:0,fail:-1},t.verifyCode={success:t.initCode.success,fail:t.initCode.fail},t.shareCode={success:t.initCode.success,fail:t.initCode.fail},t.dealOrderFailCode={continue:t.initCode.success,needReOrder:t.initCode.fail},t.loginEvent={success:"登录成功",fail:"登录失败",cancle:"登录取消",sns_error:"snsId为undefined"},t.payEvent={success:"支付成功",fail:"支付失败",cancle:"支付取消",invalid:"支付方式无效"},t.initEvent={success:"初始化成功",fail:"初始化失败",url_null:"初始化URL为空"},t.biEvent={success:"上报成功",fail:"上报失败"},t.verifyEvent={success:"认证成功",fail:"认证失败"},e.exports=t},function(e,exports){"use strict";var t={GAEvents:{SDK_INIT_ENT:"sdk_c_init_end",SDK_LOGIN_START:"sdk_c_login_start",SDK_LOGIN_SUCC:"sdk_c_login_succ",SDK_LOGIN_FAIL:"sdk_c_login_fail",SDK_BIND_START:"sdk_c_bind_start",SDK_BIND_SUCC:"sdk_c_bind_succ",SDK_BIND_FAIL:"sdk_c_bind_fail",SDK_CHANNEL_INIT_START:"sdk_c_channel_init_start",SDK_CHANNEL_INIT_SUCC:"sdk_c_channel_init_succ",SDK_CHANNEL_INIT_FAIL:"sdk_c_channel_init_fail",SDK_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_LOGIN_BY_SDKSERVER_START:"sdk_c_login_by_sdkserver_start",SDK_LOGIN_BY_SDKSERVER_SUCC:"sdk_c_login_by_sdkserver_succ",SDK_LOGIN_BY_SDKSERVER_FAIL:"sdk_c_login_by_sdkserver_fail",SDK_PAY_START:"sdk_c_pay_start",SDK_PAY_SUCC:"sdk_c_pay_succ",SDK_PAY_FAIL:"sdk_c_pay_fail",SDK_PAY_LAUNCH_SUCC:"sdk_c_pay_launch_succ",SDK_C_ORDER_START:"sdk_c_order_start",SDK_C_ORDER_SUCC:"sdk_c_order_succ",SDK_C_ORDER_FAIL:"sdk_c_order_fail",SDK_C_REQUEST_CHANNEL_PAY_START:"sdk_c_request_channel_pay_start",SDK_C_REQUEST_CHANNEL_PAY_SUCC:"sdk_c_request_channel_pay_succ",SDK_C_REQUEST_CHANNEL_PAY_FAIL:"sdk_c_request_channel_pay_fail",SDK_C_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_C_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_C_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_SHARE_START:"sdk_c_share_start",SDK_SHARE_SUCC:"sdk_c_share_succ",SDK_SHARE_FAIL:"sdk_c_share_fail",SDK_C_GAME_LAUNCH:"sdk_c_game_launch",SDK_C_VERIFY:"sdk_c_verify"}};e.exports=t},function(e,exports,t){"use strict";var o=t(8),n=new o,i={"jingdong.cn.minigame":n},r={"jingdong.cn.minigame.iap":n},a={"jingdong.cn.minigame":n};e.exports={tyLoginInterface:i,tyPayInterface:r,tyInitInterface:a}},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=t(1),i=t(5),r=t(6),a=t(3),s=n.extend({get ChargeType(){return"jingdong.cn.minigame.iap"},get ChannelType(){return"jingdong.cn.minigame"},ctor:function(){},OnInit:function(e,t,o,n){var a=this;this.config=t,this.tuyoo=e,this.jingdongAppId=t.jingdongAppId,a.options=jd.getLaunchOptionsSync(),console.log("========> jngdong getLaunchOptionsSync: ",JSON.stringify(a.options)),a.systemInfo=jd.getSystemInfoSync(),console.log("========> jingdong getSystemInfoSync: ",JSON.stringify(a.systemInfo)),this.InitNetworkListener(e),this.initShare(e);var s={sdk_channel_app_id:t.jingdongAppId,phone_model:a.systemInfo.model,os_name:a.systemInfo.platform,api_version:a.systemInfo.SDKVersion,sdk_channel_version:a.systemInfo.hostVersionName,os_version:a.systemInfo.system,sdk_channel_language:a.systemInfo.language,sdk_channel_platform:a.systemInfo.hostCode,sdk_device_brand:a.systemInfo.brand,sdk_origin_device_level_info:a.systemInfo.benchmarkLevel||"",sdk_c_version:"1.0.1.251009_release"};e.bi.AddGAReportCommonInfo(s);var l={sdk_channel_lanuch_params:this.options?JSON.stringify(this.options):"",sdk_channel_lanuch_scene_id:this.options&&this.options.scene?this.options.scene:""};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,r.GAEvents.SDK_C_GAME_LAUNCH,l),a.IsNull(a.jingdongAppId)?o.call(n,i.initCode.fail,null,"jingdongAppId is undefined"):o.call(n,i.initCode.success,i.initEvent.success,null)},InitNetworkListener:function(e){var t=function(t){console.log("onGetNetworkSuccListener: "+JSON.stringify(t)),t.hasOwnProperty("isConnected")&&!t.isConnected?e.bi.AddGAReportCommonInfo({network:"UNCONNECT"}):e.bi.AddGAReportCommonInfo({network:t.networkType})};jd.getNetworkType({success:t}),jd.onNetworkStatusChange(t)},Is:function(){return!0},Login:function(e,t,o,n){var s=this;s.loginParams=t,console.log("jingdong-login-start");var l={sdk_login_channel_type:s.ChannelType};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,r.GAEvents.SDK_C_LOGIN_BY_CHANNEL_START,l),jd.login({success:function(t){console.log("jingdong login success",JSON.stringify(t));var c=t.code,d=o.postdata;s.IsNull(c)?(l.sdk_channel_error_code="2",l.sdk_channel_error_msg=JSON.stringify(t),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,r.GAEvents.SDK_C_LOGIN_BY_CHANNEL_FAIL,l),n.call(e,i.loginCode.fail,null,JSON.stringify(t))):(e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,r.GAEvents.SDK_C_LOGIN_BY_CHANNEL_SUCC,l),d.ch_app_id=s.jingdongAppId,d.ch_auth_code=c,d.osName=s.systemInfo.platform,d.snsId=s.ChannelType+":"+c,s.options&&(d.scene_id=s.options.scene,d.scene_param=a.base64(JSON.stringify(s.options.query)),s.options.query&&s.options.query.inviteCode&&(d.invite_id=s.options.query.inviteCode)),d.os_version=s.systemInfo.system,d.sdk_device_brand=s.systemInfo.brand,d.phone_model=s.systemInfo.model,d.sdk_origin_device_level_info=s.systemInfo.benchmarkLevel||"",n.call(e,i.loginCode.success,o,null))},fail:function(t){console.log("jingdong login fail",JSON.stringify(t)),l.sdk_channel_error_code="1",l.sdk_channel_error_msg=JSON.stringify(t),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,r.GAEvents.SDK_C_LOGIN_BY_CHANNEL_FAIL,l),n.call(e,i.loginCode.fail,null,JSON.stringify(t))},complete:function(){console.log("jingdong login complete")}})},LoginEnd:function(e,t,o){try{console.log("jingdong minigame LoginEnd======>status: "+e+" \n error : "+o),100504==e&&this.loginParams.isShowLimitToast!==!1&&(this.tuyoo.bi.ReportGAWithType(this.tuyoo,this.tuyoo.bi.GA_TYPE.LOGIN,"sdk_c_receive_gateway_limit_info",{gateway_info:o}),jd.showModal({title:"温馨提示",content:o||"当前玩家过多,请稍后再试~",showCancel:!1,success:function(e){console.log(e)},fail:function(e){console.log(e)}}))}catch(e){console.error("jingdong minigame LoginEnd",e)}},ExtraOrderParams:function(e,t,o){var n=this;o.chargeType=n.ChargeType,o.ch_app_id=n.jingdongAppId,o.osName=n.systemInfo.platform,o.jd_currency=this.IsNull(t.jingdongCurrency)?1:t.jingdongCurrency,o.os_version=n.systemInfo.system,o.sdk_device_brand=n.systemInfo.brand,o.phone_model=n.systemInfo.model,o.sdk_origin_device_level_info=n.systemInfo.benchmarkLevel||""},Pay:function(e,t,o,n,a){var s=this,l=s.getGaParams(t);l.sdk_event_tips="jingdong_minigame_channel_pay_start",e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,r.GAEvents.SDK_C_VERIFY,l);var c=t.chargeData;try{jd.navigateToNative({dataParam:{url:"openapp.jdmobile://virtual",params:{category:"jump",url:c.url,des:"m",param:{}},success:function(e){console.log("跳转支付成功:",JSON.stringify(e))},fail:function(e){console.error("跳转支付失败:",JSON.stringify(e))}}}),n.call(e,i.payCode.navigatePayPageSucc,"navigate pay page success",null)}catch(t){console.error("跳转支付失败:",JSON.stringify(t)),l.sdk_event_tips="jingdong_minigame_channel_pay_fail",e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,r.GAEvents.SDK_C_VERIFY,l),n.call(e,i.payCode.fail,null,JSON.stringify(t))}},Logout:function(){},onExit:function(){jd.exitMiniProgram({complete:function(e){console.log("jingdong exitMiniProgram",e)}})},IsNull:function(e){return void 0===e||null===e||""===e},SetDefaultShareInfo:function(e,t){this.shareInfo=t},initShare:function(e){var t=this;return this.config.jdShareEnable===!1?void jd.hideShareMenu({success:function(e){console.log("jingdong hideShareMenu success")}}):(this.IsNull(this.shareInfo)&&(this.shareInfo={}),void jd.onShareAppMessage(function(){var o={sdk_c_share_track_id:e.CreateUUID(),sdk_share_user_id:e.userId};return e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,r.GAEvents.SDK_SHARE_START,o),{title:t.shareInfo.title,type:t.shareInfo.type,imageUrl:t.shareInfo.imageUrl,channel:t.shareInfo.channel,url:t.shareInfo.url,desc:t.shareInfo.desc,keyShareChannel:t.shareInfo.keyShareChannel,localImageUrl:t.shareInfo.localImageUrl,onlineImageUrl:t.shareInfo.onlineImageUrl,query:"inviteCode="+e.userId+"&extraInfo="+(t.shareInfo.extraParams?t.shareInfo.extraParams:""),success:function(n){console.log("onShareAppMessage success:"+JSON.stringify(n)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,r.GAEvents.SDK_SHARE_SUCC,o),t.shareInfo&&t.shareInfo.callback&&t.shareInfo.callback.call(e,i.shareCode.success,JSON.stringify(n),null)},fail:function(n){console.log("onShareAppMessage fail:"+JSON.stringify(n)),o.sdk_channel_error_msg=JSON.stringify(n),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,r.GAEvents.SDK_SHARE_FAIL,o),t.shareInfo&&t.shareInfo.callback&&t.shareInfo.callback.call(e,i.shareCode.fail,null,JSON.stringify(n))},complete:function(e){console.log("onShareAppMessage complete:"+JSON.stringify(e))}}}))},Share:function(e,t,o){console.log("jongdong share: "+JSON.stringify(t));var n={sdk_c_share_track_id:e.CreateUUID(),sdk_share_user_id:e.userId};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,r.GAEvents.SDK_SHARE_START,n);var a={title:t.title,type:t.type,imageUrl:t.imageUrl,channel:t.channel,url:t.url,desc:t.desc,keyShareChannel:t.keyShareChannel,localImageUrl:t.localImageUrl,onlineImageUrl:t.onlineImageUrl,query:"inviteCode="+e.userId+"&extraInfo="+(t.extraParams?t.extraParams:""),success:function(t){console.log("shareAppMessage success:"+JSON.stringify(t)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,r.GAEvents.SDK_SHARE_SUCC,n),o.call(e,i.shareCode.success,JSON.stringify(t),null)},fail:function(t){console.log("shareAppMessage fail:"+JSON.stringify(t)),n.sdk_channel_error_msg=JSON.stringify(t),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,r.GAEvents.SDK_SHARE_FAIL,n),o.call(e,i.shareCode.fail,null,JSON.stringify(t))}};jd.shareAppMessage(a)},getGaParams:function(e){var t={sdk_pay_type:this.ChargeType};return!this.IsNull(e)&&this.isJSON(JSON.stringify(e))&&(t.sdk_order_track_id=e?e.sdk_order_track_id:"DEFAULT",t.sdk_order_id=e?e.platformOrderId:"DEFAULT",t.sdk_game_order_id=e?e.prodOrderId:"DEFAULT",t.sdk_product_id=e?e.prodId:"DEFAULT"),t},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":o(t))||!t)}catch(e){return!1}return!1},HttpLib:function(e,t){if(t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{},"GET"===t.type){var o=this.formateParams(t.data,t.cache);t.url=o?t.url+"?"+o:t.url,jd.request({url:t.url,method:t.type,header:{"Content-Type":"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(e){t.error&&t.error(e)}})}else jd.request({url:t.url,method:t.type,header:t.headers?t.headers:{"Content-Type":"application/x-www-form-urlencoded"},data:t.data,success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(e){t.error&&t.error(e)}})},formateParams:function(e,t){var o=[];for(var n in e)o.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t&&o.push("v="+(new Date).getTime()),o.join("&")},LocalStorage:function(){return this},SetItem:function(e,t){try{jd.setStorageSync(e,t)}catch(e){console.log("====>jd setStorageSync fail: "+JSON.stringify(e))}},RemoveItem:function(e){try{jd.removeStorageSync(e)}catch(e){console.log("====>jd removeStorageSync fail: "+JSON.stringify(e))}},GetItem:function(e){try{return jd.getStorageSync(e)}catch(e){console.log("====>jd getStorageSync fail: "+JSON.stringify(e))}return""},Clear:function(){try{jd.clearStorage()}catch(e){console.log("====>jd clearStorage fail: "+JSON.stringify(e))}}});e.exports=s}])}); +//# sourceMappingURL=tuyoosdk_release.js.map \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/tuyoosdk_jingdongminigame_1.0.1.251009_release.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/tuyoosdk_jingdongminigame_1.0.1.251009_release.js.meta new file mode 100644 index 0000000..d62bf3c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/jingdongminigame/tuyoosdk_jingdongminigame_1.0.1.251009_release.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 68b516af9e39e473891535f4e764041a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame.meta new file mode 100644 index 0000000..f5e0fdc --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 786cf4d95c48b4dbfacc52cdd9831796 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/TyJsBridge.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/TyJsBridge.js new file mode 100644 index 0000000..1e50cf5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/TyJsBridge.js @@ -0,0 +1,170 @@ +var TuyooSdkBridge = { + + loadJsScriptToBridge: function (channelType) { + var channelTypeFromCS = UTF8ToString(channelType); + console.log("channelTypeFromCS:" + channelTypeFromCS); + }, + + InitToBridge: function (initEventInfo) { + try { + var initCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "InitResult", callbackString); + } + var initInfoFromCS = UTF8ToString(initEventInfo); + var initInfo = JSON.parse(initInfoFromCS); + var tyInitParams = {}; + tyInitParams.appId = initInfo.tuyooParam.appId; + tyInitParams.gameId = initInfo.tuyooParam.gameId; + tyInitParams.pay_version = "hall37"; + tyInitParams.baseurl = initInfo.tuyooParam.serverUrl.endsWith("/") ? initInfo.tuyooParam.serverUrl : initInfo.tuyooParam.serverUrl + "/"; + tyInitParams.bi_base_url = "https://cbi.tuyoo.com/"; + tyInitParams.cloudId = initInfo.tuyooParam.cloudId; + tyInitParams.packageName = initInfo.package; + tyInitParams.clientId = initInfo.tuyooParam.clientId; + tyInitParams.kuaishou_appId = initInfo.login.kuaishouminigame.kuaishouAppId; + console.log("initInfo: " + JSON.stringify(initInfo)); + GameGlobal.TuyooSdk.OnInit(initInfo.tuyooParam.channelType, tyInitParams, initCallback, this); + } catch (e) { + console.error("InitToBridge catch error: " + e); + } + }, + + // 切换SDK域名 + UpdateServerUrlToBridge: function (serverUrl) { + try { + var serverUrlFromCS = UTF8ToString(serverUrl); + GameGlobal.TuyooSdk.baseuri = (serverUrlFromCS.substring(serverUrlFromCS.length - 1) === '/') ? serverUrlFromCS.substring(0, serverUrlFromCS.length - 1) : serverUrlFromCS; + console.log("update serverUrl to: " + window.TuyooSdk.baseuri); + } catch (e) { + console.error("UpdateServerUrlToBridge catch error: " + e); + } + }, + + LoginToBridge: function (loginEventInfo) { + try { + var loginCallback = function (code, result, error) { + var callbackResult = { + code: code, + result: result && result.logindata ? result.logindata : result, + error: error + }; + var callbackString = JSON.stringify(callbackResult); + SendMessage("NativeCallBack", "LoginResult", callbackString); + } + var loginInfoFromCS = UTF8ToString(loginEventInfo); + var loginInfo = JSON.parse(loginInfoFromCS); + var tyLoginParams = {}; + if (loginInfo.loginType) { + tyLoginParams.ChannelType = loginInfo.loginType; + } + if (loginInfo.extraParams) { + var extraParams = JSON.parse(loginInfo.extraParams); + tyLoginParams.extraParams = extraParams; + } + console.log("tyLoginParams: " + JSON.stringify(tyLoginParams)); + GameGlobal.TuyooSdk.Login(tyLoginParams, loginCallback, this); + } catch (e) { + console.error("LoginToBridge catch error: " + e); + } + }, + + PayToBridge: function (payEventInfo) { + try { + var payCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "PayResult", callbackString); + } + var payInfoFromCS = UTF8ToString(payEventInfo); + var payInfo = JSON.parse(payInfoFromCS); + var tyPayParams = {}; + tyPayParams.prodCount = 1; + tyPayParams.appInfo = ""; + if (payInfo.chargeService) { + tyPayParams.ChargeType = payInfo.chargeService; + } + if (payInfo.productCount) { + tyPayParams.prodCount = payInfo.productCount; + } + if (payInfo.serverAppInfo) { + tyPayParams.appInfo = payInfo.serverAppInfo; + } + if (payInfo.gameOrderId) { + tyPayParams.prodOrderId = payInfo.gameOrderId; + } + if (payInfo.extraParams) { + var extraParams = JSON.parse(payInfo.extraParams); + tyPayParams.extraParams = extraParams; + } + tyPayParams.prodId = payInfo.productId; + tyPayParams.prodName = payInfo.productName; + tyPayParams.prodPrice = payInfo.productPrice; + console.log("tyPayParams: " + JSON.stringify(tyPayParams)); + GameGlobal.TuyooSdk.Pay(tyPayParams, payCallback, this); + } catch (e) { + console.error("PayToBridge catch error: " + e); + } + }, + + SetShareInfoToBridge: function (shareEventInfo) { + console.error("current channel not support SetShareInfo function"); + }, + + ShareToBridge: function (shareEventInfo) { + console.error("current channel not support Share function"); + }, + + GAEventTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + if (!reportInfo.typeName) { + reportInfo.typeName = "track"; + } + GameGlobal.TuyooSdk.bi.trackWithType(reportInfo.typeName, reportInfo.eventName, reportInfo.reportEvent); + } catch (e) { + console.error("GAEventTrackToBridge catch error: " + e); + } + }, + + GAProfileTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + GameGlobal.TuyooSdk.bi.profileTrack(reportInfo.profileType, reportInfo.profileSubjectType, reportInfo.profileSubjectPrimary, reportInfo.reportEvent); + } catch (e) { + console.error("GAProfileTrackToBridge catch error: " + e); + } + }, + + GetShareInfoBridge: function () { + console.error("current channel not support GetShareInfo function"); + }, + + GetAdInfoBridge: function () { + console.error("current channel not support GetAdInfo function"); + }, + + TxAdSDKReportToBridge: function (txAdReportInfo) { + console.error("current channel not support TxAdSDKReport function"); + }, + + CheckBindToBridge: function (bindEventInfo) { + console.error("current channel not support CheckBind function"); + }, + + SendSmsCodeToBridge: function (loginEventInfo) { + console.error("current channel not support SendSmsCode function"); + }, + + BindToBridge: function (bindEventInfo) { + console.error("current channel not support Bind function"); + }, + + SetWxUserInfoToBridge: function (type, userInfo) { + console.error("current channel not support SetWxUserInfo function"); + } + +} + +mergeInto(LibraryManager.library, TuyooSdkBridge); \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/TyJsBridge.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/TyJsBridge.js.meta new file mode 100644 index 0000000..e3317b6 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/TyJsBridge.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1bdda16891c2c4b19a48cb96f19c4a6f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/link.xml b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/link.xml new file mode 100644 index 0000000..1df8d86 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/link.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/link.xml.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/link.xml.meta new file mode 100644 index 0000000..7dd7ca9 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/link.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3c56e51a2563d47bb9e7e1fb87018692 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/tuyoosdk_kuaishouminigame_1.0.3.251023_release.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/tuyoosdk_kuaishouminigame_1.0.3.251023_release.js new file mode 100644 index 0000000..a8e16bd --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/tuyoosdk_kuaishouminigame_1.0.3.251023_release.js @@ -0,0 +1,3 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TuyooSdk=t():e.TuyooSdk=t()}(this,function(){return function(e){function t(i){if(o[i])return o[i].exports;var n=o[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,exports,t){function o(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var i,n,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=t(1),l=t(2),c=t(3),d=t(4),u=t(6),p=t(5),_=t(7),f=s.extend((r={baseuri:{get:function(){return this._baseuri},set:function(e){this._baseuri=e}},sdkRoute:{set:function(e){this._sdkRoute=e},get:function(){return void 0===this._sdkRoute||""===this.sdkRoute?"/open/v6/user/LoginBySnsIdNoVerify":this._sdkRoute}},payversion:{get:function(){return this._payversion},set:function(e){this._payversion=e}},clientId:{get:function(){return this._clientId},set:function(e){this._clientId=e}},packageName:{get:function(){return this._packageName},set:function(e){this._packageName=e}},appId:{get:function(){return this._appId},set:function(e){this._appId=e}},gameId:{get:function(){return this._gameId},set:function(e){this._gameId=e}},userId:{get:function(){return this._userId},set:function(e){this._userId=e}},token:{get:function(){return this._token},set:function(e){this._token=e}},logindata:{get:function(){return this._logindata},set:function(e){this._logindata=e}},ctor:function(){this.bi=new d},uuid:function(){if(this.IsNull(this._uuid))try{var e=this.LocalStorage().GetItem("ty_uuid");this.IsNull(e)?(this._uuid=this.CreateUUID(32,16),this.LocalStorage().SetItem("ty_uuid",this._uuid)):this._uuid=e}catch(e){return this.CreateUUID(32,16)}return this._uuid},CheckChannel:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t.tyPlatform))return t.tyPlatform}}return null},CheckParams:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t))return t}}return null},Decode:function(e){return c.decode(e)},IsNull:function(e){return void 0===e||null===e||""===e},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":a(t))||!t)}catch(e){return!1}},StartupParameter:function(){return this.platform().StartupParameter(this)},orderuri:function(){return"hall37"===this.payversion?this.baseuri+"/open/v4/pay/order":"hall51"===this.payversion?this.baseuri+"/open/v5/pay/order":this.baseuri+"/open/v4/pay/order"},platform:function(e){return this.IsNull(e)&&(e=this.type),_.tyLoginInterface[e]},platformPay:function(e){return _.tyPayInterface[e]},OnInitDebuger:function(e,t){var o="https://downqn.tuyoo.com/h5sdk/v100/js/vconsole.min.js";this.loadScript(o,function(o,i){if(0===o){new VConsole;console.log("----------tuyoosdk.OnInit-->initdebug:"),e.call(t,o,i,null)}else e.call(t,1005,null,"失败")})},OnInit:function(e,t,o,i){var n=this;console.log("----------tuyoosdk.OnInit-->channel:",e),t.debug&&n.OnInitDebuger(function(e,t,o){console.log(window.location.href,e,t,o)},n),n.TuyooInit(e,t,o,i)},SetDefaultShareInfo:function(e){this.IsNull(this.platform().SetDefaultShareInfo)||this.platform().SetDefaultShareInfo(this,e)},Share:function(e,t){this.IsNull(this.platform().Share)?t&&t.call(this,p.shareCode.fail,null,""+this.type+"不支持分享"):this.platform().Share(this,e,t)},CallMethod:function(e,t,o,i){var n=this.IsNull(t.ChannelType)?this.type:t.ChannelType;if(!this.IsNull(this.platform(n))&&"function"==typeof this.platform(n)[e]){var r=[this,t,o];return this.platform(n)[e].apply(i,r)}o&&o.call(this,p.initCode.fail,null,""+n+"不支持此功能("+e+")")},TuyooInit:function(e,t,o,i){var n=this;n.config=t;var r=(new Date).getTime(),a=function(e,t,a){0===e&&n.bi.ReportGAWithType(n,n.bi.GA_TYPE.TRACK,u.GAEvents.SDK_INIT_ENT,{sdk_init_duration_time:(new Date).getTime()-r});var s=[];for(var l in arguments)s.push(arguments[l]);o.apply(i,s)};if(n.IsNull(t.wxAppId)||(n.wxAppId=t.wxAppId),void 0===t.bi_base_url&&(t.bi_base_url="https://cbi.tuyoo.com/"),n.IsNull(t.pay_version)&&(t.pay_version="hall37"),"hall37"!==t.pay_version&&"hall51"!==t.pay_version)return void o.call(i,p.initCode.fail,null,"pay_version 必须为 hall37|hall51");if(this.IsNull(t.userId)?this.userId=0:this.userId=t.userId,console.log("----------tuyoosdk.OnInit-->config:",t),n.IsNull(t.clientId))if(n.IsNull(this.InitClientId())){if(!t.debug)return void o.call(i,p.initCode.fail,null,"clientId不能为空");t.clientId="Android_4.58_meitu.meitu.0-hall6.meitu.tu"}else t.clientId=this.InitClientId();this.type=e,this.appId=t.appId,this.gameId=t.gameId,this.clientId=t.clientId,this.payversion=t.pay_version,this.baseuri="/"===t.baseurl.substring(t.baseurl.length-1)?t.baseurl.substring(0,t.baseurl.length-1):t.baseurl,this.bi_base_uri="/"===t.bi_base_url.substring(t.bi_base_url.length-1)?t.bi_base_url.substring(0,t.bi_base_url.length-1):t.bi_base_url,this.packageName=t.packageName,console.log("----------tuyoosdk.OnInit-->clientId:",this.clientId),console.log("----------tuyoosdk.OnInit-->baseuri:",this.baseuri),console.log("----------tuyoosdk.OnInit-->platform:",this.platform()),this.bi.OnInit(this,t,function(r,s,l){0===r?(n.platform().OnInit(n,t,a,n),n.InitOtherThird(e,t,a,i)):o.call(i,r,s,l)},this)},InitOtherThird:function(e,t,o,i){for(var n in _.tyInitInterface)if(n!==e){var r=function(e,t,o){console.log("----------tuyoosdk.InitOtherThird-->type:",n," status: ",e)};_.tyInitInterface[n].OnInit(this,t,r,this)}},Is:function(e){var t=this.platform(e);return!this.IsNull(t)&&t.Is()},InitClientId:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(this.IsNull(e)===!1){var t=this.GetQueryToMap(e.substr(1,e.length));return this.IsNull(t.clientId)===!1?t.clientId:null}return null}return null},Login:function(e,t,o){var i=this;this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_login_track_id||""===e.extraParams.sdk_login_track_id?e.sdk_login_track_id=this.CreateUUID(32,16):e.sdk_login_track_id=e.extraParams.sdk_login_track_id:e.sdk_login_track_id=this.CreateUUID(32,16),this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),i.IsNull(i.platform(e.ChannelType).realLogin)?this.realLogin(e,t,o):i.platform(e.ChannelType).realLogin(i,e,t,o)},GetUserInfo:function(e,t,o){this.IsNull(this.platform().GetUserInfo)?console.error(this.platform().ChannelType+" not support GetUserInfo"):this.platform().GetUserInfo(this,e,t,o)},realLogin:function(e,t,o){var i=this,n={sdk_login_channel_type:i.platform(e.ChannelType).ChannelType,sdk_login_track_id:e.sdk_login_track_id};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_START,n);var r=function(r,a,s){var l=i.convertLoginServerResultCode(r);0===l?(i.userId=a.userId,i.token=a.token,i.userPwd=a.userPwd,i.logindata=a.logindata,i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_SUCC,n),t&&t.call(o,p.loginCode.success,a,s)):(n.sdk_error_code=r,n.sdk_error_msg=JSON.stringify(s),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_FAIL,n),t&&t.call(o,l,a,s));try{i.IsNull(i.platform(e.ChannelType).LoginEnd)||i.platform(e.ChannelType).LoginEnd(r,a,s)}catch(e){console.log("----------tuyoosdk.LoginEnd-->err:",e)}},a={retryMax:1,url:i.baseuri+this.sdkRoute.get(),postdata:{imei:"null",idfa:"",appId:i.appId,gameId:i.gameId,clientId:i.clientId,packageName:i.packageName,uuid:i.uuid(),sdk_session_id:i.bi.sessionId,original_deviceid:i.uuid(),sdk_login_track_id:e.sdk_login_track_id}};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)i.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,n,a){console.log("===========>snsHook",o,n),0===t?i.IsNull(i.platform(e.ChannelType).tuyooLogin)?i.tuyooLogin(o,r,a):i.platform(e.ChannelType).tuyooLogin(o,r,a):r.call(i,p.loginCode.fail,null,n)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(i,e,a,l)},tuyooLogin:function(e,t,o){var i=this;console.log("tuyoo-login-request",e);var n={sdk_login_channel_type:i.platform().ChannelType,sdk_login_track_id:e.postdata.sdk_login_track_id};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_START,n);try{this.HttpLib(e,function(e,r){console.log("tuyoo-login-response",e,r);var a=JSON.parse(r.data);if(i.IsNull(a.result))n.sdk_error_msg=JSON.stringify(a),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,p.loginCode.fail,null,a);else if(0===a.result.code){var s={userId:a.result.userId,token:a.result.token,userPwd:a.result.userPwd,logindata:a.result};if(!i.IsNull(o))for(var l in o)s[l]=o[l];i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_SUCC,n),t.call(i,a.result.code,s)}else n.sdk_error_code=a.result.code,n.sdk_error_msg=JSON.stringify(a.result),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,a.result.code,null,a.result.info)},function(e,o){n.sdk_error_code=e,n.sdk_error_msg=JSON.stringify(o),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,p.loginCode.fail,null,o)},i)}catch(e){n.sdk_error_msg=JSON.stringify(e),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),console.log("tuyoo-login-catch",e),t.call(i,p.loginCode.fail,null,e)}},convertLoginServerResultCode:function(e){switch(e){case 0:return p.loginCode.success;case 12010:return 100201;case 12017:case 12130:return 100206;case 10:return 100502;case 100504:return 100504;default:return p.loginCode.fail}},Logout:function(){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(this)}},o(r,"Logout",function(e,t){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(e,t)}),o(r,"Bind",function(e,t,o){this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),this.realBind(e,t,o)}),o(r,"realBind",function(e,t,o){var i=this,n={sdk_login_channel_type:i.platform(e.ChannelType).ChannelType};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_START,n);var r=function(e,r,a){var s=i.convertLoginServerResultCode(e);0===s?(i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_SUCC,n),t&&t.call(o,p.loginCode.success,r,a)):(n.sdk_error_code=e,n.sdk_error_msg=JSON.stringify(a),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_FAIL,n),t&&t.call(o,s,r,a))};if(i.IsNull(i.userId)||0===i.userId||"0"===i.userId)return void r(p.loginCode.fail,null,"Do not login");var a={retryMax:1,url:i.baseuri+"/open/v6/user/bindBySnsId",postdata:{imei:"null",appId:i.appId,gameId:i.gameId,clientId:i.clientId,packageName:i.packageName,uuid:i.uuid(),sdk_session_id:i.bi.sessionId,original_deviceid:i.uuid(),userId:i.userId,passwd:i.userPwd}};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)i.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,n,a){console.log("===========>snsHook",o,n),0===t?i.IsNull(i.platform(e.ChannelType).tuyooBind)?i.tuyooBind(o,r,a):i.platform(e.ChannelType).tuyooBind(o,r,a):r.call(i,p.loginCode.fail,null,n)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(i,e,a,l)}),o(r,"tuyooBind",function(e,t,o){var i=this;console.log("tuyoo-bind-request",e);try{this.HttpLib(e,function(e,o){console.log("tuyoo-bind-response",e,o);var n=JSON.parse(o.data);i.IsNull(n.result)?t.call(i,p.loginCode.fail,null,n):0===n.result.code?t.call(i,n.result.code,n.result):t.call(i,n.result.code,n.result,n.result.info)},function(e,o){t.call(i,p.loginCode.fail,null,o)},i)}catch(e){console.log("tuyoo-bind-catch",e),t.call(i,p.loginCode.fail,null,e)}}),o(r,"Pay",function(e,t,o){console.log("==========>start pay "),this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_order_track_id||""===e.extraParams.sdk_order_track_id?e.sdk_order_track_id=this.CreateUUID(32,16):e.sdk_order_track_id=e.extraParams.sdk_order_track_id:e.sdk_order_track_id=this.CreateUUID(32,16),this.IsNull(e.ChargeType)&&(e.ChargeType=this.platform().ChargeType),this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_START,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_pay_type:e.ChargeType}),"tuyoo"!==e.ChargeType?this.realPay(e,t,o,e.ChargeType):this.payui(e,t,o)}),o(r,"isString",function(e){return"[object String]"===Object.prototype.toString.call(e)}),o(r,"Order",function(e,t,o){var i=this;if(void 0===e.prodCount&&(e.prodCount=1),void 0===e.appInfo&&(e.appInfo=""),void 0===e.prodOrderId&&(e.prodOrderId=""),i.IsNull(i.wxAppId)||(e.wxAppId=i.wxAppId),console.log("------- self.platformPay(args.ChargeType) ----------",i.platformPay(e.ChargeType)),!i.IsNull(i.platformPay(e.ChargeType).Order))return i.platformPay(e.ChargeType).Order(i,e,t,o);if(i.IsNull(i.userId)||0===i.userId||"0"===i.userId)return this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:p.payCode.fail,sdk_error_msg:"用户信息不合法",sdk_pay_type:e.ChargeType}),void t.call(o,p.payCode.fail,null,"用户信息不合法");var n={imei:"null",chargeType:e.ChargeType,userId:i.userId,appId:i.appId,gameId:i.gameId,mustcharge:"1",uuid:i.uuid(),clientId:i.clientId,prodId:e.prodId,prodName:e.prodName,prodCount:e.prodCount,prodPrice:e.prodPrice,appInfo:e.appInfo,prodOrderId:e.prodOrderId,sdk_session_id:i.bi.sessionId,sdk_order_track_id:e.sdk_order_track_id,original_deviceid:i.uuid()};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var r in e.extraParams)i.IsNull(n[r])&&(n[r]=e.extraParams[r]);i.platformPay(e.ChargeType).ExtraOrderParams(i,e,n);var a={url:i.orderuri(),postdata:n};i.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_START,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId}),i.HttpLib(a,function(r,a){var s;if(s=i.isString(a.data)?JSON.parse(a.data):a.data,s&&null!==s.result)if(0===s.result.code){var l=s.result.chargeInfo;i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_SUCC,{sdk_pay_type:l.chargeType,sdk_order_id:l?l.platformOrderId:"DEFAULT",sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id});var c;try{c=s.result.payData}catch(e){c=null,console.log("=============> 没有paydata数据",e)}var d=function(n,r,a){var s={sdk_pay_type:l.chargeType,sdk_order_id:l.platformOrderId,sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id};0===n?i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_SUCC,s):n===p.payCode.navigatePayPageSucc?i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_LAUNCH_SUCC,s):(s.sdk_error_code=n,s.sdk_error_msg=a,i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,s));var c=[];for(var d in arguments)c.push(arguments[d]);t.apply(o,c)};console.log(e.ChargeType),l.sdk_order_track_id=e.sdk_order_track_id,i.platformPay(e.ChargeType).Pay(i,l,c,d,i)}else{if(i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:s.result.code,sdk_error_msg:JSON.stringify(s.result)}),!i.IsNull(i.platformPay(e.ChargeType).dealOrderFail)){var _=function(n,r,a){console.log("=============> dealOrderFail hook status",n),n===p.dealOrderFailCode.needReOrder?i.Order(e,t,o):this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,p.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)};return void i.platformPay(e.ChargeType).dealOrderFail(i,s.result,_)}this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,p.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)}else i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:"DEFAULT",sdk_error_msg:JSON.stringify(s)}),t.call(o,p.payCode.fail,null,s)},function(r,a){i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:r,sdk_error_msg:a}),t.call(o,p.payCode.fail,null,a)},i)}),o(r,"realNameAuth",function(e,t){var o=this,i=function(e,i,n){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("----------tuyoosdk.realNameAuth-->err:",e)}},n={retryMax:1,url:o.baseuri+"/open/v6/user/update/sync/third",postdata:{imei:"null",idfa:"",appId:o.appId,gameId:o.gameId,clientId:o.clientId,packageName:o.packageName,uuid:o.uuid(),userId:o.userId}},r=function(e,t,n){console.log("===========>snsHook",t,n),0===e?o.IsNull(o.platform().syncThird)?o.syncThird(t,i):o.platform().syncThird(t,i):i.call(o,p.verifyCode.fail,null,n)};o.IsNull(o.platform().realNameAuth)?t.call(o,p.verifyCode.fail,null,"无渠道实名方法"):this.platform().realNameAuth(o,e,n,r)}),o(r,"syncThird",function(e,t){var o=this;console.log("tuyoo-syncThird-request",e),o.HttpLib(e,function(e,i){if(o.isString(i.data))var n=JSON.parse(i.data);else var n=i.data;n.result&&null!==n.result?(console.log("syncThird=============> "+JSON.stringify(n.result)),0===n.result.code?t.call(o,p.verifyCode.success,n.result,null):t.call(o,p.verifyCode.fail,null,n.result.info)):t.call(o,p.verifyCode.fail,null,n)},function(e,i){t.call(o,p.verifyCode.fail,null,i)},o)}),o(r,"ShowBuoy",function(){this.platform().ShowBuoy()}),o(r,"HideBuoy",function(){this.platform().HideBuoy()}),o(r,"ShoutCat",function(){this.platform().ShoutCat()}),o(r,"OnExit",function(){this.platform().onExit()}),o(r,"onExit",function(e){this.platform().onExit(e)}),o(r,"HttpLib",function(e,t,o,i){var n=this;void 0===e.retry&&(e.retry=0),void 0===e.retryMax&&(e.retryMax=0),void 0===e.method&&(e.method="POST"),void 0===e.headers&&(e.headers={"Content-Type":"application/x-www-form-urlencoded"});var r=function(e){l.ajax(n,e)};try{var a=this.platform(),s=!1;if("dmm.global.h5"!==a.ChannelType?s=!0:e.url!==n.config.bi_base_url+"api/bilog5/ga"&&(s=!0),s){var c=a.HttpLib;this.IsNull(c)||(r=function(e){c.call(a,n,e)})}}catch(e){}r({url:e.url,type:e.method,dataType:"json",headers:e.headers,data:e.postdata,success:function(r){console.log(e.url,">>请求结果》》》",r);try{var a={data:r.responseText,status:r.status},s={};"string"==typeof a.data?s=JSON.parse(a.data):(s=a.data,a.data=JSON.stringify(a.data)),n.IsNull(s.error)===!1?o.call(i,1009,s):t.call(i,0,a)}catch(e){t.call(i,0,a)}},error:function(r){console.log("网络异常",e.url),e.retry

    "+e.prodName+'

    \t
  • 微信支付
  • \t
  • 支付宝支付
  • \t

    选择支付方式

    ¥ '+e.prodPrice+"

    "+e.prodName+'

    \t
    \t\t
    微信支付
    \t\t
    支付宝支付
    \t
    ',l=document.createElement("div");l.setAttribute("id","payui"),l.innerHTML=s,document.getElementsByTagName("body")[0].appendChild(l)}),o(r,"realPay",function(e,t,o,i,n){var r=this;if(!this.IsNull(n)){console.log("==========>start pay ");var a=n||event;a.stopPropagation()}e.ChargeType=i;var s=function(e,i,n){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("应用层代码出错了--->"),console.log(e)}};try{r.Order(e,s,r)}catch(e){console.log("order error--->",e.toString())}}),o(r,"hidePay",function(e){var t=document.getElementById("payui");document.getElementsByTagName("body")[0].removeChild(t)}),o(r,"LoginByToken",function(e,t){var o=this,i={appId:e.appId,clientId:e.clientId,token:e.token,imei:null},n={url:o.baseuri+"/open/v4/user/loginByToken",postdata:i};o.HttpLib(n,function(e,i,n){if(0===e){var r=JSON.parse(i.data);if(null!==r.result)if(console.log("--------->message",r),0===r.result.code){var a={userId:r.result.userId,token:r.result.token,logindata:r.result};o.userId=r.result.userId,t.call(o,p.loginCode.success,a,null)}else t.call(o,p.loginCode.fail,null,r.result)}})}),o(r,"QueryOrderStatus",function(e,t){var o=this,i={appId:o.config.appId,clientId:o.config.clientId,platformOrderId:e.platformOrderId,userId:o.userId},n={url:o.baseuri+"/open/v4/pay/query",postdata:i};o.HttpLib(n,function(e,i,n){if(0===e){var r=JSON.parse(i.data);if(void 0!==r.error&&t.call(o,p.payCode.fail,null,"orderId not exist"),void 0!==r.result){var a={status:"notPaid"},e=r.result.status;"41"===e.toString()&&(a.status="paid",t.call(o,p.payCode.success,a,null)),t.call(o,p.payCode.success,a,null)}}})}),o(r,"Ad",function(){return this.IsNull(this.platform().Ad)?void console.error(this.platform().ChannelType+" not support Ad"):this.platform().Ad()}),o(r,"getDeviceBenchmarkLevel",function(e,t){this.IsNull(this.platform().getDeviceBenchmarkLevel)?console.error(this.platform().ChannelType+" not support getDeviceBenchmarkLevel"):this.platform().getDeviceBenchmarkLevel(this,e,t)}),r)),h=new f;!function(o,r){"object"===a(exports)?e.exports=r():(i=r,n="function"==typeof i?i.call(exports,t,exports,e):i,!(void 0!==n&&(e.exports=n)))}(void 0,function(){return h})},function(e,exports,t){function o(e){function t(){}return t.prototype=e,new t}function i(e,t){var i;i="function"==typeof Object.create?Object.create(t.prototype):o.create(t.prototype),i.constructor=e,e.prototype=i}var n,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function e(t,o){return function(){function n(){if("undefined"==typeof n.prototype.ctor);else{var e=new Array;for(var t in arguments)e.push(arguments[t]);n.prototype.ctor.apply(this,e)}}var r=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/,_super=t.prototype;i(n,t);var a=n.prototype;"undefined"==typeof _super||"undefined"==typeof _super.ctor&&(_super.ctor=t),n.extend=function(t){return e(n,t)};for(var s in o)a[s]="function"==typeof o[s]&&"function"==typeof _super[s]&&r.test(o[s])?function(e,t){return function(){var o=this._super;this._super=_super[e];var i=new Array;for(var n in arguments)i.push(arguments[n]);var r=t.apply(this,i);return this._super=o,r}}(s,o[s]):o[s];return n}()},l=s(function(){},{});!function(o,i){"object"===a(exports)?e.exports=i():(n=i,r="function"==typeof n?n.call(exports,t,exports,e):n,!(void 0!==r&&(e.exports=r)))}(void 0,function(){return l})},function(e,exports,t){"use strict";var o=t(1),i=o.extend({IsWxApp:function(){try{if(void 0!==wx.request)return!0}catch(e){return!1}},IncludeWxChannel:function(e){return"xiaomi.cn.minigame"===e.type},ajax:function(e,t){if(t=t||{},t.cache=t.cache||!1,!t.url)throw new Error("参数不合法");if(this.IsWxApp()&&!this.IncludeWxChannel(e)){t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{};var o=this.formateParams(t.data,t.cache);"GET"===t.type?(t.url=o?t.url+"?"+o:t.url,wx.request({url:t.url,method:"GET",header:{Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})):wx.request({url:t.url,method:"POST",data:o,header:{"content-type":"application/x-www-form-urlencoded",Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})}else t.dataType=(t.dataType||"json").toLowerCase(),"jsonp"==t.dataType?this.ajaxJSONP(t):"json"==t.dataType&&this.ajaxJSON(t)},ajaxJSONP:function(e){e.data=e.data||{},e.jsonp=e.jsonp||"callback";var t="jsonp_"+(new Date).getTime();e.data[e.jsonp]=t;var o=this.formateParams(e.data,e.cache),i=document.getElementsByTagName("head")[0],n=document.createElement("script");i.appendChild(n),window[t]=function(o){i.removeChild(n),clearTimeout(n.timer),window[t]=null,e.success&&e.success(o)},n.src=o?e.url+"?"+o:e.url,e.time&&(n.timer=setTimeout(function(){window[t]=null,i.removeChild(n),e.error&&e.error({message:"超时"})},e.time))},ajaxJSON:function(e){e.type=(e.type||"GET").toUpperCase(),e.data=e.data||{};var t,o=this.formateParams(e.data,e.cache);if(t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),t.onreadystatechange=function(){4===t.readyState&&(200===t.status?e.success&&("string"==typeof t.responseText?e.success(t):e.success(t)):429===t.status?e.success&&t.responseText&&("string"==typeof t.responseText?e.success(t):e.success(t)):e.error&&e.error(t.status))},"GET"===e.type)t.open("GET",o?e.url+"?"+o:e.url,!0),t.send(null);else{if(e.headers&&"application/json"==e.headers["Content-Type"]){t.open("POST",e.url,!0);for(var i in e.headers)t.setRequestHeader(i,e.headers[i]);return void t.send(JSON.stringify(e.data))}t.open("POST",o?e.url+"?"+o:e.url,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(o)}},formateParams:function(e,t){var o=[];for(var i in e)o.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t&&o.push("v="+(new Date).getTime()),o.join("&")}});e.exports=new i},function(e,exports,t){var o,i,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=t(1),a=r.extend({_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",checkOs:function(){var e=navigator.userAgent,t=(navigator.appVersion,e.indexOf("Android")>-1||e.indexOf("Linux")>-1),o=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return t?"ANDROID":o?"IOS":void 0},getDeviceType:function(){return navigator&&navigator.userAgentData&&navigator.userAgentData.mobile?"Mobile":/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?"Mobile":"Browser"},encode:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},decode:function(e){return decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))},open_pay_url:function(e){this.showDetail(event,e)},pay_url:function(e){if("IOS"==s.checkOs()){console.log("pay ios ===>",e);var t=document.createElement("iframe");t.href=e,t.target="_self",top.location.href=location.href,t.click(),window.location.href=e,setTimeout(function(){document.body.removeChild(t)},3e3)}else{console.log("pay android ===>",e);var o=document.createElement("a");o.href=e,document.body.appendChild(o),o.click(),document.body.removeChild(o)}},showDetail:function(e,t){window.tysdk=this;var o=document.getElementsByTagName("head")[0],i="https://downqn.tuyoo.com/h5sdk/v100/src/css/style.css",n=document.createElement("link");n.href=i,n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css");var r=document.createElement("meta");r.setAttribute("name","viewport"),r.setAttribute("content","width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes"),o.appendChild(r),o.appendChild(n);var a='
    充值中心 X
    ',s=document.createElement("div");s.setAttribute("id","detailui"),s.innerHTML=a,document.getElementsByTagName("body")[0].appendChild(s)},fadeoutDetail:function(e){var t=e||event;t.stopPropagation();var o=document.getElementById("detailui");document.getElementsByTagName("body")[0].removeChild(o)},changeFrameHeight1:function(){ +var e=document.getElementById("myiframe");e.height=document.documentElement.clientHeight},Login_SIGN:function(e,t,o,i){var n=this.decode(i),r="userID="+e+"&clientID="+t+"&gameID="+o+"&signKey="+n;return this.signature(r)},signature:function(e){function t(e,t){var o,i,n,r,a;return n=2147483648&e,r=2147483648&t,o=1073741824&e,i=1073741824&t,a=(1073741823&e)+(1073741823&t),o&i?2147483648^a^n^r:o|i?1073741824&a?3221225472^a^n^r:1073741824^a^n^r:a^n^r}function o(e,o,i,n,r,a,s){return e=t(e,t(t(o&i|~o&n,r),s)),t(e<>>32-a,o)}function i(e,o,i,n,r,a,s){return e=t(e,t(t(o&n|i&~n,r),s)),t(e<>>32-a,o)}function n(e,o,i,n,r,a,s){return e=t(e,t(t(o^i^n,r),s)),t(e<>>32-a,o)}function r(e,o,i,n,r,a,s){return e=t(e,t(t(i^(o|~n),r),s)),t(e<>>32-a,o)}function a(e){var t,o="",i="";for(t=0;3>=t;t++)i=e>>>8*t&255,i="0"+i.toString(16),o+=i.substr(i.length-2,2);return o}var s,l,c,d,u,p,_,f,h=[];for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",o=0;oi?t+=String.fromCharCode(i):(127i?t+=String.fromCharCode(i>>6|192):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128)),t+=String.fromCharCode(63&i|128))}return t}(e),h=function(e){var t,o=e.length;t=o+8;for(var i=16*((t-t%64)/64+1),n=Array(i-1),r=0,a=0;a>>29,n}(e),u=1732584193,p=4023233417,_=2562383102,f=271733878,e=0;e>5]|=(e.charCodeAt(r/8)&o)<>2]>>8*(r%4)&255)<<16|(t[r+1>>2]>>8*((r+1)%4)&255)<<8|t[r+2>>2]>>8*((r+2)%4)&255,s=0;s<4;s++)n+=8*r+6*s>32*t.length?"":i.charAt(a>>6*(3-s)&63);return n},showModal:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.title,o=void 0===t?"":t,i=e.content,n=void 0===i?"":i,r=e.showCancel,a=void 0===r||r;return new Promise(function(e){var t="https://downqn.tuyoo.com/h5sdk/v100/src/css/modal.css";if(!document.querySelector('link[href="'+t+'"]')){var i=document.createElement("link");i.rel="stylesheet",i.href=t,document.head.appendChild(i)}var r=document.createElement("div");r.className="custom-modal",r.innerHTML='\n ',document.body.appendChild(r),r.querySelector(".ok-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!0,cancel:!1})}),a&&r.querySelector(".cancel-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!1,cancel:!0})})})}}),s=new a;!function(r,a){"object"===n(exports)?e.exports=a():(o=a,i="function"==typeof o?o.call(exports,t,exports,e):o,!(void 0!==i&&(e.exports=i)))}(void 0,function(){return s})},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;t0){var i=function(o){t.deleteCache(e),t.reportCacheData()};this.httpRequestWithLimit(o,i)}else this.reportCacheData()},processArray2String:function(e){if(e){var t="";return e.forEach(function(e){t+=e+"\n"}),t}},reportCacheData:function(){var e=this.getCacheWithLimitCount(this.gaLocalCacheData,10);e&&e.length>0&&this.reportGALog(e)},getCacheWithLimitCount:function(e,t){if(e){for(var o=[],i=Array.from(e),n=i.length>t?t:i.length,r=0;r100&&this.gaLocalCacheData.shift())},deleteCache:function(e){var t=this;e&&this.gaLocalCacheData&&e.forEach(function(e){t.gaLocalCacheData.indexOf(e)>-1&&t.gaLocalCacheData.splice(t.gaLocalCacheData.indexOf(e),1)})},httpRequest:function(e){var t=this;this.config&&this.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var o={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(o,function(e,o){t.tuyoo.config&&t.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+o)},function(e,t){console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})},httpRequestWithLimit:function(e,t){var o=this;if(!this.biLimitState){this.biLimitState=!0,this.tuyoo.config&&this.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var i={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(i,function(e,i){o.biLimitState=!1,200==i.status&&t&&t(i.data),o.tuyoo.config&&o.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+i)},function(e,t){o.biLimitState=!1,console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})}}});e.exports=a},function(e,exports){"use strict";var t=t||{};t.initCode={success:0,fail:-1},t.loginCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.payCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1001,navigatePayPageSucc:1e3},t.smsCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.biCode={success:0,fail:-1},t.verifyCode={success:t.initCode.success,fail:t.initCode.fail},t.shareCode={success:t.initCode.success,fail:t.initCode.fail},t.dealOrderFailCode={continue:t.initCode.success,needReOrder:t.initCode.fail},t.loginEvent={success:"登录成功",fail:"登录失败",cancle:"登录取消",sns_error:"snsId为undefined"},t.payEvent={success:"支付成功",fail:"支付失败",cancle:"支付取消",invalid:"支付方式无效"},t.initEvent={success:"初始化成功",fail:"初始化失败",url_null:"初始化URL为空"},t.biEvent={success:"上报成功",fail:"上报失败"},t.verifyEvent={success:"认证成功",fail:"认证失败"},e.exports=t},function(e,exports){"use strict";var t={GAEvents:{SDK_INIT_ENT:"sdk_c_init_end",SDK_LOGIN_START:"sdk_c_login_start",SDK_LOGIN_SUCC:"sdk_c_login_succ",SDK_LOGIN_FAIL:"sdk_c_login_fail",SDK_BIND_START:"sdk_c_bind_start",SDK_BIND_SUCC:"sdk_c_bind_succ",SDK_BIND_FAIL:"sdk_c_bind_fail",SDK_CHANNEL_INIT_START:"sdk_c_channel_init_start",SDK_CHANNEL_INIT_SUCC:"sdk_c_channel_init_succ",SDK_CHANNEL_INIT_FAIL:"sdk_c_channel_init_fail",SDK_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_LOGIN_BY_SDKSERVER_START:"sdk_c_login_by_sdkserver_start",SDK_LOGIN_BY_SDKSERVER_SUCC:"sdk_c_login_by_sdkserver_succ",SDK_LOGIN_BY_SDKSERVER_FAIL:"sdk_c_login_by_sdkserver_fail",SDK_PAY_START:"sdk_c_pay_start",SDK_PAY_SUCC:"sdk_c_pay_succ",SDK_PAY_FAIL:"sdk_c_pay_fail",SDK_PAY_LAUNCH_SUCC:"sdk_c_pay_launch_succ",SDK_C_ORDER_START:"sdk_c_order_start",SDK_C_ORDER_SUCC:"sdk_c_order_succ",SDK_C_ORDER_FAIL:"sdk_c_order_fail",SDK_C_REQUEST_CHANNEL_PAY_START:"sdk_c_request_channel_pay_start",SDK_C_REQUEST_CHANNEL_PAY_SUCC:"sdk_c_request_channel_pay_succ",SDK_C_REQUEST_CHANNEL_PAY_FAIL:"sdk_c_request_channel_pay_fail",SDK_C_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_C_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_C_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_SHARE_START:"sdk_c_share_start",SDK_SHARE_SUCC:"sdk_c_share_succ",SDK_SHARE_FAIL:"sdk_c_share_fail",SDK_C_GAME_LAUNCH:"sdk_c_game_launch",SDK_C_VERIFY:"sdk_c_verify"}};e.exports=t},function(e,exports,t){"use strict";var o=t(8),i=new o,n={"kuaishou.cn.minigame":i},r={"kuaishou.cn.minigame.iap":i},a={"kuaishou.cn.minigame":i};e.exports={tyLoginInterface:n,tyPayInterface:r,tyInitInterface:a}},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;t kuaishou getLaunchOptionsSync: ",JSON.stringify(n.options)),n.systemInfo=ks.getSystemInfoSync(),console.log("========> kuaishou getSystemInfoSync: ",JSON.stringify(n.systemInfo)),this.InitNetworkListener(e)}catch(e){console.log("========> kuaishou get channel info failed: ",e)}n.systemInfo.platform&&"ios"===n.systemInfo.platform.toLowerCase()?this.payType="kuaishou.cn.minigame.ios":this.payType="kuaishou.cn.minigame.iap";var s={sdk_channel_app_id:t.kuaishou_appId,phone_model:n.systemInfo.model,os_name:n.systemInfo.platform,sdk_channel_version:n.systemInfo.version,os_version:n.systemInfo.system,sdk_channel_language:n.systemInfo.language,sdk_device_brand:n.systemInfo.brand,sdk_c_version:"1.0.3.251023_release"};e.bi.AddGAReportCommonInfo(s);var l={sdk_channel_lanuch_params:n.options?JSON.stringify(n.options.query):"",sdk_channel_lanuch_scene_id:this.options&&this.options.from?this.options.from:""};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,a.GAEvents.SDK_C_GAME_LAUNCH,l),e.IsNull(n.kuaishou_appId)?o.call(i,r.initCode.fail,null,"kuaishou_appId is undefined"):o.call(i,r.initCode.success,r.initEvent.success,null)},InitNetworkListener:function(e){var t=function(t){console.log("onGetNetworkSuccListener: "+JSON.stringify(t)),t.hasOwnProperty("isConnected")&&!t.isConnected?e.bi.AddGAReportCommonInfo({network:"UNCONNECT"}):e.bi.AddGAReportCommonInfo({network:t.networkType})};ks.getNetworkType({success:t}),ks.onNetworkStatusChange(t)},Login:function(e,t,o,i){var n=this;n.loginParams=t,console.log("kuaishou-login-start");var l={sdk_login_channel_type:n.ChannelType};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,a.GAEvents.SDK_C_LOGIN_BY_CHANNEL_START,l),ks.login({success:function(t){var c=t.code,d=o.postdata;e.IsNull(c)?(l.sdk_channel_error_code="0",l.sdk_channel_error_msg=JSON.stringify(t),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,a.GAEvents.SDK_C_LOGIN_BY_CHANNEL_FAIL,l),i.call(e,r.loginCode.fail,null,JSON.stringify(t))):(e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,a.GAEvents.SDK_C_LOGIN_BY_CHANNEL_SUCC,l),d.kuaishou_appId=n.kuaishou_appId,d.kuaishou_code=c,d.snsId=n.ChannelType+":"+c,n.options&&(d.scene_id=n.options.from||"",d.scene_param=s.base64(JSON.stringify(n.options.query))||""),d.osName=n.systemInfo.platform,d.os_version=n.systemInfo.system,d.sdk_device_brand=n.systemInfo.brand,d.phone_model=n.systemInfo.model,i.call(e,r.loginCode.success,o,null))},fail:function(t){l.sdk_channel_error_code="1",l.sdk_channel_error_msg=JSON.stringify(t),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.LOGIN,a.GAEvents.SDK_C_LOGIN_BY_CHANNEL_FAIL,l),i.call(e,r.loginCode.fail,null,JSON.stringify(t))},complete:function(){console.log("login complete")}})},LoginEnd:function(e,t,o){try{console.log("kuaishou minigame LoginEnd======>status: "+e+" \n error : "+o),100504==e&&this.loginParams.isShowLimitToast!==!1&&(this.tuyoo.bi.ReportGAWithType(this.tuyoo,this.tuyoo.bi.GA_TYPE.LOGIN,"sdk_c_receive_gateway_limit_info",{gateway_info:o}),ks.showModal({title:"温馨提示",content:o||"当前玩家过多,请稍后再试~",showCancel:!1,success:function(e){console.log(e)},fail:function(e){console.log(e)}}))}catch(e){console.error("kuaishou minigame LoginEnd",e)}},ExtraOrderParams:function(e,t,o){var i=this;o.chargeType=this.payType,o.ch_app_id=i.kuaishou_appId,o.ch_os=i.systemInfo.platform,i.product_type=t.prodType,i.goods_category=t.ks_goods_category,o.os_version=i.systemInfo.system,o.sdk_device_brand=i.systemInfo.brand,o.phone_model=i.systemInfo.model},Pay:function(e,t,o,i,n){var s=this,l={};l.success=function(o){console.log("kuaishou pay onSuccess: ",JSON.stringify(o)),e.IsNull(o)||1!==o.code?(e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,s.getGaParams(t,null,{sdk_channel_error_code:o.code,sdk_channel_error_msg:o.msg})),i.call(n,r.payCode.fail,null,JSON.stringify(o))):(e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_SUCC,s.getGaParams(t,o,null)),i.call(n,r.payCode.success,JSON.stringify(o),null),s.NotifyServerDelivery(e,t,o.orderID))},l.fail=function(o){console.log("kuaishou pay onFail: ",JSON.stringify(o)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,s.getGaParams(t,null,{sdk_channel_error_code:o.code,sdk_channel_error_msg:o.msg})),i.call(n,r.payCode.fail,null,JSON.stringify(o))};var c=t.chargeData;l.zone_id=c.zone_id,l.os=c.os,l.currency_type=c.currency_type,l.buy_quantity=c.buy_quantity,l.third_party_trade_no=c.third_party_trade_no,l.extension=c.extension,l.sign=c.sign,e.IsNull(s.product_type)&&(s.product_type=1),l.product_type=s.product_type,e.IsNull(s.goods_category)&&(s.goods_category="10017"),l.goods_category=s.goods_category,l.goods_name=t.diamondName,e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_START,s.getGaParams(t,null,null)),ks.requestGamePayment(l)},Logout:function(){},onExit:function(){},IsNull:function(e){return void 0===e||null===e||""===e},NotifyServerDelivery:function(e,t,o){var i=this,n={url:t.chargeData.notifyUrl,postdata:{platformOrderId:t.platformOrderId,order_id:o,app_id:i.kuaishou_appId,extension:t.chargeData.extension}};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,"sdk_c_charge_callback_start",i.getGaParams(t,null,null)),e.HttpLib(n,function(o,n){console.log("kuaishou notifyServerDelivery=======> ",JSON.stringify(n));var r;try{r=e.isString(n.data)?JSON.parse(n.data):n.data}catch(e){console.error(e)}if(r&&null!==r.result)if(0===r.result.code)e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,"sdk_c_charge_callback_succ",i.getGaParams(t,null,null));else{console.log("kuaishou notifyServerDelivery fail: ",r.result.code);var a={sdk_error_msg:JSON.stringify(n),sdk_error_code:r.result.code};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,"sdk_c_charge_callback_fail",i.getGaParams(t,null,a))}else{var a={sdk_error_msg:JSON.stringify(n),sdk_error_code:"DEFAULT"};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,"sdk_c_charge_callback_fail",i.getGaParams(t,null,a))}},function(o,n){console.log("kuaishou notifyServerDelivery fail=======> ",n);var r={sdk_error_msg:n,sdk_error_code:o};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,"sdk_c_charge_callback_fail",i.getGaParams(t,null,r))},i)},getGaParams:function(e,t,o){var n={sdk_pay_type:this.payType||this.ChargeType};return!this.IsNull(e)&&this.isJSON(JSON.stringify(e))&&(n.sdk_order_track_id=e?e.sdk_order_track_id:"DEFAULT",n.sdk_order_id=e?e.platformOrderId:"DEFAULT",n.sdk_game_order_id=e?e.prodOrderId:"DEFAULT",n.sdk_product_id=e?e.prodId:"DEFAULT"),!this.IsNull(t)&&this.isJSON(JSON.stringify(t))&&(n.sdk_channel_order_id=t.orderID),!this.IsNull(o)&&this.isJSON(JSON.stringify(o))&&(n=i(n,o)),n},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":o(t))||!t)}catch(e){return!1}return!1},HttpLib:function(e,t){if(t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{},"GET"===t.type){var o=this.formateParams(t.data,t.cache);t.url=o?t.url+"?"+o:t.url,ks.request({url:t.url,method:t.type,header:{"Content-Type":"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(e){t.error&&t.error(e)}})}else ks.request({url:t.url,method:t.type,header:t.headers?t.headers:{"Content-Type":"application/x-www-form-urlencoded"},data:t.data,success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(e){t.error&&t.error(e)}})},formateParams:function(e,t){var o=[];for(var i in e)o.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t&&o.push("v="+(new Date).getTime()),o.join("&")},LocalStorage:function(){return this},SetItem:function(e,t){try{ks.setStorageSync(e,t)}catch(e){console.log("====>ks setStorageSync fail: "+JSON.stringify(e))}},RemoveItem:function(e){try{ks.removeStorageSync(e)}catch(e){console.log("====>ks removeStorageSync fail: "+JSON.stringify(e))}},GetItem:function(e){try{return ks.getStorageSync(e)}catch(e){console.log("====>ks getStorageSync fail: "+JSON.stringify(e))}return""},Clear:function(){try{ks.clearStorage()}catch(e){console.log("====>ks clearStorage fail: "+JSON.stringify(e))}}});e.exports=l}])}); +//# sourceMappingURL=tuyoosdk_release.js.map \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/tuyoosdk_kuaishouminigame_1.0.3.251023_release.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/tuyoosdk_kuaishouminigame_1.0.3.251023_release.js.meta new file mode 100644 index 0000000..14f35d1 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/kuaishouminigame/tuyoosdk_kuaishouminigame_1.0.3.251023_release.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e0a150155a395461ca774ce51de60925 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame.meta new file mode 100644 index 0000000..a45fd2b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 558202106df2546b6ae11a5ae152cef2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/TyJsBridge.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/TyJsBridge.js new file mode 100644 index 0000000..c615bc2 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/TyJsBridge.js @@ -0,0 +1,224 @@ +var TuyooSdkBridge = { + + loadJsScriptToBridge: function (channelType) { + var channelTypeFromCS = UTF8ToString(channelType); + console.log("channelTypeFromCS:" + channelTypeFromCS); + }, + + InitToBridge: function (initEventInfo) { + try { + var initCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "InitResult", callbackString); + } + var initInfoFromCS = UTF8ToString(initEventInfo); + var initInfo = JSON.parse(initInfoFromCS); + var tyInitParams = {}; + tyInitParams.appId = initInfo.tuyooParam.appId; + tyInitParams.gameId = initInfo.tuyooParam.gameId; + tyInitParams.pay_version = "hall37"; + tyInitParams.baseurl = initInfo.tuyooParam.serverUrl.endsWith("/") ? initInfo.tuyooParam.serverUrl : initInfo.tuyooParam.serverUrl + "/"; + tyInitParams.bi_base_url = "https://cbi.tuyoo.com/"; + tyInitParams.cloudId = initInfo.tuyooParam.cloudId; + tyInitParams.packageName = initInfo.package; + tyInitParams.clientId = initInfo.tuyooParam.clientId; + tyInitParams.meituan_appId = initInfo.login.meituanminigame.meituanAppId; + console.log("initInfo: " + JSON.stringify(initInfo)); + window.TuyooSdk.OnInit(initInfo.tuyooParam.channelType, tyInitParams, initCallback, this); + } catch (e) { + console.error("InitToBridge catch error: " + e); + } + }, + + // 切换SDK域名 + UpdateServerUrlToBridge: function (serverUrl) { + try { + var serverUrlFromCS = UTF8ToString(serverUrl); + window.TuyooSdk.baseuri = (serverUrlFromCS.substring(serverUrlFromCS.length - 1) === '/') ? serverUrlFromCS.substring(0, serverUrlFromCS.length - 1) : serverUrlFromCS; + console.log("update serverUrl to: " + window.TuyooSdk.baseuri); + } catch (e) { + console.error("UpdateServerUrlToBridge catch error: " + e); + } + }, + + LoginToBridge: function (loginEventInfo) { + try { + var loginCallback = function (code, result, error) { + var callbackResult = { + code: code, + result: result && result.logindata ? result.logindata : result, + error: error + }; + var callbackString = JSON.stringify(callbackResult); + SendMessage("NativeCallBack", "LoginResult", callbackString); + } + var loginInfoFromCS = UTF8ToString(loginEventInfo); + var loginInfo = JSON.parse(loginInfoFromCS); + var tyLoginParams = {}; + if (loginInfo.loginType) { + tyLoginParams.ChannelType = loginInfo.loginType; + } + if (loginInfo.extraParams) { + var extraParams = JSON.parse(loginInfo.extraParams); + tyLoginParams.extraParams = extraParams; + } + console.log("tyLoginParams: " + JSON.stringify(tyLoginParams)); + window.TuyooSdk.Login(tyLoginParams, loginCallback, this); + } catch (e) { + console.error("LoginToBridge catch error: " + e); + } + }, + + PayToBridge: function (payEventInfo) { + try { + var payCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "PayResult", callbackString); + } + var payInfoFromCS = UTF8ToString(payEventInfo); + var payInfo = JSON.parse(payInfoFromCS); + var tyPayParams = {}; + tyPayParams.prodCount = 1; + tyPayParams.appInfo = ""; + if (payInfo.chargeService) { + tyPayParams.ChargeType = payInfo.chargeService; + } + if (payInfo.productCount) { + tyPayParams.prodCount = payInfo.productCount; + } + if (payInfo.serverAppInfo) { + tyPayParams.appInfo = payInfo.serverAppInfo; + } + if (payInfo.gameOrderId) { + tyPayParams.prodOrderId = payInfo.gameOrderId; + } + if (payInfo.extraParams) { + var extraParams = JSON.parse(payInfo.extraParams); + tyPayParams.extraParams = extraParams; + } + tyPayParams.prodId = payInfo.productId; + tyPayParams.prodName = payInfo.productName; + tyPayParams.prodPrice = payInfo.productPrice; + console.log("tyPayParams: " + JSON.stringify(tyPayParams)); + window.TuyooSdk.Pay(tyPayParams, payCallback, this); + } catch (e) { + console.error("PayToBridge catch error: " + e); + } + }, + + SetShareInfoToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var shareInfoToJs = shareInfo.resource; + shareInfoToJs.callback = shareCallback; + console.log("shareInfoToJs: " + JSON.stringify(shareInfoToJs)); + window.TuyooSdk.SetDefaultShareInfo(shareInfoToJs); + } catch (e) { + console.error("SetShareInfoToBridge catch error: " + e); + } + }, + + ShareToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var shareInfoToJs = shareInfo.resource; + console.log("shareInfoToJs: " + JSON.stringify(shareInfoToJs)); + window.TuyooSdk.Share(shareInfoToJs, shareCallback); + } catch (e) { + console.error("ShareToBridge catch error: " + e); + } + }, + + GAEventTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + if (!reportInfo.typeName) { + reportInfo.typeName = "track"; + } + window.TuyooSdk.bi.trackWithType(reportInfo.typeName, reportInfo.eventName, reportInfo.reportEvent); + } catch (e) { + console.error("GAEventTrackToBridge catch error: " + e); + } + }, + + GAProfileTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + window.TuyooSdk.bi.profileTrack(reportInfo.profileType, reportInfo.profileSubjectType, reportInfo.profileSubjectPrimary, reportInfo.reportEvent); + } catch (e) { + console.error("GAProfileTrackToBridge catch error: " + e); + } + }, + + GetShareInfoBridge: function (shareEventInfo) { + console.error("current channel not support GetShareInfo function"); + }, + + GetAdInfoBridge: function () { + console.error("current channel not support GetAdInfo function"); + }, + + TxAdSDKReportToBridge: function (txAdReportInfo) { + console.error("current channel not support TxAdSDKReport function"); + }, + + CheckBindToBridge: function (bindEventInfo) { + console.error("current channel not support CheckBind function"); + }, + + SendSmsCodeToBridge: function (loginEventInfo) { + console.error("current channel not support SendSmsCode function"); + }, + + BindToBridge: function (bindEventInfo) { + console.error("current channel not support Bind function"); + }, + + SetWxUserInfoToBridge: function (type, userInfo) { + console.error("current channel not support SetWxUserInfo function"); + }, + + GetDeviceLevelToBridge: function() { + // try { + // var callback = function (code, result, error) { + // var callbackString = JSON.stringify({ code, result, error }); + // SendMessage("NativeCallBack", "GetDeviceLevelResult", callbackString); + // } + // window.TuyooSdk.getDeviceBenchmarkLevel(callback, this); + // } catch (error) { + // console.error("GetDeviceLevelToBridge catch error: " + error); + // } + console.error("current channel not support GetDeviceLevelToBridge function"); + }, + + CreatGridGamePanelToBridge: function(gridGameModule) { + console.error("current channel not support CreatGridGamePanel function"); + }, + + ShowGridGamePanelToBridge: function(panelId) { + console.error("current channel not support ShowGridGamePanel function"); + }, + + HideGridGamePanelToBridge: function(panelId) { + console.error("current channel not support HideGridGamePanel function"); + }, + + DestroyGridGamePanelToBridge: function(panelId) { + console.error("current channel not support DestroyGridGamePanel function"); + } + +} + +mergeInto(LibraryManager.library, TuyooSdkBridge); \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/TyJsBridge.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/TyJsBridge.js.meta new file mode 100644 index 0000000..e1e95ba --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/TyJsBridge.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 271e924d713444a5c870cb92ec5f7e4c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/tuyoosdk_meituanminigame_1.0.2.251010_release.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/tuyoosdk_meituanminigame_1.0.2.251010_release.js new file mode 100644 index 0000000..f88fe3f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/tuyoosdk_meituanminigame_1.0.2.251010_release.js @@ -0,0 +1,3 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TuyooSdk=t():e.TuyooSdk=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var i=o[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,exports,t){function o(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var n,i,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=t(1),l=t(2),c=t(3),d=t(4),u=t(6),p=t(5),_=t(7),f=s.extend((r={baseuri:{get:function(){return this._baseuri},set:function(e){this._baseuri=e}},sdkRoute:{set:function(e){this._sdkRoute=e},get:function(){return void 0===this._sdkRoute||""===this.sdkRoute?"/open/v6/user/LoginBySnsIdNoVerify":this._sdkRoute}},payversion:{get:function(){return this._payversion},set:function(e){this._payversion=e}},clientId:{get:function(){return this._clientId},set:function(e){this._clientId=e}},packageName:{get:function(){return this._packageName},set:function(e){this._packageName=e}},appId:{get:function(){return this._appId},set:function(e){this._appId=e}},gameId:{get:function(){return this._gameId},set:function(e){this._gameId=e}},userId:{get:function(){return this._userId},set:function(e){this._userId=e}},token:{get:function(){return this._token},set:function(e){this._token=e}},logindata:{get:function(){return this._logindata},set:function(e){this._logindata=e}},ctor:function(){this.bi=new d},uuid:function(){if(this.IsNull(this._uuid))try{var e=this.LocalStorage().GetItem("ty_uuid");this.IsNull(e)?(this._uuid=this.CreateUUID(32,16),this.LocalStorage().SetItem("ty_uuid",this._uuid)):this._uuid=e}catch(e){return this.CreateUUID(32,16)}return this._uuid},CheckChannel:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t.tyPlatform))return t.tyPlatform}}return null},CheckParams:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t))return t}}return null},Decode:function(e){return c.decode(e)},IsNull:function(e){return void 0===e||null===e||""===e},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":a(t))||!t)}catch(e){return!1}},StartupParameter:function(){return this.platform().StartupParameter(this)},orderuri:function(){return"hall37"===this.payversion?this.baseuri+"/open/v4/pay/order":"hall51"===this.payversion?this.baseuri+"/open/v5/pay/order":this.baseuri+"/open/v4/pay/order"},platform:function(e){return this.IsNull(e)&&(e=this.type),_.tyLoginInterface[e]},platformPay:function(e){return _.tyPayInterface[e]},OnInitDebuger:function(e,t){var o="https://downqn.tuyoo.com/h5sdk/v100/js/vconsole.min.js";this.loadScript(o,function(o,n){if(0===o){new VConsole;console.log("----------tuyoosdk.OnInit-->initdebug:"),e.call(t,o,n,null)}else e.call(t,1005,null,"失败")})},OnInit:function(e,t,o,n){var i=this;console.log("----------tuyoosdk.OnInit-->channel:",e),t.debug&&i.OnInitDebuger(function(e,t,o){console.log(window.location.href,e,t,o)},i),i.TuyooInit(e,t,o,n)},SetDefaultShareInfo:function(e){this.IsNull(this.platform().SetDefaultShareInfo)||this.platform().SetDefaultShareInfo(this,e)},Share:function(e,t){this.IsNull(this.platform().Share)?t&&t.call(this,p.shareCode.fail,null,""+this.type+"不支持分享"):this.platform().Share(this,e,t)},CallMethod:function(e,t,o,n){var i=this.IsNull(t.ChannelType)?this.type:t.ChannelType;if(!this.IsNull(this.platform(i))&&"function"==typeof this.platform(i)[e]){var r=[this,t,o];return this.platform(i)[e].apply(n,r)}o&&o.call(this,p.initCode.fail,null,""+i+"不支持此功能("+e+")")},TuyooInit:function(e,t,o,n){var i=this;i.config=t;var r=(new Date).getTime(),a=function(e,t,a){0===e&&i.bi.ReportGAWithType(i,i.bi.GA_TYPE.TRACK,u.GAEvents.SDK_INIT_ENT,{sdk_init_duration_time:(new Date).getTime()-r});var s=[];for(var l in arguments)s.push(arguments[l]);o.apply(n,s)};if(i.IsNull(t.wxAppId)||(i.wxAppId=t.wxAppId),void 0===t.bi_base_url&&(t.bi_base_url="https://cbi.tuyoo.com/"),i.IsNull(t.pay_version)&&(t.pay_version="hall37"),"hall37"!==t.pay_version&&"hall51"!==t.pay_version)return void o.call(n,p.initCode.fail,null,"pay_version 必须为 hall37|hall51");if(this.IsNull(t.userId)?this.userId=0:this.userId=t.userId,console.log("----------tuyoosdk.OnInit-->config:",t),i.IsNull(t.clientId))if(i.IsNull(this.InitClientId())){if(!t.debug)return void o.call(n,p.initCode.fail,null,"clientId不能为空");t.clientId="Android_4.58_meitu.meitu.0-hall6.meitu.tu"}else t.clientId=this.InitClientId();this.type=e,this.appId=t.appId,this.gameId=t.gameId,this.clientId=t.clientId,this.payversion=t.pay_version,this.baseuri="/"===t.baseurl.substring(t.baseurl.length-1)?t.baseurl.substring(0,t.baseurl.length-1):t.baseurl,this.bi_base_uri="/"===t.bi_base_url.substring(t.bi_base_url.length-1)?t.bi_base_url.substring(0,t.bi_base_url.length-1):t.bi_base_url,this.packageName=t.packageName,console.log("----------tuyoosdk.OnInit-->clientId:",this.clientId),console.log("----------tuyoosdk.OnInit-->baseuri:",this.baseuri),console.log("----------tuyoosdk.OnInit-->platform:",this.platform()),this.bi.OnInit(this,t,function(r,s,l){0===r?(i.platform().OnInit(i,t,a,i),i.InitOtherThird(e,t,a,n)):o.call(n,r,s,l)},this)},InitOtherThird:function(e,t,o,n){for(var i in _.tyInitInterface)if(i!==e){var r=function(e,t,o){console.log("----------tuyoosdk.InitOtherThird-->type:",i," status: ",e)};_.tyInitInterface[i].OnInit(this,t,r,this)}},Is:function(e){var t=this.platform(e);return!this.IsNull(t)&&t.Is()},InitClientId:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(this.IsNull(e)===!1){var t=this.GetQueryToMap(e.substr(1,e.length));return this.IsNull(t.clientId)===!1?t.clientId:null}return null}return null},Login:function(e,t,o){var n=this;this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_login_track_id||""===e.extraParams.sdk_login_track_id?e.sdk_login_track_id=this.CreateUUID(32,16):e.sdk_login_track_id=e.extraParams.sdk_login_track_id:e.sdk_login_track_id=this.CreateUUID(32,16),this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),n.IsNull(n.platform(e.ChannelType).realLogin)?this.realLogin(e,t,o):n.platform(e.ChannelType).realLogin(n,e,t,o)},GetUserInfo:function(e,t,o){this.IsNull(this.platform().GetUserInfo)?console.error(this.platform().ChannelType+" not support GetUserInfo"):this.platform().GetUserInfo(this,e,t,o)},realLogin:function(e,t,o){var n=this,i={sdk_login_channel_type:n.platform(e.ChannelType).ChannelType,sdk_login_track_id:e.sdk_login_track_id};n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_START,i);var r=function(r,a,s){var l=n.convertLoginServerResultCode(r);0===l?(n.userId=a.userId,n.token=a.token,n.userPwd=a.userPwd,n.logindata=a.logindata,n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_SUCC,i),t&&t.call(o,p.loginCode.success,a,s)):(i.sdk_error_code=r,i.sdk_error_msg=JSON.stringify(s),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_FAIL,i),t&&t.call(o,l,a,s));try{n.IsNull(n.platform(e.ChannelType).LoginEnd)||n.platform(e.ChannelType).LoginEnd(r,a,s)}catch(e){console.log("----------tuyoosdk.LoginEnd-->err:",e)}},a={retryMax:1,url:n.baseuri+this.sdkRoute.get(),postdata:{imei:"null",idfa:"",appId:n.appId,gameId:n.gameId,clientId:n.clientId,packageName:n.packageName,uuid:n.uuid(),sdk_session_id:n.bi.sessionId,original_deviceid:n.uuid(),sdk_login_track_id:e.sdk_login_track_id}};if(n.IsNull(e.extraParams)===!1&&n.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)n.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,i,a){console.log("===========>snsHook",o,i),0===t?n.IsNull(n.platform(e.ChannelType).tuyooLogin)?n.tuyooLogin(o,r,a):n.platform(e.ChannelType).tuyooLogin(o,r,a):r.call(n,p.loginCode.fail,null,i)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(n,e,a,l)},tuyooLogin:function(e,t,o){var n=this;console.log("tuyoo-login-request",e);var i={sdk_login_channel_type:n.platform().ChannelType,sdk_login_track_id:e.postdata.sdk_login_track_id};n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_START,i);try{this.HttpLib(e,function(e,r){console.log("tuyoo-login-response",e,r);var a=JSON.parse(r.data);if(n.IsNull(a.result))i.sdk_error_msg=JSON.stringify(a),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),t.call(n,p.loginCode.fail,null,a);else if(0===a.result.code){var s={userId:a.result.userId,token:a.result.token,userPwd:a.result.userPwd,logindata:a.result};if(!n.IsNull(o))for(var l in o)s[l]=o[l];n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_SUCC,i),t.call(n,a.result.code,s)}else i.sdk_error_code=a.result.code,i.sdk_error_msg=JSON.stringify(a.result),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),t.call(n,a.result.code,null,a.result.info)},function(e,o){i.sdk_error_code=e,i.sdk_error_msg=JSON.stringify(o),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),t.call(n,p.loginCode.fail,null,o)},n)}catch(e){i.sdk_error_msg=JSON.stringify(e),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),console.log("tuyoo-login-catch",e),t.call(n,p.loginCode.fail,null,e)}},convertLoginServerResultCode:function(e){switch(e){case 0:return p.loginCode.success;case 12010:return 100201;case 12017:case 12130:return 100206;case 10:return 100502;case 100504:return 100504;default:return p.loginCode.fail}},Logout:function(){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(this)}},o(r,"Logout",function(e,t){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(e,t)}),o(r,"Bind",function(e,t,o){this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),this.realBind(e,t,o)}),o(r,"realBind",function(e,t,o){var n=this,i={sdk_login_channel_type:n.platform(e.ChannelType).ChannelType};n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_START,i);var r=function(e,r,a){var s=n.convertLoginServerResultCode(e);0===s?(n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_SUCC,i),t&&t.call(o,p.loginCode.success,r,a)):(i.sdk_error_code=e,i.sdk_error_msg=JSON.stringify(a),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_FAIL,i),t&&t.call(o,s,r,a))};if(n.IsNull(n.userId)||0===n.userId||"0"===n.userId)return void r(p.loginCode.fail,null,"Do not login");var a={retryMax:1,url:n.baseuri+"/open/v6/user/bindBySnsId",postdata:{imei:"null",appId:n.appId,gameId:n.gameId,clientId:n.clientId,packageName:n.packageName,uuid:n.uuid(),sdk_session_id:n.bi.sessionId,original_deviceid:n.uuid(),userId:n.userId,passwd:n.userPwd}};if(n.IsNull(e.extraParams)===!1&&n.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)n.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,i,a){console.log("===========>snsHook",o,i),0===t?n.IsNull(n.platform(e.ChannelType).tuyooBind)?n.tuyooBind(o,r,a):n.platform(e.ChannelType).tuyooBind(o,r,a):r.call(n,p.loginCode.fail,null,i)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(n,e,a,l)}),o(r,"tuyooBind",function(e,t,o){var n=this;console.log("tuyoo-bind-request",e);try{this.HttpLib(e,function(e,o){console.log("tuyoo-bind-response",e,o);var i=JSON.parse(o.data);n.IsNull(i.result)?t.call(n,p.loginCode.fail,null,i):0===i.result.code?t.call(n,i.result.code,i.result):t.call(n,i.result.code,i.result,i.result.info)},function(e,o){t.call(n,p.loginCode.fail,null,o)},n)}catch(e){console.log("tuyoo-bind-catch",e),t.call(n,p.loginCode.fail,null,e)}}),o(r,"Pay",function(e,t,o){console.log("==========>start pay "),this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_order_track_id||""===e.extraParams.sdk_order_track_id?e.sdk_order_track_id=this.CreateUUID(32,16):e.sdk_order_track_id=e.extraParams.sdk_order_track_id:e.sdk_order_track_id=this.CreateUUID(32,16),this.IsNull(e.ChargeType)&&(e.ChargeType=this.platform().ChargeType),this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_START,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_pay_type:e.ChargeType}),"tuyoo"!==e.ChargeType?this.realPay(e,t,o,e.ChargeType):this.payui(e,t,o)}),o(r,"isString",function(e){return"[object String]"===Object.prototype.toString.call(e)}),o(r,"Order",function(e,t,o){var n=this;if(void 0===e.prodCount&&(e.prodCount=1),void 0===e.appInfo&&(e.appInfo=""),void 0===e.prodOrderId&&(e.prodOrderId=""),n.IsNull(n.wxAppId)||(e.wxAppId=n.wxAppId),console.log("------- self.platformPay(args.ChargeType) ----------",n.platformPay(e.ChargeType)),!n.IsNull(n.platformPay(e.ChargeType).Order))return n.platformPay(e.ChargeType).Order(n,e,t,o);if(n.IsNull(n.userId)||0===n.userId||"0"===n.userId)return this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:p.payCode.fail,sdk_error_msg:"用户信息不合法",sdk_pay_type:e.ChargeType}),void t.call(o,p.payCode.fail,null,"用户信息不合法");var i={imei:"null",chargeType:e.ChargeType,userId:n.userId,appId:n.appId,gameId:n.gameId,mustcharge:"1",uuid:n.uuid(),clientId:n.clientId,prodId:e.prodId,prodName:e.prodName,prodCount:e.prodCount,prodPrice:e.prodPrice,appInfo:e.appInfo,prodOrderId:e.prodOrderId,sdk_session_id:n.bi.sessionId,sdk_order_track_id:e.sdk_order_track_id,original_deviceid:n.uuid()};if(n.IsNull(e.extraParams)===!1&&n.isJSON(JSON.stringify(e.extraParams)))for(var r in e.extraParams)n.IsNull(i[r])&&(i[r]=e.extraParams[r]);n.platformPay(e.ChargeType).ExtraOrderParams(n,e,i);var a={url:n.orderuri(),postdata:i};n.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_START,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId}),n.HttpLib(a,function(r,a){var s;if(s=n.isString(a.data)?JSON.parse(a.data):a.data,s&&null!==s.result)if(0===s.result.code){var l=s.result.chargeInfo;n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_SUCC,{sdk_pay_type:l.chargeType,sdk_order_id:l?l.platformOrderId:"DEFAULT",sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id});var c;try{c=s.result.payData}catch(e){c=null,console.log("=============> 没有paydata数据",e)}var d=function(i,r,a){var s={sdk_pay_type:l.chargeType,sdk_order_id:l.platformOrderId,sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id};0===i?n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_SUCC,s):i===p.payCode.navigatePayPageSucc?n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_LAUNCH_SUCC,s):(s.sdk_error_code=i,s.sdk_error_msg=a,n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,s));var c=[];for(var d in arguments)c.push(arguments[d]);t.apply(o,c)};console.log(e.ChargeType),l.sdk_order_track_id=e.sdk_order_track_id,n.platformPay(e.ChargeType).Pay(n,l,c,d,n)}else{if(n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:s.result.code,sdk_error_msg:JSON.stringify(s.result)}),!n.IsNull(n.platformPay(e.ChargeType).dealOrderFail)){var _=function(i,r,a){console.log("=============> dealOrderFail hook status",i),i===p.dealOrderFailCode.needReOrder?n.Order(e,t,o):this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,p.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)};return void n.platformPay(e.ChargeType).dealOrderFail(n,s.result,_)}this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,p.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)}else n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:"DEFAULT",sdk_error_msg:JSON.stringify(s)}),t.call(o,p.payCode.fail,null,s)},function(r,a){n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:r,sdk_error_msg:a}),t.call(o,p.payCode.fail,null,a)},n)}),o(r,"realNameAuth",function(e,t){var o=this,n=function(e,n,i){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("----------tuyoosdk.realNameAuth-->err:",e)}},i={retryMax:1,url:o.baseuri+"/open/v6/user/update/sync/third",postdata:{imei:"null",idfa:"",appId:o.appId,gameId:o.gameId,clientId:o.clientId,packageName:o.packageName,uuid:o.uuid(),userId:o.userId}},r=function(e,t,i){console.log("===========>snsHook",t,i),0===e?o.IsNull(o.platform().syncThird)?o.syncThird(t,n):o.platform().syncThird(t,n):n.call(o,p.verifyCode.fail,null,i)};o.IsNull(o.platform().realNameAuth)?t.call(o,p.verifyCode.fail,null,"无渠道实名方法"):this.platform().realNameAuth(o,e,i,r)}),o(r,"syncThird",function(e,t){var o=this;console.log("tuyoo-syncThird-request",e),o.HttpLib(e,function(e,n){if(o.isString(n.data))var i=JSON.parse(n.data);else var i=n.data;i.result&&null!==i.result?(console.log("syncThird=============> "+JSON.stringify(i.result)),0===i.result.code?t.call(o,p.verifyCode.success,i.result,null):t.call(o,p.verifyCode.fail,null,i.result.info)):t.call(o,p.verifyCode.fail,null,i)},function(e,n){t.call(o,p.verifyCode.fail,null,n)},o)}),o(r,"ShowBuoy",function(){this.platform().ShowBuoy()}),o(r,"HideBuoy",function(){this.platform().HideBuoy()}),o(r,"ShoutCat",function(){this.platform().ShoutCat()}),o(r,"OnExit",function(){this.platform().onExit()}),o(r,"onExit",function(e){this.platform().onExit(e)}),o(r,"HttpLib",function(e,t,o,n){var i=this;void 0===e.retry&&(e.retry=0),void 0===e.retryMax&&(e.retryMax=0),void 0===e.method&&(e.method="POST"),void 0===e.headers&&(e.headers={"Content-Type":"application/x-www-form-urlencoded"});var r=function(e){l.ajax(i,e)};try{var a=this.platform(),s=!1;if("dmm.global.h5"!==a.ChannelType?s=!0:e.url!==i.config.bi_base_url+"api/bilog5/ga"&&(s=!0),s){var c=a.HttpLib;this.IsNull(c)||(r=function(e){c.call(a,i,e)})}}catch(e){}r({url:e.url,type:e.method,dataType:"json",headers:e.headers,data:e.postdata,success:function(r){console.log(e.url,">>请求结果》》》",r);try{var a={data:r.responseText,status:r.status},s={};"string"==typeof a.data?s=JSON.parse(a.data):(s=a.data,a.data=JSON.stringify(a.data)),i.IsNull(s.error)===!1?o.call(n,1009,s):t.call(n,0,a)}catch(e){t.call(n,0,a)}},error:function(r){console.log("网络异常",e.url),e.retry

    "+e.prodName+'

    \t
  • 微信支付
  • \t
  • 支付宝支付
  • \t

    选择支付方式

    ¥ '+e.prodPrice+"

    "+e.prodName+'

    \t
    \t\t
    微信支付
    \t\t
    支付宝支付
    \t
    ',l=document.createElement("div");l.setAttribute("id","payui"),l.innerHTML=s,document.getElementsByTagName("body")[0].appendChild(l)}),o(r,"realPay",function(e,t,o,n,i){var r=this;if(!this.IsNull(i)){console.log("==========>start pay ");var a=i||event;a.stopPropagation()}e.ChargeType=n;var s=function(e,n,i){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("应用层代码出错了--->"),console.log(e)}};try{r.Order(e,s,r)}catch(e){console.log("order error--->",e.toString())}}),o(r,"hidePay",function(e){var t=document.getElementById("payui");document.getElementsByTagName("body")[0].removeChild(t)}),o(r,"LoginByToken",function(e,t){var o=this,n={appId:e.appId,clientId:e.clientId,token:e.token,imei:null},i={url:o.baseuri+"/open/v4/user/loginByToken",postdata:n};o.HttpLib(i,function(e,n,i){if(0===e){var r=JSON.parse(n.data);if(null!==r.result)if(console.log("--------->message",r),0===r.result.code){var a={userId:r.result.userId,token:r.result.token,logindata:r.result};o.userId=r.result.userId,t.call(o,p.loginCode.success,a,null)}else t.call(o,p.loginCode.fail,null,r.result)}})}),o(r,"QueryOrderStatus",function(e,t){var o=this,n={appId:o.config.appId,clientId:o.config.clientId,platformOrderId:e.platformOrderId,userId:o.userId},i={url:o.baseuri+"/open/v4/pay/query",postdata:n};o.HttpLib(i,function(e,n,i){if(0===e){var r=JSON.parse(n.data);if(void 0!==r.error&&t.call(o,p.payCode.fail,null,"orderId not exist"),void 0!==r.result){var a={status:"notPaid"},e=r.result.status;"41"===e.toString()&&(a.status="paid",t.call(o,p.payCode.success,a,null)),t.call(o,p.payCode.success,a,null)}}})}),o(r,"Ad",function(){return this.IsNull(this.platform().Ad)?void console.error(this.platform().ChannelType+" not support Ad"):this.platform().Ad()}),o(r,"getDeviceBenchmarkLevel",function(e,t){this.IsNull(this.platform().getDeviceBenchmarkLevel)?console.error(this.platform().ChannelType+" not support getDeviceBenchmarkLevel"):this.platform().getDeviceBenchmarkLevel(this,e,t)}),r)),h=new f;!function(o,r){"object"===a(exports)?e.exports=r():(n=r,i="function"==typeof n?n.call(exports,t,exports,e):n,!(void 0!==i&&(e.exports=i)))}(void 0,function(){return h})},function(e,exports,t){function o(e){function t(){}return t.prototype=e,new t}function n(e,t){var n;n="function"==typeof Object.create?Object.create(t.prototype):o.create(t.prototype),n.constructor=e,e.prototype=n}var i,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function e(t,o){return function(){function i(){if("undefined"==typeof i.prototype.ctor);else{var e=new Array;for(var t in arguments)e.push(arguments[t]);i.prototype.ctor.apply(this,e)}}var r=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/,_super=t.prototype;n(i,t);var a=i.prototype;"undefined"==typeof _super||"undefined"==typeof _super.ctor&&(_super.ctor=t),i.extend=function(t){return e(i,t)};for(var s in o)a[s]="function"==typeof o[s]&&"function"==typeof _super[s]&&r.test(o[s])?function(e,t){return function(){var o=this._super;this._super=_super[e];var n=new Array;for(var i in arguments)n.push(arguments[i]);var r=t.apply(this,n);return this._super=o,r}}(s,o[s]):o[s];return i}()},l=s(function(){},{});!function(o,n){"object"===a(exports)?e.exports=n():(i=n,r="function"==typeof i?i.call(exports,t,exports,e):i,!(void 0!==r&&(e.exports=r)))}(void 0,function(){return l})},function(e,exports,t){"use strict";var o=t(1),n=o.extend({IsWxApp:function(){try{if(void 0!==wx.request)return!0}catch(e){return!1}},IncludeWxChannel:function(e){return"xiaomi.cn.minigame"===e.type},ajax:function(e,t){if(t=t||{},t.cache=t.cache||!1,!t.url)throw new Error("参数不合法");if(this.IsWxApp()&&!this.IncludeWxChannel(e)){t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{};var o=this.formateParams(t.data,t.cache);"GET"===t.type?(t.url=o?t.url+"?"+o:t.url,wx.request({url:t.url,method:"GET",header:{Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})):wx.request({url:t.url,method:"POST",data:o,header:{"content-type":"application/x-www-form-urlencoded",Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})}else t.dataType=(t.dataType||"json").toLowerCase(),"jsonp"==t.dataType?this.ajaxJSONP(t):"json"==t.dataType&&this.ajaxJSON(t)},ajaxJSONP:function(e){e.data=e.data||{},e.jsonp=e.jsonp||"callback";var t="jsonp_"+(new Date).getTime();e.data[e.jsonp]=t;var o=this.formateParams(e.data,e.cache),n=document.getElementsByTagName("head")[0],i=document.createElement("script");n.appendChild(i),window[t]=function(o){n.removeChild(i),clearTimeout(i.timer),window[t]=null,e.success&&e.success(o)},i.src=o?e.url+"?"+o:e.url,e.time&&(i.timer=setTimeout(function(){window[t]=null,n.removeChild(i),e.error&&e.error({message:"超时"})},e.time))},ajaxJSON:function(e){e.type=(e.type||"GET").toUpperCase(),e.data=e.data||{};var t,o=this.formateParams(e.data,e.cache);if(t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),t.onreadystatechange=function(){4===t.readyState&&(200===t.status?e.success&&("string"==typeof t.responseText?e.success(t):e.success(t)):429===t.status?e.success&&t.responseText&&("string"==typeof t.responseText?e.success(t):e.success(t)):e.error&&e.error(t.status))},"GET"===e.type)t.open("GET",o?e.url+"?"+o:e.url,!0),t.send(null);else{if(e.headers&&"application/json"==e.headers["Content-Type"]){t.open("POST",e.url,!0);for(var n in e.headers)t.setRequestHeader(n,e.headers[n]);return void t.send(JSON.stringify(e.data))}t.open("POST",o?e.url+"?"+o:e.url,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(o)}},formateParams:function(e,t){var o=[];for(var n in e)o.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t&&o.push("v="+(new Date).getTime()),o.join("&")}});e.exports=new n},function(e,exports,t){var o,n,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=t(1),a=r.extend({_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",checkOs:function(){var e=navigator.userAgent,t=(navigator.appVersion,e.indexOf("Android")>-1||e.indexOf("Linux")>-1),o=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return t?"ANDROID":o?"IOS":void 0},getDeviceType:function(){return navigator&&navigator.userAgentData&&navigator.userAgentData.mobile?"Mobile":/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?"Mobile":"Browser"},encode:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},decode:function(e){return decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))},open_pay_url:function(e){this.showDetail(event,e)},pay_url:function(e){if("IOS"==s.checkOs()){console.log("pay ios ===>",e);var t=document.createElement("iframe");t.href=e,t.target="_self",top.location.href=location.href,t.click(),window.location.href=e,setTimeout(function(){document.body.removeChild(t)},3e3)}else{console.log("pay android ===>",e);var o=document.createElement("a");o.href=e,document.body.appendChild(o),o.click(),document.body.removeChild(o)}},showDetail:function(e,t){window.tysdk=this;var o=document.getElementsByTagName("head")[0],n="https://downqn.tuyoo.com/h5sdk/v100/src/css/style.css",i=document.createElement("link");i.href=n,i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css");var r=document.createElement("meta");r.setAttribute("name","viewport"),r.setAttribute("content","width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes"),o.appendChild(r),o.appendChild(i);var a='
    充值中心 X
    ',s=document.createElement("div");s.setAttribute("id","detailui"),s.innerHTML=a,document.getElementsByTagName("body")[0].appendChild(s)},fadeoutDetail:function(e){var t=e||event;t.stopPropagation();var o=document.getElementById("detailui");document.getElementsByTagName("body")[0].removeChild(o)},changeFrameHeight1:function(){ +var e=document.getElementById("myiframe");e.height=document.documentElement.clientHeight},Login_SIGN:function(e,t,o,n){var i=this.decode(n),r="userID="+e+"&clientID="+t+"&gameID="+o+"&signKey="+i;return this.signature(r)},signature:function(e){function t(e,t){var o,n,i,r,a;return i=2147483648&e,r=2147483648&t,o=1073741824&e,n=1073741824&t,a=(1073741823&e)+(1073741823&t),o&n?2147483648^a^i^r:o|n?1073741824&a?3221225472^a^i^r:1073741824^a^i^r:a^i^r}function o(e,o,n,i,r,a,s){return e=t(e,t(t(o&n|~o&i,r),s)),t(e<>>32-a,o)}function n(e,o,n,i,r,a,s){return e=t(e,t(t(o&i|n&~i,r),s)),t(e<>>32-a,o)}function i(e,o,n,i,r,a,s){return e=t(e,t(t(o^n^i,r),s)),t(e<>>32-a,o)}function r(e,o,n,i,r,a,s){return e=t(e,t(t(n^(o|~i),r),s)),t(e<>>32-a,o)}function a(e){var t,o="",n="";for(t=0;3>=t;t++)n=e>>>8*t&255,n="0"+n.toString(16),o+=n.substr(n.length-2,2);return o}var s,l,c,d,u,p,_,f,h=[];for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",o=0;on?t+=String.fromCharCode(n):(127n?t+=String.fromCharCode(n>>6|192):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128)),t+=String.fromCharCode(63&n|128))}return t}(e),h=function(e){var t,o=e.length;t=o+8;for(var n=16*((t-t%64)/64+1),i=Array(n-1),r=0,a=0;a>>29,i}(e),u=1732584193,p=4023233417,_=2562383102,f=271733878,e=0;e>5]|=(e.charCodeAt(r/8)&o)<>2]>>8*(r%4)&255)<<16|(t[r+1>>2]>>8*((r+1)%4)&255)<<8|t[r+2>>2]>>8*((r+2)%4)&255,s=0;s<4;s++)i+=8*r+6*s>32*t.length?"":n.charAt(a>>6*(3-s)&63);return i},showModal:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.title,o=void 0===t?"":t,n=e.content,i=void 0===n?"":n,r=e.showCancel,a=void 0===r||r;return new Promise(function(e){var t="https://downqn.tuyoo.com/h5sdk/v100/src/css/modal.css";if(!document.querySelector('link[href="'+t+'"]')){var n=document.createElement("link");n.rel="stylesheet",n.href=t,document.head.appendChild(n)}var r=document.createElement("div");r.className="custom-modal",r.innerHTML='\n ',document.body.appendChild(r),r.querySelector(".ok-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!0,cancel:!1})}),a&&r.querySelector(".cancel-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!1,cancel:!0})})})}}),s=new a;!function(r,a){"object"===i(exports)?e.exports=a():(o=a,n="function"==typeof o?o.call(exports,t,exports,e):o,!(void 0!==n&&(e.exports=n)))}(void 0,function(){return s})},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=Object.assign||function(e){for(var t=1;t0){var n=function(o){t.deleteCache(e),t.reportCacheData()};this.httpRequestWithLimit(o,n)}else this.reportCacheData()},processArray2String:function(e){if(e){var t="";return e.forEach(function(e){t+=e+"\n"}),t}},reportCacheData:function(){var e=this.getCacheWithLimitCount(this.gaLocalCacheData,10);e&&e.length>0&&this.reportGALog(e)},getCacheWithLimitCount:function(e,t){if(e){for(var o=[],n=Array.from(e),i=n.length>t?t:n.length,r=0;r100&&this.gaLocalCacheData.shift())},deleteCache:function(e){var t=this;e&&this.gaLocalCacheData&&e.forEach(function(e){t.gaLocalCacheData.indexOf(e)>-1&&t.gaLocalCacheData.splice(t.gaLocalCacheData.indexOf(e),1)})},httpRequest:function(e){var t=this;this.config&&this.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var o={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(o,function(e,o){t.tuyoo.config&&t.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+o)},function(e,t){console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})},httpRequestWithLimit:function(e,t){var o=this;if(!this.biLimitState){this.biLimitState=!0,this.tuyoo.config&&this.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var n={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(n,function(e,n){o.biLimitState=!1,200==n.status&&t&&t(n.data),o.tuyoo.config&&o.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+n)},function(e,t){o.biLimitState=!1,console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})}}});e.exports=a},function(e,exports){"use strict";var t=t||{};t.initCode={success:0,fail:-1},t.loginCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.payCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1001,navigatePayPageSucc:1e3},t.smsCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.biCode={success:0,fail:-1},t.verifyCode={success:t.initCode.success,fail:t.initCode.fail},t.shareCode={success:t.initCode.success,fail:t.initCode.fail},t.dealOrderFailCode={continue:t.initCode.success,needReOrder:t.initCode.fail},t.loginEvent={success:"登录成功",fail:"登录失败",cancle:"登录取消",sns_error:"snsId为undefined"},t.payEvent={success:"支付成功",fail:"支付失败",cancle:"支付取消",invalid:"支付方式无效"},t.initEvent={success:"初始化成功",fail:"初始化失败",url_null:"初始化URL为空"},t.biEvent={success:"上报成功",fail:"上报失败"},t.verifyEvent={success:"认证成功",fail:"认证失败"},e.exports=t},function(e,exports){"use strict";var t={GAEvents:{SDK_INIT_ENT:"sdk_c_init_end",SDK_LOGIN_START:"sdk_c_login_start",SDK_LOGIN_SUCC:"sdk_c_login_succ",SDK_LOGIN_FAIL:"sdk_c_login_fail",SDK_BIND_START:"sdk_c_bind_start",SDK_BIND_SUCC:"sdk_c_bind_succ",SDK_BIND_FAIL:"sdk_c_bind_fail",SDK_CHANNEL_INIT_START:"sdk_c_channel_init_start",SDK_CHANNEL_INIT_SUCC:"sdk_c_channel_init_succ",SDK_CHANNEL_INIT_FAIL:"sdk_c_channel_init_fail",SDK_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_LOGIN_BY_SDKSERVER_START:"sdk_c_login_by_sdkserver_start",SDK_LOGIN_BY_SDKSERVER_SUCC:"sdk_c_login_by_sdkserver_succ",SDK_LOGIN_BY_SDKSERVER_FAIL:"sdk_c_login_by_sdkserver_fail",SDK_PAY_START:"sdk_c_pay_start",SDK_PAY_SUCC:"sdk_c_pay_succ",SDK_PAY_FAIL:"sdk_c_pay_fail",SDK_PAY_LAUNCH_SUCC:"sdk_c_pay_launch_succ",SDK_C_ORDER_START:"sdk_c_order_start",SDK_C_ORDER_SUCC:"sdk_c_order_succ",SDK_C_ORDER_FAIL:"sdk_c_order_fail",SDK_C_REQUEST_CHANNEL_PAY_START:"sdk_c_request_channel_pay_start",SDK_C_REQUEST_CHANNEL_PAY_SUCC:"sdk_c_request_channel_pay_succ",SDK_C_REQUEST_CHANNEL_PAY_FAIL:"sdk_c_request_channel_pay_fail",SDK_C_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_C_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_C_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_SHARE_START:"sdk_c_share_start",SDK_SHARE_SUCC:"sdk_c_share_succ",SDK_SHARE_FAIL:"sdk_c_share_fail",SDK_C_GAME_LAUNCH:"sdk_c_game_launch",SDK_C_VERIFY:"sdk_c_verify"}};e.exports=t},function(e,exports,t){"use strict";var o=t(8),n=new o,i={"mt.cn.minigame":n},r={"mt.cn.minigame.iap":n},a={"mt.cn.minigame":n};e.exports={tyLoginInterface:i,tyPayInterface:r,tyInitInterface:a}},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=Object.assign||function(e){for(var t=1;tstatus: "+e+" \n error : "+o),100504==e&&this.loginParams.isShowLimitToast!==!1&&(this.tuyoo.bi.ReportGAWithType(this.tuyoo,this.tuyoo.bi.GA_TYPE.LOGIN,"sdk_c_receive_gateway_limit_info",{gateway_info:o}),mt.showModal({title:"温馨提示",content:o||"当前玩家过多,请稍后再试~",showCancel:!1,success:function(e){console.log(e)},fail:function(e){console.log(e)}}))}catch(e){console.error("oppo minigame LoginEnd",e)}},ExtraOrderParams:function(e,t,o){o.chargeType=this.ChargeType,o.ch_app_id=this.config.meituan_appId,o.osName=this.systemInfo.platform,o.sdk_origin_device_level_info=this.systemInfo.benchmarkLevel||"",o.os_version=this.systemInfo.system,o.sdk_device_brand=this.systemInfo.brand,o.phone_model=this.systemInfo.model},Pay:function(e,t,o,n,i){var s=this;e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_START,s.getGaParams(t,null));var l=t.chargeData;mt.requestMidasPayment({mgcId:l.ch_uid,appId:s.config.meituan_appId,accessToken:l.ch_token,productId:l.productId,bizOrderNo:t.platformOrderId,productName:t.diamondName,needRefresh:1,success:function(o){console.log("meituan pay success: ",JSON.stringify(o)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_SUCC,s.getGaParams(t,JSON.stringify(o))),n.call(i,r.payCode.success,JSON.stringify(o),null)},fail:function(o){console.log("meituan pay fail: ",JSON.stringify(o)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,s.getGaParams(t,{sdk_channel_error_code:o.errCode,sdk_channel_error_msg:JSON.stringify(o)})),n.call(i,r.payCode.fail,null,JSON.stringify(o))},complete:function(e){console.log("meituan pay complete: ",JSON.stringify(e))}})},getGaParams:function(e,t){var o={sdk_pay_type:"mt.cn.minigame.iap"};return!this.IsNull(e)&&this.isJSON(JSON.stringify(e))&&(o.sdk_pay_type=e.chargeType,o.sdk_order_track_id=e.sdk_order_track_id,o.sdk_order_id=e.platformOrderId,o.sdk_game_order_id=e.prodOrderId,o.sdk_product_id=e.prodId),!this.IsNull(t)&&this.isJSON(JSON.stringify(t))&&(o=n(o,t)),o},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":o(t))||!t)}catch(e){return!1}return!1},SetDefaultShareInfo:function(e,t){this.shareInfo=t},initShare:function(e){var t=this;this.IsNull(this.shareInfo)&&(this.shareInfo={}),mt.onShareAppMessage(function(){var o={sdk_c_share_track_id:e.CreateUUID(),sdk_share_user_id:e.userId};return e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_START,o),{title:t.shareInfo.title,imageUrl:t.shareInfo.imageUrl,imageUrlId:t.shareInfo.imageUrlId,query:encodeURIComponent("inviteCode="+e.userId+"&extraInfo="+(t.shareInfo.extraParams?t.shareInfo.extraParams:"")),success:function(n){console.log("onShareAppMessage success:"+JSON.stringify(n)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_SUCC,o),t.shareInfo&&t.shareInfo.callback&&t.shareInfo.callback.call(e,r.shareCode.success,JSON.stringify(n),null)},fail:function(n){console.log("onShareAppMessage fail:"+JSON.stringify(n)),o.sdk_channel_error_msg=JSON.stringify(n),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_FAIL,o),t.shareInfo&&t.shareInfo.callback&&t.shareInfo.callback.call(e,r.shareCode.fail,null,JSON.stringify(n))},complete:function(e){console.log("onShareAppMessage complete:"+JSON.stringify(e))}}})},Share:function(e,t,o){console.log("meituan share: "+JSON.stringify(t));var n={sdk_c_share_track_id:e.CreateUUID(),sdk_share_user_id:e.userId};e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_START,n);var i={title:t.title,imageUrl:t.imageUrl,imageUrlId:t.imageUrlId,query:encodeURIComponent("inviteCode="+e.userId+"&extraInfo="+(t.extraParams?t.extraParams:"")),success:function(t){console.log("shareAppMessage success:"+JSON.stringify(t)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_SUCC,n),o.call(e,r.shareCode.success,JSON.stringify(t),null)},fail:function(t){console.log("shareAppMessage fail:"+JSON.stringify(t)),n.sdk_channel_error_msg=JSON.stringify(t),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_FAIL,n),o.call(e,r.shareCode.fail,null,JSON.stringify(t))}};mt.shareAppMessage(i)},Logout:function(){},onExit:function(){},IsNull:function(e){return void 0===e||null===e||""===e},HttpLib:function(e,t){if(t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{},"https://cbi.tuyoo.com/api/bilog5/ga"===t.url&&(t.headers={"content-type":"text/plain"}),"GET"===t.type){var o=this.formateParams(t.data,t.cache);t.url=o?t.url+"?"+o:t.url,mt.request({url:t.url,method:t.type,header:{"Content-Type":"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(e){console.log("meituan http get error:",e),t.error&&t.error(e)}})}else mt.request({url:t.url,method:t.type,header:t.headers?t.headers:{"Content-Type":"application/x-www-form-urlencoded"},data:t.data,success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(e){if(console.log("meituan http post error:",e),e&&e.response&&e.response.data&&429===e.response.status){var o=e.response.data;if(o.result&&100504===o.result.code)return void t.success({responseText:o,status:o.result.code})}t.error&&t.error(e)}})},formateParams:function(e,t){var o=[];for(var n in e)o.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t&&o.push("v="+(new Date).getTime()),o.join("&")},LocalStorage:function(){return this},SetItem:function(e,t){mt.setStorageSync(e,t)},RemoveItem:function(e){mt.removeStorage({key:e})},GetItem:function(e){try{var t=mt.getStorageSync(e);return t}catch(e){console.log(e)}return null},Clear:function(){mt.clearStorage()}});e.exports=l}])}); +//# sourceMappingURL=tuyoosdk_release.js.map \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/tuyoosdk_meituanminigame_1.0.2.251010_release.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/tuyoosdk_meituanminigame_1.0.2.251010_release.js.meta new file mode 100644 index 0000000..c1e82b9 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/meituanminigame/tuyoosdk_meituanminigame_1.0.2.251010_release.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c5ae2508677d34e3a8905d1f385f0ec3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame.meta new file mode 100644 index 0000000..27c0ef5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5423a6658141421e99e082908eb26d6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/TyJsBridge.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/TyJsBridge.js new file mode 100644 index 0000000..6cbd183 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/TyJsBridge.js @@ -0,0 +1,213 @@ +var TuyooSdkBridge = { + + loadJsScriptToBridge: function (channelType) { + var channelTypeFromCS = UTF8ToString(channelType); + console.log("channelTypeFromCS:" + channelTypeFromCS); + }, + + InitToBridge: function (initEventInfo) { + try { + var initCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "InitResult", callbackString); + } + var initInfoFromCS = UTF8ToString(initEventInfo); + var initInfo = JSON.parse(initInfoFromCS); + var tyInitParams = {}; + tyInitParams.appId = initInfo.tuyooParam.appId; + tyInitParams.gameId = initInfo.tuyooParam.gameId; + tyInitParams.pay_version = "hall37"; + tyInitParams.baseurl = initInfo.tuyooParam.serverUrl.endsWith("/") ? initInfo.tuyooParam.serverUrl : initInfo.tuyooParam.serverUrl + "/"; + tyInitParams.bi_base_url = "https://cbi.tuyoo.com/"; + tyInitParams.cloudId = initInfo.tuyooParam.cloudId; + tyInitParams.packageName = initInfo.package; + tyInitParams.clientId = initInfo.tuyooParam.clientId; + tyInitParams.oppo_appId = initInfo.login.oppominigame.oppoAppId; + console.log("initInfo: " + JSON.stringify(initInfo)); + if (initInfo.login.oppominigame.packageType === "wasmsplit" && GameGlobal.tywx) { + GameGlobal.tywx.StateInfo.debugMode = initInfo.debug.toLowerCase() === "true"; + GameGlobal.tywx.SystemInfo.loginUrl = initInfo.tuyooParam.serverUrl.endsWith("/") ? initInfo.tuyooParam.serverUrl : initInfo.tuyooParam.serverUrl + "/"; + GameGlobal.tywx.SystemInfo.clientId = initInfo.tuyooParam.clientId; + GameGlobal.tywx.SystemInfo.cloudId = initInfo.tuyooParam.cloudId; + GameGlobal.tywx.SystemInfo.appId = initInfo.tuyooParam.appId; + GameGlobal.tywx.SystemInfo.gameId = initInfo.tuyooParam.gameId; + GameGlobal.tywx.SystemInfo.wxAppId = initInfo.login.tywx.wx_appId; + GameGlobal.tywx.SystemInfo.packageName = initInfo.package; + } + GameGlobal.TuyooSdk.OnInit(initInfo.tuyooParam.channelType, tyInitParams, initCallback, this); + } catch (e) { + console.error("InitToBridge catch error: " + e); + } + }, + + // 切换SDK域名 + UpdateServerUrlToBridge: function (serverUrl) { + try { + var serverUrlFromCS = UTF8ToString(serverUrl); + window.TuyooSdk.baseuri = (serverUrlFromCS.substring(serverUrlFromCS.length - 1) === '/') ? serverUrlFromCS.substring(0, serverUrlFromCS.length - 1) : serverUrlFromCS; + console.log("update serverUrl to: " + window.TuyooSdk.baseuri); + } catch (e) { + console.error("UpdateServerUrlToBridge catch error: " + e); + } + }, + + LoginToBridge: function (loginEventInfo) { + try { + var loginCallback = function (code, result, error) { + var callbackResult = { + code: code, + result: result && result.logindata ? result.logindata : result, + error: error + }; + var callbackString = JSON.stringify(callbackResult); + SendMessage("NativeCallBack", "LoginResult", callbackString); + } + var loginInfoFromCS = UTF8ToString(loginEventInfo); + var loginInfo = JSON.parse(loginInfoFromCS); + if (loginInfo.loginType === "wx.cn.minigame" && GameGlobal.tywx) { + GameGlobal.tywx.TuyooSDK.login(loginCallback); + return; + } + var tyLoginParams = {}; + if (loginInfo.loginType) { + tyLoginParams.ChannelType = loginInfo.loginType; + } + if (loginInfo.extraParams) { + var extraParams = JSON.parse(loginInfo.extraParams); + tyLoginParams.extraParams = extraParams; + } + console.log("tyLoginParams: " + JSON.stringify(tyLoginParams)); + GameGlobal.TuyooSdk.Login(tyLoginParams, loginCallback, this); + } catch (e) { + console.error("LoginToBridge catch error: " + e); + } + }, + + PayToBridge: function (payEventInfo) { + try { + var payCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "PayResult", callbackString); + } + var payInfoFromCS = UTF8ToString(payEventInfo); + var payInfo = JSON.parse(payInfoFromCS); + var tyPayParams = {}; + tyPayParams.prodCount = 1; + tyPayParams.appInfo = ""; + if (payInfo.chargeService) { + tyPayParams.ChargeType = payInfo.chargeService; + } + if (payInfo.productCount) { + tyPayParams.prodCount = payInfo.productCount; + } + if (payInfo.serverAppInfo) { + tyPayParams.appInfo = payInfo.serverAppInfo; + } + if (payInfo.gameOrderId) { + tyPayParams.prodOrderId = payInfo.gameOrderId; + } + if (payInfo.extraParams) { + var extraParams = JSON.parse(payInfo.extraParams); + tyPayParams.extraParams = extraParams; + } + tyPayParams.prodId = payInfo.productId; + tyPayParams.prodName = payInfo.productName; + tyPayParams.prodPrice = payInfo.productPrice; + console.log("tyPayParams: " + JSON.stringify(tyPayParams)); + GameGlobal.TuyooSdk.Pay(tyPayParams, payCallback, this); + } catch (e) { + console.error("PayToBridge catch error: " + e); + } + }, + + SetShareInfoToBridge: function (shareEventInfo) { + console.error("current channel not support SetShareInfo function"); + }, + + ShareToBridge: function (shareEventInfo) { + console.error("current channel not support Share function"); + }, + + GAEventTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + if (!reportInfo.typeName) { + reportInfo.typeName = "track"; + } + GameGlobal.TuyooSdk.bi.trackWithType(reportInfo.typeName, reportInfo.eventName, reportInfo.reportEvent); + } catch (e) { + console.error("GAEventTrackToBridge catch error: " + e); + } + }, + + GAProfileTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + GameGlobal.TuyooSdk.bi.profileTrack(reportInfo.profileType, reportInfo.profileSubjectType, reportInfo.profileSubjectPrimary, reportInfo.reportEvent); + } catch (e) { + console.error("GAProfileTrackToBridge catch error: " + e); + } + }, + + GetShareInfoBridge: function (shareEventInfo) { + console.error("current channel not support GetShareInfo function"); + }, + + GetAdInfoBridge: function () { + console.error("current channel not support GetAdInfo function"); + }, + + TxAdSDKReportToBridge: function (txAdReportInfo) { + console.error("current channel not support TxAdSDKReport function"); + }, + + CheckBindToBridge: function (bindEventInfo) { + console.error("current channel not support CheckBind function"); + }, + + SendSmsCodeToBridge: function (loginEventInfo) { + console.error("current channel not support SendSmsCode function"); + }, + + BindToBridge: function (bindEventInfo) { + console.error("current channel not support Bind function"); + }, + + SetWxUserInfoToBridge: function (type, userInfo) { + console.error("current channel not support SetWxUserInfo function"); + }, + + GetDeviceLevelToBridge: function() { + // try { + // var callback = function (code, result, error) { + // var callbackString = JSON.stringify({ code, result, error }); + // SendMessage("NativeCallBack", "GetDeviceLevelResult", callbackString); + // } + // GameGlobal.TuyooSdk.getDeviceBenchmarkLevel(callback, this); + // } catch (error) { + // console.error("GetDeviceLevelToBridge catch error: " + error); + // } + console.error("current channel not support GetDeviceLevelToBridge function"); + }, + + CreatGridGamePanelToBridge: function(gridGameModule) { + console.error("current channel not support CreatGridGamePanel function"); + }, + + ShowGridGamePanelToBridge: function(panelId) { + console.error("current channel not support ShowGridGamePanel function"); + }, + + HideGridGamePanelToBridge: function(panelId) { + console.error("current channel not support HideGridGamePanel function"); + }, + + DestroyGridGamePanelToBridge: function(panelId) { + console.error("current channel not support DestroyGridGamePanel function"); + } + +} + +mergeInto(LibraryManager.library, TuyooSdkBridge); \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/TyJsBridge.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/TyJsBridge.js.meta new file mode 100644 index 0000000..3f70af5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/TyJsBridge.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 49f6a69fc2dc245aeacaeab1ac4a1d78 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/tuyoosdk_oppominigame_1.0.2.250902_release.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/tuyoosdk_oppominigame_1.0.2.250902_release.js new file mode 100644 index 0000000..0eb681a --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/tuyoosdk_oppominigame_1.0.2.250902_release.js @@ -0,0 +1,3 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TuyooSdk=t():e.TuyooSdk=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var i=o[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,exports,t){function o(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var n,i,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=t(1),l=t(2),c=t(3),d=t(4),u=t(6),p=t(5),_=t(7),f=s.extend((r={baseuri:{get:function(){return this._baseuri},set:function(e){this._baseuri=e}},sdkRoute:{set:function(e){this._sdkRoute=e},get:function(){return void 0===this._sdkRoute||""===this.sdkRoute?"/open/v6/user/LoginBySnsIdNoVerify":this._sdkRoute}},payversion:{get:function(){return this._payversion},set:function(e){this._payversion=e}},clientId:{get:function(){return this._clientId},set:function(e){this._clientId=e}},packageName:{get:function(){return this._packageName},set:function(e){this._packageName=e}},appId:{get:function(){return this._appId},set:function(e){this._appId=e}},gameId:{get:function(){return this._gameId},set:function(e){this._gameId=e}},userId:{get:function(){return this._userId},set:function(e){this._userId=e}},token:{get:function(){return this._token},set:function(e){this._token=e}},logindata:{get:function(){return this._logindata},set:function(e){this._logindata=e}},ctor:function(){this.bi=new d},uuid:function(){if(this.IsNull(this._uuid))try{var e=this.LocalStorage().GetItem("ty_uuid");this.IsNull(e)?(this._uuid=this.CreateUUID(32,16),this.LocalStorage().SetItem("ty_uuid",this._uuid)):this._uuid=e}catch(e){return this.CreateUUID(32,16)}return this._uuid},CheckChannel:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t.tyPlatform))return t.tyPlatform}}return null},CheckParams:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t))return t}}return null},Decode:function(e){return c.decode(e)},IsNull:function(e){return void 0===e||null===e||""===e},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":a(t))||!t)}catch(e){return!1}},StartupParameter:function(){return this.platform().StartupParameter(this)},orderuri:function(){return"hall37"===this.payversion?this.baseuri+"/open/v4/pay/order":"hall51"===this.payversion?this.baseuri+"/open/v5/pay/order":this.baseuri+"/open/v4/pay/order"},platform:function(e){return this.IsNull(e)&&(e=this.type),_.tyLoginInterface[e]},platformPay:function(e){return _.tyPayInterface[e]},OnInitDebuger:function(e,t){var o="https://downqn.tuyoo.com/h5sdk/v100/js/vconsole.min.js";this.loadScript(o,function(o,n){if(0===o){new VConsole;console.log("----------tuyoosdk.OnInit-->initdebug:"),e.call(t,o,n,null)}else e.call(t,1005,null,"失败")})},OnInit:function(e,t,o,n){var i=this;console.log("----------tuyoosdk.OnInit-->channel:",e),t.debug&&i.OnInitDebuger(function(e,t,o){console.log(window.location.href,e,t,o)},i),i.TuyooInit(e,t,o,n)},SetDefaultShareInfo:function(e){this.IsNull(this.platform().SetDefaultShareInfo)||this.platform().SetDefaultShareInfo(this,e)},Share:function(e,t){this.IsNull(this.platform().Share)?t&&t.call(this,p.shareCode.fail,null,""+this.type+"不支持分享"):this.platform().Share(this,e,t)},CallMethod:function(e,t,o,n){var i=this.IsNull(t.ChannelType)?this.type:t.ChannelType;if(!this.IsNull(this.platform(i))&&"function"==typeof this.platform(i)[e]){var r=[this,t,o];return this.platform(i)[e].apply(n,r)}o&&o.call(this,p.initCode.fail,null,""+i+"不支持此功能("+e+")")},TuyooInit:function(e,t,o,n){var i=this;i.config=t;var r=(new Date).getTime(),a=function(e,t,a){0===e&&i.bi.ReportGAWithType(i,i.bi.GA_TYPE.TRACK,u.GAEvents.SDK_INIT_ENT,{sdk_init_duration_time:(new Date).getTime()-r});var s=[];for(var l in arguments)s.push(arguments[l]);o.apply(n,s)};if(i.IsNull(t.wxAppId)||(i.wxAppId=t.wxAppId),void 0===t.bi_base_url&&(t.bi_base_url="https://cbi.tuyoo.com/"),i.IsNull(t.pay_version)&&(t.pay_version="hall37"),"hall37"!==t.pay_version&&"hall51"!==t.pay_version)return void o.call(n,p.initCode.fail,null,"pay_version 必须为 hall37|hall51");if(this.IsNull(t.userId)?this.userId=0:this.userId=t.userId,console.log("----------tuyoosdk.OnInit-->config:",t),i.IsNull(t.clientId))if(i.IsNull(this.InitClientId())){if(!t.debug)return void o.call(n,p.initCode.fail,null,"clientId不能为空");t.clientId="Android_4.58_meitu.meitu.0-hall6.meitu.tu"}else t.clientId=this.InitClientId();this.type=e,this.appId=t.appId,this.gameId=t.gameId,this.clientId=t.clientId,this.payversion=t.pay_version,this.baseuri="/"===t.baseurl.substring(t.baseurl.length-1)?t.baseurl.substring(0,t.baseurl.length-1):t.baseurl,this.bi_base_uri="/"===t.bi_base_url.substring(t.bi_base_url.length-1)?t.bi_base_url.substring(0,t.bi_base_url.length-1):t.bi_base_url,this.packageName=t.packageName,console.log("----------tuyoosdk.OnInit-->clientId:",this.clientId),console.log("----------tuyoosdk.OnInit-->baseuri:",this.baseuri),console.log("----------tuyoosdk.OnInit-->platform:",this.platform()),this.bi.OnInit(this,t,function(r,s,l){0===r?(i.platform().OnInit(i,t,a,i),i.InitOtherThird(e,t,a,n)):o.call(n,r,s,l)},this)},InitOtherThird:function(e,t,o,n){for(var i in _.tyInitInterface)if(i!==e){var r=function(e,t,o){console.log("----------tuyoosdk.InitOtherThird-->type:",i," status: ",e)};_.tyInitInterface[i].OnInit(this,t,r,this)}},Is:function(e){var t=this.platform(e);return!this.IsNull(t)&&t.Is()},InitClientId:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(this.IsNull(e)===!1){var t=this.GetQueryToMap(e.substr(1,e.length));return this.IsNull(t.clientId)===!1?t.clientId:null}return null}return null},Login:function(e,t,o){var n=this;this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_login_track_id||""===e.extraParams.sdk_login_track_id?e.sdk_login_track_id=this.CreateUUID(32,16):e.sdk_login_track_id=e.extraParams.sdk_login_track_id:e.sdk_login_track_id=this.CreateUUID(32,16),this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),n.IsNull(n.platform(e.ChannelType).realLogin)?this.realLogin(e,t,o):n.platform(e.ChannelType).realLogin(n,e,t,o)},GetUserInfo:function(e,t,o){this.IsNull(this.platform().GetUserInfo)?console.error(this.platform().ChannelType+" not support GetUserInfo"):this.platform().GetUserInfo(this,e,t,o)},realLogin:function(e,t,o){var n=this,i={sdk_login_channel_type:n.platform(e.ChannelType).ChannelType,sdk_login_track_id:e.sdk_login_track_id};n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_START,i);var r=function(r,a,s){var l=n.convertLoginServerResultCode(r);0===l?(n.userId=a.userId,n.token=a.token,n.userPwd=a.userPwd,n.logindata=a.logindata,n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_SUCC,i),t&&t.call(o,p.loginCode.success,a,s)):(i.sdk_error_code=r,i.sdk_error_msg=JSON.stringify(s),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_FAIL,i),t&&t.call(o,l,a,s));try{n.IsNull(n.platform(e.ChannelType).LoginEnd)||n.platform(e.ChannelType).LoginEnd(r,a,s)}catch(e){console.log("----------tuyoosdk.LoginEnd-->err:",e)}},a={retryMax:1,url:n.baseuri+this.sdkRoute.get(),postdata:{imei:"null",idfa:"",appId:n.appId,gameId:n.gameId,clientId:n.clientId,packageName:n.packageName,uuid:n.uuid(),sdk_session_id:n.bi.sessionId,original_deviceid:n.uuid(),sdk_login_track_id:e.sdk_login_track_id}};if(n.IsNull(e.extraParams)===!1&&n.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)n.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,i,a){console.log("===========>snsHook",o,i),0===t?n.IsNull(n.platform(e.ChannelType).tuyooLogin)?n.tuyooLogin(o,r,a):n.platform(e.ChannelType).tuyooLogin(o,r,a):r.call(n,p.loginCode.fail,null,i)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(n,e,a,l)},tuyooLogin:function(e,t,o){var n=this;console.log("tuyoo-login-request",e);var i={sdk_login_channel_type:n.platform().ChannelType,sdk_login_track_id:e.postdata.sdk_login_track_id};n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_START,i);try{this.HttpLib(e,function(e,r){console.log("tuyoo-login-response",e,r);var a=JSON.parse(r.data);if(n.IsNull(a.result))i.sdk_error_msg=JSON.stringify(a),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),t.call(n,p.loginCode.fail,null,a);else if(0===a.result.code){var s={userId:a.result.userId,token:a.result.token,userPwd:a.result.userPwd,logindata:a.result};if(!n.IsNull(o))for(var l in o)s[l]=o[l];n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_SUCC,i),t.call(n,a.result.code,s)}else i.sdk_error_code=a.result.code,i.sdk_error_msg=JSON.stringify(a.result),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),t.call(n,a.result.code,null,a.result.info)},function(e,o){i.sdk_error_code=e,i.sdk_error_msg=JSON.stringify(o),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),t.call(n,p.loginCode.fail,null,o)},n)}catch(e){i.sdk_error_msg=JSON.stringify(e),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,i),console.log("tuyoo-login-catch",e),t.call(n,p.loginCode.fail,null,e)}},convertLoginServerResultCode:function(e){switch(e){case 0:return p.loginCode.success;case 12010:return 100201;case 12017:case 12130:return 100206;case 10:return 100502;case 100504:return 100504;default:return p.loginCode.fail}},Logout:function(){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(this)}},o(r,"Logout",function(e,t){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(e,t)}),o(r,"Bind",function(e,t,o){this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),this.realBind(e,t,o)}),o(r,"realBind",function(e,t,o){var n=this,i={sdk_login_channel_type:n.platform(e.ChannelType).ChannelType};n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_START,i);var r=function(e,r,a){var s=n.convertLoginServerResultCode(e);0===s?(n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_SUCC,i),t&&t.call(o,p.loginCode.success,r,a)):(i.sdk_error_code=e,i.sdk_error_msg=JSON.stringify(a),n.bi.ReportGAWithType(n,n.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_FAIL,i),t&&t.call(o,s,r,a))};if(n.IsNull(n.userId)||0===n.userId||"0"===n.userId)return void r(p.loginCode.fail,null,"Do not login");var a={retryMax:1,url:n.baseuri+"/open/v6/user/bindBySnsId",postdata:{imei:"null",appId:n.appId,gameId:n.gameId,clientId:n.clientId,packageName:n.packageName,uuid:n.uuid(),sdk_session_id:n.bi.sessionId,original_deviceid:n.uuid(),userId:n.userId,passwd:n.userPwd}};if(n.IsNull(e.extraParams)===!1&&n.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)n.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,i,a){console.log("===========>snsHook",o,i),0===t?n.IsNull(n.platform(e.ChannelType).tuyooBind)?n.tuyooBind(o,r,a):n.platform(e.ChannelType).tuyooBind(o,r,a):r.call(n,p.loginCode.fail,null,i)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(n,e,a,l)}),o(r,"tuyooBind",function(e,t,o){var n=this;console.log("tuyoo-bind-request",e);try{this.HttpLib(e,function(e,o){console.log("tuyoo-bind-response",e,o);var i=JSON.parse(o.data);n.IsNull(i.result)?t.call(n,p.loginCode.fail,null,i):0===i.result.code?t.call(n,i.result.code,i.result):t.call(n,i.result.code,i.result,i.result.info)},function(e,o){t.call(n,p.loginCode.fail,null,o)},n)}catch(e){console.log("tuyoo-bind-catch",e),t.call(n,p.loginCode.fail,null,e)}}),o(r,"Pay",function(e,t,o){console.log("==========>start pay "),this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_order_track_id||""===e.extraParams.sdk_order_track_id?e.sdk_order_track_id=this.CreateUUID(32,16):e.sdk_order_track_id=e.extraParams.sdk_order_track_id:e.sdk_order_track_id=this.CreateUUID(32,16),this.IsNull(e.ChargeType)&&(e.ChargeType=this.platform().ChargeType),this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_START,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_pay_type:e.ChargeType}),"tuyoo"!==e.ChargeType?this.realPay(e,t,o,e.ChargeType):this.payui(e,t,o)}),o(r,"isString",function(e){return"[object String]"===Object.prototype.toString.call(e)}),o(r,"Order",function(e,t,o){var n=this;if(void 0===e.prodCount&&(e.prodCount=1),void 0===e.appInfo&&(e.appInfo=""),void 0===e.prodOrderId&&(e.prodOrderId=""),n.IsNull(n.wxAppId)||(e.wxAppId=n.wxAppId),console.log("------- self.platformPay(args.ChargeType) ----------",n.platformPay(e.ChargeType)),!n.IsNull(n.platformPay(e.ChargeType).Order))return n.platformPay(e.ChargeType).Order(n,e,t,o);if(n.IsNull(n.userId)||0===n.userId||"0"===n.userId)return this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:p.payCode.fail,sdk_error_msg:"用户信息不合法",sdk_pay_type:e.ChargeType}),void t.call(o,p.payCode.fail,null,"用户信息不合法");var i={imei:"null",chargeType:e.ChargeType,userId:n.userId,appId:n.appId,gameId:n.gameId,mustcharge:"1",uuid:n.uuid(),clientId:n.clientId,prodId:e.prodId,prodName:e.prodName,prodCount:e.prodCount,prodPrice:e.prodPrice,appInfo:e.appInfo,prodOrderId:e.prodOrderId,sdk_session_id:n.bi.sessionId,sdk_order_track_id:e.sdk_order_track_id,original_deviceid:n.uuid()};if(n.IsNull(e.extraParams)===!1&&n.isJSON(JSON.stringify(e.extraParams)))for(var r in e.extraParams)n.IsNull(i[r])&&(i[r]=e.extraParams[r]);n.platformPay(e.ChargeType).ExtraOrderParams(n,e,i);var a={url:n.orderuri(),postdata:i};n.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_START,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId}),n.HttpLib(a,function(r,a){var s;if(s=n.isString(a.data)?JSON.parse(a.data):a.data,s&&null!==s.result)if(0===s.result.code){var l=s.result.chargeInfo;n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_SUCC,{sdk_pay_type:l.chargeType,sdk_order_id:l?l.platformOrderId:"DEFAULT",sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id});var c;try{c=s.result.payData}catch(e){c=null,console.log("=============> 没有paydata数据",e)}var d=function(i,r,a){var s={sdk_pay_type:l.chargeType,sdk_order_id:l.platformOrderId,sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id};0===i?n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_SUCC,s):i===p.payCode.navigatePayPageSucc?n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_LAUNCH_SUCC,s):(s.sdk_error_code=i,s.sdk_error_msg=a,n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,s));var c=[];for(var d in arguments)c.push(arguments[d]);t.apply(o,c)};console.log(e.ChargeType),l.sdk_order_track_id=e.sdk_order_track_id,n.platformPay(e.ChargeType).Pay(n,l,c,d,n)}else{if(n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:s.result.code,sdk_error_msg:JSON.stringify(s.result)}),!n.IsNull(n.platformPay(e.ChargeType).dealOrderFail)){var _=function(i,r,a){console.log("=============> dealOrderFail hook status",i),i===p.dealOrderFailCode.needReOrder?n.Order(e,t,o):this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,p.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)};return void n.platformPay(e.ChargeType).dealOrderFail(n,s.result,_)}this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,p.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)}else n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:"DEFAULT",sdk_error_msg:JSON.stringify(s)}),t.call(o,p.payCode.fail,null,s)},function(r,a){n.bi.ReportGAWithType(n,n.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:i.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:r,sdk_error_msg:a}),t.call(o,p.payCode.fail,null,a)},n)}),o(r,"realNameAuth",function(e,t){var o=this,n=function(e,n,i){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("----------tuyoosdk.realNameAuth-->err:",e)}},i={retryMax:1,url:o.baseuri+"/open/v6/user/update/sync/third",postdata:{imei:"null",idfa:"",appId:o.appId,gameId:o.gameId,clientId:o.clientId,packageName:o.packageName,uuid:o.uuid(),userId:o.userId}},r=function(e,t,i){console.log("===========>snsHook",t,i),0===e?o.IsNull(o.platform().syncThird)?o.syncThird(t,n):o.platform().syncThird(t,n):n.call(o,p.verifyCode.fail,null,i)};o.IsNull(o.platform().realNameAuth)?t.call(o,p.verifyCode.fail,null,"无渠道实名方法"):this.platform().realNameAuth(o,e,i,r)}),o(r,"syncThird",function(e,t){var o=this;console.log("tuyoo-syncThird-request",e),o.HttpLib(e,function(e,n){if(o.isString(n.data))var i=JSON.parse(n.data);else var i=n.data;i.result&&null!==i.result?(console.log("syncThird=============> "+JSON.stringify(i.result)),0===i.result.code?t.call(o,p.verifyCode.success,i.result,null):t.call(o,p.verifyCode.fail,null,i.result.info)):t.call(o,p.verifyCode.fail,null,i)},function(e,n){t.call(o,p.verifyCode.fail,null,n)},o)}),o(r,"ShowBuoy",function(){this.platform().ShowBuoy()}),o(r,"HideBuoy",function(){this.platform().HideBuoy()}),o(r,"ShoutCat",function(){this.platform().ShoutCat()}),o(r,"OnExit",function(){this.platform().onExit()}),o(r,"onExit",function(e){this.platform().onExit(e)}),o(r,"HttpLib",function(e,t,o,n){var i=this;void 0===e.retry&&(e.retry=0),void 0===e.retryMax&&(e.retryMax=0),void 0===e.method&&(e.method="POST"),void 0===e.headers&&(e.headers={"Content-Type":"application/x-www-form-urlencoded"});var r=function(e){l.ajax(i,e)};try{var a=this.platform(),s=!1;if("dmm.global.h5"!==a.ChannelType?s=!0:e.url!==i.config.bi_base_url+"api/bilog5/ga"&&(s=!0),s){var c=a.HttpLib;this.IsNull(c)||(r=function(e){c.call(a,i,e)})}}catch(e){}r({url:e.url,type:e.method,dataType:"json",headers:e.headers,data:e.postdata,success:function(r){console.log(e.url,">>请求结果》》》",r);try{var a={data:r.responseText,status:r.status},s={};"string"==typeof a.data?s=JSON.parse(a.data):(s=a.data,a.data=JSON.stringify(a.data)),i.IsNull(s.error)===!1?o.call(n,1009,s):t.call(n,0,a)}catch(e){t.call(n,0,a)}},error:function(r){console.log("网络异常",e.url),e.retry

    "+e.prodName+'

    \t
  • 微信支付
  • \t
  • 支付宝支付
  • \t

    选择支付方式

    ¥ '+e.prodPrice+"

    "+e.prodName+'

    \t
    \t\t
    微信支付
    \t\t
    支付宝支付
    \t
    ',l=document.createElement("div");l.setAttribute("id","payui"),l.innerHTML=s,document.getElementsByTagName("body")[0].appendChild(l)}),o(r,"realPay",function(e,t,o,n,i){var r=this;if(!this.IsNull(i)){console.log("==========>start pay ");var a=i||event;a.stopPropagation()}e.ChargeType=n;var s=function(e,n,i){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("应用层代码出错了--->"),console.log(e)}};try{r.Order(e,s,r)}catch(e){console.log("order error--->",e.toString())}}),o(r,"hidePay",function(e){var t=document.getElementById("payui");document.getElementsByTagName("body")[0].removeChild(t)}),o(r,"LoginByToken",function(e,t){var o=this,n={appId:e.appId,clientId:e.clientId,token:e.token,imei:null},i={url:o.baseuri+"/open/v4/user/loginByToken",postdata:n};o.HttpLib(i,function(e,n,i){if(0===e){var r=JSON.parse(n.data);if(null!==r.result)if(console.log("--------->message",r),0===r.result.code){var a={userId:r.result.userId,token:r.result.token,logindata:r.result};o.userId=r.result.userId,t.call(o,p.loginCode.success,a,null)}else t.call(o,p.loginCode.fail,null,r.result)}})}),o(r,"QueryOrderStatus",function(e,t){var o=this,n={appId:o.config.appId,clientId:o.config.clientId,platformOrderId:e.platformOrderId,userId:o.userId},i={url:o.baseuri+"/open/v4/pay/query",postdata:n};o.HttpLib(i,function(e,n,i){if(0===e){var r=JSON.parse(n.data);if(void 0!==r.error&&t.call(o,p.payCode.fail,null,"orderId not exist"),void 0!==r.result){var a={status:"notPaid"},e=r.result.status;"41"===e.toString()&&(a.status="paid",t.call(o,p.payCode.success,a,null)),t.call(o,p.payCode.success,a,null)}}})}),o(r,"Ad",function(){return this.IsNull(this.platform().Ad)?void console.error(this.platform().ChannelType+" not support Ad"):this.platform().Ad()}),o(r,"getDeviceBenchmarkLevel",function(e,t){this.IsNull(this.platform().getDeviceBenchmarkLevel)?console.error(this.platform().ChannelType+" not support getDeviceBenchmarkLevel"):this.platform().getDeviceBenchmarkLevel(this,e,t)}),r)),h=new f;!function(o,r){"object"===a(exports)?e.exports=r():(n=r,i="function"==typeof n?n.call(exports,t,exports,e):n,!(void 0!==i&&(e.exports=i)))}(void 0,function(){return h})},function(e,exports,t){function o(e){function t(){}return t.prototype=e,new t}function n(e,t){var n;n="function"==typeof Object.create?Object.create(t.prototype):o.create(t.prototype),n.constructor=e,e.prototype=n}var i,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function e(t,o){return function(){function i(){if("undefined"==typeof i.prototype.ctor);else{var e=new Array;for(var t in arguments)e.push(arguments[t]);i.prototype.ctor.apply(this,e)}}var r=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/,_super=t.prototype;n(i,t);var a=i.prototype;"undefined"==typeof _super||"undefined"==typeof _super.ctor&&(_super.ctor=t),i.extend=function(t){return e(i,t)};for(var s in o)a[s]="function"==typeof o[s]&&"function"==typeof _super[s]&&r.test(o[s])?function(e,t){return function(){var o=this._super;this._super=_super[e];var n=new Array;for(var i in arguments)n.push(arguments[i]);var r=t.apply(this,n);return this._super=o,r}}(s,o[s]):o[s];return i}()},l=s(function(){},{});!function(o,n){"object"===a(exports)?e.exports=n():(i=n,r="function"==typeof i?i.call(exports,t,exports,e):i,!(void 0!==r&&(e.exports=r)))}(void 0,function(){return l})},function(e,exports,t){"use strict";var o=t(1),n=o.extend({IsWxApp:function(){try{if(void 0!==wx.request)return!0}catch(e){return!1}},IncludeWxChannel:function(e){return"xiaomi.cn.minigame"===e.type},ajax:function(e,t){if(t=t||{},t.cache=t.cache||!1,!t.url)throw new Error("参数不合法");if(this.IsWxApp()&&!this.IncludeWxChannel(e)){t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{};var o=this.formateParams(t.data,t.cache);"GET"===t.type?(t.url=o?t.url+"?"+o:t.url,wx.request({url:t.url,method:"GET",header:{Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})):wx.request({url:t.url,method:"POST",data:o,header:{"content-type":"application/x-www-form-urlencoded",Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})}else t.dataType=(t.dataType||"json").toLowerCase(),"jsonp"==t.dataType?this.ajaxJSONP(t):"json"==t.dataType&&this.ajaxJSON(t)},ajaxJSONP:function(e){e.data=e.data||{},e.jsonp=e.jsonp||"callback";var t="jsonp_"+(new Date).getTime();e.data[e.jsonp]=t;var o=this.formateParams(e.data,e.cache),n=document.getElementsByTagName("head")[0],i=document.createElement("script");n.appendChild(i),window[t]=function(o){n.removeChild(i),clearTimeout(i.timer),window[t]=null,e.success&&e.success(o)},i.src=o?e.url+"?"+o:e.url,e.time&&(i.timer=setTimeout(function(){window[t]=null,n.removeChild(i),e.error&&e.error({message:"超时"})},e.time))},ajaxJSON:function(e){e.type=(e.type||"GET").toUpperCase(),e.data=e.data||{};var t,o=this.formateParams(e.data,e.cache);if(t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),t.onreadystatechange=function(){4===t.readyState&&(200===t.status?e.success&&("string"==typeof t.responseText?e.success(t):e.success(t)):429===t.status?e.success&&t.responseText&&("string"==typeof t.responseText?e.success(t):e.success(t)):e.error&&e.error(t.status))},"GET"===e.type)t.open("GET",o?e.url+"?"+o:e.url,!0),t.send(null);else{if(e.headers&&"application/json"==e.headers["Content-Type"]){t.open("POST",e.url,!0);for(var n in e.headers)t.setRequestHeader(n,e.headers[n]);return void t.send(JSON.stringify(e.data))}t.open("POST",o?e.url+"?"+o:e.url,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(o)}},formateParams:function(e,t){var o=[];for(var n in e)o.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t&&o.push("v="+(new Date).getTime()),o.join("&")}});e.exports=new n},function(e,exports,t){var o,n,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=t(1),a=r.extend({_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",checkOs:function(){var e=navigator.userAgent,t=(navigator.appVersion,e.indexOf("Android")>-1||e.indexOf("Linux")>-1),o=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return t?"ANDROID":o?"IOS":void 0},getDeviceType:function(){return navigator&&navigator.userAgentData&&navigator.userAgentData.mobile?"Mobile":/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?"Mobile":"Browser"},encode:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},decode:function(e){return decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))},open_pay_url:function(e){this.showDetail(event,e)},pay_url:function(e){if("IOS"==s.checkOs()){console.log("pay ios ===>",e);var t=document.createElement("iframe");t.href=e,t.target="_self",top.location.href=location.href,t.click(),window.location.href=e,setTimeout(function(){document.body.removeChild(t)},3e3)}else{console.log("pay android ===>",e);var o=document.createElement("a");o.href=e,document.body.appendChild(o),o.click(),document.body.removeChild(o)}},showDetail:function(e,t){window.tysdk=this;var o=document.getElementsByTagName("head")[0],n="https://downqn.tuyoo.com/h5sdk/v100/src/css/style.css",i=document.createElement("link");i.href=n,i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css");var r=document.createElement("meta");r.setAttribute("name","viewport"),r.setAttribute("content","width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes"),o.appendChild(r),o.appendChild(i);var a='
    充值中心 X
    ',s=document.createElement("div");s.setAttribute("id","detailui"),s.innerHTML=a,document.getElementsByTagName("body")[0].appendChild(s)},fadeoutDetail:function(e){var t=e||event;t.stopPropagation();var o=document.getElementById("detailui");document.getElementsByTagName("body")[0].removeChild(o)},changeFrameHeight1:function(){ +var e=document.getElementById("myiframe");e.height=document.documentElement.clientHeight},Login_SIGN:function(e,t,o,n){var i=this.decode(n),r="userID="+e+"&clientID="+t+"&gameID="+o+"&signKey="+i;return this.signature(r)},signature:function(e){function t(e,t){var o,n,i,r,a;return i=2147483648&e,r=2147483648&t,o=1073741824&e,n=1073741824&t,a=(1073741823&e)+(1073741823&t),o&n?2147483648^a^i^r:o|n?1073741824&a?3221225472^a^i^r:1073741824^a^i^r:a^i^r}function o(e,o,n,i,r,a,s){return e=t(e,t(t(o&n|~o&i,r),s)),t(e<>>32-a,o)}function n(e,o,n,i,r,a,s){return e=t(e,t(t(o&i|n&~i,r),s)),t(e<>>32-a,o)}function i(e,o,n,i,r,a,s){return e=t(e,t(t(o^n^i,r),s)),t(e<>>32-a,o)}function r(e,o,n,i,r,a,s){return e=t(e,t(t(n^(o|~i),r),s)),t(e<>>32-a,o)}function a(e){var t,o="",n="";for(t=0;3>=t;t++)n=e>>>8*t&255,n="0"+n.toString(16),o+=n.substr(n.length-2,2);return o}var s,l,c,d,u,p,_,f,h=[];for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",o=0;on?t+=String.fromCharCode(n):(127n?t+=String.fromCharCode(n>>6|192):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128)),t+=String.fromCharCode(63&n|128))}return t}(e),h=function(e){var t,o=e.length;t=o+8;for(var n=16*((t-t%64)/64+1),i=Array(n-1),r=0,a=0;a>>29,i}(e),u=1732584193,p=4023233417,_=2562383102,f=271733878,e=0;e>5]|=(e.charCodeAt(r/8)&o)<>2]>>8*(r%4)&255)<<16|(t[r+1>>2]>>8*((r+1)%4)&255)<<8|t[r+2>>2]>>8*((r+2)%4)&255,s=0;s<4;s++)i+=8*r+6*s>32*t.length?"":n.charAt(a>>6*(3-s)&63);return i},showModal:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.title,o=void 0===t?"":t,n=e.content,i=void 0===n?"":n,r=e.showCancel,a=void 0===r||r;return new Promise(function(e){var t="https://downqn.tuyoo.com/h5sdk/v100/src/css/modal.css";if(!document.querySelector('link[href="'+t+'"]')){var n=document.createElement("link");n.rel="stylesheet",n.href=t,document.head.appendChild(n)}var r=document.createElement("div");r.className="custom-modal",r.innerHTML='\n ',document.body.appendChild(r),r.querySelector(".ok-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!0,cancel:!1})}),a&&r.querySelector(".cancel-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!1,cancel:!0})})})}}),s=new a;!function(r,a){"object"===i(exports)?e.exports=a():(o=a,n="function"==typeof o?o.call(exports,t,exports,e):o,!(void 0!==n&&(e.exports=n)))}(void 0,function(){return s})},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=Object.assign||function(e){for(var t=1;t0){var n=function(o){t.deleteCache(e),t.reportCacheData()};this.httpRequestWithLimit(o,n)}else this.reportCacheData()},processArray2String:function(e){if(e){var t="";return e.forEach(function(e){t+=e+"\n"}),t}},reportCacheData:function(){var e=this.getCacheWithLimitCount(this.gaLocalCacheData,10);e&&e.length>0&&this.reportGALog(e)},getCacheWithLimitCount:function(e,t){if(e){for(var o=[],n=Array.from(e),i=n.length>t?t:n.length,r=0;r100&&this.gaLocalCacheData.shift())},deleteCache:function(e){var t=this;e&&this.gaLocalCacheData&&e.forEach(function(e){t.gaLocalCacheData.indexOf(e)>-1&&t.gaLocalCacheData.splice(t.gaLocalCacheData.indexOf(e),1)})},httpRequest:function(e){var t=this;this.config&&this.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var o={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(o,function(e,o){t.tuyoo.config&&t.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+o)},function(e,t){console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})},httpRequestWithLimit:function(e,t){var o=this;if(!this.biLimitState){this.biLimitState=!0,this.tuyoo.config&&this.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var n={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(n,function(e,n){o.biLimitState=!1,200==n.status&&t&&t(n.data),o.tuyoo.config&&o.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+n)},function(e,t){o.biLimitState=!1,console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})}}});e.exports=a},function(e,exports){"use strict";var t=t||{};t.initCode={success:0,fail:-1},t.loginCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.payCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1001,navigatePayPageSucc:1e3},t.smsCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.biCode={success:0,fail:-1},t.verifyCode={success:t.initCode.success,fail:t.initCode.fail},t.shareCode={success:t.initCode.success,fail:t.initCode.fail},t.dealOrderFailCode={continue:t.initCode.success,needReOrder:t.initCode.fail},t.loginEvent={success:"登录成功",fail:"登录失败",cancle:"登录取消",sns_error:"snsId为undefined"},t.payEvent={success:"支付成功",fail:"支付失败",cancle:"支付取消",invalid:"支付方式无效"},t.initEvent={success:"初始化成功",fail:"初始化失败",url_null:"初始化URL为空"},t.biEvent={success:"上报成功",fail:"上报失败"},t.verifyEvent={success:"认证成功",fail:"认证失败"},e.exports=t},function(e,exports){"use strict";var t={GAEvents:{SDK_INIT_ENT:"sdk_c_init_end",SDK_LOGIN_START:"sdk_c_login_start",SDK_LOGIN_SUCC:"sdk_c_login_succ",SDK_LOGIN_FAIL:"sdk_c_login_fail",SDK_BIND_START:"sdk_c_bind_start",SDK_BIND_SUCC:"sdk_c_bind_succ",SDK_BIND_FAIL:"sdk_c_bind_fail",SDK_CHANNEL_INIT_START:"sdk_c_channel_init_start",SDK_CHANNEL_INIT_SUCC:"sdk_c_channel_init_succ",SDK_CHANNEL_INIT_FAIL:"sdk_c_channel_init_fail",SDK_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_LOGIN_BY_SDKSERVER_START:"sdk_c_login_by_sdkserver_start",SDK_LOGIN_BY_SDKSERVER_SUCC:"sdk_c_login_by_sdkserver_succ",SDK_LOGIN_BY_SDKSERVER_FAIL:"sdk_c_login_by_sdkserver_fail",SDK_PAY_START:"sdk_c_pay_start",SDK_PAY_SUCC:"sdk_c_pay_succ",SDK_PAY_FAIL:"sdk_c_pay_fail",SDK_PAY_LAUNCH_SUCC:"sdk_c_pay_launch_succ",SDK_C_ORDER_START:"sdk_c_order_start",SDK_C_ORDER_SUCC:"sdk_c_order_succ",SDK_C_ORDER_FAIL:"sdk_c_order_fail",SDK_C_REQUEST_CHANNEL_PAY_START:"sdk_c_request_channel_pay_start",SDK_C_REQUEST_CHANNEL_PAY_SUCC:"sdk_c_request_channel_pay_succ",SDK_C_REQUEST_CHANNEL_PAY_FAIL:"sdk_c_request_channel_pay_fail",SDK_C_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_C_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_C_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_SHARE_START:"sdk_c_share_start",SDK_SHARE_SUCC:"sdk_c_share_succ",SDK_SHARE_FAIL:"sdk_c_share_fail",SDK_C_GAME_LAUNCH:"sdk_c_game_launch",SDK_C_VERIFY:"sdk_c_verify"}};e.exports=t},function(e,exports,t){"use strict";var o=t(8),n=new o,i={"oppo.cn.minigame":n},r={"oppo.cn.minigame.iap":n},a={"oppo.cn.minigame":n};e.exports={tyLoginInterface:i,tyPayInterface:r,tyInitInterface:a}},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=Object.assign||function(e){for(var t=1;tstatus: "+e+" \n error : "+o),100504==e&&this.loginParams.isShowLimitToast!==!1&&(this.tuyoo.bi.ReportGAWithType(this.tuyoo,this.tuyoo.bi.GA_TYPE.LOGIN,"sdk_c_receive_gateway_limit_info",{gateway_info:o}),qg.showModal({title:"温馨提示",content:o||"当前玩家过多,请稍后再试~",showCancel:!1,success:function(e){console.log(e)},fail:function(e){console.log(e)}}))}catch(e){console.error("oppo minigame LoginEnd",e)}},ExtraOrderParams:function(e,t,o){o.chargeType=this.ChargeType,o.ch_app_id=this.config.oppo_appId,o.appVersion=e.IsNull(this.gameVersionCode)?"defalut_version":this.gameVersionCode,o.engineVersion=this.systemInfo.platformVersionCode,o.snsToken=this.channel_login_token,o.os_version=this.systemInfo.system,o.sdk_device_brand=this.systemInfo.brand,o.phone_model=this.systemInfo.model,o.sdk_origin_device_level_info=this.systemInfo.benchmarkLevel},Pay:function(e,t,o,n,i){var s=this;console.log("oppominigame-pay-start"),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_START,s.getGaParams(t,null));var l=t.chargeData;qg.pay({appId:s.oppo_appId,token:s.channel_login_token,timestamp:l.timestamp,orderNo:l.orderNo,paySign:l.paySign,success:function(o){console.log("oppo pay success: ",JSON.stringify(o)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_SUCC,s.getGaParams(t,null)),n.call(i,r.payCode.success,JSON.stringify(o),null)},fail:function(o){console.log("oppo pay fail: ",JSON.stringify(o)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,s.getGaParams(t,{sdk_channel_error_code:o.code?o.code:o.errCode,sdk_channel_error_msg:JSON.stringify(o)})),n.call(i,r.payCode.fail,null,JSON.stringify(o))}})},dealOrderFail:function(e,t,o){if(console.log("oppominigame-dealOrderFail"),t.code&&25214===t.code){var n=function(t,n,i){t===r.loginCode.success?o.call(e,r.dealOrderFailCode.needReOrder,n,i):o.call(e,r.dealOrderFailCode.continue,n,i)};this.ChannelLogin(e,null,null,null,n,"order")}else o.call(e,r.dealOrderFailCode.continue,"no needReOrder",null)},getGaParams:function(e,t){var o={sdk_pay_type:this.ChargeType};return!this.IsNull(e)&&this.isJSON(JSON.stringify(e))&&(o.sdk_pay_type=e.chargeType,o.sdk_order_track_id=e.sdk_order_track_id,o.sdk_order_id=e.platformOrderId,o.sdk_game_order_id=e.prodOrderId,o.sdk_product_id=e.prodId),!this.IsNull(t)&&this.isJSON(JSON.stringify(t))&&(o=n(o,t)),o},IsNull:function(e){return void 0===e||null===e||""===e},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":o(t))||!t)}catch(e){return!1}return!1}});e.exports=l}])}); +//# sourceMappingURL=tuyoosdk_release.js.map \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/tuyoosdk_oppominigame_1.0.2.250902_release.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/tuyoosdk_oppominigame_1.0.2.250902_release.js.meta new file mode 100644 index 0000000..6d3374f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/oppominigame/tuyoosdk_oppominigame_1.0.2.250902_release.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 39fc15a1494854837b768d65550fb7ec +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx.meta new file mode 100644 index 0000000..25bfde0 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: db431760cfd904f22b2a9edf0780c4de +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/TyJsBridge.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/TyJsBridge.js new file mode 100644 index 0000000..d402c76 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/TyJsBridge.js @@ -0,0 +1,435 @@ + +var TuyooSdkBridge = { + + loadJsScriptToBridge: function (channelType) { + var channelTypeFromCS = UTF8ToString(channelType); + console.log("channelTypeFromCS:" + channelTypeFromCS); + }, + + InitToBridge: function (initEventInfo) { + try { + var initInfoFromCS = UTF8ToString(initEventInfo); + var initInfo = JSON.parse(initInfoFromCS); + GameGlobal.tywx.StateInfo.debugMode = initInfo.debug.toLowerCase() === "true"; + GameGlobal.tywx.SystemInfo.loginUrl = initInfo.tuyooParam.serverUrl.endsWith("/") ? initInfo.tuyooParam.serverUrl : initInfo.tuyooParam.serverUrl + "/"; + GameGlobal.tywx.SystemInfo.wxPayVersion = "2.0"; + GameGlobal.tywx.SystemInfo.clientId = initInfo.tuyooParam.clientId; + GameGlobal.tywx.SystemInfo.cloudId = initInfo.tuyooParam.cloudId; + GameGlobal.tywx.SystemInfo.appId = initInfo.tuyooParam.appId; + GameGlobal.tywx.SystemInfo.gameId = initInfo.tuyooParam.gameId; + GameGlobal.tywx.SystemInfo.wxAppId = initInfo.login.tywx.wx_appId; + GameGlobal.tywx.SystemInfo.packageName = initInfo.package; + if (initInfo.login.tywx.wxShareEnable === false) { + GameGlobal.tywx.StateInfo.wxShareEnable = false; + wx.hideShareMenu({ + menus: ['shareAppMessage', 'shareTimeline'] + }); + } + // 默认关闭拉取营销系统分享配置开关 + GameGlobal.tywx.StateInfo.pullShareConfig = false; + if (initInfo.login.tywx.pullShareConfig === true) { + GameGlobal.tywx.StateInfo.pullShareConfig = true; + } + // 默认关闭交叉导流功能 + GameGlobal.tywx.StateInfo.adManagerMode = false; + if (initInfo.login.tywx.adManagerMode === true) { + GameGlobal.tywx.StateInfo.adManagerMode = true; + } + // 广点通上报,默认开启 + if (initInfo.login.tywx.txAdEventReportMode === false) { + GameGlobal.tywx.StateInfo.txAdEventReportMode = false; + } + // 错误日志上报,默认关闭 + if (initInfo.login.tywx.errorLogMode === true) { + GameGlobal.tywx.StateInfo.errorLogMode = false; + } + + if (initInfo.login.tywx.shareManagerUrl) { + GameGlobal.tywx.SystemInfo.shareManagerUrl = initInfo.login.tywx.shareManagerUrl.endsWith("/") ? initInfo.login.tywx.shareManagerUrl : initInfo.login.tywx.shareManagerUrl + "/"; + } + if (initInfo.login.tywx.txAdSetId) { + GameGlobal.tywx.SystemInfo.txAdSetId = initInfo.login.tywx.txAdSetId; + } + if (initInfo.login.tywx.txAdSetKey) { + GameGlobal.tywx.SystemInfo.txAdSetKey = initInfo.login.tywx.txAdSetKey; + } + if (initInfo.login.tywx.openFeatureFilter === true) { + GameGlobal.tywx.SystemInfo.openFeatureFilter = true; + } + + var launchInfo = wx.getLaunchOptionsSync(); + GameGlobal.tywx && GameGlobal.tywx.wxOnshowAction && GameGlobal.tywx.wxOnshowAction(launchInfo); + wx.onShow(function (result) { + GameGlobal.tywx && GameGlobal.tywx.wxOnshowAction && GameGlobal.tywx.wxOnshowAction(result); + }) + var callbackResult = { + code: 0, + result: "wx init completed!", + error: "" + }; + var callbackString = JSON.stringify(callbackResult); + GameGlobal.Module.SendMessage("NativeCallBack", "InitResult", callbackString); + } + catch (e) { + console.error("InitToBridge catch error: " + e); + } + }, + + // 切换SDK域名 + UpdateServerUrlToBridge: function (serverUrl) { + try { + var serverUrlFromCS = UTF8ToString(serverUrl); + GameGlobal.tywx.SystemInfo.loginUrl = serverUrlFromCS.endsWith("/") ? serverUrlFromCS : serverUrlFromCS + "/"; + console.log("update serverUrl to: " + GameGlobal.tywx.SystemInfo.loginUrl); + } catch (e) { + console.error("UpdateServerUrlToBridge catch error: " + e); + } + }, + + // 登录 + LoginToBridge: function (loginEventInfo) { + try { + var loginCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + GameGlobal.Module.SendMessage("NativeCallBack", "LoginResult", callbackString); + } + GameGlobal.tywx.TuyooSDK.login(loginCallback); + } catch (e) { + console.error("LoginToBridge catch error: " + e); + } + }, + + // 支付 + PayToBridge: function (payEventInfo) { + try { + var payCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + GameGlobal.Module.SendMessage("NativeCallBack", "PayResult", callbackString); + } + var payInfoFromCS = UTF8ToString(payEventInfo); + var payInfo = JSON.parse(payInfoFromCS); + var tyPayParams = {}; + tyPayParams.prodCount = 1; + tyPayParams.appInfo = ""; + if (payInfo.chargeService) { + tyPayParams.chargeType = payInfo.chargeService; + } + if (payInfo.productCount) { + tyPayParams.prodCount = payInfo.productCount; + } + if (payInfo.serverAppInfo) { + tyPayParams.appInfo = payInfo.serverAppInfo; + } + if (payInfo.gameOrderId) { + tyPayParams.prodOrderId = payInfo.gameOrderId; + } + tyPayParams.prodId = payInfo.productId; + tyPayParams.prodName = payInfo.productName; + tyPayParams.prodPrice = payInfo.productPrice; + tyPayParams.sdk_game_role_id = payInfo.gameRoleId; + tyPayParams.sdk_game_zone_id = payInfo.gameZoneId; + if (payInfo.extraParams) { + var extraParams = JSON.parse(payInfo.extraParams); + if (extraParams.actId) { + tyPayParams.actId = extraParams.actId; + delete extraParams.actId; + } + if (extraParams.levelList) { + tyPayParams.levelList = JSON.parse(extraParams.levelList); + delete extraParams.levelList; + } + if (extraParams.sendMessageTitle) { + tyPayParams.sendMessageTitle = extraParams.sendMessageTitle; + delete extraParams.sendMessageTitle; + } + if (extraParams.sendMessagePath) { + tyPayParams.sendMessagePath = extraParams.sendMessagePath; + delete extraParams.sendMessagePath; + } + if (extraParams.sendMessageImg) { + tyPayParams.sendMessageImg = extraParams.sendMessageImg; + delete extraParams.sendMessageImg; + } + tyPayParams.extraParams = extraParams; + } + console.log("tyPayParams: " + JSON.stringify(tyPayParams)); + GameGlobal.tywx.TYPayInterface.pay(tyPayParams, payCallback); + } catch (e) { + console.error("PayToBridge catch error: " + e); + } + }, + + GAEventTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + if (!reportInfo.typeName) { + reportInfo.typeName = "track"; + } + GameGlobal.tywx.GALog.trackWithType(reportInfo.typeName, reportInfo.eventName, reportInfo.reportEvent); + } catch (e) { + console.error("GAEventTrackToBridge catch error: " + e); + } + }, + + GAProfileTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + GameGlobal.tywx.GALog.profileTrack(reportInfo.profileType, reportInfo.profileSubjectType, reportInfo.profileSubjectPrimary, reportInfo.reportEvent); + } catch (e) { + console.error("GAProfileTrackToBridge catch error: " + e); + } + }, + + GetShareInfoBridge: function (shareEventInfo) { + try { + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var resource = shareInfo.resource; + var shareCallback = function (code, result, error) { + if(code == 0 && result){ + result.sharePoint = resource.sharePointId; + } + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "GetShareInfoResult", callbackString); + } + GameGlobal.tywx.ShareInterface.GetServerShareConfig(resource.type || 'wx_normal', resource.sharePointId, shareCallback); + } catch (error) { + console.error("GetShareInfoBridge catch error: " + error); + } + }, + + SetShareInfoToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var resource = shareInfo.resource; + var extraData = shareInfo.extra; + var shareInfoToJs = {}; + resource.title && (shareInfoToJs.shareContent = resource.title); + resource.imageUrl && (shareInfoToJs.sharePicUrl = resource.imageUrl); + resource.shareSchemeId && (shareInfoToJs.shareSchemeId = resource.shareSchemeId); + resource.extraParams && (shareInfoToJs.extraInfo = resource.extraParams); + resource.sharePointId && (shareInfoToJs.sharePoint = resource.sharePointId); + if(extraData){ + Object.assign(shareInfoToJs, extraData); + } + console.log("shareInfoToJs: " + JSON.stringify(shareInfoToJs)); + GameGlobal.tywx.ShareInterface.setOnShareAppMessageInfo(shareInfoToJs.sharePoint, shareInfoToJs, shareCallback); + } catch (e) { + console.error("SetShareInfoToBridge catch error: " + e); + } + }, + + ShareToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + GameGlobal.Module.SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var resource = shareInfo.resource; + var extraData = resource.extra; + var shareInfoToJs = {}; + resource.title && (shareInfoToJs.shareContent = resource.title); + resource.imageUrl && (shareInfoToJs.sharePicUrl = resource.imageUrl); + resource.shareSchemeId && (shareInfoToJs.shareSchemeId = resource.shareSchemeId); + resource.extraParams && (shareInfoToJs.extraInfo = resource.extraParams); + resource.sharePointId && (shareInfoToJs.sharePoint = resource.sharePointId); + if(extraData){ + Object.assign(shareInfoToJs, extraData); + } + console.log("shareInfoToJs: " + JSON.stringify(shareInfoToJs)); + if(resource.type == 'wx_activity_not_chat'){ + GameGlobal.tywx.ShareInterface.activityShare(shareInfoToJs.sharePoint, shareInfoToJs, shareCallback); + }else if(resource.type == 'wx_poster'){ + GameGlobal.tywx.ShareInterface.posterShare(shareInfoToJs.sharePoint, shareInfoToJs, shareCallback); + }else{ + GameGlobal.tywx.ShareInterface.share(shareInfoToJs.sharePoint, shareInfoToJs, shareCallback); + } + } catch (e) { + console.error("ShareToBridge catch error: " + e); + } + }, + + GetAdInfoBridge: function () { + try { + var iconCallback = function (result) { + var callbackResult = { + code: 0, + result: result, + }; + var callbackString = JSON.stringify(callbackResult); + GameGlobal.Module.SendMessage("NativeCallBack", "GetIconInfoResult", callbackString); + } + var newIconCallback = function (result) { + var callbackResult = { + code: 0, + result: result, + }; + var callbackString = JSON.stringify(callbackResult); + GameGlobal.Module.SendMessage("NativeCallBack", "GetNewIconInfoResult", callbackString); + } + GameGlobal.tywx.NotificationCenter.listen(tywx.EventType.GET_ADMANAGER_ICON_INFO_SUCCESS, iconCallback); + GameGlobal.tywx.NotificationCenter.listen(tywx.EventType.GET_ADMANAGER_NEWICON_INFO_SUCCESS, newIconCallback); + GameGlobal.tywx.AdManager.init(); + } catch (error) { + console.error("ShareToBridge catch error: " + error); + } + }, + + TxAdSDKReportToBridge: function (txAdReportInfo) { + try { + var reportInfoFromCS = UTF8ToString(txAdReportInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + console.log("reportInfoToJs: " + JSON.stringify(reportInfo.actionParams)); + GameGlobal.tywx.TxAdSDKReportInterface.track(reportInfo.actionType, JSON.parse(reportInfo.actionParams)); + } catch (error) { + console.error("TxAdSDKReportToBridge catch error: " + error); + } + }, + + CheckBindToBridge: function (bindEventInfo) { + try { + var bindInfoFromCS = UTF8ToString(bindEventInfo); + var bindInfo = JSON.parse(bindInfoFromCS); + var checkBindCallback = function (code, result) { + var finnalResult = { + code: code, + }; + if (code == -1) { + finnalResult.error = result; + } else { + finnalResult.result = result; + } + var callbackString = JSON.stringify(finnalResult); + GameGlobal.Module.SendMessage("NativeCallBack", "CheckResult", callbackString); + } + GameGlobal.tywx.TuyooSDK.CheckBind(bindInfo.userId, checkBindCallback); + } catch (error) { + console.error("checkBindToBridge catch error: " + error); + } + }, + + SendSmsCodeToBridge: function (loginEventInfo) { + try { + var loginInfoFromCS = UTF8ToString(loginEventInfo); + var phoneInfo = JSON.parse(loginInfoFromCS); + var sendSmsCodeCallback = function (code, result) { + var finnalResult = { + code: code, + }; + if (code == 0) { + finnalResult.result = result; + } else { + finnalResult.error = result; + } + var callbackString = JSON.stringify(finnalResult); + GameGlobal.Module.SendMessage("NativeCallBack", "SendCodeResult", callbackString); + } + GameGlobal.tywx.TuyooSDK.ThirdSmsSend(phoneInfo.phoneNumber, sendSmsCodeCallback); + } catch (error) { + console.error("SendSmsCodeToBridge catch error: " + error); + } + }, + + BindToBridge: function (bindEventInfo) { + try { + var bindInfoFromCS = UTF8ToString(bindEventInfo); + var bindInfo = JSON.parse(bindInfoFromCS); + var doBindCallback = function (code, result) { + var finnalResult = { + code: code, + }; + if (code == 0) { + finnalResult.result = result; + } else { + finnalResult.error = result; + } + var callbackString = JSON.stringify(finnalResult); + GameGlobal.Module.SendMessage("NativeCallBack", "onBindSucc", callbackString); + } + GameGlobal.tywx.TuyooSDK.ThirdBindSns(bindInfo.phoneNumber, bindInfo.phoneCode, bindInfo.userId, bindInfo.password, doBindCallback); + } catch (error) { + console.error("BindToBridge catch error: " + error); + } + }, + + SetWxUserInfoToBridge: function (type, userInfo) { + try { + var userInfoFromCS = UTF8ToString(userInfo); + var currentUserInfo = JSON.parse(userInfoFromCS); + var reportInfo = currentUserInfo.wxUserInfo; + var currentType = UTF8ToString(type); + var succCb = function () { + var finnalResult = { + code: 0, + result: "success!" + }; + var callbackString = JSON.stringify(finnalResult); + GameGlobal.Module.SendMessage("NativeCallBack", "SetWxInfoResult", callbackString); + } + var failCb = function () { + var finnalResult = { + code: -1, + error: "fail!" + }; + var callbackString = JSON.stringify(finnalResult); + GameGlobal.Module.SendMessage("NativeCallBack", "SetWxInfoResult", callbackString); + } + if (currentType == "1") { + GameGlobal.tywx.NotificationCenter.listen(tywx.EventType.SET_WX_USER_INFO_SUCCESS, succCb); + GameGlobal.tywx.NotificationCenter.listen(tywx.EventType.SET_WX_USER_INFO_FAIL, failCb); + GameGlobal.tywx.TuyooSDK.setWxUserInfo(reportInfo); + } else if (currentType == "2") { + GameGlobal.tywx.NotificationCenter.listen(tywx.EventType.SET_WX_SENSITIVE_DATA_SUCCESS, succCb); + GameGlobal.tywx.NotificationCenter.listen(tywx.EventType.SET_WX_SENSITIVE_DATA_FAIL, failCb); + GameGlobal.tywx.TuyooSDK.setWxEncryptedData(reportInfo.encryptedData, reportInfo.iv); + } else if (currentType == "3") { + GameGlobal.tywx.NotificationCenter.listen(tywx.EventType.SET_WX_SENSITIVE_DATA_SUCCESS, succCb); + GameGlobal.tywx.NotificationCenter.listen(tywx.EventType.SET_WX_SENSITIVE_DATA_SUCCESS, failCb); + GameGlobal.tywx.TuyooSDK.setThreeWxEncryptedData(reportInfo.wxOpenId, reportInfo.unionId, reportInfo.session_key); + } + } catch (error) { + console.error("SetWxUserInfoToBridge catch error: " + error); + } + }, + + GetDeviceLevelToBridge: function() { + try { + var callback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + GameGlobal.Module.SendMessage("NativeCallBack", "GetDeviceLevelResult", callbackString); + } + GameGlobal.tywx.TuyooSDK.getDeviceBenchmarkLevel(callback); + } catch (error) { + console.error("GetDeviceLevelToBridge catch error: " + error); + } + }, + + CreatGridGamePanelToBridge: function(gridGameModule) { + console.error("current channel not support CreatGridGamePanel function"); + }, + + ShowGridGamePanelToBridge: function(panelId) { + console.error("current channel not support ShowGridGamePanel function"); + }, + + HideGridGamePanelToBridge: function(panelId) { + console.error("current channel not support HideGridGamePanel function"); + }, + + DestroyGridGamePanelToBridge: function(panelId) { + console.error("current channel not support DestroyGridGamePanel function"); + } + +} + + +mergeInto(LibraryManager.library, TuyooSdkBridge); \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/TyJsBridge.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/TyJsBridge.js.meta new file mode 100644 index 0000000..f2382bd --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/TyJsBridge.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2ca65f180cf9f414aa2630d83f81f306 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4.meta new file mode 100644 index 0000000..8bc1eeb --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e71e06e22de84bab9c7114861753f3d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.d.ts b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.d.ts new file mode 100644 index 0000000..c951ba0 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.d.ts @@ -0,0 +1,491 @@ +/** + * SDK 初始化参数 + */ +interface SdkConfig { + /** + * 数据源ID,必填 + */ + user_action_set_id: number; + /** + * 加密key,必填 + */ + secret_key: string; + /** + * 微信小程序/小游戏APPID,wx开头,必填 + */ + appid: string; + /** + * 微信 openid,openid 和 unionid 至少填一个, 可以调用 setOpenId 设置 + */ + openid?: string; + /** + * 微信 unionid,openid 和 unionid 至少填一个, 可以调用 setUnionId 设置 + */ + unionid?: string; + /** + * 自定义用户ID,选填 + */ + user_unique_id?: string; + /** + * 是否自动采集事件 + */ + auto_track?: boolean; + /** + * 是否自动采集属性 + */ + auto_attr?: boolean; +} +/** + * 小程序/小游戏信息 + */ +interface GameInfo { + /** + * 广告点击id、曝光id + */ + ad_trace_id?: string; + /** + * 页面路径,小游戏没有 + */ + page_url?: string; + /** + * 页面名称,小游戏没有 + */ + page_title?: string; + /** + * 组件名称 + */ + component_name?: string; + /** + * 场景来源 + */ + source_scene?: number; + /** + * 渠道号 + */ + pkg_channel_id?: string; + /** + * 框架信息,小游戏没有 + */ + framework?: string; + /** + * 渠道来源 + */ + channel: string; + /** + * 启动参数 + */ + launch_options: string; +} +/** + * 设备信息 + */ +interface DeviceInfo { + /** + * 设备品牌 + */ + device_brand: string; + /** + * 设备型号 + */ + device_model: string; + /** + * 微信App版本 + */ + wx_version: string; + /** + * 微信基础库版本 + */ + wx_lib_version: string; + /** + * 微信客户端平台 + */ + wx_platform: string; + /** + * 操作系统 + */ + os: string; + /** + * 操作系统版本 + */ + os_version: string; + /** + * 设备性能等级 + */ + benchmark_level: number; + /** + * 屏幕高度 + */ + screen_height: number; + /** + * 屏幕宽度 + */ + screen_width: number; +} +interface TrackBaseInfo extends SdkConfig, DeviceInfo { + local_id: string; + sdk_name: string; + sdk_version: string; + inner_param: { + app_version: string; + app_env_version: string; + }; +} +/** + * 行为信息 + */ +interface ActionInfo { + action_type: string; + action_param?: Record; + is_sdk_auto_track: boolean; + session_id: string; + log_id: number; + action_id: string; + action_time: number; + revised_action_time: number; + is_retry: boolean; + retry_count: number; + ad_trace_id?: string; + page_url?: string; + page_title?: string; + component_name?: string; + source_scene?: number; + pkg_channel_id?: string; + /** + * 网络类型 + */ + network_type?: string; + inner_param?: Record; + channel?: string; +} +interface LogParams { + log_type: string; + code?: number; + message?: string; + err_stack?: string; + user_action_set_id?: number; + appid?: string; + local_id?: string; + session_id?: string; + sdk_name?: string; + sdk_version?: string; + page_url?: string; + framework?: string; + device_brand?: string; + device_model?: string; + wx_version?: string; + wx_lib_version?: string; + wx_platform?: string; + os?: string; + os_version?: string; +} + +interface QueueProps { + /** + * 数据源ID,用于本地存储队列key + */ + userActionSetId: number; + /** + * 队列长度 + */ + maxLength: number; +} +interface QueueManagerProps extends QueueProps { + /** + * OG事件列表 + */ + ogEvents: string[]; +} +interface IEvent extends ActionInfo { + inner_status?: string; +} + +/** + * 队列原子操作 + */ + +declare class Queue { + protected maxLength: any; + protected userActionSetId: any; + protected lostActionMaps: Record; + private stack; + private localStorageKey; + private timeStamp; + constructor({ userActionSetId, maxLength }: QueueProps); + getItems(): IEvent[]; + getStorage(): IEvent[]; + /** + * 上报丢失条数到日志系统 + */ + reportLostNum(): void; + /** + * 获取丢失条数map + * @returns 丢失条数map + */ + getLostMaps(): Record; + protected init(): void; + protected addItem(eventData: IEvent): void; + protected removeItems(actionIds: string[]): void; + protected updateForReportFail(actionIds: string[]): void; + protected updateForReporting(actionIds: string[]): void; + protected updateAllStack(stack: IEvent[]): void; + protected updateToStorage(): void; + /** + * 更新丢失条数 + * @param sessionId 当前被丢弃行为的会话id + */ + protected updateLostAction(sessionId: string): void; + /** + * 设置时间戳 + */ + protected setTimeStamp(): void; +} + +declare class QueueManage extends Queue { + protected ogEvents: string[]; + constructor({ userActionSetId, maxLength, ogEvents }: QueueManagerProps); + /** + * 获取可上报的队列 + * @param reportMaxLength 需要上报的队列最大长度 + */ + getReportableActions(reportMaxLength?: number): IEvent[]; + /** + * 添加行为到队列 + * @param eventData 单条行为数据 + */ + addAction(eventData: IEvent): void; + /** + * 根据acition_id删除行为 + * @param actionIds 行为id列表 + */ + removeActions(actionIds: string[]): void; + /** + * 上报失败时更新队列状态 + * @param actionIds + */ + updateActionsForReportFail(actionIds: string[]): void; + /** + * 上报时更新队列状态为reporting + * @param actionIds 需要更新的行为id数组 + */ + updateActionsForReporting(actionIds: string[]): void; + /** + * 获取可上报队列长度 + * @returns 可上报队列长度 + */ + getReportableActionsLength(): number; + /** + * 按照优先级从大到小给队列排序 + * @param currEvent 当前事件 + * @param stack 当前队列 + */ + sortQueue(currEvent: IEvent, stack: IEvent[]): IEvent[]; + /** + * 计算优先级 + * @param currTime 当前时间 + * @param event 行为事件 + * @returns 权重值 + */ + private caculateWeight; + /** + * + * @param currTime 当前时间 + * @param actionTime 队列行为时间 + * @returns 权重值 + */ + private formatWeight; +} + +interface ConfigManager { + getRealTimeActionList: () => Array; + getRequestTimeout: () => number; +} +interface ActionReporterProps { + getBaseInfo: () => TrackBaseInfo; + reportLog: (param: LogParams) => void; + queueManager: QueueManage; + configManager?: ConfigManager; +} +/** + * 行为上报类 + */ +declare class ActionReporter { + private static currentRequestCount; + private static requestConcurrency; + static setRequestConcurrency(n: number): void; + private getBaseInfo; + private reportLog; + private queueManager; + private configManager; + private cgiBatchSize; + private reportThreshold; + private reportDelay; + private triggerExecuteSend; + private inspectDelay; + private inspectTimer; + private isNeedContinueSend; + constructor(props: ActionReporterProps); + /** + * 批量上报行为,track的时候触发 + */ + batchSend(): void; + /** + * 全量上报, flush的时候触发 + */ + flushSend(): void; + /** + * 执行指定数量的行为上报逻辑,超过接口batch上限则并行发送请求 + */ + private executeSend; + /** + * 组装上报用的行为数据 + */ + private generateActionReportParams; + /** + * 上报接口请求成功逻辑处理 + * @param resData + * @param actionIdList + */ + private dealSuccessData; + /** + * 上报接口请求失败逻辑处理 + * @param errData + * @param actionIdList + */ + private dealFailData; + /** + * wx.request文档:https://developers.weixin.qq.com/minigame/dev/api/network/request/wx.request.html + * @param param.data:接口请求参数、param.actionIdList:行为id列表 + * @returns + */ + private report; + /** + * 启动上报定时器 + */ + private startInspectTimer; +} + +declare abstract class SdkExtCommon { + protected special_method_symbol: symbol; + /** + * 付费 + */ + onPurchase(value: number): void; + /** + * 进入前台 + */ + onEnterForeground(): void; + /** + * 进入后台 + */ + onEnterBackground(): void; + /** + * 启动 + */ + onAppStart(): void; + /** + * 退出 + */ + onAppQuit(): void; + /** + * 收藏 + */ + onAddToWishlist(): void; + protected wrapTrack(action_type: ActionInfo["action_type"], action_param?: ActionInfo["action_param"]): void; + abstract track(action_type: ActionInfo["action_type"], action_param?: ActionInfo["action_param"]): void; +} + +declare abstract class sdkExt extends SdkExtCommon { + /** + * 注册 + */ + onRegister(): void; + /** + * 创角 + */ + onCreateRole(name?: string): void; + /** + * 完成新手教程 + */ + onTutorialFinish(): void; +} + +declare const initializedInstanceSymbol: unique symbol; +declare class SDK extends sdkExt { + private static [initializedInstanceSymbol]; + static setRequestConcurrency(n: number): void; + static setDebug(debug: boolean): void; + protected env: string; + protected sdk_version: string; + protected sdk_name: string; + protected config?: SdkConfig; + protected deviceInfo: Partial; + protected gameInfo: Partial; + protected session_id: string; + protected log_id: number; + protected queueManage?: QueueManage; + protected actionReporter?: ActionReporter; + protected openid?: string; + protected unionid?: string; + protected user_unique_id?: string; + protected inited: boolean; + constructor(sdkConfig: SdkConfig); + /** + * 数据上报方法 + */ + track(action_type: ActionInfo['action_type'], action_param?: ActionInfo['action_param']): void; + /** + * 立即上报数据 + */ + flush(): void; + /** + * 设置 openId + */ + setOpenId(openid: string): void; + /** + * 设置 unionid + */ + setUnionId(unionid: string): void; + /** + * 设置 user_unique_id + * @param user_unique_id + */ + setUserUniqueId(user_unique_id: string): void; + protected doReportOnEnterBackground(): void; + /** + * 获取数据上报时所需要的 info 参数 + */ + private getTrackBaseInfo; + /** + * 生成上报队列需要的行为数据 + * @param actionParams 行为参数 + * @param is_sdk_auto_track 是否自动采集 + * @returns + */ + private createAction; + /** + * 给指定行为的inner_param字段追加字段 + * @param action 待追加字段的行为 + * @param key 待添加到inner_param字段的key + * @param value key对应的value + */ + private addActionInnerParam; + /** + * 不同行为携带的渠道来源判断逻辑 + * @param actionType + * @returns + */ + private getChannelByActionType; + /** + * 上报日志 + * @param params 日志参数 + */ + private reportLog; + private useAutoTrack; + private getAutoProxyRemoteConfig; + /** + * 设置openid时,如果值合法缓存到Storage + */ + private saveValidOpenidToStorage; +} + +export { SDK }; diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.d.ts.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.d.ts.meta new file mode 100644 index 0000000..a9de547 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.d.ts.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4281eb15fbaf94140ac04656d0b06e85 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.js new file mode 100644 index 0000000..db865ed --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.js @@ -0,0 +1,6 @@ +/** + * @dn-sdk/minigame v1.5.4 + * (c) 2024 + * @license ISC + */ +function t(t,e,n){return(e=p(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function e(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n-1?O:e.indexOf("IOS")>-1?I:e.indexOf("MAC")>-1?C:e.indexOf("WINDOWS")>-1?w:x}(o[0]),a=function(t){return!t||t.length<=0?"":2===t.length?t[1]:3===t.length&&"Windows"===t[0]?"".concat(t[1]," ").concat(t[2]):t[t.length-1]}(o);t={benchmark_level:e.benchmarkLevel,device_brand:e.brand,screen_height:Math.floor(e.screenHeight),screen_width:Math.floor(e.screenWidth),wx_lib_version:e.SDKVersion,wx_version:e.version,wx_platform:e.platform,device_model:e.model,os:i,os_version:a}}return t}}(),rt=function(){var t;return function(){try{if(t)return t;t||(t=tt.getSync(_)||""),t||(t=mt(),tt.setSync(_,t))}catch(t){}return t}}();var ot=function(){var t="unknown",e=!1;return function(){if(!e)try{wx.getNetworkType({success:function(e){t=e.networkType},fail:function(){t="unknown"}}),wx.onNetworkStatusChange((function(e){t=e.networkType})),e=!0}catch(t){}return t}}();ot();var it=function(){var t="";return function(){return t||(t=tt.getSync(T)||""),t}}(),at=function(){var t;return function(){if(t)return t;try{var e=wx.getAccountInfoSync();return ht(e.miniProgram)?t=e.miniProgram:{}}catch(e){return{}}}}();function ut(t){var e=null==t?void 0:t.query;if(!ht(e))return"";var n="";return e.gdt_vid||[1045,1046,1084].indexOf(null==t?void 0:t.scene)>-1?n=Y:e.clue_token||e.clickid&&e.item_id?n=W:e.callback&&"kuaishou"===e.ksChannel?n=J:e.bd_vid||e.ai&&e.d&&e.q&&e.c?n=z:e.uctrackid?n=H:(e.trackid||e.imp||[1065,1069,1194].indexOf(null==t?void 0:t.scene)>-1&&(e.callback||e.u))&&(n=$),n}function ct(t,e){try{var n=nt(),r={sdk_version:"1.5.4",sdk_name:"@dn-sdk/minigame",device_brand:null==n?void 0:n.device_brand,device_model:null==n?void 0:n.device_model,wx_version:null==n?void 0:n.wx_version,wx_lib_version:null==n?void 0:n.wx_lib_version,wx_platform:null==n?void 0:n.wx_platform,os:null==n?void 0:n.os,os_version:null==n?void 0:n.os_version,local_id:rt()},o=Object.assign(r,t);wx.request({url:"https://api.datanexus.qq.com/data-nexus-trace/log",data:o,method:"POST",timeout:E.requestTimeout,success:function(t){"function"==typeof e&&200===(null==t?void 0:t.statusCode)&&e()}})}catch(n){xt.error(n)}}var st=function(){function t(){f(this,t)}return v(t,null,[{key:"revise",value:function(t){t>0&&!this.isRevised&&(this.offsetTime=t-Date.now(),this.isRevised=!0)}},{key:"getRevisedcurrentTimeMillis",value:function(){return this.isRevised?Date.now()+this.offsetTime:-1}}]),t}();function lt(t){return new Promise((function(e,n){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/config/get",data:t,timeout:E.requestTimeout,success:function(t){ft(t,e,"config/get",n),vt(t)},fail:function(t){dt(t,"config/get",n)}})}))}function ft(t,e,n,r){var o,i,a,u,c=null==t?void 0:t.statusCode,s=null==(o=null==t?void 0:t.data)?void 0:o.code;if(200!==c||0!==s){var l=s;200!==c&&(l="number"==typeof c?-1*c:-888),ct({log_type:b.REQUEST_CONFIG_ERROR,message:"cgiName: ".concat(n,", statusCode: ").concat(c,", code: ").concat(s,", traceid: ").concat(null==(a=null==t?void 0:t.data)?void 0:a.trace_id),code:l}),null==r||r(null==(u=null==t?void 0:t.data)?void 0:u.data)}else e(null==(i=t.data)?void 0:i.data)}function dt(t,e,n){ct({log_type:b.REQUEST_CONFIG_ERROR,message:"cgiName: ".concat(e," , message: ").concat(null==t?void 0:t.errMsg," "),code:"number"==typeof(null==t?void 0:t.errno)?-1*t.errno:-999}),null==n||n(t)}function vt(t){var e,n=1*(null==(e=null==t?void 0:t.header)?void 0:e["Server-Time"]);n>17266752e5&&st.revise(n)}st.offsetTime=0,st.isRevised=!1;var pt=Object.prototype.toString,ht=function(t){return"[object Object]"===pt.call(t)},yt=function(t){return"[object Array]"===pt.call(t)},_t=function(t){return"[object Function]"===pt.call(t)},gt=(new Date).getTime();function mt(){var t=(new Date).getTime(),e=Math.abs(1e3*(t-gt));return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(n){var r=16*Math.random();return t>0?(r=(t+r)%16|0,t=Math.floor(t/16)):(r=(e+r)%16|0,e=Math.floor(e/16)),("x"===n?r:3&r|8).toString(16).replace(/-/g,"")}))}var At=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Rt=function(t){if("string"!=typeof t)throw new TypeError("Invalid argument expected string");if(!At.test(t))throw new Error("Invalid argument not valid semver ('".concat(t,"' received)"))},kt=function(t){return isNaN(Number(t))?t:Number(t)},Tt=function(t){var e=t.replace(/^v/,"").replace(/\+.*$/,""),n=function(t,e){return-1===t.indexOf(e)?t.length:t.indexOf(e)}(e,"-"),r=e.substring(0,n).split(".");return r.push(e.substring(n+1)),r},St=function(t,e){[t,e].forEach(Rt);for(var n=Tt(t),r=Tt(e),o=0;oa)return 1;if(a>i)return-1}var u=n[n.length-1],c=r[r.length-1];if(u&&c)for(var s=u.split(".").map(kt),l=c.split(".").map(kt),f=0;fl[f])return 1;if(l[f]>s[f])return-1}else if(u||c)return u?-1:1;return 0},Et=function(t){return ht(t)?(function(t){var e=["user_action_set_id","secret_key","appid","openid","unionid","user_unique_id","auto_track","auto_attr"];for(var n in t)e.includes(n)||xt.warn("Invalid property '".concat(n,"' found in config"))}(t),"number"!=typeof t.user_action_set_id?"user_action_set_id 参数需为 number 类型":t.user_action_set_id<=0?"user_action_set_id 参数需大于 0":"string"!=typeof t.secret_key?"secret_key 参数需为 string 类型":""===t.secret_key.trim()?"缺少 secret_key 参数":32!==t.secret_key.length?"secret_key 参数需为 32 位字符串":"string"!=typeof t.appid?"appid 参数需为 string 类型":""!==t.appid.trim()||"缺少 appid"):"初始化参数需为 object 类型"};function bt(t){return Ot()[t]}function Ot(){return E}function It(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var wt=function(t){try{return t&&"string"==typeof t?-1===(t=t.replace(/\s/g,"")).indexOf(".")?t:t.split(".").slice(0,2).join("."):""}catch(e){return t}},Ct=function(){function t(){f(this,t)}return v(t,null,[{key:"error",value:function(t){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1?r-1:0),i=1;i1?r-1:0),i=1;i1?n-1:0),o=1;o1?r-1:0),i=1;i1e4&&(r=JSON.stringify({cut:1,scene:e.scene})),t={source_scene:e.scene,pkg_channel_id:e.query.wxgamepro||"",ad_trace_id:n,launch_options:r,channel:ut(e)}}catch(e){t={},xt.log("获取场景值和渠道号失败",e)}return t}}();function Lt(t,e,n){var r=n.value;return n.value=function(){for(var n=arguments.length,o=new Array(n),i=0;i1?void 0:r?Dt(e,n):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,n,i):o(i))||i);return r&&i&&Mt(e,n,i),i},qt=function(){function t(e){var n=e.userActionSetId,r=e.maxLength,o=void 0===r?500:r;f(this,t),this.lostActionMaps={},this.stack=[],this.localStorageKey="",this.localStorageKey="".concat(g,"_").concat(null==n?void 0:n.toString()),this.maxLength=o,this.userActionSetId=n,this.setTimeStamp(),this.init()}return v(t,[{key:"getItems",value:function(){return this.stack}},{key:"getStorage",value:function(){var t,e=(null==(t=tt)?void 0:t.getSync(this.localStorageKey))||"[]";return JSON.parse(e)}},{key:"reportLostNum",value:function(){var t=this,e=Object.assign({},this.lostActionMaps),n=[];for(var r in e){var o=null==r?void 0:r.split("_");n.push({queue_lost_session_id:o[0],queue_lost_timestamp:o[1],queue_lost_num:e[r]})}n.length&&(this.setTimeStamp(),n.forEach((function(e){var n=Object.assign({},{user_action_set_id:t.userActionSetId,log_type:b.QUEUE_LOST_NUM},e),r=null==e?void 0:e.queue_lost_session_id,o=null==e?void 0:e.queue_lost_timestamp,i="".concat(r,"_").concat(o);ct(n,(function(){It(t.lostActionMaps,i)&&(delete t.lostActionMaps[i],tt.setSync(A,JSON.stringify(t.lostActionMaps)))}))})))}},{key:"getLostMaps",value:function(){return this.lostActionMaps}},{key:"init",value:function(){var t=this,e=this.getStorage(),n=null==e?void 0:e.map((function(t){var e,n;return t.inner_status===(null==(e=S)?void 0:e.reporting)?Object.assign({},t,{inner_status:null==(n=S)?void 0:n.fail,is_retry:!0,retry_count:t.retry_count+1}):t}));this.stack=n,this.lostActionMaps=JSON.parse(tt.getSync(A)||"{}"),setTimeout((function(){t.reportLostNum()}),1e3)}},{key:"addItem",value:function(t){var e;null==(e=null==this?void 0:this.stack)||e.push(t)}},{key:"removeItems",value:function(t){var e,n=null==(e=null==this?void 0:this.stack)?void 0:e.filter((function(e){return!(null!=t&&t.includes(null==e?void 0:e.action_id))}));this.stack=n}},{key:"updateForReportFail",value:function(t){var e;this.stack=null==(e=this.stack)?void 0:e.map((function(e){var n;return null!=t&&t.includes(null==e?void 0:e.action_id)?Object.assign({},e,{inner_status:null==(n=S)?void 0:n.fail,retry_count:e.retry_count+1,is_retry:!0}):e}))}},{key:"updateForReporting",value:function(t){var e;this.stack=null==(e=this.stack)?void 0:e.map((function(e){var n;return null!=t&&t.includes(null==e?void 0:e.action_id)?Object.assign({},e,{inner_status:null==(n=S)?void 0:n.reporting}):e}))}},{key:"updateAllStack",value:function(t){this.stack=t}},{key:"updateToStorage",value:function(){tt.setSync(this.localStorageKey,JSON.stringify(this.stack))}},{key:"updateLostAction",value:function(t){if(t){var e="".concat(t,"_").concat(this.timeStamp),n=this.lostActionMaps[e]||0;this.lostActionMaps[e]=n+1,tt.setSync(A,JSON.stringify(this.lostActionMaps))}}},{key:"setTimeStamp",value:function(){this.timeStamp=Date.now().toString()}}]),t}();Ut([Lt],qt.prototype,"getItems",1),Ut([Lt],qt.prototype,"getStorage",1),Ut([Lt],qt.prototype,"reportLostNum",1),Ut([Lt],qt.prototype,"getLostMaps",1),Ut([Lt],qt.prototype,"init",1),Ut([Lt],qt.prototype,"addItem",1),Ut([Lt],qt.prototype,"removeItems",1),Ut([Lt],qt.prototype,"updateForReportFail",1),Ut([Lt],qt.prototype,"updateForReporting",1),Ut([Lt],qt.prototype,"updateAllStack",1),Ut([Lt],qt.prototype,"updateToStorage",1),Ut([Lt],qt.prototype,"updateLostAction",1);var jt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor,Bt=function(t,e,n,r){for(var o,i=r>1?void 0:r?Ft(e,n):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,n,i):o(i))||i);return r&&i&&jt(e,n,i),i},Vt=function(t){o(n,qt);var e=a(n);function n(t){var r,o=t.userActionSetId,i=t.maxLength,a=void 0===i?500:i,u=t.ogEvents,c=void 0===u?[]:u;return f(this,n),(r=e.call(this,{userActionSetId:o,maxLength:a})).ogEvents=c,r}return v(n,[{key:"getReportableActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,e=this.getItems(),n=[];return null==e||e.forEach((function(e){var r;(null==n?void 0:n.length)=this.maxLength){var n="队列长度超过最大限制".concat(this.maxLength,"条,SDK将按照行为优先级排序,丢弃优先级最低的行为事件");xt.warn(n),ct({user_action_set_id:this.userActionSetId,log_type:b.JS_QUEUE_LOG,message:n});var r=this.sortQueue(t,e);xt.debug&&xt.info("超过".concat(this.maxLength,"条按优先级排序的队列:"),r.concat([]));var o=r.pop();this.updateAllStack(r),this.updateLostAction((null==o?void 0:o.session_id)||"")}else this.addItem(t);this.updateToStorage()}},{key:"removeActions",value:function(t){this.removeItems(t),this.updateToStorage()}},{key:"updateActionsForReportFail",value:function(t){this.updateForReportFail(t),this.updateToStorage()}},{key:"updateActionsForReporting",value:function(t){this.updateForReporting(t),this.updateToStorage()}},{key:"getReportableActionsLength",value:function(){var t=this.getItems().filter((function(t){var e;return(null==t?void 0:t.inner_status)!==(null==(e=S)?void 0:e.reporting)}));return null==t?void 0:t.length}},{key:"sortQueue",value:function(t,e){var n=this,r={},o=null==t?void 0:t.action_time,i=e.concat([t]),a=function(t){return r[t.action_id]||(r[t.action_id]=n.caculateWeight(o,t)),r[t.action_id]};return i.sort((function(t,e){return a(e)-a(t)}))}},{key:"caculateWeight",value:function(t,e){var n,r=0,o=this.formatWeight(t,null==e?void 0:e.action_time),i=o.ogWeight,a=o.sdkWeight,u=o.userWeight;null!=(n=this.ogEvents)&&n.includes(null==e?void 0:e.action_type)&&(r+=i),null!=e&&e.is_sdk_auto_track?r+=a:r+=u;var c=t-(null==e?void 0:e.action_time)+1;return r=c>0?r+1/c:r}},{key:"formatWeight",value:function(t,e){var n=N,r=P,o=L;return t-e>2592e6&&(n/=100,r/=100,o/=100),{ogWeight:n,sdkWeight:r,userWeight:o}}}]),n}();Bt([Lt],Vt.prototype,"getReportableActions",1),Bt([Lt],Vt.prototype,"addAction",1),Bt([Lt],Vt.prototype,"removeActions",1),Bt([Lt],Vt.prototype,"updateActionsForReportFail",1),Bt([Lt],Vt.prototype,"updateActionsForReporting",1),Bt([Lt],Vt.prototype,"getReportableActionsLength",1),Bt([Lt],Vt.prototype,"sortQueue",1),Bt([Lt],Vt.prototype,"caculateWeight",1),Bt([Lt],Vt.prototype,"formatWeight",1);var Kt=function(){function t(){f(this,t),this.events={}}return v(t,[{key:"subscribe",value:function(e,n){t.checkCallback(n),yt(this.events[e])?this.events[e].push(n):this.events[e]=[n]}},{key:"once",value:function(e,n){t.checkCallback(n),this.subscribe(this.onceEventName(e),n)}},{key:"unsubscribe",value:function(e,n){t.checkCallback(n),yt(this.events[e])&&(this.events[e]=this.events[e].filter((function(t){return t!==n}))),yt(this.events[this.onceEventName(e)])&&(this.events[this.onceEventName(e)]=this.events[this.onceEventName(e)].filter((function(t){return t!==n})))}},{key:"publish",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1&&t.ticketInterval!==this.ticketInterval&&(this.ticketInterval=t.ticketInterval,Qt.publish(Z)),t.requestTimeout&&"number"==typeof t.requestTimeout&&t.requestTimeout>5e3&&(this.requestTimeout=t.requestTimeout)}}]),t}(),se=new ce,le=Wt,fe=Jt,de=Ht,ve=zt,pe=function(){var t=!1,e=!1,n=!0,r=!0,o=!0,i=!1;return function(){if(!i){i=!0;var a=tt.getSync(R);if((null==a?void 0:a.bg)===G?t=!0:(null==a?void 0:a.bg)===Q&&(t=!1),(null==a?void 0:a.fg)===G?e=!0:(null==a?void 0:a.fg)===Q&&(e=!1),(null==a?void 0:a.st)===G?n=!0:(null==a?void 0:a.st)===Q&&(n=!1),(null==a?void 0:a.ti)===G?r=!0:(null==a?void 0:a.ti)===Q&&(r=!1),xt.devLog("当前缓存开关 bgOn,fgOn,stOn,tiOn:",t,e,n,r),n&&Qt.publish(le),r){var u=function(){o&&Qt.publish(fe)},c=setInterval(u,1e3*se.getTicketInterval());Qt.subscribe(Z,(function(){c&&clearInterval(c),c=setInterval(u,1e3*se.getTicketInterval())}))}wx.onShow((function(t){if(o=!0,e){var n="";try{(n=JSON.stringify(t)).length>1e4&&(n=JSON.stringify({cut:1,scene:t.scene}))}catch(t){}Qt.publish(de,{enter_options:n})}})),wx.onHide((function(){o=!1,t&&Qt.publish(ve)}))}}}(),he="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ye(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _e,ge=ye((function(){var t,e=null;function n(t){return!!t&&("object"==l(t)||"function"==typeof t)}function r(t){if(null!==t&&!n(t))throw new TypeError("Object prototype may only be an Object or null: "+t)}var o=Object,i=!(!o.create&&{__proto__:null}instanceof o),a=o.create||(i?function(t){return r(t),{__proto__:t}}:function(t){if(r(t),null===t)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var e=function(){};return e.prototype=t,new e}),u=function(){return null},c=o.getPrototypeOf||([].__proto__===Array.prototype?function(t){var e=t.__proto__;return n(e)?e:null}:u);return t=function(s,l){if(void 0===(this&&this instanceof t?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!n(s)||!n(l))throw new TypeError("Cannot create proxy with a non-object as target or handler");var f=function(){};e=function(){s=null,f=function(t){throw new TypeError("Cannot perform '".concat(t,"' on a proxy that has been revoked"))}},setTimeout((function(){e=null}),0);var d=l;for(var v in l={get:null,set:null,apply:null,construct:null},d){if(!(v in l))throw new TypeError("Proxy polyfill does not support trap '".concat(v,"'"));l[v]=d[v]}"function"==typeof d&&(l.apply=d.apply.bind(d));var p,h=c(s),y=!1,_=!1;"function"==typeof s?(p=function(){var t=this&&this.constructor===p,e=Array.prototype.slice.call(arguments);return f(t?"construct":"apply"),t&&l.construct?l.construct.call(this,s,e):!t&&l.apply?l.apply(s,this,e):t?(e.unshift(s),new(s.bind.apply(s,e))):s.apply(this,e)},y=!0):s instanceof Array?(p=[],_=!0):p=i||null!==h?a(h):{};var g=l.get?function(t){return f("get"),l.get(this,t,p)}:function(t){return f("get"),this[t]},m=l.set?function(t,e){f("set"),l.set(this,t,e,p)}:function(t,e){f("set"),this[t]=e},A=o.getOwnPropertyNames(s),R={};A.forEach((function(t){if(!y&&!_||!(t in p)){var e={enumerable:!!o.getOwnPropertyDescriptor(s,t).enumerable,get:g.bind(s,t),set:m.bind(s,t)};o.defineProperty(p,t,e),R[t]=!0}}));var k=!0;if(y||_){var T=o.setPrototypeOf||([].__proto__===Array.prototype?function(t,e){return r(e),t.__proto__=e,t}:u);h&&T(p,h)||(k=!1)}if(l.get||!k)for(var S in s)R[S]||o.defineProperty(p,S,{get:g.bind(s,S)});return o.seal(s),o.seal(p),p},t.revocable=function(n,r){return{proxy:new t(n,r),revoke:e}},t})),me={};try{_e||(_e=ge())}catch(h){Se(h)}function Ae(t,n,r,o){try{if(!_e||null==t||!t[n])return;t[n]=new _e(t[n],{apply:function(t,n,i){var a,u;o&&Te((function(){return o.apply(void 0,e(i))}));var c=!!(null!=(a=i[0])&&a.success||null!=(u=i[0])&&u.fail);c&&["success","fail"].forEach((function(t){if(i[0][t])try{i[0][t]=new _e(i[0][t],{apply:function(n,o,a){return Te((function(){return r.apply(void 0,[t,i[0]].concat(e(a)))})),n.apply(o,a)}})}catch(t){Se(t)}}));var s=t.apply(n,i);return!c&&s&&"[object Promise]"===Object.prototype.toString.call(s)?s.then((function(t){return Te((function(){return r("success",i[0],t)})),t})).catch((function(t){throw Te((function(){return r("fail",i[0],t)})),t})):s}})}catch(t){Se(t)}}function Re(t,n,r){try{if(!_e||null==t||!t[n])return;t[n]=new _e(t[n],{apply:function(t,n,o){var i="function"==typeof o[0];if(i)try{o[0]=new _e(o[0],{apply:function(t,n,o){var i=t.call.apply(t,[n].concat(e(o)));return Te((function(){return r(i)})),i}})}catch(t){Se(t)}var a=t.call.apply(t,[n].concat(e(o)));return i||Te((function(){return r(a)})),a}})}catch(t){Se(t)}}function ke(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4?arguments[4]:void 0;try{if(!_e||null==t||!t[n])return;t[n]=new _e(t[n],{apply:function(t,a,u){var c=t.call.apply(t,[a].concat(e(u)));return(!r||!me[n])&&(Te((function(){return null==i?void 0:i(c)})),o.forEach((function(t){var e=t.eventName,n=t.isAsync,r=t.proxyEvent;n?Ae(c,e,r):Re(c,e,r)}))),r&&(me[n]=!0),c}})}catch(t){Se(t)}}function Te(t){try{t()}catch(t){Se(t)}}function Se(t){ct({log_type:b.PROXY_ERROR,message:null==t?void 0:t.message,err_stack:null==t?void 0:t.stack})}var Ee=$t,be=ie,Oe=Xt,Ie=Zt,we=te,Ce=ne,xe=oe,Ne=re,Le=function(){var t=!1;return function(){t||(t=!0,Ae(wx,"login",(function(t){"success"===t&&Qt.publish(Ee)})),Re(wx,"onAddToFavorites",(function(){Qt.publish(be)})),Re(wx,"onShareTimeline",(function(){Qt.publish(Oe,{target:"TIME_LINE",trigger:"MENU"})})),Re(wx,"onShareAppMessage",(function(){Qt.publish(Oe,{target:"APP_MESSAGE",trigger:"MENU"})})),Re(wx,"shareAppMessage",(function(){Qt.publish(Oe,{target:"APP_MESSAGE",trigger:"BUTTON"})})),ke(wx,"createGameClubButton",!1,[{isAsync:!1,eventName:"onTap",proxyEvent:function(){Qt.publish(Ie)}}],(function(){Qt.publish(we)})),ke(wx,"getGameServerManager",!0,[{isAsync:!0,eventName:"createRoom",proxyEvent:function(t){"success"===t&&Qt.publish("CREATE_GAME_ROOM")}},{isAsync:!0,eventName:"joinRoom",proxyEvent:function(t){"success"===t&&Qt.publish(Ce)}}]),Ae(wx,"requestMidasPayment",(function(t,e){Qt.publish(Ne,{status:"success"===t?"SUCCESS":"FAIL",quantity:(null==e?void 0:e.buyQuantity)||0,mode:(null==e?void 0:e.mode)||"",platform:(null==e?void 0:e.platform)||"",no:(null==e?void 0:e.outTradeNo)||"",payType:"Midas"})}),(function(t){Qt.publish(xe,{quantity:(null==t?void 0:t.buyQuantity)||0,mode:(null==t?void 0:t.mode)||"",platform:(null==t?void 0:t.platform)||"",no:(null==t?void 0:t.outTradeNo)||"",payType:"Midas"})})),Ae(wx,"requestMidasPaymentGameItem",(function(t,e){var n=(e||{}).signData;Qt.publish(Ne,{status:"success"===t?"SUCCESS":"FAIL",quantity:(null==n?void 0:n.buyQuantity)||0,mode:(null==n?void 0:n.mode)||"",platform:(null==n?void 0:n.platform)||"",no:(null==n?void 0:n.outTradeNo)||"",p:(null==n?void 0:n.goodsPrice)||0,productId:(null==n?void 0:n.productId)||"",payType:"MidasGameItem"})}),(function(t){var e=(t||{}).signData;Qt.publish(xe,{quantity:(null==e?void 0:e.buyQuantity)||0,mode:(null==e?void 0:e.mode)||"",platform:(null==e?void 0:e.platform)||"",no:(null==e?void 0:e.outTradeNo)||"",p:(null==e?void 0:e.goodsPrice)||0,productId:(null==e?void 0:e.productId)||"",payType:"MidasGameItem"})})))}}(),Pe=function(){function t(){f(this,t)}return v(t,null,[{key:"isEmpty",value:function(t){return!t||""===t.trim()}},{key:"format",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r>16)+(e>>16)+(n>>16)<<16|65535&n}function r(t,e,r,o,i,a){return n(function(t,e){return t<>>32-e}(n(n(e,t),n(o,a)),i),r)}function o(t,e,n,o,i,a,u){return r(e&n|~e&o,t,e,i,a,u)}function i(t,e,n,o,i,a,u){return r(e&o|n&~o,t,e,i,a,u)}function a(t,e,n,o,i,a,u){return r(e^n^o,t,e,i,a,u)}function u(t,e,n,o,i,a,u){return r(n^(e|~o),t,e,i,a,u)}function c(t,e){t[e>>5]|=128<>>9<<4)]=e;var r,c,s,l,f,d=1732584193,v=-271733879,p=-1732584194,h=271733878;for(r=0;r>5]>>>e%32&255);return n}function l(t){var e,n=[];for(n[(t.length>>2)-1]=void 0,e=0;e>5]|=(255&t.charCodeAt(e/8))<>>4&15)+r.charAt(15&e);return o}function d(t){return unescape(encodeURIComponent(t))}function v(t){return function(t){return s(c(l(t),8*t.length))}(d(t))}function p(t,e){return function(t,e){var n,r,o=l(t),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=c(o,8*t.length)),n=0;n<16;n+=1)i[n]=909522486^o[n],a[n]=1549556828^o[n];return r=c(i.concat(l(e)),512+8*e.length),s(c(a.concat(r),640))}(d(t),d(e))}function h(t,e,n){return e?n?p(e,t):function(t,e){return f(p(t,e))}(e,t):n?v(t):function(t){return f(v(t))}(t)}t.exports?t.exports=h:e.md5=h}(he)}(je);var Fe=ye(je.exports),Be="function"==typeof btoa,Ve="function"==typeof Buffer;"function"==typeof TextDecoder&&new TextDecoder;var Ke,Ge="function"==typeof TextEncoder?new TextEncoder:void 0,Qe=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");Ke={},Qe.forEach((function(t,e){return Ke[t]=e}));var Ye=String.fromCharCode.bind(String);"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);var We=Be?function(t){return btoa(t)}:Ve?function(t){return Buffer.from(t,"binary").toString("base64")}:function(t){for(var e,n,r,o,i="",a=t.length%3,u=0;u255||(r=t.charCodeAt(u++))>255||(o=t.charCodeAt(u++))>255)throw new TypeError("invalid character found");i+=Qe[(e=n<<16|r<<8|o)>>18&63]+Qe[e>>12&63]+Qe[e>>6&63]+Qe[63&e]}return a?i.slice(0,a-3)+"===".substring(a):i},Je=Ve?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var e=[],n=0,r=t.length;n>>6)+Ye(128|63&e):Ye(224|e>>>12&15)+Ye(128|e>>>6&63)+Ye(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return Ye(240|e>>>18&7)+Ye(128|e>>>12&63)+Ye(128|e>>>6&63)+Ye(128|63&e)},ze=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,$e=Ve?function(t){return Buffer.from(t,"utf8").toString("base64")}:Ge?function(t){return Je(Ge.encode(t))}:function(t){return We(function(t){return t.replace(ze,He)}(t))};var Xe=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,tn=function(t,e,n,r){for(var o,i=r>1?void 0:r?Ze(e,n):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,n,i):o(i))||i);return r&&i&&Xe(e,n,i),i},en=function(){function t(e){var n=this;f(this,t),this.cgiBatchSize=E.cgiBatchSize,this.reportThreshold=E.reportThreshold,this.reportDelay=E.reportDelay,this.triggerExecuteSend=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[];return function(){for(var o=arguments.length,i=new Array(o),a=0;a=this.reportThreshold)this.executeSend();else{var n=(null==(t=this.configManager)?void 0:t.getRealTimeActionList())||E.realTimeActionList;e.some((function(t){return n.indexOf(t.action_type)>-1&&!t.is_retry}))?this.executeSend():this.triggerExecuteSend()}this.startInspectTimer()}},{key:"flushSend",value:function(){this.executeSend()}},{key:"executeSend",value:function(){var e=this;if(t.currentRequestCount>=t.requestConcurrency)this.isNeedContinueSend=!0;else{this.isNeedContinueSend=!1;var n=(t.requestConcurrency-t.currentRequestCount)*this.cgiBatchSize,r=this.queueManager.getReportableActions(n),o=this.getBaseInfo();if(!o.openid&&!o.unionid&&(xt.warn("请尽快调用 setOpenId 或 setUnionId 方法设置用户ID!"),r=r.filter((function(t){return null==t?void 0:t.ad_trace_id}))),!(r.length<=0)){n=0}));e.isNeedContinueSend&&n&&e.executeSend()})).catch((function(t){xt.error(t),e.reportLog({message:"executeSend catch: ".concat(t.message),log_type:b.JS_RUN_ERROR,err_stack:t.stack})}))}}}},{key:"generateActionReportParams",value:function(t){var e=[],n=[],r=this.getBaseInfo();return t.forEach((function(t){n.push(t.action_id);var r=Object.assign({},t);delete r.inner_status,e.push(r)})),{data:{info:r,actions:e},actionIdList:n}}},{key:"dealSuccessData",value:function(t,e){[51001,51003].indexOf(null==t?void 0:t.code)>-1?this.queueManager.updateActionsForReportFail(e):this.queueManager.removeActions(e),0!==(null==t?void 0:t.code)&&(this.reportLog({log_type:b.REQUEST_ERROR,code:null==t?void 0:t.code,message:"trace_id: ".concat(null==t?void 0:t.trace_id,",msg: ").concat(null==t?void 0:t.message)}),xt.error("上报失败:",t))}},{key:"dealFailData",value:function(t,e){this.queueManager.updateActionsForReportFail(e),this.reportLog({log_type:b.REQUEST_ERROR,code:t.code,message:t.message}),xt.error("上报失败:",t)}},{key:"report",value:function(e){var n=this,r=e.data,o=e.actionIdList;return this.queueManager.updateActionsForReporting(o),xt.debug&&(xt.info("上报行为类型: ","【".concat(r.actions.map((function(t){return t.action_type})).join("、"),"】")),xt.info("上报请求参数: ",r)),new Promise((function(e){var i,a,u,c,s,f,d,v,p=Date.now();try{var h=function(t){var e="",n=null==t?void 0:t.appid,r=null==t?void 0:t.secret_key,o=null==t?void 0:t.sdk_version,i=null==t?void 0:t.timestamp;if(!(n&&r&&o&&i&&32===r.length))return e;for(var a=Fe(o+n+i),u=0;u<32;u++)e+=u%2==0?r[u]:a[u];return e}({appid:null==(i=null==r?void 0:r.info)?void 0:i.appid,secret_key:null==(a=null==r?void 0:r.info)?void 0:a.secret_key,sdk_version:null==(u=null==r?void 0:r.info)?void 0:u.sdk_version,timestamp:p}),y=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))}($e(t)):$e(t)}(JSON.stringify(r));d={"Client-Time":p,"Sign-Value":Fe(y+(null==(c=null==r?void 0:r.info)?void 0:c.user_action_set_id)+(null==(s=null==r?void 0:r.info)?void 0:s.secret_key)+h),"Sign-Version":E.signVersion,"content-type":"text/plain;charset=UTF-8"},v=y}catch(h){d={"Client-Time":p},v=r,n.reportLog({log_type:b.SIGN_ERROR,message:"sign error msg: ".concat(null==h?void 0:h.message),err_stack:null==h?void 0:h.stack}),xt.error(h)}wx.request({url:"https://api.datanexus.qq.com/data-nexus-cgi/miniprogram",method:"POST",timeout:(null==(f=n.configManager)?void 0:f.getRequestTimeout())||E.requestTimeout,header:d,data:v,success:function(r){var i,a;xt.devLog("上报接口返回码:",null==(i=null==r?void 0:r.data)?void 0:i.code);var u=(null==(a=null==r?void 0:r.header)?void 0:a["Server-Time"])||-1;if(st.revise(u),t.currentRequestCount-=1,200===(null==r?void 0:r.statusCode))return n.dealSuccessData(null==r?void 0:r.data,o),void e((null==r?void 0:r.data).code);var c="";try{c="object"==l(null==r?void 0:r.data)?JSON.stringify(null==r?void 0:r.data):null==r?void 0:r.data}catch(t){xt.error(t)}var s={code:"number"==typeof(null==r?void 0:r.statusCode)?-1*r.statusCode:-888,message:"statusCode: ".concat(null==r?void 0:r.statusCode,", data: ").concat(c)};n.dealFailData(s,o),e(s.code)},fail:function(r){xt.devLog("上报失败:",r),t.currentRequestCount-=1;var i={code:"number"==typeof(null==r?void 0:r.errno)?-1*r.errno:-999,message:null==r?void 0:r.errMsg};n.dealFailData(i,o),e(i.code)}})}))}},{key:"startInspectTimer",value:function(){var e=this;clearTimeout(this.inspectTimer),this.inspectTimer=setTimeout((function(){t.currentRequestCount>=t.requestConcurrency&&(t.currentRequestCount=t.requestConcurrency-1),e.executeSend(),e.startInspectTimer()}),1e3*this.inspectDelay)}}],[{key:"setRequestConcurrency",value:function(e){"number"==typeof e?e<1?xt.error("网络请求最大并发量不能小于1"):e>10?xt.error("网络请求最大并发量不能大于10"):t.requestConcurrency=e:xt.error("网络请求最大并发量需设置为数字")}}]),t}(),nn=en;nn.currentRequestCount=0,nn.requestConcurrency=E.requestConcurrency,tn([Lt],nn.prototype,"batchSend",1),tn([Lt],nn.prototype,"flushSend",1),tn([Lt],nn.prototype,"executeSend",1);var rn=Wt,on=Jt,an=Ht,un=zt,cn=$t,sn=ie,ln=Xt,fn=Zt,dn=te,vn=ne,pn=oe,hn=re,yn=ee,_n=function(){function e(){f(this,e)}return v(e,[{key:"install",value:function(e,n){var r=function(n){Qt.subscribe(n,function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.track(n,Object.assign(r||{},i,t(t({},wn,!0),Cn,o)))}}(n))};r(on),r(rn),r(an),r(un),"all"===n&&(r(cn),r(sn),r(ln),r(dn),r(fn),r(yn),r(vn),r(pn),r(hn))}}]),e}(),gn=function(){function e(){f(this,e),this.special_method_symbol=Symbol("special_method_symbol")}return v(e,[{key:"onPurchase",value:function(t){"number"!=typeof t&&xt.warn("付费金额需要为数字"),t<=0&&xt.warn("付费金额需要大于0"),this.wrapTrack(j,{value:t})}},{key:"onEnterForeground",value:function(){this.wrapTrack(D)}},{key:"onEnterBackground",value:function(){this.wrapTrack(U)}},{key:"onAppStart",value:function(){this.wrapTrack(M)}},{key:"onAppQuit",value:function(){this.wrapTrack(F)}},{key:"onAddToWishlist",value:function(){this.wrapTrack(q)}},{key:"wrapTrack",value:function(e,n){this.track(e,Object.assign(n||{},t({},this.special_method_symbol,1)))}}]),e}(),mn=function(t){o(n,gn);var e=a(n);function n(){return f(this,n),e.apply(this,arguments)}return v(n,[{key:"onRegister",value:function(){this.wrapTrack(B)}},{key:"onCreateRole",value:function(t){t&&"string"!=typeof t&&xt.warn("角色名称需要为字符串"),this.wrapTrack(V,t?{name:t}:{})}},{key:"onTutorialFinish",value:function(){this.wrapTrack(K)}}]),n}(),An="(如果确认无误,请忽略该提示)",Rn=function(){var t=[];return{requestActionList:function(){try{lt({conf_name:"data_nexus_common",conf_key:"action_types"}).then((function(e){yt(e)&&(t=e)}))}catch(t){xt.error(t)}},getActionList:function(){return t}}}();function kn(t,e){try{t.is_sdk_auto_track||(function(t){try{var e=Rn.getActionList();if(!e.includes(t)){var r,o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;if(Tn(i,t)<=parseInt((.3*i.length).toString())){xt.warn("通过SDK上报的".concat(t,"行为名称可能有误,请检查该行为类型是否为腾讯广告提供的标准行为!").concat(An));break}}}catch(t){o.e(t)}finally{o.f()}}}catch(e){xt.error(e)}}(t.action_type),"minigame"===e?function(t,e){var n,r,o;try{["PURCHASE","ADD_TO_CART"].includes(t.action_type)&&t.action_param&&It(t.action_param,"value")&&("number"!=typeof(null==(n=t.action_param)?void 0:n.value)?xt.warn("通过SDK上报的".concat(t.action_type,"行为携带的金额参数需要为数字!")):(null==(r=t.action_param)?void 0:r.value)<=0?xt.warn("通过SDK上报的".concat(t.action_type,"行为携带的金额参数需要大于0!")):"minigame"===e&&(null==(o=t.action_param)?void 0:o.value)<100&&xt.warn("通过SDK上报的".concat(t.action_type,"行为携带的金额参数可能有误,金额的单位为‘分’,请检查金额是否正确!").concat(An)))}catch(t){xt.error(t)}}(t,e):"miniprogram"===e&&function(t){try{var e=null==t?void 0:t.action_type,n=(null==t?void 0:t.action_param)||{};"PURCHASE"===e&&It(n,"value")&&("number"!=typeof(null==n?void 0:n.value)?xt.warn("通过SDK上报的".concat(e,"行为携带的金额参数需要为数字!")):(null==n?void 0:n.value)<=0&&xt.warn("通过SDK上报的".concat(e,"行为携带的金额参数需要大于0!")))}catch(e){xt.error(e)}}(t))}catch(t){xt.error(t)}}function Tn(t,e){try{if(0===t.length)return e.length;if(0===e.length)return t.length;for(var n=[],r=0;r<=e.length;r++)n[r]=[r];for(var o=0;o<=t.length;o++)n[0][o]=o;for(var i=1;i<=e.length;i++)for(var a=1;a<=t.length;a++)e.charAt(i-1)===t.charAt(a-1)?n[i][a]=n[i-1][a-1]:n[i][a]=Math.min(n[i-1][a-1]+1,n[i][a-1]+1,n[i-1][a]+1);return n[e.length][t.length]}catch(n){xt.error(n)}}function Sn(t){try{t&&!/^[a-zA-Z0-9_\-]+$/.test(t)&&xt.warn("通过SDK上报的openid:".concat(t,"可能有误,请检查openid是否正确!").concat(An))}catch(t){xt.error(t)}}var En=Object.defineProperty,bn=Object.getOwnPropertyDescriptor,On=function(t,e,n,r){for(var o,i=r>1?void 0:r?bn(e,n):e,a=t.length-1;a>=0;a--)(o=t[a])&&(i=(r?o(e,n,i):o(i))||i);return r&&i&&En(e,n,i),i},In=Symbol("initializedInstance"),wn=Symbol("autoTrack"),Cn=Symbol("actionTime"),xn=function(e){o(r,mn);var n=a(r);function r(t){var e;if(f(this,r),(e=n.call(this)).env="production",e.sdk_version="1.5.4",e.sdk_name="@dn-sdk/minigame",e.deviceInfo={},e.gameInfo={},e.session_id="",e.log_id=0,e.inited=!1,null==wx||!wx.createCanvas)return xt.error("SDK只可以用在微信小游戏中使用"),u(e);var o=Ot();if(r[In].length>=o.maxSdkInstance)return xt.error("初始化超过上限"),u(e);var i=Et(t),a=at();if(!0!==i)return xt.error(i),u(e);var s=null==a?void 0:a.appId;if(s&&s!==t.appid)return xt.error("初始化失败,传入的appid与当前小游戏appid不一致"),u(e);e.config=t,It(t,"auto_track")||(e.config.auto_track=bt("autoTrack")),e.openid=t.openid,e.unionid=t.unionid,e.user_unique_id=t.user_unique_id,e.saveValidOpenidToStorage();var l=t.user_action_set_id;return r[In].includes(l)?(xt.error("请勿重复初始化SDK"),u(e)):(e.reportLog=e.reportLog.bind(c(e)),e.getTrackBaseInfo=e.getTrackBaseInfo.bind(c(e)),e.deviceInfo=nt(),e.gameInfo=Nt(),e.session_id=mt(),e.queueManage=new Vt({userActionSetId:l,maxLength:o.maxQueueLength,ogEvents:Yt}),e.actionReporter=new nn({getBaseInfo:e.getTrackBaseInfo,reportLog:e.reportLog,queueManager:e.queueManage,configManager:se}),e.inited=!0,r[In].push(l),e.useAutoTrack(),e.doReportOnEnterBackground(),"release"===(null==a?void 0:a.envVersion)?(xt.info("初始化成功"),u(e)):(function(t){var e=t.conf_name,n=t.conf_key,r=t.sdk_version,o=t.default_download_url,i=t.fail_handler;lt({conf_name:e,conf_key:n}).then((function(t){if(ht(t)){var e=null==t?void 0:t.blackVersions,n=null==t?void 0:t.minVersion,a=null==t?void 0:t.bestVersion,u=null==t?void 0:t.downloadUrl,c=o;return u&&/^https/.test(u)&&(c=u),yt(e)&&(null==e?void 0:e.indexOf(r))>-1?(null==i||i(),void xt.error("初始化失败!当前SDK版本存在兼容问题,请尽快升级至最新版!下载地址:".concat(c))):n&&St(r,n)<0?(null==i||i(),void xt.error("初始化失败!当前SDK版本过低,请尽快升级至最新版!下载地址:".concat(c))):(a&&St(r,a)<0&&xt.warn("新版本SDK已上线,强烈建议您升级至最新版,尽早享受新特性!下载地址:".concat(c)),void xt.info("初始化成功"))}xt.info("初始化成功")})).catch((function(){xt.info("初始化成功")}))}({conf_name:"mini_game_sdk_common",conf_key:"version",sdk_version:e.sdk_version,default_download_url:"https://sr-home-1257214331.cos.ap-guangzhou.myqcloud.com/sdk/dn-sdk-minigame/dn-sdk-minigame.zip",fail_handler:function(){e.inited=!1}}),Rn.requestActionList(),Sn(t.openid),u(e)))}return v(r,[{key:"track",value:function(t,e){var n,r,o,i=qe.validateActionType(t),a=qe.validateActionParam(e);if(i&&a){!this.openid&&!this.unionid&&xt.warn("缺少 openid 或 unionid");var u=bt("actionParamMaxLength");if(JSON.stringify(e||{}).length>u)return void xt.error("监测到超过".concat(u,"的上报日志:").concat(t," ").concat(e));var c=!(null==e||!e[wn]),s=this.createAction(t,e||{},c);"release"!==(null==(n=at())?void 0:n.envVersion)&&kn(s,"minigame"),null==(r=this.queueManage)||r.addAction(s),null==(o=this.actionReporter)||o.batchSend()}}},{key:"flush",value:function(){var t;null==(t=this.actionReporter)||t.flushSend()}},{key:"setOpenId",value:function(t){var e;t&&"string"==typeof t?(this.openid=t,this.gameInfo.ad_trace_id&&!tt.getSync(T)&&Qt.publish("START_APP"),this.flush(),this.saveValidOpenidToStorage(),"release"!==(null==(e=at())?void 0:e.envVersion)&&Sn(t)):xt.error("openid 格式错误")}},{key:"setUnionId",value:function(t){t&&"string"==typeof t?(this.unionid=t,this.flush()):xt.error("unionid 格式错误")}},{key:"setUserUniqueId",value:function(t){t&&"string"==typeof t?this.user_unique_id=t:xt.error("user_unique_id 格式错误")}},{key:"doReportOnEnterBackground",value:function(){var t=this;wx.onHide((function(){var e,n;null==(e=t.actionReporter)||e.flushSend(),null==(n=t.queueManage)||n.reportLostNum()}))}},{key:"getTrackBaseInfo",value:function(){var t=at();return Object.assign({},this.deviceInfo,function(t,e){var n={};return e.forEach((function(e){It(t,e)&&(n[e]=t[e])})),n}(this.config,["user_action_set_id","appid","openid","secret_key","user_unique_id","unionid"]),{local_id:rt(),sdk_name:this.sdk_name,sdk_version:this.sdk_version,openid:this.openid||it(),unionid:this.unionid,user_unique_id:this.user_unique_id,inner_param:{app_env_version:t.envVersion,app_version:t.version}})}},{key:"createAction",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null!=e&&e[wn]&&delete e[wn];var r=Date.now();null!=e&&e[Cn]&&(r=null==e?void 0:e[Cn],delete e[Cn]);var o={action_id:mt(),action_param:e,action_time:r,action_type:t,is_retry:!1,is_sdk_auto_track:n,retry_count:0,revised_action_time:st.getRevisedcurrentTimeMillis(),log_id:++this.log_id,session_id:this.session_id,pkg_channel_id:this.gameInfo.pkg_channel_id,source_scene:this.gameInfo.source_scene,network_type:ot(),ad_trace_id:this.gameInfo.ad_trace_id,channel:this.getChannelByActionType(t)};return null!=e&&e[this.special_method_symbol]&&(this.addActionInnerParam(o,"is_special_method",!0),delete e[this.special_method_symbol]),se.getChannelClaimActionList().indexOf(t)>-1&&this.gameInfo.launch_options&&this.addActionInnerParam(o,"launch_options",this.gameInfo.launch_options),o}},{key:"addActionInnerParam",value:function(e,n,r){e.inner_param&&ht(e.inner_param)?e.inner_param[n]=r:e.inner_param=t({},n,r)}},{key:"getChannelByActionType",value:function(t){var e="";return se.getChannelClaimActionList().indexOf(t)>-1?e=this.gameInfo.channel||"":se.getNoClaimActionList().indexOf(t)>-1&&(e=X),e}},{key:"reportLog",value:function(t){var e,n,r={user_action_set_id:null==(e=this.config)?void 0:e.user_action_set_id,appid:null==(n=this.config)?void 0:n.appid,session_id:this.session_id};ct(Object.assign(r,t))}},{key:"useAutoTrack",value:function(){var t;if(null!=(t=this.config)&&t.auto_track){var e=!0,n=tt.getSync(R);(null==n?void 0:n.ap)===G?e=!0:(null==n?void 0:n.ap)===Q&&(e=!1),"devtools"===nt().wx_platform&&(e=!0),(new _n).install(this,e?"all":"lifecycle"),pe(),e&&Le(),this.getAutoProxyRemoteConfig()}}},{key:"getAutoProxyRemoteConfig",value:function(){var t,e,n=nt();n.os&&n.os_version&&null!=(t=this.config)&&t.user_action_set_id&&function(t){return new Promise((function(e){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/minigame/get",data:t,timeout:E.requestTimeout,success:function(t){ft(t,e,"minigame/get"),vt(t)},fail:function(t){dt(t,"minigame/get")}})}))}({conf_name:"MG",conf_param:{user_action_set_id:null==(e=this.config)?void 0:e.user_action_set_id,sdk_version:this.sdk_version,os_type:(null==n?void 0:n.os)||"",os_version:wt(n.os_version),device_brand:(null==n?void 0:n.device_brand)||"",weixin_lib_version:(null==n?void 0:n.wx_lib_version)||"",weixin_version:(null==n?void 0:n.wx_version)||""}}).then((function(t){ht(t)&&tt.setSync(R,t)}))}},{key:"saveValidOpenidToStorage",value:function(){this.openid&&function(t){return/^[a-zA-Z0-9_-]{28,30}$/.test(t)}(this.openid)&&tt.setSync(T,this.openid)}}],[{key:"setRequestConcurrency",value:function(t){nn.setRequestConcurrency(t)}},{key:"setDebug",value:function(t){xt.debug=t}}]),r}(),Nn=xn;Nn[In]=[],On([Lt,Pt],Nn.prototype,"track",1),On([Lt,Pt],Nn.prototype,"flush",1),On([Lt],Nn.prototype,"setOpenId",1),On([Lt],Nn.prototype,"setUnionId",1),On([Lt],Nn.prototype,"setUserUniqueId",1),On([Lt],Nn.prototype,"doReportOnEnterBackground",1),On([Lt],Nn.prototype,"getTrackBaseInfo",1),On([Lt],Nn.prototype,"useAutoTrack",1);export{Nn as SDK}; diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.js.meta new file mode 100644 index 0000000..2b2645c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/dn-sdk-minigame-1.5.4/index.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 208b4345ee65d4f66968164f0c71bb91 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/tywx.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/tywx.js new file mode 100644 index 0000000..46a8941 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/tywx/tywx.js @@ -0,0 +1,3 @@ +var e={};(function(){var t=!0,n="Default";e.StateInfo={debugMode:!1,errorLogMode:t,adManagerMode:t,shareManagerMode:t,networkConnected:t,networkType:"none",txAdEventReportMode:t,wxShareEnable:t},e.SystemInfo={clientId:"H5_2.0_weixin.weixin.0-hall20055.weixin.qmcar",intClientId:24035,cloudId:8,loginUrl:"https://xyxsf.nalrer.cn/",officialServerUrl:"https://pt57-wxiospay.tuyoo.com",shareManagerUrl:"https://market-share-go.tuyoo.com/",deviceId:"wechatGame",wxAppId:"",appId:20055,gameId:20055,packageName:"com.wx.minigame",biLogServer:"https://cbi.tuyoo.com/api/bilog5/text",gaLogServer:"https://cbi.tuyoo.com/api/bilog5/ga",errorLogServer:"https://clienterr.tuyoo.com/api/bilog5/text/error",deviceLevelServer:"https://clip-dispatcher.ywdier.com",tywxVersion:"1.8.8_20250915_release",openFeatureFilter:!1,wxPayVersion:"1.0"},e.UserInfo={userId:0,userName:"TuWechatGame",userPic:"",authorCode:"",systemType:0,wechatType:n,model:n,system:n,platform:n,language:n,benchmarkLevel:"",modelLevel:"",brand:n,scene_id:"",scene_param:"",invite_id:0,wxgame_session_key:"",signature:"",encryptedData:"",iv:"",wxUserInfo:{},extraParams:{},wxgame_openid:""}})(),e.LOGD=function(t,n){if(!e.StateInfo.debugMode)return;t=t||"tywx";var r=t+" : "+n;console.log(r)},e.LOGE=function(t,n){if(!e.StateInfo.debugMode)return;t=t||"tywx";var r=t+" : "+n;console.error(r)},e.IsWechatPlatform=function(){try{return wx,!0}catch(e){return!1}},function(){function o(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"}function u(e,n){e[n>>5]|=128<>>9<<4)+14]=n;var r=1732584193,i=-271733879,s=-1732584194,o=271733878;for(var u=0;u16&&(r=u(r,e[t]*s));var i=Array(16),o=Array(16);for(var a=0;a<16;a++)i[a]=r[a]^909522486,o[a]=r[a]^1549556828;var f=u(i.concat(m(n)),512+n[t]*s);return u(o.concat(f),640)}function d(e,t){var n=(e&65535)+(t&65535),r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535}function v(e,t){return e<>>32-t}function m(e){var n=Array(),r=(1<>5]|=(e.charCodeAt(i/s)&r)<>5]>>>i%32&r);return n}function y(e){var i=r?"0123456789ABCDEF":"0123456789abcdef",s="";for(var o=0;o>2]>>o%4*8+4&15)+i[n](e[o>>2]>>o%4*8&15);return s}function b(e){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s="";for(var o=0;o>2]>>8*(o%4)&255)<<16|(e[o+1>>2]>>8*((o+1)%4)&255)<<8|e[o+2>>2]>>8*((o+2)%4)&255;for(var a=0;a<4;a++)o*8+a*6>e[t]*32?s+=i:s+=r[n](u>>6*(3-a)&63)}return s}var t="length",n="charAt",r=0,i="",s=8;e.b64=function(e){return b(m(e),e[t]*s)},e.hex_md5=function(e){return y(u(m(e),e[t]*s))},e.b64_md5=function(e){return b(u(m(e),e[t]*s))},e.str_md5=function(e){return g(u(m(e),e[t]*s))},e.hex_hmac_md5=function(e,t){return y(p(e,t))},e.b64_hmac_md5=function(e,t){return b(p(e,t))},e.str_hmac_md5=function(e,t){return g(p(e,t))}}(),e.GAEventType={SDK_LOGIN_START:"sdk_c_login_start",SDK_LOGIN_SUCC:"sdk_c_login_succ",SDK_LOGIN_FAIL:"sdk_c_login_fail",SDK_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_LOGIN_BY_SDKSERVER_START:"sdk_c_login_by_sdkserver_start",SDK_LOGIN_BY_SDKSERVER_SUCC:"sdk_c_login_by_sdkserver_succ",SDK_LOGIN_BY_SDKSERVER_FAIL:"sdk_c_login_by_sdkserver_fail",SDK_PAY_START:"sdk_c_pay_start",SDK_PAY_SUCC:"sdk_c_pay_succ",SDK_PAY_FAIL:"sdk_c_pay_fail",SDK_CHECK_CHANNEL_STATUS_START:"sdk_c_check_channel_status_start",SDK_CHECK_CHANNEL_STATUS_SUCC:"sdk_c_check_channel_status_succ",SDK_CHECK_CHANNEL_STATUS_FAIL:"sdk_c_check_channel_status_fail"},e.EventType={SDK_LOGIN_SUCCESS:"sdk_login_success",SDK_LOGIN_FAIL:"sdk_login_fail",WEIXIN_LOGIN_SUCCESS:"weixin_login_success",WEIXIN_LOGIN_FAIL:"weixin_login_fail",GET_USER_FEATURE_SUCCESS:"GET_USER_FEATURE_SUCCESS",GET_USER_FEATURE_FAIL:"GET_USER_FEATURE_FAIL",GET_SHARE_CONFIG_SUCCESS:"GET_SHARE_CONFIG_SUCCESS",GET_SHARE_CONFIG_FAIL:"GET_SHARE_CONFIG_FAIL",GAME_SHOW:"GAME_SHOW",START_AUTHORIZATION_SUCCESS:"START_AUTHORIZATION_SUCCESS",START_AUTHORIZATION_FAILED:"START_AUTHORIZATION_FAILED",CREATE_PAY_ORDER_SUCCESS:"CREATE_PAY_ORDER_SUCCESS",CREATE_PAY_ORDER_FAIL:"CREATE_PAY_ORDER_FAIL",SDK_WX_PAY_SUCCESS:"SDK_WX_PAY_SUCCESS",SDK_WX_PAY_FAIL:"SDK_WX_PAY_FAIL",SET_WX_SENSITIVE_DATA_SUCCESS:"SET_WX_SENSITIVE_DATA_SUCCESS",SET_WX_SENSITIVE_DATA_FAIL:"SET_WX_SENSITIVE_DATA_FAIL",SET_WX_USER_INFO_SUCCESS:"SET_WX_USER_INFO_SUCCESS",SET_WX_USER_INFO_FAIL:"SET_WX_USER_INFO_FAIL",GET_ADMANAGER_ICON_INFO_SUCCESS:"GET_ADMANAGER_ICON_INFO_SUCCESS",GET_ADMANAGER_NEWICON_INFO_SUCCESS:"GET_ADMANAGER_NEWICON_INFO_SUCCESS"},e.clickStatEventType={clickStatEventTypeUserFrom:99990001,clickStatEventTypeUserShare:99990002,clickStatEventTypeClickFirstAd:99990003,clickStatEventTypeClickShowQRCode:99990004,clickStatEventTypeClickDirectToMiniGameSuccess:99990005,clickStatEventTypeClickDirectToMiniGameFail:99990006,clickStatEventTypeClickAdBtn:99990007,clickStatEventTypeAuthorizationStart:10004,clickStatEventTypeAuthorizationSuccess:10005,clickStatEventTypeAuthorizationFailed:10006},e.loginForWhat={WX_LOGIN_FOR_LOGIN:"WX_LOGIN_FOR_LOGIN",WX_LOGIN_FOR_REFRESH_SESSION:"WX_LOGIN_FOR_REFRESH_SESSION"},e.Util={localUuid:"",CheckPhoneNumber:function(e){var t=/^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])\d{8}$/;return t.test(e)?!0:!1},IsNull:function(e){return e===undefined||e===null||e===""},isSceneQrCode:function(e){var t=[1047,1048,1049];return t.indexOf(e)>-1},createUUID:function(){var e=[],t="0123456789abcdef";for(var n=0;n<36;n++)e[n]=t.substr(Math.floor(Math.random()*16),1);e[14]="4",e[19]=t.substr(e[19]&3|8,1),e[8]=e[13]=e[18]=e[23]="";var r=e.join("");return r},getLocalUUID:function(){var t="localUuid",n="LOCAL_UUID_KEY";return this[t]||(this[t]=e.Util.getItemFromLocalStorage(n,""),this[t]||(this[t]=e.Util.createUUID(),e.Util.setItemToLocalStorage(n,this[t]),e.GALog.innerTrack(e.GALog.GA_TYPE.TRACK,"sdk_c_device_register",{}))),this[t]},getItemFromLocalStorage:function(e,t){try{var n=wx.getStorageSync(e);if(n)return n}catch(r){return t}},setItemToLocalStorage:function(t,n){try{wx.setStorage({key:t,data:n+""})}catch(r){e.LOGE("tywx.Util","setItemToLocalStorage fail")}},getPlatform:function(){var t="platform",n="UserInfo",r="getDeviceInfo",i="getSystemInfoSync";if(!e[n][t]||e[n][t]==""||e[n][t]=="Default")wx[r]?e[n][t]=wx[r]()?wx[r]()[t]:"":e[n][t]=wx[i]()?wx[i]()[t]:"";return e[n][t]},getConfigSignStr:function(t){var n=Object.keys(t).sort(),r="";for(var i=0;i0){var i={url:e.SystemInfo.errorLogServer,header:{"Content-Type":"text/plain"},postData:r},s=function(r){e.ErrorLog.deleteCache(t),e.GALog[n]()};e.LOGD("BILOG","reportErrorLog:"+r),e.HttpUtil.httpLimitPost(e.HttpUtil.httpLimitType.biLimit,i,s,null)}else e.GALog[n]()},saveCache:function(t){var n="errorLocalCacheData";if(e.StateInfo.errorLogMode)return;if(!t)return;this[n]||(this[n]=[]),this[n].indexOf(t)===-1&&this[n].push(t),this[n].length>100&&this[n].shift()},deleteCache:function(t){var n="errorLocalCacheData";if(e.StateInfo.errorLogMode)return;if(!t)return;if(!this[n])return;var r=this[n];t.forEach(function(e){r.indexOf(e)>-1&&r.splice(r.indexOf(e),1)})},reportCacheData:function(){if(e.StateInfo.errorLogMode)return;var t=e.GALog.getCacheWithLimitCount(this.errorLocalCacheData,10);t&&t.length>0&&this.reportErrorLog(t)}},e.BiLog={biLocalCacheData:[],getSystemInfo:function(){var t="SystemInfo",n="0";this.cloud_id=e[t].cloudId,this.rec_type="1",this.rec_id=n,this.receive_time=n,this.user_id=e.UserInfo.userId||n,this.game_id=e[t].gameId,this.client_id=e[t].clientId,this.device_id=e.Util.getLocalUUID(),this.ip_addr="#IP",this.nettype=n,this.phone_maker=n,this.phone_model=e.UserInfo.model,this.phone_carrier=n,this.reserved=n},uploadClickStatLogTimely:function(t){var n="reportCacheData",r=e.GALog.processArray2String(t);if(t&&t.length>0){var i={url:e.SystemInfo.biLogServer,header:{"Content-Type":"text/plain"},postData:r},s=function(r){e.BiLog.deleteCache(t),e.GALog[n]()};e.LOGD("BILOG","reportBiLog:"+r),e.HttpUtil.httpLimitPost(e.HttpUtil.httpLimitType.biLimit,i,s,null)}else e.GALog[n]()},clickStat:function(t,n){n=n||[];var r=[];if(n.length<10)for(var i=0;i<9;i++)i6e4&&(this._timetag=r,this.nettype=0);var i=t.join(n);this.getSystemInfo();var s=this.cloud_id+n+this.rec_type+n+r+n+this.rec_id+n+this.receive_time+n+e+n+this.user_id+n+this.game_id+n+this.client_id+n+this.device_id+n+this.ip_addr+n+this.nettype+n+this.phone_maker+n+this.phone_model+n+this.phone_carrier+n+i+n+this.reserved,o=this.trimTab0(s);return o},trimTab0:function(e){if(e==null||e==undefined)return"";var t=e.replace(/(\t0)*$/,"");return t},saveCache:function(e){var t="biLocalCacheData";if(!e)return;this[t]||(this[t]=[]),this[t].indexOf(e)===-1&&this[t].push(e),this[t].length>100&&this[t].shift()},deleteCache:function(e){var t="biLocalCacheData";if(!e)return;if(!this[t])return;var n=this[t];e.forEach(function(e){n.indexOf(e)>-1&&n.splice(n.indexOf(e),1)})},reportCacheData:function(){var t=e.GALog.getCacheWithLimitCount(this.biLocalCacheData,10);t&&t.length>0?this.uploadClickStatLogTimely(t):e.ErrorLog.reportCacheData()}},e.GALog={gaLocalCacheData:[],sessionId:"",GA_TYPE:{TRACK:"track",LOGIN:"login",PAY:"pay",GAME:"game",PROFILE:"profile"},GA_BASE_INFO:{PROJECT_ID:"20437",CLIENT_ID:"H5_5.0_tuyoo.tuyoo.0-hall20437.tuyoo.sdkonline",FRAMEWORK:"wxgame",LIB_VERSION:"1.0.1_0704-RELEASE",LIB_TYPE:"JavaScript"},GA_PROFILE_TYPE:{PROFILE_SET:"profile_set",PROFILE_SET_ONCE:"profile_set_once",PROFILE_INCREMENT:"profile_increment",PROFILE_DELETE:"profile_delete",PROFILE_UNSET:"profile_unset"},GA_PROFILE_SUBJECT_TYPE:{USERS:"users",DEVICES:"devices",ROLES:"roles"},addPrefix:function(e){var t="startsWith",n="proj_",r=e;try{if(r!=null&&typeof r=="object")for(var i in r)i!=null&&!i[t]("sdk_")&&!i[t](n)&&(r[n+i]=r[i],delete r[i]);return r}catch(s){return e}},innerTrack:function(t,n,r){var i="SystemInfo",s="sessionId",o={proj_client_id:e[i].clientId,proj_game_id:e[i].gameId,proj_app_id:e[i].appId,proj_cloud_id:e[i].cloudId,sdk_c_framework:this.GA_BASE_INFO.FRAMEWORK,sdk_c_version:e[i].tywxVersion,sdk_pay_type:e[i].wxPayVersion==="1.0"?"wxapp.iap":"wxapp.iap.v2",sdk_session_id:this[s]?this[s]:this[s]=e.Util.createUUID()};r||(r={}),o=Object.assign(o,r),o=this.addPrefix(o),this.assembleGAData(t,n,o,!0)},track:function(e,t){t||(t={}),this.trackWithType(this.GA_TYPE.TRACK,e,t)},trackWithType:function(e,t,n){n||(n={}),n=this.addPrefix(n),this.assembleGAData(e,t,n,!1)},profileTrack:function(e,t,n,r){r||(r={}),this.assembleGAData(this.GA_TYPE.PROFILE,e,r,!1,t,n)},saveCache:function(e){var t="gaLocalCacheData";if(!e)return;this[t]||(this[t]=[]),this[t].indexOf(e)===-1&&this[t].push(e),this[t].length>100&&this[t].shift()},deleteCache:function(e){var t="gaLocalCacheData";if(!e)return;if(!this[t])return;var n=this[t];e.forEach(function(e){n.indexOf(e)>-1&&n.splice(n.indexOf(e),1)})},getCacheWithLimitCount:function(e,t){if(!e)return;var n=[],r=Array.from(e),i=r.length>t?t:r.length;for(var s=0;s0){var i={url:e.SystemInfo.gaLogServer,postData:r,header:{"content-type":"application/x-www-form-urlencoded"}},s=function(r){e.GALog.deleteCache(t),e.GALog[n]()};e.HttpUtil.httpLimitPost(e.HttpUtil.httpLimitType.biLimit,i,s,null)}else this[n]()},reportCacheData:function(){var t=this.getCacheWithLimitCount(this.gaLocalCacheData,10);t&&t.length>0?this.reportGALog(t):e.BiLog.reportCacheData()}},e.HttpUtil={httpLimitType:{biLimit:"BI_LIMIT"},httpLimitState:{},httpLimitPost:function(t,n,r,i){var s="httpLimitState",o=!1,u="statusCode",a="ty.HttpUtil.httpPost",f=this[s].hasOwnProperty(t)&&typeof this[s][t]=="boolean"?this[s][t]:o;if(f){i&&i("limit");return}this[s][t]=!0,wx.request({url:n.url,data:n.postData,header:n.header,method:"POST",dataType:"json",success:function(n){e.HttpUtil[s][t]=o,n[u]==200?(e.LOGD(a,"post success! "),r&&r(n.data)):(e.LOGD(a,"statusCode:"+n[u]),i&&i(n))},fail:function(r){e.HttpUtil[s][t]=o,e.LOGD(a,"post error! "+n.url),i&&i(r)}})},httpPostJson:function(t,n,r){var i="statusCode",s="ty.HttpUtil.httpPost";try{e.IsWechatPlatform()&&wx.request({url:t.url,data:t.postData,header:t.header,method:"POST",dataType:"json",success:function(t){t[i]==200&&t.data?n&&n(t.data):(e.LOGD(s,"statusCode:"+t[i]),r&&r(t))},fail:function(n){e.LOGD(s,"post error! "+t.url),r&&r(n)}})}catch(o){e.LOGE("error:","tywx.HttpUtil.httpPost——"+JSON.stringify(o))}},httpGet:function(t,n,r){var i="ty.HttpUtil.httpGet",s="statusCode";e.IsWechatPlatform()&&(e.LOGD(i,"url:"+t.url),wx.request({url:t.url,method:"GET",success:function(t){t[s]==200?(e.LOGD(i,"get success! "),n&&n(t.data)):e.LOGD(i,"statusCode:"+t[s])},fail:function(n){e.LOGD(i,"post error! "+t.url),r&&r(n)}}))}},e.NotificationCenter={events:{},listen:function(e,t,n){this.events[e]=this.events[e]||[],this.events[e].push({scope:n||this,handler:t})},ignore:function(e,t,n){n=n||this;var r=this.events[e];if(!r)return;this.events[e]=r.filter(function(e){return e.scope!=n||e.handler!=t})},ignoreScope:function(t){for(var n in this.events){var r=this.events[n];r&&(this.events[n]=r.filter(function(r){return r.scope!=t?!0:(e.LOGD("tywx.NotificationCenter","ty.NotificationCenter : remove listener by Scope: "+n),!1)}))}},trigger:function(t,n){e.LOGD("EventTrigger",t);var r=this.events[t];if(!r)return;var i;for(var s=0;s=0,f=t.windowHeight,l=0;return a?f==812?l=2:f==736?l=4:l=1:l=3,e[r].systemType=l,e[r].wechatType=t.version,e[r].model=t.model,e[r].system=t.system,e[r].sdkVersion=t.SDKVersion,e[r][i]=t[i],e[r].language=t.language,e[r][s]=t[s],e[r].brand=t.brand,e[r].extraParams.osName=t[i],t[o]!==undefined&&t[o]!==null&&(e[r][o]=t[o]),n&&n(0,"handleWXSystemInfo done!"),e.LOGD("tywx getSystemInfo result",JSON.stringify(t)),t},getDeviceBenchmarkLevel:function(t){var n="platform",r="UserInfo",i="getDeviceLevelFromServer";if(!e[r][n]||e[r][n]==""||e[r][n]=="Default"){var s=function(n,r){n===0&&e.TuyooSDK[i](t)};this.getSystemInfo(s)}else this[i](t)},getDeviceLevelFromServer:function( +t){var n="SystemInfo",r="toString",i="UserInfo",s="wxapp",o="innerTrack",u="GALog",a="LOGIN",f="GA_TYPE",l="GAEventType",c="stringify",h="data",p="sdk_device_level",d="sdk_error_msg",v="SDK_C_RECEIVE_PERFORMANCE_CLASS_LEVEL_FAIL";try{var m=e[n].deviceLevelServer+"/api/v1/device-level",g={sdk_device_type:"default",app_id:e[n].appId[r](),client_id:e[n].clientId,cloud_id:e[n].cloudId[r](),game_id:e[n].gameId[r](),user_id:e[i].userId[r](),uuid:e.Util.getLocalUUID(),platform:s,os_name:e[i].platform,os_version:e[i].system,sdk_device_level:e[i].modelLevel,sdk_origin_device_level_info:e[i].benchmarkLevel,sdk_device_brand:e[i].brand,sdk_device_model:e[i].model},y={sdk_platform_type:s};e[u][o](e[u][f][a],e[l].SDK_C_RECEIVE_PERFORMANCE_CLASS_LEVEL_START,y),wx.request({url:m,header:{"content-type":"application/json"},data:g,method:"POST",success:function(n){e.LOGD(null,"getDeviceBenchmarkLevel from server success, params:"+JSON[c](n));var r=n[h];r&&r.code===200&&r[h]&&!e.Util.IsNull(r[h][p])?(y[p]=r[h][p],e[u][o](e[u][f][a],e[l].SDK_C_RECEIVE_PERFORMANCE_CLASS_LEVEL_SUCC,y),t&&t(0,r[h][p],r.message)):(y.sdk_error_code=r&&r.code?r.code:"DEFULT_CODE",y[d]=JSON[c](r),e[u][o](e[u][f][a],e[l][v],y),t&&t(-1,"",r.message))},fail:function(n){e.LOGE(null,"getDeviceBenchmarkLevel from server fail, params:"+JSON[c](n)),y[d]=JSON[c](n),e[u][o](e[u][f][a],e[l][v],y),t&&t(-2,"",JSON[c](n))},complete:function(e){}})}catch(b){console.error("error:","tywx.TuyooSDK.getDeviceBenchmarkLevel"+JSON[c](b)),t&&t(1,"",JSON[c](b))}},setWxUserInfo:function(t){var n="UserInfo",r="trigger",i="NotificationCenter",s="EventType",o="SET_WX_USER_INFO_FAIL";if(!e[n].userId){console.error("tywx login error! Please Check!");return}if(!t){console.error("Invalid Param! Please Check Your Param!");return}var u={userId:e[n].userId.toString(),province:t.province||"",nickName:t.nickName||"",avatarUrl:t.avatarUrl||"",gender:t.gender||0,city:t.city||"",country:t.country||"",language:t.language||"",osName:e[n].platform,original_deviceid:e.Util.getLocalUUID()},a=e.SystemInfo.loginUrl;wx.request({url:a+"open/v6/user/setWxUserInfo",header:{"content-type":"application/x-www-form-urlencoded"},data:u,method:"POST",success:function(t){var n=t.data.result;n&&0==n.code?e[i][r](e[s].SET_WX_USER_INFO_SUCCESS):e[i][r](e[s][o])},fail:function(t){e[i][r](e[s][o])},complete:function(e){}})},wechatAuthorize:function(){var t="scope.userInfo",n="clickStat",r="clickStatEventType",i="trigger",s="NotificationCenter",o="START_AUTHORIZATION_SUCCESS",u="EventType";if(!e.IsWechatPlatform())return;wx.getSetting({success:function(a){a.authSetting[t]?e[s][i](e[u][o]):(e.BiLog[n](e[r].clickStatEventTypeAuthorizationStart,[]),wx.authorize({scope:t,success:function(){e.BiLog[n](e[r].clickStatEventTypeAuthorizationSuccess,[]),e[s][i](e[u][o])},fail:function(){e.BiLog[n](e[r].clickStatEventTypeAuthorizationFailed,[]),e[s][i](e[u].START_AUTHORIZATION_FAILED)},complete:function(){}}))}})},wechatAuthorizeForUserInfo:function(t,n,r){var i="clickStat",s="clickStatEventType",o="trigger",u="NotificationCenter",a="EventType",f="START_AUTHORIZATION_SUCCESS",l="getUserInfo",c="userInfo",h="setWxUserInfo",p="wxUserInfo";try{if(!e.IsWechatPlatform())return;wx.getSetting({success:function(d){if(!d.authSetting["scope.userInfo"]){e.BiLog[i](e[s].clickStatEventTypeAuthorizationStart,[]);var v=wx.createUserInfoButton(t),m=function(t){var d=t.errMsg;d.indexOf("fail")!=-1?(e.BiLog[i](e[s].clickStatEventTypeAuthorizationFailed,[]),e[u][o](e[a].START_AUTHORIZATION_FAILED),r&&r()):(e.BiLog[i](e[s].clickStatEventTypeAuthorizationSuccess,[]),e[u][o](e[a][f]),wx[l]({success:function(t){t&&t[c]&&(e.TuyooSDK[h](t[c]),e.UserInfo[p]=t[c])},complete:function(e){n&&n()}}),v.destroy())};v.onTap(m)}else e[u][o](e[a][f]),wx[l]({success:function(t){t&&t[c]&&(e.TuyooSDK[h](t[c]),e.UserInfo[p]=t[c])},complete:function(){n&&n()}})}})}catch(d){e.LOGE("error:","tywx.TuyooSDK.wechatAuthorizeForUserInfo——"+JSON.stringify(d))}},reportServerWxCode:function(t,n){var r="SystemInfo",i="innerTrack",s="GALog",o="LOGIN",u="GA_TYPE",a="GAEventType",f="stringify",l="sdk_error_msg",c="SDK_LOGIN_BY_SDKSERVER_FAIL";try{var h=e[r].loginUrl+"open/v6/user/update/session_key",p={appId:e[r].appId,clientId:e[r].clientId,userId:e.UserInfo.userId,wxAppId:e[r].wxAppId,wxCode:t};n=n||{},e[s][i](e[s][u][o],e[a].SDK_LOGIN_BY_SDKSERVER_START,n),wx.request({url:h,header:{"content-type":"application/x-www-form-urlencoded"},data:p,method:"POST",success:function(t){e.LOGD(null,"reportServerWxCode success, params:"+JSON[f](t));var r=t.data.result;r&&r.code==0?e[s][i](e[s][u][o],e[a].SDK_LOGIN_BY_SDKSERVER_SUCC,n):(n.sdk_error_code=r&&r.code?r.code:"DEFULT_CODE",n[l]=JSON[f](t.data),e[s][i](e[s][u][o],e[a][c],n))},fail:function(t){e.LOGE(null,"reportServerWxCode fail, params:"+JSON[f](t)),n[l]=JSON[f](t),e[s][i](e[s][u][o],e[a][c],n)},complete:function(e){}})}catch(d){console.error("error:","tywx.TuyooSDK.reportServerWxCode——"+JSON[f](d))}}},e.wxOnshowAction=function(t){var n="stringify",r="TxAdSDKReportInterface",i="UserInfo",s="inviteCode",o="sourceCode",u="clickStat",a="BiLog",f="clickStatEventTypeUserFrom",l="clickStatEventType",c="AdManager",h="onForeGround";if(e.IsWechatPlatform()){e.LOGE("","+++++++++++++++++onShow+++++++++++++++++"+JSON[n](t)),e.StateInfo.txAdEventReportMode&&!e[r].isAdSdkInit&&e[r].initChSDK();var p=t.scene,d=t.query;e.showScene=p,e.showQuery=d,e[i].scene_id=p,e[i].invite_id=d[s]||0,e.NotificationCenter.trigger(e.EventType.GAME_SHOW,t);var v="";d&&d[o]?(p==1088?e[a][u](e[l][f],[p,d[s],d[o],d.imageType,d.entryType]):e[a][u](e[l][f],[p,d[s],d[o],d.imageType,"CardActive",d.template_type,d.fun_type]),v=e.b64(JSON[n](d))):e.Util.isSceneQrCode(p)&&t.hasOwnProperty("path")?(v=t.path,v.replace(".html",""),v=decodeURIComponent(v),e[a][u](e[l][f],[p,v])):(v=e.b64(JSON[n](d)),e[a][u](e[l][f],[p,v])),e[i].scene_param=v,e.TuyooSDK.getSystemInfo(null),e.StateInfo.adManagerMode&&e[c]&&e[c][h]&&e[c][h](),e.TuyooSDK.InitSDK()}},e.WechatNetworkInit=function(){var t="hasOwnProperty",n="isConnected",r="networkConnected",i="StateInfo",s="networkType";if(e.IsWechatPlatform()){var o=function(o){o[t](n)?e[i][r]=o[n]:o[t]("errMsg")?e[i][r]=o.errMsg=="getNetworkType:ok":e[i][r]=o[s]!="none",e[i][s]=o[s]};wx.getNetworkType({success:o}),wx.onNetworkStatusChange(o),wx.onError(function(t){var n=new Date,r="userId:"+e.UserInfo.userId+"time:"+n.toDateString()+" "+n.toTimeString()+";"+t.message;e.ErrorLog.uploadLogTimely(r)})}},e.WechatNetworkInit(),e.ShareInterface={OnShareAppMessageInfo:null,OnShareAppMessageCallback:null,onShareAppMessageInit:function(){var t="onShareAppMessage",n="OnShareAppMessageInfo",r="ShareInterface",i="TxAdSDKReportInterface",s="EVENT_TYPE",o="wx_right_top",u="sdk_share_user_id=",a="&extraInfo=",f="&sdk_share_type=",l="shareSchemeId",c="&sdk_share_scheme_id=",h="sharePoint",p="&sdk_share_point_id=",d="sharePicId",v="&sdk_share_template_id=",m="createUUID",g="innerTrack",y="GALog",b="TRACK",w="GA_TYPE",E="sdk_c_share_start",S="shareContent",x="sharePicUrl",T="sdk_c_share_succ",N="OnShareAppMessageCallback",C="sdk_channel_error_msg",k="stringify",L="sdk_c_share_fail",A="onShareTimeline";if(e.IsWechatPlatform()){var O=this;wx[t](function(A){var M=e[r][n]||{};e[i].track(e[i][s].SHARE,{target:"APP_MESSAGE"});var _=o,D=u+e.UserInfo.userId+a+(M.extraInfo||"")+f+_;M[l]&&(D=D+c+M[l]),M[h]&&(D=D+p+M[h]),M[d]&&(D=D+v+M[d]);var P={sdk_share_type:_,sdk_share_scheme_id:M[l]||"",sdk_share_point_id:M[h]||"",sdk_share_template_id:M[d]||"",sdk_event_tips:t,sdk_c_share_track_id:e.Util[m]()};return e[y][g](e[y][w][b],E,P),{title:M[S]||"",imageUrl:M[x]||"",imageUrlId:M[d]||"",query:D,success:function(t,n){e[y][g](e[y][w][b],T,P),O[N]&&O[N](0,{},"")},fail:function(t){P[C]=JSON[k](t),e[y][g](e[y][w][b],L,P),O[N]&&O[N](1,{},JSON[k](t))}}}),wx[A]&&wx[A](function(t){var M=e[r][n]||{};e[i].track(e[i][s].SHARE,{target:"TIME_LINE"});var _=o,D=u+e.UserInfo.userId+a+(M.extraInfo||"")+f+_;M[l]&&(D=D+c+M[l]),M[h]&&(D=D+p+M[h]),M[d]&&(D=D+v+M[d]);var P={sdk_share_type:_,sdk_share_scheme_id:M[l]||"",sdk_share_point_id:M[h]||"",sdk_share_template_id:M[d]||"",sdk_event_tips:A,sdk_c_share_track_id:e.Util[m]()};return e[y][g](e[y][w][b],E,P),{title:M[S]||"",imageUrl:M[x]||"",imageUrlId:M[d]||"",query:D,success:function(t,n){e[y][g](e[y][w][b],T,P),O[N]&&O[N](0,{},"")},fail:function(t){P[C]=JSON[k](t),e[y][g](e[y][w][b],L,P),O[N]&&O[N](1,{},JSON[k](t))}}})}},GetServerShareConfig:function(e,t,n){this.GetServerShareConfigWithTrack(e,t,"",n)},GetServerShareConfigWithTrack:function(t,n,r,i){var s="api.getShareConfig",o="SystemInfo",u="innerTrack",a="GALog",f="TRACK",l="GA_TYPE",c="sdk_error_msg",h="sdk_c_get_share_config_fail",p=t;t=="wx_normal"||t=="wx_right_top"?p="normal":t=="wx_activity_not_chat"?p="not_chat":t=="wx_activity_chat"?p="chat":t=="wx_poster"&&(p="poster");var d;n&&n!=""?d={act:s,time:(new Date).getTime(),share_point:n,game_mark:e[o].cloudId+"-"+e[o].gameId}:d={act:s,time:(new Date).getTime(),game_mark:e[o].cloudId+"-"+e[o].gameId};var v=e.Util.getConfigSignStr(d),m=[];for(var g in d)m.push(g+"="+d[g]);m.push("sign="+v),m.push("share_type="+p),m.push("user_id="+e.UserInfo.userId);var y=e[o].shareManagerUrl+"?"+m.join("&"),b={sdk_share_point_id:n,sdk_share_type:t,sdk_c_share_track_id:r||""};e[a][u](e[a][l][f],"sdk_c_get_share_config_start",b),e.HttpUtil.httpGet({url:y},function(t){t.retcode==0?(e[a][u](e[a][l][f],"sdk_c_get_share_config_succ",b),i&&i(0,t.data,"")):(b.sdk_error_code=t.retcode,b[c]=t.retmsg,e[a][u](e[a][l][f],h,b),i&&i(1,{},t.retmsg))},function(t){b[c]=JSON.stringify(t),e[a][u](e[a][l][f],h,b),i&&i(1,{},JSON.stringify(t))})},setOnShareAppMessageInfo:function(t,n,r){var i="shareContent",s="sharePicUrl",o="shareSchemeId",u="OnShareAppMessageInfo",a="processShareMessage",f="wx_right_top";n=n||{};if(n[i]&&!n[s]||!n[i]&&n[s])n[i]&&delete n[i],n[s]&&delete n[s],n[o]&&delete n[o];if(n[i]&&n[s]||!t)this[u]=n;else{var l=this;e.ShareInterface.GetServerShareConfig(f,t,function(e,r,i){e==0?(r.sharePoint=t,l[u]=l[a](r,n)):l[u]=l[a]({},n)})}this.OnShareAppMessageCallback=r},share:function(t,n,r){var i="shareContent",s="sharePicUrl",o="shareSchemeId",u="shareWXAppMessage";try{if(e.IsWechatPlatform()){n=n||{};if(n[i]&&!n[s]||!n[i]&&n[s])n[i]&&delete n[i],n[s]&&delete n[s],n[o]&&delete n[o];var a="wx_normal",f={sdk_share_type:a,sdk_share_scheme_id:n[o]||"",sdk_share_point_id:t||"",sdk_share_template_id:n.sharePicId||"",sdk_c_share_track_id:e.Util.createUUID()};e.GALog.innerTrack(e.GALog.GA_TYPE.TRACK,"sdk_c_share_start",f);var l=this;n[i]&&n[s]||!t?this[u](a,{},n,f,r):e.ShareInterface.GetServerShareConfigWithTrack(a,t,f.sdk_c_share_track_id,function(e,t,i){l[u](a,t||{},n,f,r)})}else r&&r(1,{},"not wechat platform")}catch(c){e.LOGE("error:","tywx.ShareInterface.share——"+JSON.stringify(c)),r&&r(1,{},JSON.stringify(c))}},posterShare:function(t,n,r){var i="shareWXAppMessage";try{if(e.IsWechatPlatform()){n=n||{};var s="wx_poster",o={sdk_share_type:s,sdk_share_scheme_id:n.shareSchemeId||"",sdk_share_point_id:t||"",sdk_share_template_id:n.sharePicId||"",sdk_c_share_track_id:e.Util.createUUID()};e.GALog.innerTrack(e.GALog.GA_TYPE.TRACK,"sdk_c_share_start",o);if(n.sharePicUrl)this[i](s,{},n,o,r);else{var u=this;e.ShareInterface.GetServerShareConfigWithTrack(s,t,o.sdk_c_share_track_id,function(e,t,a){u[i](s,t||{},n,o,r)})}}else r&&r(1,{},"not wechat platform")}catch(a){e.LOGE("error:","tywx.ShareInterface.posterShare——"+JSON.stringify(a)),r&&r(1,{},JSON.stringify(a))}},activityShare:function(t,n,r){var i="shareContent",s="sharePicUrl",o="shareSchemeId",u="stringify";try{if(e.IsWechatPlatform()){n=n||{};if(n[i]&&!n[s]||!n[i]&&n[s])n[i]&&delete n[i],n[s]&&delete n[s],n[o]&&delete n[o];var a="wx_activity_not_chat",f=this,l={sdk_share_type:a,sdk_share_scheme_id:n[o]||"",sdk_share_point_id:t||"",sdk_share_template_id:n.sharePicId||"",sdk_c_share_track_id:e.Util.createUUID()};e.GALog.innerTrack(e.GALog.GA_TYPE.TRACK,"sdk_c_share_start",l),e.ShareInterface.GetServerShareConfigWithTrack(a,t,l.sdk_c_share_track_id,function(e,t,i){if(e!=0){r&&r(1,{},i);return}wx.updateShareMenu({withShareTicket:!0,isUpdatableMessage:!0,activityId:t.activityId,templateInfo:{parameterList:[{name:"member_count",value:""+n.memberCount},{name:"room_limit",value:""+n.roomLimit}]},success:function(e){f.shareWXAppMessage(a,t,n,l,r)},fail:function(e){r&&r(1,{},JSON[u](e))}})})}else r&&r(1,{},"not wechat platform")}catch(c){e.LOGE("error:","tywx.ShareInterface.activityShare——"+JSON[u](c)),r&&r(1,{},JSON[u](c))}},processShareMessage:function(e,t){var n={};return t?n=Object.assign(e,t):n=e,this.replaceTemplate(n),n},replaceTemplate:function(e){var t="shareContent",n="shareContentParam";if(!e||!e[t]||!e[n])return e;var r=e[t];const i=e[n].split("|");return i.forEach(function(t){const n="{"+t+"}";if(r.includes(n)&&e.hasOwnProperty(t)){const i=String(e[t])||"";r=r.split(n).join(i)}}),e[t]=r,e},shareWXAppMessage:function(t,n,r,i,s){var o="TxAdSDKReportInterface",u="sharePointId",a="shareSchemeId",f="activityId",l="sharePicId",c="innerTrack",h="GALog",p="TRACK",d="GA_TYPE",v="sharePicUrl",m="sdk_c_share_succ",g="sdk_channel_error_msg",y="stringify",b="sdk_c_share_fail",w="showShareImageMenu",E=this.processShareMessage(n,r);e[o].track(e[o].EVENT_TYPE.SHARE,{target:"APP_MESSAGE"});var S="sdk_share_user_id="+e.UserInfo.userId+"&inviteCode="+e.UserInfo.userId+"&extraInfo="+(E.extraInfo||"")+"&sdk_share_type="+t+"&sdk_share_point_id="+(i.sdk_share_point_id||"");E[u]&&(S=S+"&sourceCode="+E[u]),E[a]&&(S=S+"&sdk_share_scheme_id="+E[a]),E[a]&&(S=S+"&imageType="+E[a]),E[f]&&(S=S+"&sdk_share_activity_id="+E[f]),E[l]&&(S=S+"&sdk_share_template_id="+E[l]),E[a]&&(i.sdk_share_scheme_id=E[a]),E[f]&&(i.sdk_share_activity_id=E[f]),e[h][c](e[h][d][p],"sdk_c_share_channel_start",i);if(t=="wx_poster")if(E[v]&&E[v].startsWith("http"))wx.downloadFile({url:E[v],success:function(t){var n={path:t.tempFilePath,needShowEntrance:!0,entrancePath:"?"+S,success:function(t){e[h][c](e[h][d][p],m,i),s&&s(0,{},"")},fail:function(t){i[g]=JSON[y](t),e[h][c](e[h][d][p],b,i),s&&s(1,{},JSON[y](t))}};wx[w](n)},fail:function(t){i[g]=JSON[y](t),e[h][c](e[h][d][p],b,i),s&&s(1,{},JSON[y](t))}});else{var x={path:E[v],needShowEntrance:!0,entrancePath:"?"+S,success:function(t){e[h][c](e[h][d][p],m,i),s&&s(0,{},"")},fail:function(t){i[g]=JSON[y](t),e[h][c](e[h][d][p],b,i),s&&s(1,{},JSON[y](t))}};wx[w](x)}else{var T={title:E.shareContent,imageUrl:E[v],imageUrlId:E[l]||"",query:S,success:function(t){var n={};E[f]&&(n[f]=E[f]),e[h][c](e[h][d][p],m,i),s&&s(0,n,"")},fail:function(t){i[g]=JSON[y](t),e[h][c](e[h][d][p],b,i),s&&s(1,{},JSON[y](t))}};wx.shareAppMessage(T)}}},e.AdManager={retryCrossTimes:3,retryNewAdTimes:3,iconTimer:0,newIconTimer:0,AnimType:{STATIC:1,SHAKE:2,FRAME:3},adNodeList:[],newAdNodeList:[],newAdPointInfoList:[],allAdInfoList:[],allNewAdInfoDict:{},rawAdInfoList:undefined,rawNewAdInfoDict:undefined,showAd:function(t,n){var r="AdManager";if(!e.StateInfo.adManagerMode)return;var i=new e[r].adNodeClass;i.adInfoList=JSON.parse(JSON.stringify(e[r].allAdInfoList)),i.adType=1,i.adTag=n||"",t==undefined&&(t={x:0,y:0}),i.createAdNode(t),e[r].adNodeList.push(i)},showNewAd:function(t,n,r){var i="AdManager",s="allNewAdInfoDict",o="adInfoList";if(!e.StateInfo.adManagerMode)return;var u=new e[i].adNodeClass;if(n==undefined)return;if(typeof n!="string"||e[i][s][n]==undefined){console.error("This PointName Does Not Exist!Please Check!");return}u[o]=JSON.parse(JSON.stringify(e[i][s][n])),e[i].newAdPointInfoList=u[o],u.adType=3,u.adTag=r||"",t==undefined&&(t={x:0,y:0}),u.createAdNode(t),e[i].newAdNodeList.push(u)},getAdNodeList:function(){return this.adNodeList},getNewAdNodeList:function(){return this.newAdNodeList},getAdNodeByTag:function(e){var t="adNodeList";if(!e)return null;for(var n in this[t])if(this[t][n].adTag.toString()==e.toString())return this[t][n];return null},getNewAdNodeByTag:function(e){var t="newAdNodeList";if(!e)return null;for(var n in this[t])if(this[t][n].adTag.toString()==e.toString())return this[t][n];return null},getAdInfoList:function(){return this.allAdInfoList},getNewAdInfoDict:function(){return this.allNewAdInfoDict},adNodeClass:function(){this.adType=0,this.adIconBtn=null,this.currentAdInfo=null,this.currentWebPage=null,this.adInfoList=[],this.adTag=""},adNodeObj:{createAdNode:function(t){var n="adIconBtn";if(!e.StateInfo.adManagerMode)return;this.genRandomFirstAdInfo();if(!this.currentAdInfo)return;if(this[n])this[n].active=!0;else{var r=this;cc.loader.loadRes("prefabs/adNode",function(e,i){var s=cc.instantiate(i),o=t?t:{x:0,y:0};s.position=cc.p(o.x,o.y),r[n]=s,cc.game.addPersistRootNode(s),r.adIconNode();var u=r[n].getChildByName("adButton");u.on("click",function(){r.onClickAdIconBtn()})})}},genRandomFirstAdInfo:function(){var e="adInfoList",t="weight",n=this;if(this[e].length==0)return;var r=[{weight:0,id:"000"}];for(var i in this[e]){var s={weight:parseInt(n[e][i].icon_weight),id:n[e][i].icon_id};r.push(s)}r.sort(function(e,n){return e[t]>n[t]});var o=0;r.forEach(function(e){o+=e[t]});var u=parseInt(Math.random()*1e4)%(o+1),a=0,f=0;for(var i=0;i=u){f=i+1;break}}var l=r[f];this[e].forEach(function(e){e.icon_id==l.id&&(n.currentAdInfo=e)})},genRandomSecondAdInfo:function(){var e="weight",t=this,n=this.currentAdInfo.webpages;if(typeof n=="undefined"||n.length==0)return;var r=[{weight:0,id:"000"}];for(var i in n){var s={weight:parseInt(n[i].webpage_weight),id:n[i].config_id};r.push(s)}r.sort(function(t,n){return t[e]>n[e]});var o=0;r.forEach(function(t){o+=t[e]});var u=parseInt(Math.random()*1e4)%(o+1),a=0,f=0;for(var i=0;i=u){f=i+1;break}}var l=r[f];n.forEach(function(e){e.config_id==l.id&&(t.currentWebPage=e)})},adIconNode:function(){var t="currentAdInfo",n="adIconBtn",r="getChildByName",i="stopAllActions",s="removeComponent",o="Animation",u="AnimType",a="AdManager",f="loader",l="icon_url",c="spriteFrame",h="getComponent",p="SpriteFrame",d="width",v="height",m="setContentSize",g="size",y="rotateBy",b="anim_frame",w="getContent";if(!e.StateInfo.adManagerMode)return;if(!this[t]||!this[n])return;var E=this[t].icon_type,S=this,x=this[n][r]("adIcon"),T=this[n][r]("adButton");x[i](),x[s](cc[o]),x.setRotation(0);switch(E){case e[a][u].STATIC:cc[f].load({url:S[t][l][0]},function(e,t){e||(x[h](cc.Sprite)[c]=new cc[p](t),t&&t[d]&&t[v]&&(x[m](cc[g](t[d],t[v])),T[m](cc[g](t[d],t[v]))))});break;case e[a][u].SHAKE:cc[f].load({url:S[t][l][0]},function(e,t){x[h](cc.Sprite)[c]=new cc[p](t),t&&t[d]&&t[v]&&(x[m](cc[g](t[d],t[v])),T[m](cc[g](t[d],t[v]))),x.anchorX=.5,x.anchorY=.5;var n=cc[y](.06,-20),r=cc[y](.12,40),i=cc[y](.12,-40),s=cc[y](.06,20),o=cc.delayTime(1);x.runAction(cc.repeatForever(cc.sequence(n,cc.repeat(cc.sequence(r,i),2),s,o)))});break;case e[a][u].FRAME:var N=[],C=function(){x[i](),x[s](cc[o]);var e=N[0].getTexture();e&&e[d]&&e[v]&&(x[m](cc[g](e[d],e[v])),T[m](cc[g](e[d],e[v])));var n=S[t].time_interval,r=n&&n>0?1e3/n:10,u=x.addComponent(cc[o]),a=cc.AnimationClip.createWithSpriteFrames(N,r);a.name=b,a.wrapMode=cc.WrapMode.Loop,u.addClip(a),u.play(b)};cc[f].load(S[t][l],function(e,n){if(e)for(var r=0;r0)for(var f=0;f0?parseInt(l):a;break}}e[s][i]&&(clearInterval(e[s][i]),e[s][i]=0),e[s][i]=setInterval(e[s].freshAdIconByTime,a*1e3);var c=10;if(this[o]&&this[o][n]&&this[o][n]>0)for(var f=0;f0?parseInt(l):c;break}}e[s][u]&&(clearInterval(e[s][u]),e[s][u]=0),e[s][u]=setInterval(e[s].freshNewAdIconByTime,c*1e3)}catch(h){console.error("Error: startFreshAdIcon==>"+JSON.stringify(h))}},onForeGround:function(){if(!e.StateInfo.adManagerMode)return;this.freshAdIconByTime(),this.freshNewAdIconByTime(),this.startFreshAdIcon()},getConfigSignStr:function(t){var n=Object.keys(t).sort(),r="";for(var i=0;i0?p[o]():p[s]=3},fail:function(e){p[s]>0?p[o]():p[s]=3}})}catch(d){e.LOGE("error:","tywx.AdManager.requestADInfo——"+JSON.stringify(d))}},requestNewAdInfo:function(){var t="openFeatureFilter",n="SystemInfo",r="userId",i="UserInfo",s="retryNewAdTimes",o="requestNewAdInfo";try{if(!e.IsWechatPlatform())return;if(e[n][t]&&!e[i][r]){console.error("Open feature filter but tywx login error! Please Check! ");return}this[s]--;var u={},a=(new Date).getTime();u.act="api.getCrossConfigNew",u.time=a,u.game_mark=e[n].cloudId+"-"+e[n].gameId,e[n][t]&&e[i][r]&&(u.user_id=e[i][r]);var f=this.getConfigSignStr(u),l=[];for(var c in u)l.push(c+"="+u[c]);l.push("sign="+f);var h=e[n].shareManagerUrl+"?"+l.join("&"),p=this;wx.request({url:h,method:"GET",success:function(e){if(e.statusCode==200){var t=e.data;p.allNewAdInfoDict={},t.retmsg&&(p.rawNewAdInfoDict=t.retmsg,p.processNewIconConfigInfo()),p[s]=3}else p[s]>0?p[o]():p[s]=3},fail:function(e){p[s]>0?p[o]():p[s]=3}})}catch(d){e.LOGE("error:","tywx.AdManager.requestNewADInfo——"+JSON.stringify(d))}},processRawConfigInfo:function(){this.processIconConfigInfo(),this.processNewIconConfigInfo()},processIconConfigInfo:function(){var t="allAdInfoList",n="rawAdInfoList",r="icon_weight",i="UserInfo",s=this;this[t]=[];if(this[n]==undefined)return;this[n].forEach(function(n){if(n[r]==undefined||Math.floor(n[r])<=.1)n[r]=0;var o=!1,u=n.push_uids||[];for(var a=0,f=u.length;ainitdebug:"),e.call(t,o,i,null)}else e.call(t,1005,null,"失败")})},OnInit:function(e,t,o,i){var n=this;console.log("----------tuyoosdk.OnInit-->channel:",e),t.debug&&n.OnInitDebuger(function(e,t,o){console.log(window.location.href,e,t,o)},n),n.TuyooInit(e,t,o,i)},SetDefaultShareInfo:function(e){this.IsNull(this.platform().SetDefaultShareInfo)||this.platform().SetDefaultShareInfo(this,e)},Share:function(e,t){this.IsNull(this.platform().Share)?t&&t.call(this,_.shareCode.fail,null,""+this.type+"不支持分享"):this.platform().Share(this,e,t)},CallMethod:function(e,t,o,i){var n=this.IsNull(t.ChannelType)?this.type:t.ChannelType;if(!this.IsNull(this.platform(n))&&"function"==typeof this.platform(n)[e]){var r=[this,t,o];return this.platform(n)[e].apply(i,r)}o&&o.call(this,_.initCode.fail,null,""+n+"不支持此功能("+e+")")},TuyooInit:function(e,t,o,i){var n=this;n.config=t;var r=(new Date).getTime(),a=function(e,t,a){0===e&&n.bi.ReportGAWithType(n,n.bi.GA_TYPE.TRACK,u.GAEvents.SDK_INIT_ENT,{sdk_init_duration_time:(new Date).getTime()-r});var s=[];for(var l in arguments)s.push(arguments[l]);o.apply(i,s)};if(n.IsNull(t.wxAppId)||(n.wxAppId=t.wxAppId),void 0===t.bi_base_url&&(t.bi_base_url="https://cbi.tuyoo.com/"),n.IsNull(t.pay_version)&&(t.pay_version="hall37"),"hall37"!==t.pay_version&&"hall51"!==t.pay_version)return void o.call(i,_.initCode.fail,null,"pay_version 必须为 hall37|hall51");if(this.IsNull(t.userId)?this.userId=0:this.userId=t.userId,console.log("----------tuyoosdk.OnInit-->config:",t),n.IsNull(t.clientId))if(n.IsNull(this.InitClientId())){if(!t.debug)return void o.call(i,_.initCode.fail,null,"clientId不能为空");t.clientId="Android_4.58_meitu.meitu.0-hall6.meitu.tu"}else t.clientId=this.InitClientId();this.type=e,this.appId=t.appId,this.gameId=t.gameId,this.clientId=t.clientId,this.payversion=t.pay_version,this.baseuri="/"===t.baseurl.substring(t.baseurl.length-1)?t.baseurl.substring(0,t.baseurl.length-1):t.baseurl,this.bi_base_uri="/"===t.bi_base_url.substring(t.bi_base_url.length-1)?t.bi_base_url.substring(0,t.bi_base_url.length-1):t.bi_base_url,this.packageName=t.packageName,console.log("----------tuyoosdk.OnInit-->clientId:",this.clientId),console.log("----------tuyoosdk.OnInit-->baseuri:",this.baseuri),console.log("----------tuyoosdk.OnInit-->platform:",this.platform()),this.bi.OnInit(this,t,function(r,s,l){0===r?(n.platform().OnInit(n,t,a,n),n.InitOtherThird(e,t,a,i)):o.call(i,r,s,l)},this)},InitOtherThird:function(e,t,o,i){for(var n in p.tyInitInterface)if(n!==e){var r=function(e,t,o){console.log("----------tuyoosdk.InitOtherThird-->type:",n," status: ",e)};p.tyInitInterface[n].OnInit(this,t,r,this)}},Is:function(e){var t=this.platform(e);return!this.IsNull(t)&&t.Is()},InitClientId:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(this.IsNull(e)===!1){var t=this.GetQueryToMap(e.substr(1,e.length));return this.IsNull(t.clientId)===!1?t.clientId:null}return null}return null},Login:function(e,t,o){var i=this;this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_login_track_id||""===e.extraParams.sdk_login_track_id?e.sdk_login_track_id=this.CreateUUID(32,16):e.sdk_login_track_id=e.extraParams.sdk_login_track_id:e.sdk_login_track_id=this.CreateUUID(32,16),this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),i.IsNull(i.platform(e.ChannelType).realLogin)?this.realLogin(e,t,o):i.platform(e.ChannelType).realLogin(i,e,t,o)},GetUserInfo:function(e,t,o){this.IsNull(this.platform().GetUserInfo)?console.error(this.platform().ChannelType+" not support GetUserInfo"):this.platform().GetUserInfo(this,e,t,o)},realLogin:function(e,t,o){var i=this,n={sdk_login_channel_type:i.platform(e.ChannelType).ChannelType,sdk_login_track_id:e.sdk_login_track_id};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_START,n);var r=function(r,a,s){var l=i.convertLoginServerResultCode(r);0===l?(i.userId=a.userId,i.token=a.token,i.userPwd=a.userPwd,i.logindata=a.logindata,i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_SUCC,n),t&&t.call(o,_.loginCode.success,a,s)):(n.sdk_error_code=r,n.sdk_error_msg=JSON.stringify(s),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_FAIL,n),t&&t.call(o,l,a,s));try{i.IsNull(i.platform(e.ChannelType).LoginEnd)||i.platform(e.ChannelType).LoginEnd(r,a,s)}catch(e){console.log("----------tuyoosdk.LoginEnd-->err:",e)}},a={retryMax:1,url:i.baseuri+this.sdkRoute.get(),postdata:{imei:"null",idfa:"",appId:i.appId,gameId:i.gameId,clientId:i.clientId,packageName:i.packageName,uuid:i.uuid(),sdk_session_id:i.bi.sessionId,original_deviceid:i.uuid(),sdk_login_track_id:e.sdk_login_track_id}};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)i.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,n,a){console.log("===========>snsHook",o,n),0===t?i.IsNull(i.platform(e.ChannelType).tuyooLogin)?i.tuyooLogin(o,r,a):i.platform(e.ChannelType).tuyooLogin(o,r,a):r.call(i,_.loginCode.fail,null,n)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(i,e,a,l)},tuyooLogin:function(e,t,o){var i=this;console.log("tuyoo-login-request",e);var n={sdk_login_channel_type:i.platform().ChannelType,sdk_login_track_id:e.postdata.sdk_login_track_id};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_START,n);try{this.HttpLib(e,function(e,r){console.log("tuyoo-login-response",e,r);var a=JSON.parse(r.data);if(i.IsNull(a.result))n.sdk_error_msg=JSON.stringify(a),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,_.loginCode.fail,null,a);else if(0===a.result.code){var s={userId:a.result.userId,token:a.result.token,userPwd:a.result.userPwd,logindata:a.result};if(!i.IsNull(o))for(var l in o)s[l]=o[l];i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_SUCC,n),t.call(i,a.result.code,s)}else n.sdk_error_code=a.result.code,n.sdk_error_msg=JSON.stringify(a.result),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,a.result.code,null,a.result.info)},function(e,o){n.sdk_error_code=e,n.sdk_error_msg=JSON.stringify(o),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,_.loginCode.fail,null,o)},i)}catch(e){n.sdk_error_msg=JSON.stringify(e),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),console.log("tuyoo-login-catch",e),t.call(i,_.loginCode.fail,null,e)}},convertLoginServerResultCode:function(e){switch(e){case 0:return _.loginCode.success;case 12010:return 100201;case 12017:case 12130:return 100206;case 10:return 100502;case 100504:return 100504;default:return _.loginCode.fail}},Logout:function(){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(this)}},o(r,"Logout",function(e,t){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(e,t)}),o(r,"Bind",function(e,t,o){this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),this.realBind(e,t,o)}),o(r,"realBind",function(e,t,o){var i=this,n={sdk_login_channel_type:i.platform(e.ChannelType).ChannelType};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_START,n);var r=function(e,r,a){var s=i.convertLoginServerResultCode(e);0===s?(i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_SUCC,n),t&&t.call(o,_.loginCode.success,r,a)):(n.sdk_error_code=e,n.sdk_error_msg=JSON.stringify(a),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_FAIL,n),t&&t.call(o,s,r,a))};if(i.IsNull(i.userId)||0===i.userId||"0"===i.userId)return void r(_.loginCode.fail,null,"Do not login");var a={retryMax:1,url:i.baseuri+"/open/v6/user/bindBySnsId",postdata:{imei:"null",appId:i.appId,gameId:i.gameId,clientId:i.clientId,packageName:i.packageName,uuid:i.uuid(),sdk_session_id:i.bi.sessionId,original_deviceid:i.uuid(),userId:i.userId,passwd:i.userPwd}};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)i.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,o,n,a){console.log("===========>snsHook",o,n),0===t?i.IsNull(i.platform(e.ChannelType).tuyooBind)?i.tuyooBind(o,r,a):i.platform(e.ChannelType).tuyooBind(o,r,a):r.call(i,_.loginCode.fail,null,n)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(i,e,a,l)}),o(r,"tuyooBind",function(e,t,o){var i=this;console.log("tuyoo-bind-request",e);try{this.HttpLib(e,function(e,o){console.log("tuyoo-bind-response",e,o);var n=JSON.parse(o.data);i.IsNull(n.result)?t.call(i,_.loginCode.fail,null,n):0===n.result.code?t.call(i,n.result.code,n.result):t.call(i,n.result.code,n.result,n.result.info)},function(e,o){t.call(i,_.loginCode.fail,null,o)},i)}catch(e){console.log("tuyoo-bind-catch",e),t.call(i,_.loginCode.fail,null,e)}}),o(r,"Pay",function(e,t,o){console.log("==========>start pay "),this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_order_track_id||""===e.extraParams.sdk_order_track_id?e.sdk_order_track_id=this.CreateUUID(32,16):e.sdk_order_track_id=e.extraParams.sdk_order_track_id:e.sdk_order_track_id=this.CreateUUID(32,16),this.IsNull(e.ChargeType)&&(e.ChargeType=this.platform().ChargeType),this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_START,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_pay_type:e.ChargeType}),"tuyoo"!==e.ChargeType?this.realPay(e,t,o,e.ChargeType):this.payui(e,t,o)}),o(r,"isString",function(e){return"[object String]"===Object.prototype.toString.call(e)}),o(r,"Order",function(e,t,o){var i=this;if(void 0===e.prodCount&&(e.prodCount=1),void 0===e.appInfo&&(e.appInfo=""),void 0===e.prodOrderId&&(e.prodOrderId=""),i.IsNull(i.wxAppId)||(e.wxAppId=i.wxAppId),console.log("------- self.platformPay(args.ChargeType) ----------",i.platformPay(e.ChargeType)),!i.IsNull(i.platformPay(e.ChargeType).Order))return i.platformPay(e.ChargeType).Order(i,e,t,o);if(i.IsNull(i.userId)||0===i.userId||"0"===i.userId)return this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:_.payCode.fail,sdk_error_msg:"用户信息不合法",sdk_pay_type:e.ChargeType}),void t.call(o,_.payCode.fail,null,"用户信息不合法");var n={imei:"null",chargeType:e.ChargeType,userId:i.userId,appId:i.appId,gameId:i.gameId,mustcharge:"1",uuid:i.uuid(),clientId:i.clientId,prodId:e.prodId,prodName:e.prodName,prodCount:e.prodCount,prodPrice:e.prodPrice,appInfo:e.appInfo,prodOrderId:e.prodOrderId,sdk_session_id:i.bi.sessionId,sdk_order_track_id:e.sdk_order_track_id,original_deviceid:i.uuid()};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var r in e.extraParams)i.IsNull(n[r])&&(n[r]=e.extraParams[r]);i.platformPay(e.ChargeType).ExtraOrderParams(i,e,n);var a={url:i.orderuri(),postdata:n};i.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_START,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId}),i.HttpLib(a,function(r,a){var s;if(s=i.isString(a.data)?JSON.parse(a.data):a.data,s&&null!==s.result)if(0===s.result.code){var l=s.result.chargeInfo;i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_SUCC,{sdk_pay_type:l.chargeType,sdk_order_id:l?l.platformOrderId:"DEFAULT",sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id});var c;try{c=s.result.payData}catch(e){c=null,console.log("=============> 没有paydata数据",e)}var d=function(n,r,a){var s={sdk_pay_type:l.chargeType,sdk_order_id:l.platformOrderId,sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id};0===n?i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_SUCC,s):n===_.payCode.navigatePayPageSucc?i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_LAUNCH_SUCC,s):(s.sdk_error_code=n,s.sdk_error_msg=a,i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,s));var c=[];for(var d in arguments)c.push(arguments[d]);t.apply(o,c)};console.log(e.ChargeType),l.sdk_order_track_id=e.sdk_order_track_id,i.platformPay(e.ChargeType).Pay(i,l,c,d,i)}else{if(i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:s.result.code,sdk_error_msg:JSON.stringify(s.result)}),!i.IsNull(i.platformPay(e.ChargeType).dealOrderFail)){var p=function(n,r,a){console.log("=============> dealOrderFail hook status",n),n===_.dealOrderFailCode.needReOrder?i.Order(e,t,o):this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,_.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)};return void i.platformPay(e.ChargeType).dealOrderFail(i,s.result,p)}this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(o,_.payCode.fail,null,s.result.info):t.call(o,30315,null,s.result.info)}else i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:"DEFAULT",sdk_error_msg:JSON.stringify(s)}),t.call(o,_.payCode.fail,null,s)},function(r,a){i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:r,sdk_error_msg:a}),t.call(o,_.payCode.fail,null,a)},i)}),o(r,"realNameAuth",function(e,t){var o=this,i=function(e,i,n){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("----------tuyoosdk.realNameAuth-->err:",e)}},n={retryMax:1,url:o.baseuri+"/open/v6/user/update/sync/third",postdata:{imei:"null",idfa:"",appId:o.appId,gameId:o.gameId,clientId:o.clientId,packageName:o.packageName,uuid:o.uuid(),userId:o.userId}},r=function(e,t,n){console.log("===========>snsHook",t,n),0===e?o.IsNull(o.platform().syncThird)?o.syncThird(t,i):o.platform().syncThird(t,i):i.call(o,_.verifyCode.fail,null,n)};o.IsNull(o.platform().realNameAuth)?t.call(o,_.verifyCode.fail,null,"无渠道实名方法"):this.platform().realNameAuth(o,e,n,r)}),o(r,"syncThird",function(e,t){var o=this;console.log("tuyoo-syncThird-request",e),o.HttpLib(e,function(e,i){if(o.isString(i.data))var n=JSON.parse(i.data);else var n=i.data;n.result&&null!==n.result?(console.log("syncThird=============> "+JSON.stringify(n.result)),0===n.result.code?t.call(o,_.verifyCode.success,n.result,null):t.call(o,_.verifyCode.fail,null,n.result.info)):t.call(o,_.verifyCode.fail,null,n)},function(e,i){t.call(o,_.verifyCode.fail,null,i)},o)}),o(r,"ShowBuoy",function(){this.platform().ShowBuoy()}),o(r,"HideBuoy",function(){this.platform().HideBuoy()}),o(r,"ShoutCat",function(){this.platform().ShoutCat()}),o(r,"OnExit",function(){this.platform().onExit()}),o(r,"onExit",function(e){this.platform().onExit(e)}),o(r,"HttpLib",function(e,t,o,i){var n=this;void 0===e.retry&&(e.retry=0),void 0===e.retryMax&&(e.retryMax=0),void 0===e.method&&(e.method="POST"),void 0===e.headers&&(e.headers={"Content-Type":"application/x-www-form-urlencoded"});var r=function(e){l.ajax(n,e)};try{var a=this.platform(),s=!1;if("dmm.global.h5"!==a.ChannelType?s=!0:e.url!==n.config.bi_base_url+"api/bilog5/ga"&&(s=!0),s){var c=a.HttpLib;this.IsNull(c)||(r=function(e){c.call(a,n,e)})}}catch(e){}r({url:e.url,type:e.method,dataType:"json",headers:e.headers,data:e.postdata,success:function(r){console.log(e.url,">>请求结果》》》",r);try{var a={data:r.responseText,status:r.status},s={};"string"==typeof a.data?s=JSON.parse(a.data):(s=a.data,a.data=JSON.stringify(a.data)),n.IsNull(s.error)===!1?o.call(i,1009,s):t.call(i,0,a)}catch(e){t.call(i,0,a)}},error:function(r){console.log("网络异常",e.url),e.retry

    "+e.prodName+'

    \t
  • 微信支付
  • \t
  • 支付宝支付
  • \t

    选择支付方式

    ¥ '+e.prodPrice+"

    "+e.prodName+'

    \t
    \t\t
    微信支付
    \t\t
    支付宝支付
    \t
    ',l=document.createElement("div");l.setAttribute("id","payui"),l.innerHTML=s,document.getElementsByTagName("body")[0].appendChild(l)}),o(r,"realPay",function(e,t,o,i,n){var r=this;if(!this.IsNull(n)){console.log("==========>start pay ");var a=n||event;a.stopPropagation()}e.ChargeType=i;var s=function(e,i,n){var r=[];for(var a in arguments)r.push(arguments[a]);try{t.apply(o,r)}catch(e){console.log("应用层代码出错了--->"),console.log(e)}};try{r.Order(e,s,r)}catch(e){console.log("order error--->",e.toString())}}),o(r,"hidePay",function(e){var t=document.getElementById("payui");document.getElementsByTagName("body")[0].removeChild(t)}),o(r,"LoginByToken",function(e,t){var o=this,i={appId:e.appId,clientId:e.clientId,token:e.token,imei:null},n={url:o.baseuri+"/open/v4/user/loginByToken",postdata:i};o.HttpLib(n,function(e,i,n){if(0===e){var r=JSON.parse(i.data);if(null!==r.result)if(console.log("--------->message",r),0===r.result.code){var a={userId:r.result.userId,token:r.result.token,logindata:r.result};o.userId=r.result.userId,t.call(o,_.loginCode.success,a,null)}else t.call(o,_.loginCode.fail,null,r.result)}})}),o(r,"QueryOrderStatus",function(e,t){var o=this,i={appId:o.config.appId,clientId:o.config.clientId,platformOrderId:e.platformOrderId,userId:o.userId},n={url:o.baseuri+"/open/v4/pay/query",postdata:i};o.HttpLib(n,function(e,i,n){if(0===e){var r=JSON.parse(i.data);if(void 0!==r.error&&t.call(o,_.payCode.fail,null,"orderId not exist"),void 0!==r.result){var a={status:"notPaid"},e=r.result.status;"41"===e.toString()&&(a.status="paid",t.call(o,_.payCode.success,a,null)),t.call(o,_.payCode.success,a,null)}}})}),o(r,"Ad",function(){return this.IsNull(this.platform().Ad)?void console.error(this.platform().ChannelType+" not support Ad"):this.platform().Ad()}),o(r,"getDeviceBenchmarkLevel",function(e,t){this.IsNull(this.platform().getDeviceBenchmarkLevel)?console.error(this.platform().ChannelType+" not support getDeviceBenchmarkLevel"):this.platform().getDeviceBenchmarkLevel(this,e,t)}),r)),h=new f;!function(o,r){"object"===a(exports)?e.exports=r():(i=r,n="function"==typeof i?i.call(exports,t,exports,e):i,!(void 0!==n&&(e.exports=n)))}(void 0,function(){return h})},function(e,exports,t){function o(e){function t(){}return t.prototype=e,new t}function i(e,t){var i;i="function"==typeof Object.create?Object.create(t.prototype):o.create(t.prototype),i.constructor=e,e.prototype=i}var n,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function e(t,o){return function(){function n(){if("undefined"==typeof n.prototype.ctor);else{var e=new Array;for(var t in arguments)e.push(arguments[t]);n.prototype.ctor.apply(this,e)}}var r=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/,_super=t.prototype;i(n,t);var a=n.prototype;"undefined"==typeof _super||"undefined"==typeof _super.ctor&&(_super.ctor=t),n.extend=function(t){return e(n,t)};for(var s in o)a[s]="function"==typeof o[s]&&"function"==typeof _super[s]&&r.test(o[s])?function(e,t){return function(){var o=this._super;this._super=_super[e];var i=new Array;for(var n in arguments)i.push(arguments[n]);var r=t.apply(this,i);return this._super=o,r}}(s,o[s]):o[s];return n}()},l=s(function(){},{});!function(o,i){"object"===a(exports)?e.exports=i():(n=i,r="function"==typeof n?n.call(exports,t,exports,e):n,!(void 0!==r&&(e.exports=r)))}(void 0,function(){return l})},function(e,exports,t){"use strict";var o=t(1),i=o.extend({IsWxApp:function(){try{if(void 0!==wx.request)return!0}catch(e){return!1}},IncludeWxChannel:function(e){return"xiaomi.cn.minigame"===e.type},ajax:function(e,t){if(t=t||{},t.cache=t.cache||!1,!t.url)throw new Error("参数不合法");if(this.IsWxApp()&&!this.IncludeWxChannel(e)){t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{};var o=this.formateParams(t.data,t.cache);"GET"===t.type?(t.url=o?t.url+"?"+o:t.url,wx.request({url:t.url,method:"GET",header:{Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})):wx.request({url:t.url,method:"POST",data:o,header:{"content-type":"application/x-www-form-urlencoded",Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})}else t.dataType=(t.dataType||"json").toLowerCase(),"jsonp"==t.dataType?this.ajaxJSONP(t):"json"==t.dataType&&this.ajaxJSON(t)},ajaxJSONP:function(e){e.data=e.data||{},e.jsonp=e.jsonp||"callback";var t="jsonp_"+(new Date).getTime();e.data[e.jsonp]=t;var o=this.formateParams(e.data,e.cache),i=document.getElementsByTagName("head")[0],n=document.createElement("script");i.appendChild(n),window[t]=function(o){i.removeChild(n),clearTimeout(n.timer),window[t]=null,e.success&&e.success(o)},n.src=o?e.url+"?"+o:e.url,e.time&&(n.timer=setTimeout(function(){window[t]=null,i.removeChild(n),e.error&&e.error({message:"超时"})},e.time))},ajaxJSON:function(e){e.type=(e.type||"GET").toUpperCase(),e.data=e.data||{};var t,o=this.formateParams(e.data,e.cache);if(t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),t.onreadystatechange=function(){4===t.readyState&&(200===t.status?e.success&&("string"==typeof t.responseText?e.success(t):e.success(t)):429===t.status?e.success&&t.responseText&&("string"==typeof t.responseText?e.success(t):e.success(t)):e.error&&e.error(t.status))},"GET"===e.type)t.open("GET",o?e.url+"?"+o:e.url,!0),t.send(null);else{if(e.headers&&"application/json"==e.headers["Content-Type"]){t.open("POST",e.url,!0);for(var i in e.headers)t.setRequestHeader(i,e.headers[i]);return void t.send(JSON.stringify(e.data))}t.open("POST",o?e.url+"?"+o:e.url,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(o)}},formateParams:function(e,t){var o=[];for(var i in e)o.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t&&o.push("v="+(new Date).getTime()),o.join("&")}});e.exports=new i},function(e,exports,t){var o,i,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=t(1),a=r.extend({_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",checkOs:function(){var e=navigator.userAgent,t=(navigator.appVersion,e.indexOf("Android")>-1||e.indexOf("Linux")>-1),o=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return t?"ANDROID":o?"IOS":void 0},getDeviceType:function(){return navigator&&navigator.userAgentData&&navigator.userAgentData.mobile?"Mobile":/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?"Mobile":"Browser"},encode:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},decode:function(e){return decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))},open_pay_url:function(e){this.showDetail(event,e)},pay_url:function(e){if("IOS"==s.checkOs()){console.log("pay ios ===>",e);var t=document.createElement("iframe");t.href=e,t.target="_self",top.location.href=location.href,t.click(),window.location.href=e,setTimeout(function(){document.body.removeChild(t)},3e3)}else{console.log("pay android ===>",e);var o=document.createElement("a");o.href=e,document.body.appendChild(o),o.click(),document.body.removeChild(o)}},showDetail:function(e,t){window.tysdk=this;var o=document.getElementsByTagName("head")[0],i="https://downqn.tuyoo.com/h5sdk/v100/src/css/style.css",n=document.createElement("link");n.href=i,n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css");var r=document.createElement("meta");r.setAttribute("name","viewport"),r.setAttribute("content","width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes"),o.appendChild(r),o.appendChild(n);var a='
    充值中心 X
    ',s=document.createElement("div");s.setAttribute("id","detailui"),s.innerHTML=a,document.getElementsByTagName("body")[0].appendChild(s)},fadeoutDetail:function(e){var t=e||event;t.stopPropagation();var o=document.getElementById("detailui");document.getElementsByTagName("body")[0].removeChild(o)},changeFrameHeight1:function(){ +var e=document.getElementById("myiframe");e.height=document.documentElement.clientHeight},Login_SIGN:function(e,t,o,i){var n=this.decode(i),r="userID="+e+"&clientID="+t+"&gameID="+o+"&signKey="+n;return this.signature(r)},signature:function(e){function t(e,t){var o,i,n,r,a;return n=2147483648&e,r=2147483648&t,o=1073741824&e,i=1073741824&t,a=(1073741823&e)+(1073741823&t),o&i?2147483648^a^n^r:o|i?1073741824&a?3221225472^a^n^r:1073741824^a^n^r:a^n^r}function o(e,o,i,n,r,a,s){return e=t(e,t(t(o&i|~o&n,r),s)),t(e<>>32-a,o)}function i(e,o,i,n,r,a,s){return e=t(e,t(t(o&n|i&~n,r),s)),t(e<>>32-a,o)}function n(e,o,i,n,r,a,s){return e=t(e,t(t(o^i^n,r),s)),t(e<>>32-a,o)}function r(e,o,i,n,r,a,s){return e=t(e,t(t(i^(o|~n),r),s)),t(e<>>32-a,o)}function a(e){var t,o="",i="";for(t=0;3>=t;t++)i=e>>>8*t&255,i="0"+i.toString(16),o+=i.substr(i.length-2,2);return o}var s,l,c,d,u,_,p,f,h=[];for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",o=0;oi?t+=String.fromCharCode(i):(127i?t+=String.fromCharCode(i>>6|192):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128)),t+=String.fromCharCode(63&i|128))}return t}(e),h=function(e){var t,o=e.length;t=o+8;for(var i=16*((t-t%64)/64+1),n=Array(i-1),r=0,a=0;a>>29,n}(e),u=1732584193,_=4023233417,p=2562383102,f=271733878,e=0;e>5]|=(e.charCodeAt(r/8)&o)<>2]>>8*(r%4)&255)<<16|(t[r+1>>2]>>8*((r+1)%4)&255)<<8|t[r+2>>2]>>8*((r+2)%4)&255,s=0;s<4;s++)n+=8*r+6*s>32*t.length?"":i.charAt(a>>6*(3-s)&63);return n},showModal:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.title,o=void 0===t?"":t,i=e.content,n=void 0===i?"":i,r=e.showCancel,a=void 0===r||r;return new Promise(function(e){var t="https://downqn.tuyoo.com/h5sdk/v100/src/css/modal.css";if(!document.querySelector('link[href="'+t+'"]')){var i=document.createElement("link");i.rel="stylesheet",i.href=t,document.head.appendChild(i)}var r=document.createElement("div");r.className="custom-modal",r.innerHTML='\n ',document.body.appendChild(r),r.querySelector(".ok-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!0,cancel:!1})}),a&&r.querySelector(".cancel-btn").addEventListener("click",function(){document.body.removeChild(r),e({confirm:!1,cancel:!0})})})}}),s=new a;!function(r,a){"object"===n(exports)?e.exports=a():(o=a,i="function"==typeof o?o.call(exports,t,exports,e):o,!(void 0!==i&&(e.exports=i)))}(void 0,function(){return s})},function(e,exports,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;t0){var i=function(o){t.deleteCache(e),t.reportCacheData()};this.httpRequestWithLimit(o,i)}else this.reportCacheData()},processArray2String:function(e){if(e){var t="";return e.forEach(function(e){t+=e+"\n"}),t}},reportCacheData:function(){var e=this.getCacheWithLimitCount(this.gaLocalCacheData,10);e&&e.length>0&&this.reportGALog(e)},getCacheWithLimitCount:function(e,t){if(e){for(var o=[],i=Array.from(e),n=i.length>t?t:i.length,r=0;r100&&this.gaLocalCacheData.shift())},deleteCache:function(e){var t=this;e&&this.gaLocalCacheData&&e.forEach(function(e){t.gaLocalCacheData.indexOf(e)>-1&&t.gaLocalCacheData.splice(t.gaLocalCacheData.indexOf(e),1)})},httpRequest:function(e){var t=this;this.config&&this.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var o={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(o,function(e,o){t.tuyoo.config&&t.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+o)},function(e,t){console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})},httpRequestWithLimit:function(e,t){var o=this;if(!this.biLimitState){this.biLimitState=!0,this.tuyoo.config&&this.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var i={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(i,function(e,i){o.biLimitState=!1,200==i.status&&t&&t(i.data),o.tuyoo.config&&o.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+i)},function(e,t){o.biLimitState=!1,console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})}}});e.exports=a},function(e,exports){"use strict";var t=t||{};t.initCode={success:0,fail:-1},t.loginCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.payCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1001,navigatePayPageSucc:1e3},t.smsCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.biCode={success:0,fail:-1},t.verifyCode={success:t.initCode.success,fail:t.initCode.fail},t.shareCode={success:t.initCode.success,fail:t.initCode.fail},t.dealOrderFailCode={continue:t.initCode.success,needReOrder:t.initCode.fail},t.loginEvent={success:"登录成功",fail:"登录失败",cancle:"登录取消",sns_error:"snsId为undefined"},t.payEvent={success:"支付成功",fail:"支付失败",cancle:"支付取消",invalid:"支付方式无效"},t.initEvent={success:"初始化成功",fail:"初始化失败",url_null:"初始化URL为空"},t.biEvent={success:"上报成功",fail:"上报失败"},t.verifyEvent={success:"认证成功",fail:"认证失败"},e.exports=t},function(e,exports){"use strict";var t={GAEvents:{SDK_INIT_ENT:"sdk_c_init_end",SDK_LOGIN_START:"sdk_c_login_start",SDK_LOGIN_SUCC:"sdk_c_login_succ",SDK_LOGIN_FAIL:"sdk_c_login_fail",SDK_BIND_START:"sdk_c_bind_start",SDK_BIND_SUCC:"sdk_c_bind_succ",SDK_BIND_FAIL:"sdk_c_bind_fail",SDK_CHANNEL_INIT_START:"sdk_c_channel_init_start",SDK_CHANNEL_INIT_SUCC:"sdk_c_channel_init_succ",SDK_CHANNEL_INIT_FAIL:"sdk_c_channel_init_fail",SDK_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_LOGIN_BY_SDKSERVER_START:"sdk_c_login_by_sdkserver_start",SDK_LOGIN_BY_SDKSERVER_SUCC:"sdk_c_login_by_sdkserver_succ",SDK_LOGIN_BY_SDKSERVER_FAIL:"sdk_c_login_by_sdkserver_fail",SDK_PAY_START:"sdk_c_pay_start",SDK_PAY_SUCC:"sdk_c_pay_succ",SDK_PAY_FAIL:"sdk_c_pay_fail",SDK_PAY_LAUNCH_SUCC:"sdk_c_pay_launch_succ",SDK_C_ORDER_START:"sdk_c_order_start",SDK_C_ORDER_SUCC:"sdk_c_order_succ",SDK_C_ORDER_FAIL:"sdk_c_order_fail",SDK_C_REQUEST_CHANNEL_PAY_START:"sdk_c_request_channel_pay_start",SDK_C_REQUEST_CHANNEL_PAY_SUCC:"sdk_c_request_channel_pay_succ",SDK_C_REQUEST_CHANNEL_PAY_FAIL:"sdk_c_request_channel_pay_fail",SDK_C_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_C_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_C_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_SHARE_START:"sdk_c_share_start",SDK_SHARE_SUCC:"sdk_c_share_succ",SDK_SHARE_FAIL:"sdk_c_share_fail",SDK_C_GAME_LAUNCH:"sdk_c_game_launch",SDK_C_VERIFY:"sdk_c_verify"}};e.exports=t},function(e,exports,t){"use strict";var o=t(8),i=new o,n={"xiaomi.cn.minigame":i},r={"xiaomi.cn.minigame.iap":i},a={"xiaomi.cn.minigame":i};e.exports={tyLoginInterface:n,tyPayInterface:r,tyInitInterface:a}},function(e,exports,t){"use strict";var o=Object.assign||function(e){for(var t=1;tstatus: "+e+" \n error : "+o),100504==e&&this.loginParams.isShowLimitToast!==!1&&(this.tuyoo.bi.ReportGAWithType(this.tuyoo,this.tuyoo.bi.GA_TYPE.LOGIN,"sdk_c_receive_gateway_limit_info",{gateway_info:o}),qg.showModal({title:"温馨提示",content:o||"当前玩家过多,请稍后再试~",showCancel:!1,success:function(e){console.log(e)},fail:function(e){console.log(e)}}))}catch(e){console.error("xiaomi minigame LoginEnd",e)}},IsNull:function(e){return void 0===e||null===e||""===e},ExtraOrderParams:function(e,t,o){o.chargeType=this.ChargeType,o.xiaomi_appId=this.xiaomiAppId,o.xiaomi_uid=this.xiaomi_uid,o.xiaomi_session=this.xiaomi_session,o.osName=this.os_name,o.packageName=this.config.packageName,o.os_version=this.os_version,o.sdk_device_brand=this.systemInfo.brand,o.phone_model=this.systemInfo.model},Pay:function(e,t,o,i,a){var s=this;console.log("xiaomi-minigame-pay-start"),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,r.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_START,s.getGaParams(e,t,null));var l=t.chargeData;qg.pay({orderInfo:l,success:function(o){console.log("xiaomi pay success: ",JSON.stringify(o)),o&&"9000"==o.resultStatus?(e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,r.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_SUCC,s.getGaParams(e,t,null)),i.call(a,n.payCode.success,JSON.stringify(o),null)):(e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,r.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,s.getGaParams(e,t,{sdk_channel_error_code:o.resultStatus,sdk_channel_error_msg:JSON.stringify(o)})),i.call(a,n.payCode.fail,null,JSON.stringify(o)))},fail:function(o){console.log("xiaomi pay fail: ",JSON.stringify(o)),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,r.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,s.getGaParams(e,t,{sdk_channel_error_code:o.resultStatus,sdk_channel_error_msg:JSON.stringify(o)})),i.call(a,n.payCode.fail,null,JSON.stringify(o))}})},getGaParams:function(e,t,i){var n={sdk_pay_type:this.ChargeType};return!this.IsNull(t)&&e.isJSON(JSON.stringify(t))&&(n.sdk_pay_type=t.chargeType,n.sdk_order_track_id=t.sdk_order_track_id,n.sdk_order_id=t.platformOrderId,n.sdk_game_order_id=t.prodOrderId,n.sdk_product_id=t.prodId),!this.IsNull(i)&&e.isJSON(JSON.stringify(i))&&(n=o(n,i)),n}});e.exports=s}])}); +//# sourceMappingURL=tuyoosdk_release.js.map \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/xiaomiminigame/tuyoosdk_xiaomiminigame_1.0.1_20251010_release.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/xiaomiminigame/tuyoosdk_xiaomiminigame_1.0.1_20251010_release.js.meta new file mode 100644 index 0000000..481ede0 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/xiaomiminigame/tuyoosdk_xiaomiminigame_1.0.1_20251010_release.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4e1696e5b21ec4f61a8dbe8b29a4d42c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame.meta new file mode 100644 index 0000000..62cfd33 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0337fef97e7c04746962950a31cf3b41 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame/TyJsBridge.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame/TyJsBridge.js new file mode 100644 index 0000000..4b30b47 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame/TyJsBridge.js @@ -0,0 +1,318 @@ +var TuyooSdkBridge = { + + loadJsScriptToBridge: function (channelType) { + var channelTypeFromCS = UTF8ToString(channelType); + console.log("channelTypeFromCS:" + channelTypeFromCS); + }, + + InitToBridge: function (initEventInfo) { + try { + var initCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "InitResult", callbackString); + } + var initInfoFromCS = UTF8ToString(initEventInfo); + var initInfo = JSON.parse(initInfoFromCS); + var tyInitParams = {}; + tyInitParams.appId = initInfo.tuyooParam.appId; + tyInitParams.gameId = initInfo.tuyooParam.gameId; + tyInitParams.pay_version = "hall37"; + tyInitParams.baseurl = initInfo.tuyooParam.serverUrl.endsWith("/") ? initInfo.tuyooParam.serverUrl : initInfo.tuyooParam.serverUrl + "/"; + tyInitParams.bi_base_url = "https://cbi.tuyoo.com/"; + tyInitParams.cloudId = initInfo.tuyooParam.cloudId; + tyInitParams.packageName = initInfo.package; + tyInitParams.clientId = initInfo.tuyooParam.clientId; + tyInitParams.bytedanceAppId = initInfo.login.zijieminigame.bytedanceAppId; + if (initInfo.login.zijieminigame.shareManagerUrl) { + tyInitParams.shareManagerUrl = initInfo.login.zijieminigame.shareManagerUrl.endsWith("/") ? initInfo.login.zijieminigame.shareManagerUrl : initInfo.login.zijieminigame.shareManagerUrl + "/"; + } + // 默认关闭拉取营销系统分享配置的开关 + tyInitParams.pullShareConfig = false; + if(initInfo.login.zijieminigame.pullShareConfig === true) { + tyInitParams.pullShareConfig = true; + } + console.log("initInfo: " + JSON.stringify(initInfo)); + window.TuyooSdk.OnInit("bytedance.cn.iap", tyInitParams, initCallback, this); + } catch (e) { + console.error("InitToBridge catch error: " + e); + } + }, + + // 切换SDK域名 + UpdateServerUrlToBridge: function (serverUrl) { + try { + var serverUrlFromCS = UTF8ToString(serverUrl); + window.TuyooSdk.baseuri = (serverUrlFromCS.substring(serverUrlFromCS.length - 1) === '/') ? serverUrlFromCS.substring(0, serverUrlFromCS.length - 1) : serverUrlFromCS; + console.log("update serverUrl to: " + window.TuyooSdk.baseuri); + } catch (e) { + console.error("UpdateServerUrlToBridge catch error: " + e); + } + }, + + LoginToBridge: function (loginEventInfo) { + try { + var loginCallback = function (code, result, error) { + var callbackResult = { + code: code, + result: result && result.logindata ? result.logindata : result, + error: error + }; + var callbackString = JSON.stringify(callbackResult); + SendMessage("NativeCallBack", "LoginResult", callbackString); + } + var loginInfoFromCS = UTF8ToString(loginEventInfo); + var loginInfo = JSON.parse(loginInfoFromCS); + var tyLoginParams = {}; + if (loginInfo.loginType) { + tyLoginParams.ChannelType = "bytedance.cn.iap"; + } + if (loginInfo.extraParams) { + var extraParams = JSON.parse(loginInfo.extraParams); + tyLoginParams.extraParams = extraParams; + } + console.log("tyLoginParams: " + JSON.stringify(tyLoginParams)); + window.TuyooSdk.Login(tyLoginParams, loginCallback, this); + } catch (e) { + console.error("LoginToBridge catch error: " + e); + } + }, + + PayToBridge: function (payEventInfo) { + try { + var payCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "PayResult", callbackString); + } + var payInfoFromCS = UTF8ToString(payEventInfo); + var payInfo = JSON.parse(payInfoFromCS); + var tyPayParams = {}; + tyPayParams.prodCount = 1; + tyPayParams.appInfo = ""; + if (payInfo.chargeService) { + tyPayParams.ChargeType = payInfo.chargeService; + } + if (payInfo.productCount) { + tyPayParams.prodCount = payInfo.productCount; + } + if (payInfo.serverAppInfo) { + tyPayParams.appInfo = payInfo.serverAppInfo; + } + if (payInfo.gameOrderId) { + tyPayParams.prodOrderId = payInfo.gameOrderId; + } + if (payInfo.extraParams) { + var extraParams = JSON.parse(payInfo.extraParams); + tyPayParams.extraParams = extraParams; + } + tyPayParams.prodId = payInfo.productId; + tyPayParams.prodName = payInfo.productName; + tyPayParams.prodPrice = payInfo.productPrice; + console.log("tyPayParams: " + JSON.stringify(tyPayParams)); + window.TuyooSdk.Pay(tyPayParams, payCallback, this); + } catch (e) { + console.error("PayToBridge catch error: " + e); + } + }, + + SetShareInfoToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var resource = shareInfo.resource; + var shareInfoToJs = {}; + var inviteInfo = {}; + var videoInfo = {}; + resource.content && (inviteInfo.shareContent = resource.content); + resource.title && (inviteInfo.sharePointTitle = resource.title); + resource.imageUrl && (inviteInfo.sharePicLocUrl = resource.imageUrl); + resource.shareTemplateId && (inviteInfo.shareTemplateId = resource.shareTemplateId); + + resource.videoContent && (videoInfo.shareContent = resource.videoContent); + resource.shareTopic && (videoInfo.shareTopic = resource.shareTopic); + resource.videoShareTemplateId && (videoInfo.shareTemplateId = resource.videoShareTemplateId); + resource.shareDefaultBgm && (videoInfo.shareDefaultBgm = resource.shareDefaultBgm); + resource.shareCutTemplateId && (videoInfo.shareCutTemplateId = resource.shareCutTemplateId); + resource.shareVideoPath && (videoInfo.shareVideoPath = resource.shareVideoPath); + + shareInfoToJs.callback = shareCallback; + shareInfoToJs.invite = inviteInfo; + shareInfoToJs.video = videoInfo; + console.log("shareInfoToJs: " + JSON.stringify(shareInfoToJs.invite) + JSON.stringify(shareInfoToJs.video)); + window.TuyooSdk.SetDefaultShareInfo(shareInfoToJs); + } catch (e) { + console.error("SetShareInfoToBridge catch error: " + e); + } + }, + + ShareToBridge: function (shareEventInfo) { + try { + var shareCallback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "ShareResult", callbackString); + } + var shareInfoFromCS = UTF8ToString(shareEventInfo); + var shareInfo = JSON.parse(shareInfoFromCS); + var resource = shareInfo.resource; + var shareInfoToJs = {}; + shareInfoToJs.shareType = resource.type; + resource.sharePointId && (shareInfoToJs.sharePointName = resource.sharePointId); + resource.extraParams && (shareInfoToJs.extraInfo = JSON.parse(resource.extraParams)); + resource.useDefault && (shareInfoToJs.useDefault = resource.useDefault); + + if (resource.type == "video") { + resource.videoShareTemplateId && (shareInfoToJs.shareTemplateId = resource.videoShareTemplateId); + resource.shareDefaultBgm && (shareInfoToJs.shareDefaultBgm = resource.shareDefaultBgm); + resource.shareCutTemplateId && (shareInfoToJs.shareCutTemplateId = resource.shareCutTemplateId); + resource.shareVideoPath && (shareInfoToJs.shareVideoPath = resource.shareVideoPath); + resource.videoContent && (shareInfoToJs.shareContent = resource.videoContent); + resource.shareTopic && (shareInfoToJs.shareTopic = resource.shareTopic); + } else { + resource.shareTemplateId && (shareInfoToJs.shareTemplateId = resource.shareTemplateId); + resource.content && (shareInfoToJs.shareContent = resource.content); + resource.title && (shareInfoToJs.sharePointTitle = resource.title); + resource.imageUrl && (shareInfoToJs.sharePicLocUrl = resource.imageUrl); + } + + console.log("shareInfoToJs: " + JSON.stringify(shareInfoToJs)); + window.TuyooSdk.Share(shareInfoToJs, shareCallback); + } catch (e) { + console.error("ShareToBridge catch error: " + e); + } + }, + + GAEventTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + if (!reportInfo.typeName) { + reportInfo.typeName = "track"; + } + window.TuyooSdk.bi.trackWithType(reportInfo.typeName, reportInfo.eventName, reportInfo.reportEvent); + } catch (e) { + console.error("GAEventTrackToBridge catch error: " + e); + } + }, + + GAProfileTrackToBridge: function (reportEventInfo) { + try { + var reportInfoFromCS = UTF8ToString(reportEventInfo); + var reportInfo = JSON.parse(reportInfoFromCS); + window.TuyooSdk.bi.profileTrack(reportInfo.profileType, reportInfo.profileSubjectType, reportInfo.profileSubjectPrimary, reportInfo.reportEvent); + } catch (e) { + console.error("GAProfileTrackToBridge catch error: " + e); + } + }, + + GetShareInfoBridge: function (shareEventInfo) { + console.error("current channel not support GetShareInfo function"); + }, + + GetAdInfoBridge: function () { + console.error("current channel not support GetAdInfo function"); + }, + + TxAdSDKReportToBridge: function (txAdReportInfo) { + console.error("current channel not support TxAdSDKReport function"); + }, + + CheckBindToBridge: function (bindEventInfo) { + console.error("current channel not support CheckBind function"); + }, + + SendSmsCodeToBridge: function (loginEventInfo) { + console.error("current channel not support SendSmsCode function"); + }, + + BindToBridge: function (bindEventInfo) { + console.error("current channel not support Bind function"); + }, + + SetWxUserInfoToBridge: function (type, userInfo) { + console.error("current channel not support SetWxUserInfo function"); + }, + + GetDeviceLevelToBridge: function() { + try { + var callback = function (code, result, error) { + var callbackString = JSON.stringify({ code, result, error }); + SendMessage("NativeCallBack", "GetDeviceLevelResult", callbackString); + } + window.TuyooSdk.getDeviceBenchmarkLevel(callback); + } catch (error) { + console.error("GetDeviceLevelToBridge catch error: " + error); + } + }, + + CreatGridGamePanelToBridge: function(gridGameModule) { + var self = this; + try { + var gridGameModuleFromCS = UTF8ToString(gridGameModule); + var gridGameInfo = JSON.parse(gridGameModuleFromCS); + var gridGameInfoToJs = gridGameInfo; + var callbackKey = gridGameInfo.gridGamePanelId; + !gridGameInfoToJs.position && (delete gridGameInfoToJs.position) + !gridGameInfoToJs.size && (delete gridGameInfoToJs.size) + !gridGameInfo.query && (gridGameInfoToJs.query = {}) + var callback = function (code, result, error) { + if(code == 0){ + !window._tyGridGamePanelJson && (window._tyGridGamePanelJson = {}) + window._tyGridGamePanelJson[callbackKey] = result; + } + if(code != 900508){ + result = {}; + } + var action = callbackKey; + var callbackString = JSON.stringify({ code, result, error, action}); + SendMessage("NativeCallBack", "UnifiedNativeCallback", callbackString); + } + window.TuyooSdk.CallMethod("CreateGamePanel", gridGameInfoToJs, callback); + } catch (e) { + console.error("CreatGridGamePanelToBridge catch error: " + e); + } + }, + + ShowGridGamePanelToBridge: function(panelId) { + try { + !window._tyGridGamePanelJson && (window._tyGridGamePanelJson = {}) + panelId = UTF8ToString(panelId); + var gridGamePanel = window._tyGridGamePanelJson[panelId]; + if(gridGamePanel){ + gridGamePanel.show(); + } + } catch (e) { + console.error("ShowGridGamePanelToBridge catch error: " + e); + } + }, + + HideGridGamePanelToBridge: function(panelId) { + try { + !window._tyGridGamePanelJson && (window._tyGridGamePanelJson = {}) + panelId = UTF8ToString(panelId); + var gridGamePanel = window._tyGridGamePanelJson[panelId]; + if(gridGamePanel){ + gridGamePanel.hide(); + } + } catch (e) { + console.error("HideGridGamePanelToBridge catch error: " + e); + } + }, + + DestroyGridGamePanelToBridge: function(panelId) { + try { + !window._tyGridGamePanelJson && (window._tyGridGamePanelJson = {}) + panelId = UTF8ToString(panelId); + var gridGamePanel = window._tyGridGamePanelJson[panelId]; + if(gridGamePanel){ + gridGamePanel.destroy(); + } + } catch (e) { + console.error("DestroyGridGamePanelToBridge catch error: " + e); + } + } +} + +mergeInto(LibraryManager.library, TuyooSdkBridge); \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame/TyJsBridge.js.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame/TyJsBridge.js.meta new file mode 100644 index 0000000..b1758fe --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame/TyJsBridge.js.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9c3d8413bebaa44d78eb0f4b3c31f3c7 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame/tuyoosdk_zijiegame_1.0.4.250915_release.js b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame/tuyoosdk_zijiegame_1.0.4.250915_release.js new file mode 100644 index 0000000..b8ea239 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/ChannelResource/zijieminigame/tuyoosdk_zijiegame_1.0.4.250915_release.js @@ -0,0 +1,12 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TuyooSdk=t():window.TuyooSdk=t()}(this,function(){return function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,exports,t){function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i,n,o,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=t(1),l=t(2),c=t(3),d=t(4),u=t(6),h=t(5),_=t(7),p=s.extend((o={baseuri:{get:function(){return this._baseuri},set:function(e){this._baseuri=e}},sdkRoute:{set:function(e){this._sdkRoute=e},get:function(){return void 0===this._sdkRoute||""===this.sdkRoute?"/open/v6/user/LoginBySnsIdNoVerify":this._sdkRoute}},payversion:{get:function(){return this._payversion},set:function(e){this._payversion=e}},clientId:{get:function(){return this._clientId},set:function(e){this._clientId=e}},packageName:{get:function(){return this._packageName},set:function(e){this._packageName=e}},appId:{get:function(){return this._appId},set:function(e){this._appId=e}},gameId:{get:function(){return this._gameId},set:function(e){this._gameId=e}},userId:{get:function(){return this._userId},set:function(e){this._userId=e}},token:{get:function(){return this._token},set:function(e){this._token=e}},logindata:{get:function(){return this._logindata},set:function(e){this._logindata=e}},ctor:function(){this.bi=new d},uuid:function(){if(this.IsNull(this._uuid))try{var e=this.LocalStorage().GetItem("ty_uuid");this.IsNull(e)?(this._uuid=this.CreateUUID(32,16),this.LocalStorage().SetItem("ty_uuid",this._uuid)):this._uuid=e}catch(e){return this.CreateUUID(32,16)}return this._uuid},CheckChannel:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t.tyPlatform))return t.tyPlatform}}return null},CheckParams:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(!this.IsNull(e)){var t=this.GetQueryToMap(e.substr(1,e.length));if(!this.IsNull(t))return t}}return null},Decode:function(e){return c.decode(e)},IsNull:function(e){return void 0===e||null===e||""===e},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":a(t))||!t)}catch(e){return!1}},StartupParameter:function(){return this.platform().StartupParameter(this)},orderuri:function(){return"hall37"===this.payversion?this.baseuri+"/open/v4/pay/order":"hall51"===this.payversion?this.baseuri+"/open/v5/pay/order":this.baseuri+"/open/v4/pay/order"},platform:function(e){return this.IsNull(e)&&(e=this.type),_.tyLoginInterface[e]},platformPay:function(e){return _.tyPayInterface[e]},OnInitDebuger:function(e,t){var r="https://downqn.tuyoo.com/h5sdk/v100/js/vconsole.min.js";this.loadScript(r,function(r,i){if(0===r){new VConsole;console.log("----------tuyoosdk.OnInit-->initdebug:"),e.call(t,r,i,null)}else e.call(t,1005,null,"失败")})},OnInit:function(e,t,r,i){var n=this;console.log("----------tuyoosdk.OnInit-->channel:",e),t.debug&&n.OnInitDebuger(function(e,t,r){console.log(window.location.href,e,t,r)},n),n.TuyooInit(e,t,r,i)},SetDefaultShareInfo:function(e){this.IsNull(this.platform().SetDefaultShareInfo)||this.platform().SetDefaultShareInfo(this,e)},Share:function(e,t){this.IsNull(this.platform().Share)?t&&t.call(this,h.shareCode.fail,null,""+this.type+"不支持分享"):this.platform().Share(this,e,t)},CallMethod:function(e,t,r,i){var n=this.IsNull(t.ChannelType)?this.type:t.ChannelType;if(!this.IsNull(this.platform(n))&&"function"==typeof this.platform(n)[e]){var o=[this,t,r];return this.platform(n)[e].apply(i,o)}r&&r.call(this,h.initCode.fail,null,""+n+"不支持此功能("+e+")")},TuyooInit:function(e,t,r,i){var n=this;n.config=t;var o=(new Date).getTime(),a=function(e,t,a){0===e&&n.bi.ReportGAWithType(n,n.bi.GA_TYPE.TRACK,u.GAEvents.SDK_INIT_ENT,{sdk_init_duration_time:(new Date).getTime()-o});var s=[];for(var l in arguments)s.push(arguments[l]);r.apply(i,s)};if(n.IsNull(t.wxAppId)||(n.wxAppId=t.wxAppId),void 0===t.bi_base_url&&(t.bi_base_url="https://cbi.tuyoo.com/"),n.IsNull(t.pay_version)&&(t.pay_version="hall37"),"hall37"!==t.pay_version&&"hall51"!==t.pay_version)return void r.call(i,h.initCode.fail,null,"pay_version 必须为 hall37|hall51");if(this.IsNull(t.userId)?this.userId=0:this.userId=t.userId,console.log("----------tuyoosdk.OnInit-->config:",t),n.IsNull(t.clientId))if(n.IsNull(this.InitClientId())){if(!t.debug)return void r.call(i,h.initCode.fail,null,"clientId不能为空");t.clientId="Android_4.58_meitu.meitu.0-hall6.meitu.tu"}else t.clientId=this.InitClientId();this.type=e,this.appId=t.appId,this.gameId=t.gameId,this.clientId=t.clientId,this.payversion=t.pay_version,this.baseuri="/"===t.baseurl.substring(t.baseurl.length-1)?t.baseurl.substring(0,t.baseurl.length-1):t.baseurl,this.bi_base_uri="/"===t.bi_base_url.substring(t.bi_base_url.length-1)?t.bi_base_url.substring(0,t.bi_base_url.length-1):t.bi_base_url,this.packageName=t.packageName,console.log("----------tuyoosdk.OnInit-->clientId:",this.clientId),console.log("----------tuyoosdk.OnInit-->baseuri:",this.baseuri),console.log("----------tuyoosdk.OnInit-->platform:",this.platform()),this.bi.OnInit(this,t,function(o,s,l){0===o?(n.platform().OnInit(n,t,a,n),n.InitOtherThird(e,t,a,i)):r.call(i,o,s,l)},this)},InitOtherThird:function(e,t,r,i){for(var n in _.tyInitInterface)if(n!==e){var o=function(e,t,r){console.log("----------tuyoosdk.InitOtherThird-->type:",n," status: ",e)};_.tyInitInterface[n].OnInit(this,t,o,this)}},Is:function(e){var t=this.platform(e);return!this.IsNull(t)&&t.Is()},InitClientId:function(){if("undefined"!=typeof window.location.search){var e=window.location.search;if(this.IsNull(e)===!1){var t=this.GetQueryToMap(e.substr(1,e.length));return this.IsNull(t.clientId)===!1?t.clientId:null}return null}return null},Login:function(e,t,r){var i=this;this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_login_track_id||""===e.extraParams.sdk_login_track_id?e.sdk_login_track_id=this.CreateUUID(32,16):e.sdk_login_track_id=e.extraParams.sdk_login_track_id:e.sdk_login_track_id=this.CreateUUID(32,16),this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),i.IsNull(i.platform(e.ChannelType).realLogin)?this.realLogin(e,t,r):i.platform(e.ChannelType).realLogin(i,e,t,r)},GetUserInfo:function(e,t,r){this.IsNull(this.platform().GetUserInfo)?console.error(this.platform().ChannelType+" not support GetUserInfo"):this.platform().GetUserInfo(this,e,t,r)},realLogin:function(e,t,r){var i=this,n={sdk_login_channel_type:i.platform(e.ChannelType).ChannelType,sdk_login_track_id:e.sdk_login_track_id};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_START,n);var o=function(o,a,s){var l=i.convertLoginServerResultCode(o);0===l?(i.userId=a.userId,i.token=a.token,i.userPwd=a.userPwd,i.logindata=a.logindata,i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_SUCC,n),t&&t.call(r,h.loginCode.success,a,s)):(n.sdk_error_code=o,n.sdk_error_msg=JSON.stringify(s),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_FAIL,n),t&&t.call(r,l,a,s));try{i.IsNull(i.platform(e.ChannelType).LoginEnd)||i.platform(e.ChannelType).LoginEnd(o,a,s)}catch(e){console.log("----------tuyoosdk.LoginEnd-->err:",e)}},a={retryMax:1,url:i.baseuri+this.sdkRoute.get(),postdata:{imei:"null",idfa:"",appId:i.appId,gameId:i.gameId,clientId:i.clientId,packageName:i.packageName,uuid:i.uuid(),sdk_session_id:i.bi.sessionId,original_deviceid:i.uuid(),sdk_login_track_id:e.sdk_login_track_id}};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)i.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,r,n,a){console.log("===========>snsHook",r,n),0===t?i.IsNull(i.platform(e.ChannelType).tuyooLogin)?i.tuyooLogin(r,o,a):i.platform(e.ChannelType).tuyooLogin(r,o,a):o.call(i,h.loginCode.fail,null,n)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(i,e,a,l)},tuyooLogin:function(e,t,r){var i=this;console.log("tuyoo-login-request",e);var n={sdk_login_channel_type:i.platform().ChannelType,sdk_login_track_id:e.postdata.sdk_login_track_id};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_START,n);try{this.HttpLib(e,function(e,o){console.log("tuyoo-login-response",e,o);var a=JSON.parse(o.data);if(i.IsNull(a.result))n.sdk_error_msg=JSON.stringify(a),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,h.loginCode.fail,null,a);else if(0===a.result.code){var s={userId:a.result.userId,token:a.result.token,userPwd:a.result.userPwd,logindata:a.result};if(!i.IsNull(r))for(var l in r)s[l]=r[l];i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_SUCC,n),t.call(i,a.result.code,s)}else n.sdk_error_code=a.result.code,n.sdk_error_msg=JSON.stringify(a.result),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,a.result.code,null,a.result.info)},function(e,r){n.sdk_error_code=e,n.sdk_error_msg=JSON.stringify(r),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),t.call(i,h.loginCode.fail,null,r)},i)}catch(e){n.sdk_error_msg=JSON.stringify(e),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_LOGIN_BY_SDKSERVER_FAIL,n),console.log("tuyoo-login-catch",e),t.call(i,h.loginCode.fail,null,e)}},convertLoginServerResultCode:function(e){switch(e){case 0:return h.loginCode.success;case 12010:return 100201;case 12017:case 12130:return 100206;case 10:return 100502;case 100504:return 100504;default:return h.loginCode.fail}},Logout:function(){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(this)}},r(o,"Logout",function(e,t){if(!this.IsNull(this.platform().Logout))return this.platform().Logout(e,t)}),r(o,"Bind",function(e,t,r){this.IsNull(e.ChannelType)&&(e.ChannelType=this.platform().ChannelType),this.realBind(e,t,r)}),r(o,"realBind",function(e,t,r){var i=this,n={sdk_login_channel_type:i.platform(e.ChannelType).ChannelType};i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_START,n);var o=function(e,o,a){var s=i.convertLoginServerResultCode(e);0===s?(i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_SUCC,n),t&&t.call(r,h.loginCode.success,o,a)):(n.sdk_error_code=e,n.sdk_error_msg=JSON.stringify(a),i.bi.ReportGAWithType(i,i.bi.GA_TYPE.LOGIN,u.GAEvents.SDK_BIND_FAIL,n),t&&t.call(r,s,o,a))};if(i.IsNull(i.userId)||0===i.userId||"0"===i.userId)return void o(h.loginCode.fail,null,"Do not login");var a={retryMax:1,url:i.baseuri+"/open/v6/user/bindBySnsId",postdata:{imei:"null",appId:i.appId,gameId:i.gameId,clientId:i.clientId,packageName:i.packageName,uuid:i.uuid(),sdk_session_id:i.bi.sessionId,original_deviceid:i.uuid(),userId:i.userId,passwd:i.userPwd}};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var s in e.extraParams)i.IsNull(a.postdata[s])&&(a.postdata[s]=e.extraParams[s]);var l=function(t,r,n,a){console.log("===========>snsHook",r,n),0===t?i.IsNull(i.platform(e.ChannelType).tuyooBind)?i.tuyooBind(r,o,a):i.platform(e.ChannelType).tuyooBind(r,o,a):o.call(i,h.loginCode.fail,null,n)};console.log("===========>ChannelType=",e.ChannelType),this.platform(e.ChannelType).Login(i,e,a,l)}),r(o,"tuyooBind",function(e,t,r){var i=this;console.log("tuyoo-bind-request",e);try{this.HttpLib(e,function(e,r){console.log("tuyoo-bind-response",e,r);var n=JSON.parse(r.data);i.IsNull(n.result)?t.call(i,h.loginCode.fail,null,n):0===n.result.code?t.call(i,n.result.code,n.result):t.call(i,n.result.code,n.result,n.result.info)},function(e,r){t.call(i,h.loginCode.fail,null,r)},i)}catch(e){console.log("tuyoo-bind-catch",e),t.call(i,h.loginCode.fail,null,e)}}),r(o,"Pay",function(e,t,r){console.log("==========>start pay "),this.IsNull(e.extraParams)===!1&&this.isJSON(JSON.stringify(e.extraParams))?null==e.extraParams.sdk_order_track_id||""===e.extraParams.sdk_order_track_id?e.sdk_order_track_id=this.CreateUUID(32,16):e.sdk_order_track_id=e.extraParams.sdk_order_track_id:e.sdk_order_track_id=this.CreateUUID(32,16),this.IsNull(e.ChargeType)&&(e.ChargeType=this.platform().ChargeType),this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_START,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_pay_type:e.ChargeType}),"tuyoo"!==e.ChargeType?this.realPay(e,t,r,e.ChargeType):this.payui(e,t,r)}),r(o,"isString",function(e){return"[object String]"===Object.prototype.toString.call(e)}),r(o,"Order",function(e,t,r){var i=this;if(void 0===e.prodCount&&(e.prodCount=1),void 0===e.appInfo&&(e.appInfo=""),void 0===e.prodOrderId&&(e.prodOrderId=""),i.IsNull(i.wxAppId)||(e.wxAppId=i.wxAppId),console.log("------- self.platformPay(args.ChargeType) ----------",i.platformPay(e.ChargeType)),!i.IsNull(i.platformPay(e.ChargeType).Order))return i.platformPay(e.ChargeType).Order(i,e,t,r);if(i.IsNull(i.userId)||0===i.userId||"0"===i.userId)return this.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,{sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:h.payCode.fail,sdk_error_msg:"用户信息不合法",sdk_pay_type:e.ChargeType}),void t.call(r,h.payCode.fail,null,"用户信息不合法");var n={imei:"null",chargeType:e.ChargeType,userId:i.userId,appId:i.appId,gameId:i.gameId,mustcharge:"1",uuid:i.uuid(),clientId:i.clientId,prodId:e.prodId,prodName:e.prodName,prodCount:e.prodCount,prodPrice:e.prodPrice,appInfo:e.appInfo,prodOrderId:e.prodOrderId,sdk_session_id:i.bi.sessionId,sdk_order_track_id:e.sdk_order_track_id,original_deviceid:i.uuid()};if(i.IsNull(e.extraParams)===!1&&i.isJSON(JSON.stringify(e.extraParams)))for(var o in e.extraParams)i.IsNull(n[o])&&(n[o]=e.extraParams[o]);i.platformPay(e.ChargeType).ExtraOrderParams(i,e,n);var a={url:i.orderuri(),postdata:n};i.bi.ReportGAWithType(this,this.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_START,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId}),i.HttpLib(a,function(o,a){var s;if(s=i.isString(a.data)?JSON.parse(a.data):a.data,s&&null!==s.result)if(0===s.result.code){var l=s.result.chargeInfo;i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_SUCC,{sdk_pay_type:l.chargeType,sdk_order_id:l?l.platformOrderId:"DEFAULT",sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id});var c;try{c=s.result.payData}catch(e){c=null,console.log("=============> 没有paydata数据",e)}var d=function(n,o,a){var s={sdk_pay_type:l.chargeType,sdk_order_id:l.platformOrderId,sdk_game_order_id:l.prodOrderId,sdk_product_id:l.prodId,sdk_order_track_id:e.sdk_order_track_id};0===n?i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_SUCC,s):n===h.payCode.navigatePayPageSucc?i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_LAUNCH_SUCC,s):(s.sdk_error_code=n,s.sdk_error_msg=a,i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_PAY_FAIL,s));var c=[];for(var d in arguments)c.push(arguments[d]);t.apply(r,c)};console.log(e.ChargeType),l.sdk_order_track_id=e.sdk_order_track_id,i.platformPay(e.ChargeType).Pay(i,l,c,d,i)}else{if(i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:s.result.code,sdk_error_msg:JSON.stringify(s.result)}),!i.IsNull(i.platformPay(e.ChargeType).dealOrderFail)){var _=function(n,o,a){console.log("=============> dealOrderFail hook status",n),n===h.dealOrderFailCode.needReOrder?i.Order(e,t,r):this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(r,h.payCode.fail,null,s.result.info):t.call(r,30315,null,s.result.info)};return void i.platformPay(e.ChargeType).dealOrderFail(i,s.result,_)}this.IsNull(s.result.err_code)||30315!==s.result.err_code?t.call(r,h.payCode.fail,null,s.result.info):t.call(r,30315,null,s.result.info)}else i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:"DEFAULT",sdk_error_msg:JSON.stringify(s)}),t.call(r,h.payCode.fail,null,s)},function(o,a){i.bi.ReportGAWithType(i,i.bi.GA_TYPE.PAY,u.GAEvents.SDK_C_ORDER_FAIL,{sdk_pay_type:n.chargeType,sdk_order_track_id:e.sdk_order_track_id,sdk_game_order_id:e.prodOrderId,sdk_product_id:e.prodId,sdk_error_code:o,sdk_error_msg:a}),t.call(r,h.payCode.fail,null,a)},i)}),r(o,"realNameAuth",function(e,t){var r=this,i=function(e,i,n){var o=[];for(var a in arguments)o.push(arguments[a]);try{t.apply(r,o)}catch(e){console.log("----------tuyoosdk.realNameAuth-->err:",e)}},n={retryMax:1,url:r.baseuri+"/open/v6/user/update/sync/third",postdata:{imei:"null",idfa:"",appId:r.appId,gameId:r.gameId,clientId:r.clientId,packageName:r.packageName,uuid:r.uuid(),userId:r.userId}},o=function(e,t,n){console.log("===========>snsHook",t,n),0===e?r.IsNull(r.platform().syncThird)?r.syncThird(t,i):r.platform().syncThird(t,i):i.call(r,h.verifyCode.fail,null,n)};r.IsNull(r.platform().realNameAuth)?t.call(r,h.verifyCode.fail,null,"无渠道实名方法"):this.platform().realNameAuth(r,e,n,o)}),r(o,"syncThird",function(e,t){var r=this;console.log("tuyoo-syncThird-request",e),r.HttpLib(e,function(e,i){if(r.isString(i.data))var n=JSON.parse(i.data);else var n=i.data;n.result&&null!==n.result?(console.log("syncThird=============> "+JSON.stringify(n.result)),0===n.result.code?t.call(r,h.verifyCode.success,n.result,null):t.call(r,h.verifyCode.fail,null,n.result.info)):t.call(r,h.verifyCode.fail,null,n)},function(e,i){t.call(r,h.verifyCode.fail,null,i)},r)}),r(o,"ShowBuoy",function(){this.platform().ShowBuoy()}),r(o,"HideBuoy",function(){this.platform().HideBuoy()}),r(o,"ShoutCat",function(){this.platform().ShoutCat()}),r(o,"OnExit",function(){this.platform().onExit()}),r(o,"onExit",function(e){this.platform().onExit(e)}),r(o,"HttpLib",function(e,t,r,i){var n=this;void 0===e.retry&&(e.retry=0),void 0===e.retryMax&&(e.retryMax=0),void 0===e.method&&(e.method="POST"),void 0===e.headers&&(e.headers={"content-type":"application/x-www-form-urlencoded"});var o=function(e){l.ajax(n,e)};try{var a=this.platform(),s=!1;if("dmm.global.h5"!==a.ChannelType?s=!0:e.url!==n.config.bi_base_url+"api/bilog5/ga"&&(s=!0),s){var c=a.HttpLib;this.IsNull(c)||(o=function(e){c.call(a,n,e)})}}catch(e){}o({url:e.url,type:e.method,dataType:"json",headers:e.headers,data:e.postdata,success:function(o){console.log(e.url,">>请求结果》》》",o);try{var a={data:o.responseText,status:o.status},s={};"string"==typeof a.data?s=JSON.parse(a.data):(s=a.data,a.data=JSON.stringify(a.data)),n.IsNull(s.error)===!1?r.call(i,1009,s):t.call(i,0,a)}catch(e){t.call(i,0,a)}},error:function(o){console.log("网络异常",e.url),e.retry

    "+e.prodName+'

    \t
  • 微信支付
  • \t
  • 支付宝支付
  • \t

    选择支付方式

    ¥ '+e.prodPrice+"

    "+e.prodName+'

    \t
    \t\t
    微信支付
    \t\t
    支付宝支付
    \t
    ',l=document.createElement("div");l.setAttribute("id","payui"),l.innerHTML=s,document.getElementsByTagName("body")[0].appendChild(l)}),r(o,"realPay",function(e,t,r,i,n){var o=this;if(!this.IsNull(n)){console.log("==========>start pay ");var a=n||event;a.stopPropagation()}e.ChargeType=i;var s=function(e,i,n){var o=[];for(var a in arguments)o.push(arguments[a]);try{t.apply(r,o)}catch(e){console.log("应用层代码出错了--->"),console.log(e)}};try{o.Order(e,s,o)}catch(e){console.log("order error--->",e.toString())}}),r(o,"hidePay",function(e){var t=document.getElementById("payui");document.getElementsByTagName("body")[0].removeChild(t)}),r(o,"LoginByToken",function(e,t){var r=this,i={appId:e.appId,clientId:e.clientId,token:e.token,imei:null},n={url:r.baseuri+"/open/v4/user/loginByToken",postdata:i};r.HttpLib(n,function(e,i,n){if(0===e){var o=JSON.parse(i.data);if(null!==o.result)if(console.log("--------->message",o),0===o.result.code){var a={userId:o.result.userId,token:o.result.token,logindata:o.result};r.userId=o.result.userId,t.call(r,h.loginCode.success,a,null)}else t.call(r,h.loginCode.fail,null,o.result)}})}),r(o,"QueryOrderStatus",function(e,t){var r=this,i={appId:r.config.appId,clientId:r.config.clientId,platformOrderId:e.platformOrderId,userId:r.userId},n={url:r.baseuri+"/open/v4/pay/query",postdata:i};r.HttpLib(n,function(e,i,n){if(0===e){var o=JSON.parse(i.data);if(void 0!==o.error&&t.call(r,h.payCode.fail,null,"orderId not exist"),void 0!==o.result){var a={status:"notPaid"},e=o.result.status;"41"===e.toString()&&(a.status="paid",t.call(r,h.payCode.success,a,null)),t.call(r,h.payCode.success,a,null)}}})}),r(o,"Ad",function(){return this.IsNull(this.platform().Ad)?void console.error(this.platform().ChannelType+" not support Ad"):this.platform().Ad()}),r(o,"getDeviceBenchmarkLevel",function(e,t){this.IsNull(this.platform().getDeviceBenchmarkLevel)?console.error(this.platform().ChannelType+" not support getDeviceBenchmarkLevel"):this.platform().getDeviceBenchmarkLevel(this,e,t)}),o)),f=new p;!function(r,o){"object"===a(exports)?e.exports=o():(i=o,n="function"==typeof i?i.call(exports,t,exports,e):i,!(void 0!==n&&(e.exports=n)))}(void 0,function(){return f})},function(e,exports,t){function r(e){function t(){}return t.prototype=e,new t}function i(e,t){var i;i="function"==typeof Object.create?Object.create(t.prototype):r.create(t.prototype),i.constructor=e,e.prototype=i}var n,o,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function e(t,r){return function(){function n(){if("undefined"==typeof n.prototype.ctor);else{var e=new Array;for(var t in arguments)e.push(arguments[t]);n.prototype.ctor.apply(this,e)}}var o=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/,_super=t.prototype;i(n,t);var a=n.prototype;"undefined"==typeof _super||"undefined"==typeof _super.ctor&&(_super.ctor=t),n.extend=function(t){return e(n,t)};for(var s in r)a[s]="function"==typeof r[s]&&"function"==typeof _super[s]&&o.test(r[s])?function(e,t){return function(){var r=this._super;this._super=_super[e];var i=new Array;for(var n in arguments)i.push(arguments[n]);var o=t.apply(this,i);return this._super=r,o}}(s,r[s]):r[s];return n}()},l=s(function(){},{});!function(r,i){"object"===a(exports)?e.exports=i():(n=i,o="function"==typeof n?n.call(exports,t,exports,e):n,!(void 0!==o&&(e.exports=o)))}(void 0,function(){return l})},function(e,exports,t){"use strict";var r=t(1),i=r.extend({IsWxApp:function(){try{if(void 0!==wx.request)return!0}catch(e){return!1}},IncludeWxChannel:function(e){return"xiaomi.cn.minigame"===e.type},ajax:function(e,t){if(t=t||{},t.cache=t.cache||!1,!t.url)throw new Error("参数不合法");if(this.IsWxApp()&&!this.IncludeWxChannel(e)){t.type=(t.type||"GET").toUpperCase(),t.data=t.data||{};var r=this.formateParams(t.data,t.cache);"GET"===t.type?(t.url=r?t.url+"?"+r:t.url,wx.request({url:t.url,method:"GET",header:{Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})):wx.request({url:t.url,method:"POST",data:r,header:{"content-type":"application/x-www-form-urlencoded",Accept:"application/json"},success:function(e){t.success({responseText:e.data,status:e.statusCode})},fail:function(){t.error&&t.error("")}})}else t.dataType=(t.dataType||"json").toLowerCase(),"jsonp"==t.dataType?this.ajaxJSONP(t):"json"==t.dataType&&this.ajaxJSON(t)},ajaxJSONP:function(e){e.data=e.data||{},e.jsonp=e.jsonp||"callback";var t="jsonp_"+(new Date).getTime();e.data[e.jsonp]=t;var r=this.formateParams(e.data,e.cache),i=document.getElementsByTagName("head")[0],n=document.createElement("script");i.appendChild(n),window[t]=function(r){i.removeChild(n),clearTimeout(n.timer),window[t]=null,e.success&&e.success(r)},n.src=r?e.url+"?"+r:e.url,e.time&&(n.timer=setTimeout(function(){window[t]=null,i.removeChild(n),e.error&&e.error({message:"超时"})},e.time))},ajaxJSON:function(e){e.type=(e.type||"GET").toUpperCase(),e.data=e.data||{};var t,r=this.formateParams(e.data,e.cache);if(t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),t.onreadystatechange=function(){4===t.readyState&&(200===t.status?e.success&&("string"==typeof t.responseText?e.success(t):e.success(t)):e.error&&e.error(t.status))},"GET"===e.type)t.open("GET",r?e.url+"?"+r:e.url,!0),t.send(null);else{if(e.headers&&"application/json"==e.headers["Content-Type"]){t.open("POST",e.url,!0);for(var i in e.headers)t.setRequestHeader(i,e.headers[i]);return void t.send(JSON.stringify(e.data))}t.open("POST",r?e.url+"?"+r:e.url,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(r)}},formateParams:function(e,t){var r=[];for(var i in e)r.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t&&r.push("v="+(new Date).getTime()),r.join("&")}});e.exports=new i},function(e,exports,t){var r,i,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=t(1),a=o.extend({_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",checkOs:function(){var e=navigator.userAgent,t=(navigator.appVersion,e.indexOf("Android")>-1||e.indexOf("Linux")>-1),r=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return t?"ANDROID":r?"IOS":void 0},getDeviceType:function(){return navigator&&navigator.userAgentData&&navigator.userAgentData.mobile?"Mobile":/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?"Mobile":"Browser"},encode:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},decode:function(e){return decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))},open_pay_url:function(e){this.showDetail(event,e)},pay_url:function(e){if("IOS"==s.checkOs()){console.log("pay ios ===>",e);var t=document.createElement("iframe");t.href=e,t.target="_self",top.location.href=location.href,t.click(),window.location.href=e,setTimeout(function(){document.body.removeChild(t)},3e3)}else{console.log("pay android ===>",e);var r=document.createElement("a");r.href=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}},showDetail:function(e,t){window.tysdk=this;var r=document.getElementsByTagName("head")[0],i="https://downqn.tuyoo.com/h5sdk/v100/src/css/style.css",n=document.createElement("link");n.href=i,n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css");var o=document.createElement("meta");o.setAttribute("name","viewport"),o.setAttribute("content","width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes"),r.appendChild(o),r.appendChild(n);var a='
    充值中心 X
    ',s=document.createElement("div");s.setAttribute("id","detailui"),s.innerHTML=a,document.getElementsByTagName("body")[0].appendChild(s)},fadeoutDetail:function(e){var t=e||event;t.stopPropagation();var r=document.getElementById("detailui");document.getElementsByTagName("body")[0].removeChild(r)},changeFrameHeight1:function(){var e=document.getElementById("myiframe");e.height=document.documentElement.clientHeight; +},Login_SIGN:function(e,t,r,i){var n=this.decode(i),o="userID="+e+"&clientID="+t+"&gameID="+r+"&signKey="+n;return this.signature(o)},signature:function(e){function t(e,t){var r,i,n,o,a;return n=2147483648&e,o=2147483648&t,r=1073741824&e,i=1073741824&t,a=(1073741823&e)+(1073741823&t),r&i?2147483648^a^n^o:r|i?1073741824&a?3221225472^a^n^o:1073741824^a^n^o:a^n^o}function r(e,r,i,n,o,a,s){return e=t(e,t(t(r&i|~r&n,o),s)),t(e<>>32-a,r)}function i(e,r,i,n,o,a,s){return e=t(e,t(t(r&n|i&~n,o),s)),t(e<>>32-a,r)}function n(e,r,i,n,o,a,s){return e=t(e,t(t(r^i^n,o),s)),t(e<>>32-a,r)}function o(e,r,i,n,o,a,s){return e=t(e,t(t(i^(r|~n),o),s)),t(e<>>32-a,r)}function a(e){var t,r="",i="";for(t=0;3>=t;t++)i=e>>>8*t&255,i="0"+i.toString(16),r+=i.substr(i.length-2,2);return r}var s,l,c,d,u,h,_,p,f=[];for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;ri?t+=String.fromCharCode(i):(127i?t+=String.fromCharCode(i>>6|192):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128)),t+=String.fromCharCode(63&i|128))}return t}(e),f=function(e){var t,r=e.length;t=r+8;for(var i=16*((t-t%64)/64+1),n=Array(i-1),o=0,a=0;a>>29,n}(e),u=1732584193,h=4023233417,_=2562383102,p=271733878,e=0;e>5]|=(e.charCodeAt(o/8)&r)<>2]>>8*(o%4)&255)<<16|(t[o+1>>2]>>8*((o+1)%4)&255)<<8|t[o+2>>2]>>8*((o+2)%4)&255,s=0;s<4;s++)n+=8*o+6*s>32*t.length?"":i.charAt(a>>6*(3-s)&63);return n}}),s=new a;!function(o,a){"object"===n(exports)?e.exports=a():(r=a,i="function"==typeof r?r.call(exports,t,exports,e):r,!(void 0!==i&&(e.exports=i)))}(void 0,function(){return s})},function(e,exports,t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;t0){var i=function(r){t.deleteCache(e),t.reportCacheData()};this.httpRequestWithLimit(r,i)}else this.reportCacheData()},processArray2String:function(e){if(e){var t="";return e.forEach(function(e){t+=e+"\n"}),t}},reportCacheData:function(){var e=this.getCacheWithLimitCount(this.gaLocalCacheData,10);e&&e.length>0&&this.reportGALog(e)},getCacheWithLimitCount:function(e,t){if(e){for(var r=[],i=Array.from(e),n=i.length>t?t:i.length,o=0;o100&&this.gaLocalCacheData.shift())},deleteCache:function(e){var t=this;e&&this.gaLocalCacheData&&e.forEach(function(e){t.gaLocalCacheData.indexOf(e)>-1&&t.gaLocalCacheData.splice(t.gaLocalCacheData.indexOf(e),1)})},httpRequest:function(e){var t=this;this.config&&this.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var r={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(r,function(e,r){t.tuyoo.config&&t.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+r)},function(e,t){console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})},httpRequestWithLimit:function(e,t){var r=this;if(!this.biLimitState){this.biLimitState=!0,this.tuyoo.config&&this.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : "+JSON.stringify(e));var i={url:this.config.bi_base_url+"api/bilog5/ga",postdata:e,headers:{"Content-Type":"application/json"}};this.tuyoo.HttpLib(i,function(e,i){r.biLimitState=!1,200==i.status&&t&&t(i.data),r.tuyoo.config&&r.tuyoo.config.debug&&console.log("GAMESSAGE_LOG : Report Succ. "+e+" "+i)},function(e,t){r.biLimitState=!1,console.error("GAMESSAGE_LOG : Report Fail."+e+" "+t)})}}});e.exports=a},function(e,exports){"use strict";var t=t||{};t.initCode={success:0,fail:-1},t.loginCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.payCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1001,navigatePayPageSucc:1e3},t.smsCode={success:t.initCode.success,fail:t.initCode.fail,cancle:1},t.biCode={success:0,fail:-1},t.verifyCode={success:t.initCode.success,fail:t.initCode.fail},t.shareCode={success:t.initCode.success,fail:t.initCode.fail},t.dealOrderFailCode={continue:t.initCode.success,needReOrder:t.initCode.fail},t.loginEvent={success:"登录成功",fail:"登录失败",cancle:"登录取消",sns_error:"snsId为undefined"},t.payEvent={success:"支付成功",fail:"支付失败",cancle:"支付取消",invalid:"支付方式无效"},t.initEvent={success:"初始化成功",fail:"初始化失败",url_null:"初始化URL为空"},t.biEvent={success:"上报成功",fail:"上报失败"},t.verifyEvent={success:"认证成功",fail:"认证失败"},e.exports=t},function(e,exports){"use strict";var t={GAEvents:{SDK_INIT_ENT:"sdk_c_init_end",SDK_LOGIN_START:"sdk_c_login_start",SDK_LOGIN_SUCC:"sdk_c_login_succ",SDK_LOGIN_FAIL:"sdk_c_login_fail",SDK_BIND_START:"sdk_c_bind_start",SDK_BIND_SUCC:"sdk_c_bind_succ",SDK_BIND_FAIL:"sdk_c_bind_fail",SDK_CHANNEL_INIT_START:"sdk_c_channel_init_start",SDK_CHANNEL_INIT_SUCC:"sdk_c_channel_init_succ",SDK_CHANNEL_INIT_FAIL:"sdk_c_channel_init_fail",SDK_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_LOGIN_BY_SDKSERVER_START:"sdk_c_login_by_sdkserver_start",SDK_LOGIN_BY_SDKSERVER_SUCC:"sdk_c_login_by_sdkserver_succ",SDK_LOGIN_BY_SDKSERVER_FAIL:"sdk_c_login_by_sdkserver_fail",SDK_PAY_START:"sdk_c_pay_start",SDK_PAY_SUCC:"sdk_c_pay_succ",SDK_PAY_FAIL:"sdk_c_pay_fail",SDK_PAY_LAUNCH_SUCC:"sdk_c_pay_launch_succ",SDK_C_ORDER_START:"sdk_c_order_start",SDK_C_ORDER_SUCC:"sdk_c_order_succ",SDK_C_ORDER_FAIL:"sdk_c_order_fail",SDK_C_REQUEST_CHANNEL_PAY_START:"sdk_c_request_channel_pay_start",SDK_C_REQUEST_CHANNEL_PAY_SUCC:"sdk_c_request_channel_pay_succ",SDK_C_REQUEST_CHANNEL_PAY_FAIL:"sdk_c_request_channel_pay_fail",SDK_C_LOGIN_BY_CHANNEL_START:"sdk_c_login_by_channel_start",SDK_C_LOGIN_BY_CHANNEL_SUCC:"sdk_c_login_by_channel_succ",SDK_C_LOGIN_BY_CHANNEL_FAIL:"sdk_c_login_by_channel_fail",SDK_SHARE_START:"sdk_c_share_start",SDK_SHARE_SUCC:"sdk_c_share_succ",SDK_SHARE_FAIL:"sdk_c_share_fail",SDK_C_GAME_LAUNCH:"sdk_c_game_launch",SDK_C_VERIFY:"sdk_c_verify"}};e.exports=t},function(e,exports,t){"use strict";var r=t(8),i=new r,n={"bytedance.cn.iap":i},o={"bytedance.cn.iap":i,"bytedance.cn.minigame.ios":i,"bytedance.cn.minigame.iap.prop":i,"bytedance.cn.minigame.ios.prop":i},a={"bytedance.cn.iap":i};e.exports={tyLoginInterface:n,tyPayInterface:o,tyInitInterface:a}},function(e,exports,t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;tstatus: "+e+" \n error : "+r),100504==e&&this.loginParams.isShowLimitToast!==!1&&(this.tuyoo.bi.ReportGAWithType(this.tuyoo,this.tuyoo.bi.GA_TYPE.LOGIN,"sdk_c_receive_gateway_limit_info",{gateway_info:r}),tt.showModal({title:"温馨提示",content:r||"当前玩家过多,请稍后再试~",showCancel:!1,success:function(e){console.log(e)},fail:function(e){console.log(e)}}))}catch(e){console.error("bytedance minigame LoginEnd",e)}},ExtraOrderParams:function(e,t,r){var i=this;t.ChargeType!==this.CHARGE_TYPE.ANDROID_MICRO_PAY_TYPE||tt.canIUse("requestGamePayment.object.goodType")?r.chargeType=t.ChargeType?t.ChargeType:this.ChargeType:r.chargeType=this.CHARGE_TYPE.ANDROID_PAY_TYPE,r.bytedance_appId=this.config.bytedanceAppId,r.osName=this.channelSystemInfo.platform,r.os_version=i.channelSystemInfo.system,r.sdk_origin_device_level_info=JSON.stringify(i.channelSystemInfo.deviceScore),r.sdk_device_brand=i.channelSystemInfo.brand,r.phone_model=i.channelSystemInfo.model},Pay:function(e,t,r,i,n){var s=this,l=this;e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_START,l.getGaParams(t,null)),tt.checkSession({success:function(a){t.chargeType==l.ChargeType||t.chargeType==s.CHARGE_TYPE.ANDROID_MICRO_PAY_TYPE?l.androidPay(e,t,r,i,n):t.chargeType==s.CHARGE_TYPE.IOS_PAY_TYPE||t.chargeType==s.CHARGE_TYPE.IOS_MICRO_PAY_TYPE?l.iOSPay(e,t,r,i,n):i.call(e,o.payCode.fail,null,"支付方式不匹配")},fail:function(r){e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,l.getGaParams(t,{sdk_channel_error_msg:JSON.stringify(r)})),i.call(e,o.payCode.fail,null,JSON.stringify(r))}})},androidPay:function(e,t,r,i,n){var s=this,l=t.chargeData,c={mode:"game",env:0,currencyType:"CNY",platform:"android",zoneId:"1",customId:t.platformOrderId,extraInfo:"",success:function(r){e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_SUCC,s.getGaParams(t,null)),i.call(n,o.payCode.success,r,null),s.notifyService(e,t)},fail:function(r){e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,s.getGaParams(t,{sdk_channel_error_coe:r.errCode,sdk_channel_error_msg:JSON.stringify(r)})),i.call(n,o.payCode.fail,null,r)},complete:function(e){}};t.chargeType===this.CHARGE_TYPE.ANDROID_MICRO_PAY_TYPE?(c.goodType=l.goodType,c.orderAmount=l.orderAmount,c.goodName=t.diamondName):c.buyQuantity=l.buyQuantity,console.log("pay info",c),tt.requestGamePayment(c)},iOSPay:function(e,t,r,i,n){var s=this,l=t.chargeData,c={buyQuantity:l.buyQuantity,zoneId:l.zoneId?l.zoneId:"1",customId:t.platformOrderId,extraInfo:"",success:function(r){e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_SUCC,s.getGaParams(t,null)),i.call(n,o.payCode.success,r,null),s.notifyService(e,t)},fail:function(r){e.bi.ReportGAWithType(e,e.bi.GA_TYPE.PAY,a.GAEvents.SDK_C_REQUEST_CHANNEL_PAY_FAIL,s.getGaParams(t,{sdk_channel_error_code:r.errCode,sdk_channel_error_msg:JSON.stringify(r)})),i.call(n,o.payCode.fail,null,JSON.stringify(r))},complete:function(e){}};t.chargeType==this.CHARGE_TYPE.IOS_MICRO_PAY_TYPE?c.currencyType=l.currencyType:c.currencyType="CNY",tt.openAwemeCustomerService(c)},notifyService:function(e,t){var r={appid:this.config.bytedanceAppId,cp_orderno:t.platformOrderId},i={retryMax:2,url:e.baseuri+"/open/ve/pay/bytedance/iap/callback",postdata:{msg:JSON.stringify(r),bytedance_appId:this.config.bytedanceAppId,platformOrderId:t.platformOrderId}};e.HttpLib(i,function(e,t){},function(e,t){},this)},getGaParams:function(e,t){var r={sdk_pay_type:this.ChargeType};return!this.IsNull(e)&&this.isJSON(JSON.stringify(e))&&(r.sdk_pay_type=e.chargeType,r.sdk_order_track_id=e.sdk_order_track_id,r.sdk_order_id=e.platformOrderId,r.sdk_game_order_id=e.prodOrderId,r.sdk_product_id=e.prodId),!this.IsNull(t)&&this.isJSON(JSON.stringify(t))&&(r=i(r,t)),r},isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!=("undefined"==typeof t?"undefined":r(t))||!t)}catch(e){return!1}return!1},base64:function(e){for(var t=Array(),r=255,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",o=0;o<8*e.length;o+=8)t[o>>5]|=(e.charCodeAt(o/8)&r)<>2]>>8*(o%4)&255)<<16|(t[o+1>>2]>>8*((o+1)%4)&255)<<8|t[o+2>>2]>>8*((o+2)%4)&255,s=0;s<4;s++)n+=8*o+6*s>32*t.length?"":i.charAt(a>>6*(3-s)&63);return n},Logout:function(){},onExit:function(){},IsNull:function(e){return void 0===e||null===e||""===e},SetDefaultShareInfo:function(e,t){this._DefaultShareInfo=t},initShare:function(e){var t=this,r=this;tt.canIUse("showShareMenu")&&tt.showShareMenu({}),tt.onShareAppMessage(function(n){console.log("SDKTEST ","tt.onShareAppMessage ",n.channel);var o="video"===n.channel?"video":"nomal",s={shareType:o,useDefault:!0},l=t.assembleShareData(e,s);l.extraParams.sdk_share_type="right_top_"+o;var c={sdk_c_share_track_id:e.CreateUUID()};c=i(c,l.extraParams),e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_START,c);var d=function(t,i,n){0==t?e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_SUCC,c):(c.sdk_channel_error_msg=n,e.bi.ReportGAWithType(e,e.bi.GA_TYPE.TRACK,a.GAEvents.SDK_SHARE_FAIL,c)),r._DefaultShareInfo&&r._DefaultShareInfo.callback&&r._DefaultShareInfo.callback.call(e,t,i,n)};if("video"===o){var u=r.assembleVideoShareData(l,d);return u}var u=r.assembleInviteShareData(l,d);return u}),tt.onShow(function(t){r.getShareInfoFromServer(e)})},shuffleByWeights:function(e,t){var r,i="video"===e?this._videoShareServerInfoCached:this._inviteShareServerInfoCached;if(i){var n=i[t];if(this.IsNull(n)||0==n.length)r=n;else if(1==n.length)r=n[0];else for(var o=n.reduce(function(e,t){return e+t.weight},0),a=Math.random()*o,s=0;s>>6,a[l++]=128|63&n):n<55296||n>=57344?(a[l++]=224|n>>>12,a[l++]=128|n>>>6&63,a[l++]=128|63&n):(n=65536+((1023&n)<<10|1023&e.charCodeAt(++r)),a[l++]=240|n>>>18,a[l++]=128|n>>>12&63,a[l++]=128|n>>>6&63,a[l++]=128|63&n);e=a}e.length>64&&(e=new o(!0).update(e).array());var c=[],d=[];for(r=0;r<64;++r){var u=e[r]||0;c[r]=92^u,d[r]=54^u}o.call(this,t),this.update(d),this.oKeyPad=c,this.inner=!0,this.sharedMemory=t}var s="input is invalid type",l="finalize already called",c="object"==typeof window,d=c?window:{};d.JS_MD5_NO_WINDOW&&(c=!1);var u=!c&&"object"==typeof self,h=!d.JS_MD5_NO_NODE_JS&&"object"==typeof i&&i.versions&&i.versions.node;h?d=n:u&&(d=self);var _,p=!d.JS_MD5_NO_COMMON_JS&&"object"==typeof e&&e.exports,f=t(11),y=!d.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,g="0123456789abcdef".split(""),m=[128,32768,8388608,-2147483648],I=[0,8,16,24],v=["hex","array","digest","buffer","arrayBuffer","base64"],S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),A=[];if(y){var C=new ArrayBuffer(68);_=new Uint8Array(C),A=new Uint32Array(C)}var T=Array.isArray;!d.JS_MD5_NO_NODE_JS&&T||(T=function(e){return"[object Array]"===Object.prototype.toString.call(e)});var b=ArrayBuffer.isView;!y||!d.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&b||(b=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var E=function(e){var t=typeof e;if("string"===t)return[e,!0];if("object"!==t||null===e)throw new Error(s);if(y&&e.constructor===ArrayBuffer)return[new Uint8Array(e),!1];if(!T(e)&&!b(e))throw new Error(s);return[e,!1]},k=function(e){return function(t){return new o(!0).update(t)[e]()}},N=function(){var e=k("hex");h&&(e=P(e)),e.create=function(){return new o},e.update=function(t){return e.create().update(t)};for(var t=0;t>>6,c[i++]=128|63&r):r<55296||r>=57344?(c[i++]=224|r>>>12,c[i++]=128|r>>>6&63,c[i++]=128|63&r):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++o)),c[i++]=240|r>>>18,c[i++]=128|r>>>12&63,c[i++]=128|r>>>6&63,c[i++]=128|63&r);else for(i=this.start;o>>2]|=r<>>2]|=(192|r>>>6)<>>2]|=(128|63&r)<=57344?(s[i>>>2]|=(224|r>>>12)<>>2]|=(128|r>>>6&63)<>>2]|=(128|63&r)<>>2]|=(240|r>>>18)<>>2]|=(128|r>>>12&63)<>>2]|=(128|r>>>6&63)<>>2]|=(128|63&r)<>>2]|=e[o]<=64?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},o.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>>2]|=m[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},o.prototype.hash=function(){var e,t,r,i,n,o,a=this.blocks;this.first?(e=a[0]-680876937,e=(e<<7|e>>>25)-271733879<<0,i=(-1732584194^2004318071&e)+a[1]-117830708,i=(i<<12|i>>>20)+e<<0,r=(-271733879^i&(e^-271733879))+a[2]-1126478375,r=(r<<17|r>>>15)+i<<0,t=(e^r&(i^e))+a[3]-1316259209,t=(t<<22|t>>>10)+r<<0):(e=this.h0,t=this.h1,r=this.h2,i=this.h3,e+=(i^t&(r^i))+a[0]-680876936,e=(e<<7|e>>>25)+t<<0,i+=(r^e&(t^r))+a[1]-389564586,i=(i<<12|i>>>20)+e<<0,r+=(t^i&(e^t))+a[2]+606105819,r=(r<<17|r>>>15)+i<<0,t+=(e^r&(i^e))+a[3]-1044525330,t=(t<<22|t>>>10)+r<<0),e+=(i^t&(r^i))+a[4]-176418897,e=(e<<7|e>>>25)+t<<0,i+=(r^e&(t^r))+a[5]+1200080426,i=(i<<12|i>>>20)+e<<0,r+=(t^i&(e^t))+a[6]-1473231341,r=(r<<17|r>>>15)+i<<0,t+=(e^r&(i^e))+a[7]-45705983,t=(t<<22|t>>>10)+r<<0,e+=(i^t&(r^i))+a[8]+1770035416,e=(e<<7|e>>>25)+t<<0,i+=(r^e&(t^r))+a[9]-1958414417,i=(i<<12|i>>>20)+e<<0,r+=(t^i&(e^t))+a[10]-42063,r=(r<<17|r>>>15)+i<<0,t+=(e^r&(i^e))+a[11]-1990404162,t=(t<<22|t>>>10)+r<<0,e+=(i^t&(r^i))+a[12]+1804603682,e=(e<<7|e>>>25)+t<<0,i+=(r^e&(t^r))+a[13]-40341101,i=(i<<12|i>>>20)+e<<0,r+=(t^i&(e^t))+a[14]-1502002290,r=(r<<17|r>>>15)+i<<0,t+=(e^r&(i^e))+a[15]+1236535329,t=(t<<22|t>>>10)+r<<0,e+=(r^i&(t^r))+a[1]-165796510,e=(e<<5|e>>>27)+t<<0,i+=(t^r&(e^t))+a[6]-1069501632,i=(i<<9|i>>>23)+e<<0,r+=(e^t&(i^e))+a[11]+643717713,r=(r<<14|r>>>18)+i<<0,t+=(i^e&(r^i))+a[0]-373897302,t=(t<<20|t>>>12)+r<<0,e+=(r^i&(t^r))+a[5]-701558691,e=(e<<5|e>>>27)+t<<0,i+=(t^r&(e^t))+a[10]+38016083,i=(i<<9|i>>>23)+e<<0,r+=(e^t&(i^e))+a[15]-660478335,r=(r<<14|r>>>18)+i<<0,t+=(i^e&(r^i))+a[4]-405537848,t=(t<<20|t>>>12)+r<<0,e+=(r^i&(t^r))+a[9]+568446438,e=(e<<5|e>>>27)+t<<0,i+=(t^r&(e^t))+a[14]-1019803690,i=(i<<9|i>>>23)+e<<0,r+=(e^t&(i^e))+a[3]-187363961,r=(r<<14|r>>>18)+i<<0,t+=(i^e&(r^i))+a[8]+1163531501,t=(t<<20|t>>>12)+r<<0,e+=(r^i&(t^r))+a[13]-1444681467,e=(e<<5|e>>>27)+t<<0,i+=(t^r&(e^t))+a[2]-51403784,i=(i<<9|i>>>23)+e<<0,r+=(e^t&(i^e))+a[7]+1735328473,r=(r<<14|r>>>18)+i<<0,t+=(i^e&(r^i))+a[12]-1926607734,t=(t<<20|t>>>12)+r<<0,n=t^r,e+=(n^i)+a[5]-378558,e=(e<<4|e>>>28)+t<<0,i+=(n^e)+a[8]-2022574463,i=(i<<11|i>>>21)+e<<0,o=i^e,r+=(o^t)+a[11]+1839030562,r=(r<<16|r>>>16)+i<<0,t+=(o^r)+a[14]-35309556,t=(t<<23|t>>>9)+r<<0,n=t^r,e+=(n^i)+a[1]-1530992060,e=(e<<4|e>>>28)+t<<0,i+=(n^e)+a[4]+1272893353,i=(i<<11|i>>>21)+e<<0,o=i^e,r+=(o^t)+a[7]-155497632,r=(r<<16|r>>>16)+i<<0,t+=(o^r)+a[10]-1094730640,t=(t<<23|t>>>9)+r<<0,n=t^r,e+=(n^i)+a[13]+681279174,e=(e<<4|e>>>28)+t<<0,i+=(n^e)+a[0]-358537222,i=(i<<11|i>>>21)+e<<0,o=i^e,r+=(o^t)+a[3]-722521979,r=(r<<16|r>>>16)+i<<0,t+=(o^r)+a[6]+76029189,t=(t<<23|t>>>9)+r<<0,n=t^r,e+=(n^i)+a[9]-640364487,e=(e<<4|e>>>28)+t<<0,i+=(n^e)+a[12]-421815835,i=(i<<11|i>>>21)+e<<0,o=i^e,r+=(o^t)+a[15]+530742520,r=(r<<16|r>>>16)+i<<0,t+=(o^r)+a[2]-995338651,t=(t<<23|t>>>9)+r<<0,e+=(r^(t|~i))+a[0]-198630844,e=(e<<6|e>>>26)+t<<0,i+=(t^(e|~r))+a[7]+1126891415,i=(i<<10|i>>>22)+e<<0,r+=(e^(i|~t))+a[14]-1416354905,r=(r<<15|r>>>17)+i<<0,t+=(i^(r|~e))+a[5]-57434055,t=(t<<21|t>>>11)+r<<0,e+=(r^(t|~i))+a[12]+1700485571,e=(e<<6|e>>>26)+t<<0,i+=(t^(e|~r))+a[3]-1894986606,i=(i<<10|i>>>22)+e<<0,r+=(e^(i|~t))+a[10]-1051523,r=(r<<15|r>>>17)+i<<0,t+=(i^(r|~e))+a[1]-2054922799,t=(t<<21|t>>>11)+r<<0,e+=(r^(t|~i))+a[8]+1873313359,e=(e<<6|e>>>26)+t<<0,i+=(t^(e|~r))+a[15]-30611744,i=(i<<10|i>>>22)+e<<0,r+=(e^(i|~t))+a[6]-1560198380,r=(r<<15|r>>>17)+i<<0,t+=(i^(r|~e))+a[13]+1309151649,t=(t<<21|t>>>11)+r<<0,e+=(r^(t|~i))+a[4]-145523070,e=(e<<6|e>>>26)+t<<0,i+=(t^(e|~r))+a[11]-1120210379,i=(i<<10|i>>>22)+e<<0,r+=(e^(i|~t))+a[2]+718787259,r=(r<<15|r>>>17)+i<<0,t+=(i^(r|~e))+a[9]-343485551,t=(t<<21|t>>>11)+r<<0,this.first?(this.h0=e+1732584193<<0,this.h1=t-271733879<<0,this.h2=r-1732584194<<0,this.h3=i+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+r<<0,this.h3=this.h3+i<<0)},o.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3;return g[e>>>4&15]+g[15&e]+g[e>>>12&15]+g[e>>>8&15]+g[e>>>20&15]+g[e>>>16&15]+g[e>>>28&15]+g[e>>>24&15]+g[t>>>4&15]+g[15&t]+g[t>>>12&15]+g[t>>>8&15]+g[t>>>20&15]+g[t>>>16&15]+g[t>>>28&15]+g[t>>>24&15]+g[r>>>4&15]+g[15&r]+g[r>>>12&15]+g[r>>>8&15]+g[r>>>20&15]+g[r>>>16&15]+g[r>>>28&15]+g[r>>>24&15]+g[i>>>4&15]+g[15&i]+g[i>>>12&15]+g[i>>>8&15]+g[i>>>20&15]+g[i>>>16&15]+g[i>>>28&15]+g[i>>>24&15]},o.prototype.toString=o.prototype.hex,o.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&r,r>>>8&255,r>>>16&255,r>>>24&255,255&i,i>>>8&255,i>>>16&255,i>>>24&255]},o.prototype.array=o.prototype.digest,o.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},o.prototype.buffer=o.prototype.arrayBuffer,o.prototype.base64=function(){for(var e,t,r,i="",n=this.array(),o=0;o<15;)e=n[o++],t=n[o++],r=n[o++],i+=S[e>>>2]+S[63&(e<<4|t>>>4)]+S[63&(t<<2|r>>>6)]+S[63&r];return e=n[o],i+=S[e>>>2]+S[e<<4&63]+"=="},a.prototype=new o,a.prototype.finalize=function(){if(o.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();o.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),o.prototype.finalize.call(this)}};var exports=N();exports.md5=exports,exports.md5.hmac=O(),p?e.exports=exports:(d.md5=exports,f&&(r=function(){return exports}.call(exports,t,exports,e),!(void 0!==r&&(e.exports=r))))}()}).call(exports,t(10),function(){return this}())},function(e,exports){function t(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===t||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function n(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function o(){p&&h&&(p=!1,h.length?_=h.concat(_):f=-1,_.length&&a())}function a(){if(!p){var e=i(o);p=!0;for(var t=_.length;t;){for(h=_,_=[];++f1)for(var r=1;r("tygameconfig"); + + if (jsonText != null) + { + // 反序列化 JSON 内容 + configData = JsonUtility.FromJson(jsonText.text); + configJsonString = jsonText.text; + } + else + { + Debug.LogError("Failed to load config.json from Resources."); + } + } + + public static string GetChannelType() + { + return configData.tuyooParam.channelType; + } + + } + +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/TYParamsModel.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/TYParamsModel.cs.meta new file mode 100644 index 0000000..88070d9 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/TYParamsModel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a0b3e97d884f9409da0df2a32c500add +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/gameconfig.json b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/gameconfig.json new file mode 100644 index 0000000..5874991 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/gameconfig.json @@ -0,0 +1,47 @@ +{ + "package": "", + "debug": "false", + "tuyooParam": { + "appId": "", + "gameId": "", + "projectId": "", + "clientId": "", + "cloudId": "", + "serverUrl": "", + "channelType": "" + }, + "login": { + "aliminigame": { + "ali_appId": "", + "sdkVersion": "1.0.4.250915_release" + }, + "tywx": { + "wx_appId": "", + "sdkVersion": "1.8.8_20250915_release" + }, + "zijieminigame": { + "bytedanceAppId": "", + "sdkVersion": "1.0.4.250915_release" + }, + "jingdongminigame": { + "jingdongAppId": "", + "sdkVersion": "1.0.1.251009_release" + }, + "oppominigame": { + "oppoAppId": "", + "sdkVersion": "1.0.2.250902_release" + }, + "meituanminigame": { + "meituanAppId": "", + "sdkVersion": "1.0.2.251010_release" + }, + "kuaishouminigame": { + "kuaishouAppId": "", + "sdkVersion": "1.0.3.251023_release" + }, + "xiaomiminigame": { + "xiaomiAppId": "", + "sdkVersion": "1.0.1_20251010_release" + } + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/gameconfig.json.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/gameconfig.json.meta new file mode 100644 index 0000000..98b3fd5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/WebGL/gameconfig.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0551fdc302c6f4bb9982d58715fccf06 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/com.tuyoo.unitysdk.plugin.asmdef b/Packages/com.bywaystudios.tuyoosdk/Plugins/com.tuyoo.unitysdk.plugin.asmdef new file mode 100644 index 0000000..24a7b5b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/com.tuyoo.unitysdk.plugin.asmdef @@ -0,0 +1,19 @@ +{ + "name": "com.tuyoo.unitysdk.plugin", + "rootNamespace": "", + "references": [], + "includePlatforms": [ + "Android", + "Editor", + "iOS", + "WebGL" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/com.tuyoo.unitysdk.plugin.asmdef.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/com.tuyoo.unitysdk.plugin.asmdef.meta new file mode 100644 index 0000000..e79a7c6 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/com.tuyoo.unitysdk.plugin.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2104153dbb22d46e89c9a1195f478f01 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS.meta new file mode 100644 index 0000000..a10196e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 152041c031a714f72900bb583271a813 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.h b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.h new file mode 100644 index 0000000..7f7c7e4 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.h @@ -0,0 +1,12 @@ +// +// SDKManager.h +// Unity-iPhone +// +#import "UnityFramework/UnityAppController.h" +#pragma once + +#import + +@interface SDKManager : UnityAppController + +@end diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.h.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.h.meta new file mode 100644 index 0000000..050a2a4 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: c1d9b16ca18054be6a825b4b5e71aabb +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.mm b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.mm new file mode 100644 index 0000000..45ba3a5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.mm @@ -0,0 +1,68 @@ +// +// SDKManager.c +// Unity-iPhone +// +// + +#import "SDKManager.h" +#import +#import "UnityAppController.h" +#import "UnityInterface.h" +#import "UnityAppController.h" +#import "UnityAppController+ViewHandling.h" +#import "UnityAppController+Rendering.h" +#import "iPhone_Sensors.h" +#import "UnityInterface.h" +#include + +@implementation SDKManager : UnityAppController + +- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { + [super application:application didFinishLaunchingWithOptions:launchOptions]; + [TDKEngineBaseAdapter application:application didFinishLaunchingWithOptions:launchOptions]; + return YES; +} + +- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken +{ +#if UNITY_USES_REMOTE_NOTIFICATIONS + [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; +#endif + [TDKEngineBaseAdapter application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; +} + +- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler +{ +#if UNITY_USES_REMOTE_NOTIFICATIONS + [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:handler]; +#endif + [TDKEngineBaseAdapter application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:handler]; +} + +- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url options:(NSDictionary*)options +{ + [super application:application openURL:url options:options]; + [TDKEngineBaseAdapter application:application openURL:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]; + [TDKEngineBaseAdapter application:application openURL:url options:options]; + return YES; +} + +-(BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { + BOOL result = [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; + [TDKEngineBaseAdapter application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; + return result; +} + +- (void)applicationDidBecomeActive:(UIApplication*)application +{ + [super applicationDidBecomeActive:application]; + [TDKEngineBaseAdapter applicationDidBecomeActive:application]; +} + +-(void)applicationWillTerminate:(UIApplication *)application{ + [super applicationWillTerminate:application]; + [TDKEngineBaseAdapter applicationWillTerminate:application]; +} + +@end +IMPL_APP_CONTROLLER_SUBCLASS(SDKManager); diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.mm.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.mm.meta new file mode 100644 index 0000000..4fd65ab --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/SDKManager.mm.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: bcc22082266734f618747a0fbf208880 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites.meta new file mode 100644 index 0000000..ee023fd --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7ded83bad20e4c6ab0bae24201a1423 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser.meta new file mode 100644 index 0000000..27c0cf8 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4ecb6da5062d445d2ae07c8745b25ae7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/__init__.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/__init__.py new file mode 100644 index 0000000..66d9107 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/__init__.py @@ -0,0 +1,3 @@ +from .openstep_parser import OpenStepDecoder + +__version__ = '2.0.1' diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/__init__.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/__init__.py.meta new file mode 100644 index 0000000..9883a27 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/__init__.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b507d2f571f454ff4aa5da9fe7db7106 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/openstep_parser.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/openstep_parser.py new file mode 100644 index 0000000..c01bd23 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/openstep_parser.py @@ -0,0 +1,206 @@ +# Copyright (c) 2015, Ignacio Calderon +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +import sys + + +_WHITESPACE = frozenset(' \t\n\r') +_UNQUOTED_LITERAL_ENDER = frozenset(';,})').union(_WHITESPACE) +_KEY_ENDER = frozenset(';=').union(_WHITESPACE) +_LITERAL_ESCAPES = {'\\"': '"', "\\'": "'", "\\0": "\0", "\\\\": "\\", "\\n": "\n", "\\t": "\t"} + + +class OpenStepDecoder(object): + @classmethod + def ParseFromFile(cls, fp): + # Check the python version to support unicode files in python 2 + if sys.version_info > (3, 0): + return cls.ParseFromString(fp.read()) + else: + return cls.ParseFromString(fp.read().decode('UTF-8')) + + @classmethod + def ParseFromString(cls, str): + return OpenStepDecoder()._parse(str) + + def _parse(self, str): + # parse the comment if any + index = 0 + if str[0] == '/' and str[1] == '/': + while str[index] != '{': + index += 1 + + result, index = self._parse_dictionary(str, index) + return result + + def _parse_dictionary(self, str, index): + obj = {} + + if str[index] != '{': + raise Exception("Expected { as dictionary start") + + index = self._parse_padding(str, index + 1) + + while str[index] != '}': + index = self._parse_dictionary_entry(str, index, obj) + index = self._parse_padding(str, index) + + index = self._parse_padding(str, index + 1) + + return obj, index + + def _parse_array(self, str, index): + obj = [] + + if str[index] != '(': + raise Exception("Expected ( as dictionary start") + + index = self._parse_padding(str, index + 1) + while str[index] != ')': + index = self._parse_array_entry(str, index, obj) + index = self._parse_padding(str, index) + + index = self._parse_padding(str, index + 1) + + return obj, index + + def _parse_dictionary_entry(self, str, index, dictionary): + # adds a entry to the given dictionary + key, index = self._parse_key(str, index) + + if str[index] != '=': + raise Exception("Expected = after a key. Found {1} @ {0}".format(index, str[index])) + + index = self._parse_padding(str, index + 1) + value, index = self._parse_value(str, index) + + dictionary[key] = value + + if str[index] == '}': + # Let the caller know we're finished by NOT skipping the "}" from the stream. + return index + + if str[index] != ';': + raise Exception("Expected ; after a value. Found {1} @ {0}".format(index, str[index])) + + # Skip the ";" character. + return index + 1 + + def _parse_array_entry(self, str, index, array): + # parse a: dict, array or value until the ',' + value, index = self._parse_value(str, index) + + array.append(value) + + if str[index] == ')': + # Let the caller know we're finished by NOT skipping the ")" from the stream. + return index + + if str[index] != ',': + raise Exception("Expected , after a value. Found {1} @ {0} = {2}".format(index, str[index], value)) + + return index + 1 + + def _parse_padding(self, str, index): + str_len = len(str) + + # Ignore whitespace + while index < str_len and str[index] in _WHITESPACE: + index += 1 + + # Ignore comment + if index + 1 < str_len and str[index] == '/' and str[index + 1] == '*': + # move after the first character in the comment + index += 2 + + while not (str[index] == '*' and str[index + 1] == '/'): + index += 1 + + # move after the first character after the comment + index += 2 + + # Ignore whitespace + while index < str_len and str[index] in _WHITESPACE: + index += 1 + + return index + + def _parse_key(self, str, index): + # returns the key and the last index. + index = self._parse_padding(str, index) + + start_index = index + if str[index] == '"': + index += 1 + while str[index] != '"': + index += 1 + start_index += 1 + end_index = index + index += 1 + else: + while str[index] not in _KEY_ENDER: + index += 1 + end_index = index + + key = str[start_index:end_index] + + index = self._parse_padding(str, index) + return key, index + + def _parse_literal(self, str, index): + # returns the key and the last index. + index = self._parse_padding(str, index) + + if str[index] == '"': + index += 1 + # if the literal starts with " then spaces are allowed + start_index = index + while str[index] != '"' or str[index - 1] == "\\": + index += 1 + key = str[start_index:index] + for escaped_value, real_value in _LITERAL_ESCAPES.items(): + key = key.replace(escaped_value, real_value) + index += 1 + else: + # otherwise stop in the spaces. + start_index = index + while str[index] not in _UNQUOTED_LITERAL_ENDER: + index += 1 + key = str[start_index:index] + + index = self._parse_padding(str, index) + return key, index + + def _parse_value(self, str, index): + # return an object depending on the value of the first character. + + if str[index] == '{': + value, index = self._parse_dictionary(str, index) + elif str[index] == '(': + value, index = self._parse_array(str, index) + else: + value, index = self._parse_literal(str, index) + + return value, index diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/openstep_parser.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/openstep_parser.py.meta new file mode 100644 index 0000000..55cecf4 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/openstep_parser/openstep_parser.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5d2e4083e6bd843dbb58e534870d5e37 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj.meta new file mode 100644 index 0000000..9d6d980 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d2cd75d42c47640038b31a9c14fd7af1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXGenericObject.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXGenericObject.py new file mode 100644 index 0000000..0ad00d4 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXGenericObject.py @@ -0,0 +1,193 @@ +import re +import uuid +import copy + +from pbxproj.PBXKey import PBXKey + + +class PBXGenericObject(object): + """ + Generic class that creates internal attributes to match the structure of the tree used to create the element. + Also, prints itself using the openstep format. Extensions might be required to insert comments on right places. + """ + # use negative look-ahead to avoid matching the newline character in multiline strings + _VALID_KEY_REGEX = re.compile(r'^[a-zA-Z0-9\\._/]*(?!\n)$') + _ESCAPE_REPLACEMENTS = [ + ('\\', '\\\\'), + ('\n', '\\n'), + ('\"', '\\"'), + ('\0', '\\0'), + ('\t', '\\\t'), + ('\'', '\\\''), + ] + + def __init__(self, parent=None): + self._parent = parent + + def get_parent(self): + return self._parent + + def parse(self, value): + if isinstance(value, dict): + return self._parse_dict(value) + + if isinstance(value, str): + return self._parse_string(value) + + if isinstance(value, list): + return self._parse_list(value) + + return value + + def _parse_dict(self, obj): + # all top level objects are added as variables to this object + for key, value in obj.items(): + if value is None: + continue + + key = self._parse_string(key) + setattr(self, key, self._get_instance(key, value)) + + return self + + def _parse_list(self, obj): + ret = [] + for item in obj: + ret.append(copy.copy(self).parse(item)) + + return ret + + def _parse_string(self, obj): + if re.match('([0-9A-F]{24})', obj) is not None: + return PBXKey(obj, self) + + return obj + + def _get_instance(self, class_type, content): + # check if the key maps to a kind of object + return self._get_class_reference(class_type)(self).parse(content) + + @classmethod + def _get_class_reference(cls, class_type): + module = __import__('pbxproj') + return getattr(module, class_type, PBXGenericObject) + + def __repr__(self): + return self._print_object() + + def _print_object(self, indent_depth='', entry_separator='\n', object_start='\n', indent_increment='\t'): + ret = f"{'{'}{object_start}" + for key in self.get_keys(): + value = self._format(self[key], indent_depth, entry_separator, object_start, + indent_increment) + + # use key decorators, could simplify the generation of the comments. + ret += f'{indent_depth}{indent_increment}{PBXGenericObject._escape(key)} = {value};{entry_separator}' + + ret += f"{indent_depth}{'}'}" + return ret + + def _print_list(self, obj, indentation_depth='', entry_separator='\n', object_start='\n', + indentation_increment='\t'): + ret = f'({object_start}' + for item in obj: + value = self._format(item, indentation_depth, entry_separator, object_start, indentation_increment) + + ret += f'{indentation_depth}{indentation_increment}{value},{entry_separator}' + ret += f'{indentation_depth})' + return ret + + def _format(self, value, indentation_depth='', entry_separator='\n', object_start='\n', indentation_increment='\t'): + if hasattr(value, '_print_object'): + value = value._print_object(indentation_depth + indentation_increment, + entry_separator, + object_start, + indentation_increment) + elif isinstance(value, list): + value = self._print_list(value, indentation_depth + indentation_increment, + entry_separator, + object_start, + indentation_increment) + elif isinstance(value, PBXKey): + value = value.__repr__() + else: + value = PBXGenericObject._escape(value.__str__(), exclude=['\'']) + + return value + + def get_keys(self): + fields = [field for field in list(self.__dict__.keys()) if field[0] != '_'] + if 'isa' in fields: + fields.remove('isa') + fields = sorted(fields) + fields.insert(0, 'isa') + else: + fields = sorted(fields) + + return fields + + def __getitem__(self, key): + return getattr(self, key, None) + + def get(self, key, default): + return getattr(self, key, default) + + def __setitem__(self, key, value): + if type(value) is list: + if value.__len__() == 1: + value = value[0] + if value.__len__() == 0: + if hasattr(self, key): + delattr(self, key) + return + + setattr(self, key, value) + + def __delitem__(self, key): + delattr(self, key) + + def __contains__(self, item): + return hasattr(self, item) + + def __lt__(self, other): + return self.get_id() < other.get_id() + + def _resolve_comment(self, key): + parent = self.get_parent() + if key in self: + return self[key]._get_comment() + + if parent is None: + return None + + return parent._resolve_comment(key) + + def get_id(self): + return self['_id'] + + def _get_comment(self): + if hasattr(self, 'name'): + return self.name + if hasattr(self, 'path'): + return self.path + + return None + + @classmethod + def _generate_id(cls): + return ''.join(str(uuid.uuid4()).upper().split('-')[1:]) + + @classmethod + def _escape(cls, item, exclude=None): + exclude = set() if exclude is None else set(exclude) + if len(item) != 0 and cls._VALID_KEY_REGEX.match(item) is not None: + return item + + escaped = item + for unescaped_value, escaped_value in cls._ESCAPE_REPLACEMENTS: + if unescaped_value in exclude: + continue + escaped = escaped.replace(unescaped_value, escaped_value) + + return '"'+escaped+'"' + diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXGenericObject.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXGenericObject.py.meta new file mode 100644 index 0000000..cc14080 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXGenericObject.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7d2a1138f1c7843698ffe1ddd3cc7f24 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXKey.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXKey.py new file mode 100644 index 0000000..d501281 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXKey.py @@ -0,0 +1,20 @@ +class PBXKey(str): + def __new__(cls, value, parent): + obj = str.__new__(cls, value) + obj._parent = parent + return obj + + def __repr__(self): + comment = self._get_comment() + if comment is not None: + comment = f' /* {comment} */' + else: + comment = '' + + return f'{self.__str__()}{comment}' + + def get_parent(self): + return self._parent + + def _get_comment(self): + return self.get_parent()._resolve_comment(self) diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXKey.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXKey.py.meta new file mode 100644 index 0000000..3ccd8f5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXKey.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d101e2808a1cd4553bfdf81a4c471f91 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXList.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXList.py new file mode 100644 index 0000000..132ef7b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXList.py @@ -0,0 +1,2 @@ +class PBXList(list): + pass diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXList.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXList.py.meta new file mode 100644 index 0000000..9a5ce52 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXList.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 10d6db0b8567f4a12b1a27ad698780d1 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXObjects.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXObjects.py new file mode 100644 index 0000000..283cce6 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXObjects.py @@ -0,0 +1,157 @@ +import pbxproj +import bisect +from pbxproj import PBXGenericObject + + +class objects(PBXGenericObject): + def __init__(self, parent=None): + super(objects, self).__init__(parent) + + # sections: dict + # sections get aggregated under the isa type. Each contains a list of tuples (id, obj) with every object defined + self._sections = {} + + # keep a dict indexed by obj.get_id() in order to do fast lookup while saving the file or in general + # this means that the structure needs to be kept in sync whenever an object is added or removed to the _sections + # dict. + self._objects_by_id = {} + + def parse(self, object_data): + # iterate over the keys and fill the sections + if isinstance(object_data, dict): + for key, value in object_data.items(): + key = self._parse_string(key) + obj_type = key + if 'isa' in value: + obj_type = value['isa'] + + child = self._get_instance(obj_type, value) + child['_id'] = key + self[key] = child + + return self + + # safe-guard: delegate to the parent how to deal with non-object values + return super(objects, self).parse(object_data) + + def _print_object(self, indent_depth='', entry_separator='\n', object_start='\n', + indent_increment='\t'): + # override to change the way the object is printed out + result = '{\n' + for section in self.get_sections(): + phase = self._sections[section] + result += f'\n/* Begin {section} section */\n' + for value in phase: + obj = value._print_object(indent_depth + '\t', entry_separator, object_start, + indent_increment) + result += f'{indent_depth}\t{value.get_id().__repr__()} = {obj};\n' + result += f'/* End {section} section */\n' + result += f'{indent_depth}{"}"}' + return result + + def get_keys(self): + """ + :return: all the keys of the object (ids of objects) + """ + keys = list(self._objects_by_id.keys()) + keys.sort() + return keys + + def get_sections(self): + sections = list(self._sections.keys()) + sections.sort() + return sections + + def __getitem__(self, key): + # retrieve the element from the dict representation for faster access. + return self._objects_by_id.get(key, None) + + def __setitem__(self, key, value): + if value.isa not in self._sections: + self._sections[value.isa] = [] + + # use the bisect module to keep the list sorted at all times. + bisect.insort(self._sections[value.isa], value) + + # add to the fast lookup dict + self._objects_by_id[value.get_id()] = value + + value._parent = self + + def __delitem__(self, key): + obj = self[key] + if obj is not None: + phase = self._sections[obj.isa] + phase.remove(obj) + # remove from the fast lookup dict + del self._objects_by_id[obj.get_id()] + + # remove empty phases + if phase.__len__() == 0: + del self._sections[obj.isa] + + def __contains__(self, item): + return self[item] is not None + + def __len__(self): + return sum([section.__len__() for section in self._sections]) + + def get_objects_in_section(self, *sections): + result = [] + for name in sections: + if name in self._sections: + result.extend(self._sections[name]) + return result + + def get_targets(self, name=None): + """ + Retrieve all/one target objects + :param name: name of the target to search for, None for everything + :return: A list of target objects + """ + targets = [] + for section in self.get_sections(): + if section.endswith('Target'): + targets += [value for value in self._sections[section]] + + if name is None: + return targets + + if not isinstance(name, list): + name = [name] + + return [target for target in targets if target.name in name] + + def get_buildphases_on_target(self, target_name=None): + for target in self.get_targets(target_name): + for build_phase_id in target.buildPhases: + yield (target, self[build_phase_id]) + + def get_configurations_on_targets(self, target_name=None, configuration_name=None): + """ + Retrieves all configuration given a name on the specified target + :param target_name: Searches for a specific target name or a list of target names. If None all targets are used + :param configuration_name: Searches for a specific configuration, if None all configuration of the target + are used + :return: A generator of configurations objects matching the target and configuration given (or all if nothing is + specified) + """ + for target in self.get_targets(target_name): + configuration_list = self[target.buildConfigurationList] + for configuration in configuration_list.buildConfigurations: + if configuration_name is None or self[configuration].name == configuration_name: + yield self[configuration] + + def get_project_configurations(self, configuration_name=None): + """ + Retrieves all configuration given a name on the root project + :param configuration_name: Searches for a specific configuration, if None all configuration of the target + are used + :return: A generator of configurations objects from the root project the given configuration name (or all if + nothing is specified) + """ + project = self[self._parent.rootObject] + configuration_list = self[project.buildConfigurationList] + for configuration in configuration_list.buildConfigurations: + if configuration_name is None or self[configuration].name == configuration_name: + yield self[configuration] \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXObjects.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXObjects.py.meta new file mode 100644 index 0000000..8918ff2 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXObjects.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 421cd45c7854f4d1095923dc78bd96cd +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXRootObject.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXRootObject.py new file mode 100644 index 0000000..f1d814e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXRootObject.py @@ -0,0 +1,6 @@ +from pbxproj import PBXGenericObject + + +class rootObject(PBXGenericObject): + def _resolve_comment(self, key): + return self.get_parent().objects._resolve_comment(key) diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXRootObject.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXRootObject.py.meta new file mode 100644 index 0000000..0535fe2 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/PBXRootObject.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 85817e35effc6480f86aaced3bebaf9e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/XcodeProject.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/XcodeProject.py new file mode 100644 index 0000000..6858d10 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/XcodeProject.py @@ -0,0 +1,111 @@ +import datetime +import os +import plistlib +import shutil +import sys + +from pbxproj import PBXGenericObject +from pbxproj.pbxextensions import ProjectFiles, ProjectFlags, ProjectGroups + + +class XcodeProject(PBXGenericObject, ProjectFiles, ProjectFlags, ProjectGroups): + """ + Top level class, handles the project CRUD operations, new, load, save, delete. Also, exposes methods to manipulate + the project's content, add/remove files, add/remove libraries/frameworks, query sections. For more advanced + operations, underlying objects are exposed that can be manipulated using said objects. + """ + + def __init__(self, tree=None, path=None): + super(XcodeProject, self).__init__(parent=None) + + if path is None: + path = os.path.join(os.getcwd(), 'project.pbxproj') + + self._pbxproj_path = os.path.abspath(path) + self._source_root = os.path.abspath(os.path.join(os.path.split(path)[0], '..')) + + # initialize the structure using the given tree + self.parse(tree) + + # sync up all the buildFile sections for speed up saving time + if 'objects' not in self: + return + + if self._check_missing_references(): + print('[WARNING] The project contains missing/broken references that may cause other problems.' + ' Open your project in Xcode and resolve all red-colored files.', file=sys.stderr) + + def _check_missing_references(self): + missing_references = False + for section in self.objects.get_sections(): + for obj in self.objects.get_objects_in_section(section): + # if 'files' in obj and obj['files'] is not None: + for file_id in obj.get('files', []): + if self.objects[file_id] is not None: + # set the section into the objects + self.objects[file_id]._section = obj._get_comment() + else: + missing_references = True + return missing_references + + def save(self, path=None): + if path is None: + path = self._pbxproj_path + + with open(path, 'w') as file: + file.write(self.__repr__() + "\n") + + def backup(self): + backup_name = "%s_%s.backup" % (self._pbxproj_path, datetime.datetime.now().strftime('%d%m%y-%H%M%S')) + + shutil.copy2(self._pbxproj_path, backup_name) + return backup_name + + def __repr__(self): + return '// !$*UTF8*$!\n' + super(XcodeProject, self).__repr__() + + def get_ids(self): + return self.objects.get_keys() + + def get_build_phases_by_name(self, phase_name): + return self.objects.get_objects_in_section(phase_name) + + def get_build_files_for_file(self, file_id): + return [build_file for build_file in self.objects.get_objects_in_section('PBXBuildFile') + if build_file.fileRef == file_id] + + def get_build_configurations_by_target(self, target_name): + result = [] + target = self.get_target_by_name(target_name) + if target is None: + return None + + build_configuration_list = self.objects[target.buildConfigurationList] + target_build_configurations = build_configuration_list['buildConfigurations'] + + for build_configuration in target_build_configurations: + build_configuration_obj = self.objects[build_configuration] + if build_configuration_obj is not None: + result.append(build_configuration_obj.name) + + return result + + def get_target_by_name(self, name): + targets = self.objects.get_targets(name) + if targets.__len__() > 0: + return targets[0] + return None + + def get_object(self, object_id): + return self.objects[object_id] + + @classmethod + def load(cls, path): + import openstep_parser as osp + try: + with open(path, 'r') as file: + tree = osp.OpenStepDecoder.ParseFromFile(file) + return XcodeProject(tree, path) + except: + with open(path, 'rb') as file: + return XcodeProject(plistlib.load(file), path) diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/XcodeProject.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/XcodeProject.py.meta new file mode 100644 index 0000000..be4105f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/XcodeProject.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1b7ba10d51a084bc19c73c44eec39a8d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__init__.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__init__.py new file mode 100644 index 0000000..6b21c46 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__init__.py @@ -0,0 +1,30 @@ +# MIT License +# +# Copyright (c) 2016 Ignacio Calderon aka kronenthaler +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from pbxproj.PBXList import PBXList +from pbxproj.PBXGenericObject import PBXGenericObject +from pbxproj.PBXObjects import objects +from pbxproj.PBXRootObject import rootObject +from pbxproj.XcodeProject import XcodeProject +from pbxproj.pbxsections import * + +__version__ = '4.3.0' diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__init__.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__init__.py.meta new file mode 100644 index 0000000..3f765e3 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__init__.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 04b915cbbbc9b4f87aebd817632d5e9f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__main__.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__main__.py new file mode 100644 index 0000000..36dd90f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__main__.py @@ -0,0 +1,44 @@ +""" +usage: + pbxproj [--version] [--help] [ ...] + +options: + -v, --version Shows version of pbxproj running + -h, --help This message + +commands: + show Displays information about the project targets + file Manipulates files on a project + flag Manipulates compilation flags on the project + folder Manipulates folders or groups on a project + +See pbxproj --help, for more information about a specific command. +""" + +from docopt import docopt + +import pbxproj +from pbxproj.pbxcli import command_parser + + +def main(): + args = docopt(__doc__, options_first=True, version=f'{pbxproj.__version__}') + cmd = args[''] + argv = [cmd] + args[''] + + if cmd == 'file': + import pbxproj.pbxcli.pbxproj_file as pbxproj_file + command_parser(pbxproj_file.execute)(docopt(pbxproj_file.__doc__, argv=argv)) + elif cmd == 'flag': + import pbxproj.pbxcli.pbxproj_flag as pbxproj_flag + command_parser(pbxproj_flag.execute)(docopt(pbxproj_flag.__doc__, argv=argv)) + elif cmd == 'folder': + import pbxproj.pbxcli.pbxproj_folder as pbxproj_folder + command_parser(pbxproj_folder.execute)(docopt(pbxproj_folder.__doc__, argv=argv)) + elif cmd == 'show': + import pbxproj.pbxcli.pbxproj_show as pbxproj_show + command_parser(pbxproj_show.execute, auto_save=False)(docopt(pbxproj_show.__doc__, argv=argv)) + + +if __name__ == '__main__': + main() diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__main__.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__main__.py.meta new file mode 100644 index 0000000..4fa17ab --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/__main__.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6ccbcbbf907c54e39b91ea7f010d3c7f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli.meta new file mode 100644 index 0000000..702f5ce --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 99720617944ab47ffa7965411e9ba59f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/__init__.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/__init__.py new file mode 100644 index 0000000..542208f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/__init__.py @@ -0,0 +1,43 @@ +import os + +from pbxproj.XcodeProject import XcodeProject + +PROJECT_PLACEHOLDER = '' +PATH_PLACEHOLDER = '' + + +def open_project(args): + if os.path.isdir(args[PROJECT_PLACEHOLDER]): + args[PROJECT_PLACEHOLDER] += '/project.pbxproj' + + if not os.path.isfile(args[PROJECT_PLACEHOLDER]): + raise FileNotFoundError('Project file not found') + + return XcodeProject.load(args[PROJECT_PLACEHOLDER]) + + +def backup_project(project, args): + if args['--backup']: + return project.backup() + return None + + +def resolve_backup(project, backup_file, args): + # remove backup if everything was ok. + if args['--backup'] and backup_file: + os.remove(backup_file) + + +def command_parser(command, auto_save=True): + def parser(args): + try: + project = open_project(args) + backup_file = backup_project(project, args) + print((command(project, args))) + if auto_save: + project.save() + resolve_backup(project, backup_file, args) + except Exception as ex: + print(f'{ex}') + exit(1) + return parser diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/__init__.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/__init__.py.meta new file mode 100644 index 0000000..7397e4e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/__init__.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 06c865f2d51d7448286cebcf2c08934e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_file.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_file.py new file mode 100644 index 0000000..24dafc4 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_file.py @@ -0,0 +1,100 @@ +""" +usage: + pbxproj file [options] [--target ...] + [(--weak | -w)] + [(--no-embed | -E)] + [(--sign-on-copy | -s)] + [(--ignore-unknown-types | -i)] + [(--no-create-build-files | -C)] + [(--header-scope | -H )] + pbxproj file [options] (--delete | -D) + +positional arguments: + Project path to the .xcodeproj folder. + Path of the file to add to the project. + +generic options: + -h, --help This message. + --tree Tree to add the file relative to. Available options: , , + SOURCE_ROOT, SDKROOT, DEVELOPER_DIR, BUILT_PRODUCTS_DIR. [default: SOURCE_ROOT] + -t, --target Target name(s) to be modified. If there is no target specified, all targets are + modified. + --parent Parent to use when adding the file (uses project root if not given). + -b, --backup Creates a backup before start processing the command. + +delete options: + -D, --delete Delete the file. + +add options: + -w, --weak Add the weak flag when libraries or frameworks are added. Linking optional. + -E, --no-embed Do not embed frameworks when added. + -s, --sign-on-copy Sign frameworks when copied/embedded. + -i, --ignore-unknown-types Ignore unknown file types when added. + -C, --no-create-build-files Do not create build file phases when adding a file. + -H, --header-scope Add header file using the given scope. Available options: public or private, project. + [default: project] +""" +from docopt import docopt + +from pbxproj.pbxcli import command_parser +from pbxproj.pbxextensions.ProjectFiles import FileOptions + + +def execute(project, args): + # make a decision of what function to call based on the -D flag + if args['--delete']: + return _remove(project, args) + else: + return _add(project, args) + + +def _add(project, args): + if '--header-scope' not in args or args['--header-scope'] not in ['public', 'private', 'project']: + header_scope = 'project' + else: + header_scope = args['--header-scope'] + + parent_group = None + if args['--parent']: + parent_group = project.get_or_create_group(args['--parent']) + + options = FileOptions(create_build_files=not args['--no-create-build-files'], + weak=args['--weak'], + ignore_unknown_type=args['--ignore-unknown-types'], + embed_framework=not args['--no-embed'], + code_sign_on_copy=args['--sign-on-copy'], + header_scope=header_scope.title()) + build_files = project.add_file(args[''], tree=args['--tree'], force=False, target_name=args['--target'], + parent=parent_group, file_options=options) + + # print some information about the build files created. + if build_files is None: + raise RuntimeError('No files were added to the project.') + + if not build_files: + return 'File added to the project, no build file sections created.' + + info = {} + for build_file in build_files: + if build_file.isa not in info: + info[build_file.isa] = 0 + info[build_file.isa] += 1 + + summary = 'File added to the project.' + for k in info: + summary += f'\n{info[k]} {k} sections created.' + return summary + + +def _remove(project, args): + if project.remove_files_by_path(args[''], tree=args['--tree'], target_name=args['--target']): + return 'File removed from the project.' + raise RuntimeError('An error occurred removing one of the files.') + + +def main(): + command_parser(execute)(docopt(__doc__)) + + +if __name__ == '__main__': + main() diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_file.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_file.py.meta new file mode 100644 index 0000000..516946d --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_file.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bf5f5db6b94f0460384e8d72eec9450a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_flag.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_flag.py new file mode 100644 index 0000000..2af33c0 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_flag.py @@ -0,0 +1,61 @@ +""" +usage: + pbxproj flag [options] [--target ...] [--] ( )... + pbxproj flag [options] (--delete | -D) [--] ( )... + +positional arguments: + Project path to the .xcodeproj folder. + Flag name to be modified in the project's configuration(s). + Flag value to be modified in the project's configuration(s). + +generic options: + -- Force to read the flag_value's and flag_name's as they are, otherwise they + might be interpreted as an option and detected as such. Use when a + flag_value starts with -, like -ObjC + -h, --help This message. + -t, --target Target name(s) to be modified. If there is no target specified, all targets + are modified. + -b, --backup Creates a backup before start processing the command. + -c, --configuration Configuration name to modify the flags. If no configuration name is + provided, all configurations are affected. + +delete options: + -D, --delete Removes the given flag_value's from the pairing flag_name. +""" + +# Future addition to the command line: +# pbxproj flag [options] (--delete | -D) (--all | -A) [--] ... +from docopt import docopt + +from pbxproj.pbxcli import command_parser + + +def execute(project, args): + # make a decision of what function to call based on the -D flag + if args['--delete']: + return _remove(project, args) + else: + return _add(project, args) + + +def _add(project, args): + for (flag_name, flag_value) in zip(args[''], args['']): + project.add_flags(flag_name, flag_value, target_name=args['--target'], + configuration_name=args['--configuration']) + return 'Flags added successfully.' + + +def _remove(project, args): + for (flag_name, flag_value) in zip(args[''], args['']): + project.remove_flags(flag_name, flag_value, target_name=args['--target'], + configuration_name=args['--configuration']) + return 'Flags removed successfully.' + + +def main(): + command_parser(execute)(docopt(__doc__)) + + +if __name__ == '__main__': + main() + diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_flag.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_flag.py.meta new file mode 100644 index 0000000..810fbfe --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_flag.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1ca2f56547296445f9e3e39533c18a0d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_folder.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_folder.py new file mode 100644 index 0000000..81535e6 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_folder.py @@ -0,0 +1,103 @@ +""" +usage: + pbxproj folder [options] [--target ...] + [--exclude ...] + [(--recursive | -r)] + [(--no-create-groups | -G)] + [(--weak | -w)] + [(--no-embed | -E)] + [(--sign-on-copy | -s)] + [(--ignore-unknown-types | -i)] + [(--no-create-build-files | -C)] + [(--header-scope | -H )] + pbxproj folder [options] (--delete | -D) [--tree ] + +positional arguments: + Project path to the .xcodeproj folder. + Path of the file to add to the project. + +generic options: + -h, --help This message. + -t, --target Target name(s) to be modified. If there is no target specified, all targets are + modified. + -b, --backup Creates a backup before start processing the command. + +delete options: + -D, --delete Delete the file. + --tree Tree to add the file relative to. Available options: , , + SOURCE_ROOT, SDKROOT, DEVELOPER_DIR, BUILT_PRODUCTS_DIR. [default: SOURCE_ROOT] + +add options: + -e, --exclude Pattern to exclude during the insertion of a folder. The pattern applies to file + names and folder names. + -r, --recursive Add folders and files recursively. + -G, --no-create-groups Add the folder as a file reference instead of creating group(s). + -w, --weak Add the weak flag when libraries or frameworks are added. Linking optional. + -E, --no-embed Do not embed frameworks when added. + -s, --sign-on-copy Sign frameworks when copied/embedded. + -i, --ignore-unknown-types Ignore unknown file types when added. + -C, --no-create-build-files Do not create build file phases when adding a file. + -H, --header-scope Add header file using the given scope. Available options: public or private, project. + [default: project] +""" +from docopt import docopt + +from pbxproj.pbxcli import command_parser +from pbxproj.pbxextensions.ProjectFiles import FileOptions + + +def execute(project, args): + # make a decision of what function to call based on the -D flag + if args['--delete']: + return _remove(project, args) + else: + return _add(project, args) + + +def _add(project, args): + if '--header-scope' not in args or args['--header-scope'] not in ['public', 'private', 'project']: + header_scope = 'project' + else: + header_scope = args['--header-scope'] + + options = FileOptions(create_build_files=not args['--no-create-build-files'], + weak=args['--weak'], + ignore_unknown_type=args['--ignore-unknown-types'], + embed_framework=not args['--no-embed'], + code_sign_on_copy=args['--sign-on-copy'], + header_scope=header_scope.title()) + + build_files = project.add_folder(args[''], excludes=args['--exclude'], recursive=args['--recursive'], + create_groups=not args['--no-create-groups'], target_name=args['--target'], + file_options=options) + # print some information about the build files created. + if build_files is None: + raise RuntimeError('No files were added to the project.') + + if not build_files: + return 'Folder added to the project, no build file sections created.' + + info = {} + for build_file in build_files: + if build_file.isa not in info: + info[build_file.isa] = 0 + info[build_file.isa] += 1 + + summary = 'Folder added to the project.' + for k in info: + summary += f'\n{info[k]} {k} sections created.' + return summary + + +def _remove(project, args): + if project.remove_files_by_path(args[''], tree=args['--tree'], target_name=args['--target']): + return 'Folder removed from the project.' + raise RuntimeError('An error occurred removing one of the files.') + + +def main(): + command_parser(execute)(docopt(__doc__)) + + +if __name__ == '__main__': + main() diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_folder.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_folder.py.meta new file mode 100644 index 0000000..17b7bcc --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_folder.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: de97c10f0a9624c95b304a6d02de2c50 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_show.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_show.py new file mode 100644 index 0000000..e263752 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_show.py @@ -0,0 +1,91 @@ +""" +usage: + pbxproj show [options] + pbxproj show [options] (--target ...) [(-s | --source-files) | + (-H | --header-files) | + (-r | --resource-files) | + (-f | --framework-files) | + (--build-phase-files )] + +positional arguments: + Project path to the .xcodeproj folder. + +generic options: + -h, --help This message. + -t, --target Target name to be modified. If there is no target specified, all targets are used. + -b, --backup Creates a backup before start processing the command. + +target options: + -s, --source-files Show the source files attached to the target + -r, --resource-files Show the resource files attached to the target + -f, --framework-files Show the library files attached to the target + -H, --header-files Show the header files attached to the target + -c, --configurations Show the configurations attached to the target + -B, --build-phase-files Show the files associated to the build phase of the given type. +""" + + +def execute(project, args): + # make a decision of what function to call based on the -D flag + if args['--target']: + return _target_info(project, args['--target'], args) + else: + return _summary(project, args) + + +def _summary(project, _): + info = '' + for target in project.objects.get_targets(): + configs = ', '.join([c.name for c in project.objects.get_configurations_on_targets(target.name)]) + info += f"{target.name}:\n" \ + f"\tTarget type: {target.isa}\n" \ + f"\tProduct name: {target.productName}\n" \ + f"\tConfigurations: {configs}\n" \ + + for build_phase_id in target.buildPhases: + build_phase = project.objects[build_phase_id] + info += f"\t{build_phase._get_comment()} ({build_phase.isa}) file count: {build_phase.files.__len__()}\n" + + info += "\n" + return info + + +def _target_info(project, target_name, args): + build_phases = _process_parameters(args) + + info = '' + for target in project.objects.get_targets(target_name): + info += f"{target.name}:\n" \ + f"\tProduct name: {target.productName}\n" + + if args['--configurations']: + configs = ', '.join([c.name for c in project.objects.get_configurations_on_targets(target.name)]) + info += f"\tConfigurations: {configs}\n" + + for build_phase_id in target.buildPhases: + build_phase = project.objects[build_phase_id] + if build_phase.isa in build_phases: + info += f"\t{build_phase._get_comment()}: \n\t\t" + files = [] + for build_file_id in build_phase.files: + build_file = project.objects[build_file_id] + files.append(project.objects[build_file.fileRef]._get_comment()) + formatted_files = "\n\t\t".join(sorted(files)) + info += f'{formatted_files}\n' + info += '\n' + return info + + +def _process_parameters(args): + build_phases = [] + if args['--source-files']: + build_phases += ['PBXSourcesBuildPhase'] + elif args['--header-files']: + build_phases += ['PBXHeadersBuildPhase'] + elif args['--resource-files']: + build_phases += ['PBXResourcesBuildPhase'] + elif args['--framework-files']: + build_phases += ['PBXFrameworksBuildPhase'] + elif args['--build-phase-files']: + build_phases += [args['--build-phase-files']] + return build_phases diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_show.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_show.py.meta new file mode 100644 index 0000000..b42b683 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxcli/pbxproj_show.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0555e5569cdf446f5ad4cf9c2e9e21dc +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions.meta new file mode 100644 index 0000000..5e8fc8c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2143f461a2b6a472fac8a8b77d096be8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFiles.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFiles.py new file mode 100644 index 0000000..f20776d --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFiles.py @@ -0,0 +1,673 @@ +import os +import re + +from pbxproj import PBXList, PBXGenericObject +from pbxproj.pbxsections import PBXGroup, PBXContainerItemProxy, PBXReferenceProxy, PBXFileReference, \ + PBXCopyFilesBuildPhaseNames, XCBuildConfigurationFlags, PBXBuildFile, XCRemoteSwiftPackageReference, \ + XCSwiftPackageProductDependency + + +class TreeType: + ABSOLUTE = '' + GROUP = '' + BUILT_PRODUCTS_DIR = 'BUILT_PRODUCTS_DIR' + DEVELOPER_DIR = 'DEVELOPER_DIR' + SDKROOT = 'SDKROOT' + SOURCE_ROOT = 'SOURCE_ROOT' + + @classmethod + def options(cls): + return [TreeType.SOURCE_ROOT, TreeType.SDKROOT, TreeType.GROUP, TreeType.ABSOLUTE, + TreeType.DEVELOPER_DIR, TreeType.BUILT_PRODUCTS_DIR] + + +class HeaderScope: + PUBLIC = 'Public' + PRIVATE = 'Private' + PROJECT = '' + + +class FileOptions: + """ + Wrapper class for all file parameters required at the moment of adding a file to the project. + """ + def __init__(self, create_build_files=True, weak=False, ignore_unknown_type=False, embed_framework=True, + code_sign_on_copy=True, header_scope=HeaderScope.PROJECT, add_groups_relative=True): + """ + Creates an object specifying options to be considered during the file creation into the project. + + :param create_build_files: Creates any necessary PBXBuildFile section when adding the file + :param weak: When adding a framework set it as a weak reference + :param ignore_unknown_type: Stop insertion if the file type is unknown (Default is false) + :param embed_framework: When adding a framework sets the embed section + :param code_sign_on_copy: When embedding a framework, sets the code sign attribute + :param header_scope: When adding a header file, adds the header as HeaderScope.PROJECT (default), + HeaderScope.PRIVATE or HeaderScope.PUBLIC. + :param add_groups_relative: Sets the group name to match the relative path is representing (default). + """ + self.create_build_files = create_build_files + self.weak = weak + self.ignore_unknown_type = ignore_unknown_type + self.embed_framework = embed_framework + self.code_sign_on_copy = code_sign_on_copy + self.header_scope = header_scope + self.add_groups_relative = add_groups_relative + + def get_attributes(self, file_ref, build_phase): + if file_ref.get_file_type() not in ('wrapper.framework', 'wrapper.xcframework') and file_ref.get_file_type() != 'sourcecode.c.h': + return None + + attributes = None + if build_phase.isa == 'PBXFrameworksBuildPhase': + attributes = ['Weak'] if self.weak else None + + if build_phase.isa == 'PBXCopyFilesBuildPhase' and \ + file_ref.sourceTree != TreeType.SDKROOT and \ + self.code_sign_on_copy: + if attributes is None: + attributes = [] + attributes += ['CodeSignOnCopy', 'RemoveHeadersOnCopy'] + + if build_phase.isa == 'PBXHeadersBuildPhase': + attributes = [self.header_scope] if self.header_scope != HeaderScope.PROJECT else None + + return attributes + + +class ProjectFiles: + _FILE_TYPES = { + '': ('text', 'PBXResourcesBuildPhase'), + '.a': ('archive.ar', 'PBXFrameworksBuildPhase'), + '.app': ('wrapper.application', None), + '.as': ('sourcecode.actionscript', 'PBXSourcesBuildPhase'), + '.asm': ('sourcecode.asm', 'PBXSourcesBuildPhase'), + '.bin': ('archive.macbinary', 'PBXResourcesBuildPhase'), + '.blend': ('file.blender', 'PBXResourcesBuildPhase'), + '.bundle': ('wrapper.plug-in', 'PBXResourcesBuildPhase'), + '.c': ('sourcecode.c.c', 'PBXSourcesBuildPhase'), + '.cpp': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase'), + '.d': ('sourcecode.dtrace', 'PBXSourcesBuildPhase'), + '.def': ('text', 'PBXResourcesBuildPhase'), + '.dylib': ('compiled.mach-o.dylib', 'PBXFrameworksBuildPhase'), + '.entitlements': ('text.plist.entitlements', 'PBXResourcesBuildPhase'), + '.frag': ('sourcecode.glsl', 'PBXResourcesBuildPhase'), + '.framework': ('wrapper.framework', 'PBXFrameworksBuildPhase'), + '.h': ('sourcecode.c.h', 'PBXHeadersBuildPhase'), + '.hpp': ('sourcecode.c.h', 'PBXHeadersBuildPhase'), + '.html':('text.html', 'PBXResourcesBuildPhase'), + '.icns': ('image.icns', 'PBXResourcesBuildPhase'), + '.inl': ('sourcecode.c.h', 'PBXHeadersBuildPhase'), + '.j': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'), + '.jfif': ('image.jfif', 'PBXResourcesBuildPhase'), + '.jpg': ('image.jpg', 'PBXResourcesBuildPhase'), + '.json': ('text.json', 'PBXResourcesBuildPhase'), + '.m': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'), + '.md': ('text', 'PBXResourcesBuildPhase'), + '.mesh': ('file.mesh', 'PBXResourcesBuildPhase'), + '.mlmodel':('file.mlmodel', 'PBXSourcesBuildPhase'), + '.mm': ('sourcecode.cpp.objcpp', 'PBXSourcesBuildPhase'), + '.nib': ('wrapper.nib', 'PBXResourcesBuildPhase'), + '.ogg': ('audio.ogg', 'PBXResourcesBuildPhase'), + '.pch': ('sourcecode.c.h', 'PBXHeadersBuildPhase'), + '.plist': ('text.plist.xml', 'PBXResourcesBuildPhase'), + '.png': ('image.png', 'PBXResourcesBuildPhase'), + '.py': ('sourcecode.python', 'PBXSourcesBuildPhase'), + '.rtf': ('text.rtf', 'PBXResourcesBuildPhase'), + '.S': ('sourcecode.asm', 'PBXSourcesBuildPhase'), + '.scene': ('file.scene', 'PBXResourcesBuildPhase'), + '.strings': ('text.plist.strings', 'PBXResourcesBuildPhase'), + '.swift': ('sourcecode.swift', 'PBXSourcesBuildPhase'), + '.tbd': ('sourcecode.text-based-dylib-definition', 'PBXFrameworksBuildPhase'), + '.tiff': ('image.tiff', 'PBXResourcesBuildPhase'), + '.ttf': ('file.ttf', 'PBXResourcesBuildPhase'), + '.txt': ('text', 'PBXResourcesBuildPhase'), + '.vert': ('sourcecode.glsl', 'PBXResourcesBuildPhase'), + '.wav': ('audio.wav', 'PBXResourcesBuildPhase'), + '.xcassets': ('folder.assetcatalog', 'PBXResourcesBuildPhase'), + '.xcconfig': ('sourcecode.xcconfig', 'PBXSourcesBuildPhase'), + '.xcdatamodeld': ('wrapper.xcdatamodel', 'PBXSourcesBuildPhase'), + '.xcf': ('file.xcf', 'PBXResourcesBuildPhase'), + '.xcframework': ('wrapper.xcframework', 'PBXFrameworksBuildPhase'), + '.xcodeproj': ('wrapper.pb-project', None), + '.xcprivacy': ('text.plist.xml', 'PBXResourcesBuildPhase'), + '.xib': ('file.xib', 'PBXResourcesBuildPhase') + } + _SPECIAL_FOLDERS = [ + '.bundle', + '.framework', + '.xcodeproj', + '.xcassets', + '.xcdatamodeld', + '.storyboardc' + ] + + def __init__(self): + raise EnvironmentError('This class cannot be instantiated directly, use XcodeProject instead') + + def add_file(self, path, parent=None, tree=TreeType.SOURCE_ROOT, target_name=None, force=True, + file_options=FileOptions()): + """ + Adds a file to the project, taking care of the type of the file and creating additional structures depending on + the file type. For instance, frameworks will be linked, embedded and search paths will be adjusted automatically. + Header file will be added to the headers sections, but not compiled, whereas the source files will be added to + the compilation phase. + :param path: Path to the file to be added + :param parent: Parent group to be added under + :param tree: Tree where the path is relative to + :param target_name: Target name or list of target names where the file should be added (none for every target) + :param force: Add the file without checking if the file already exists + :param file_options: FileOptions object to be used during the addition of the file to the project. + :return: a list of elements that were added to the project successfully as PBXBuildFile objects + """ + results = [] + # if it's not forced to add the file stop if the file already exists. + if not force: + target_name = self._filter_targets_without_path(path, target_name) + if target_name.__len__() == 0: + return [] + + file_ref, abs_path, path, tree, expected_build_phase = self._add_file_reference(path, parent, tree, force, + file_options) + if path is None or tree is None: + return None + + # no need to create the build_files, done + if not file_options.create_build_files: + return results + + # create build_files for the targets + results.extend(self._create_build_files(file_ref, target_name, expected_build_phase, file_options)) + + # special case for the frameworks and libraries to update the search paths + if abs_path is None: + return results + + # the path is absolute and it's outside the scope of the project for linking purposes + library_path = os.path.join('$(SRCROOT)', os.path.split(file_ref.path)[0]) + if os.path.isfile(abs_path): + self.add_library_search_paths([library_path], recursive=False, escape=" " in library_path) + else: + self.add_framework_search_paths([library_path, '$(inherited)'], recursive=False, escape=" " in library_path) + + return results + + def _filter_targets_without_path(self, path, target_name): + potential_targets = self.objects.get_targets(target_name) + for target in potential_targets.copy(): + for build_phase_id in target.buildPhases: + build_phase = self.get_object(build_phase_id) + for build_file_id in build_phase.files: + build_file = self.get_object(build_file_id) + if build_file is None: + continue + + file_ref = self.get_object(build_file.fileRef) + if 'path' in file_ref and ProjectFiles._path_leaf(path) == ProjectFiles._path_leaf(file_ref.path) \ + and target in potential_targets: + potential_targets.remove(target) + + return [target.name for target in potential_targets] + + def _file_exists(self, path): + for section in self.objects.get_sections(): + for obj in self.objects.get_objects_in_section(section): + if 'path' in obj and ProjectFiles._path_leaf(path) == ProjectFiles._path_leaf(obj.path): + return True + return False + + def add_project(self, path, parent=None, tree=TreeType.GROUP, target_name=None, force=True, + file_options=FileOptions()): + """ + Adds another Xcode project into this project. Allows to use the products generated from the given project into + this project during compilation time. Optional: it can add the products into the different sections: frameworks + and bundles. + + :param path: Path to the .xcodeproj file + :param parent: Parent group to be added under + :param tree: Tree where the path is relative to + :param target_name: Target name or list of target names where the file should be added (none for every target) + :param force: Add the file without checking if the file already exists + :param file_options: FileOptions object to be used during the addition of the file to the project. + :return: list of PBXReferenceProxy objects that can be used to create the PBXBuildFile phases. + """ + results = [] + # if it's not forced to add the file stop if the file already exists. + if not force and self._file_exists(path): + return [] + + file_ref, _, path, tree, expected_build_phase = self._add_file_reference(path, parent, tree, force, + file_options) + if path is None or tree is None: + return None + + # load project and add the things + child_project = self.__class__.load(os.path.join(path, 'project.pbxproj')) + child_products = child_project.get_build_phases_by_name('PBXNativeTarget') + + # create an special group without parent (ref proxies) + products_group = PBXGroup.create(name='Products', children=[]) + self.objects[products_group.get_id()] = products_group + + for child_product in child_products: + product_file_ref = child_project.objects[child_product.productReference] + + # create the container proxies + container_proxy = PBXContainerItemProxy.create(file_ref, child_product) + self.objects[container_proxy.get_id()] = container_proxy + + # create the reference proxies + reference_proxy = PBXReferenceProxy.create(product_file_ref, container_proxy) + self.objects[reference_proxy.get_id()] = reference_proxy + + # add reference proxy to the product group + products_group.add_child(reference_proxy) + + # append the result + results.append(reference_proxy) + + if file_options.create_build_files: + _, expected_build_phase = self._determine_file_type(reference_proxy, file_options.ignore_unknown_type) + self._create_build_files(reference_proxy, target_name, expected_build_phase, file_options) + + # add new PBXFileReference and PBXGroup to the PBXProject object + project_object = self.objects.get_objects_in_section('PBXProject')[0] + project_ref = PBXGenericObject(project_object).parse({ + 'ProductGroup': products_group.get_id(), + 'ProjectRef': file_ref.get_id() + }) + + if 'projectReferences' not in project_object: + project_object['projectReferences'] = PBXList() + + project_object.projectReferences.append(project_ref) + + return results + + def get_file_by_id(self, file_id): + """ + Gets the PBXFileReference to the given id + :param file_id: Identifier of the PBXFileReference to be retrieved. + :return: A PBXFileReference if the id is found, None otherwise. + """ + file_ref = self.objects[file_id] + if not isinstance(file_ref, PBXFileReference): + return None + return file_ref + + def get_files_by_name(self, name, parent=None): + """ + Gets all the files references that have the given name, under the specified parent PBXGroup object or + PBXGroup id. + :param name: name of the file to be retrieved + :param parent: PBXGroup that should be used to narrow the search or None to retrieve files from all project + :return: List of all PBXFileReference that match the name and parent criteria. + """ + if parent is not None: + parent = self._get_parent_group(parent) + + files = [] + for file_ref in self.objects.get_objects_in_section('PBXFileReference'): + if file_ref.get_name() == name and (parent is None or parent.has_child(file_ref.get_id())): + files.append(file_ref) + + return files + + def get_files_by_path(self, path, tree=TreeType.SOURCE_ROOT): + """ + Gets the files under the given tree type that match the given path. + :param path: Path to the file relative to the tree root + :param tree: Tree type to look for the path. By default the SOURCE_ROOT + :return: List of all PBXFileReference that match the path and tree criteria. + """ + files = [] + for file_ref in self.objects.get_objects_in_section('PBXFileReference'): + if file_ref.path == path and file_ref.sourceTree == tree: + files.append(file_ref) + + return files + + def remove_file_by_id(self, file_id, target_name=None): + """ + Removes the file id from given target name. If no target name is given, the file is removed + from all targets + :param file_id: identifier of the file to be removed + :param target_name: Target name or list of target names where the file should be removed from (none for every + target) + :return: True if the file id was removed. False if the file was not removed. + """ + + file_ref = self.get_file_by_id(file_id) + if file_ref is None: + return False + + for target, build_phase in self.objects.get_buildphases_on_target(target_name): + for build_file_id in filter(lambda x: x in self.objects, build_phase.files): + build_file = self.objects[build_file_id] + + if hasattr(build_file, 'fileRef') and build_file.fileRef == file_ref.get_id(): + # remove the build file from the phase + build_phase.remove_build_file(build_file) + + # if the build_phase is empty remove it too, unless it's a shell script. + if build_phase.files.__len__() == 0 and build_phase.isa != 'PBXShellScriptBuildPhase': + # remove the build phase from the target + target.remove_build_phase(build_phase) + + # remove it iff it's removed from all targets or no build file reference it + if len([1 for x in self.objects.get_objects_in_section('PBXBuildFile') if + hasattr(x, 'fileRef') and x.fileRef == file_ref.get_id()]) != 0: + return True + + # remove the file from any groups if there is no reference from any target + for group in filter(lambda x: file_ref.get_id() in x.children, self.objects.get_objects_in_section('PBXGroup')): + group.remove_child(file_ref) + + # the file is not referenced in any build file, remove it + del self.objects[file_ref.get_id()] + return True + + def remove_files_by_path(self, path, tree=TreeType.SOURCE_ROOT, target_name=None): + """ + Removes all files for the given path under the same tree + :param path: Path to the file relative to the tree root + :param tree: Tree type to look for the path. By default the SOURCE_ROOT + :param target_name: Target name or list of target names where the file should be removed from (none for every + target) + :return: True if all the files were removed without problems. False if at least one file failed. + """ + files = self.get_files_by_path(path, tree) + result = 0 + total = files.__len__() + for file_ref in files: + if self.remove_file_by_id(file_ref.get_id(), target_name=target_name): + result += 1 + + return result != 0 and result == total + + def add_folder(self, path, parent=None, excludes=None, recursive=True, create_groups=True, target_name=None, + file_options=FileOptions()): + """ + Given a directory, it will create the equivalent group structure and add all files in the process. + If groups matching the logical path already exist, it will use them instead of creating a new one. Same + apply for file within a group, if the file name already exists it will be ignored. + + :param path: OS path to the directory to be added. + :param parent: Parent group to be added under + :param excludes: list of regexs to ignore + :param recursive: add folders recursively or stop in the first level + :param create_groups: add folders recursively as groups or references + :param target_name: Target name or list of target names where the file should be added (none for every target) + :param file_options: FileOptions object to be used during the addition of the file to the project. + :return: a list of elements that were added to the project successfully as PBXBuildFile objects + """ + if not os.path.isdir(path): + return None + + if not excludes: + excludes = [] + + results = [] + + # add the top folder as a group, make it the new parent + path = os.path.abspath(path) + if not create_groups and os.path.splitext(path)[1] not in ProjectFiles._SPECIAL_FOLDERS: + return self.add_file(path, parent, target_name=target_name, force=False, tree=TreeType.GROUP, + file_options=file_options) + + parent = self.get_or_create_group(os.path.split(path)[1], path, parent, make_relative=file_options.add_groups_relative) + + # iterate over the objects in the directory + for child in os.listdir(path): + # exclude dirs or files matching any of the expressions + if [pattern for pattern in excludes if re.match(pattern, child)]: + continue + + full_path = os.path.join(path, child) + children = [] + if os.path.isfile(full_path) or os.path.splitext(child)[1] in ProjectFiles._SPECIAL_FOLDERS or \ + not create_groups: + # check if the file exists already, if not add it + children = self.add_file(full_path, parent, target_name=target_name, force=False, tree=TreeType.GROUP, + file_options=file_options) + else: + # if recursive is true, go deeper, otherwise create the group here. + if recursive: + children = self.add_folder(full_path, parent, excludes, recursive, target_name=target_name, + file_options=file_options) + else: + self.get_or_create_group(child, child, parent, make_relative=True) + + results.extend(children) + + return results + + def add_package(self, repository_url, package_requirement, product_name, target_name): + """ + Add Swift package and its package product(s) to project. + Each package product is added for a given target. + + :param repository_url: repository url of Swift package to be added + :param package_requirement: dictionary containing rules used to determine Swift package version + :param product_name: product name or list of product names to be added + :param target_name: target name to which the product is added + :return: a list of elements that were added or found as + XCRemoteSwiftPackageReference and XCSwiftPackageProductDependency objects + """ + results = [] + + package_ref = self.get_or_create_package_reference(repository_url, (repository_url, package_requirement,)) + results.append(package_ref) + + if not isinstance(product_name, list): + product_name = [product_name] + + for name in product_name: + package_dep = self.get_or_create_package_dependency(name, target_name, (package_ref, name,)) + results.append(package_dep) + + return results + + def get_or_create_package_reference(self, url, create_parameters=()): + """ + Get or create Swift package reference. + + :param url: url of Swift package repository + :param create_parameters: parameters required in XCRemoteSwiftPackageReference.create + :return: XCRemoteSwiftPackageReference object found or created + """ + if not url: + return None + + package_ref = self.get_package_reference_by_url(url) + if package_ref is not None: + return package_ref + + return self.add_package_reference(create_parameters) + + def get_package_reference_by_url(self, url): + """ + Retrieve package reference matching the given url. + + :param url: The name of the package reference that has to be returned + :return: The matching package reference + """ + package_refs = self.objects.get_objects_in_section('XCRemoteSwiftPackageReference') + package_refs = [package_ref for package_ref in package_refs if package_ref.repositoryURL == url] + + return package_refs[0] if package_refs.__len__() > 0 else None + + def add_package_reference(self, create_parameters=()): + """ + Add Swift package reference to project. + + :param create_parameters: parameters required in XCRemoteSwiftPackageReference.create + :return: XCRemoteSwiftPackageReference object created + """ + package_ref = XCRemoteSwiftPackageReference.create(*create_parameters) + self.objects[package_ref.get_id()] = package_ref + + for project_object in self.objects.get_objects_in_section('PBXProject'): + if 'packageReferences' not in project_object: + project_object['packageReferences'] = PBXList() + + if package_ref.get_id() not in project_object['packageReferences']: + project_object.packageReferences.append(package_ref.get_id()) + + return package_ref + + def get_or_create_package_dependency(self, product_name, target_name, create_parameters=()): + """ + Get or create Swift package product dependency. + + :param product_name: name of anyone product available in the Swift package + :param target_name: target name to which the product is added if it is not found + :param create_parameters: parameters required in XCSwiftPackageProductDependency.create + :return: XCSwiftPackageProductDependency object found or created + """ + if not product_name: + return None + + package_dep = self.get_package_dependency_by_name(product_name) + if package_dep is not None: + return package_dep + + return self.add_package_dependency(target_name, create_parameters) + + def get_package_dependency_by_name(self, product_name): + """ + Retrieve package dependency matching the given product name. + + :param product_name: The product name of the package dependency that has to be returned + :return: The matching package dependency + """ + package_deps = self.objects.get_objects_in_section('XCSwiftPackageProductDependency') + package_deps = [package_dep for package_dep in package_deps if package_dep.productName == product_name] + + return package_deps[0] if package_deps.__len__() > 0 else None + + def add_package_dependency(self, target_name, create_parameters=()): + """ + Add Swift package dependency to project. + + :param target_name: target name to which the product dependency is added + :param create_parameters: parameters required in XCRemoteSwiftPackageReference.create + :return: XCRemoteSwiftPackageReference object created + """ + package_dep = XCSwiftPackageProductDependency.create(*create_parameters) + self.objects[package_dep.get_id()] = package_dep + + # add build files (PBXBuildFile section and PBXFrameworksBuildPhase section) + self._create_build_products(package_dep, target_name) + + # add packageProductDependencies to PBXNativeTarget section + target = self.get_target_by_name(name=target_name) + if 'packageProductDependencies' not in target: + target['packageProductDependencies'] = PBXList() + + if package_dep.get_id() not in target['packageProductDependencies']: + target.packageProductDependencies.append(package_dep.get_id()) + + return package_dep + + # miscellaneous functions, candidates to be extracted and decouple implementation + + def _add_file_reference(self, path, parent, tree, force, file_options): + # decide the proper tree and path to add + abs_path, path, tree = ProjectFiles._get_path_and_tree(self._source_root, path, tree) + if path is None or tree is None: + return None, abs_path, path, tree, None + + # create a PBXFileReference for the new file + file_ref = PBXFileReference.create(path, tree) + + # determine the type of the new file: + file_type, expected_build_phase = ProjectFiles._determine_file_type(file_ref, file_options.ignore_unknown_type) + + # set the file type on the file ref add the files + file_ref.set_last_known_file_type(file_type) + self.objects[file_ref.get_id()] = file_ref + + # determine the parent and add it to it + self._get_parent_group(parent).add_child(file_ref) + + return file_ref, abs_path, path, tree, expected_build_phase + + def _create_build_files(self, file_ref, target_name, expected_build_phase, file_options): + results = [] + for target in self.objects.get_targets(target_name): + # determine if there is a suitable build phase created + build_phases = target.get_or_create_build_phase(expected_build_phase) + + # if it's a framework and it needs to be embedded + if file_options.embed_framework and expected_build_phase == 'PBXFrameworksBuildPhase' and \ + file_ref.get_file_type() in ('wrapper.framework', 'wrapper.xcframework'): + embed_phase = target.get_or_create_build_phase('PBXCopyFilesBuildPhase', + search_parameters={'dstSubfolderSpec': '10'}, + create_parameters=(PBXCopyFilesBuildPhaseNames.EMBEDDED_FRAMEWORKS,)) + # add runpath search flag + self.add_flags(XCBuildConfigurationFlags.LD_RUNPATH_SEARCH_PATHS, + '$(inherited) @executable_path/Frameworks', target_name) + build_phases.extend(embed_phase) + + # create the build file and add it to the phase + for target_build_phase in build_phases: + build_file = PBXBuildFile.create(file_ref, file_options.get_attributes(file_ref, target_build_phase)) + self.objects[build_file.get_id()] = build_file + target_build_phase.add_build_file(build_file) + + results.append(build_file) + + return results + + def _create_build_products(self, product_ref, target_name): + results = [] + for target in self.objects.get_targets(target_name): + build_phases = target.get_or_create_build_phase('PBXFrameworksBuildPhase') + + # create the build file and add it to the phase + for target_build_phase in build_phases: + build_file = PBXBuildFile.create(product_ref, is_product=True) + self.objects[build_file.get_id()] = build_file + target_build_phase.add_build_file(build_file) + + results.append(build_file) + + return results + + @classmethod + def _determine_file_type(cls, file_ref, unknown_type_allowed): + ext = os.path.splitext(file_ref.get_name())[1] + if os.path.isdir(os.path.abspath(file_ref.path)) and ext not in ProjectFiles._SPECIAL_FOLDERS: + file_type = 'folder' + build_phase = 'PBXResourcesBuildPhase' + else: + file_type, build_phase = ProjectFiles._FILE_TYPES.get(ext, (None, 'PBXResourcesBuildPhase')) + + if not unknown_type_allowed and file_type is None: + raise ValueError( + f'Unknown file extension: {os.path.splitext(file_ref.get_name())[1]}. ' \ + f'Please add the extension and Xcode type to ProjectFiles._FILE_TYPES') + + return file_type, build_phase + + @classmethod + def _path_leaf(cls, path): + head, tail = os.path.split(path) + return tail or os.path.basename(head) + + @classmethod + def _get_path_and_tree(cls, source_root, path, tree): + # returns the absolute path, the relative path and the tree + abs_path = None + if os.path.isabs(path): + abs_path = path + + if not os.path.exists(path): + return None, None, None + + if tree == TreeType.SOURCE_ROOT or tree == TreeType.GROUP: + path = os.path.relpath(path, source_root) + else: + tree = TreeType.ABSOLUTE + + return abs_path, path, tree diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFiles.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFiles.py.meta new file mode 100644 index 0000000..c705973 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFiles.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 45f83f35b0c9b4ed59d9978a30fd9a56 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFlags.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFlags.py new file mode 100644 index 0000000..7eefb26 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFlags.py @@ -0,0 +1,266 @@ +from pbxproj.pbxsections import XCBuildConfigurationFlags, PBXShellScriptBuildPhase +from pbxproj.pbxsections.PBXProject import PBXProvisioningTypes + + +class ProjectFlags: + """ + This class provides separation of concerns, this class contains all methods related to flags manipulations. + This class should not be instantiated on its own + """ + + def __init__(self): + raise EnvironmentError('This class cannot be instantiated directly, use XcodeProject instead') + + def add_flags(self, flag_name, flags, target_name=None, configuration_name=None): + """ + Adds the given flags to the flag_name section of the target on the given configurations + :param flag_name: name of the flag to be added the values to + :param flags: A string or array of strings + :param target_name: Target name or list of target names to add the flag to or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + for configuration in self.objects.get_configurations_on_targets(target_name, configuration_name): + configuration.add_flags(flag_name, flags) + + def add_project_flags(self, flag_name, flags, configuration_name=None): + """ + Adds the given flags to the flag_name section of the root project on the given configurations + :param flag_name: name of the flag to be added the values to + :param flags: A string or array of strings + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + for configuration in self.objects.get_project_configurations(configuration_name): + configuration.add_flags(flag_name, flags) + + def set_flags(self, flag_name, flags, target_name=None, configuration_name=None): + """ + Sets the given flags to the flag_name section of the target on the configurations, full override. + :param flag_name: name of the flag to be added the values to + :param flags: A string or array of strings + :param target_name: Target name or list of target names to set the flag to or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + for configuration in self.objects.get_configurations_on_targets(target_name, configuration_name): + configuration.set_flags(flag_name, flags) + + def remove_flags(self, flag_name, flags, target_name=None, configuration_name=None): + """ + Removes the given flags from the flag_name section of the target on the configurations + :param flag_name: name of the flag to be removed the values from + :param flags: A string or array of strings. If none, removes all values from the flag. + :param target_name: Target name or list of target names to remove the flag from or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + for configuration in self.objects.get_configurations_on_targets(target_name, configuration_name): + configuration.remove_flags(flag_name, flags) + + def remove_project_flags(self, flag_name, flags, configuration_name=None): + """ + Removes the given flags to the flag_name section of the root project on the given configurations. + :param flag_name: name of the flag to be added the values to + :param flags: A string or array of strings + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + for configuration in self.objects.get_project_configurations(configuration_name): + configuration.remove_flags(flag_name, flags) + + def add_other_cflags(self, flags, target_name=None, configuration_name=None): + """ + Adds flag values to the OTHER_CFLAGS flag. + :param flags: A string or array of strings. If none, removes all values from the flag. + :param target_name: Target name or list of target names to add the flag to or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.add_flags(XCBuildConfigurationFlags.OTHER_CFLAGS, flags, target_name, configuration_name) + + def remove_other_cflags(self, flags, target_name=None, configuration_name=None): + """ + Removes the given flags from the OTHER_CFLAGS section of the target on the configurations + :param flags: A string or array of strings. If none, removes all values from the flag. + :param target_name: Target name or list of target names to remove the flag from or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.remove_flags(XCBuildConfigurationFlags.OTHER_CFLAGS, flags, target_name, configuration_name) + + def add_other_ldflags(self, flags, target_name=None, configuration_name=None): + """ + Adds flag values to the OTHER_LDFLAGS flag. + :param flags: A string or array of strings. If none, removes all values from the flag. + :param target_name: Target name or list of target names to add the flag to or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.add_flags(XCBuildConfigurationFlags.OTHER_LDFLAGS, flags, target_name, configuration_name) + + def remove_other_ldflags(self, flags, target_name=None, configuration_name=None): + """ + Removes the given flags from the OTHER_LDFLAGS section of the target on the configurations + :param flags: A string or array of strings. If none, removes all values from the flag. + :param target_name: Target name or list of target names to remove the flag from or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.remove_flags(XCBuildConfigurationFlags.OTHER_LDFLAGS, flags, target_name, configuration_name) + + def add_search_paths(self, path_type, paths, recursive=True, escape=False, target_name=None, + configuration_name=None): + """ + Adds the given search paths to the path type section of the target on the configurations + :param path_type: name of the flag to be added the values to + :param paths: A string or array of strings + :param recursive: Add the paths as recursive ones + :param escape: Escape the path in case it contains spaces + :param target_name: Target name or list of target names to add the flag to or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + for configuration in self.objects.get_configurations_on_targets(target_name, configuration_name): + configuration.add_search_paths(path_type, paths, recursive, escape) + + def remove_search_paths(self, path_type, paths, target_name=None, configuration_name=None): + """ + Removes the given search paths from the path_type section of the target on the configurations + :param path_type: name of the path type to be removed the values from + :param paths: A string or array of strings + :param target_name: Target name or list of target names to remove the flag from or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + for configuration in self.objects.get_configurations_on_targets(target_name, configuration_name): + configuration.remove_search_paths(path_type, paths) + + def add_header_search_paths(self, paths, recursive=True, escape=False, target_name=None, configuration_name=None): + """ + Adds paths to the HEADER_SEARCH_PATHS configuration. + :param paths: A string or array of strings + :param recursive: Add the paths as recursive ones + :param escape: Escape the path in case it contains spaces + :param target_name: Target name or list of target names to add the flag to or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.add_search_paths(XCBuildConfigurationFlags.HEADER_SEARCH_PATHS, paths, recursive, escape, target_name, + configuration_name) + + def remove_header_search_paths(self, paths, target_name=None, configuration_name=None): + """ + Removes the given search paths from the HEADER_SEARCH_PATHS section of the target on the configurations + :param paths: A string or array of strings + :param target_name: Target name or list of target names to remove the flag from or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.remove_search_paths(XCBuildConfigurationFlags.HEADER_SEARCH_PATHS, paths, target_name, configuration_name) + + def add_library_search_paths(self, paths, recursive=True, escape=False, target_name=None, configuration_name=None): + """ + Adds paths to the LIBRARY_SEARCH_PATHS configuration. + :param paths: A string or array of strings + :param recursive: Add the paths as recursive ones + :param escape: Escape the path in case it contains spaces + :param target_name: Target name or list of target names to add the flag to or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.add_search_paths(XCBuildConfigurationFlags.LIBRARY_SEARCH_PATHS, paths, recursive, escape, target_name, + configuration_name) + + def remove_library_search_paths(self, paths, target_name=None, configuration_name=None): + """ + Removes the given search paths from the LIBRARY_SEARCH_PATHS section of the target on the configurations + :param paths: A string or array of strings + :param target_name: Target name or list of target names to remove the flag from or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.remove_search_paths(XCBuildConfigurationFlags.LIBRARY_SEARCH_PATHS, paths, target_name, configuration_name) + + def add_framework_search_paths(self, paths, recursive=True, escape=False, target_name=None, + configuration_name=None): + """ + Adds paths to the FRAMEWORK_SEARCH_PATHS configuration. + :param paths: A string or array of strings + :param recursive: Add the paths as recursive ones + :param escape: Escape the path in case it contains spaces + :param target_name: Target name or list of target names to add the flag to or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.add_search_paths(XCBuildConfigurationFlags.FRAMEWORK_SEARCH_PATHS, paths, recursive, escape, target_name, + configuration_name) + + def remove_framework_search_paths(self, paths, target_name=None, configuration_name=None): + """ + Removes the given search paths from the FRAMEWORK_SEARCH_PATHS section of the target on the configurations + :param paths: A string or array of strings + :param target_name: Target name or list of target names to remove the flag from or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: void + """ + self.remove_search_paths(XCBuildConfigurationFlags.FRAMEWORK_SEARCH_PATHS, paths, target_name, configuration_name) + + def add_run_script(self, script, target_name=None, insert_before_compile=False, input_files=None, output_files=None, run_install_build=0): + """ + Adds a run script phase into the given target, optionally before compilation phase + :param script: Script to be inserted on the run script + :param target_name: Target name or list of target names to add the run script to or None for every target + :param insert_before_compile: Insert the run script phase before the compilation of the source files. By default, + it's added at the end. + :param input_files: An array of input file paths to be added to the run script + :param output_files: An array of output file paths to be added to the run script + :param run_install_build: Toggle For install builds only on Run Script phase. Default is 0 + :return: + """ + for target in self.objects.get_targets(target_name): + shell = PBXShellScriptBuildPhase.create(script, input_paths=input_files, output_paths=output_files, run_install_build=run_install_build) + + self.objects[shell.get_id()] = shell + target.add_build_phase(shell, 0 if insert_before_compile else None) + + def remove_run_script(self, script, target_name=None): + """ + Removes the given script string from the given target + :param script: The script string to be removed from the target + :param target_name: Target name or list of target names to remove the run script from or None for every target + :return: + """ + for target in self.objects.get_targets(target_name): + for build_phase_id in target.buildPhases: + build_phase = self.objects[build_phase_id] + if not isinstance(build_phase, PBXShellScriptBuildPhase): + continue + + if build_phase.shellScript == script: + del self.objects[build_phase_id] + target.remove_build_phase(build_phase) + + def add_code_sign(self, code_sign_identity, development_team, provisioning_profile_uuid, + provisioning_profile_specifier, target_name=None, configuration_name=None): + """ + Adds the code sign information to the project and creates the appropriate flags in the configuration. + In xcode 8+ the provisioning_profile_uuid becomes optional, and the provisioning_profile_specifier becomes + mandatory. Contrariwise, in xcode 8< provisioning_profile_uuid becomes mandatory and + provisioning_profile_specifier becomes optional. + + :param code_sign_identity: Code sign identity name. Usually formatted as: 'iPhone Distribution[: (MAAYFEXXXX)]' + :param development_team: Development team identifier string. Usually formatted as: 'MAAYFEXXXX' + :param provisioning_profile_uuid: Provisioning profile UUID string. Usually formatted as: '6f1ffc4d-xxxx-xxxx-xxxx-6dc186280e1e' + :param provisioning_profile_specifier: Provisioning profile specifier (a.k.a. name) string. + :param target_name: Target name or list of target names to add the flag to or None for every target + :param configuration_name: Configuration name to add the flag to or None for every configuration + :return: + """ + self.set_flags('CODE_SIGN_IDENTITY[sdk=iphoneos*]', code_sign_identity, target_name, configuration_name) + self.set_flags('DEVELOPMENT_TEAM', development_team, target_name, configuration_name) + self.set_flags('PROVISIONING_PROFILE', provisioning_profile_uuid, target_name, configuration_name) + self.set_flags('PROVISIONING_PROFILE_SPECIFIER', provisioning_profile_specifier, target_name, configuration_name) + + for target in self.objects.get_targets(target_name): + self.objects[self.rootObject].set_provisioning_style(PBXProvisioningTypes.MANUAL, target) diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFlags.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFlags.py.meta new file mode 100644 index 0000000..7aae476 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectFlags.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c526e83cbc5a44a9ba4cba060209af40 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectGroups.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectGroups.py new file mode 100644 index 0000000..aa72c6e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectGroups.py @@ -0,0 +1,158 @@ +from pbxproj.pbxextensions import TreeType +from pbxproj.pbxsections import PBXGroup, PBXFileReference + + +class ProjectGroups: + """ + This class provides separation of concerns, this class contains all methods related to groups manipulations. + This class should not be instantiated on its own + """ + + def __init__(self): + raise EnvironmentError('This class cannot be instantiated directly, use XcodeProject instead') + + def add_group(self, name, path=None, parent=None, source_tree=''): + """ + Add a new group with the given name and optionally path to the parent group. If parent is None, the group will + be added to the 'root' group. + Additionally the source tree type can be specified, normally it's group. + :param name: Name of the group to be added (visible folder name) + :param path: Path relative to the project where this group points to. If not present, name will match the path + name + :param parent: The PBXGroup that will be the parent of this group. If parent is None, the default 'root' group + will be used as parent + :param source_tree: The type of group to be created + :return: PBXGroup created + """ + group = PBXGroup.create(name=name, path=path, tree=source_tree) + + parent = self._get_parent_group(parent) + + parent.add_child(group) + self.objects[group.get_id()] = group + + return group + + def remove_group_by_id(self, group_id, recursive=True): + """ + Remove the group matching the given group_id. If recursive is True, all descendants of this group are also removed. + :param group_id: The group id to be removed + :param recursive: All descendants should be removed as well + :return: True if the element was removed successfully, False if an error occured or there was nothing to remove. + """ + group = self.objects[group_id] + if group is None: + return False + + result = True + # iterate over the children and determine if they are file/group and call the right method. + for subgroup_id in list(group.children): + subgroup = self.objects[subgroup_id] + if subgroup is None: + return False + + if recursive and isinstance(subgroup, PBXGroup): + result &= self.remove_group_by_id(subgroup.get_id(), recursive) + if isinstance(subgroup, PBXFileReference): + result &= self.remove_file_by_id(subgroup.get_id()) + + if not result: + return False + + del self.objects[group.get_id()] + + # remove the reference from any other group object that could be containing it. + for other_group in self.objects.get_objects_in_section('PBXGroup'): + other_group.remove_child(group) + + return True + + def remove_group_by_name(self, group_name, recursive=True): + """ + Remove the groups matching the given name. If recursive is True, all descendants of this group are also removed. + This method could cause the removal of multiple groups that not necessarily are intended to be removed, use with + caution + :param group_name: The group name to be removed + :param recursive: All descendants should be removed as well + :return: True if the element was removed successfully, False otherwise + """ + groups = self.get_groups_by_name(name=group_name) + + if groups.__len__() == 0: + return False + + for group in groups: + if not self.remove_group_by_id(group.get_id(), recursive): + return False + + return True + + def get_groups_by_name(self, name, parent=None): + """ + Retrieve all groups matching the given name and optionally filtered by the given parent node. + :param name: The name of the group that has to be returned + :param parent: A PBXGroup object where the object has to be retrieved from. If None all matching groups are returned + :return: An list of all matching groups + """ + groups = self.objects.get_objects_in_section('PBXGroup') + groups = [group for group in groups if group.get_name() == name] + + if parent: + return [group for group in groups if parent.has_child(group)] + + return groups + + def get_groups_by_path(self, path, parent=None): + """ + Retrieve all groups matching the given path and optionally filtered by the given parent node. + The path is converted into the absolute path of the OS before comparison. + :param path: The name of the group that has to be returned + :param parent: A PBXGroup object where the object has to be retrieved from. If None all matching groups are returned + :return: An list of all matching groups + """ + groups = self.objects.get_objects_in_section('PBXGroup') + groups = [group for group in groups if group.get_path() == path] + + if parent: + return [group for group in groups if parent.has_child(group)] + + return groups + + def get_or_create_group(self, name, path=None, parent=None, make_relative=False): + if not name: + return None + + groups = self.get_groups_by_name(name, parent) + if groups.__len__() > 0: + return groups[0] + + if make_relative and path is not None: + _, path, _ = self._get_path_and_tree(self._source_root, path, TreeType.SOURCE_ROOT) + + return self.add_group(name, path, parent) + + def _get_parent_group(self, parent): + if parent is None: + # search for the mainGroup of the project + project = self.objects[self['rootObject']] + if project: + parent = self.objects[project['mainGroup']] + if parent is not None: + return parent + + # search for the group without name + parent = self.get_groups_by_name(None) + + # if there is no parent, create and empty parent group, add it to the objects + if parent.__len__() > 0: + return parent[0] + + parent = PBXGroup.create(path=None, name=None) + self.objects[parent.get_id()] = parent + return parent + + # it's not a group instance, assume it's an id + if not isinstance(parent, PBXGroup): + return self.objects[parent] + + return parent diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectGroups.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectGroups.py.meta new file mode 100644 index 0000000..16703a5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/ProjectGroups.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4b2972d3875d248d8881db17bdf84bac +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/__init__.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/__init__.py new file mode 100644 index 0000000..3b6be4f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/__init__.py @@ -0,0 +1,3 @@ +from pbxproj.pbxextensions.ProjectFiles import * +from pbxproj.pbxextensions.ProjectFlags import * +from pbxproj.pbxextensions.ProjectGroups import * diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/__init__.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/__init__.py.meta new file mode 100644 index 0000000..f596e70 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxextensions/__init__.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bd345275f0f514c12b91d059dd517823 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections.meta new file mode 100644 index 0000000..f260029 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bf2504c34e6ea4de48920ddafdd57e36 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXAggregateTarget.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXAggregateTarget.py new file mode 100644 index 0000000..8420cc7 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXAggregateTarget.py @@ -0,0 +1,5 @@ +from pbxproj.pbxsections.PBXGenericTarget import PBXGenericTarget + + +class PBXAggregateTarget(PBXGenericTarget): + pass diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXAggregateTarget.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXAggregateTarget.py.meta new file mode 100644 index 0000000..789018d --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXAggregateTarget.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1efab35c8126a42bfa8bc8d73cee2f68 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXBuildFile.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXBuildFile.py new file mode 100644 index 0000000..604f7d5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXBuildFile.py @@ -0,0 +1,156 @@ +import sys + +from pbxproj import PBXGenericObject, PBXList + + +class PBXBuildFile(PBXGenericObject): + def __init__(self, parent=None): + self._parent = parent + self._section = None + + @classmethod + def create(cls, file_ref, attributes=None, compiler_flags=None, is_product=False): + ref_key = 'productRef' if is_product else 'fileRef' + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + ref_key: file_ref.get_id(), + 'settings': cls._get_settings(attributes, compiler_flags) + }) + + @classmethod + def _get_settings(cls, attributes=None, compiler_flags=None): + if attributes is None and compiler_flags is None: + return None + + settings = {} + if attributes is not None: + if not isinstance(attributes, list): + attributes = [attributes] + settings['ATTRIBUTES'] = attributes + + if compiler_flags is not None: + if not isinstance(compiler_flags, list): + compiler_flags = [compiler_flags] + settings['COMPILER_FLAGS'] = ' '.join(compiler_flags) + + return settings + + def _print_object(self, indent_depth='', entry_separator='\n', object_start='\n', indent_increment='\t'): + return super(PBXBuildFile, self)._print_object('', entry_separator=' ', object_start='', indent_increment='') + + def _get_comment(self): + comment = '(null)' + if hasattr(self, 'fileRef'): + comment = self.fileRef._get_comment() + if hasattr(self, 'productRef'): + comment = self.productRef._get_comment() + return f'{comment} in {self._get_section()}' + + def _get_section(self): + if self._section is not None: + return self._section + + print('[WARNING] falling back to slow mechanism', file=sys.stderr) + objects = self.get_parent() + target = self.get_id() + + for section in objects.get_sections(): + for obj in objects.get_objects_in_section(section): + if 'files' in obj and target in obj.files: + self._section = obj._get_comment() + break + return self._section + + def get_attributes(self): + if 'settings' not in self: + return None + + if 'ATTRIBUTES' not in self.settings: + return None + + return self.settings['ATTRIBUTES'] + + def get_compiler_flags(self): + if 'settings' not in self or 'COMPILER_FLAGS' not in self.settings: + return None + + return self.settings['COMPILER_FLAGS'] + + def add_attributes(self, attributes): + if not isinstance(attributes, list): + attributes = [attributes] + + if 'settings' not in self: + self['settings'] = PBXGenericObject() + + if 'ATTRIBUTES' not in self.settings: + self.settings['ATTRIBUTES'] = PBXList() + + # append, if it's assigned and the list only has 1 element it will turn it into a string + self.settings.ATTRIBUTES += attributes + + def remove_attributes(self, attributes): + if 'settings' not in self or 'ATTRIBUTES' not in self.settings: + # nothing to remove + return False + + if not isinstance(attributes, list): + attributes = [attributes] + + for attribute in attributes: + self.settings.ATTRIBUTES.remove(attribute) + + return self._clean_up_settings() + + def add_compiler_flags(self, compiler_flags): + if isinstance(compiler_flags, list): + compiler_flags = ' '.join(compiler_flags) + + if 'settings' not in self: + self['settings'] = PBXGenericObject() + + if 'COMPILER_FLAGS' not in self.settings: + self.settings['COMPILER_FLAGS'] = '' + + self.settings['COMPILER_FLAGS'] += ' ' + compiler_flags + self.settings['COMPILER_FLAGS'] = self.settings['COMPILER_FLAGS'].strip() + + def remove_compiler_flags(self, compiler_flags): + if 'settings' not in self or 'COMPILER_FLAGS' not in self.settings: + # nothing to remove + return False + + if not isinstance(compiler_flags, list): + compiler_flags = [compiler_flags] + + for flag in compiler_flags: + self.settings['COMPILER_FLAGS'] = self.settings['COMPILER_FLAGS'].replace(flag, '') + self.settings['COMPILER_FLAGS'] = self.settings['COMPILER_FLAGS'].strip() + + return self._clean_up_settings() + + def _clean_up_settings(self): + # no attributes remain, remove the element + if 'ATTRIBUTES' in self.settings and self.settings.ATTRIBUTES.__len__() == 0: + del self.settings['ATTRIBUTES'] + + # no flags remain, remove the element + if 'COMPILER_FLAGS' in self.settings and self.settings.COMPILER_FLAGS.__len__() == 0: + del self.settings['COMPILER_FLAGS'] + + if self.settings.get_keys().__len__() == 0: + del self['settings'] + + return True + + def remove(self, recursive=True): + if recursive: + build_phases = [build_phase for build_phase in self.get_parent().get_sections() if build_phase.endswith('BuildPhase')] + for build_phase in self.get_parent().get_objects_in_section(*build_phases): + # if this build_phase contains a reference to this build_file... + if 'files' in build_phase and self.get_id() in build_phase.files: + build_phase.remove_build_file(self) + + del self.get_parent()[self.get_id()] + return True \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXBuildFile.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXBuildFile.py.meta new file mode 100644 index 0000000..5460fe6 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXBuildFile.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 71217c2dd00c9438fa687c829c26f6f2 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXContainerItemProxy.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXContainerItemProxy.py new file mode 100644 index 0000000..3f6945f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXContainerItemProxy.py @@ -0,0 +1,22 @@ +from pbxproj import PBXGenericObject + + +class PBXContainerItemProxy(PBXGenericObject): + @classmethod + def create(cls, file_ref, remote_ref, proxy_type=2): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'containerPortal': file_ref.get_id(), + 'proxyType': proxy_type, + 'remoteGlobalIDString': remote_ref.productReference, + 'remoteInfo': remote_ref.productName + }) + + def _get_comment(self): + return 'PBXContainerItemProxy' + + def __getitem__(self, item): + if item == 'remoteGlobalIDString': + return getattr(self, item).__str__() + return super().__getitem__(item) \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXContainerItemProxy.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXContainerItemProxy.py.meta new file mode 100644 index 0000000..4cdd54e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXContainerItemProxy.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5472f0aa8433047c78302c74869cf0fd +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXCopyFilesBuildPhase.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXCopyFilesBuildPhase.py new file mode 100644 index 0000000..467e3ae --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXCopyFilesBuildPhase.py @@ -0,0 +1,26 @@ +from pbxproj.pbxsections.PBXGenericBuildPhase import PBXGenericBuildPhase + + +class PBXCopyFilesBuildPhaseNames: + EMBEDDED_FRAMEWORKS = 'Embed Frameworks' + + +class PBXCopyFilesBuildPhase(PBXGenericBuildPhase): + @classmethod + def create(cls, name=None, files=None, dest_path='', dest_subfolder_spec='10'): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'name': name, + 'files': files if files else [], + 'buildActionMask': 0x7FFFFFFF, + 'dstSubfolderSpec': dest_subfolder_spec, + 'dstPath': dest_path, + 'runOnlyForDeploymentPostprocessing': 0 + }) + + def _get_comment(self): + comment = super(PBXCopyFilesBuildPhase, self)._get_comment() + if comment is None: + return 'CopyFiles' + return comment diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXCopyFilesBuildPhase.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXCopyFilesBuildPhase.py.meta new file mode 100644 index 0000000..7bd0507 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXCopyFilesBuildPhase.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1939dbbc1003b48bfaab23fcaf33b6d0 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileReference.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileReference.py new file mode 100644 index 0000000..a44e245 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileReference.py @@ -0,0 +1,58 @@ +import os + +from pbxproj import PBXGenericObject + + +class PBXFileReference(PBXGenericObject): + @classmethod + def create(cls, path, tree='SOURCE_ROOT'): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'path': path, + 'name': os.path.split(path)[1], + 'sourceTree': tree + }) + + def set_explicit_file_type(self, file_type): + if 'lastKnownFileType' in self: + del self['lastKnownFileType'] + self['explicitFileType'] = file_type + + def set_last_known_file_type(self, file_type): + if 'explicitFileType' in self: + del self['explicitFileType'] + self['lastKnownFileType'] = file_type + + def get_file_type(self): + if 'explicitFileType' in self: + return self.explicitFileType + return self.lastKnownFileType + + def _print_object(self, indent_depth='', entry_separator='\n', object_start='\n', + indent_increment='\t'): + return super(PBXFileReference, self)._print_object('', entry_separator=' ', object_start='', + indent_increment='') + + def get_name(self): + if hasattr(self, 'name'): + return self.name + return self.path + + def remove(self, recursive=True): + parent = self.get_parent() + # search on the BuildFiles if there is a build file to be removed, and remove it + build_files = [build_file for build_file in parent.get_objects_in_section('PBXBuildFile') + if build_file.fileRef == self.get_id()] + for build_file in build_files: + build_file.remove(recursive) + + # search for each group that has a reference to the build file and remove it from it. + for group in parent.get_objects_in_section('PBXGroup'): + if self.get_id() in group.children: + group.remove_child(self) + + # remove the file reference from it's parent + del parent[self.get_id()] + + return True diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileReference.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileReference.py.meta new file mode 100644 index 0000000..92906cf --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileReference.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 43731889321854e0d8bcdc397dc45497 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileSystemSynchronizedRootGroup.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileSystemSynchronizedRootGroup.py new file mode 100644 index 0000000..5091be7 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileSystemSynchronizedRootGroup.py @@ -0,0 +1,17 @@ +from pbxproj import PBXGenericObject + + +class PBXFileSystemSynchronizedRootGroup(PBXGenericObject): + @classmethod + def create(cls, explicit_file_types, explicit_folders, path, tree='SOURCE_ROOT'): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'explicitFileTypes': explicit_file_types, + 'explicitFolders': explicit_folders, + 'path': path, + 'sourceTree': tree + }) + + def _print_object(self, indent_depth='', entry_separator='\n', object_start='\n', indent_increment='\t'): + return super(PBXFileSystemSynchronizedRootGroup, self)._print_object('', entry_separator=' ', object_start='', indent_increment='') diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileSystemSynchronizedRootGroup.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileSystemSynchronizedRootGroup.py.meta new file mode 100644 index 0000000..019009a --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFileSystemSynchronizedRootGroup.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b259d333361154b91851153d79f68285 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFrameworksBuildPhase.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFrameworksBuildPhase.py new file mode 100644 index 0000000..fc601b1 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFrameworksBuildPhase.py @@ -0,0 +1,6 @@ +from pbxproj.pbxsections.PBXGenericBuildPhase import PBXGenericBuildPhase + + +class PBXFrameworksBuildPhase(PBXGenericBuildPhase): + def _get_comment(self): + return 'Frameworks' diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFrameworksBuildPhase.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFrameworksBuildPhase.py.meta new file mode 100644 index 0000000..f2ce57d --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXFrameworksBuildPhase.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 91e7bfcaa390845cfbb4fb5c6c9d6043 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericBuildPhase.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericBuildPhase.py new file mode 100644 index 0000000..b3047da --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericBuildPhase.py @@ -0,0 +1,38 @@ +from pbxproj.PBXGenericObject import PBXGenericObject +from pbxproj.pbxsections.PBXBuildFile import PBXBuildFile + + +class PBXGenericBuildPhase(PBXGenericObject): + @classmethod + def create(cls, name=None, files=None): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'name': name, + 'files': files if files else [], + 'buildActionMask': 0x7FFFFFFF, + 'runOnlyForDeploymentPostprocessing': 0 + }) + + def add_build_file(self, build_file): + if not isinstance(build_file, PBXBuildFile): + return False + + self.files.append(build_file.get_id()) + + # update the build_file section + build_file._section = self._get_comment() + + return True + + def remove_build_file(self, build_file): + if not isinstance(build_file, PBXBuildFile): + return False + + self.files.remove(build_file.get_id()) + del self.get_parent()[build_file.get_id()] + + # update the build_file section + build_file._section = None + + return True diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericBuildPhase.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericBuildPhase.py.meta new file mode 100644 index 0000000..a0a8e96 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericBuildPhase.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 928a0fe317b0949bb840d9a6c9139d00 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericTarget.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericTarget.py new file mode 100644 index 0000000..d4d0c67 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericTarget.py @@ -0,0 +1,43 @@ +from pbxproj.PBXGenericObject import PBXGenericObject +from pbxproj.pbxsections.PBXGenericBuildPhase import PBXGenericBuildPhase + + +class PBXGenericTarget(PBXGenericObject): + def get_or_create_build_phase(self, build_phase_type, search_parameters=None, create_parameters=()): + result = [] + parent = self.get_parent() + search_parameters = search_parameters if search_parameters is not None else {} + + if build_phase_type is None: + return result + + for build_phase_id in self.buildPhases: + target_build_phase = parent[build_phase_id] + current_build_phase = target_build_phase.isa + + if current_build_phase == build_phase_type and \ + all(key in target_build_phase and target_build_phase[key] == search_parameters[key] for key in search_parameters): + result.append(target_build_phase) + + if result.__len__() == 0: + build_phase = self._get_class_reference(build_phase_type).create(*create_parameters) + parent[build_phase.get_id()] = build_phase + self.add_build_phase(build_phase) + result.append(build_phase) + + return result + + def add_build_phase(self, build_phase, position=None): + if position is None: + position = self.buildPhases.__len__() + + self.buildPhases.insert(position, build_phase.get_id()) + + def remove_build_phase(self, build_phase): + if not isinstance(build_phase, PBXGenericBuildPhase): + return False + + self.buildPhases.remove(build_phase.get_id()) + del self.get_parent()[build_phase.get_id()] + + return True diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericTarget.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericTarget.py.meta new file mode 100644 index 0000000..88c883b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGenericTarget.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a7ee8dc1af5204a1ab059b124117cf60 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGroup.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGroup.py new file mode 100644 index 0000000..6cabb5e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGroup.py @@ -0,0 +1,74 @@ +from pbxproj import PBXGenericObject +from pbxproj.pbxsections import PBXFileReference, PBXReferenceProxy + + +class PBXGroup(PBXGenericObject): + @classmethod + def create(cls, path=None, name=None, tree='', children=None): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'children': children if children else [], + 'name': name, + 'path': path, + 'sourceTree': tree + }) + + def get_name(self): + if 'name' in self: + return self.name + if 'path' in self: + return self.path + return None + + def get_path(self): + if 'path' in self: + return self.path + if 'name' in self: + return self.name + return None + + def has_child(self, child): + """ + Checks if the given child id + :param child: The id to check if it's a child of the group + :return: True if the given id it's a child of this group, False otherwise + """ + if 'children' not in self: + return False + + if not isinstance(child, str): + child = child.get_id() + + return child in self.children + + def add_child(self, child): + # if it's not the right type of children for the group + if not isinstance(child, PBXGroup) \ + and not isinstance(child, PBXFileReference) \ + and not isinstance(child, PBXReferenceProxy): + return False + + self.children.append(child.get_id()) + return True + + def remove_child(self, child): + if self.has_child(child): + self.children.remove(child.get_id()) + return True + + return False + + def remove(self, recursive=True): + parent = self.get_parent() + # remove from the objects reference + del parent[self.get_id()] + + # remove children if necessary + if recursive: + for subgroup_id in self.children: + subgroup = parent[subgroup_id] + if subgroup is None or not subgroup.remove(recursive): + return False + + return True diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGroup.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGroup.py.meta new file mode 100644 index 0000000..e57f96c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXGroup.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fb5f98c19751f483a884aba32fb97f81 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXHeadersBuildPhase.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXHeadersBuildPhase.py new file mode 100644 index 0000000..94d445e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXHeadersBuildPhase.py @@ -0,0 +1,6 @@ +from pbxproj.pbxsections.PBXGenericBuildPhase import PBXGenericBuildPhase + + +class PBXHeadersBuildPhase(PBXGenericBuildPhase): + def _get_comment(self): + return 'Headers' diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXHeadersBuildPhase.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXHeadersBuildPhase.py.meta new file mode 100644 index 0000000..1a38414 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXHeadersBuildPhase.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3f4ae4d0bf0304588850f0ef610ea867 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXLegacyTarget.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXLegacyTarget.py new file mode 100644 index 0000000..0f3a6e2 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXLegacyTarget.py @@ -0,0 +1,5 @@ +from pbxproj.pbxsections.PBXGenericTarget import PBXGenericTarget + + +class PBXLegacyTarget(PBXGenericTarget): + pass diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXLegacyTarget.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXLegacyTarget.py.meta new file mode 100644 index 0000000..562da5b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXLegacyTarget.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 109f1b9609843436a812e4a48d94703c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXNativeTarget.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXNativeTarget.py new file mode 100644 index 0000000..d768766 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXNativeTarget.py @@ -0,0 +1,5 @@ +from pbxproj.pbxsections.PBXGenericTarget import PBXGenericTarget + + +class PBXNativeTarget(PBXGenericTarget): + pass diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXNativeTarget.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXNativeTarget.py.meta new file mode 100644 index 0000000..17f3a99 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXNativeTarget.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 14e36120958574120a0c1f71bc51c443 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXProject.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXProject.py new file mode 100644 index 0000000..be510df --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXProject.py @@ -0,0 +1,23 @@ +from pbxproj import PBXGenericObject + + +class PBXProvisioningTypes: + MANUAL = 'Manual' + AUTOMATIC = 'Automatic' + + +class PBXProject(PBXGenericObject): + def _get_comment(self): + return 'Project object' + + def set_provisioning_style(self, provisioning_type, target): + if 'attributes' not in self: + self['attributes'] = PBXGenericObject() + + if 'TargetAttributes' not in self.attributes: + self.attributes['TargetAttributes'] = PBXGenericObject() + + if target.get_id() not in self.attributes.TargetAttributes: + self.attributes.TargetAttributes[target.get_id()] = PBXGenericObject() + + self.attributes.TargetAttributes[target.get_id()]['ProvisioningStyle'] = provisioning_type diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXProject.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXProject.py.meta new file mode 100644 index 0000000..957974b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXProject.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bcebe426eee224c91a9b80728ba605b9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXReferenceProxy.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXReferenceProxy.py new file mode 100644 index 0000000..173234a --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXReferenceProxy.py @@ -0,0 +1,20 @@ +from pbxproj import PBXGenericObject + + +class PBXReferenceProxy(PBXGenericObject): + @classmethod + def create(cls, file_ref, remote_ref, tree='BUILT_PRODUCTS_DIR'): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'path': file_ref.path, + 'fileType': file_ref.get_file_type(), + 'remoteRef': remote_ref.get_id(), + 'sourceTree': tree + }) + + def get_file_type(self): + return self.fileType + + def get_name(self): + return self.path diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXReferenceProxy.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXReferenceProxy.py.meta new file mode 100644 index 0000000..47a1a37 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXReferenceProxy.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 576e5dd46f7114f28948a081d641d6ff +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXResourcesBuildPhase.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXResourcesBuildPhase.py new file mode 100644 index 0000000..454a2bd --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXResourcesBuildPhase.py @@ -0,0 +1,6 @@ +from pbxproj.pbxsections.PBXGenericBuildPhase import PBXGenericBuildPhase + + +class PBXResourcesBuildPhase(PBXGenericBuildPhase): + def _get_comment(self): + return 'Resources' diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXResourcesBuildPhase.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXResourcesBuildPhase.py.meta new file mode 100644 index 0000000..3b345a3 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXResourcesBuildPhase.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c0773d36b87b44e0f801ae16cec26e23 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXShellScriptBuildPhase.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXShellScriptBuildPhase.py new file mode 100644 index 0000000..8e83f08 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXShellScriptBuildPhase.py @@ -0,0 +1,24 @@ +from pbxproj.pbxsections.PBXGenericBuildPhase import PBXGenericBuildPhase + + +class PBXShellScriptBuildPhase(PBXGenericBuildPhase): + + @classmethod + def create(cls, script, name=None, files=None, shell_path="/bin/sh", input_paths=None, output_paths=None, + show_in_log='0', run_install_build=0): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'name': name, + 'files': files if files else [], + 'buildActionMask': 0x7FFFFFFF, + 'inputPaths': input_paths if input_paths else [], + 'outputPaths': output_paths if output_paths else [], + 'runOnlyForDeploymentPostprocessing': run_install_build, + 'shellPath': shell_path, + 'shellScript': script, + 'showEnvVarsInLog': show_in_log + }) + + def _get_comment(self): + return getattr(self, 'name', 'ShellScript') diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXShellScriptBuildPhase.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXShellScriptBuildPhase.py.meta new file mode 100644 index 0000000..9f425ae --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXShellScriptBuildPhase.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 328fddcf78d4348578b6addf26d9f075 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXSourcesBuildPhase.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXSourcesBuildPhase.py new file mode 100644 index 0000000..848a907 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXSourcesBuildPhase.py @@ -0,0 +1,6 @@ +from pbxproj.pbxsections.PBXGenericBuildPhase import PBXGenericBuildPhase + + +class PBXSourcesBuildPhase(PBXGenericBuildPhase): + def _get_comment(self): + return 'Sources' diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXSourcesBuildPhase.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXSourcesBuildPhase.py.meta new file mode 100644 index 0000000..6e1f41e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXSourcesBuildPhase.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8474414b3824b48ef9596b6ef5782a25 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXTargetDependency.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXTargetDependency.py new file mode 100644 index 0000000..d2b4499 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXTargetDependency.py @@ -0,0 +1,6 @@ +from pbxproj import PBXGenericObject + + +class PBXTargetDependency(PBXGenericObject): + def _get_comment(self): + return 'PBXTargetDependency' diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXTargetDependency.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXTargetDependency.py.meta new file mode 100644 index 0000000..f21b09b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/PBXTargetDependency.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3ec02d8580323447fae4fc8a0debe660 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCBuildConfiguration.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCBuildConfiguration.py new file mode 100644 index 0000000..32256b5 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCBuildConfiguration.py @@ -0,0 +1,84 @@ +import os +from collections import OrderedDict + +from pbxproj import PBXGenericObject + + +class XCBuildConfigurationFlags: + OTHER_CFLAGS = 'OTHER_CFLAGS' + OTHER_LDFLAGS = 'OTHER_LDFLAGS' + HEADER_SEARCH_PATHS = 'HEADER_SEARCH_PATHS' + LIBRARY_SEARCH_PATHS = 'LIBRARY_SEARCH_PATHS' + FRAMEWORK_SEARCH_PATHS = 'FRAMEWORK_SEARCH_PATHS' + LD_RUNPATH_SEARCH_PATHS = 'LD_RUNPATH_SEARCH_PATHS' + + +class XCBuildConfiguration(PBXGenericObject): + + def add_flags(self, flag_name, flags): + if 'buildSettings' not in self: + self['buildSettings'] = PBXGenericObject() + + current_flags = self.buildSettings[flag_name] + if current_flags is None: + self.set_flags(flag_name, flags) + return + + if not isinstance(current_flags, list): + current_flags = [current_flags] + + if not isinstance(flags, list): + flags = [flags] + + self.set_flags(flag_name, current_flags + flags) + + def set_flags(self, flag_name, flags): + if 'buildSettings' not in self: + self['buildSettings'] = PBXGenericObject() + + if not isinstance(flags, list): + flags = [flags] + + self.buildSettings[flag_name] = list(OrderedDict.fromkeys(flags)) + + def remove_flags(self, flag_name, flags): + if 'buildSettings' not in self or self.buildSettings[flag_name] is None: + # nothing to remove + return False + + current_flags = self.buildSettings[flag_name] + if not isinstance(current_flags, list): + current_flags = [current_flags] + + if flags is None: + flags = current_flags + + if not isinstance(flags, list): + flags = [flags] + + self.buildSettings[flag_name] = [x for x in current_flags if x not in flags] + return True + + def add_search_paths(self, key, paths, recursive=False, escape=False): + if not isinstance(paths, list): + paths = [paths] + + # build the recursive/escaped strings and add the flags accordingly + flags = [] + for path in paths: + if path == '$(inherited)': + escape = False + recursive = False + + if escape: + path = f'"{path}"' + + if recursive and not path.endswith('/**'): + path = os.path.join(path, '**') + + flags.append(path) + + self.add_flags(key, flags) + + def remove_search_paths(self, key, paths): + return self.remove_flags(key, paths) diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCBuildConfiguration.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCBuildConfiguration.py.meta new file mode 100644 index 0000000..ad3b77b --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCBuildConfiguration.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0079a33dfe11240d7ba8f85c3a199f9f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCConfigurationList.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCConfigurationList.py new file mode 100644 index 0000000..70aa38f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCConfigurationList.py @@ -0,0 +1,21 @@ +from pbxproj import PBXGenericObject + + +class XCConfigurationList(PBXGenericObject): + def _get_comment(self): + info = self._get_section() + return f'Build configuration list for {info[0]} "{info[1]}"' + + def _get_section(self): + objects = self.get_parent() + target_id = self.get_id() + + for obj in objects.get_objects_in_section('PBXNativeTarget', 'PBXLegacyTarget', 'PBXAggregateTarget'): + if target_id in obj.buildConfigurationList: + return obj.isa, obj.name + + projects = filter(lambda o: target_id in o.buildConfigurationList, objects.get_objects_in_section('PBXProject')) + project = projects.__next__() + target = objects[project.targets[0]] + name = target.name if hasattr(target, 'name') else target.productName + return project.isa, name diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCConfigurationList.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCConfigurationList.py.meta new file mode 100644 index 0000000..e2e38a7 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCConfigurationList.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c8cacae2380ab4d93bea8ccdf349678a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCLocalSwiftPackageReference.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCLocalSwiftPackageReference.py new file mode 100644 index 0000000..d7cb8b6 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCLocalSwiftPackageReference.py @@ -0,0 +1,14 @@ +from pbxproj import PBXGenericObject + + +class XCLocalSwiftPackageReference(PBXGenericObject): + @classmethod + def create(cls, relative_path): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'relativePath': relative_path + }) + + def _get_comment(self): + return f'XCLocalSwiftPackageReference "{self.relativePath}"' diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCLocalSwiftPackageReference.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCLocalSwiftPackageReference.py.meta new file mode 100644 index 0000000..5a97386 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCLocalSwiftPackageReference.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 59964f6cffc3446a09acae8db90817a5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCRemoteSwiftPackageReference.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCRemoteSwiftPackageReference.py new file mode 100644 index 0000000..4815b17 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCRemoteSwiftPackageReference.py @@ -0,0 +1,20 @@ +from pbxproj import PBXGenericObject + + +class XCRemoteSwiftPackageReference(PBXGenericObject): + @classmethod + def create(cls, repository_url, requirement): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'repositoryURL': repository_url, + 'requirement': PBXGenericObject().parse(requirement) + }) + + def _get_comment(self): + name = None + if hasattr(self, 'repositoryURL'): + name = self.repositoryURL.split('/')[-1] + if name.endswith('.git'): + name = name[:-4] + return f'XCRemoteSwiftPackageReference "{name}"' diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCRemoteSwiftPackageReference.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCRemoteSwiftPackageReference.py.meta new file mode 100644 index 0000000..4f4ecc9 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCRemoteSwiftPackageReference.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0948cf75c0d984462b93512ee6bdc0d1 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCSwiftPackageProductDependency.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCSwiftPackageProductDependency.py new file mode 100644 index 0000000..a440fe1 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCSwiftPackageProductDependency.py @@ -0,0 +1,18 @@ +from pbxproj import PBXGenericObject + + +class XCSwiftPackageProductDependency(PBXGenericObject): + @classmethod + def create(cls, package_ref, product_name): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'package': package_ref.get_id(), + 'productName': product_name + }) + + def _get_comment(self): + if hasattr(self, 'productName'): + return self.productName + + return None diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCSwiftPackageProductDependency.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCSwiftPackageProductDependency.py.meta new file mode 100644 index 0000000..7707a44 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/XCSwiftPackageProductDependency.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a6f29085a130a48fdae45c598fe4fddb +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/__init__.py b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/__init__.py new file mode 100644 index 0000000..7a893f1 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/__init__.py @@ -0,0 +1,22 @@ +from pbxproj.pbxsections.PBXBuildFile import * +from pbxproj.pbxsections.PBXFileReference import * +from pbxproj.pbxsections.PBXFileSystemSynchronizedRootGroup import * +from pbxproj.pbxsections.PBXFrameworksBuildPhase import * +from pbxproj.pbxsections.PBXProject import * +from pbxproj.pbxsections.PBXResourcesBuildPhase import * +from pbxproj.pbxsections.PBXSourcesBuildPhase import * +from pbxproj.pbxsections.XCConfigurationList import * +from pbxproj.pbxsections.PBXContainerItemProxy import * +from pbxproj.pbxsections.PBXCopyFilesBuildPhase import * +from pbxproj.pbxsections.PBXShellScriptBuildPhase import * +from pbxproj.pbxsections.PBXTargetDependency import * +from pbxproj.pbxsections.PBXHeadersBuildPhase import * +from pbxproj.pbxsections.XCBuildConfiguration import * +from pbxproj.pbxsections.PBXAggregateTarget import * +from pbxproj.pbxsections.PBXNativeTarget import * +from pbxproj.pbxsections.PBXLegacyTarget import * +from pbxproj.pbxsections.PBXReferenceProxy import * +from pbxproj.pbxsections.PBXGroup import * +from pbxproj.pbxsections.XCSwiftPackageProductDependency import * +from pbxproj.pbxsections.XCRemoteSwiftPackageReference import * +from pbxproj.pbxsections.XCLocalSwiftPackageReference import * diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/__init__.py.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/__init__.py.meta new file mode 100644 index 0000000..d664b49 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/python_sites/pbxproj/pbxsections/__init__.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2fda7601ded5e45a6a7c3e0b740ef491 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/union_special_logo.png b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/union_special_logo.png new file mode 100644 index 0000000..a345b39 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/union_special_logo.png differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/union_special_logo.png.meta b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/union_special_logo.png.meta new file mode 100644 index 0000000..aeb4557 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Plugins/iOS/union_special_logo.png.meta @@ -0,0 +1,153 @@ +fileFormatVersion: 2 +guid: 70566064881ce4c569b989152b3f0c8f +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime.meta new file mode 100644 index 0000000..09796ba --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ba60c705e1667e543b1eab397510de02 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts.meta new file mode 100644 index 0000000..321bc66 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a69fe6f4f9f2f4f96a86eb3c694ebce3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK.meta new file mode 100644 index 0000000..68b60cf --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e0e27171b2d154be6ad00fd8be8a91a1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common.meta new file mode 100644 index 0000000..e0b65d6 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 62e8ba0e06eb946019868766b6f317ac +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/AIHelpType.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/AIHelpType.cs new file mode 100644 index 0000000..bb014c3 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/AIHelpType.cs @@ -0,0 +1,176 @@ +using System; +using UnityEngine; + +namespace EngineSdkConverter.Unity.SDK +{ + /// + /// AIHelp事件类型 + /// + public enum AiHelpEventType { + /** + * Event for SDK initialization + */ + INITIALIZATION, + + /** + * Event for user login + */ + USER_LOGIN, + + /** + * Event for enterprise authentication + */ + ENTERPRISE_AUTH, + + /** + * Event for opening or closing a session (window) + */ + SESSION_OPEN, + SESSION_CLOSE, + + /** + * Event for message arrival + */ + MESSAGE_ARRIVAL, + + /** + * Event for log upload + */ + LOG_UPLOAD, + + /** + * Event for URL click + */ + URL_CLICK + } + + /// + /// AIHelp初始化参数 + /// + public class AIHelpInitType + { + public bool isInIndia; + public bool isInChinaMainland; + + public AIHelpInitType(bool isInIndia, bool isInChinaMainland) + { + this.isInIndia = isInIndia; + this.isInChinaMainland = isInChinaMainland; + } + } + + + /// + /// AIHelp事件回调 + /// + #if UNITY_ANDROID + public class AIHelpCallback : AndroidJavaProxy + { + public AIHelpCallback() : base("com.tuyoo.sdk.sdk_inter_layer.interfaces.RegisterAiHelpAsyncEventListener") { } + + public Action onAsyncEventReceivedCallback; + + public void onEvent(string jsonData, AndroidJavaObject ignored) + { + Debug.Log($"AIHelp event received: {jsonData}"); + NativeCallBack.Enqueue(() => + { + onAsyncEventReceivedCallback?.Invoke(jsonData, ignored); + }); + } + } + #endif + + /// + /// AIHelp显示参数 + /// + public class AIHelpShowTypeBuilder + { + public class AIHelpShowType + { + public string entranceId; + public string welcomeMsg; + } + + private AIHelpShowType _aihelpShowType; + + public AIHelpShowTypeBuilder() + { + _aihelpShowType = new AIHelpShowType(); + } + + public AIHelpShowTypeBuilder SetEntranceId(string entranceId) + { + _aihelpShowType.entranceId = entranceId; + return this; + } + + public AIHelpShowTypeBuilder SetWelcomeMsg(string welcomeMsg) + { + _aihelpShowType.welcomeMsg = welcomeMsg; + return this; + } + + public AIHelpShowType Build() + { + return _aihelpShowType; + } + } + + /// + /// AIHelp设置登录用户信息参数 + /// + public class AIHelpSetLoginUserInfoTypeBuilder + { + public class AIHelpSetLoginUserInfoType + { + public string userId; + public string serverId; + public string userName; + public string customData; + public string tag; + } + + private AIHelpSetLoginUserInfoType _aihelpSetLoginUserInfoType; + + public AIHelpSetLoginUserInfoTypeBuilder() + { + _aihelpSetLoginUserInfoType = new AIHelpSetLoginUserInfoType(); + } + + public AIHelpSetLoginUserInfoTypeBuilder SetUserId(string userId) + { + _aihelpSetLoginUserInfoType.userId = userId; + return this; + } + + public AIHelpSetLoginUserInfoTypeBuilder SetServerId(string serverId) + { + _aihelpSetLoginUserInfoType.serverId = serverId; + return this; + } + + public AIHelpSetLoginUserInfoTypeBuilder SetUserName(string userName) + { + _aihelpSetLoginUserInfoType.userName = userName; + return this; + } + + public AIHelpSetLoginUserInfoTypeBuilder SetCustomData(string customData) + { + _aihelpSetLoginUserInfoType.customData = customData; + return this; + } + + public AIHelpSetLoginUserInfoTypeBuilder SetTag(string tag) + { + _aihelpSetLoginUserInfoType.tag = tag; + return this; + } + + public AIHelpSetLoginUserInfoType Build() + { + return _aihelpSetLoginUserInfoType; + } + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/AIHelpType.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/AIHelpType.cs.meta new file mode 100644 index 0000000..6471f36 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/AIHelpType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 515287c54f5794c5a81418381b37a53a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CertificationType.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CertificationType.cs new file mode 100644 index 0000000..8ae3b05 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CertificationType.cs @@ -0,0 +1,129 @@ +using System; +using UnityEngine; + +namespace EngineSdkConverter.Unity.SDK +{ + /// + /// 防沉迷信息变更通知回调 + /// + #if UNITY_ANDROID + public class CertificationInfoChangedCallbackType : AndroidJavaProxy + { + public CertificationInfoChangedCallbackType() : base("com.tuyoo.sdk.sdk_inter_layer.interfaces.SurveyInterface$SurveyInfoChanged") { } + public Action callback; + + public void onSuccess(string data) + { + NativeCallBack.Enqueue(() => + { + callback?.Invoke(data); + }); + } + } + #endif + + /// + /// 防沉迷信息设置通知回调 + /// + #if UNITY_ANDROID + public class CertificationSetCallbackType : AndroidJavaProxy + { + public CertificationSetCallbackType() : base("com.tuyoo.sdk.sdk_inter_layer.interfaces.SurveyInterface$Result") { } + public Action callback; + + public void onSuccess(string data) + { + NativeCallBack.Enqueue(() => + { + callback?.Invoke(data); + }); + } + + public void onFail(string data) + { + NativeCallBack.Enqueue(() => + { + callback?.Invoke(data); + }); + } + } + #endif + + /// + /// 重新防沉迷信息设置通知回调 + /// + #if UNITY_ANDROID + public class ReCertificationSetCallbackType : AndroidJavaProxy + { + public ReCertificationSetCallbackType() : base("com.tuyoo.sdk.sdk_inter_layer.interfaces.SurveyInterface$Result") { } + public Action callback; + + public void onSuccess(string data) + { + NativeCallBack.Enqueue(() => + { + callback?.Invoke(data); + }); + } + + public void onFail(string data) + { + NativeCallBack.Enqueue(() => + { + callback?.Invoke(data); + }); + } + } + #endif + + /// + /// 防沉迷信息参数 + /// + public class CertificationEventBuilder + { + public class CertificationEvent + { + public string citizenId; + public string citizenName; + public string oldId; + public string oldName; + } + + private CertificationEvent _event; + + public CertificationEventBuilder() + { + _event = new CertificationEvent(); + } + + public CertificationEventBuilder SetCitizenId(string id) + { + _event.citizenId = id; + return this; + } + + public CertificationEventBuilder SetCitizenName(string name) + { + _event.citizenName = name; + return this; + } + + public CertificationEventBuilder SetOldId(string id) + { + _event.oldId = id; + return this; + } + + public CertificationEventBuilder SetOldName(string name) + { + _event.oldName = name; + return this; + } + + public CertificationEvent Build() + { + return _event; + } + } + +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CertificationType.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CertificationType.cs.meta new file mode 100644 index 0000000..65aa2e8 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CertificationType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ff7af2910576d4046b9820bf29513f2e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CommonType.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CommonType.cs new file mode 100644 index 0000000..3cbdffe --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CommonType.cs @@ -0,0 +1,18 @@ +namespace EngineSdkConverter.Unity.SDK +{ + public class KeyValueType + { + public string key; + public string value; + } + + public class MessageType + { + public string message; + } + + public class IdentifierType + { + public string identifier; + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CommonType.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CommonType.cs.meta new file mode 100644 index 0000000..1f4188c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/CommonType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: afd25c3bad9204d7696176546b035dfe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/FirebaseCrashType.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/FirebaseCrashType.cs new file mode 100644 index 0000000..9016e5c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/FirebaseCrashType.cs @@ -0,0 +1,135 @@ +namespace EngineSdkConverter.Unity.SDK +{ + /// + /// 设置FIrebase崩溃自定义键值对 + /// + public class FirebaseCrashCustomKeyBuilder + { + public class FirebaseCrashCustomKeyType : KeyValueType + { + } + + private FirebaseCrashCustomKeyType _firebaseCrashCustomKey; + + public FirebaseCrashCustomKeyBuilder() + { + _firebaseCrashCustomKey = new FirebaseCrashCustomKeyType(); + } + + public FirebaseCrashCustomKeyBuilder SetKey(string key) + { + _firebaseCrashCustomKey.key = key; + return this; + } + + public FirebaseCrashCustomKeyBuilder SetValue(string value) + { + _firebaseCrashCustomKey.value = value; + return this; + } + + public FirebaseCrashCustomKeyType Build() + { + return _firebaseCrashCustomKey; + } + } + + /// + /// 上报FIrebase崩溃自定义消息 + /// + public class FirebaseCrashLogBuilder + { + public class FirebaseCrashLogType : MessageType + { + } + + private FirebaseCrashLogType _firebaseCrashLog; + + public FirebaseCrashLogBuilder() + { + _firebaseCrashLog = new FirebaseCrashLogType(); + } + + public FirebaseCrashLogBuilder SetMessage(string message) + { + _firebaseCrashLog.message = message; + return this; + } + + public FirebaseCrashLogType Build() + { + return _firebaseCrashLog; + } + } + + /// + /// 设置FIrebase崩溃用户标识符 + /// + public class FirebaseCrashUserIdentifierBuilder + { + public class FirebaseCrashUserIdentifierType : IdentifierType + { + } + + private FirebaseCrashUserIdentifierType _firebaseCrashUserIdentifier; + + public FirebaseCrashUserIdentifierBuilder() + { + _firebaseCrashUserIdentifier = new FirebaseCrashUserIdentifierType(); + } + + public FirebaseCrashUserIdentifierBuilder SetIdentifier(string identifier) + { + _firebaseCrashUserIdentifier.identifier = identifier; + return this; + } + + public FirebaseCrashUserIdentifierType Build() + { + return _firebaseCrashUserIdentifier; + } + } + + /// + /// 上报FIrebase崩溃异常 + /// + public class FirebaseCrashExceptionTypeBuilder + { + public class FirebaseCrashExceptionType + { + public string name; + public string message; + public string stackTrace; + } + + private FirebaseCrashExceptionType _firebaseCrashException; + + public FirebaseCrashExceptionTypeBuilder() + { + _firebaseCrashException = new FirebaseCrashExceptionType(); + } + + public FirebaseCrashExceptionTypeBuilder SetName(string name) + { + _firebaseCrashException.name = name; + return this; + } + + public FirebaseCrashExceptionTypeBuilder SetMessage(string message) + { + _firebaseCrashException.message = message; + return this; + } + + public FirebaseCrashExceptionTypeBuilder SetStackTrace(string stackTrace) + { + _firebaseCrashException.stackTrace = stackTrace; + return this; + } + + public FirebaseCrashExceptionType Build() + { + return _firebaseCrashException; + } + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/FirebaseCrashType.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/FirebaseCrashType.cs.meta new file mode 100644 index 0000000..abae85f --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Common/FirebaseCrashType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c5e8cf6e0653f43bab9f63f0e0bad556 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Interface.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Interface.meta new file mode 100644 index 0000000..7cdf1b9 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Interface.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fe699f56d1aa64694b9e33664e1c04f8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Interface/NativeInterface.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Interface/NativeInterface.cs new file mode 100644 index 0000000..08f3fd7 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Interface/NativeInterface.cs @@ -0,0 +1,957 @@ +using System; +using UnityEngine; + +namespace EngineSdkConverter.Unity.SDK +{ + /// + /// 与原生平台交互的接口 + /// + public abstract class ISDKInterface + { + /// + /// 初始化接口 + /// + public virtual void Init() => throw new NotImplementedException(); + + /// + /// 初始化SDK + /// + /// 回调函数 + public virtual void InitSDK(Action callback) => throw new NotImplementedException(); + + /// + /// 个性化初始化SDK + /// + /// 初始化事件参数 + /// 回调函数 + public virtual void InitSDK(InitEventBuilder.InitEvent initEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 更新服务器地址 + /// + public virtual void UpdateServerUrl(string serverUrl) => throw new NotImplementedException(); + + /// + /// 更新服务器地址列表 + /// + /// 服务器地址列表 + public virtual void UpdateServerUrlList(string[] serverUrlList) => throw new NotImplementedException(); + + + /// + /// 静默登录 + /// + /// 回调函数 + public virtual void SilentLogin(Action callback) => throw new NotImplementedException(); + + /// + /// 静默登录 + /// + /// 登录事件参数 + /// 回调函数 + public virtual void SilentLoginWithParam(LoginEventBuilder.LoginEvent loginEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 登录 + /// + /// 回调函数 + public virtual void Login(Action callback) => throw new NotImplementedException(); + + /// + /// 根据类型登录 + /// + /// 登录事件参数 + /// 回调函数 + public virtual void LoginByType(LoginEventBuilder.LoginEvent loginEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 发送验证码 + /// + /// 登录事件参数 + /// 回调函数 + public virtual void SendCode(LoginEventBuilder.LoginEvent loginEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 获取支付方式列表 + /// + /// 支付事件参数 + /// 回调函数 + public virtual void Charge(PayEventBuilder.PayEvent payEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 支付 + /// + /// 支付事件参数 + /// 回调函数 + public virtual void Pay(PayEventBuilder.PayEvent payEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 获取商品配置 + /// + /// 回调函数 + public virtual void GetLocalProductInfo(Action callback) => throw new NotImplementedException(); + + /// + /// 设置推送回调 + /// + /// 接收推送回调 + /// 点击推送回调 + public virtual void SetPushResultHandler(Action onReceive, Action onClick) => throw new NotImplementedException(); + + /// + /// AppsFlyer事件上报 + /// + /// 上报事件参数 + public virtual void AppsFlyerEventReport(ReportEventBuilder.ReportEvent reportEvent) => throw new NotImplementedException(); + + /// + /// 退出登录 + /// + /// 回调函数 + public virtual void Logout(Action callback) => throw new NotImplementedException(); + + /// + /// 退出渠道登录 + /// + /// 登出事件参数 + /// 回调函数 + public virtual void LogoutChannel(LoginEventBuilder.LoginEvent logoutEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 退出游戏 + /// + /// 回调函数 + public virtual void ExitGame(Action callback) => throw new NotImplementedException(); + + /// + /// 获取AppsFlyer设备ID + /// + /// 回调函数 + public virtual void GetAppsFlyerDeviceId(Action callback) => throw new NotImplementedException(); + + /// + /// 设置AppsFlyer通用参数 + /// + /// 上报事件参数 + public virtual void SetAppsFlyerCommonParam(ReportEventBuilder.ReportEvent reportEvent) => throw new NotImplementedException(); + + /// + /// 设置Firebase用户属性 + /// + /// 上报事件参数 + public virtual void SetFirebaseUserProperty(ReportEventBuilder.ReportEvent reportEvent) => throw new NotImplementedException(); + + /// + /// 设置Firebase通用参数 + /// + /// 上报事件参数 + public virtual void SetFirebaseCommonParam(ReportEventBuilder.ReportEvent reportEvent) => throw new NotImplementedException(); + + /// + /// Firebase事件上报 + /// + /// 上报事件参数 + public virtual void FirebaseEventReport(ReportEventBuilder.ReportEvent reportEvent) => throw new NotImplementedException(); + + /// + /// 获取可绑定账号列表 + /// + /// 回调函数 + public virtual void CanBindList(Action callback) => throw new NotImplementedException(); + + /// + /// 获取已绑定账号列表 + /// + /// 回调函数 + public virtual void AlreadyBindList(Action callback) => throw new NotImplementedException(); + + /// + /// 绑定检查 + /// + /// 绑定事件参数 + /// 回调函数 + public virtual void Check(BindEventBuilder.BindEvent bindEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 绑定账号 + /// + /// 绑定事件参数 + /// 回调函数 + public virtual void Bind(BindEventBuilder.BindEvent bindEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 获取手机号绑定的用户列表 + /// + /// 绑定事件参数 + /// 回调函数 + public virtual void GetBindUserList(BindEventBuilder.BindEvent bindEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 设置GA用户属性 + /// + /// 上报事件参数 + public virtual void GAProfileTrack(ReportEventBuilder.ReportEvent reportEvent) => throw new NotImplementedException(); + + /// + /// GA事件上报 + /// + /// 上报事件参数 + public virtual void GAEventTrack(ReportEventBuilder.ReportEvent reportEvent) => throw new NotImplementedException(); + + /// + /// 设置GA通用参数 + /// + /// 上报事件参数 + public virtual void SetGACommonParam(ReportEventBuilder.ReportEvent reportEvent) => throw new NotImplementedException(); + + /// + /// 设置发货回调 + /// + /// 回调函数 + public virtual void SetLocalDeliverListener(Action> callback) => throw new NotImplementedException(); + + /// + /// 申请通知权限 + /// + public virtual void RequestNotificationPermission() => throw new NotImplementedException(); + + /// + /// 设置防沉迷信息监听 + /// + /// 回调函数 + public virtual void SetCertificationListener(Action callback) => throw new NotImplementedException(); + + /// + /// 防沉迷认证 + /// + /// 认证事件参数 + /// 回调函数 + public virtual void Certificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 获取实名信息 + /// + public virtual string GetCertificationInfo() => throw new NotImplementedException(); + + /// + /// 修改认证信息 + /// + /// 认证事件参数 + /// 回调函数 + public virtual void ReCertificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 刷新实名信息 + /// + public virtual void RefreshCertification() => throw new NotImplementedException(); + + /// + /// 获取防沉迷启用状态 + /// + /// 回调函数 + public virtual bool IsCertificationEnable() => throw new NotImplementedException(); + + /// + /// 设置服务器返回语言 + /// + /// 服务器语言 + /// 回调函数 + public virtual void SetServerLanguage(ServerLanguage serverLanguage, Action callback) => throw new NotImplementedException(); + + /// + /// 获取设备ID + /// + /// 回调函数 + public virtual void GetDeviceId(Action callback) => throw new NotImplementedException(); + + /// + /// 人脸识别 + /// + /// 易盾事件参数 + /// 回调函数 + public virtual void LiveDetect(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 微信授权 + /// + /// 回调函数 + public virtual void RequestWXAuthorize(Action callback) => throw new NotImplementedException(); + + /// + /// 获取微信用户信息 + /// + /// 回调函数 + public virtual void GetWXAuthInfo(Action callback) => throw new NotImplementedException(); + + /// + /// 获取易盾行为验证码 + /// + /// 易盾事件参数 + /// 回调函数 + public virtual void GetYiDunCaptcha(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 获取SDK版本号 + /// + /// 回调函数 + public virtual void GetAPIVersion(Action callback) => throw new NotImplementedException(); + + /// + /// 检查是否存在游客账号 + /// + /// 回调函数 + public virtual void HasGeneratedGuest(Action callback) => throw new NotImplementedException(); + + /// + /// 设置隐私协议 + /// + /// 易盾事件参数 + /// 回调函数 + public virtual void SetPrivacy(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 设置默认分享信息 + /// + /// 分享事件参数 + /// 回调函数 + public virtual void SetDefaultShareInfo(ShareEventBuilder.ShareEvent shareEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 分享 + /// + /// 分享事件参数 + /// 回调函数 + public virtual void Share(ShareEventBuilder.ShareEvent shareEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 小游戏-获取营销系统配置的分享信息 + /// + /// 回调函数 + public virtual void GetShareInfoFromMarketService(Action callback) => throw new NotImplementedException(); + + /// + /// 小游戏-获取营销系统配置的分享信息 + /// + /// 回调函数 + public virtual void GetSharePointInfoFromMarketService(ShareEventBuilder.ShareEvent shareEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 小游戏-获取营销系统配置的交叉导流信息 + /// + /// 回调函数 + /// 新回调函数 + public virtual void GetAdInfoFromMarketService(Action callback, Action newCallback) => throw new NotImplementedException(); + + /// + /// 微信小游戏-广点通归因事件上报 + /// + /// 广点通上报事件参数 + public virtual void TxAdSDKReport(TxAdSDKReportEventBuilder.TxAdSDKReportEvent txAdSDKReportEvent) => throw new NotImplementedException(); + + /// + /// 微信小游戏-设置用户信息 + /// + /// 微信用户信息事件参数 + /// 回调函数 + public virtual void SetWxUserInfo(SetWxUserInfoEventBuilder.SetWxUserInfoEvent setWxUserInfoEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 抖音归因设置用户信息 + /// + /// 抖音追踪事件参数 + /// 回调函数 + public virtual void ResetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 抖音归因获取用户信息 + /// + /// 抖音追踪事件参数 + /// 回调函数 + public virtual void GetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 抖音归因获取直播信息 + /// + /// 回调函数 + public virtual void GetLiveInfo(Action callback) => throw new NotImplementedException(); + + /// + /// 单独设置配置参数 + /// + /// 配置事件参数 + /// 回调函数 + public virtual void SetConfig(ConfigEventBuilder.ConfigEvent configEvent, Action callback) => throw new NotImplementedException(); + + /// + /// 检查微信是否已安装 + /// + /// 回调函数 + public virtual void IsWxInstalled(Action callback) => throw new NotImplementedException(); + + /// + /// 展示AIHelp + /// + /// AIHelp显示参数 + public virtual void ShowAIHelp(AIHelpShowTypeBuilder.AIHelpShowType aihelpShowType) => throw new NotImplementedException(); + + /// + /// 设置登录用户信息 + /// + /// AIHelp设置登录用户信息参数 + public virtual void SetLoginUserInfo(AIHelpSetLoginUserInfoTypeBuilder.AIHelpSetLoginUserInfoType aihelpSetLoginUserInfoType) => throw new NotImplementedException(); + + /// + /// 退出登录 + /// + public virtual void LogoutAIHelp() => throw new NotImplementedException(); + + /// + /// 获取AIHelp未读消息数 + /// + public virtual void FetchAIHelpUnreadMessageCount() => throw new NotImplementedException(); + + /// + /// 注册AIHelp事件监听 + /// + public virtual void RegisterAIHelpEventListener(AiHelpEventType aiHelpEventType, Action callback) => throw new NotImplementedException(); + + /// + /// 设置FIrebase崩溃自定义键值对 + /// + public virtual void SetFirebaseCrashCustomKey(FirebaseCrashCustomKeyBuilder.FirebaseCrashCustomKeyType firebaseCrashCustomKey) => throw new NotImplementedException(); + + /// + /// 上报FIrebase崩溃自定义消息 + /// + public virtual void ReportFirebaseCrashLog(FirebaseCrashLogBuilder.FirebaseCrashLogType firebaseCrashLog) => throw new NotImplementedException(); + + /// + /// 设置FIrebase崩溃用户标识符 + /// + public virtual void SetFirebaseCrashUserIdentifier(FirebaseCrashUserIdentifierBuilder.FirebaseCrashUserIdentifierType firebaseCrashUserIdentifier) => throw new NotImplementedException(); + + /// + /// 上报FIrebase崩溃异常 + /// + public virtual void ReportFirebaseCrashException(FirebaseCrashExceptionTypeBuilder.FirebaseCrashExceptionType firebaseCrashException) => throw new NotImplementedException(); + + /// + /// 展示个人清单 + /// + public virtual void ShowCollectUserInfo() => throw new NotImplementedException(); + + /// + /// 展示三方清单 + /// + public virtual void ShowCollectThirdInfo() => throw new NotImplementedException(); + + /// + /// 获取当前包自定义的属性,输入业务定义的key,返回当前包对应的value + /// + public virtual string GetCustomKeyValue(string key, string defaultValue) => throw new NotImplementedException(); + + /// + /// 获取设备的性能等级(0,1,2,3) + /// + public virtual string GetDeviceLevel(Action callback) => throw new NotImplementedException(); + + public virtual void CreateGridGamePanel(GridGameModuleBuilder.GridGameModule gridGameModule, Action callback) => throw new NotImplementedException(); + + internal virtual void ShowGridGamePanel(string panelId) => throw new NotImplementedException(); + + internal virtual void HideGridGamePanel(string panelId) => throw new NotImplementedException(); + + internal virtual void DestroyGridGamePanel(string panelId) => throw new NotImplementedException(); + } + + public static class NativeInterface + { + private static ISDKInterface _sdkInterface; + + private static GameObject callbackListener = null; + + private static void Init() + { + if (callbackListener == null) + { + callbackListener = new GameObject("NativeCallBack"); + callbackListener.AddComponent(); +#if UNITY_EDITOR + _sdkInterface = new EditorInterface(); +#elif UNITY_IOS + _sdkInterface = new IOSInterface(); +#elif UNITY_ANDROID + _sdkInterface = new AndroidInterface(); +#elif UNITY_WEBGL + _sdkInterface = new WebGLInterface(); +#endif + _sdkInterface.Init(); + } + } +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void InitSDK(Action callback) + { + Init(); + _sdkInterface.InitSDK(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void InitSDK(InitEventBuilder.InitEvent initEvent, Action callback) + { + Init(); + _sdkInterface.InitSDK(initEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void UpdateServerUrl(string serverUrl) + { + _sdkInterface.UpdateServerUrl(serverUrl); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void UpdateServerUrlList(string[] serverUrlList) + { + _sdkInterface.UpdateServerUrlList(serverUrlList); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SilentLogin(Action callback) + { + _sdkInterface.SilentLogin(callback); + } +#endif +#if UNITY_ANDROID || UNITY_EDITOR + public static void SilentLoginWithParam(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + _sdkInterface.SilentLoginWithParam(loginEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void Login(Action callback) + { + _sdkInterface.Login(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void LoginByType(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + _sdkInterface.LoginByType(loginEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SendCode(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + _sdkInterface.SendCode(loginEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void Charge(PayEventBuilder.PayEvent payEvent, Action callback) + { + _sdkInterface.Charge(payEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void Pay(PayEventBuilder.PayEvent payEvent, Action callback) + { + _sdkInterface.Pay(payEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetLocalProductInfo(Action callback) + { + _sdkInterface.GetLocalProductInfo(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetPushResultHandler(Action onReceive, Action onClick) + { + _sdkInterface.SetPushResultHandler(onReceive, onClick); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void AppsFlyerEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + _sdkInterface.AppsFlyerEventReport(reportEvent); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void Logout(Action callback) + { + _sdkInterface.Logout(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void LogoutChannel(LoginEventBuilder.LoginEvent logoutEvent, Action callback) + { + _sdkInterface.LogoutChannel(logoutEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void ExitGame(Action callback) + { + _sdkInterface.ExitGame(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetAppsFlyerDeviceId(Action callback) + { + _sdkInterface.GetAppsFlyerDeviceId(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetAppsFlyerCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + Init(); + _sdkInterface.SetAppsFlyerCommonParam(reportEvent); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetFirebaseUserProperty(ReportEventBuilder.ReportEvent reportEvent) + { + _sdkInterface.SetFirebaseUserProperty(reportEvent); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetFirebaseCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + Init(); + _sdkInterface.SetFirebaseCommonParam(reportEvent); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void FirebaseEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + _sdkInterface.FirebaseEventReport(reportEvent); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void Check(BindEventBuilder.BindEvent bindEvent, Action callback) + { + _sdkInterface.Check(bindEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void Bind(BindEventBuilder.BindEvent bindEvent, Action callback) + { + _sdkInterface.Bind(bindEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void CanBindList(Action callback) + { + _sdkInterface.CanBindList(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void AlreadyBindList(Action callback) + { + _sdkInterface.AlreadyBindList(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetBindUserList(BindEventBuilder.BindEvent bindEvent, Action callback) + { + _sdkInterface.GetBindUserList(bindEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GAProfileTrack(ReportEventBuilder.ReportEvent reportEvent) + { + _sdkInterface.GAProfileTrack(reportEvent); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GAEventTrack(ReportEventBuilder.ReportEvent reportEvent) + { + Init(); + _sdkInterface.GAEventTrack(reportEvent); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetGACommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + _sdkInterface.SetGACommonParam(reportEvent); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetLocalDeliverListener(Action> callback) + { + Init(); + _sdkInterface.SetLocalDeliverListener(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void RequestNotificationPermission() + { + _sdkInterface.RequestNotificationPermission(); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetCertificationListener(Action callback) + { + _sdkInterface.SetCertificationListener(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void Certificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + _sdkInterface.Certificate(certificationEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static string GetCertificationInfo() + { + return _sdkInterface.GetCertificationInfo(); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void ReCertificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + _sdkInterface.ReCertificate(certificationEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void RefreshCertification() + { + _sdkInterface.RefreshCertification(); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static bool IsCertificationEnable() + { + return _sdkInterface.IsCertificationEnable(); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetServerLanguage(ServerLanguage serverLanguage, Action callback) + { + _sdkInterface.SetServerLanguage(serverLanguage, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetDeviceId(Action callback) + { + _sdkInterface.GetDeviceId(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void LiveDetect(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + _sdkInterface.LiveDetect(yiDunEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void RequestWXAuthorize(Action callback) + { + _sdkInterface.RequestWXAuthorize(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetWXAuthInfo(Action callback) + { + _sdkInterface.GetWXAuthInfo(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetYiDunCaptcha(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + _sdkInterface.GetYiDunCaptcha(yiDunEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetAPIVersion(Action callback) + { + _sdkInterface.GetAPIVersion(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void HasGeneratedGuest(Action callback) + { + _sdkInterface.HasGeneratedGuest(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetPrivacy(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + _sdkInterface.SetPrivacy(yiDunEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetDefaultShareInfo(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + _sdkInterface.SetDefaultShareInfo(shareEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void Share(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + _sdkInterface.Share(shareEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetShareInfoFromMarketService(Action callback) + { + _sdkInterface.GetShareInfoFromMarketService(callback); + } +#endif +#if UNITY_WEBGL || UNITY_EDITOR + public static void GetSharePointInfoFromMarketService(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + _sdkInterface.GetSharePointInfoFromMarketService(shareEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetAdInfoFromMarketService(Action callback, Action newCallback) + { + _sdkInterface.GetAdInfoFromMarketService(callback, newCallback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void TxAdSDKReport(TxAdSDKReportEventBuilder.TxAdSDKReportEvent txAdSDKReportEvent) + { + _sdkInterface.TxAdSDKReport(txAdSDKReportEvent); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void setWxUserInfo(SetWxUserInfoEventBuilder.SetWxUserInfoEvent setWxUserInfoEvent, Action callback) + { + _sdkInterface.SetWxUserInfo(setWxUserInfoEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void ResetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + _sdkInterface.ResetUserInfo(dYTrackEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + _sdkInterface.GetUserInfo(dYTrackEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void GetLiveInfo(Action callback) + { + _sdkInterface.GetLiveInfo(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetConfig(ConfigEventBuilder.ConfigEvent configEvent, Action callback) + { + _sdkInterface.SetConfig(configEvent, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void IsWxInstalled(Action callback) + { + _sdkInterface.IsWxInstalled(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void ShowAIHelp(AIHelpShowTypeBuilder.AIHelpShowType aihelpShowType) + { + _sdkInterface.ShowAIHelp(aihelpShowType); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetLoginUserInfo(AIHelpSetLoginUserInfoTypeBuilder.AIHelpSetLoginUserInfoType aihelpSetLoginUserInfoType) + { + _sdkInterface.SetLoginUserInfo(aihelpSetLoginUserInfoType); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void LogoutAIHelp() + { + _sdkInterface.LogoutAIHelp(); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void FetchAIHelpUnreadMessageCount() + { + _sdkInterface.FetchAIHelpUnreadMessageCount(); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void RegisterAIHelpEventListener(AiHelpEventType aiHelpEventType, Action callback) + { + _sdkInterface.RegisterAIHelpEventListener(aiHelpEventType, callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetFirebaseCrashCustomKey(FirebaseCrashCustomKeyBuilder.FirebaseCrashCustomKeyType firebaseCrashCustomKey) + { + _sdkInterface.SetFirebaseCrashCustomKey(firebaseCrashCustomKey); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void ReportFirebaseCrashLog(FirebaseCrashLogBuilder.FirebaseCrashLogType firebaseCrashLog) + { + _sdkInterface.ReportFirebaseCrashLog(firebaseCrashLog); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void SetFirebaseCrashUserIdentifier(FirebaseCrashUserIdentifierBuilder.FirebaseCrashUserIdentifierType firebaseCrashUserIdentifier) + { + _sdkInterface.SetFirebaseCrashUserIdentifier(firebaseCrashUserIdentifier); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void ReportFirebaseCrashException(FirebaseCrashExceptionTypeBuilder.FirebaseCrashExceptionType firebaseCrashException) + { + _sdkInterface.ReportFirebaseCrashException(firebaseCrashException); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void ShowCollectUserInfo() + { + _sdkInterface.ShowCollectUserInfo(); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void ShowCollectThirdInfo() + { + _sdkInterface.ShowCollectThirdInfo(); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static string GetCustomKeyValue(string key, string defaultValue) + { + return _sdkInterface.GetCustomKeyValue(key, defaultValue); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static string GetDeviceLevel(Action callback) + { + return _sdkInterface.GetDeviceLevel(callback); + } +#endif +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + public static void CreateGridGamePanel(GridGameModuleBuilder.GridGameModule gridGameModule, Action callback) + { + _sdkInterface.CreateGridGamePanel(gridGameModule, callback); + } +#endif + +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + internal static void ShowGridGamePanel(string panelId) + { + _sdkInterface.ShowGridGamePanel(panelId); + } +#endif + +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + internal static void HideGridGamePanel(string panelId) + { + _sdkInterface.HideGridGamePanel(panelId); + } +#endif + +#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_EDITOR + internal static void DestroyGridGamePanel(string panelId) + { + _sdkInterface.DestroyGridGamePanel(panelId); + } +#endif + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Interface/NativeInterface.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Interface/NativeInterface.cs.meta new file mode 100644 index 0000000..ee381c1 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Interface/NativeInterface.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 074f7ae78d1294c90a27e481fc41717d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/LitJson.dll b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/LitJson.dll new file mode 100644 index 0000000..93d0055 Binary files /dev/null and b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/LitJson.dll differ diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/LitJson.dll.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/LitJson.dll.meta new file mode 100644 index 0000000..e3a4326 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/LitJson.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: acaf2f9caf83a4203a85fffbae91ac3d +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Modules.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Modules.meta new file mode 100644 index 0000000..193feca --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Modules.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1ab3ced2cb6ab4e81a01912ae29bfe4f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Modules/GridGamePanel.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Modules/GridGamePanel.cs new file mode 100644 index 0000000..925e99c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Modules/GridGamePanel.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; + +namespace EngineSdkConverter.Unity.SDK +{ + //***** 互推组件功能统一参数 *****// + public class GridGameModuleBuilder + { + public class GridGameModule + { + public string gridGamePanelId; + public string gridCount; + public string size; + public Dictionary position; + public Dictionary query; + } + + private GridGameModule _gridGameModule; + + public GridGameModuleBuilder() + { + _gridGameModule = new GridGameModule(); + } + + public GridGameModuleBuilder SetGridCount(string gridCount) + { + _gridGameModule.gridCount = gridCount; + return this; + } + + public GridGameModuleBuilder SetSize(string size) + { + _gridGameModule.size = size; + return this; + } + + public GridGameModuleBuilder SetPosition(Dictionary position) + { + _gridGameModule.position = position; + return this; + } + + public GridGameModuleBuilder SetQuery(Dictionary query) + { + _gridGameModule.query = query; + return this; + } + + public GridGameModule Build() + { + return _gridGameModule; + } + } + + public class GridGamePanel + { + private GridGameModuleBuilder.GridGameModule _gridGameModule; + public GridGamePanel CreateGridGamePanel(GridGameModuleBuilder.GridGameModule gridGameModule, Action callback) + { + _gridGameModule = gridGameModule; + return this; + } + + public GridGamePanel ShowGridGamePanel() + { + NativeInterface.ShowGridGamePanel(_gridGameModule.gridGamePanelId); + return this; + } + + public GridGamePanel HideGridGamePanel() + { + NativeInterface.HideGridGamePanel(_gridGameModule.gridGamePanelId); + return this; + } + + public GridGamePanel DestroyGridGamePanel() + { + NativeInterface.DestroyGridGamePanel(_gridGameModule.gridGamePanelId); + return this; + } + } + + //************************************* + +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Modules/GridGamePanel.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Modules/GridGamePanel.cs.meta new file mode 100644 index 0000000..6f3011e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Modules/GridGamePanel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f422b3861ffe049c1a16b130d66dd3fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native.meta new file mode 100644 index 0000000..6f5982d --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7144d9a8370324bb2a4653224e75f8f8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/AndroidInterface.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/AndroidInterface.cs new file mode 100644 index 0000000..b6eeb4a --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/AndroidInterface.cs @@ -0,0 +1,495 @@ +#if UNITY_ANDROID + +using System; +using LitJson; +using UnityEngine; + +namespace EngineSdkConverter.Unity.SDK +{ + + public class UnityCallback : AndroidJavaProxy + { + public UnityCallback() : base("com.tuyoo.sdk.sdk_inter_layer.interfaces.LocalDeliverListener") { } + + public void notifyDeliver(string param, AndroidJavaObject callback) + { + Debug.Log($"Event received: {param}"); + Action onConfirm = () => + { + NativeCallBack.Enqueue(() => + { + callback.Call("onConfirm"); + }); + }; + + Action onCancel = (code, errorInfo) => + { + NativeCallBack.Enqueue(() => + { + callback.Call("onCancel", code, errorInfo); + }); + }; + + NativeCallBack.setDeliverResultCallback(param, onConfirm, onCancel); + } + } + + public class AndroidInterface : ISDKInterface + { + + public override void Init() + { + + } + + public override void Login(Action callback) + { + + } + + public override void InitSDK(Action callback) + { + InitEventBuilder.InitEvent initEvent = new InitEventBuilder.InitEvent(); + InitSDK(initEvent, callback); + } + + public override void InitSDK(InitEventBuilder.InitEvent initEvent, Action callback) + { + NativeCallBack.initResultCallback = callback; + NativeCallBack.autoLogoutResultCallback = initEvent.autoLogoutCallback; + initEvent.autoLogoutCallback = null; + string initEventInfo = JsonMapper.ToJson(initEvent); + Debug.Log($"InitSDK called with event: {initEventInfo}");//AutoLogoutResult + UnityPlayerUtils.invokeWithAll("init", initEventInfo, "InitResult"); + } + + public override void UpdateServerUrl(string serverUrl) + { + UnityPlayerUtils.invokeWithParams("updateServerUrl", serverUrl); + } + + public override void UpdateServerUrlList(string[] serverUrlList) + { + string serverUrlListJson = JsonMapper.ToJson(serverUrlList); + UnityPlayerUtils.invokeWithParams("updateServerUrlList", serverUrlListJson); + } + + public override void SilentLogin(Action callback) + { + NativeCallBack.silentLoginResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("silentLogin", "SilentLoginResult"); + } + + public override void SilentLoginWithParam(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + NativeCallBack.silentLoginResultCallback = callback; + string loginEventInfo = JsonMapper.ToJson(loginEvent); + UnityPlayerUtils.invokeWithAll("silentLoginWithParam", loginEventInfo, "SilentLoginResult"); + } + + public override void LoginByType(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + NativeCallBack.loginResultCallback = callback; + if (loginEvent.loginType == "auto") + { + UnityPlayerUtils.invokeWithCallback("login", "LoginResult"); + } + else if (loginEvent.loginType == "uidPwd") + { + string loginEventInfo = JsonMapper.ToJson(loginEvent); + Debug.Log($"LoginByType called with event: {loginEventInfo}"); + UnityPlayerUtils.invokeWithThreeParams("loginByTypeWithExtra", loginEvent.loginType, loginEventInfo, "LoginResult"); + } + else + { + UnityPlayerUtils.invokeWithAll("loginByType", loginEvent.loginType, "LoginResult"); + } + } + + public override void SendCode(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + NativeCallBack.sendCodeResultCallback = callback; + string loginEventInfo = JsonMapper.ToJson(loginEvent); + UnityPlayerUtils.invokeWithAll("sendCode", loginEventInfo, "SendCodeResult"); + } + + public override void Charge(PayEventBuilder.PayEvent payEvent, Action callback) + { + NativeCallBack.chargeResultCallback = callback; + string payEventInfo = JsonMapper.ToJson(payEvent); + UnityPlayerUtils.invokeWithTwoParams("charge", payEventInfo, "ChargeResult"); + } + + public override void Pay(PayEventBuilder.PayEvent payEvent, Action callback) + { + NativeCallBack.payResultCallback = callback; + if (payEvent.chargeService.Equals("auto")) + { + payEvent.chargeService = ""; + } + string payEventInfo = JsonMapper.ToJson(payEvent); + UnityPlayerUtils.invokeWithAll("pay", payEventInfo, "PayResult"); + } + + public override void GetLocalProductInfo(Action callback) + { + NativeCallBack.getLocalProductInfoCallback = callback; + UnityPlayerUtils.invokeWithCallback("getSkuDetailList", "GetLocalProductInfoResult"); + } + + public override void SetPushResultHandler(Action onReceive, Action onClick) + { + NativeCallBack.onPushResultReceiveCallback = onReceive; + NativeCallBack.onPushResultClickCallback = onClick; + UnityPlayerUtils.invokeWithTwoCallback("setMessageListener", "onPushResultReceive", "onPushResultClick"); + } + + public override void Logout(Action callback) + { + NativeCallBack.logoutResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("logout", "LogoutResult"); + } + + public override void LogoutChannel(LoginEventBuilder.LoginEvent logoutEvent, Action callback) + { + NativeCallBack.logoutChannelResultCallback = callback; + UnityPlayerUtils.invokeWithParams("clearChannelLoginState", logoutEvent.loginType); + } + + public override void ExitGame(Action callback) + { + NativeCallBack.exitGameResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("exitGame", "ExitGameResult"); + } + + public override void AppsFlyerEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + UnityPlayerUtils.invokeWithTwoParams("appsFlyerEventReport", reportEvent.eventName, JsonMapper.ToJson(reportEvent.reportEvent)); + } + + public override void GetAppsFlyerDeviceId(Action callback) + { + NativeCallBack.getAFDeviceIdCallback = callback; + UnityPlayerUtils.invokeWithCallback("getAppsFlyerDeviceId", "GetAFDeviceId"); + } + + public override void SetAppsFlyerCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + UnityPlayerUtils.invokeWithParams("setAppsFlyerCommonParam", reportEventInfo); + } + + public override void SetFirebaseUserProperty(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + UnityPlayerUtils.invokeWithParams("setFirebaseUserProperty", reportEventInfo); + } + + public override void SetFirebaseCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + UnityPlayerUtils.invokeWithParams("setFirebaseCommonParam", reportEventInfo); + } + + public override void FirebaseEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + UnityPlayerUtils.invokeWithTwoParams("firebaseEventReport", reportEvent.eventName, reportEventInfo); + } + + public override void Check(BindEventBuilder.BindEvent bindEvent, Action callback) + { + NativeCallBack.Put("Check", callback); + UnityPlayerUtils.invokeWithTwoCallback("check", bindEvent.loginType, "Check"); + } + + public override void Bind(BindEventBuilder.BindEvent bindEvent, Action callback) + { + NativeCallBack.Put("Bind", callback); + UnityPlayerUtils.invokeWithTwoCallback("bind", bindEvent.loginType, "Bind"); + } + + public override void CanBindList(Action callback) + { + NativeCallBack.canBindListResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("canBindList", "CanBindListResult"); + } + + public override void AlreadyBindList(Action callback) + { + NativeCallBack.alreadyBindListResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("alreadyBindList", "AlreadyBindListResult"); + } + + public override void GetBindUserList(BindEventBuilder.BindEvent bindEvent, Action callback) + { + NativeCallBack.userBindListResultCallback = callback; + UnityPlayerUtils.invokeWithAll("userBindList", bindEvent.phoneNumber, "UserBindListResult"); + } + + public override void GAProfileTrack(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + UnityPlayerUtils.invokeWithTwoParams("gaProfileTrack", reportEvent.typeName, reportEventInfo); + } + + public override void GAEventTrack(ReportEventBuilder.ReportEvent reportEvent) + { + + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + UnityPlayerUtils.invokeWithThreeParams("gaEventTrack", reportEvent.typeName, reportEvent.eventName, reportEventInfo); + } + + public override void SetGACommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + UnityPlayerUtils.invokeWithParams("setGACommonParam", reportEventInfo); + } + + public override void SetLocalDeliverListener(Action> callback) + { + NativeCallBack.setDeliverResultCallback = callback; + UnityCallback unityCallback = new UnityCallback(); + UnityPlayerUtils.invokeWithJavaObject("setLocalDeliverListener", unityCallback); + } + + public override void RequestNotificationPermission() + { + UnityPlayerUtils.invokeWithNone("requestNotificationPermission"); + } + + public override void SetCertificationListener(Action callback) + { + CertificationInfoChangedCallbackType certificationInfoChangedCallbackType = new CertificationInfoChangedCallbackType(); + certificationInfoChangedCallbackType.callback = callback; + NativeCallBack.callbacks["setCertificationListener"] = certificationInfoChangedCallbackType; + UnityPlayerUtils.invokeWithJavaObject("setCertificationListener", certificationInfoChangedCallbackType); + } + + public override void Certificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + CertificationSetCallbackType certificationSetCallbackType = new CertificationSetCallbackType(); + certificationSetCallbackType.callback = callback; + NativeCallBack.callbacks["certificate"] = certificationSetCallbackType; + string certificationEventInfo = JsonMapper.ToJson(certificationEvent); + UnityPlayerUtils.invokeWithJavaObject("certificate", certificationEventInfo, certificationSetCallbackType); + } + + public override string GetCertificationInfo() + { + return UnityPlayerUtils.invokeWithNoneReturn("getCertificationInfo"); + } + + public override void ReCertificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + ReCertificationSetCallbackType reCertificationSetCallbackType = new ReCertificationSetCallbackType(); + reCertificationSetCallbackType.callback = callback; + NativeCallBack.callbacks["reCertificate"] = reCertificationSetCallbackType; + string certificationEventInfo = JsonMapper.ToJson(certificationEvent); + UnityPlayerUtils.invokeWithJavaObject("reCertificate", certificationEventInfo, reCertificationSetCallbackType); + } + + public override void RefreshCertification() + { + UnityPlayerUtils.invokeWithNone("refreshCertificate"); + } + + public override bool IsCertificationEnable() + { + return "true".Equals(UnityPlayerUtils.invokeWithNoneReturn("isCertificationEnable")); + } + + public override void SetServerLanguage(ServerLanguage serverLanguage, Action callback) + { + NativeCallBack.setServerLanguageResultCallback = callback; + UnityPlayerUtils.invokeWithAll("setServerLanguage", serverLanguage.ToString(), "SetServerLanguageResult"); + } + + public override void GetDeviceId(Action callback) + { + NativeCallBack.getDeviceIdResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("getDeviceInfo", "GetDeviceIdResult"); + } + + public override void LiveDetect(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + NativeCallBack.liveDetectResultCallback = callback; + string yiDunEventInfo = JsonMapper.ToJson(yiDunEvent); + UnityPlayerUtils.invokeWithAll("liveDetect", yiDunEventInfo, "LiveDetectResult"); + } + + public override void RequestWXAuthorize(Action callback) + { + NativeCallBack.requestWXAuthorizeResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("requestWXAuthorize", "RequestWXAuthorizeResult"); + } + + public override void GetWXAuthInfo(Action callback) + { + NativeCallBack.getWXAuthInfoResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("getWXAuthInfo", "GetWXAuthInfoResult"); + } + + public override void GetYiDunCaptcha(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + NativeCallBack.getYiDunCaptchaResultCallback = callback; + string yiDunEventInfo = JsonMapper.ToJson(yiDunEvent); + UnityPlayerUtils.invokeWithAll("getYiDunCaptcha", yiDunEventInfo, "GetYiDunCaptchaResult"); + } + + public override void GetAPIVersion(Action callback) + { + NativeCallBack.getAPIVersionResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("getAPIVersion", "GetAPIVersionResult"); + } + + public override void HasGeneratedGuest(Action callback) + { + NativeCallBack.hasGeneratedGuestResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("hasGeneratedGuest", "HasGeneratedGuestResult"); + } + + public override void SetPrivacy(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + NativeCallBack.setPrivacyResultCallback = callback; + string yiDunEventInfo = JsonMapper.ToJson(yiDunEvent); + UnityPlayerUtils.invokeWithAll("setPrivacy", yiDunEventInfo, "SetPrivacyResult"); + } + + public override void Share(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + NativeCallBack.shareResultCallback = callback; + string shareEventInfo = JsonMapper.ToJson(shareEvent); + UnityPlayerUtils.invokeWithAll("share", shareEventInfo, "ShareResult"); + } + + public override void ResetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + NativeCallBack.resetUserInfoResultCallback = callback; + string dYTrackEventInfo = JsonMapper.ToJson(dYTrackEvent); + UnityPlayerUtils.invokeWithAll("resetUserInfo", dYTrackEventInfo, "ResetUserInfoResult"); + } + + public override void GetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + NativeCallBack.getUserInfoResultCallback = callback; + string dYTrackEventInfo = JsonMapper.ToJson(dYTrackEvent); + UnityPlayerUtils.invokeWithAll("getUserInfo", dYTrackEventInfo, "GetUserInfoResult"); + } + + public override void GetLiveInfo(Action callback) + { + NativeCallBack.getLiveInfoResultCallback = callback; + UnityPlayerUtils.invokeWithCallback("getLiveInfo", "GetLiveInfoResult"); + } + + public override void SetDefaultShareInfo(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + throw new NotImplementedException(); + } + + public override void SetConfig(ConfigEventBuilder.ConfigEvent configEvent, Action callback) + { + NativeCallBack.Put("SetConfig", callback); + string configEventJson = JsonMapper.ToJson(configEvent); + UnityPlayerUtils.invokeWithTwoCallback("setConfig", configEventJson, "SetConfig"); + } + + public override void IsWxInstalled(Action callback) + { + NativeCallBack.Put("IsWxInstalled", callback); + UnityPlayerUtils.invokeWithCallback("iswInstalled", "IsWxInstalled"); + } + + public override void GetShareInfoFromMarketService(Action callback) + { + throw new NotImplementedException(); + } + + public override void GetAdInfoFromMarketService(Action callback, Action newCallback) + { + throw new NotImplementedException(); + } + + public override void TxAdSDKReport(TxAdSDKReportEventBuilder.TxAdSDKReportEvent txAdSDKReportEvent) + { + throw new NotImplementedException(); + } + + public override void SetWxUserInfo(SetWxUserInfoEventBuilder.SetWxUserInfoEvent setWxUserInfoEvent, Action callback) + { + throw new NotImplementedException(); + } + + public override void ShowAIHelp(AIHelpShowTypeBuilder.AIHelpShowType aihelpShowType) + { + string aihelpShowTypeInfo = JsonMapper.ToJson(aihelpShowType); + UnityPlayerUtils.invokeWithParams("showAIHelp", aihelpShowTypeInfo); + } + + public override void SetLoginUserInfo(AIHelpSetLoginUserInfoTypeBuilder.AIHelpSetLoginUserInfoType aihelpSetLoginUserInfoType) + { + string aihelpSetLoginUserInfoTypeInfo = JsonMapper.ToJson(aihelpSetLoginUserInfoType); + UnityPlayerUtils.invokeWithParams("setLoginUserInfo", aihelpSetLoginUserInfoTypeInfo); + } + + public override void LogoutAIHelp() + { + UnityPlayerUtils.invokeWithNone("logoutAIHelp"); + } + + public override void FetchAIHelpUnreadMessageCount() + { + UnityPlayerUtils.invokeWithNone("fetchAIHelpUnreadMessageCount"); + } + + public override void RegisterAIHelpEventListener(AiHelpEventType aiHelpEventType, Action callback) + { + AIHelpCallback aiHelpCallback = new AIHelpCallback(); + aiHelpCallback.onAsyncEventReceivedCallback = callback; + NativeCallBack.callbacks["registerAiHelpAsyncEventListener"] = aiHelpCallback; + UnityPlayerUtils.invokeWithJavaObject("registerAiHelpAsyncEventListener", aiHelpEventType.ToString(), aiHelpCallback); + } + + public override void SetFirebaseCrashCustomKey(FirebaseCrashCustomKeyBuilder.FirebaseCrashCustomKeyType firebaseCrashCustomKey) + { + string firebaseCrashCustomKeyInfo = JsonMapper.ToJson(firebaseCrashCustomKey); + UnityPlayerUtils.invokeWithParams("setFirebaseCrashCustomKey", firebaseCrashCustomKeyInfo); + } + + public override void ReportFirebaseCrashLog(FirebaseCrashLogBuilder.FirebaseCrashLogType firebaseCrashLog) + { + string firebaseCrashLogInfo = JsonMapper.ToJson(firebaseCrashLog); + UnityPlayerUtils.invokeWithParams("reportFirebaseCrashLog", firebaseCrashLogInfo); + } + + public override void SetFirebaseCrashUserIdentifier(FirebaseCrashUserIdentifierBuilder.FirebaseCrashUserIdentifierType firebaseCrashUserIdentifier) + { + string firebaseCrashUserIdentifierInfo = JsonMapper.ToJson(firebaseCrashUserIdentifier); + UnityPlayerUtils.invokeWithParams("setFirebaseCrashUserIdentifier", firebaseCrashUserIdentifierInfo); + } + + public override void ReportFirebaseCrashException(FirebaseCrashExceptionTypeBuilder.FirebaseCrashExceptionType firebaseCrashException) + { + string firebaseCrashExceptionInfo = JsonMapper.ToJson(firebaseCrashException); + UnityPlayerUtils.invokeWithParams("reportFirebaseCrashException", firebaseCrashExceptionInfo); + } + + public override void ShowCollectUserInfo() + { + UnityPlayerUtils.invokeWithNone("showCollectUserInfo"); + } + + public override void ShowCollectThirdInfo() + { + UnityPlayerUtils.invokeWithNone("showCollectThirdInfo"); + } + + public override string GetCustomKeyValue(string key, string defaultValue) + { + return UnityPlayerUtils.invokeWithTwoReturn("getCustomKeyValue", key, defaultValue); + } + } +} + +#endif \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/AndroidInterface.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/AndroidInterface.cs.meta new file mode 100644 index 0000000..22b9b89 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/AndroidInterface.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fd5c6d9125d7544d6a73a780809fd7c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/EditorInterface.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/EditorInterface.cs new file mode 100644 index 0000000..913e9c3 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/EditorInterface.cs @@ -0,0 +1,293 @@ +using EngineSdkConverter.Unity.SDK; +using System; +using UnityEngine; + +#if UNITY_EDITOR + +namespace EngineSdkConverter.Unity.SDK +{ + /// + /// Editor下可以直接使用WebGL,不需要单独实现 + /// + public class EditorInterface : ISDKInterface + { + + public override void Init() + { + Debug.Log("Init"); + } + + public override void InitSDK(Action callback) + { + Debug.Log("InitSDK"); + } + + public override void InitSDK(InitEventBuilder.InitEvent initEvent, Action callback) + { + Debug.Log("InitSDK"); + } + + public override void SilentLogin(Action callback) + { + Debug.Log("SilentLogin"); + } + + public override void Login(Action callback) + { + Debug.Log("Login"); + } + + public override void LoginByType(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + Debug.Log("LoginByType"); + } + + public override void SendCode(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + Debug.Log("SendCode"); + } + + public override void Charge(PayEventBuilder.PayEvent payEvent, Action callback) + { + Debug.Log("Charge"); + } + + public override void Pay(PayEventBuilder.PayEvent payEvent, Action callback) + { + Debug.Log("Pay"); + } + + public override void GetLocalProductInfo(Action callback) + { + Debug.Log("GetLocalProductInfo"); + } + + public override void SetPushResultHandler(Action onReceive, Action onClick) + { + Debug.Log("SetPushResultHandler"); + } + + public override void AppsFlyerEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + Debug.Log("AppsFlyerEventReport"); + } + + public override void Logout(Action callback) + { + Debug.Log("Logout"); + } + + public override void LogoutChannel(LoginEventBuilder.LoginEvent logoutEvent, Action callback) + { + Debug.Log("LogoutChannel"); + } + + public override void ExitGame(Action callback) + { + Debug.Log("ExitGame"); + } + + public override void GetAppsFlyerDeviceId(Action callback) + { + Debug.Log("GetAppsFlyerDeviceId"); + } + + public override void SetAppsFlyerCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + Debug.Log("SetAppsFlyerCommonParam"); + } + + public override void SetFirebaseUserProperty(ReportEventBuilder.ReportEvent reportEvent) + { + Debug.Log("SetFirebaseUserProperty"); + } + + public override void SetFirebaseCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + Debug.Log("SetFirebaseCommonParam"); + } + + public override void FirebaseEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + Debug.Log("FirebaseEventReport"); + } + + public override void CanBindList(Action callback) + { + Debug.Log("CanBindList"); + } + + public override void AlreadyBindList(Action callback) + { + Debug.Log("AlreadyBindList"); + } + + public override void Check(BindEventBuilder.BindEvent bindEvent, Action callback) + { + Debug.Log("Check"); + } + + public override void Bind(BindEventBuilder.BindEvent bindEvent, Action callback) + { + Debug.Log("Bind"); + } + + public override void GetBindUserList(BindEventBuilder.BindEvent bindEvent, Action callback) + { + Debug.Log("GetBindUserList"); + } + + public override void GAProfileTrack(ReportEventBuilder.ReportEvent reportEvent) + { + Debug.Log("GAProfileTrack"); + } + + public override void GAEventTrack(ReportEventBuilder.ReportEvent reportEvent) + { + Debug.Log("GAEventTrack"); + } + + public override void SetGACommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + Debug.Log("SetGACommonParam"); + } + + public override void SetLocalDeliverListener(Action> callback) + { + Debug.Log("SetLocalDeliverListener"); + } + + public override void RequestNotificationPermission() + { + Debug.Log("RequestNotificationPermission"); + } + + public override void SetCertificationListener(Action callback) + { + Debug.Log("SetCertificationListener"); + } + + public override void Certificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + Debug.Log("Certificate"); + } + + public override void ReCertificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + Debug.Log("ReCertificate"); + } + + public override void RefreshCertification() + { + Debug.Log("RefreshCertification"); + } + + public override void SetServerLanguage(ServerLanguage serverLanguage, Action callback) + { + Debug.Log("SetServerLanguage"); + } + + public override void GetDeviceId(Action callback) + { + Debug.Log("GetDeviceId"); + } + + public override void LiveDetect(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + Debug.Log("LiveDetect"); + } + + public override void RequestWXAuthorize(Action callback) + { + Debug.Log("RequestWXAuthorize"); + } + + public override void GetWXAuthInfo(Action callback) + { + Debug.Log("GetWXAuthInfo"); + } + + public override void GetYiDunCaptcha(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + Debug.Log("GetYiDunCaptcha"); + } + + public override void GetAPIVersion(Action callback) + { + Debug.Log("GetAPIVersion"); + } + + public override void HasGeneratedGuest(Action callback) + { + Debug.Log("HasGeneratedGuest"); + } + + public override void SetPrivacy(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + Debug.Log("SetPrivacy"); + } + + public override void SetDefaultShareInfo(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + Debug.Log("SetDefaultShareInfo"); + } + + public override void Share(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + Debug.Log("Share"); + } + + public override void GetShareInfoFromMarketService(Action callback) + { + Debug.Log("GetShareInfoFromMarketService"); + } + + public override void GetSharePointInfoFromMarketService(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + Debug.Log("GetSharePointInfoFromMarketService"); + } + + public override void GetAdInfoFromMarketService(Action callback, Action newCallback) + { + Debug.Log("GetAdInfoFromMarketService"); + } + + public override void TxAdSDKReport(TxAdSDKReportEventBuilder.TxAdSDKReportEvent txAdSDKReportEvent) + { + Debug.Log("TxAdSDKReport"); + } + + public override void SetWxUserInfo(SetWxUserInfoEventBuilder.SetWxUserInfoEvent setWxUserInfoEvent, Action callback) + { + Debug.Log("SetWxUserInfo"); + } + + public override void ResetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + Debug.Log("ResetUserInfo"); + } + + public override void GetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + Debug.Log("GetUserInfo"); + } + + public override void GetLiveInfo(Action callback) + { + Debug.Log("GetLiveInfo"); + } + + public override void SetConfig(ConfigEventBuilder.ConfigEvent configEvent, Action callback) + { + Debug.Log("SetConfig"); + } + + public override void IsWxInstalled(Action callback) + { + Debug.Log("IsWxInstalled"); + } + + } +} + +#endif \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/EditorInterface.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/EditorInterface.cs.meta new file mode 100644 index 0000000..08eb25c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/EditorInterface.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9f2c0a8299f6d4b3dab2fab97da308cf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/IOSInterface.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/IOSInterface.cs new file mode 100644 index 0000000..3499a95 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/IOSInterface.cs @@ -0,0 +1,622 @@ +#if UNITY_IOS + +using System; +using System.Runtime.InteropServices; +using LitJson; +using UnityEngine; +using AOT; + +namespace EngineSdkConverter.Unity.SDK +{ + class IOSUnityAdpter + { + [DllImport("__Internal")] + internal static extern void InitSDK(string initEvent, string callback); + + [DllImport("__Internal")] + internal static extern void SilentLogin(string callback); + + [DllImport("__Internal")] + internal static extern void LoginByType(string loginEvent, string callback); + + [DllImport("__Internal")] + internal static extern void SendMobileCode(string loginEvent, string callback); + + [DllImport("__Internal")] + internal static extern void Pay(string payParams, string callback); + + [DllImport("__Internal")] + internal static extern void GetLocalProductInfo(string callback); + + [DllImport("__Internal")] + internal static extern void SetPushResultHandler(string onReceive, string onClick); + + [DllImport("__Internal")] + internal static extern void Logout(string callback); + + [DllImport("__Internal")] + internal static extern void LogoutChannel(string loginType); + + [DllImport("__Internal")] + internal static extern void AppsFlyerEventReport(string eventName, string reportEvent); + + [DllImport("__Internal")] + internal static extern void GetAppsFlyerDeviceId(string callback); + + [DllImport("__Internal")] + internal static extern void SetAppsFlyerCommonParam(string reportEvent); + + [DllImport("__Internal")] + internal static extern void SetFirebaseUserProperty(string reportEvent); + + [DllImport("__Internal")] + internal static extern void SetFirebaseCommonParam(string reportEvent); + + [DllImport("__Internal")] + internal static extern void FirebaseEventReport(string eventName, string reportEvent); + + [DllImport("__Internal")] + internal static extern void CanBindList(string callback); + + [DllImport("__Internal")] + internal static extern void AlreadyBindList(string callback); + + [DllImport("__Internal")] + internal static extern void CheckBind(string loginType, string callback); + + [DllImport("__Internal")] + internal static extern void Bind(string bindEvent, string onGetSnsInfoFail, string onCheckSnsInfoFail, string onBindSnsInfoFail, string onBindSucc); + + [DllImport("__Internal")] + internal static extern void GetBindUserList(string phoneNumber, string callback); + + [DllImport("__Internal")] + internal static extern void GAProfileTrack(string profileType, string reportEvent); + + [DllImport("__Internal")] + internal static extern void GAEventTrack(string eventType, string eventName, string reportEvent); + + [DllImport("__Internal")] + internal static extern void SetGACommonParam(string reportEvent); + + //TODO + [DllImport("__Internal")] + internal static extern void OnConfirm(); + + //TODO + [DllImport("__Internal")] + internal static extern void OnCancel(string code, string errorInfo); + + [DllImport("__Internal")] + internal static extern void RequestNotificationPermission(); + + [DllImport("__Internal")] + internal static extern void SetCertificationListener(string callback); + + [DllImport("__Internal")] + internal static extern void Certificate(string certificationEventInfo, string callback); + + [DllImport("__Internal")] + internal static extern void ReCertificate(string certificationEventInfo, string callback); + + [DllImport("__Internal")] + internal static extern void RefreshCertification(); + + [DllImport("__Internal")] + internal static extern void SetServerLanguage(string languageType, string callback); + + //TODO + [DllImport("__Internal")] + internal static extern void GetDeviceId(string callback); + + [DllImport("__Internal")] + internal static extern void LiveDetect(string yiDunEvent, string callback); + + [DllImport("__Internal")] + internal static extern void GetYiDunCaptcha(string yiDunEvent, string callback); + + [DllImport("__Internal")] + internal static extern void RequestWXAuthorize(string callback); + + [DllImport("__Internal")] + internal static extern void GetWXAuthInfo(string callback); + + [DllImport("__Internal")] + internal static extern void GetAPIVersion(string callback); + + [DllImport("__Internal")] + internal static extern void Share(string shareEventInfo, string callback); + + [DllImport("__Internal")] + internal static extern void SetPrivacy(string yiDunEventInfo, string callback); + + [DllImport("__Internal")] + internal static extern void HasGeneratedGuest(string callback); + + [DllImport("__Internal")] + internal static extern void ResetDouYinUserInfo(string douyinTrackInfo, string callback); + + [DllImport("__Internal")] + internal static extern void ShowCollectUserInfo(); + + [DllImport("__Internal")] + internal static extern void ShowCollectThirdInfo(); + + [DllImport("__Internal")] + internal static extern void ShowAIHelp(string aihelpShowType); + + [DllImport("__Internal")] + internal static extern void SetLoginUserInfo(string aihelpSetLoginUserInfoType); + + [DllImport("__Internal")] + internal static extern void LogoutAIHelp(); + + [DllImport("__Internal")] + internal static extern void FetchAIHelpUnreadMessageCount(); + + [DllImport("__Internal")] + internal static extern void RegisterAIHelpEventListener(int aihelpEventType, string callback); + + [DllImport("__Internal")] + internal static extern void UpdateServerUrl(string serverUrl); + + [DllImport("__Internal")] + internal static extern void UpdateServerUrlList(string serverUrlList); + + [DllImport("__Internal")] + internal static extern string GetCustomKeyValue(string key, string defaultValue); + } + public class IOSInterface : ISDKInterface + { + public delegate void CallbackWithParam(string param); + [MonoPInvokeCallback(typeof(CallbackWithParam))] + public static void SetDeliverResult(string param) + { + Debug.Log("SetDeliverResult------>in! result=" + param); + Action onConfirm = () => + { + IOSUnityAdpter.OnConfirm(); + }; + + Action onCancel = (code, errorInfo) => + { + IOSUnityAdpter.OnCancel(code, errorInfo); + }; + NativeCallBack.setDeliverResultCallback(param, onConfirm, onCancel); + } + + public override void Init() + { + + } + + //初始化 + public override void InitSDK(Action callback) + { + InitEventBuilder.InitEvent initEvent = new InitEventBuilder.InitEvent(); + InitSDK(initEvent, callback); + } + + // 个性化初始化 + public override void InitSDK(InitEventBuilder.InitEvent initEvent, Action callback) + { + NativeCallBack.initResultCallback = callback; + NativeCallBack.autoLogoutResultCallback = initEvent.autoLogoutCallback; + initEvent.autoLogoutCallback = null; //AutoLogoutResult + string initEventInfo = JsonMapper.ToJson(initEvent); + IOSUnityAdpter.InitSDK(initEventInfo, "InitResult"); + } + + // 静默登录 + public override void SilentLogin(Action callback) + { + NativeCallBack.silentLoginResultCallback = callback; + IOSUnityAdpter.SilentLogin("SilentLoginResult"); + } + + // 登录 + public override void LoginByType(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + NativeCallBack.loginResultCallback = callback; + string loginEventInfo = JsonMapper.ToJson(loginEvent); + IOSUnityAdpter.LoginByType(loginEventInfo, "LoginResult"); + } + + // 验证码 + public override void SendCode(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + NativeCallBack.sendCodeResultCallback = callback; + string loginEventInfo = JsonMapper.ToJson(loginEvent); + IOSUnityAdpter.SendMobileCode(loginEventInfo, "SendCodeResult"); + } + + // 支付 + public override void Pay(PayEventBuilder.PayEvent payEvent, Action callback) + { + NativeCallBack.payResultCallback = callback; + string payEventInfo = JsonMapper.ToJson(payEvent); + IOSUnityAdpter.Pay(payEventInfo, "PayResult"); + } + + // 获取商品配置 + public override void GetLocalProductInfo(Action callback) + { + NativeCallBack.getLocalProductInfoCallback = callback; + IOSUnityAdpter.GetLocalProductInfo("GetLocalProductInfoResult"); + } + + // 设置推送回调 + public override void SetPushResultHandler(Action onReceive, Action onClick) + { + NativeCallBack.onPushResultReceiveCallback = onReceive; + NativeCallBack.onPushResultClickCallback = onClick; + IOSUnityAdpter.SetPushResultHandler("onPushResultReceive", "onPushResultClick"); + } + + // 退出登录 + public override void Logout(Action callback) + { + NativeCallBack.logoutResultCallback = callback; + IOSUnityAdpter.Logout("LogoutResult"); + } + + // 退出渠道登录 + public override void LogoutChannel(LoginEventBuilder.LoginEvent logoutEvent, Action callback) + { + IOSUnityAdpter.LogoutChannel(logoutEvent.loginType); + } + + // 设置AF上报 + public override void AppsFlyerEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + IOSUnityAdpter.AppsFlyerEventReport(reportEvent.eventName, reportEventInfo); + } + + // 获取AF DeviceId + public override void GetAppsFlyerDeviceId(Action callback) + { + NativeCallBack.getAFDeviceIdCallback = callback; + IOSUnityAdpter.GetAppsFlyerDeviceId("GetAFDeviceId"); + } + + // 设置AF通用参数 ok + public override void SetAppsFlyerCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + IOSUnityAdpter.SetAppsFlyerCommonParam(reportEventInfo); + } + // FB设置用户信息 ok + public override void SetFirebaseUserProperty(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + IOSUnityAdpter.SetFirebaseUserProperty(reportEventInfo); + } + + // FB设置通用参数 ok + public override void SetFirebaseCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + IOSUnityAdpter.SetFirebaseCommonParam(reportEventInfo); + } + + // FB信息上报 ok + public override void FirebaseEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + IOSUnityAdpter.FirebaseEventReport(reportEvent.eventName, reportEventInfo); + } + + // 可绑定列表 + public override void CanBindList(Action callback) + { + IOSUnityAdpter.CanBindList("CanBindListResult"); + } + + // 已绑定列表 + public override void AlreadyBindList(Action callback) + { + IOSUnityAdpter.AlreadyBindList("AlreadyBindListResult"); + } + + // 绑定检查 + public override void Check(BindEventBuilder.BindEvent bindEvent, Action callback) + { + NativeCallBack.checkResultCallback = callback; + IOSUnityAdpter.CheckBind(bindEvent.loginType, "CheckResult"); + } + + // 绑定 + public override void Bind(BindEventBuilder.BindEvent bindEvent, Action callback) + { + NativeCallBack.bindCallback = callback; + string loginEventInfo = JsonMapper.ToJson(bindEvent); + IOSUnityAdpter.Bind(loginEventInfo, "onGetSnsInfoFail", "onCheckSnsInfoFail", "onBindSnsInfoFail", "onBindSucc"); + } + + // 获取手机号绑定的用户列表 + public override void GetBindUserList(BindEventBuilder.BindEvent bindEvent, Action callback) + { + NativeCallBack.bindCallback = callback; + IOSUnityAdpter.GetBindUserList(bindEvent.phoneNumber, "UserBindListResult"); + } + + // 设置用户属性 + public override void GAProfileTrack(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + IOSUnityAdpter.GAProfileTrack(reportEvent.typeName, reportEventInfo); + } + + // GA上报 + public override void GAEventTrack(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + IOSUnityAdpter.GAEventTrack(reportEvent.typeName, reportEvent.eventName, reportEventInfo); + } + + // GA设置公共参数 + public override void SetGACommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent.reportEvent); + IOSUnityAdpter.SetGACommonParam(reportEventInfo); + } + + // 申请通知权限 + public override void RequestNotificationPermission() + { + IOSUnityAdpter.RequestNotificationPermission(); + } + + // 设置防沉迷信息监听 + public override void SetCertificationListener(Action callback) + { + NativeCallBack.setCertificationListenerCallback = callback; + IOSUnityAdpter.SetCertificationListener("SetCertificationListener"); + } + + // 防沉迷 + public override void Certificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + NativeCallBack.certificationResultCallback = callback; + string certificationEventInfo = JsonMapper.ToJson(certificationEvent); + IOSUnityAdpter.Certificate(certificationEventInfo, "CertificationResult"); + } + + // 修改认证信息 + public override void ReCertificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + NativeCallBack.reCertificationResultCallback = callback; + string certificationEventInfo = JsonMapper.ToJson(certificationEvent); + IOSUnityAdpter.ReCertificate(certificationEventInfo, "ReCertificationResult"); + } + + // 刷新实名信息 + public override void RefreshCertification() + { + IOSUnityAdpter.RefreshCertification(); + } + + // 设置服务器返回语言 + public override void SetServerLanguage(ServerLanguage serverLanguage, Action callback) + { + NativeCallBack.setServerLanguageResultCallback = callback; + IOSUnityAdpter.SetServerLanguage(serverLanguage.ToString(), "SetServerLanguageResult"); + } + + // 获取设备ID + public override void GetDeviceId(Action callback) + { + NativeCallBack.getDeviceIdResultCallback = callback; + IOSUnityAdpter.GetDeviceId("GetDeviceIdResult"); + } + + + // 人脸识别 + public override void LiveDetect(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + NativeCallBack.liveDetectResultCallback = callback; + string yiDunEventInfo = JsonMapper.ToJson(yiDunEvent); + IOSUnityAdpter.LiveDetect(yiDunEventInfo, "LiveDetectResult"); + } + + // 行为验证码 + public override void GetYiDunCaptcha(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + NativeCallBack.getYiDunCaptchaResultCallback = callback; + string yiDunEventInfo = JsonMapper.ToJson(yiDunEvent); + IOSUnityAdpter.GetYiDunCaptcha(yiDunEventInfo, "GetYiDunCaptchaResult"); + } + + // 微信授权 + public override void RequestWXAuthorize(Action callback) + { + NativeCallBack.requestWXAuthorizeResultCallback = callback; + IOSUnityAdpter.RequestWXAuthorize("RequestWXAuthorizeResult"); + } + + // 获取微信用户信息 + public override void GetWXAuthInfo(Action callback) + { + NativeCallBack.getWXAuthInfoResultCallback = callback; + IOSUnityAdpter.GetWXAuthInfo("GetWXAuthInfoResult"); + } + + // 获取SDK版本号 + public override void GetAPIVersion(Action callback) + { + NativeCallBack.getAPIVersionResultCallback = callback; + IOSUnityAdpter.GetAPIVersion("GetAPIVersionResult"); + } + + // 分享 + public override void Share(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + NativeCallBack.shareResultCallback = callback; + string shareEventInfo = JsonMapper.ToJson(shareEvent); + IOSUnityAdpter.Share(shareEventInfo, "ShareResult"); + } + + // 隐私协议 + public override void SetPrivacy(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + NativeCallBack.setPrivacyResultCallback = callback; + string yiDunEventInfo = JsonMapper.ToJson(yiDunEvent); + IOSUnityAdpter.SetPrivacy(yiDunEventInfo, "SetPrivacyResult"); + } + + // 是否存在游客账号 + public override void HasGeneratedGuest(Action callback) + { + NativeCallBack.hasGeneratedGuestResultCallback = callback; + IOSUnityAdpter.HasGeneratedGuest("HasGeneratedGuestResult"); + } + + // 抖音归因设置用户信息 ok + public override void ResetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + NativeCallBack.resetUserInfoResultCallback = callback; + string douyinTrackInfo = JsonMapper.ToJson(dYTrackEvent); + IOSUnityAdpter.ResetDouYinUserInfo(douyinTrackInfo, "ResetUserInfoResult"); + } + + public override void ShowCollectUserInfo() + { + IOSUnityAdpter.ShowCollectUserInfo(); + } + + public override void ShowCollectThirdInfo() + { + IOSUnityAdpter.ShowCollectThirdInfo(); + } + + // 抖音归因获取用户信息 + public override void GetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + CallbackNotSupport(callback); + } + + // 抖音归因获取直播信息 ok + public override void GetLiveInfo(Action callback) + { + CallbackNotSupport(callback); + } + + // 单独设置配置参数 ok + public override void SetConfig(ConfigEventBuilder.ConfigEvent configEvent, Action callback) + { + CallbackNotSupport(callback); + } + + // 是否微信安装 ok + public override void IsWxInstalled(Action callback) + { + CallbackNotSupport(callback); + } + // ———————————————————————————————————————————— + + // 国内渠道登录 ok + public override void Login(Action callback) + { + CallbackNotSupport(callback); + } + + // 获取支付方式列表 + public override void Charge(PayEventBuilder.PayEvent payEvent, Action callback) + { + CallbackNotSupport(callback); + } + + // 退出游戏 + public override void ExitGame(Action callback) + { + CallbackNotSupport(callback); + } + + // 设置默认分享信息 + public override void SetDefaultShareInfo(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + CallbackNotSupport(callback); + } + + private void CallbackNotSupport(Action callback) + { + //TODO: 回调不支持 + throw new NotImplementedException(); + } + + // 设置发货回调 + public override void SetLocalDeliverListener(Action> callback) + { + CallbackNotSupport(null); + } + + public override void GetShareInfoFromMarketService(Action callback) + { + CallbackNotSupport(null); + } + + public override void GetAdInfoFromMarketService(Action callback, Action newCallback) + { + CallbackNotSupport(null); + } + + public override void TxAdSDKReport(TxAdSDKReportEventBuilder.TxAdSDKReportEvent txAdSDKReportEvent) + { + CallbackNotSupport(null); + } + + public override void SetWxUserInfo(SetWxUserInfoEventBuilder.SetWxUserInfoEvent setWxUserInfoEvent, Action callback) + { + CallbackNotSupport(null); + } + + public override void ShowAIHelp(AIHelpShowTypeBuilder.AIHelpShowType aihelpShowType) + { + IOSUnityAdpter.ShowAIHelp(JsonMapper.ToJson(aihelpShowType)); + } + + public override void SetLoginUserInfo(AIHelpSetLoginUserInfoTypeBuilder.AIHelpSetLoginUserInfoType aihelpSetLoginUserInfoType) + { + IOSUnityAdpter.SetLoginUserInfo(JsonMapper.ToJson(aihelpSetLoginUserInfoType)); + } + + public override void LogoutAIHelp() + { + IOSUnityAdpter.LogoutAIHelp(); + } + + public override void FetchAIHelpUnreadMessageCount() + { + IOSUnityAdpter.FetchAIHelpUnreadMessageCount(); + } + + public override void RegisterAIHelpEventListener(AiHelpEventType aihelpEventType, Action callback) + { + Action outCallback = (param) => + { + callback(param, null); + }; + string key = "registerAiHelpAsyncEventListener_" + aihelpEventType.ToString(); + NativeCallBack.callbacks[key] = outCallback; + IOSUnityAdpter.RegisterAIHelpEventListener((int)aihelpEventType, key); + } + + public override void UpdateServerUrl(string serverUrl) + { + IOSUnityAdpter.UpdateServerUrl(serverUrl); + } + + public override void UpdateServerUrlList(string[] serverUrlList) + { + IOSUnityAdpter.UpdateServerUrlList(JsonMapper.ToJson(serverUrlList)); + } + + public override string GetCustomKeyValue(string key, string defaultValue) + { + return IOSUnityAdpter.GetCustomKeyValue(key, defaultValue); + } + } +} + +#endif \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/IOSInterface.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/IOSInterface.cs.meta new file mode 100644 index 0000000..776de1e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/IOSInterface.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8e42a48fa9cc245dbaf2bfdab10442cd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/WebGLInterface.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/WebGLInterface.cs new file mode 100644 index 0000000..0e391bd --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/WebGLInterface.cs @@ -0,0 +1,445 @@ +#if UNITY_WEBGL + +using System; +using System.Runtime.InteropServices; +using LitJson; +using EngineSdkConverter.Unity.Plugins.WebGL; +using UnityEngine; + + +namespace EngineSdkConverter.Unity.SDK +{ + public class WebGLInterface : ISDKInterface + { + + [DllImport("__Internal")] + private static extern void loadJsScriptToBridge(string channelType); + + [DllImport("__Internal")] + private static extern void InitToBridge(string initEventInfo); + + [DllImport("__Internal")] + private static extern void LoginToBridge(string loginEventInfo); + + [DllImport("__Internal")] + private static extern void PayToBridge(string payEventInfo); + + [DllImport("__Internal")] + private static extern void SetShareInfoToBridge(string shareEventInfo); + + [DllImport("__Internal")] + private static extern void ShareToBridge(string shareEventInfo); + + [DllImport("__Internal")] + private static extern void GetShareInfoBridge(string shareEventInfo); + + [DllImport("__Internal")] + private static extern void GetAdInfoBridge(); + + [DllImport("__Internal")] + private static extern void GAEventTrackToBridge(string reportEventInfo); + + [DllImport("__Internal")] + private static extern void GAProfileTrackToBridge(string reportEventInfo); + + [DllImport("__Internal")] + private static extern void TxAdSDKReportToBridge(string txAdSDKReportEventInfo); + + [DllImport("__Internal")] + private static extern void CheckBindToBridge(string bindEventInfo); + + [DllImport("__Internal")] + private static extern void SendSmsCodeToBridge(string loginEventInfo); + + [DllImport("__Internal")] + private static extern void BindToBridge(string bindEventInfo); + + [DllImport("__Internal")] + private static extern void SetWxUserInfoToBridge(string type, string userInfo); + + [DllImport("__Internal")] + private static extern void UpdateServerUrlToBridge(string serverUrl); + + [DllImport("__Internal")] + private static extern string GetDeviceLevelToBridge(); + + [DllImport("__Internal")] + private static extern void CreatGridGamePanelToBridge(string gridGameModule); + + [DllImport("__Internal")] + private static extern void ShowGridGamePanelToBridge(string gridGamePanelId); + + [DllImport("__Internal")] + private static extern void HideGridGamePanelToBridge(string gridGamePanelId); + + [DllImport("__Internal")] + private static extern void DestroyGridGamePanelToBridge(string gridGamePanelId); + + public override void Init() + { + TYConfigManager.LoadConfig(); + loadJsScriptToBridge(TYConfigManager.GetChannelType()); + } + + public override void InitSDK(Action callback) + { + InitEventBuilder.InitEvent initEvent = new InitEventBuilder.InitEvent(); + InitSDK(initEvent, callback); + } + + public override void InitSDK(InitEventBuilder.InitEvent initEvent, Action callback) + { + NativeCallBack.initResultCallback = callback; + if (initEvent != null && !string.IsNullOrEmpty(initEvent.serverURL)) + { + TYConfigManager.configData.tuyooParam.serverUrl = initEvent.serverURL; + } + InitToBridge(JsonUtility.ToJson(TYConfigManager.configData)); + } + + public override void UpdateServerUrl(string serverUrl) + { + UpdateServerUrlToBridge(serverUrl); + } + + public override void Pay(PayEventBuilder.PayEvent payEvent, Action callback) + { + NativeCallBack.payResultCallback = callback; + string payEventInfo = JsonMapper.ToJson(payEvent); + PayToBridge(payEventInfo); + } + + public override void LoginByType(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + NativeCallBack.loginResultCallback = callback; + string loginEventInfo = JsonMapper.ToJson(loginEvent); + LoginToBridge(loginEventInfo); + } + + public override void GetLocalProductInfo(Action callback) + { + throw new NotImplementedException(); + } + + public override void Login(Action callback) + { + LoginEventBuilder.LoginEvent loginEvent = new LoginEventBuilder() + .SetLoginType(TYConfigManager.GetChannelType()) + .Build(); + LoginByType(loginEvent, callback); + } + + public override void SendCode(LoginEventBuilder.LoginEvent loginEvent, Action callback) + { + NativeCallBack.sendCodeResultCallback = callback; + string loginEventInfo = JsonMapper.ToJson(loginEvent); + SendSmsCodeToBridge(loginEventInfo); + } + + public override void Charge(PayEventBuilder.PayEvent payEvent, Action callback) + { + + } + + public override void SetPushResultHandler(Action onReceive, Action onClick) + { + + } + + public override void AppsFlyerEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + + } + + public override void SilentLogin(Action callback) + { + + } + + public override void Logout(Action callback) + { + + } + + public override void LogoutChannel(LoginEventBuilder.LoginEvent logoutEvent, Action callback) + { + + } + + public override void ExitGame(Action callback) + { + + } + + public override void GetAppsFlyerDeviceId(Action callback) + { + + } + + public override void SetAppsFlyerCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + + } + + public override void SetFirebaseUserProperty(ReportEventBuilder.ReportEvent reportEvent) + { + + } + + public override void SetFirebaseCommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + + } + + public override void FirebaseEventReport(ReportEventBuilder.ReportEvent reportEvent) + { + + } + + public override void Check(BindEventBuilder.BindEvent bindEvent, Action callback) + { + NativeCallBack.checkResultCallback = callback; + string bindEventInfo = JsonMapper.ToJson(bindEvent); + CheckBindToBridge(bindEventInfo); + } + + public override void Bind(BindEventBuilder.BindEvent bindEvent, Action callback) + { + NativeCallBack.bindCallback = callback; + string bindEventInfo = JsonMapper.ToJson(bindEvent); + BindToBridge(bindEventInfo); + } + + public override void CanBindList(Action callback) + { + + } + + public override void AlreadyBindList(Action callback) + { + + } + + public override void GetBindUserList(BindEventBuilder.BindEvent bindEvent, Action callback) + { + + } + + public override void GAProfileTrack(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent); + GAProfileTrackToBridge(reportEventInfo); + } + + public override void GAEventTrack(ReportEventBuilder.ReportEvent reportEvent) + { + string reportEventInfo = JsonMapper.ToJson(reportEvent); + GAEventTrackToBridge(reportEventInfo); + } + + public override void SetGACommonParam(ReportEventBuilder.ReportEvent reportEvent) + { + + } + + public override void SetLocalDeliverListener(Action> callback) + { + + } + + public override void RequestNotificationPermission() + { + + } + + public override void SetCertificationListener(Action callback) + { + + } + + public override void Certificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + + } + + public override void ReCertificate(CertificationEventBuilder.CertificationEvent certificationEvent, Action callback) + { + + } + + public override void RefreshCertification() + { + + } + + public override void SetServerLanguage(ServerLanguage serverLanguage, Action callback) + { + + } + + public override void GetDeviceId(Action callback) + { + + } + + public override void LiveDetect(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + + } + + public override void RequestWXAuthorize(Action callback) + { + + } + + public override void GetWXAuthInfo(Action callback) + { + + } + + public override void GetYiDunCaptcha(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + + } + + public override void GetAPIVersion(Action callback) + { + + } + + public override void HasGeneratedGuest(Action callback) + { + + } + + public override void SetPrivacy(YiDunEventBuilder.YiDunEvent yiDunEvent, Action callback) + { + + } + + public override void Share(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + NativeCallBack.shareResultCallback = callback; + string shareEventInfo = JsonMapper.ToJson(shareEvent); + ShareToBridge(shareEventInfo); + } + + public override void ResetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + + } + + public override void GetUserInfo(DYTrackEventBuilder.DYTrackEvent dYTrackEvent, Action callback) + { + + } + + public override void GetLiveInfo(Action callback) + { + + } + + public override void SetConfig(ConfigEventBuilder.ConfigEvent configEvent, Action callback) + { + + } + + public override void IsWxInstalled(Action callback) + { + + } + + public override void SetDefaultShareInfo(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + NativeCallBack.shareResultCallback = callback; + string shareEventInfo = JsonMapper.ToJson(shareEvent); + SetShareInfoToBridge(shareEventInfo); + } + + public override void GetShareInfoFromMarketService(Action callback) + { + NativeCallBack.getShareInfoCallback = callback; + string shareEventInfo = JsonMapper.ToJson(new ShareEventBuilder.ShareEvent()); + GetShareInfoBridge(shareEventInfo); + } + + public override void GetSharePointInfoFromMarketService(ShareEventBuilder.ShareEvent shareEvent, Action callback) + { + NativeCallBack.getShareInfoCallback = callback; + string shareEventInfo = JsonMapper.ToJson(shareEvent); + GetShareInfoBridge(shareEventInfo); + } + + public override void GetAdInfoFromMarketService(Action callback, Action newCallback) + { + NativeCallBack.getIconInfoCallback = callback; + NativeCallBack.getNewIconInfoCallback = newCallback; + GetAdInfoBridge(); + } + + public override void TxAdSDKReport(TxAdSDKReportEventBuilder.TxAdSDKReportEvent txAdSDKReportEvent) + { + string reportInfo = JsonMapper.ToJson(txAdSDKReportEvent); + TxAdSDKReportToBridge(reportInfo); + } + + public override void SetWxUserInfo(SetWxUserInfoEventBuilder.SetWxUserInfoEvent setWxUserInfoEvent, Action callback) + { + NativeCallBack.setWxUserInfoCallback = callback; + string type = "0"; + if (setWxUserInfoEvent.wxUserInfo is SetWxUserInfo) + { + type = "1"; + } + else if (setWxUserInfoEvent.wxUserInfo is SetWxEncData) + { + type = "2"; + } + else if (setWxUserInfoEvent.wxUserInfo is SetThreeWxEncData) + { + type = "3"; + } + string thirdExtendEventInfo = JsonMapper.ToJson(setWxUserInfoEvent); + SetWxUserInfoToBridge(type, thirdExtendEventInfo); + } + + public override string GetDeviceLevel(Action callback) + { + return GetDeviceLevelToBridge(); + } + + public override void CreateGridGamePanel(GridGameModuleBuilder.GridGameModule gridGameModule, Action callback) + { + string key = "GridGamePanel_" + Guid.NewGuid().ToString("N"); + if(key != null){ + gridGameModule.gridGamePanelId = key; + GridGamePanel gridGamePanel = new GridGamePanel().CreateGridGamePanel(gridGameModule, callback); + Action outCallback = (param) => + { + callback(param, gridGamePanel); + }; + NativeCallBack.callbacks[key] = outCallback; + string info = JsonMapper.ToJson(gridGameModule); + CreatGridGamePanelToBridge(info); + } + } + + internal override void ShowGridGamePanel(string gridGamePanelId) + { + ShowGridGamePanelToBridge(gridGamePanelId); + } + + internal override void HideGridGamePanel(string gridGamePanelId) + { + HideGridGamePanelToBridge(gridGamePanelId); + } + + internal override void DestroyGridGamePanel(string gridGamePanelId) + { + DestroyGridGamePanelToBridge(gridGamePanelId); + } + } + +} + +#endif \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/WebGLInterface.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/WebGLInterface.cs.meta new file mode 100644 index 0000000..f3fa6cf --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/Native/WebGLInterface.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f80cf62df7c0b44c49a4d24ec49980aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeCallBack.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeCallBack.cs new file mode 100644 index 0000000..e44dece --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeCallBack.cs @@ -0,0 +1,398 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using LitJson; + +namespace EngineSdkConverter.Unity.SDK +{ + public class NativeCallBack : SDKMonoBehaviour + { + public static Action initResultCallback; + public static Action silentLoginResultCallback; + public static Action loginResultCallback; + public static Action sendCodeResultCallback; + public static Action logoutResultCallback; + public static Action logoutChannelResultCallback; + public static Action autoLogoutResultCallback; + public static Action exitGameResultCallback; + public static Action chargeResultCallback; + public static Action payResultCallback; + public static Action getLocalProductInfoCallback; + public static Action onPushResultReceiveCallback; + public static Action onPushResultClickCallback; + public static Action getAFDeviceIdCallback; + public static Action checkResultCallback; + public static Action bindCallback; + public static Action canBindListResultCallback; + public static Action alreadyBindListResultCallback; + public static Action userBindListResultCallback; + // 设置发货回调 + public static Action> setDeliverResultCallback; + public static Action setServerLanguageResultCallback; + public static Action getDeviceIdResultCallback; + public static Action liveDetectResultCallback; + public static Action requestWXAuthorizeResultCallback; + public static Action getWXAuthInfoResultCallback; + public static Action getYiDunCaptchaResultCallback; + public static Action getAPIVersionResultCallback; + public static Action hasGeneratedGuestResultCallback; + public static Action setPrivacyResultCallback; + public static Action shareResultCallback; + public static Action getShareInfoCallback; + public static Action getIconInfoCallback; + public static Action getNewIconInfoCallback; + public static Action setWxUserInfoCallback; + public static Action setCertificationListenerCallback; + public static Action certificationResultCallback; + public static Action reCertificationResultCallback; + public static Action resetUserInfoResultCallback; + public static Action getUserInfoResultCallback; + public static Action getLiveInfoResultCallback; + public static Action setConfigResultCallback; + public static Action isWxInstalledResultCallback; + public static Action GetDeviceLevelCallback; + + private static Dictionary> actionMap = new Dictionary>(); + + // 统一回调入口 + public static Dictionary callbacks = new Dictionary(); + + public void UnifiedNativeCallback(string result) + { + JsonData json = JsonMapper.ToObject(result); + string action = json["action"].ToString(); + if (callbacks.ContainsKey(action)) + { + ((Action)callbacks[action])?.Invoke(result); + } + } + + // 切换到主线程回调 + private static readonly Queue _actions = new Queue(); + + public static void Enqueue(Action action) + { + if (action == null) return; + + lock (_actions) + { + _actions.Enqueue(action); + } + } + + private void Update() + { + lock (_actions) + { + while (_actions.Count > 0) + { + var action = _actions.Dequeue(); + action?.Invoke(); + } + } + } + + // 添加或更新 key-value + public static void Put(string key, Action action) + { + actionMap[key] = action; + } + + /*******************************************************************************************/ + + private void Awake() + { + DontDestroyOnLoad(GameObject); + } + + public void InitResult(string result) + { + Debug.Log("InitResult------>in! result=" + result); + initResultCallback?.Invoke(result); + } + + public void SilentLoginResult(string result) + { + Debug.Log("SilentLoginResult------>in! result=" + result); + silentLoginResultCallback?.Invoke(result); + } + + public void LoginResult(string result) + { + Debug.Log("LoginResult------>in! result=" + result); + loginResultCallback?.Invoke(result); + } + + public void SendCodeResult(string result) + { + Debug.Log("SendCodeResult------>in! result=" + result); + sendCodeResultCallback?.Invoke(result); + } + + public void LogoutResult(string result) + { + Debug.Log("LogoutResult------>in! result=" + result); + logoutResultCallback?.Invoke(result); + } + + public void LogoutChannelResult(string result) + { + Debug.Log("LogoutChannelResult------>in! result=" + result); + logoutChannelResultCallback?.Invoke(result); + } + + public void ExitGameResult(string result) + { + Debug.Log("ExitGameResult------>in! result=" + result); + exitGameResultCallback?.Invoke(result); + } + + public void ChargeResult(string result) + { + Debug.Log("ChargeResult------>in! result=" + result); + chargeResultCallback?.Invoke(result); + } + + public void PayResult(string result) + { + Debug.Log("PayResult------>in! result=" + result); + payResultCallback?.Invoke(result); + } + + public void GetLocalProductInfoResult(string result) + { + Debug.Log("GetLocalProductInfoResult------>in! result=" + result); + getLocalProductInfoCallback?.Invoke(result); + } + + public void onPushResultReceive(string result) + { + Debug.Log("onPushResultReceive------>in! result=" + result); + onPushResultReceiveCallback?.Invoke(result); + } + + public void onPushResultClick(string result) + { + Debug.Log("onPushResultClick------>in! result=" + result); + onPushResultClickCallback?.Invoke(result); + } + + public void GetAFDeviceId(string result) + { + Debug.Log("GetAFDeviceId------>in! result=" + result); + getAFDeviceIdCallback?.Invoke(result); + } + + public void CheckResult(string result) + { + Debug.Log("checkResult------>in! result=" + result); + checkResultCallback?.Invoke(result); + } + + public void onGetSnsInfoFail(string result) + { + Debug.Log("onGetSnsInfoFail------>in! result=" + result); + bindCallback?.Invoke(result); + } + + public void onCheckSnsInfoFail(string result) + { + Debug.Log("onCheckSnsInfoFail------>in! result=" + result); + bindCallback?.Invoke(result); + } + + public void onBindSnsInfoFail(string result) + { + Debug.Log("onBindSnsInfoFail------>in! result=" + result); + bindCallback?.Invoke(result); + } + + public void onBindSucc(string result) + { + Debug.Log("onBindSucc------>in! result=" + result); + bindCallback?.Invoke(result); + } + + public void CanBindListResult(string result) + { + Debug.Log("CanBindListResult------>in! result=" + result); + canBindListResultCallback?.Invoke(result); + } + + public void AlreadyBindListResult(string result) + { + Debug.Log("AlreadyBindListResult------>in! result=" + result); + alreadyBindListResultCallback?.Invoke(result); + } + + public void UserBindListResult(string result) + { + Debug.Log("UserBindListResult------>in! result=" + result); + userBindListResultCallback?.Invoke(result); + } + + public void SetServerLanguageResult(string result) + { + Debug.Log("SetServerLanguageResult------>in! result=" + result); + setServerLanguageResultCallback?.Invoke(result); + } + + public void GetDeviceIdResult(string result) + { + Debug.Log("GetDeviceIdResult------>in! result=" + result); + getDeviceIdResultCallback?.Invoke(result); + } + + public void LiveDetectResult(string result) + { + Debug.Log("LiveDetectResult------>in! result=" + result); + liveDetectResultCallback?.Invoke(result); + } + + public void RequestWXAuthorizeResult(string result) + { + Debug.Log("RequestWXAuthorizeResult------>in! result=" + result); + requestWXAuthorizeResultCallback?.Invoke(result); + } + + public void GetWXAuthInfoResult(string result) + { + Debug.Log("GetWXAuthInfoResult------>in! result=" + result); + getWXAuthInfoResultCallback?.Invoke(result); + } + + public void GetYiDunCaptchaResult(string result) + { + Debug.Log("GetYiDunCaptchaResult------>in! result=" + result); + getYiDunCaptchaResultCallback?.Invoke(result); + } + + public void GetAPIVersionResult(string result) + { + Debug.Log("GetAPIVersionResult------>in! result=" + result); + getAPIVersionResultCallback?.Invoke(result); + } + + public void HasGeneratedGuestResult(string result) + { + Debug.Log("HasGeneratedGuestResult------>in! result=" + result); + hasGeneratedGuestResultCallback?.Invoke(result); + } + + public void SetPrivacyResult(string result) + { + Debug.Log("SetPrivacyResult------>in! result=" + result); + setPrivacyResultCallback?.Invoke(result); + } + + public void ShareResult(string result) + { + Debug.Log("ShareResult------>in! result=" + result); + shareResultCallback?.Invoke(result); + } + + public void GetShareInfoResult(string result) + { + Debug.Log("GetShareInfoResult------>in! result=" + result); + getShareInfoCallback?.Invoke(result); + } + + public void GetIconInfoResult(string result) + { + Debug.Log("GetIconInfoResult------>in! result=" + result); + getIconInfoCallback?.Invoke(result); + } + + public void GetNewIconInfoResult(string result) + { + Debug.Log("GetNewIconInfoResult------>in! result=" + result); + getNewIconInfoCallback?.Invoke(result); + } + + public void SetWxInfoResult(string result) + { + Debug.Log("SetWxInfoResult------>in! result=" + result); + setWxUserInfoCallback?.Invoke(result); + } + + public void ResetUserInfoResult(string result) + { + Debug.Log("ResetUserInfoResult------>in! result=" + result); + resetUserInfoResultCallback?.Invoke(result); + } + + public void GetUserInfoResult(string result) + { + Debug.Log("GetUserInfoResult------>in! result=" + result); + getUserInfoResultCallback?.Invoke(result); + } + + public void GetLiveInfoResult(string result) + { + Debug.Log("GetLiveInfoResult------>in! result=" + result); + getLiveInfoResultCallback?.Invoke(result); + } + + public void AutoLogoutResult(string result) + { + Debug.Log("AutoLogoutResult------>in! result=" + result); + autoLogoutResultCallback?.Invoke(result); + } + + public void SetConfigResult(string result) + { + Debug.Log("SetConfigResult------>in! result=" + result); + setConfigResultCallback?.Invoke(result); + } + + public void IsWxInstalledResult(string result) + { + Debug.Log("IsWxInstalledResult------>in! result=" + result); + isWxInstalledResultCallback?.Invoke(result); + } + + public void onNativeCallback(string result) + { + Debug.Log("onNativeCallback------>in! result=" + result); + string method = getMethodFromResult(result); + if (actionMap.ContainsKey(method)) + { + actionMap[method]?.Invoke(getDataFromResult(result)); + actionMap.Remove(method); + } + } + + private string getMethodFromResult(string result) + { + return result.Substring(0, result.IndexOf(';')); + } + + private string getDataFromResult(string result) + { + return result.Substring(result.IndexOf(';') + 1); + } + + public void SetCertificationListener(string result) + { + Debug.Log("SetCertificationListener------>in! result=" + result); + setCertificationListenerCallback?.Invoke(result); + } + + public void CertificationResult(string result) + { + Debug.Log("CertificationResult------>in! result=" + result); + certificationResultCallback?.Invoke(result); + } + + public void ReCertificationResult(string result) + { + Debug.Log("ReCertificationResult------>in! result=" + result); + reCertificationResultCallback?.Invoke(result); + } + public void GetDeviceLevelResult(string result) + { + Debug.Log("GetDeviceLevelResult------>in! result=" + result); + GetDeviceLevelCallback?.Invoke(result); + } + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeCallBack.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeCallBack.cs.meta new file mode 100644 index 0000000..136525c --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeCallBack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b5e66b92c059a483680bda951704182a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeEvents.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeEvents.cs new file mode 100644 index 0000000..e9f5454 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeEvents.cs @@ -0,0 +1,942 @@ +using System; +using System.Collections.Generic; + +namespace EngineSdkConverter.Unity.SDK +{ + + //***** 初始化功能统一参数 *****// + public class InitEventBuilder + { + public class InitEvent + { + public string serverURL; + public string[] serverURLs; + public Action autoLogoutCallback; + public AIHelpInitType aihelp; + } + + private InitEvent _event; + + public InitEventBuilder() + { + _event = new InitEvent(); + } + + public InitEventBuilder SetServerURL(string url) + { + _event.serverURL = url; + return this; + } + + public InitEventBuilder SetServerURLs(string[] urls) + { + _event.serverURLs = urls; + return this; + } + + public InitEventBuilder SetAutoLogoutCallback(Action callback) + { + _event.autoLogoutCallback = callback; + return this; + } + + public InitEventBuilder SetAIHelpInitType(AIHelpInitType aihelp) + { + _event.aihelp = aihelp; + return this; + } + + public InitEvent Build() + { + return _event; + } + } + //************************// + + + //***** 登录功能统一参数 *****// + public class LoginEventBuilder + { + public class LoginEvent + { + public string loginType; + public string token; + public string extraParams; + } + + public class PhoneCodeLogin : LoginEvent + { + public string phoneNumber; + public string phoneCode; + } + + public class EmailCodeLogin : LoginEvent + { + public string emailNumber; + public string emailCode; + } + + public class YiDunLogin : LoginEvent + { + public YiDunEventBuilder.YiDunEvent yiDunEvent; + } + + // Android 用户id + 密码登录,for版署包 + public class UidPwdLogin : LoginEvent + { + public string uid; + public string password; + } + + private LoginEvent _event; + + public LoginEventBuilder SetLoginType(string type) + { + if (type.Equals("phoneCode")) + { + _event = new PhoneCodeLogin(); + } + else if (type.Equals("emailCode")) + { + _event = new EmailCodeLogin(); + } + else if (type.Equals("yidun")) + { + _event = new YiDunLogin(); + } + else if (type.Equals("uidPwd")) + { + _event = new UidPwdLogin(); + } + else + { + _event = new LoginEvent(); + } + _event.loginType = type; + return this; + } + + public LoginEventBuilder SetToken(string token) + { + SetLoginType("token"); + _event.token = token; + return this; + } + + public LoginEventBuilder SetExtraParams(string extraParams) + { + _event.extraParams = extraParams; + return this; + } + + public LoginEventBuilder SetPhoneNumber(string phone) + { + (_event as PhoneCodeLogin).phoneNumber = phone; + return this; + } + + public LoginEventBuilder SetPhoneCode(string code) + { + (_event as PhoneCodeLogin).phoneCode = code; + return this; + } + + public LoginEventBuilder SetEmailNumber(string email) + { + (_event as EmailCodeLogin).emailNumber = email; + return this; + } + + public LoginEventBuilder SetEmailCode(string code) + { + (_event as EmailCodeLogin).emailCode = code; + return this; + } + + public LoginEventBuilder SetUidWithPwd(string uid,string pwd) + { + (_event as UidPwdLogin).uid = uid; + (_event as UidPwdLogin).password = pwd; + return this; + } + + public LoginEventBuilder SetYiDunConfig(YiDunEventBuilder.YiDunEvent yiDunEvent) + { + (_event as YiDunLogin).yiDunEvent = yiDunEvent; + return this; + } + + public LoginEvent Build() + { + return _event; + } + } + //************************// + + //***** 绑定功能统一参数 *****// + public class BindEventBuilder + { + public class BindEvent + { + public string loginType; + public string userId; + public string phoneNumber; + } + + private BindEvent _event; + + public BindEventBuilder() + { + _event = new BindEvent(); + } + + public BindEventBuilder SetLoginType(string type) + { + _event.loginType = type; + return this; + } + + public BindEventBuilder SetUserId(string userId) + { + _event.userId = userId; + return this; + } + + public BindEventBuilder SetPhoneNumber(string phoneNember) + { + _event.phoneNumber = phoneNember; + return this; + } + + public BindEvent Build() + { + return _event; + } + } + //************************// + + //***** 支付功能统一参数 *****// + public class PayEventBuilder + { + public class PayEvent + { + public string userId; + public string productId; + public string productName; + public string productCount; + public string chargeService; + public string gameOrderId; + public string serverAppInfo; + public string gameId; + public string productPrice; + public string extraParams; + + } + + private PayEvent _event; + + public PayEventBuilder() + { + _event = new PayEvent(); + } + + public PayEventBuilder SetUserId(string userId) + { + _event.userId = userId; + return this; + } + + public PayEventBuilder SetProductId(string productId) + { + _event.productId = productId; + return this; + } + + public PayEventBuilder SetProductName(string productName) + { + _event.productName = productName; + return this; + } + + public PayEventBuilder SetProductCount(string productCount) + { + _event.productCount = productCount; + return this; + } + + public PayEventBuilder SetChargeService(string service) + { + _event.chargeService = service; + return this; + } + + public PayEventBuilder SetGameOrderId(string gameOrderId) + { + _event.gameOrderId = gameOrderId; + return this; + } + + public PayEventBuilder SetServerAppInfo(string serverAppInfo) + { + _event.serverAppInfo = serverAppInfo; + return this; + } + + public PayEventBuilder SetGameId(string gameId) + { + _event.gameId = gameId; + return this; + } + + public PayEventBuilder SetProductPrice(string productPrice) + { + _event.productPrice = productPrice; + return this; + } + + public PayEventBuilder SetExtraParams(string extraParams) + { + _event.extraParams = extraParams; + return this; + } + + public PayEvent Build() + { + return _event; + } + } + //************************// + + //***** 上报统一参数 *****// + public static class ReportProfileType + { + /** + * 直接设置一个用户的 Profile,如果用户或者 Profile 的字段已存在,则覆盖,不存在则自动创建。 + **/ + public static string PROFILE_SET = "profile_set"; + + /** + * 与 profile_set 接口不同的是,如果用户或者 Profile 的字段已存在,则这条记录会被忽略而不会覆盖已有数据,如果 Profile 不存在则会自动创建。因此,profile_set_once 比较适用于为用户设置首次激活时间、首次注册时间等只在首次设置时有效的属性。 + **/ + public static string PROFILE_SET_ONCE = "profile_set_once"; + /** + * 增加或减少一个用户的某个 Numeric 类型的 Profile,如果用户不存在则自动创建, Profile 不存在则默认为 0。 + **/ + public static string PROFILE_INCREMENT = "profile_increment"; + /** + * 删除一个用户的整个 Profile。 + **/ + public static string PROFILE_DELETE = "profile_delete"; + /** + * 将某个用户的某些属性值设置为空。另外,为了与其它接口保持一致,在提交的数据上,属性的值请设置为非 null 的任何值,例如 true。 + **/ + public static string PROFILE_UNSET = "profile_unset"; + } + + public static class ReportProfileSubjectType + { + public static string USERS = "users"; + public static string DEVICES = "devices"; + public static string ROLES = "roles"; + } + + public static class ReportEventType + { + public static string TRACK = "track"; + public static string GAME = "game"; + public static string COIN = "coin"; + public static string LOGIN = "login"; + public static string PAY = "pay"; + public static string PUSH = "push"; + public static string PROFILE = "profile"; + public static string PREFORMANCE = "preformance"; + public static string ADBOX = "adbox"; + public static string SDK = "sdk"; + public static string ABTEST = "abtest"; + } + + public class ReportEventBuilder + { + public class ReportEvent + { + public string typeName; + public string eventName; + public string profileType; + public string profileSubjectType; + public string profileSubjectPrimary; + public Dictionary reportEvent; + + public ReportEvent() + { + reportEvent = new Dictionary(); + } + } + + private ReportEvent _event; + + public ReportEventBuilder() + { + _event = new ReportEvent(); + } + + public ReportEventBuilder setTypeName(string typeName) + { + _event.typeName = typeName; + return this; + } + + public ReportEventBuilder setEventName(string eventName) + { + _event.eventName = eventName; + return this; + } + + public ReportEventBuilder setProfileType(string profileType) + { + _event.profileType = profileType; + return this; + } + + public ReportEventBuilder setProfileSubjectType(string profileSubjectType) + { + _event.profileSubjectType = profileSubjectType; + return this; + } + public ReportEventBuilder setProfileSubjectPrimary(string profileSubjectPrimary) + { + _event.profileSubjectPrimary = profileSubjectPrimary; + return this; + } + + public ReportEventBuilder addReportEvent(string key, string value) + { + _event.reportEvent.Add(key, value); + return this; + } + + public ReportEvent Build() + { + return _event; + } + } + //************************************************************* + + //***** 服务器返回语言统一参数 *****// + public enum ServerLanguage + { + zh_CN, // 中文简体 + zh_TW, // 中文繁体 + en_US, // 英语 + ja_JP, // 日语 + ko_KR, // 韩语(朝鲜语) + vi_VN, // 越南语 + tl_PH, // 菲律宾语 + ar, // 阿拉伯语 + nl_NL, // 荷兰语 + fr_FR, // 法语 + de_DE, // 德语 + it_IT, // 意大利语 + pt_PT, // 葡萄牙语 + es_ES, // 西班牙语 + bn_BD, // 孟加拉语 + hr_HR, // 克罗地亚语 + cs_CZ, // 捷克语 + da_DK, // 丹麦语 + el_GR, // 希腊语 + hi_IN, // 印度语 + hu_HU, // 匈牙利语 + in_ID, // 印度尼西亚语 + ms_MY, // 马来语 + fa_IR, // 波斯语 + pl_PL, // 波兰语 + ro_RO, // 罗马尼亚语 + ru_RU, // 俄罗斯语 + sr_RS, // 塞尔维亚语 + sv_SE, // 瑞典语 + th_TH, // 泰语 + tr_TR, // 土耳其语 + fi_FI, // 芬兰语 + af_ZA, // 南非语 + km_KH // 柬埔寨语 + } + //************************************************************* + + //***** 易盾统一参数 *****// + public static class YiDunOrientation + { + + } + public class YiDunEventBuilder + { + public class YiDunEvent + { + public string type; + } + + public class YiDunFaceDetect : YiDunEvent + { + public string faceTrackId; + public string authMsgOne; + public string authMsgTwo; + } + + public class YiDunCaptcha : YiDunEvent + { + public string captchaTrackId; + public string captchaId; + } + + public class YiDunLoginConfig : YiDunEvent + { + public string orientation; + public List hideLogin; + public Dictionary privacy; + + public YiDunLoginConfig() + { + hideLogin = new List(); + privacy = new Dictionary(); + } + } + + private YiDunEvent _event; + + public YiDunEventBuilder SetType(string type) + { + if (type.Equals("face")) + { + _event = new YiDunFaceDetect(); + } + else if (type.Equals("captcha")) + { + _event = new YiDunCaptcha(); + } + else if (type.Equals("login")) + { + _event = new YiDunLoginConfig(); + } + _event.type = type; + return this; + } + + public YiDunEventBuilder SetFaceTrackId(string faceTrackId) + { + (_event as YiDunFaceDetect).faceTrackId = faceTrackId; + return this; + } + + public YiDunEventBuilder SetAuthMsgOne(string authMsgOne) + { + (_event as YiDunFaceDetect).authMsgOne = authMsgOne; + return this; + } + + public YiDunEventBuilder SetAuthMsgTwo(string authMsgTwo) + { + (_event as YiDunFaceDetect).authMsgTwo = authMsgTwo; + return this; + } + + public YiDunEventBuilder SetCaptchaTrackId(string captchaTrackId) + { + (_event as YiDunCaptcha).captchaTrackId = captchaTrackId; + return this; + } + + public YiDunEventBuilder SetCaptchaId(string captchaId) + { + (_event as YiDunCaptcha).captchaId = captchaId; + return this; + } + + public YiDunEventBuilder SetYiDunOrientation(string orientation) + { + (_event as YiDunLoginConfig).orientation = orientation; + return this; + } + + public YiDunEventBuilder AddHidenType(string loginType) + { + (_event as YiDunLoginConfig).hideLogin.Add(loginType); + return this; + } + + public YiDunEventBuilder SetPrivacy(Dictionary privacy) + { + (_event as YiDunLoginConfig).privacy = privacy; + return this; + } + + public YiDunEvent Build() + { + return _event; + } + } + //************************************************************* + + //***** 分享统一参数 *****// + public static class ShareChannel + { + public static string WX = "wx"; + public static string FB = "fb"; + public static string MINI = "min"; + } + + public static class ShareType + { + public static string TEXT = "text"; + public static string LINK = "link"; + public static string IMAGE = "image"; + public static string VIDEO = "video"; + public static string MiniData = "miniData"; + } + + //public static class WXShareTarget + //{ + // public static string FRIEND = "friend"; + // public static string GROUP = "group"; + // public static string FAVOURITE = "favourite"; + //} + + public class Resource + { + public virtual string type { get; set; } + /** + * 附加参数 + * 1. 微信分享时,extra 中可以设置 target 参数,用于指定分享目标,可选值为 0 - 朋友圈 1 - 微信对话, 默认为 0 + * + */ + public Dictionary extra; + } + + public class TextResource : Resource + { + public override string type => ShareType.TEXT; + } + + public class LinkResource : Resource + { + public override string type => ShareType.LINK; + public string url; //链接地址 必填 分享的页面URL / 视频URL + public string title; //链接标题 + public string des; //链接描述 + public string picResPath; //链接缩略图图片 + public string picRes; //缩略图资源ID + } + + public class ImageResource : Resource + { + public override string type => ShareType.IMAGE; + public string path; //图片路径 必填 + public string des; //图片描述 + public string title; //图片标题 + } + + // 小程序分享 + public class MiniDataResource : Resource + { + public override string type => ShareType.MiniData; + public string appId; //小程序appId 小程序原始id + public string miniPath; //小程序路径 + public string miniProgramType; //小程序类型 正式版:0,测试版:1,体验版:2 + public string title; + public string desc; + public string picResPath; //缩略图路径 + } + + public class VideoResource : Resource + { + + } + + public class MediaResource : Resource + { + public string sharePointId; + public string shareSchemeId; + public string title; + public string desc; + public string path; + public string content; + public string bgImgUrl; + public string scImgUrl; + public string imageUrl; + public string extraParams; + // 微信动态分享信息 + public string activityData; + // 抖音分享 + public string shareTemplateId; + public string shareTopic; + public string videoContent; + public string videoShareTemplateId; + public string shareDefaultBgm; + public string shareCutTemplateId; + public string shareVideoPath; + public bool useDefault; + } + + public class ShareEventBuilder + { + public class ShareEvent + { + public string channel; + public Resource resource; + } + + //public class WXShareType : ShareEvent + //{ + // public string target; + //} + + //public class FBShareType : ShareEvent + //{ + + //} + + //public class MINIShareType : ShareEvent + //{ + + //} + + private ShareEvent _event; + + public ShareEventBuilder() + { + _event = new ShareEvent(); + } + + public ShareEventBuilder SetChannel(string channel) + { + //if (channel.Equals(ShareChannel.WX)) + //{ + // _event = new WXShareType(); + //} else if (channel.Equals(ShareChannel.FB)) + //{ + // _event = new FBShareType(); + //} else + //{ + // _event = new MINIShareType(); + //} + _event.channel = channel; + return this; + } + + //public ShareEventBuilder SetType(string type) + //{ + // if (type.Equals(ShareType.TEXT)) + // { + // _event.resource = new TextResource(); + // } else if(type.Equals(ShareType.LINK)) + // { + // _event.resource = new LinkResource(); + // } else if (type.Equals(ShareType.IMAGE)) + // { + // _event.resource = new ImageResource(); + // } else if (type.Equals(ShareType.LINK)) + // { + // _event.resource = new LinkResource(); + // } + // _event.type = type; + // return this; + //} + + public ShareEventBuilder SetResource(Resource resource) + { + _event.resource = resource; + return this; + } + + public ShareEvent Build() + { + return _event; + } + } + //************************************************************* + + //***** 抖音归因统一参数 *****// + public class DYTrackEventBuilder + { + public class DYTrackEvent + { + public string userId; + public string extraJson; + public string indieToken; + public string loginToken; + public string appId; + } + + private DYTrackEvent _event; + + public DYTrackEventBuilder() + { + _event = new DYTrackEvent(); + } + + public DYTrackEventBuilder SetUserId(string userId) + { + _event.userId = userId; + return this; + } + + public DYTrackEventBuilder SetExtraJson(string extraJson) + { + _event.extraJson = extraJson; + return this; + } + + public DYTrackEventBuilder SetIndieToken(string indieToken) + { + _event.indieToken = indieToken; + return this; + } + + public DYTrackEventBuilder SetLoginToken(string loginToken) + { + _event.loginToken = loginToken; + return this; + } + + public DYTrackEventBuilder SetAppId(string appId) + { + _event.appId = appId; + return this; + } + + public DYTrackEvent Build() + { + return _event; + } + } + //************************************************************* + + //********************** 配置参数 **********************// + public class ConfigEventBuilder + { + public class ConfigEvent + { + public string channelType; + public Dictionary configContent; + } + + private ConfigEvent _event; + + public ConfigEventBuilder() + { + _event = new ConfigEvent(); + } + + public ConfigEventBuilder SetChannelType(string channelType) + { + _event.channelType = channelType; + return this; + } + + public ConfigEventBuilder SetConfigContent(Dictionary configContent) + { + _event.configContent = configContent; + return this; + } + + public ConfigEvent Build() + { + return _event; + } + } + //************************************************************* + + //***** 微信小游戏-广点通归因事件上报参数 *****// + public class TxAdSDKReportEventBuilder + { + public class TxAdSDKReportEvent + { + public string actionType; + public string actionParams; + } + + private TxAdSDKReportEvent _event; + + public TxAdSDKReportEventBuilder() + { + _event = new TxAdSDKReportEvent(); + } + + public TxAdSDKReportEventBuilder setAction(string actionType) + { + _event.actionType = actionType; + return this; + } + + public TxAdSDKReportEventBuilder setExtraParams(string actionParams) + { + _event.actionParams = actionParams; + return this; + } + + public TxAdSDKReportEvent Build() + { + return _event; + } + } + + //************************************* + + //***** 微信小游戏设置用户信息 *****// + public class SetWxUserInfoEventBuilder + { + public class SetWxUserInfoEvent + { + public WxUserInfo wxUserInfo; + } + + private SetWxUserInfoEvent _event; + + public SetWxUserInfoEventBuilder() + { + _event = new SetWxUserInfoEvent(); + } + + public SetWxUserInfoEventBuilder setWxUserInfo(WxUserInfo wxUserInfo) + { + _event.wxUserInfo = wxUserInfo; + return this; + } + + public SetWxUserInfoEvent Build() + { + return _event; + } + + } + + public class WxUserInfo + { + + } + + public class SetWxUserInfo : WxUserInfo + { + public string province; + public string nickName; + public string avatarUrl; + public string gender; + public string city; + public string country; + public string language; + } + + public class SetWxEncData : WxUserInfo + { + public string encryptedData; + public string iv; + public string setattr; + } + + public class SetThreeWxEncData : WxUserInfo + { + public string wxOpenId; + public string unionId; + public string session_key; + } + + //************************************* + +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeEvents.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeEvents.cs.meta new file mode 100644 index 0000000..055c9f7 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/NativeEvents.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: af55dc690ccff4272b5561289a0cd5a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/SDKMonoBehaviour.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/SDKMonoBehaviour.cs new file mode 100644 index 0000000..186c6f7 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/SDKMonoBehaviour.cs @@ -0,0 +1,131 @@ +using UnityEngine; + +namespace EngineSdkConverter.Unity.SDK +{ + public class SDKMonoBehaviour : MonoBehaviour + { + private Transform _transform; + + public Transform Transform + { + get + { + if (_transform == null) + { + _transform = base.transform; + } + + return _transform; + } + } + + private GameObject _gameObject; + + protected GameObject GameObject + { + get + { + if (_gameObject == null) + { + _gameObject = base.gameObject; + } + + return _gameObject; + } + } + } + + /// + /// mono单例的实现 + /// + /// + public abstract class MonoSingleton : SDKMonoBehaviour where T : MonoSingleton + { + private static T mInstance = null; + public static Transform BootRoot = null; + + public static T Instance + { + get + { + if (mInstance is null) + { + mInstance = FindObjectOfType(typeof(T)) as T; + if (mInstance is null) + { + GameObject go = new GameObject(typeof(T).Name); + mInstance = go.AddComponent(); + if (BootRoot is null || BootRoot.gameObject == null) + { + var bootRootObj = GameObject.Find("Boot"); + if (bootRootObj is null) + { + bootRootObj = new GameObject("Boot"); + BootRoot = bootRootObj.transform; + DontDestroyOnLoad(bootRootObj); + } + else + { + BootRoot = bootRootObj.transform; + } + } + + if (!(BootRoot is null)) + { + go.transform.SetParent(BootRoot); + } + } + } + + return mInstance; + } + } + + + public void Startup() + { + } + + private void Awake() + { + if (mInstance == null) + { + mInstance = this as T; + } + + DontDestroyOnLoad(GameObject); + Init(); + } + + protected virtual void Init() + { + RegisterMsg(); + } + + protected virtual void RegisterMsg() + { + } + + protected virtual void UnRegisterMsg() + { + } + + public void DestroySelf() + { + UnRegisterMsg(); + Dispose(); + mInstance = null; + Destroy(GameObject); + } + + public virtual void Dispose() + { + } + + protected virtual void OnDestroy() + { + UnRegisterMsg(); + mInstance = null; + } + } +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/SDKMonoBehaviour.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/SDKMonoBehaviour.cs.meta new file mode 100644 index 0000000..feffeea --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/SDKMonoBehaviour.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d89e0933a63e44c60a306b0d1b1d9234 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/UnityPlayerUtils.cs b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/UnityPlayerUtils.cs new file mode 100644 index 0000000..e956070 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/UnityPlayerUtils.cs @@ -0,0 +1,97 @@ +// using Unity.VisualScripting; +using UnityEngine; + +#if UNITY_ANDROID +namespace EngineSdkConverter.Unity.SDK +{ + public class UnityPlayerUtils + { + private static AndroidJavaClass sdkMidLayer; + private static string sdkMidLayerPath = "com.tuyoo.sdk.sdk_inter_layer_unity.UnityInterface"; + + static UnityPlayerUtils() + { + sdkMidLayer = new AndroidJavaClass(sdkMidLayerPath); + } + + public static void invokeWithAll(string sdkType, string args, string callbackId) + { + Debug.Log($"invokeWithAll: {sdkType}: {args}: {callbackId}"); + sdkMidLayer.CallStatic(sdkType, args, callbackId); + } + + public static object invokeWithAllReturn(string sdkType, string args, string callbackId) + { + Debug.Log($"invokeWithAll: {sdkType}: {args}: {callbackId}"); + return sdkMidLayer.CallStatic(sdkType, args, callbackId); + } + + public static void invokeWithCallback(string sdkType, string callbackId) + { + Debug.Log($"invokeWithCallback: {sdkType}: {callbackId}"); + sdkMidLayer.CallStatic(sdkType, callbackId); + } + + public static void invokeWithTwoCallback(string sdkType, string callbackIdF, string callbackIdS) + { + Debug.Log($"invokeWithTwoCallback: {sdkType}: {callbackIdF}: {callbackIdS}"); + sdkMidLayer.CallStatic(sdkType, callbackIdF, callbackIdS); + } + + public static void invokeWithAllFourCallback(string sdkType, string args, string callbackIdF, string callbackIdS, string callbackIdT, string callbackIdFo) + { + Debug.Log($"invokeWithAllFourCallback: {sdkType}: {args}: {callbackIdF}: {callbackIdS}: {callbackIdT}: {callbackIdFo}"); + sdkMidLayer.CallStatic(sdkType, args, callbackIdF, callbackIdS, callbackIdT, callbackIdFo); + } + + public static void invokeWithParams(string sdkType, string args) + { + Debug.Log($"invokeWithParams: {sdkType}: {args}"); + sdkMidLayer.CallStatic(sdkType, args); + } + + public static void invokeWithTwoParams(string sdkType, string argsOne, string argsTwo) + { + Debug.Log($"invokeWithParams: {sdkType}: {argsOne}: {argsTwo}"); + sdkMidLayer.CallStatic(sdkType, argsOne, argsTwo); + } + + public static void invokeWithThreeParams(string sdkType, string argsOne, string argsTwo, string argsThree) + { + Debug.Log($"invokeWithParams: {sdkType}: {argsOne}: {argsTwo}: {argsThree}"); + sdkMidLayer.CallStatic(sdkType, argsOne, argsTwo, argsThree); + } + + public static void invokeWithNone(string sdkType) + { + Debug.Log($"invokeWithNone: {sdkType}"); + sdkMidLayer.CallStatic(sdkType); + } + + public static string invokeWithNoneReturn(string sdkType) + { + Debug.Log($"invokeWithNoneReturn: {sdkType}"); + return sdkMidLayer.CallStatic(sdkType); + } + + public static string invokeWithTwoReturn(string sdkType, string argsOne, string argsTwo) + { + Debug.Log($"invokeWithOneReturn: {sdkType}: {argsOne}: {argsTwo}"); + return sdkMidLayer.CallStatic(sdkType, argsOne, argsTwo); + } + + public static void invokeWithJavaObject(string sdkType, object callback) + { + Debug.Log($"invokeWithJavaObject: {sdkType}"); + sdkMidLayer.CallStatic(sdkType, callback); + } + + public static void invokeWithJavaObject(string sdkType, string args, object callback) + { + Debug.Log($"invokeWithParamsAndJavaObject: {sdkType}"); + sdkMidLayer.CallStatic(sdkType, args, callback); + } + + } +} +#endif \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/UnityPlayerUtils.cs.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/UnityPlayerUtils.cs.meta new file mode 100644 index 0000000..e5f278e --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/Scripts/SDK/UnityPlayerUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8925468e6af6a4b4db24d06924b54e89 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/com.tuyoo.unitysdk.asmdef b/Packages/com.bywaystudios.tuyoosdk/Runtime/com.tuyoo.unitysdk.asmdef new file mode 100644 index 0000000..448b8f3 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/com.tuyoo.unitysdk.asmdef @@ -0,0 +1,21 @@ +{ + "name": "com.tuyoo.unitysdk", + "rootNamespace": "", + "references": [ + "GUID:2104153dbb22d46e89c9a1195f478f01" + ], + "includePlatforms": [ + "Android", + "Editor", + "iOS", + "WebGL" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/Runtime/com.tuyoo.unitysdk.asmdef.meta b/Packages/com.bywaystudios.tuyoosdk/Runtime/com.tuyoo.unitysdk.asmdef.meta new file mode 100644 index 0000000..16bbb64 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/Runtime/com.tuyoo.unitysdk.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1555d8ab8ac204cd1aff97b28220a345 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.bywaystudios.tuyoosdk/package.json b/Packages/com.bywaystudios.tuyoosdk/package.json new file mode 100644 index 0000000..65878ae --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/package.json @@ -0,0 +1,6 @@ +{ + "name": "com.bywaystudios.tuyoosdk", + "displayName": "TuyooSDK", + "version": "1.0.20-exp.2", + "description": "Include Tuyoo SDK and Resolve Build Process Problems" +} \ No newline at end of file diff --git a/Packages/com.bywaystudios.tuyoosdk/package.json.meta b/Packages/com.bywaystudios.tuyoosdk/package.json.meta new file mode 100644 index 0000000..f15bb84 --- /dev/null +++ b/Packages/com.bywaystudios.tuyoosdk/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 84080fe21dea58c4a8b9b610229a3f87 +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json new file mode 100644 index 0000000..8ea1a67 --- /dev/null +++ b/Packages/manifest.json @@ -0,0 +1,53 @@ +{ + "dependencies": { + "com.bywaystudios.customgradle": "8.13.0-exp.2", + "com.bywaystudios.gameconfig": "1.0.0-meowment.1", + "com.unity.collab-proxy": "2.10.2", + "com.unity.feature.development": "1.0.1", + "com.unity.textmeshpro": "3.0.7", + "com.unity.timeline": "1.7.7", + "com.unity.ugui": "1.0.0", + "com.unity.upm.develop": "0.5.3-exp.1", + "com.unity.visualscripting": "1.9.4", + "com.unity.modules.ai": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.cloth": "1.0.0", + "com.unity.modules.director": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.physics2d": "1.0.0", + "com.unity.modules.screencapture": "1.0.0", + "com.unity.modules.terrain": "1.0.0", + "com.unity.modules.terrainphysics": "1.0.0", + "com.unity.modules.tilemap": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.umbra": "1.0.0", + "com.unity.modules.unityanalytics": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.unitywebrequesttexture": "1.0.0", + "com.unity.modules.unitywebrequestwww": "1.0.0", + "com.unity.modules.vehicles": "1.0.0", + "com.unity.modules.video": "1.0.0", + "com.unity.modules.vr": "1.0.0", + "com.unity.modules.wind": "1.0.0", + "com.unity.modules.xr": "1.0.0" + }, + "scopedRegistries": [ + { + "name": "bywaystudios", + "url": "https://npm.bywaystudios.com/", + "scopes": [ + "com.bywaystudios" + ] + } + ] +} diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json new file mode 100644 index 0000000..0f05f2a --- /dev/null +++ b/Packages/packages-lock.json @@ -0,0 +1,429 @@ +{ + "dependencies": { + "com.bywaystudios.customgradle": { + "version": "8.13.0-exp.2", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://npm.bywaystudios.com" + }, + "com.bywaystudios.gameconfig": { + "version": "1.0.0-meowment.1", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://npm.bywaystudios.com" + }, + "com.bywaystudios.tuyoosdk": { + "version": "file:com.bywaystudios.tuyoosdk", + "depth": 0, + "source": "embedded", + "dependencies": {} + }, + "com.unity.asset-store-validation": { + "version": "0.1.3", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.nuget.newtonsoft-json": "2.0.2" + }, + "url": "https://packages.unity.com" + }, + "com.unity.collab-proxy": { + "version": "2.10.2", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.editorcoroutines": { + "version": "1.0.0", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.ext.nunit": { + "version": "1.0.6", + "depth": 2, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.feature.development": { + "version": "1.0.1", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.ide.visualstudio": "2.0.22", + "com.unity.ide.rider": "3.0.36", + "com.unity.ide.vscode": "1.2.5", + "com.unity.editorcoroutines": "1.0.0", + "com.unity.performance.profile-analyzer": "1.2.3", + "com.unity.test-framework": "1.1.33", + "com.unity.testtools.codecoverage": "1.2.6" + } + }, + "com.unity.ide.rider": { + "version": "3.0.36", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.ext.nunit": "1.0.6" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ide.visualstudio": { + "version": "2.0.22", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.1.9" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ide.vscode": { + "version": "1.2.5", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.nuget.newtonsoft-json": { + "version": "3.2.1", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.performance.profile-analyzer": { + "version": "1.2.3", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.settings-manager": { + "version": "2.1.0", + "depth": 2, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.test-framework": { + "version": "1.1.33", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.ext.nunit": "1.0.6", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.testtools.codecoverage": { + "version": "1.2.6", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.0.16", + "com.unity.settings-manager": "1.0.1" + }, + "url": "https://packages.unity.com" + }, + "com.unity.textmeshpro": { + "version": "3.0.7", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.timeline": { + "version": "1.7.7", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.director": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ugui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0" + } + }, + "com.unity.upm.develop": { + "version": "0.5.3-exp.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.1.20", + "com.unity.nuget.newtonsoft-json": "2.0.2", + "com.unity.asset-store-validation": "0.1.3" + }, + "url": "https://packages.unity.com" + }, + "com.unity.visualscripting": { + "version": "1.9.4", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.modules.ai": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.androidjni": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.animation": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.assetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.audio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.cloth": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.director": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.animation": "1.0.0" + } + }, + "com.unity.modules.imageconversion": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.imgui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.jsonserialize": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.particlesystem": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics2d": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.screencapture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.subsystems": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.terrain": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.terrainphysics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.terrain": "1.0.0" + } + }, + "com.unity.modules.tilemap": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics2d": "1.0.0" + } + }, + "com.unity.modules.ui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.uielements": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.umbra": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unityanalytics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.unitywebrequest": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unitywebrequestassetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestaudio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.audio": "1.0.0" + } + }, + "com.unity.modules.unitywebrequesttexture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestwww": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.vehicles": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.video": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.vr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.xr": "1.0.0" + } + }, + "com.unity.modules.wind": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.xr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.subsystems": "1.0.0" + } + } + } +} diff --git a/ProjectSettings/AudioManager.asset b/ProjectSettings/AudioManager.asset new file mode 100644 index 0000000..07ebfb0 --- /dev/null +++ b/ProjectSettings/AudioManager.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!11 &1 +AudioManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Volume: 1 + Rolloff Scale: 1 + Doppler Factor: 1 + Default Speaker Mode: 2 + m_SampleRate: 0 + m_DSPBufferSize: 1024 + m_VirtualVoiceCount: 512 + m_RealVoiceCount: 32 + m_SpatializerPlugin: + m_AmbisonicDecoderPlugin: + m_DisableAudio: 0 + m_VirtualizeEffects: 1 + m_RequestedDSPBufferSize: 1024 diff --git a/ProjectSettings/ClusterInputManager.asset b/ProjectSettings/ClusterInputManager.asset new file mode 100644 index 0000000..e7886b2 --- /dev/null +++ b/ProjectSettings/ClusterInputManager.asset @@ -0,0 +1,6 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!236 &1 +ClusterInputManager: + m_ObjectHideFlags: 0 + m_Inputs: [] diff --git a/ProjectSettings/DynamicsManager.asset b/ProjectSettings/DynamicsManager.asset new file mode 100644 index 0000000..cdc1f3e --- /dev/null +++ b/ProjectSettings/DynamicsManager.asset @@ -0,0 +1,34 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!55 &1 +PhysicsManager: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_Gravity: {x: 0, y: -9.81, z: 0} + m_DefaultMaterial: {fileID: 0} + m_BounceThreshold: 2 + m_SleepThreshold: 0.005 + m_DefaultContactOffset: 0.01 + m_DefaultSolverIterations: 6 + m_DefaultSolverVelocityIterations: 1 + m_QueriesHitBackfaces: 0 + m_QueriesHitTriggers: 1 + m_EnableAdaptiveForce: 0 + m_ClothInterCollisionDistance: 0 + m_ClothInterCollisionStiffness: 0 + m_ContactsGeneration: 1 + m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + m_AutoSimulation: 1 + m_AutoSyncTransforms: 0 + m_ReuseCollisionCallbacks: 1 + m_ClothInterCollisionSettingsToggle: 0 + m_ContactPairsMode: 0 + m_BroadphaseType: 0 + m_WorldBounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 250, y: 250, z: 250} + m_WorldSubdivisions: 8 + m_FrictionType: 0 + m_EnableEnhancedDeterminism: 0 + m_EnableUnifiedHeightmaps: 1 + m_DefaultMaxAngluarSpeed: 7 diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset new file mode 100644 index 0000000..40917b0 --- /dev/null +++ b/ProjectSettings/EditorBuildSettings.asset @@ -0,0 +1,11 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1045 &1 +EditorBuildSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Scenes: + - enabled: 1 + path: Assets/Scenes/SampleScene.unity + guid: 9fc0d4010bbf28b4594072e72b8655ab + m_configObjects: {} diff --git a/ProjectSettings/EditorSettings.asset b/ProjectSettings/EditorSettings.asset new file mode 100644 index 0000000..1e44a0a --- /dev/null +++ b/ProjectSettings/EditorSettings.asset @@ -0,0 +1,30 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!159 &1 +EditorSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_ExternalVersionControlSupport: Visible Meta Files + m_SerializationMode: 2 + m_LineEndingsForNewScripts: 0 + m_DefaultBehaviorMode: 0 + m_PrefabRegularEnvironment: {fileID: 0} + m_PrefabUIEnvironment: {fileID: 0} + m_SpritePackerMode: 0 + m_SpritePackerPaddingPower: 1 + m_EtcTextureCompressorBehavior: 1 + m_EtcTextureFastCompressor: 1 + m_EtcTextureNormalCompressor: 2 + m_EtcTextureBestCompressor: 4 + m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref + m_ProjectGenerationRootNamespace: + m_CollabEditorSettings: + inProgressEnabled: 1 + m_EnableTextureStreamingInEditMode: 1 + m_EnableTextureStreamingInPlayMode: 1 + m_AsyncShaderCompilation: 1 + m_EnterPlayModeOptionsEnabled: 0 + m_EnterPlayModeOptions: 3 + m_ShowLightmapResolutionOverlay: 1 + m_UseLegacyProbeSampleCount: 0 + m_SerializeInlineMappingsOnOneLine: 1 diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset new file mode 100644 index 0000000..43369e3 --- /dev/null +++ b/ProjectSettings/GraphicsSettings.asset @@ -0,0 +1,63 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!30 &1 +GraphicsSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_Deferred: + m_Mode: 1 + m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} + m_DeferredReflections: + m_Mode: 1 + m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} + m_ScreenSpaceShadows: + m_Mode: 1 + m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} + m_LegacyDeferred: + m_Mode: 1 + m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} + m_DepthNormals: + m_Mode: 1 + m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} + m_MotionVectors: + m_Mode: 1 + m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} + m_LightHalo: + m_Mode: 1 + m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} + m_LensFlare: + m_Mode: 1 + m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} + m_AlwaysIncludedShaders: + - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} + m_PreloadedShaders: [] + m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, + type: 0} + m_CustomRenderPipeline: {fileID: 0} + m_TransparencySortMode: 0 + m_TransparencySortAxis: {x: 0, y: 0, z: 1} + m_DefaultRenderingPath: 1 + m_DefaultMobileRenderingPath: 1 + m_TierSettings: [] + m_LightmapStripping: 0 + m_FogStripping: 0 + m_InstancingStripping: 0 + m_LightmapKeepPlain: 1 + m_LightmapKeepDirCombined: 1 + m_LightmapKeepDynamicPlain: 1 + m_LightmapKeepDynamicDirCombined: 1 + m_LightmapKeepShadowMask: 1 + m_LightmapKeepSubtractive: 1 + m_FogKeepLinear: 1 + m_FogKeepExp: 1 + m_FogKeepExp2: 1 + m_AlbedoSwatchInfos: [] + m_LightsUseLinearIntensity: 0 + m_LightsUseColorTemperature: 0 + m_LogWhenShaderIsCompiled: 0 + m_AllowEnlightenSupportForUpgradedProject: 0 diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset new file mode 100644 index 0000000..17c8f53 --- /dev/null +++ b/ProjectSettings/InputManager.asset @@ -0,0 +1,295 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!13 &1 +InputManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Axes: + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: a + altPositiveButton: d + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: s + altPositiveButton: w + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left ctrl + altNegativeButton: + altPositiveButton: mouse 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left alt + altNegativeButton: + altPositiveButton: mouse 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left shift + altNegativeButton: + altPositiveButton: mouse 2 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: space + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse X + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse Y + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse ScrollWheel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 2 + joyNum: 0 + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 0 + type: 2 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 1 + type: 2 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 0 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 1 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 2 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: return + altNegativeButton: + altPositiveButton: joystick button 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: enter + altNegativeButton: + altPositiveButton: space + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Cancel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: escape + altNegativeButton: + altPositiveButton: joystick button 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 diff --git a/ProjectSettings/MemorySettings.asset b/ProjectSettings/MemorySettings.asset new file mode 100644 index 0000000..5b5face --- /dev/null +++ b/ProjectSettings/MemorySettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!387306366 &1 +MemorySettings: + m_ObjectHideFlags: 0 + m_EditorMemorySettings: + m_MainAllocatorBlockSize: -1 + m_ThreadAllocatorBlockSize: -1 + m_MainGfxBlockSize: -1 + m_ThreadGfxBlockSize: -1 + m_CacheBlockSize: -1 + m_TypetreeBlockSize: -1 + m_ProfilerBlockSize: -1 + m_ProfilerEditorBlockSize: -1 + m_BucketAllocatorGranularity: -1 + m_BucketAllocatorBucketsCount: -1 + m_BucketAllocatorBlockSize: -1 + m_BucketAllocatorBlockCount: -1 + m_ProfilerBucketAllocatorGranularity: -1 + m_ProfilerBucketAllocatorBucketsCount: -1 + m_ProfilerBucketAllocatorBlockSize: -1 + m_ProfilerBucketAllocatorBlockCount: -1 + m_TempAllocatorSizeMain: -1 + m_JobTempAllocatorBlockSize: -1 + m_BackgroundJobTempAllocatorBlockSize: -1 + m_JobTempAllocatorReducedBlockSize: -1 + m_TempAllocatorSizeGIBakingWorker: -1 + m_TempAllocatorSizeNavMeshWorker: -1 + m_TempAllocatorSizeAudioWorker: -1 + m_TempAllocatorSizeCloudWorker: -1 + m_TempAllocatorSizeGfx: -1 + m_TempAllocatorSizeJobWorker: -1 + m_TempAllocatorSizeBackgroundWorker: -1 + m_TempAllocatorSizePreloadManager: -1 + m_PlatformMemorySettings: {} diff --git a/ProjectSettings/NavMeshAreas.asset b/ProjectSettings/NavMeshAreas.asset new file mode 100644 index 0000000..3b0b7c3 --- /dev/null +++ b/ProjectSettings/NavMeshAreas.asset @@ -0,0 +1,91 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!126 &1 +NavMeshProjectSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + areas: + - name: Walkable + cost: 1 + - name: Not Walkable + cost: 1 + - name: Jump + cost: 2 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + m_LastAgentTypeID: -887442657 + m_Settings: + - serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.75 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_SettingNames: + - Humanoid diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset new file mode 100644 index 0000000..313c72c --- /dev/null +++ b/ProjectSettings/PackageManagerSettings.asset @@ -0,0 +1,44 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_EnablePreReleasePackages: 0 + m_AdvancedSettingsExpanded: 1 + m_ScopedRegistriesSettingsExpanded: 1 + m_SeeAllPackageVersions: 0 + m_DismissPreviewPackagesInUse: 0 + oneTimeWarningShown: 0 + m_Registries: + - m_Id: main + m_Name: + m_Url: https://packages.unity.com + m_Scopes: [] + m_IsDefault: 1 + m_Capabilities: 7 + m_ConfigSource: 0 + - m_Id: scoped:project:bywaystudios + m_Name: bywaystudios + m_Url: https://npm.bywaystudios.com + m_Scopes: + - com.bywaystudios + m_IsDefault: 0 + m_Capabilities: 0 + m_ConfigSource: 4 + m_UserSelectedRegistryName: bywaystudios + m_UserAddingNewScopedRegistry: 0 + m_RegistryInfoDraft: + m_Modified: 0 + m_ErrorMessage: + m_UserModificationsInstanceId: -836 + m_OriginalInstanceId: -838 + m_LoadAssets: 0 diff --git a/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json b/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json new file mode 100644 index 0000000..3c7b4c1 --- /dev/null +++ b/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json @@ -0,0 +1,5 @@ +{ + "m_Dictionary": { + "m_DictionaryValues": [] + } +} \ No newline at end of file diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset new file mode 100644 index 0000000..47880b1 --- /dev/null +++ b/ProjectSettings/Physics2DSettings.asset @@ -0,0 +1,56 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!19 &1 +Physics2DSettings: + m_ObjectHideFlags: 0 + serializedVersion: 4 + m_Gravity: {x: 0, y: -9.81} + m_DefaultMaterial: {fileID: 0} + m_VelocityIterations: 8 + m_PositionIterations: 3 + m_VelocityThreshold: 1 + m_MaxLinearCorrection: 0.2 + m_MaxAngularCorrection: 8 + m_MaxTranslationSpeed: 100 + m_MaxRotationSpeed: 360 + m_BaumgarteScale: 0.2 + m_BaumgarteTimeOfImpactScale: 0.75 + m_TimeToSleep: 0.5 + m_LinearSleepTolerance: 0.01 + m_AngularSleepTolerance: 2 + m_DefaultContactOffset: 0.01 + m_JobOptions: + serializedVersion: 2 + useMultithreading: 0 + useConsistencySorting: 0 + m_InterpolationPosesPerJob: 100 + m_NewContactsPerJob: 30 + m_CollideContactsPerJob: 100 + m_ClearFlagsPerJob: 200 + m_ClearBodyForcesPerJob: 200 + m_SyncDiscreteFixturesPerJob: 50 + m_SyncContinuousFixturesPerJob: 50 + m_FindNearestContactsPerJob: 100 + m_UpdateTriggerContactsPerJob: 100 + m_IslandSolverCostThreshold: 100 + m_IslandSolverBodyCostScale: 1 + m_IslandSolverContactCostScale: 10 + m_IslandSolverJointCostScale: 10 + m_IslandSolverBodiesPerJob: 50 + m_IslandSolverContactsPerJob: 50 + m_AutoSimulation: 1 + m_QueriesHitTriggers: 1 + m_QueriesStartInColliders: 1 + m_CallbacksOnDisable: 1 + m_ReuseCollisionCallbacks: 1 + m_AutoSyncTransforms: 0 + m_AlwaysShowColliders: 0 + m_ShowColliderSleep: 1 + m_ShowColliderContacts: 0 + m_ShowColliderAABB: 0 + m_ContactArrowScale: 0.2 + m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} + m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} + m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} + m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} + m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/ProjectSettings/PresetManager.asset b/ProjectSettings/PresetManager.asset new file mode 100644 index 0000000..67a94da --- /dev/null +++ b/ProjectSettings/PresetManager.asset @@ -0,0 +1,7 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1386491679 &1 +PresetManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_DefaultPresets: {} diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset new file mode 100644 index 0000000..b484af6 --- /dev/null +++ b/ProjectSettings/ProjectSettings.asset @@ -0,0 +1,962 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!129 &1 +PlayerSettings: + m_ObjectHideFlags: 0 + serializedVersion: 26 + productGUID: da310c323b4d9ea4d8c6e4392474fc19 + AndroidProfiler: 0 + AndroidFilterTouchesWhenObscured: 0 + AndroidEnableSustainedPerformanceMode: 0 + defaultScreenOrientation: 4 + targetDevice: 2 + useOnDemandResources: 0 + accelerometerFrequency: 60 + companyName: DefaultCompany + productName: TuyooSDK + defaultCursor: {fileID: 0} + cursorHotspot: {x: 0, y: 0} + m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} + m_ShowUnitySplashScreen: 1 + m_ShowUnitySplashLogo: 1 + m_SplashScreenOverlayOpacity: 1 + m_SplashScreenAnimation: 1 + m_SplashScreenLogoStyle: 1 + m_SplashScreenDrawMode: 0 + m_SplashScreenBackgroundAnimationZoom: 1 + m_SplashScreenLogoAnimationZoom: 1 + m_SplashScreenBackgroundLandscapeAspect: 1 + m_SplashScreenBackgroundPortraitAspect: 1 + m_SplashScreenBackgroundLandscapeUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenBackgroundPortraitUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenLogos: [] + m_VirtualRealitySplashScreen: {fileID: 0} + m_HolographicTrackingLossScreen: {fileID: 0} + defaultScreenWidth: 1920 + defaultScreenHeight: 1080 + defaultScreenWidthWeb: 960 + defaultScreenHeightWeb: 600 + m_StereoRenderingPath: 0 + m_ActiveColorSpace: 1 + unsupportedMSAAFallback: 0 + m_SpriteBatchVertexThreshold: 300 + m_MTRendering: 1 + mipStripping: 0 + numberOfMipsStripped: 0 + numberOfMipsStrippedPerMipmapLimitGroup: {} + m_StackTraceTypes: 010000000100000001000000010000000100000001000000 + iosShowActivityIndicatorOnLoading: -1 + androidShowActivityIndicatorOnLoading: -1 + iosUseCustomAppBackgroundBehavior: 0 + allowedAutorotateToPortrait: 1 + allowedAutorotateToPortraitUpsideDown: 1 + allowedAutorotateToLandscapeRight: 1 + allowedAutorotateToLandscapeLeft: 1 + useOSAutorotation: 1 + use32BitDisplayBuffer: 1 + preserveFramebufferAlpha: 0 + disableDepthAndStencilBuffers: 0 + androidStartInFullscreen: 1 + androidRenderOutsideSafeArea: 1 + androidUseSwappy: 1 + androidBlitType: 0 + androidResizableWindow: 0 + androidDefaultWindowWidth: 1920 + androidDefaultWindowHeight: 1080 + androidMinimumWindowWidth: 400 + androidMinimumWindowHeight: 300 + androidFullscreenMode: 1 + androidAutoRotationBehavior: 1 + androidPredictiveBackSupport: 1 + defaultIsNativeResolution: 1 + macRetinaSupport: 1 + runInBackground: 1 + captureSingleScreen: 0 + muteOtherAudioSources: 0 + Prepare IOS For Recording: 0 + Force IOS Speakers When Recording: 0 + audioSpatialExperience: 0 + deferSystemGesturesMode: 0 + hideHomeButton: 0 + submitAnalytics: 1 + usePlayerLog: 1 + dedicatedServerOptimizations: 0 + bakeCollisionMeshes: 0 + forceSingleInstance: 0 + useFlipModelSwapchain: 1 + resizableWindow: 0 + useMacAppStoreValidation: 0 + macAppStoreCategory: public.app-category.games + gpuSkinning: 1 + xboxPIXTextureCapture: 0 + xboxEnableAvatar: 0 + xboxEnableKinect: 0 + xboxEnableKinectAutoTracking: 0 + xboxEnableFitness: 0 + visibleInBackground: 1 + allowFullscreenSwitch: 1 + fullscreenMode: 1 + xboxSpeechDB: 0 + xboxEnableHeadOrientation: 0 + xboxEnableGuest: 0 + xboxEnablePIXSampling: 0 + metalFramebufferOnly: 0 + xboxOneResolution: 0 + xboxOneSResolution: 0 + xboxOneXResolution: 3 + xboxOneMonoLoggingLevel: 0 + xboxOneLoggingLevel: 1 + xboxOneDisableEsram: 0 + xboxOneEnableTypeOptimization: 0 + xboxOnePresentImmediateThreshold: 0 + switchQueueCommandMemory: 0 + switchQueueControlMemory: 16384 + switchQueueComputeMemory: 262144 + switchNVNShaderPoolsGranularity: 33554432 + switchNVNDefaultPoolsGranularity: 16777216 + switchNVNOtherPoolsGranularity: 16777216 + switchGpuScratchPoolGranularity: 2097152 + switchAllowGpuScratchShrinking: 0 + switchNVNMaxPublicTextureIDCount: 0 + switchNVNMaxPublicSamplerIDCount: 0 + switchNVNGraphicsFirmwareMemory: 32 + switchMaxWorkerMultiple: 8 + stadiaPresentMode: 0 + stadiaTargetFramerate: 0 + vulkanNumSwapchainBuffers: 3 + vulkanEnableSetSRGBWrite: 0 + vulkanEnablePreTransform: 1 + vulkanEnableLateAcquireNextImage: 0 + vulkanEnableCommandBufferRecycling: 1 + loadStoreDebugModeEnabled: 0 + visionOSBundleVersion: 1.0 + tvOSBundleVersion: 1.0 + bundleVersion: 0.1 + preloadedAssets: [] + metroInputSource: 0 + wsaTransparentSwapchain: 0 + m_HolographicPauseOnTrackingLoss: 1 + xboxOneDisableKinectGpuReservation: 1 + xboxOneEnable7thCore: 1 + vrSettings: + enable360StereoCapture: 0 + isWsaHolographicRemotingEnabled: 0 + enableFrameTimingStats: 0 + enableOpenGLProfilerGPURecorders: 1 + allowHDRDisplaySupport: 0 + useHDRDisplay: 0 + hdrBitDepth: 0 + m_ColorGamuts: 00000000 + targetPixelDensity: 30 + resolutionScalingMode: 0 + resetResolutionOnWindowResize: 0 + androidSupportedAspectRatio: 1 + androidMaxAspectRatio: 2.1 + applicationIdentifier: + Android: com.DefaultCompany.TuyooSDK + buildNumber: + Standalone: 0 + VisionOS: 0 + iPhone: 0 + tvOS: 0 + overrideDefaultApplicationIdentifier: 0 + AndroidBundleVersionCode: 1 + AndroidMinSdkVersion: 22 + AndroidTargetSdkVersion: 0 + AndroidPreferredInstallLocation: 1 + aotOptions: + stripEngineCode: 1 + iPhoneStrippingLevel: 0 + iPhoneScriptCallOptimization: 0 + ForceInternetPermission: 0 + ForceSDCardPermission: 0 + CreateWallpaper: 0 + APKExpansionFiles: 0 + keepLoadedShadersAlive: 0 + StripUnusedMeshComponents: 1 + strictShaderVariantMatching: 0 + VertexChannelCompressionMask: 4054 + iPhoneSdkVersion: 988 + iOSSimulatorArchitecture: 0 + iOSTargetOSVersionString: 12.0 + tvOSSdkVersion: 0 + tvOSSimulatorArchitecture: 0 + tvOSRequireExtendedGameController: 0 + tvOSTargetOSVersionString: 12.0 + VisionOSSdkVersion: 0 + VisionOSTargetOSVersionString: 1.0 + uIPrerenderedIcon: 0 + uIRequiresPersistentWiFi: 0 + uIRequiresFullScreen: 1 + uIStatusBarHidden: 1 + uIExitOnSuspend: 0 + uIStatusBarStyle: 0 + appleTVSplashScreen: {fileID: 0} + appleTVSplashScreen2x: {fileID: 0} + tvOSSmallIconLayers: [] + tvOSSmallIconLayers2x: [] + tvOSLargeIconLayers: [] + tvOSLargeIconLayers2x: [] + tvOSTopShelfImageLayers: [] + tvOSTopShelfImageLayers2x: [] + tvOSTopShelfImageWideLayers: [] + tvOSTopShelfImageWideLayers2x: [] + iOSLaunchScreenType: 0 + iOSLaunchScreenPortrait: {fileID: 0} + iOSLaunchScreenLandscape: {fileID: 0} + iOSLaunchScreenBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreenFillPct: 100 + iOSLaunchScreenSize: 100 + iOSLaunchScreenCustomXibPath: + iOSLaunchScreeniPadType: 0 + iOSLaunchScreeniPadImage: {fileID: 0} + iOSLaunchScreeniPadBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreeniPadFillPct: 100 + iOSLaunchScreeniPadSize: 100 + iOSLaunchScreeniPadCustomXibPath: + iOSLaunchScreenCustomStoryboardPath: + iOSLaunchScreeniPadCustomStoryboardPath: + iOSDeviceRequirements: [] + iOSURLSchemes: [] + macOSURLSchemes: [] + iOSBackgroundModes: 0 + iOSMetalForceHardShadows: 0 + metalEditorSupport: 1 + metalAPIValidation: 1 + metalCompileShaderBinary: 0 + iOSRenderExtraFrameOnPause: 0 + iosCopyPluginsCodeInsteadOfSymlink: 0 + appleDeveloperTeamID: + iOSManualSigningProvisioningProfileID: + tvOSManualSigningProvisioningProfileID: + VisionOSManualSigningProvisioningProfileID: + iOSManualSigningProvisioningProfileType: 0 + tvOSManualSigningProvisioningProfileType: 0 + VisionOSManualSigningProvisioningProfileType: 0 + appleEnableAutomaticSigning: 0 + iOSRequireARKit: 0 + iOSAutomaticallyDetectAndAddCapabilities: 1 + appleEnableProMotion: 0 + shaderPrecisionModel: 0 + clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea + templatePackageId: com.unity.template.3d@8.1.3 + templateDefaultScene: Assets/Scenes/SampleScene.unity + useCustomMainManifest: 0 + useCustomLauncherManifest: 0 + useCustomMainGradleTemplate: 0 + useCustomLauncherGradleManifest: 0 + useCustomBaseGradleTemplate: 0 + useCustomGradlePropertiesTemplate: 0 + useCustomGradleSettingsTemplate: 0 + useCustomProguardFile: 0 + AndroidTargetArchitectures: 1 + AndroidTargetDevices: 0 + AndroidSplashScreenScale: 0 + androidSplashScreen: {fileID: 0} + AndroidKeystoreName: + AndroidKeyaliasName: + AndroidEnableArmv9SecurityFeatures: 0 + AndroidBuildApkPerCpuArchitecture: 0 + AndroidTVCompatibility: 0 + AndroidIsGame: 1 + AndroidEnableTango: 0 + androidEnableBanner: 1 + androidUseLowAccuracyLocation: 0 + androidUseCustomKeystore: 0 + m_AndroidBanners: + - width: 320 + height: 180 + banner: {fileID: 0} + androidGamepadSupportLevel: 0 + chromeosInputEmulation: 1 + AndroidMinifyRelease: 0 + AndroidMinifyDebug: 0 + AndroidValidateAppBundleSize: 1 + AndroidAppBundleSizeToValidate: 150 + m_BuildTargetIcons: [] + m_BuildTargetPlatformIcons: + - m_BuildTarget: iPhone + m_Icons: + - m_Textures: [] + m_Width: 180 + m_Height: 180 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 120 + m_Height: 120 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 167 + m_Height: 167 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 152 + m_Height: 152 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 76 + m_Height: 76 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 120 + m_Height: 120 + m_Kind: 3 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 80 + m_Height: 80 + m_Kind: 3 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 80 + m_Height: 80 + m_Kind: 3 + m_SubKind: iPad + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 3 + m_SubKind: iPad + - m_Textures: [] + m_Width: 87 + m_Height: 87 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 58 + m_Height: 58 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 29 + m_Height: 29 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 58 + m_Height: 58 + m_Kind: 1 + m_SubKind: iPad + - m_Textures: [] + m_Width: 29 + m_Height: 29 + m_Kind: 1 + m_SubKind: iPad + - m_Textures: [] + m_Width: 60 + m_Height: 60 + m_Kind: 2 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 2 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 2 + m_SubKind: iPad + - m_Textures: [] + m_Width: 20 + m_Height: 20 + m_Kind: 2 + m_SubKind: iPad + - m_Textures: [] + m_Width: 1024 + m_Height: 1024 + m_Kind: 4 + m_SubKind: App Store + - m_BuildTarget: Android + m_Icons: + - m_Textures: [] + m_Width: 432 + m_Height: 432 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 324 + m_Height: 324 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 216 + m_Height: 216 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 162 + m_Height: 162 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 108 + m_Height: 108 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 81 + m_Height: 81 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 192 + m_Height: 192 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 144 + m_Height: 144 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 96 + m_Height: 96 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 72 + m_Height: 72 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 48 + m_Height: 48 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 36 + m_Height: 36 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 192 + m_Height: 192 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 144 + m_Height: 144 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 96 + m_Height: 96 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 72 + m_Height: 72 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 48 + m_Height: 48 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 36 + m_Height: 36 + m_Kind: 0 + m_SubKind: + m_BuildTargetBatching: + - m_BuildTarget: Standalone + m_StaticBatching: 1 + m_DynamicBatching: 0 + - m_BuildTarget: tvOS + m_StaticBatching: 1 + m_DynamicBatching: 0 + - m_BuildTarget: Android + m_StaticBatching: 1 + m_DynamicBatching: 0 + - m_BuildTarget: iPhone + m_StaticBatching: 1 + m_DynamicBatching: 0 + - m_BuildTarget: WebGL + m_StaticBatching: 0 + m_DynamicBatching: 0 + m_BuildTargetShaderSettings: [] + m_BuildTargetGraphicsJobs: + - m_BuildTarget: MacStandaloneSupport + m_GraphicsJobs: 0 + - m_BuildTarget: Switch + m_GraphicsJobs: 1 + - m_BuildTarget: MetroSupport + m_GraphicsJobs: 1 + - m_BuildTarget: AppleTVSupport + m_GraphicsJobs: 0 + - m_BuildTarget: BJMSupport + m_GraphicsJobs: 1 + - m_BuildTarget: LinuxStandaloneSupport + m_GraphicsJobs: 1 + - m_BuildTarget: PS4Player + m_GraphicsJobs: 1 + - m_BuildTarget: iOSSupport + m_GraphicsJobs: 0 + - m_BuildTarget: WindowsStandaloneSupport + m_GraphicsJobs: 1 + - m_BuildTarget: XboxOnePlayer + m_GraphicsJobs: 1 + - m_BuildTarget: LuminSupport + m_GraphicsJobs: 0 + - m_BuildTarget: AndroidPlayer + m_GraphicsJobs: 0 + - m_BuildTarget: WebGLSupport + m_GraphicsJobs: 0 + m_BuildTargetGraphicsJobMode: + - m_BuildTarget: PS4Player + m_GraphicsJobMode: 0 + - m_BuildTarget: XboxOnePlayer + m_GraphicsJobMode: 0 + m_BuildTargetGraphicsAPIs: + - m_BuildTarget: AndroidPlayer + m_APIs: 150000000b000000 + m_Automatic: 1 + - m_BuildTarget: iOSSupport + m_APIs: 10000000 + m_Automatic: 1 + - m_BuildTarget: AppleTVSupport + m_APIs: 10000000 + m_Automatic: 1 + - m_BuildTarget: WebGLSupport + m_APIs: 0b000000 + m_Automatic: 1 + m_BuildTargetVRSettings: + - m_BuildTarget: Standalone + m_Enabled: 0 + m_Devices: + - Oculus + - OpenVR + m_DefaultShaderChunkSizeInMB: 16 + m_DefaultShaderChunkCount: 0 + openGLRequireES31: 0 + openGLRequireES31AEP: 0 + openGLRequireES32: 0 + m_TemplateCustomTags: {} + mobileMTRendering: + Android: 1 + iPhone: 1 + tvOS: 1 + m_BuildTargetGroupLightmapEncodingQuality: + - m_BuildTarget: Android + m_EncodingQuality: 1 + - m_BuildTarget: iPhone + m_EncodingQuality: 1 + - m_BuildTarget: tvOS + m_EncodingQuality: 1 + m_BuildTargetGroupHDRCubemapEncodingQuality: + - m_BuildTarget: Android + m_EncodingQuality: 1 + - m_BuildTarget: iPhone + m_EncodingQuality: 1 + - m_BuildTarget: tvOS + m_EncodingQuality: 1 + m_BuildTargetGroupLightmapSettings: [] + m_BuildTargetGroupLoadStoreDebugModeSettings: [] + m_BuildTargetNormalMapEncoding: + - m_BuildTarget: Android + m_Encoding: 1 + - m_BuildTarget: iPhone + m_Encoding: 1 + - m_BuildTarget: tvOS + m_Encoding: 1 + m_BuildTargetDefaultTextureCompressionFormat: + - m_BuildTarget: Android + m_Format: 3 + playModeTestRunnerEnabled: 0 + runPlayModeTestAsEditModeTest: 0 + actionOnDotNetUnhandledException: 1 + enableInternalProfiler: 0 + logObjCUncaughtExceptions: 1 + enableCrashReportAPI: 0 + cameraUsageDescription: + locationUsageDescription: + microphoneUsageDescription: + bluetoothUsageDescription: + macOSTargetOSVersion: 10.13.0 + switchNMETAOverride: + switchNetLibKey: + switchSocketMemoryPoolSize: 6144 + switchSocketAllocatorPoolSize: 128 + switchSocketConcurrencyLimit: 14 + switchScreenResolutionBehavior: 2 + switchUseCPUProfiler: 0 + switchEnableFileSystemTrace: 0 + switchLTOSetting: 0 + switchApplicationID: 0x01004b9000490000 + switchNSODependencies: + switchCompilerFlags: + switchTitleNames_0: + switchTitleNames_1: + switchTitleNames_2: + switchTitleNames_3: + switchTitleNames_4: + switchTitleNames_5: + switchTitleNames_6: + switchTitleNames_7: + switchTitleNames_8: + switchTitleNames_9: + switchTitleNames_10: + switchTitleNames_11: + switchTitleNames_12: + switchTitleNames_13: + switchTitleNames_14: + switchTitleNames_15: + switchPublisherNames_0: + switchPublisherNames_1: + switchPublisherNames_2: + switchPublisherNames_3: + switchPublisherNames_4: + switchPublisherNames_5: + switchPublisherNames_6: + switchPublisherNames_7: + switchPublisherNames_8: + switchPublisherNames_9: + switchPublisherNames_10: + switchPublisherNames_11: + switchPublisherNames_12: + switchPublisherNames_13: + switchPublisherNames_14: + switchPublisherNames_15: + switchIcons_0: {fileID: 0} + switchIcons_1: {fileID: 0} + switchIcons_2: {fileID: 0} + switchIcons_3: {fileID: 0} + switchIcons_4: {fileID: 0} + switchIcons_5: {fileID: 0} + switchIcons_6: {fileID: 0} + switchIcons_7: {fileID: 0} + switchIcons_8: {fileID: 0} + switchIcons_9: {fileID: 0} + switchIcons_10: {fileID: 0} + switchIcons_11: {fileID: 0} + switchIcons_12: {fileID: 0} + switchIcons_13: {fileID: 0} + switchIcons_14: {fileID: 0} + switchIcons_15: {fileID: 0} + switchSmallIcons_0: {fileID: 0} + switchSmallIcons_1: {fileID: 0} + switchSmallIcons_2: {fileID: 0} + switchSmallIcons_3: {fileID: 0} + switchSmallIcons_4: {fileID: 0} + switchSmallIcons_5: {fileID: 0} + switchSmallIcons_6: {fileID: 0} + switchSmallIcons_7: {fileID: 0} + switchSmallIcons_8: {fileID: 0} + switchSmallIcons_9: {fileID: 0} + switchSmallIcons_10: {fileID: 0} + switchSmallIcons_11: {fileID: 0} + switchSmallIcons_12: {fileID: 0} + switchSmallIcons_13: {fileID: 0} + switchSmallIcons_14: {fileID: 0} + switchSmallIcons_15: {fileID: 0} + switchManualHTML: + switchAccessibleURLs: + switchLegalInformation: + switchMainThreadStackSize: 1048576 + switchPresenceGroupId: + switchLogoHandling: 0 + switchReleaseVersion: 0 + switchDisplayVersion: 1.0.0 + switchStartupUserAccount: 0 + switchSupportedLanguagesMask: 0 + switchLogoType: 0 + switchApplicationErrorCodeCategory: + switchUserAccountSaveDataSize: 0 + switchUserAccountSaveDataJournalSize: 0 + switchApplicationAttribute: 0 + switchCardSpecSize: -1 + switchCardSpecClock: -1 + switchRatingsMask: 0 + switchRatingsInt_0: 0 + switchRatingsInt_1: 0 + switchRatingsInt_2: 0 + switchRatingsInt_3: 0 + switchRatingsInt_4: 0 + switchRatingsInt_5: 0 + switchRatingsInt_6: 0 + switchRatingsInt_7: 0 + switchRatingsInt_8: 0 + switchRatingsInt_9: 0 + switchRatingsInt_10: 0 + switchRatingsInt_11: 0 + switchRatingsInt_12: 0 + switchLocalCommunicationIds_0: + switchLocalCommunicationIds_1: + switchLocalCommunicationIds_2: + switchLocalCommunicationIds_3: + switchLocalCommunicationIds_4: + switchLocalCommunicationIds_5: + switchLocalCommunicationIds_6: + switchLocalCommunicationIds_7: + switchParentalControl: 0 + switchAllowsScreenshot: 1 + switchAllowsVideoCapturing: 1 + switchAllowsRuntimeAddOnContentInstall: 0 + switchDataLossConfirmation: 0 + switchUserAccountLockEnabled: 0 + switchSystemResourceMemory: 16777216 + switchSupportedNpadStyles: 22 + switchNativeFsCacheSize: 32 + switchIsHoldTypeHorizontal: 0 + switchSupportedNpadCount: 8 + switchEnableTouchScreen: 1 + switchSocketConfigEnabled: 0 + switchTcpInitialSendBufferSize: 32 + switchTcpInitialReceiveBufferSize: 64 + switchTcpAutoSendBufferSizeMax: 256 + switchTcpAutoReceiveBufferSizeMax: 256 + switchUdpSendBufferSize: 9 + switchUdpReceiveBufferSize: 42 + switchSocketBufferEfficiency: 4 + switchSocketInitializeEnabled: 1 + switchNetworkInterfaceManagerInitializeEnabled: 1 + switchDisableHTCSPlayerConnection: 0 + switchUseNewStyleFilepaths: 1 + switchUseLegacyFmodPriorities: 0 + switchUseMicroSleepForYield: 1 + switchEnableRamDiskSupport: 0 + switchMicroSleepForYieldTime: 25 + switchRamDiskSpaceSize: 12 + ps4NPAgeRating: 12 + ps4NPTitleSecret: + ps4NPTrophyPackPath: + ps4ParentalLevel: 11 + ps4ContentID: ED1633-NPXX51362_00-0000000000000000 + ps4Category: 0 + ps4MasterVersion: 01.00 + ps4AppVersion: 01.00 + ps4AppType: 0 + ps4ParamSfxPath: + ps4VideoOutPixelFormat: 0 + ps4VideoOutInitialWidth: 1920 + ps4VideoOutBaseModeInitialWidth: 1920 + ps4VideoOutReprojectionRate: 60 + ps4PronunciationXMLPath: + ps4PronunciationSIGPath: + ps4BackgroundImagePath: + ps4StartupImagePath: + ps4StartupImagesFolder: + ps4IconImagesFolder: + ps4SaveDataImagePath: + ps4SdkOverride: + ps4BGMPath: + ps4ShareFilePath: + ps4ShareOverlayImagePath: + ps4PrivacyGuardImagePath: + ps4ExtraSceSysFile: + ps4NPtitleDatPath: + ps4RemotePlayKeyAssignment: -1 + ps4RemotePlayKeyMappingDir: + ps4PlayTogetherPlayerCount: 0 + ps4EnterButtonAssignment: 1 + ps4ApplicationParam1: 0 + ps4ApplicationParam2: 0 + ps4ApplicationParam3: 0 + ps4ApplicationParam4: 0 + ps4DownloadDataSize: 0 + ps4GarlicHeapSize: 2048 + ps4ProGarlicHeapSize: 2560 + playerPrefsMaxSize: 32768 + ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ + ps4pnSessions: 1 + ps4pnPresence: 1 + ps4pnFriends: 1 + ps4pnGameCustomData: 1 + playerPrefsSupport: 0 + enableApplicationExit: 0 + resetTempFolder: 1 + restrictedAudioUsageRights: 0 + ps4UseResolutionFallback: 0 + ps4ReprojectionSupport: 0 + ps4UseAudio3dBackend: 0 + ps4UseLowGarlicFragmentationMode: 1 + ps4SocialScreenEnabled: 0 + ps4ScriptOptimizationLevel: 0 + ps4Audio3dVirtualSpeakerCount: 14 + ps4attribCpuUsage: 0 + ps4PatchPkgPath: + ps4PatchLatestPkgPath: + ps4PatchChangeinfoPath: + ps4PatchDayOne: 0 + ps4attribUserManagement: 0 + ps4attribMoveSupport: 0 + ps4attrib3DSupport: 0 + ps4attribShareSupport: 0 + ps4attribExclusiveVR: 0 + ps4disableAutoHideSplash: 0 + ps4videoRecordingFeaturesUsed: 0 + ps4contentSearchFeaturesUsed: 0 + ps4CompatibilityPS5: 0 + ps4AllowPS5Detection: 0 + ps4GPU800MHz: 1 + ps4attribEyeToEyeDistanceSettingVR: 0 + ps4IncludedModules: [] + ps4attribVROutputEnabled: 0 + monoEnv: + splashScreenBackgroundSourceLandscape: {fileID: 0} + splashScreenBackgroundSourcePortrait: {fileID: 0} + blurSplashScreenBackground: 1 + spritePackerPolicy: + webGLMemorySize: 16 + webGLExceptionSupport: 1 + webGLNameFilesAsHashes: 0 + webGLShowDiagnostics: 0 + webGLDataCaching: 1 + webGLDebugSymbols: 0 + webGLEmscriptenArgs: + webGLModulesDirectory: + webGLTemplate: APPLICATION:Default + webGLAnalyzeBuildSize: 0 + webGLUseEmbeddedResources: 0 + webGLCompressionFormat: 1 + webGLWasmArithmeticExceptions: 0 + webGLLinkerTarget: 1 + webGLThreadsSupport: 0 + webGLDecompressionFallback: 0 + webGLInitialMemorySize: 32 + webGLMaximumMemorySize: 2048 + webGLMemoryGrowthMode: 2 + webGLMemoryLinearGrowthStep: 16 + webGLMemoryGeometricGrowthStep: 0.2 + webGLMemoryGeometricGrowthCap: 96 + webGLPowerPreference: 2 + scriptingDefineSymbols: {} + additionalCompilerArguments: {} + platformArchitecture: {} + scriptingBackend: {} + il2cppCompilerConfiguration: {} + il2cppCodeGeneration: {} + managedStrippingLevel: + EmbeddedLinux: 1 + GameCoreScarlett: 1 + GameCoreXboxOne: 1 + Nintendo Switch: 1 + PS4: 1 + PS5: 1 + QNX: 1 + Stadia: 1 + VisionOS: 1 + WebGL: 1 + Windows Store Apps: 1 + XboxOne: 1 + iPhone: 1 + tvOS: 1 + incrementalIl2cppBuild: {} + suppressCommonWarnings: 1 + allowUnsafeCode: 0 + useDeterministicCompilation: 1 + additionalIl2CppArgs: + scriptingRuntimeVersion: 1 + gcIncremental: 1 + gcWBarrierValidation: 0 + apiCompatibilityLevelPerPlatform: {} + m_RenderingPath: 1 + m_MobileRenderingPath: 1 + metroPackageName: TuyooSDK + metroPackageVersion: + metroCertificatePath: + metroCertificatePassword: + metroCertificateSubject: + metroCertificateIssuer: + metroCertificateNotAfter: 0000000000000000 + metroApplicationDescription: TuyooSDK + wsaImages: {} + metroTileShortName: + metroTileShowName: 0 + metroMediumTileShowName: 0 + metroLargeTileShowName: 0 + metroWideTileShowName: 0 + metroSupportStreamingInstall: 0 + metroLastRequiredScene: 0 + metroDefaultTileSize: 1 + metroTileForegroundText: 2 + metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} + metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1} + metroSplashScreenUseBackgroundColor: 0 + syncCapabilities: 0 + platformCapabilities: {} + metroTargetDeviceFamilies: {} + metroFTAName: + metroFTAFileTypes: [] + metroProtocolName: + vcxProjDefaultLanguage: + XboxOneProductId: + XboxOneUpdateKey: + XboxOneSandboxId: + XboxOneContentId: + XboxOneTitleId: + XboxOneSCId: + XboxOneGameOsOverridePath: + XboxOnePackagingOverridePath: + XboxOneAppManifestOverridePath: + XboxOneVersion: 1.0.0.0 + XboxOnePackageEncryption: 0 + XboxOnePackageUpdateGranularity: 2 + XboxOneDescription: + XboxOneLanguage: + - enus + XboxOneCapability: [] + XboxOneGameRating: {} + XboxOneIsContentPackage: 0 + XboxOneEnhancedXboxCompatibilityMode: 0 + XboxOneEnableGPUVariability: 1 + XboxOneSockets: {} + XboxOneSplashScreen: {fileID: 0} + XboxOneAllowedProductIds: [] + XboxOnePersistentLocalStorageSize: 0 + XboxOneXTitleMemory: 8 + XboxOneOverrideIdentityName: + XboxOneOverrideIdentityPublisher: + vrEditorSettings: {} + cloudServicesEnabled: + UNet: 1 + luminIcon: + m_Name: + m_ModelFolderPath: + m_PortalFolderPath: + luminCert: + m_CertPath: + m_SignPackage: 1 + luminIsChannelApp: 0 + luminVersion: + m_VersionCode: 1 + m_VersionName: + hmiPlayerDataPath: + hmiForceSRGBBlit: 1 + embeddedLinuxEnableGamepadInput: 1 + hmiLogStartupTiming: 0 + hmiCpuConfiguration: + apiCompatibilityLevel: 6 + activeInputHandler: 0 + windowsGamepadBackendHint: 0 + cloudProjectId: + framebufferDepthMemorylessMode: 0 + qualitySettingsNames: [] + projectName: + organizationId: + cloudEnabled: 0 + legacyClampBlendShapeWeights: 0 + hmiLoadingImage: {fileID: 0} + platformRequiresReadableAssets: 0 + virtualTexturingSupportEnabled: 0 + insecureHttpOption: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt new file mode 100644 index 0000000..587f809 --- /dev/null +++ b/ProjectSettings/ProjectVersion.txt @@ -0,0 +1,2 @@ +m_EditorVersion: 2022.3.62f3 +m_EditorVersionWithRevision: 2022.3.62f3 (96770f904ca7) diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset new file mode 100644 index 0000000..36c0dad --- /dev/null +++ b/ProjectSettings/QualitySettings.asset @@ -0,0 +1,234 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!47 &1 +QualitySettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_CurrentQuality: 5 + m_QualitySettings: + - serializedVersion: 2 + name: Very Low + pixelLightCount: 0 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 15 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + blendWeights: 1 + textureQuality: 1 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 0 + lodBias: 0.3 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 4 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Low + pixelLightCount: 0 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 20 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + blendWeights: 2 + textureQuality: 0 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 0 + lodBias: 0.4 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 16 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Medium + pixelLightCount: 1 + shadows: 1 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 20 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + blendWeights: 2 + textureQuality: 0 + anisotropicTextures: 1 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 1 + lodBias: 0.7 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 64 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: High + pixelLightCount: 2 + shadows: 2 + shadowResolution: 1 + shadowProjection: 1 + shadowCascades: 2 + shadowDistance: 40 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + blendWeights: 2 + textureQuality: 0 + anisotropicTextures: 1 + antiAliasing: 0 + softParticles: 0 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 256 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Very High + pixelLightCount: 3 + shadows: 2 + shadowResolution: 2 + shadowProjection: 1 + shadowCascades: 2 + shadowDistance: 70 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + blendWeights: 4 + textureQuality: 0 + anisotropicTextures: 2 + antiAliasing: 2 + softParticles: 1 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1.5 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 1024 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Ultra + pixelLightCount: 4 + shadows: 2 + shadowResolution: 2 + shadowProjection: 1 + shadowCascades: 4 + shadowDistance: 150 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + blendWeights: 4 + textureQuality: 0 + anisotropicTextures: 2 + antiAliasing: 2 + softParticles: 1 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 2 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 4096 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + excludedTargetPlatforms: [] + m_PerPlatformDefaultQuality: + Android: 2 + Lumin: 5 + GameCoreScarlett: 5 + GameCoreXboxOne: 5 + Nintendo 3DS: 5 + Nintendo Switch: 5 + PS4: 5 + PS5: 5 + Stadia: 5 + Standalone: 5 + WebGL: 3 + Windows Store Apps: 5 + XboxOne: 5 + iPhone: 2 + tvOS: 2 diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset new file mode 100644 index 0000000..1c92a78 --- /dev/null +++ b/ProjectSettings/TagManager.asset @@ -0,0 +1,43 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!78 &1 +TagManager: + serializedVersion: 2 + tags: [] + layers: + - Default + - TransparentFX + - Ignore Raycast + - + - Water + - UI + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + m_SortingLayers: + - name: Default + uniqueID: 0 + locked: 0 diff --git a/ProjectSettings/TimeManager.asset b/ProjectSettings/TimeManager.asset new file mode 100644 index 0000000..558a017 --- /dev/null +++ b/ProjectSettings/TimeManager.asset @@ -0,0 +1,9 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!5 &1 +TimeManager: + m_ObjectHideFlags: 0 + Fixed Timestep: 0.02 + Maximum Allowed Timestep: 0.33333334 + m_TimeScale: 1 + Maximum Particle Timestep: 0.03 diff --git a/ProjectSettings/UnityConnectSettings.asset b/ProjectSettings/UnityConnectSettings.asset new file mode 100644 index 0000000..a88bee0 --- /dev/null +++ b/ProjectSettings/UnityConnectSettings.asset @@ -0,0 +1,36 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!310 &1 +UnityConnectSettings: + m_ObjectHideFlags: 0 + serializedVersion: 1 + m_Enabled: 0 + m_TestMode: 0 + m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events + m_EventUrl: https://cdp.cloud.unity3d.com/v1/events + m_ConfigUrl: https://config.uca.cloud.unity3d.com + m_DashboardUrl: https://dashboard.unity3d.com + m_TestInitMode: 0 + CrashReportingSettings: + m_EventUrl: https://perf-events.cloud.unity3d.com + m_Enabled: 0 + m_LogBufferSize: 10 + m_CaptureEditorExceptions: 1 + UnityPurchasingSettings: + m_Enabled: 0 + m_TestMode: 0 + UnityAnalyticsSettings: + m_Enabled: 0 + m_TestMode: 0 + m_InitializeOnStartup: 1 + m_PackageRequiringCoreStatsPresent: 0 + UnityAdsSettings: + m_Enabled: 0 + m_InitializeOnStartup: 1 + m_TestMode: 0 + m_IosGameId: + m_AndroidGameId: + m_GameIds: {} + m_GameId: + PerformanceReportingSettings: + m_Enabled: 0 diff --git a/ProjectSettings/VFXManager.asset b/ProjectSettings/VFXManager.asset new file mode 100644 index 0000000..3a95c98 --- /dev/null +++ b/ProjectSettings/VFXManager.asset @@ -0,0 +1,12 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!937362698 &1 +VFXManager: + m_ObjectHideFlags: 0 + m_IndirectShader: {fileID: 0} + m_CopyBufferShader: {fileID: 0} + m_SortShader: {fileID: 0} + m_StripUpdateShader: {fileID: 0} + m_RenderPipeSettingsPath: + m_FixedTimeStep: 0.016666668 + m_MaxDeltaTime: 0.05 diff --git a/ProjectSettings/VersionControlSettings.asset b/ProjectSettings/VersionControlSettings.asset new file mode 100644 index 0000000..dca2881 --- /dev/null +++ b/ProjectSettings/VersionControlSettings.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!890905787 &1 +VersionControlSettings: + m_ObjectHideFlags: 0 + m_Mode: Visible Meta Files + m_CollabEditorSettings: + inProgressEnabled: 1 diff --git a/ProjectSettings/XRSettings.asset b/ProjectSettings/XRSettings.asset new file mode 100644 index 0000000..482590c --- /dev/null +++ b/ProjectSettings/XRSettings.asset @@ -0,0 +1,10 @@ +{ + "m_SettingKeys": [ + "VR Device Disabled", + "VR Device User Alert" + ], + "m_SettingValues": [ + "False", + "False" + ] +} \ No newline at end of file