Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b9f9ee741 | |||
| 31fac7a2b3 | |||
| 4f33446770 | |||
| 6866b7fca9 | |||
| 9f5151c54c |
8
sdk-intergration/Assets/MaxSdk/Mediation/ByteDance.meta
Normal file
8
sdk-intergration/Assets/MaxSdk/Mediation/ByteDance.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fac2ab3b272f487c8ef6515ae7668e1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef8467ffb0e4447b79a8804884a7520a
|
||||
labels:
|
||||
- al_max
|
||||
- al_max_export_path-MaxSdk/Mediation/ByteDance/Editor
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.applovin.mediation:bytedance-adapter:8.1.0.3.0">
|
||||
<repositories>
|
||||
<repository>https://artifact.bytedance.com/repository/pangle</repository>
|
||||
</repositories>
|
||||
</androidPackage>
|
||||
</androidPackages>
|
||||
<iosPods>
|
||||
<iosPod name="AppLovinMediationByteDanceAdapter" version="8.1.0.6.0" />
|
||||
</iosPods>
|
||||
</dependencies>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0828555cb1ce94702a4af6f3dce3d735
|
||||
labels:
|
||||
- al_max
|
||||
- al_max_export_path-MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
sdk-intergration/Assets/MaxSdk/Mediation/Mintegral.meta
Normal file
8
sdk-intergration/Assets/MaxSdk/Mediation/Mintegral.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 324c3a2236ad740799b8b6dc27e85c82
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db1de4066dc4e4290b3879b34fa87de2
|
||||
labels:
|
||||
- al_max
|
||||
- al_max_export_path-MaxSdk/Mediation/Mintegral/Editor
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.applovin.mediation:mintegral-adapter:17.1.61.0">
|
||||
<repositories>
|
||||
<repository>https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea</repository>
|
||||
</repositories>
|
||||
</androidPackage>
|
||||
<androidPackage spec="androidx.recyclerview:recyclerview:1.2.1" />
|
||||
</androidPackages>
|
||||
<iosPods>
|
||||
<iosPod name="AppLovinMediationMintegralAdapter" version="8.1.4.0.0" />
|
||||
</iosPods>
|
||||
</dependencies>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 221b2a20a58a04f2cb4afb0779587206
|
||||
labels:
|
||||
- al_max
|
||||
- al_max_export_path-MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
sdk-intergration/Assets/MaxSdk/Mediation/Moloco.meta
Normal file
8
sdk-intergration/Assets/MaxSdk/Mediation/Moloco.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6796c876aa794d13affab798ea46f1c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
sdk-intergration/Assets/MaxSdk/Mediation/Moloco/Editor.meta
Normal file
11
sdk-intergration/Assets/MaxSdk/Mediation/Moloco/Editor.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ecadc3649c184389b90252aa2a2b448
|
||||
labels:
|
||||
- al_max
|
||||
- al_max_export_path-MaxSdk/Mediation/Moloco/Editor
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.applovin.mediation:moloco-adapter:4.9.0.0" />
|
||||
</androidPackages>
|
||||
<iosPods>
|
||||
<iosPod name="AppLovinMediationMolocoAdapter" version="4.6.1.1" />
|
||||
</iosPods>
|
||||
</dependencies>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f5b2cb1209274ba18b234b42d2efe96
|
||||
labels:
|
||||
- al_max
|
||||
- al_max_export_path-MaxSdk/Mediation/Moloco/Editor/Dependencies.xml
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
sdk-intergration/Assets/MaxSdk/Mediation/Yandex.meta
Normal file
8
sdk-intergration/Assets/MaxSdk/Mediation/Yandex.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b1126795647541ba8c2eb166b7b70bc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
sdk-intergration/Assets/MaxSdk/Mediation/Yandex/Editor.meta
Normal file
11
sdk-intergration/Assets/MaxSdk/Mediation/Yandex/Editor.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 277e2383262e844708fc74a6104f4985
|
||||
labels:
|
||||
- al_max
|
||||
- al_max_export_path-MaxSdk/Mediation/Yandex/Editor
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.applovin.mediation:yandex-adapter:8.1.0.0" />
|
||||
</androidPackages>
|
||||
<iosPods>
|
||||
<iosPod name="AppLovinMediationYandexAdapter" version="8.1.0.1" />
|
||||
</iosPods>
|
||||
</dependencies>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a77aaf886990c4e6ba469a4f083b9284
|
||||
labels:
|
||||
- al_max
|
||||
- al_max_export_path-MaxSdk/Mediation/Yandex/Editor/Dependencies.xml
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,23 +7,94 @@ import com.tuyoo.gamesdk.api.SDKAPI;
|
||||
import com.tuyoo.gamesdk.api.SDKAPIConstant;
|
||||
import com.tuyoo.gamesdk.api.SDKCallBack;
|
||||
import com.tuyoo.gamesdk.api.SDKWrapper;
|
||||
import com.tuyoo.gamesdk.login.model.SnsInfo;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class SnsTest {
|
||||
static final String TAG = "SNSTEST";
|
||||
static final String GOName = "SDKTest";
|
||||
|
||||
public static void Bind(String type, String guserId)
|
||||
static SnsInfo tmpSnsInfo = null;
|
||||
|
||||
public static void Bind(String type, String userId)
|
||||
{
|
||||
SDKAPI.getIns().getSnsInfo(type, (snscode, snsInfo, snsmsg) ->{
|
||||
if(snscode == SDKCallBack.CODE_SUCCESS && snsInfo !=null)
|
||||
if(snscode == SDKCallBack.CODE_SUCCESS && snsInfo != null)
|
||||
{
|
||||
SDKAPI.getIns().bindBySnsId(snsInfo, guserId, (bindcode, bindmsg)->{
|
||||
SDKAPI.getIns().bindBySnsId(snsInfo, userId, (bindcode, bindmsg)->{
|
||||
if(bindcode == SDKCallBack.CODE_SUCCESS)
|
||||
{
|
||||
Log.i(TAG, "LinkSns success");
|
||||
try {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", bindcode);
|
||||
result.put("userId", userId);
|
||||
|
||||
JSONObject serverResponse = new JSONObject(bindmsg);
|
||||
JSONObject userInfo = serverResponse.getJSONObject("result");
|
||||
result.put("loginData", userInfo);
|
||||
UnityPlayer.UnitySendMessage(GOName, "BindCallback", result.toString());
|
||||
|
||||
} catch (JSONException e) {
|
||||
String msg = "{\"code\":1, \"userId\": 0}";
|
||||
UnityPlayer.UnitySendMessage(GOName, "BindCallback", msg);
|
||||
}
|
||||
}
|
||||
else if(bindcode == SDKCallBack.CODE_FAILED)
|
||||
{
|
||||
try
|
||||
{
|
||||
JSONObject bindMsgObj = new JSONObject(bindmsg);
|
||||
JSONObject bindMsgResult = bindMsgObj.getJSONObject("result");
|
||||
int bindMsgResultCode = bindMsgResult.getInt("code");
|
||||
if(bindMsgResultCode == 4)
|
||||
{
|
||||
SDKAPI.getIns().checkSnsInfo(snsInfo, (checkcode, checkMsg ) -> {
|
||||
if(checkcode != SDKCallBack.CODE_SUCCESS)
|
||||
{
|
||||
Log.w(TAG, checkMsg);
|
||||
String msg = "{\"code\":1, \"userId\": 0}";
|
||||
UnityPlayer.UnitySendMessage(GOName, "BindCallback", msg);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
tmpSnsInfo = snsInfo;
|
||||
JSONObject checkMsgObj = new JSONObject(checkMsg);
|
||||
JSONObject checkResult = checkMsgObj.getJSONObject("result");
|
||||
String bindInfo = checkResult.getString("bindInfo");
|
||||
int bindUserId = checkResult.getInt("userId");
|
||||
JSONObject callbackMsg = new JSONObject();
|
||||
callbackMsg.put("code", -1);
|
||||
callbackMsg.put("userId", bindUserId);
|
||||
callbackMsg.put("bindInfo", bindInfo);
|
||||
UnityPlayer.UnitySendMessage(GOName, "BindCallback", callbackMsg.toString());
|
||||
} catch (JSONException e) {
|
||||
Log.i(TAG, e.toString());
|
||||
String msg = "{\"code\":1, \"userId\": 0}";
|
||||
UnityPlayer.UnitySendMessage(GOName, "BindCallback", msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.i(TAG, String.format("LinkSns failed, code: %d, msg: %s", bindcode, bindmsg));
|
||||
Log.w(TAG, bindmsg);
|
||||
String msg = "{\"code\":1, \"userId\": 0}";
|
||||
UnityPlayer.UnitySendMessage(GOName, "BindCallback", msg);
|
||||
}
|
||||
}
|
||||
catch (JSONException e)
|
||||
{
|
||||
Log.i(TAG, e.toString());
|
||||
String msg = "{\"code\":1, \"userId\": 0}";
|
||||
UnityPlayer.UnitySendMessage(GOName, "BindCallback", msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.w(TAG, bindmsg);
|
||||
String msg = "{\"code\":1, \"userId\": 0}";
|
||||
UnityPlayer.UnitySendMessage(GOName, "BindCallback", msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -34,8 +105,32 @@ public class SnsTest {
|
||||
});
|
||||
}
|
||||
|
||||
public static void Unbind(String type, int userId)
|
||||
public static void ChangeBind(int unbindUserId, int bindUserId)
|
||||
{
|
||||
if(tmpSnsInfo == null)
|
||||
{
|
||||
Log.i(TAG, "tmpSnsInfo is null");
|
||||
return ;
|
||||
}
|
||||
|
||||
SDKAPI.getIns().unbindBySnsId(tmpSnsInfo, String.valueOf(unbindUserId), (unbindCode, unbindMsg) -> {
|
||||
Log.i(TAG, "unbindBySnsId code: " + unbindCode + " msg: " + unbindMsg);
|
||||
if(unbindCode == SDKCallBack.CODE_SUCCESS)
|
||||
{
|
||||
SDKAPI.getIns().bindBySnsId(tmpSnsInfo, String.valueOf(bindUserId), (bindCode, bindMsg) -> {
|
||||
Log.i(TAG, "bindBySnsId code: " + bindCode + " msg: " + bindMsg);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void RmSns()
|
||||
{
|
||||
tmpSnsInfo = null;
|
||||
}
|
||||
|
||||
public static void GetSns(String accountType)
|
||||
{
|
||||
Log.i(TAG, "GetSns accountType: " + accountType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,13 +60,18 @@ dependencies {
|
||||
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
||||
|
||||
// Android Resolver Dependencies Start
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1' // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:9
|
||||
implementation 'com.android.installreferrer:installreferrer:2.1' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:7
|
||||
implementation 'com.applovin.mediation:bytedance-adapter:8.1.0.3.0' // Assets/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml:8
|
||||
implementation 'com.applovin.mediation:facebook-adapter:[6.18.0.1]' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:8
|
||||
implementation 'com.applovin.mediation:fyber-adapter:8.4.2.0' // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:4
|
||||
implementation 'com.applovin.mediation:google-adapter:[23.6.0.1]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5
|
||||
implementation 'com.applovin.mediation:ironsource-adapter:8.6.1.0.0' // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
|
||||
implementation 'com.applovin.mediation:mintegral-adapter:17.1.61.0' // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:8
|
||||
implementation 'com.applovin.mediation:moloco-adapter:4.9.0.0' // Assets/MaxSdk/Mediation/Moloco/Editor/Dependencies.xml:4
|
||||
implementation 'com.applovin.mediation:unityads-adapter:4.12.3.0' // Assets/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml:4
|
||||
implementation 'com.applovin.mediation:vungle-adapter:7.4.2.2' // Assets/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml:4
|
||||
implementation 'com.applovin.mediation:yandex-adapter:8.1.0.0' // Assets/MaxSdk/Mediation/Yandex/Editor/Dependencies.xml:4
|
||||
implementation 'com.applovin:applovin-sdk:13.5.1' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:4
|
||||
implementation 'com.appsflyer:af-android-sdk:6.17.3' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:5
|
||||
implementation 'com.appsflyer:purchase-connector:2.2.0' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:8
|
||||
|
||||
@@ -18,9 +18,15 @@ dependencyResolutionManagement {
|
||||
mavenCentral()
|
||||
// Android Resolver Repos Start
|
||||
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
||||
maven {
|
||||
url "https://artifact.bytedance.com/repository/pangle" // Assets/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml:8
|
||||
}
|
||||
maven {
|
||||
url "https://android-sdk.is.com/" // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
|
||||
}
|
||||
maven {
|
||||
url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:8
|
||||
}
|
||||
mavenLocal()
|
||||
// Android Resolver Repos End
|
||||
flatDir {
|
||||
|
||||
4566
sdk-intergration/Assets/Scenes/AdTest.unity
Normal file
4566
sdk-intergration/Assets/Scenes/AdTest.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
sdk-intergration/Assets/Scenes/AdTest.unity.meta
Normal file
7
sdk-intergration/Assets/Scenes/AdTest.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 813d4ac98b7f4092a3dddb472539f9d2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -513,6 +513,127 @@ MonoBehaviour:
|
||||
m_MipBias: 0
|
||||
m_VarianceClampScale: 0.9
|
||||
m_ContrastAdaptiveSharpening: 0
|
||||
--- !u!1 &385330068
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 385330072}
|
||||
- component: {fileID: 385330071}
|
||||
- component: {fileID: 385330070}
|
||||
- component: {fileID: 385330069}
|
||||
m_Layer: 5
|
||||
m_Name: changebind
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &385330069
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 385330068}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 385330070}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &385330070
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 385330068}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &385330071
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 385330068}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!224 &385330072
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 385330068}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 465819806}
|
||||
m_Father: {fileID: 1044920373}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 1}
|
||||
--- !u!1 &393321311
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -549,6 +670,85 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: -20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &465819805
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 465819806}
|
||||
- component: {fileID: 465819808}
|
||||
- component: {fileID: 465819807}
|
||||
m_Layer: 5
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &465819806
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 465819805}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 385330072}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &465819807
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 465819805}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 33
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 0
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: CBind
|
||||
--- !u!222 &465819808
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 465819805}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &471181945
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -670,7 +870,7 @@ GameObject:
|
||||
- component: {fileID: 514656874}
|
||||
- component: {fileID: 514656873}
|
||||
m_Layer: 5
|
||||
m_Name: Check sns
|
||||
m_Name: rm sns
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -1315,6 +1515,127 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 757589085}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &839565401
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 839565402}
|
||||
- component: {fileID: 839565405}
|
||||
- component: {fileID: 839565404}
|
||||
- component: {fileID: 839565403}
|
||||
m_Layer: 5
|
||||
m_Name: LoginBySns
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &839565402
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 839565401}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1387388941}
|
||||
m_Father: {fileID: 1044920373}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 1}
|
||||
--- !u!114 &839565403
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 839565401}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 839565404}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &839565404
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 839565401}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &839565405
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 839565401}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &845062987
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1506,7 +1827,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: CSNS
|
||||
m_Text: RM SNS
|
||||
--- !u!222 &875109649
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1706,11 +2027,13 @@ RectTransform:
|
||||
- {fileID: 1956900235}
|
||||
- {fileID: 1299164145}
|
||||
- {fileID: 1472314934}
|
||||
- {fileID: 839565402}
|
||||
- {fileID: 1274822429}
|
||||
- {fileID: 1095319726}
|
||||
- {fileID: 514656872}
|
||||
- {fileID: 599093755}
|
||||
- {fileID: 730871748}
|
||||
- {fileID: 385330072}
|
||||
m_Father: {fileID: 1451597222}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@@ -2276,6 +2599,87 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1299164144}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1387388940
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1387388941}
|
||||
- component: {fileID: 1387388943}
|
||||
- component: {fileID: 1387388942}
|
||||
m_Layer: 5
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1387388941
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1387388940}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 839565402}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1387388942
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1387388940}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 33
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 0
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: 'loginSNS
|
||||
|
||||
'
|
||||
--- !u!222 &1387388943
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1387388940}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1422461756
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2871,9 +3275,10 @@ MonoBehaviour:
|
||||
loginBtn: {fileID: 1472314935}
|
||||
logoutBtn: {fileID: 1274822430}
|
||||
getSnsBtn: {fileID: 1095319727}
|
||||
checkSnsBtn: {fileID: 514656873}
|
||||
rmSnsBtn: {fileID: 514656873}
|
||||
loginBySns: {fileID: 839565403}
|
||||
bindBtn: {fileID: 599093756}
|
||||
unbindBtn: {fileID: 730871749}
|
||||
changeBindBtn: {fileID: 385330069}
|
||||
--- !u!1 &1905578657
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
8
sdk-intergration/Assets/Scripts/AdTesting.meta
Normal file
8
sdk-intergration/Assets/Scripts/AdTesting.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9176f7473eb140f4af98b026642a0c8c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
public static class AdReadyStateLog
|
||||
{
|
||||
public static string FormatReadyCheck(string format, string adUnitId, bool isReady)
|
||||
{
|
||||
string status = isReady ? "OK" : "WARNING";
|
||||
return $"[{format}] Loaded callback ready check: adUnitId={adUnitId}, IsReady={isReady}, {status}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6db64ebff4c74a8e987935dcdf9fd211
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
423
sdk-intergration/Assets/Scripts/AdTesting/AdTest.cs
Normal file
423
sdk-intergration/Assets/Scripts/AdTesting/AdTest.cs
Normal file
@@ -0,0 +1,423 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class AdTest : MonoBehaviour
|
||||
{
|
||||
[Header("Rewarded")]
|
||||
[SerializeField] private string androidRewardedAdUnitId = "c6c49a100de8496c";
|
||||
[SerializeField] private string iosRewardedAdUnitId = "ec3c8fd688cdb5e2";
|
||||
|
||||
[Header("Interstitial")]
|
||||
[SerializeField] private string androidInterstitialAdUnitId = "0dcd37fa0885aa1f";
|
||||
[SerializeField] private string iosInterstitialAdUnitId = "interstitial_test_ios";
|
||||
|
||||
[Header("UI")]
|
||||
[SerializeField] private Button initMaxButton;
|
||||
[SerializeField] private Button loadRewardedButton;
|
||||
[SerializeField] private Button showRewardedButton;
|
||||
[SerializeField] private Button forceShowRewardedButton;
|
||||
[SerializeField] private Button checkRewardedReadyButton;
|
||||
[SerializeField] private Button loadInterstitialButton;
|
||||
[SerializeField] private Button showInterstitialButton;
|
||||
[SerializeField] private Button forceShowInterstitialButton;
|
||||
[SerializeField] private Button checkInterstitialReadyButton;
|
||||
[SerializeField] private Button mediationDebuggerButton;
|
||||
[SerializeField] private Button clearLogButton;
|
||||
[SerializeField] private Text logText;
|
||||
|
||||
private const int MaxLogLines = 80;
|
||||
private readonly List<string> logLines = new List<string>();
|
||||
private bool callbacksRegistered;
|
||||
private bool sdkInitializeRequested;
|
||||
private int rewardedLoadFailCount;
|
||||
private int interstitialLoadFailCount;
|
||||
|
||||
private string RewardedAdUnitId
|
||||
{
|
||||
get
|
||||
{
|
||||
#if UNITY_IOS
|
||||
return iosRewardedAdUnitId;
|
||||
#else
|
||||
return androidRewardedAdUnitId;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private string InterstitialAdUnitId
|
||||
{
|
||||
get
|
||||
{
|
||||
#if UNITY_IOS
|
||||
return iosInterstitialAdUnitId;
|
||||
#else
|
||||
return androidInterstitialAdUnitId;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public void Configure(
|
||||
Button initMax,
|
||||
Button loadRewarded,
|
||||
Button showRewarded,
|
||||
Button forceShowRewarded,
|
||||
Button checkRewardedReady,
|
||||
Button loadInterstitial,
|
||||
Button showInterstitial,
|
||||
Button forceShowInterstitial,
|
||||
Button checkInterstitialReady,
|
||||
Button mediationDebugger,
|
||||
Button clearLog,
|
||||
Text output)
|
||||
{
|
||||
initMaxButton = initMax;
|
||||
loadRewardedButton = loadRewarded;
|
||||
showRewardedButton = showRewarded;
|
||||
forceShowRewardedButton = forceShowRewarded;
|
||||
checkRewardedReadyButton = checkRewardedReady;
|
||||
loadInterstitialButton = loadInterstitial;
|
||||
showInterstitialButton = showInterstitial;
|
||||
forceShowInterstitialButton = forceShowInterstitial;
|
||||
checkInterstitialReadyButton = checkInterstitialReady;
|
||||
mediationDebuggerButton = mediationDebugger;
|
||||
clearLogButton = clearLog;
|
||||
logText = output;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Bind(initMaxButton, InitMax);
|
||||
Bind(loadRewardedButton, LoadRewarded);
|
||||
Bind(showRewardedButton, ShowRewarded);
|
||||
Bind(forceShowRewardedButton, ForceShowRewarded);
|
||||
Bind(checkRewardedReadyButton, CheckRewardedReady);
|
||||
Bind(loadInterstitialButton, LoadInterstitial);
|
||||
Bind(showInterstitialButton, ShowInterstitial);
|
||||
Bind(forceShowInterstitialButton, ForceShowInterstitial);
|
||||
Bind(checkInterstitialReadyButton, CheckInterstitialReady);
|
||||
Bind(mediationDebuggerButton, ShowMediationDebugger);
|
||||
Bind(clearLogButton, ClearLog);
|
||||
AppendLog("AdTest ready.");
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (!callbacksRegistered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MaxSdkCallbacks.OnSdkInitializedEvent -= OnSdkInitialized;
|
||||
|
||||
MaxSdkCallbacks.Rewarded.OnAdLoadedEvent -= OnRewardedAdLoaded;
|
||||
MaxSdkCallbacks.Rewarded.OnAdLoadFailedEvent -= OnRewardedAdLoadFailed;
|
||||
MaxSdkCallbacks.Rewarded.OnAdDisplayedEvent -= OnRewardedAdDisplayed;
|
||||
MaxSdkCallbacks.Rewarded.OnAdDisplayFailedEvent -= OnRewardedAdDisplayFailed;
|
||||
MaxSdkCallbacks.Rewarded.OnAdHiddenEvent -= OnRewardedAdHidden;
|
||||
MaxSdkCallbacks.Rewarded.OnAdReceivedRewardEvent -= OnRewardedAdReceivedReward;
|
||||
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent -= OnRewardedAdRevenuePaid;
|
||||
|
||||
MaxSdkCallbacks.Interstitial.OnAdLoadedEvent -= OnInterstitialAdLoaded;
|
||||
MaxSdkCallbacks.Interstitial.OnAdLoadFailedEvent -= OnInterstitialAdLoadFailed;
|
||||
MaxSdkCallbacks.Interstitial.OnAdDisplayedEvent -= OnInterstitialAdDisplayed;
|
||||
MaxSdkCallbacks.Interstitial.OnAdDisplayFailedEvent -= OnInterstitialAdDisplayFailed;
|
||||
MaxSdkCallbacks.Interstitial.OnAdHiddenEvent -= OnInterstitialAdHidden;
|
||||
MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent -= OnInterstitialAdRevenuePaid;
|
||||
}
|
||||
|
||||
private void Bind(Button button, Action action)
|
||||
{
|
||||
if (button == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
button.onClick.AddListener(() => action());
|
||||
}
|
||||
|
||||
public void InitMax()
|
||||
{
|
||||
RegisterCallbacks();
|
||||
|
||||
if (sdkInitializeRequested)
|
||||
{
|
||||
AppendLog("MAX initialization already requested.");
|
||||
return;
|
||||
}
|
||||
|
||||
sdkInitializeRequested = true;
|
||||
MaxSdk.SetHasUserConsent(true);
|
||||
MaxSdk.SetDoNotSell(false);
|
||||
#if UNITY_IOS
|
||||
MaxSdk.SetExtraParameter("disable_b2b_ad_unit_ids", "ec3c8fd688cdb5e2,00442f7962682a80");
|
||||
#else
|
||||
MaxSdk.SetExtraParameter("disable_b2b_ad_unit_ids", "c6c49a100de8496c,0dcd37fa0885aa1f");
|
||||
#endif
|
||||
MaxSdk.InitializeSdk();
|
||||
AppendLog("MAX initialization requested.");
|
||||
}
|
||||
|
||||
public void LoadRewarded()
|
||||
{
|
||||
EnsureInitialized();
|
||||
AppendLog($"Load rewarded: {RewardedAdUnitId}");
|
||||
MaxSdk.LoadRewardedAd(RewardedAdUnitId);
|
||||
}
|
||||
|
||||
public void ShowRewarded()
|
||||
{
|
||||
EnsureInitialized();
|
||||
bool isReady = MaxSdk.IsRewardedAdReady(RewardedAdUnitId);
|
||||
AppendLog($"Show rewarded requested. IsReady={isReady}");
|
||||
|
||||
if (isReady)
|
||||
{
|
||||
MaxSdk.ShowRewardedAd(RewardedAdUnitId);
|
||||
return;
|
||||
}
|
||||
|
||||
LoadRewarded();
|
||||
}
|
||||
|
||||
public void ForceShowRewarded()
|
||||
{
|
||||
EnsureInitialized();
|
||||
AppendLog($"Force show rewarded without ready check: {RewardedAdUnitId}");
|
||||
MaxSdk.ShowRewardedAd(RewardedAdUnitId);
|
||||
}
|
||||
|
||||
public void CheckRewardedReady()
|
||||
{
|
||||
EnsureInitialized();
|
||||
bool isReady = MaxSdk.IsRewardedAdReady(RewardedAdUnitId);
|
||||
AppendReadyCheck("Rewarded", RewardedAdUnitId, isReady);
|
||||
}
|
||||
|
||||
public void LoadInterstitial()
|
||||
{
|
||||
EnsureInitialized();
|
||||
if (string.IsNullOrEmpty(InterstitialAdUnitId))
|
||||
{
|
||||
AppendWarning("Interstitial ad unit ID is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
AppendLog($"Load interstitial: {InterstitialAdUnitId}");
|
||||
MaxSdk.LoadInterstitial(InterstitialAdUnitId);
|
||||
}
|
||||
|
||||
public void ShowInterstitial()
|
||||
{
|
||||
EnsureInitialized();
|
||||
if (string.IsNullOrEmpty(InterstitialAdUnitId))
|
||||
{
|
||||
AppendWarning("Interstitial ad unit ID is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
bool isReady = MaxSdk.IsInterstitialReady(InterstitialAdUnitId);
|
||||
AppendLog($"Show interstitial requested. IsReady={isReady}");
|
||||
|
||||
if (isReady)
|
||||
{
|
||||
MaxSdk.ShowInterstitial(InterstitialAdUnitId);
|
||||
return;
|
||||
}
|
||||
|
||||
LoadInterstitial();
|
||||
}
|
||||
|
||||
public void ForceShowInterstitial()
|
||||
{
|
||||
EnsureInitialized();
|
||||
if (string.IsNullOrEmpty(InterstitialAdUnitId))
|
||||
{
|
||||
AppendWarning("Interstitial ad unit ID is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
AppendLog($"Force show interstitial without ready check: {InterstitialAdUnitId}");
|
||||
MaxSdk.ShowInterstitial(InterstitialAdUnitId);
|
||||
}
|
||||
|
||||
public void CheckInterstitialReady()
|
||||
{
|
||||
EnsureInitialized();
|
||||
if (string.IsNullOrEmpty(InterstitialAdUnitId))
|
||||
{
|
||||
AppendWarning("Interstitial ad unit ID is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
bool isReady = MaxSdk.IsInterstitialReady(InterstitialAdUnitId);
|
||||
AppendReadyCheck("Interstitial", InterstitialAdUnitId, isReady);
|
||||
}
|
||||
|
||||
public void ClearLog()
|
||||
{
|
||||
logLines.Clear();
|
||||
if (logText != null)
|
||||
{
|
||||
logText.text = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowMediationDebugger()
|
||||
{
|
||||
AppendLog("Show mediation debugger requested.");
|
||||
MaxSdk.ShowMediationDebugger();
|
||||
}
|
||||
|
||||
private void EnsureInitialized()
|
||||
{
|
||||
if (!sdkInitializeRequested)
|
||||
{
|
||||
InitMax();
|
||||
}
|
||||
}
|
||||
|
||||
private void RegisterCallbacks()
|
||||
{
|
||||
if (callbacksRegistered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
callbacksRegistered = true;
|
||||
MaxSdkCallbacks.OnSdkInitializedEvent += OnSdkInitialized;
|
||||
|
||||
MaxSdkCallbacks.Rewarded.OnAdLoadedEvent += OnRewardedAdLoaded;
|
||||
MaxSdkCallbacks.Rewarded.OnAdLoadFailedEvent += OnRewardedAdLoadFailed;
|
||||
MaxSdkCallbacks.Rewarded.OnAdDisplayedEvent += OnRewardedAdDisplayed;
|
||||
MaxSdkCallbacks.Rewarded.OnAdDisplayFailedEvent += OnRewardedAdDisplayFailed;
|
||||
MaxSdkCallbacks.Rewarded.OnAdHiddenEvent += OnRewardedAdHidden;
|
||||
MaxSdkCallbacks.Rewarded.OnAdReceivedRewardEvent += OnRewardedAdReceivedReward;
|
||||
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent += OnRewardedAdRevenuePaid;
|
||||
|
||||
MaxSdkCallbacks.Interstitial.OnAdLoadedEvent += OnInterstitialAdLoaded;
|
||||
MaxSdkCallbacks.Interstitial.OnAdLoadFailedEvent += OnInterstitialAdLoadFailed;
|
||||
MaxSdkCallbacks.Interstitial.OnAdDisplayedEvent += OnInterstitialAdDisplayed;
|
||||
MaxSdkCallbacks.Interstitial.OnAdDisplayFailedEvent += OnInterstitialAdDisplayFailed;
|
||||
MaxSdkCallbacks.Interstitial.OnAdHiddenEvent += OnInterstitialAdHidden;
|
||||
MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent += OnInterstitialAdRevenuePaid;
|
||||
}
|
||||
|
||||
private void OnSdkInitialized(MaxSdkBase.SdkConfiguration configuration)
|
||||
{
|
||||
AppendLog($"MAX initialized. Success={configuration.IsSuccessfullyInitialized}");
|
||||
}
|
||||
|
||||
private void OnRewardedAdLoaded(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
rewardedLoadFailCount = 0;
|
||||
AppendLog($"Rewarded loaded callback: {adUnitId}");
|
||||
bool isReady = MaxSdk.IsRewardedAdReady(adUnitId);
|
||||
AppendReadyCheck("Rewarded", adUnitId, isReady);
|
||||
}
|
||||
|
||||
private void OnRewardedAdLoadFailed(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||
{
|
||||
rewardedLoadFailCount++;
|
||||
AppendWarning($"Rewarded load failed: {adUnitId}, attempt={rewardedLoadFailCount}, message={errorInfo.Message}");
|
||||
}
|
||||
|
||||
private void OnRewardedAdDisplayed(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
AppendLog($"Rewarded displayed: {adUnitId}");
|
||||
}
|
||||
|
||||
private void OnRewardedAdDisplayFailed(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
AppendWarning($"Rewarded display failed: {adUnitId}, message={errorInfo.Message}");
|
||||
LoadRewarded();
|
||||
}
|
||||
|
||||
private void OnRewardedAdHidden(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
AppendLog($"Rewarded hidden: {adUnitId}");
|
||||
LoadRewarded();
|
||||
}
|
||||
|
||||
private void OnRewardedAdReceivedReward(string adUnitId, MaxSdkBase.Reward reward, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
AppendLog($"Rewarded received reward: {adUnitId}, label={reward.Label}, amount={reward.Amount}");
|
||||
}
|
||||
|
||||
private void OnRewardedAdRevenuePaid(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
AppendLog($"Rewarded revenue paid: {adUnitId}, revenue={adInfo.Revenue}");
|
||||
}
|
||||
|
||||
private void OnInterstitialAdLoaded(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
interstitialLoadFailCount = 0;
|
||||
AppendLog($"Interstitial loaded callback: {adUnitId}");
|
||||
bool isReady = MaxSdk.IsInterstitialReady(adUnitId);
|
||||
AppendReadyCheck("Interstitial", adUnitId, isReady);
|
||||
}
|
||||
|
||||
private void OnInterstitialAdLoadFailed(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||
{
|
||||
interstitialLoadFailCount++;
|
||||
AppendWarning($"Interstitial load failed: {adUnitId}, attempt={interstitialLoadFailCount}, message={errorInfo.Message}");
|
||||
}
|
||||
|
||||
private void OnInterstitialAdDisplayed(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
AppendLog($"Interstitial displayed: {adUnitId}");
|
||||
}
|
||||
|
||||
private void OnInterstitialAdDisplayFailed(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
AppendWarning($"Interstitial display failed: {adUnitId}, message={errorInfo.Message}");
|
||||
LoadInterstitial();
|
||||
}
|
||||
|
||||
private void OnInterstitialAdHidden(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
AppendLog($"Interstitial hidden: {adUnitId}");
|
||||
LoadInterstitial();
|
||||
}
|
||||
|
||||
private void OnInterstitialAdRevenuePaid(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||
{
|
||||
AppendLog($"Interstitial revenue paid: {adUnitId}, revenue={adInfo.Revenue}");
|
||||
}
|
||||
|
||||
private void AppendReadyCheck(string format, string adUnitId, bool isReady)
|
||||
{
|
||||
string line = AdReadyStateLog.FormatReadyCheck(format, adUnitId, isReady);
|
||||
if (isReady)
|
||||
{
|
||||
AppendLog(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
AppendWarning(line);
|
||||
}
|
||||
}
|
||||
|
||||
private void AppendWarning(string message)
|
||||
{
|
||||
AppendLog(message, true);
|
||||
}
|
||||
|
||||
private void AppendLog(string message, bool warning = false)
|
||||
{
|
||||
string line = $"[{DateTime.Now:HH:mm:ss}] {message}";
|
||||
logLines.Add(line);
|
||||
while (logLines.Count > MaxLogLines)
|
||||
{
|
||||
logLines.RemoveAt(0);
|
||||
}
|
||||
|
||||
if (logText != null)
|
||||
{
|
||||
logText.text = string.Join("\n", logLines);
|
||||
}
|
||||
|
||||
// This scene is for device-side manual QA, so the UI log is the source of truth.
|
||||
}
|
||||
}
|
||||
11
sdk-intergration/Assets/Scripts/AdTesting/AdTest.cs.meta
Normal file
11
sdk-intergration/Assets/Scripts/AdTesting/AdTest.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70a4079f02f94f47a9a065de6d76f8f2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,98 @@
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class AdTestSceneBootstrap : MonoBehaviour
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
EnsureEventSystem();
|
||||
|
||||
AdTest adTest = GetComponent<AdTest>();
|
||||
if (adTest == null)
|
||||
{
|
||||
adTest = gameObject.AddComponent<AdTest>();
|
||||
}
|
||||
|
||||
adTest.Configure(
|
||||
FindButton("InitMax", "Init"),
|
||||
FindButton("LoadRewardedAd", "LoadRewarded", "Load Rewarded", "RewardedLoad"),
|
||||
FindButton("RewardedAd", "Max", "ShowRewarded", "Show Rewarded", "RewardedShow"),
|
||||
FindButton("ForceRewardedAd", "ForceRewarded", "Force Rewarded"),
|
||||
FindButton("CheckRewardedReady", "CheckRewarded", "Check Rewarded", "RewardedReady"),
|
||||
FindButton("LoadInterstitialAd", "LoadInterstitial", "Load Interstitial", "InterstitialLoad", "PayList"),
|
||||
FindButton("ShowInterstitialAd", "ShowInterstitial", "Show Interstitial", "InterstitialShow", "Pay"),
|
||||
FindButton("ForceInterstitialAd", "ForceInterstitial", "Force Interstitial"),
|
||||
FindButton("CheckInterstitialReady", "CheckInterstitial", "Check Interstitial", "InterstitialReady"),
|
||||
FindButton("MediationDebugger", "ATT", "Debugger", "Mediation Debugger"),
|
||||
FindButton("ClearLog", "Clear Log"),
|
||||
FindText("Message", "Log", "LogText"));
|
||||
|
||||
RenameButton("InitMax", "Init MAX");
|
||||
RenameButton("LoadRewardedAd", "Load Reward");
|
||||
RenameButton("CheckRewardedReady", "Check Reward");
|
||||
RenameButton("RewardedAd", "Rewarded");
|
||||
RenameButton("ForceRewardedAd", "Force Reward");
|
||||
RenameButton("LoadInterstitialAd", "Load Inter");
|
||||
RenameButton("CheckInterstitialReady", "Check Inter");
|
||||
RenameButton("ShowInterstitialAd", "Show Inter");
|
||||
RenameButton("ForceInterstitialAd", "Force Inter");
|
||||
RenameButton("MediationDebugger", "Debugger");
|
||||
RenameButton("ClearLog", "Clear Log");
|
||||
}
|
||||
|
||||
private void EnsureEventSystem()
|
||||
{
|
||||
if (FindObjectOfType<EventSystem>() != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject eventSystem = new GameObject("EventSystem");
|
||||
eventSystem.AddComponent<EventSystem>();
|
||||
eventSystem.AddComponent<StandaloneInputModule>();
|
||||
}
|
||||
|
||||
private Button FindButton(params string[] names)
|
||||
{
|
||||
foreach (string name in names)
|
||||
{
|
||||
GameObject target = GameObject.Find(name);
|
||||
if (target != null && target.TryGetComponent(out Button button))
|
||||
{
|
||||
return button;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Text FindText(params string[] names)
|
||||
{
|
||||
foreach (string name in names)
|
||||
{
|
||||
GameObject target = GameObject.Find(name);
|
||||
if (target != null && target.TryGetComponent(out Text text))
|
||||
{
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void RenameButton(string buttonName, string label)
|
||||
{
|
||||
GameObject target = GameObject.Find(buttonName);
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Text text = target.GetComponentInChildren<Text>();
|
||||
if (text != null)
|
||||
{
|
||||
text.text = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f4c0e3f6b3d4d6b9b8a923dc1274d31
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -136,6 +136,11 @@ public class SDKTest : MonoBehaviour
|
||||
};
|
||||
MaxSdk.SetHasUserConsent(true);
|
||||
MaxSdk.SetDoNotSell(false);
|
||||
#if UNITY_IOS
|
||||
MaxSdk.SetExtraParameter("disable_b2b_ad_unit_ids", "ec3c8fd688cdb5e2,00442f7962682a80");
|
||||
#else
|
||||
MaxSdk.SetExtraParameter("disable_b2b_ad_unit_ids", "c6c49a100de8496c,0dcd37fa0885aa1f");
|
||||
#endif
|
||||
MaxSdk.InitializeSdk();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using tysdk;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -28,13 +29,17 @@ public class UnbindTest : MonoBehaviour
|
||||
private Button getSnsBtn;
|
||||
|
||||
[SerializeField]
|
||||
private Button checkSnsBtn;
|
||||
private Button rmSnsBtn;
|
||||
|
||||
|
||||
[SerializeField]
|
||||
private Button loginBySns;
|
||||
|
||||
[SerializeField]
|
||||
private Button bindBtn;
|
||||
|
||||
[SerializeField]
|
||||
private Button unbindBtn;
|
||||
private Button changeBindBtn;
|
||||
|
||||
private EAccoutType accoutType;
|
||||
|
||||
@@ -56,9 +61,10 @@ public class UnbindTest : MonoBehaviour
|
||||
}); loginBtn.onClick.AddListener(OnLogin);
|
||||
logoutBtn.onClick.AddListener(OnLogout);
|
||||
getSnsBtn.onClick.AddListener(OnGetSns);
|
||||
checkSnsBtn.onClick.AddListener(OnCheckSns);
|
||||
rmSnsBtn.onClick.AddListener(OnRmSns);
|
||||
loginBySns.onClick.AddListener(OnLoginBySns);
|
||||
bindBtn.onClick.AddListener(OnBind);
|
||||
unbindBtn.onClick.AddListener(OnUnbind);
|
||||
changeBindBtn.onClick.AddListener(OnChangeBind);
|
||||
Debug.Log("========== Init =============");
|
||||
TYSdkFacade.Instance.Init();
|
||||
Debug.Log($"AccoutType {accoutType}");
|
||||
@@ -96,7 +102,14 @@ public class UnbindTest : MonoBehaviour
|
||||
t.CallStatic("GetSns", accoutType.ToString());
|
||||
}
|
||||
|
||||
private async void OnCheckSns()
|
||||
private void OnRmSns()
|
||||
{
|
||||
Debug.Log("========== Get SNS =============");
|
||||
using var t = new AndroidJavaClass(Cls);
|
||||
t.CallStatic("RmSns") ;
|
||||
}
|
||||
|
||||
private async void OnLoginBySns()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -115,6 +128,7 @@ public class UnbindTest : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private int buserId;
|
||||
private async void OnBind()
|
||||
{
|
||||
try
|
||||
@@ -126,6 +140,7 @@ public class UnbindTest : MonoBehaviour
|
||||
{
|
||||
var info = await PlayFabTool.GetPFPlayerInfoBySDKId(linkResult.userId, "6DC6D");
|
||||
Debug.Log(info?.ToString() ?? "[UnbindTest::OnBind] info is null");
|
||||
buserId = linkResult.userId;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -134,21 +149,17 @@ public class UnbindTest : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void BindCallback(string message)
|
||||
private async void OnChangeBind()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
Debug.Log("========== Change Bind =============");
|
||||
var result = await TYSdkFacade.Instance.ChangeLinkAccount(accoutType, buserId, loginInfo.userId);
|
||||
Debug.Log($"Change Bind Result Code:{result.code}, UserId:{result.userId}, msg:{result.msg}");
|
||||
}
|
||||
|
||||
private void OnUnbind()
|
||||
catch (Exception e)
|
||||
{
|
||||
using (var t = new AndroidJavaClass(Cls))
|
||||
{
|
||||
t.CallStatic("Unbind");
|
||||
Debug.LogException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void UnbindCallback(string message)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ public class ConfigManager {
|
||||
public static final String UNITY_FACADE_NAME = "TYSdkFacade";
|
||||
public static final String LOGIN_CALLBACK_FUNCTION_NAME = "LoginResult";
|
||||
public static final String LINKACCOUT_CALLBACK_FUNCTION_NAME = "LinkAccoutResult";
|
||||
public static final String CHANGELINK_CALLBACK_FUNCTION_NAME = "ChangeLinkAccountResult";
|
||||
public static final String CHECKLINK_CALLBACK_FUNCTION_NAME = "CheckLinkResult";
|
||||
public static final String PAY_CALLBACK_FUNCTION_NAME = "PayResult";
|
||||
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "SKUListResult";
|
||||
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
|
||||
public static final String FCM_REALNAME_CALLBACK_FUNCTION_NAME = "RealNameCallback";
|
||||
|
||||
}
|
||||
|
||||
@@ -266,6 +266,41 @@ public class SDKManager {
|
||||
tmpSnsInfo = null;
|
||||
}
|
||||
|
||||
public static void ChangeLinkAccount(String type, int oldUserId, int newUserId)
|
||||
{
|
||||
if(tmpSnsInfo == null)
|
||||
{
|
||||
String msg = "{\"code\":1, \"userId\": 0, \"msg\": \"tmpSnsInfo is null\"}";
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
SDKAPI.getIns().unbindBySnsId(tmpSnsInfo, String.valueOf(oldUserId), (unbindCode, unbindMsg) -> {
|
||||
Log.i(TAG, "unbindBySnsId code: " + unbindCode + " msg: " + unbindMsg);
|
||||
if(unbindCode == SDKCallBack.CODE_SUCCESS)
|
||||
{
|
||||
SDKAPI.getIns().bindBySnsId(tmpSnsInfo, String.valueOf(newUserId), (bindCode, bindMsg) -> {
|
||||
Log.i(TAG, "bindBySnsId code: " + bindCode + " msg: " + bindMsg);
|
||||
if(bindCode == SDKCallBack.CODE_SUCCESS)
|
||||
{
|
||||
String msg = "{\"code\":0, \"userId\": " + newUserId + ", \"msg\": \"success\"}";
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
String msg = String.format("{\"code\":-1, \"userId\": 0, \"msg\": \"%s\"}", bindMsg);
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
String msg = String.format("{\"code\":1, \"userId\": 0, \"msg\": \"%s\"}", unbindMsg);
|
||||
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME, ConfigManager.CHANGELINK_CALLBACK_FUNCTION_NAME, msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void LinkCheck(String type)
|
||||
{
|
||||
SDKAPI.getIns().getSnsInfo(type, (code, snsInfo, msg) -> {
|
||||
|
||||
@@ -147,6 +147,20 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
NSInteger LoginTypeToBindType(NSInteger loginType)
|
||||
{
|
||||
switch (loginType) {
|
||||
case XYLoginWithApple:
|
||||
return XYBindApple;
|
||||
case XYLoginWithFB:
|
||||
return XYBindFB;
|
||||
case XYLoginWithGoogle:
|
||||
return XYBindGoodle;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
const char* UnityLoginBySnsInfo()
|
||||
{
|
||||
NSLog(@"TYSdkInterface UnityLoginBySnsInfo");
|
||||
@@ -387,10 +401,6 @@ extern "C" {
|
||||
}];
|
||||
}
|
||||
|
||||
void UnlinkGoogle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LinkFacebook(const int userId)
|
||||
{
|
||||
@@ -412,10 +422,6 @@ extern "C" {
|
||||
}];
|
||||
}
|
||||
|
||||
void UnlinkFacebook()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LinkApple(const int userId)
|
||||
{
|
||||
@@ -437,11 +443,60 @@ extern "C" {
|
||||
}];
|
||||
}
|
||||
|
||||
void UnlinkApple()
|
||||
void ChangeLinkAccount(const int accoutType, const int oldUserId, const int newUserId)
|
||||
{
|
||||
NSLog(@"TYSdkInterface ChangeLinkAccount accoutType:%d oldUserId:%d newUserId:%d", accoutType, oldUserId, newUserId);
|
||||
|
||||
if (g_snsLoginType == -1)
|
||||
{
|
||||
UnitySendMessage("TYSdkFacade", "ChangeLinkAccountResult",
|
||||
"{\"code\":1, \"userId\": 0, \"msg\": \"g_snsLoginType is invalid\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
NSInteger bindTypeValue = LoginTypeToBindType(g_snsLoginType);
|
||||
if (bindTypeValue == -1)
|
||||
{
|
||||
UnitySendMessage("TYSdkFacade", "ChangeLinkAccountResult",
|
||||
"{\"code\":1, \"userId\": 0, \"msg\": \"unsupported account type\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
XYBindType bindType = (XYBindType)bindTypeValue;
|
||||
|
||||
XYBindReq *unbindReq = [XYBindReq initUnBindWithPlatform:bindType UserId:(NSUInteger)oldUserId];
|
||||
[XYApi XYUnBindByBindReq:unbindReq completionHandler:^(XYResp * _Nonnull unbindResp) {
|
||||
NSLog(@"TYSdkInterface ChangeLinkAccount unbind code:%ld msg:%@", (long)unbindResp.errCode, unbindResp.errStr);
|
||||
|
||||
if (unbindResp.errCode == XYSuccess)
|
||||
{
|
||||
XYBindReq *bindReq = [XYBindReq initBindWithPlatform:bindType UserId:(NSUInteger)newUserId];
|
||||
[XYApi XYBindByBindReq:bindReq isUnbindGuest:@"false" completionHandler:^(XYResp * _Nonnull bindResp) {
|
||||
NSLog(@"TYSdkInterface ChangeLinkAccount bind code:%ld msg:%@", (long)bindResp.errCode, bindResp.errStr);
|
||||
|
||||
if (bindResp.errCode == XYSuccess)
|
||||
{
|
||||
NSString *msg = [NSString stringWithFormat:@"{\"code\":0, \"userId\": %d, \"msg\": \"success\"}", newUserId];
|
||||
UnitySendMessage("TYSdkFacade", "ChangeLinkAccountResult", AllocCString(msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *errStr = bindResp.errStr ? bindResp.errStr : @"bind failed";
|
||||
NSString *msg = [NSString stringWithFormat:@"{\"code\":-1, \"userId\": 0, \"msg\": \"%@\"}", errStr];
|
||||
UnitySendMessage("TYSdkFacade", "ChangeLinkAccountResult", AllocCString(msg));
|
||||
}
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *errStr = unbindResp.errStr ? unbindResp.errStr : @"unbind failed";
|
||||
NSString *msg = [NSString stringWithFormat:@"{\"code\":1, \"userId\": 0, \"msg\": \"%@\"}", errStr];
|
||||
UnitySendMessage("TYSdkFacade", "ChangeLinkAccountResult", AllocCString(msg));
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
void FBShareLink(const char* title, const char* content, const char* url)
|
||||
{
|
||||
NSLog(@"TYSdkInterface FBShareLink");
|
||||
|
||||
@@ -71,6 +71,49 @@ namespace tysdk
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置已注册 callback 的超时时间:取消先前安排的延时 <see cref="CancellationTokenSource.Cancel"/>,
|
||||
/// 并从<strong>当前时刻</strong>起在 <paramref name="newTimeout"/> 后触发取消(与构造时传入的延时等价,见 <see cref="CancellationTokenSource.CancelAfter(System.TimeSpan)"/>)。
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Callback 数据类型</typeparam>
|
||||
/// <param name="newTimeout">新的超时时间;若需立即按超时处理可使用 <see cref="TimeSpan.Zero"/></param>
|
||||
/// <returns>找到未完成 pending 并成功重置则为 true</returns>
|
||||
public bool ResetCallbackTimeout<T>(TimeSpan newTimeout) where T : class
|
||||
{
|
||||
if (_disposed)
|
||||
throw new ObjectDisposedException(nameof(TYSDKCallbackManager));
|
||||
|
||||
var callbackId = typeof(T).Name;
|
||||
|
||||
if (!_callbacks.TryGetValue(callbackId, out var entry))
|
||||
{
|
||||
UnityEngine.Debug.LogWarning($"[TYSDKCallbackManager] No pending callback found for type: {callbackId}");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entry.Task.IsCompleted)
|
||||
{
|
||||
UnityEngine.Debug.LogWarning($"[TYSDKCallbackManager] Callback {callbackId} already completed, cannot reset timeout");
|
||||
return false;
|
||||
}
|
||||
|
||||
var cts = entry.CancellationTokenSource;
|
||||
if (cts == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
cts.CancelAfter(newTimeout);
|
||||
UnityEngine.Debug.Log($"[TYSDKCallbackManager] Reset timeout for {callbackId} to {newTimeout.TotalSeconds}s");
|
||||
return true;
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
UnityEngine.Debug.LogWarning($"[TYSDKCallbackManager] CancellationTokenSource already disposed for {callbackId}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发callback
|
||||
/// </summary>
|
||||
|
||||
@@ -364,6 +364,43 @@ namespace tysdk
|
||||
UnityBridgeFunc.CleanLinkTmpSnsInfo();
|
||||
}
|
||||
|
||||
public async Task<ChangeLinkResult> ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
||||
{
|
||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<ChangeLinkResult>(TimeSpan.FromSeconds(30));
|
||||
UnityBridgeFunc.ChangeLinkAccount(accoutType, oldUserId, newUserId);
|
||||
try
|
||||
{
|
||||
var result = await task;
|
||||
if (result.code == 0)
|
||||
{
|
||||
_accountInfo.AddLinkedAccount(accoutType);
|
||||
_accountInfo.Save();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogWarning($"[TYSdkFacade] Change link account failed: {e}");
|
||||
return new ChangeLinkResult() { code = 1 };
|
||||
}
|
||||
finally
|
||||
{
|
||||
CleanLinkTempSnSInfo();
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeLinkAccountResult(string message)
|
||||
{
|
||||
JObject data = JObject.Parse(message);
|
||||
var result = new ChangeLinkResult()
|
||||
{
|
||||
code = (int)data["code"],
|
||||
userId = (int)data["userId"],
|
||||
msg = (string)data["msg"]
|
||||
};
|
||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查是否已经绑定
|
||||
/// <returns>
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace tysdk
|
||||
|___/
|
||||
=================================================*/
|
||||
|
||||
private bool _payFirstNegativeHandled;
|
||||
|
||||
//public async Task<PaymentInfo> Pay(string prodId, string prodPrice, string prodName, int count, string pType, string price_amount_micros =null)
|
||||
public async Task<PaymentInfo> Pay(SKUDetail prod, int count, float usdprice, JObject purchaseInfo)
|
||||
{
|
||||
@@ -76,6 +78,10 @@ namespace tysdk
|
||||
Debug.LogWarning($"[TYSdkFacade::Pay] Faild {e.Message}");
|
||||
return new PaymentInfo(){code = "-1"};
|
||||
}
|
||||
finally
|
||||
{
|
||||
_payFirstNegativeHandled = false;
|
||||
}
|
||||
|
||||
|
||||
#elif UNITY_IOS
|
||||
@@ -95,6 +101,10 @@ namespace tysdk
|
||||
Debug.LogWarning($"[TYSdkFacade::Pay] Faild {e.Message}");
|
||||
return new PaymentInfo(){code = "-1"};
|
||||
}
|
||||
finally
|
||||
{
|
||||
_payFirstNegativeHandled = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -107,8 +117,17 @@ namespace tysdk
|
||||
result.code = jresult["code"].ToString();
|
||||
result.msg = jresult["errStr"].ToString();
|
||||
if(result.code == "-1")
|
||||
{
|
||||
if (!_payFirstNegativeHandled)
|
||||
{
|
||||
_payFirstNegativeHandled = true;
|
||||
TYSDKCallbackManager.Instance.ResetCallbackTimeout<PaymentInfo>(TimeSpan.FromSeconds(5));
|
||||
Debug.Log("[TYSdkFacade] pay failed (first time): reset timeout to 5s, waiting next pay callback");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[TYSdkFacade] pay failed: waiting next pay callback");
|
||||
}
|
||||
return;
|
||||
}
|
||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
||||
|
||||
@@ -34,6 +34,13 @@ namespace tysdk
|
||||
public Dictionary<string, string> bindInfo;
|
||||
}
|
||||
|
||||
public class ChangeLinkResult
|
||||
{
|
||||
public int code;
|
||||
public int userId;
|
||||
public string msg;
|
||||
}
|
||||
|
||||
public class LinkCheckInfo
|
||||
{
|
||||
public int code;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace tysdk
|
||||
|
||||
|
||||
public static void LinkAccount(EAccoutType accoutType){}
|
||||
public static void UnlinkAccount(EAccoutType accoutType){}
|
||||
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId){}
|
||||
public static void LinkCheck(EAccoutType accoutType){}
|
||||
|
||||
public static void UnityGetIdentityFun(string type){}
|
||||
@@ -149,11 +149,11 @@ namespace tysdk
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnlinkAccount(EAccoutType accoutType)
|
||||
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
||||
{
|
||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||
{
|
||||
sdkManager.CallStatic("UnlinkAccount", accoutType.ToString());
|
||||
sdkManager.CallStatic("ChangeLinkAccount", accoutType.ToString(), oldUserId, newUserId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,16 +298,16 @@ namespace tysdk
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoginByGuest();
|
||||
private static extern void UnityLoginByGuest();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoginByGoogle();
|
||||
private static extern void UnityLoginByGoogle();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoginByFacebook();
|
||||
private static extern void UnityLoginByFacebook();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityLoginByApple();
|
||||
private static extern void UnityLoginByApple();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void UnityGetIdentityFun(string type);
|
||||
@@ -364,25 +364,13 @@ namespace tysdk
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnlinkAccount(EAccoutType accoutType)
|
||||
{
|
||||
switch (accoutType)
|
||||
{
|
||||
case EAccoutType.hwGoogle:
|
||||
UnlinkGoogle();
|
||||
break;
|
||||
case EAccoutType.hwFacebook:
|
||||
UnlinkFacebook();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")] private static extern void LinkGoogle(int userId);
|
||||
[DllImport("__Internal")] private static extern void UnlinkGoogle();
|
||||
[DllImport("__Internal")] private static extern void LinkFacebook(int userId);
|
||||
[DllImport("__Internal")] private static extern void UnlinkFacebook();
|
||||
[DllImport("__Internal")] private static extern void LinkApple(int userId);
|
||||
[DllImport("__Internal")] private static extern void UnlinkApple();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId);
|
||||
|
||||
public static void LinkCheck(EAccoutType accoutType)
|
||||
{
|
||||
@@ -401,6 +389,7 @@ namespace tysdk
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[DllImport("__Internal")] public static extern void CleanLinkTmpSnsInfo();
|
||||
|
||||
[DllImport("__Internal")] private static extern void IsLinkedGoogle();
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
<dependencies>
|
||||
<packages>
|
||||
<package>androidx.recyclerview:recyclerview:1.2.1</package>
|
||||
<package>com.android.installreferrer:installreferrer:2.1</package>
|
||||
<package>com.applovin.mediation:bytedance-adapter:8.1.0.3.0</package>
|
||||
<package>com.applovin.mediation:facebook-adapter:[6.18.0.1]</package>
|
||||
<package>com.applovin.mediation:fyber-adapter:8.4.2.0</package>
|
||||
<package>com.applovin.mediation:google-adapter:[23.6.0.1]</package>
|
||||
<package>com.applovin.mediation:ironsource-adapter:8.6.1.0.0</package>
|
||||
<package>com.applovin.mediation:mintegral-adapter:17.1.61.0</package>
|
||||
<package>com.applovin.mediation:moloco-adapter:4.9.0.0</package>
|
||||
<package>com.applovin.mediation:unityads-adapter:4.12.3.0</package>
|
||||
<package>com.applovin.mediation:vungle-adapter:7.4.2.2</package>
|
||||
<package>com.applovin.mediation:yandex-adapter:8.1.0.0</package>
|
||||
<package>com.applovin:applovin-sdk:13.5.1</package>
|
||||
<package>com.appsflyer:af-android-sdk:6.17.3</package>
|
||||
<package>com.appsflyer:purchase-connector:2.2.0</package>
|
||||
|
||||
@@ -4,11 +4,5 @@
|
||||
EditorBuildSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/SampleScene.unity
|
||||
guid: 99c9720ab356a0642a771bea13969a05
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/UnbindTest.unity
|
||||
guid: e55d807d563854943a26ad6dadec548d
|
||||
m_Scenes: []
|
||||
m_configObjects: {}
|
||||
|
||||
Reference in New Issue
Block a user