You've already forked Commercialization.topon
release: 1.4.9
This commit is contained in:
@@ -1,166 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build.Reporting;
|
||||
using UnityEngine;
|
||||
|
||||
public static class IAAAdAndroidBuild
|
||||
{
|
||||
private const string OutputDirectory = "Build/Android";
|
||||
private const string OutputApkPath = OutputDirectory + "/IAAAdDebugSample-starveg.apk";
|
||||
private const string KeystorePath = "Build/Android/keys/starveg-test.keystore";
|
||||
private const string KeystorePassword = "Foldcc123!";
|
||||
private const string KeyAliasName = "starvegtest";
|
||||
private const string PackageName = "com.foldcc.starveg";
|
||||
|
||||
[MenuItem("Topon/Build IAA Android Test APK")]
|
||||
public static void BuildAndroidTestApk()
|
||||
{
|
||||
EnsureBuildFolders();
|
||||
ConfigurePlayerSettings();
|
||||
var resolverState = CaptureResolverState();
|
||||
|
||||
try
|
||||
{
|
||||
ApplyBatchFriendlyResolverSettings();
|
||||
|
||||
var scenes = new[] { "Assets/Samples/IAAAdDebugSample/Scenes/IAAAdDebugSample.unity" };
|
||||
var options = new BuildPlayerOptions
|
||||
{
|
||||
scenes = scenes,
|
||||
target = BuildTarget.Android,
|
||||
locationPathName = OutputApkPath,
|
||||
options = BuildOptions.None
|
||||
};
|
||||
|
||||
var report = BuildPipeline.BuildPlayer(options);
|
||||
if (report.summary.result != BuildResult.Succeeded)
|
||||
{
|
||||
throw new Exception(
|
||||
$"Android APK build failed: {report.summary.result} ({report.summary.totalErrors} errors)");
|
||||
}
|
||||
|
||||
Debug.Log($"[IAA Build] APK generated: {Path.GetFullPath(OutputApkPath)}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
RestoreResolverState(resolverState);
|
||||
}
|
||||
}
|
||||
|
||||
public static void BuildAndroidTestApkInBatchMode()
|
||||
{
|
||||
BuildAndroidTestApk();
|
||||
EditorApplication.Exit(0);
|
||||
}
|
||||
|
||||
private static void ConfigurePlayerSettings()
|
||||
{
|
||||
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, PackageName);
|
||||
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
|
||||
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64;
|
||||
PlayerSettings.Android.useCustomKeystore = true;
|
||||
PlayerSettings.Android.keystoreName = Path.GetFullPath(KeystorePath);
|
||||
PlayerSettings.Android.keystorePass = KeystorePassword;
|
||||
PlayerSettings.Android.keyaliasName = KeyAliasName;
|
||||
PlayerSettings.Android.keyaliasPass = KeystorePassword;
|
||||
PlayerSettings.bundleVersion = string.IsNullOrWhiteSpace(PlayerSettings.bundleVersion)
|
||||
? "1.0.0"
|
||||
: PlayerSettings.bundleVersion;
|
||||
PlayerSettings.Android.bundleVersionCode = Mathf.Max(1, PlayerSettings.Android.bundleVersionCode);
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
private static void EnsureBuildFolders()
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetFullPath(OutputDirectory));
|
||||
Directory.CreateDirectory(Path.GetFullPath(Path.GetDirectoryName(KeystorePath) ?? OutputDirectory));
|
||||
}
|
||||
|
||||
private static ResolverState CaptureResolverState()
|
||||
{
|
||||
var settingsType = GetResolverSettingsType();
|
||||
return new ResolverState
|
||||
{
|
||||
EnableAutoResolution = GetResolverBool(settingsType, "EnableAutoResolution"),
|
||||
AutoResolveOnBuild = GetResolverBool(settingsType, "AutoResolveOnBuild"),
|
||||
PromptBeforeAutoResolution = GetResolverBool(settingsType, "PromptBeforeAutoResolution")
|
||||
};
|
||||
}
|
||||
|
||||
private static void ApplyBatchFriendlyResolverSettings()
|
||||
{
|
||||
var settingsType = GetResolverSettingsType();
|
||||
SetResolverBool(settingsType, "EnableAutoResolution", false);
|
||||
SetResolverBool(settingsType, "AutoResolveOnBuild", false);
|
||||
SetResolverBool(settingsType, "PromptBeforeAutoResolution", false);
|
||||
}
|
||||
|
||||
private static void RestoreResolverState(ResolverState state)
|
||||
{
|
||||
var settingsType = GetResolverSettingsType();
|
||||
SetResolverBool(settingsType, "EnableAutoResolution", state.EnableAutoResolution);
|
||||
SetResolverBool(settingsType, "AutoResolveOnBuild", state.AutoResolveOnBuild);
|
||||
SetResolverBool(settingsType, "PromptBeforeAutoResolution", state.PromptBeforeAutoResolution);
|
||||
}
|
||||
|
||||
private static Type GetResolverSettingsType()
|
||||
{
|
||||
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
var type = assembly.GetType("GooglePlayServices.SettingsDialog");
|
||||
if (type != null)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool GetResolverBool(Type settingsType, string propertyName)
|
||||
{
|
||||
if (settingsType == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var property = settingsType.GetProperty(
|
||||
propertyName,
|
||||
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if (property == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool)property.GetValue(null, null);
|
||||
}
|
||||
|
||||
private static void SetResolverBool(Type settingsType, string propertyName, bool value)
|
||||
{
|
||||
if (settingsType == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var property = settingsType.GetProperty(
|
||||
propertyName,
|
||||
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if (property == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
property.SetValue(null, value, null);
|
||||
}
|
||||
|
||||
private struct ResolverState
|
||||
{
|
||||
public bool EnableAutoResolution;
|
||||
public bool AutoResolveOnBuild;
|
||||
public bool PromptBeforeAutoResolution;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97e92d5544ec4fc9adf7571f9f4ea241
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,159 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Runtime.ADAggregator;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
public static class IAAAdDebugSampleCreator
|
||||
{
|
||||
private const string SampleRoot = "Assets/Samples/IAAAdDebugSample";
|
||||
private const string SampleSceneDirectory = SampleRoot + "/Scenes";
|
||||
private const string SampleConfigDirectory = SampleRoot + "/Configs";
|
||||
private const string SampleScenePath = SampleSceneDirectory + "/IAAAdDebugSample.unity";
|
||||
private const string SampleConfigPath = SampleConfigDirectory + "/IAAAdDebugSampleConfig.asset";
|
||||
|
||||
[MenuItem("Topon/Create IAA IMGUI Debug Sample")]
|
||||
public static void CreateOrUpdateSample()
|
||||
{
|
||||
EnsureDirectory(SampleRoot);
|
||||
EnsureDirectory(SampleSceneDirectory);
|
||||
EnsureDirectory(SampleConfigDirectory);
|
||||
|
||||
var config = LoadOrCreateConfig();
|
||||
CreateOrUpdateScene(config);
|
||||
AppendSceneToBuildSettings(SampleScenePath);
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
EditorUtility.DisplayDialog(
|
||||
"IAA Sample Created",
|
||||
$"Scene: {SampleScenePath}\nConfig: {SampleConfigPath}",
|
||||
"OK");
|
||||
}
|
||||
|
||||
public static void CreateOrUpdateSampleInBatchMode()
|
||||
{
|
||||
CreateOrUpdateSample();
|
||||
EditorApplication.Exit(0);
|
||||
}
|
||||
|
||||
private static ADConfig LoadOrCreateConfig()
|
||||
{
|
||||
var config = AssetDatabase.LoadAssetAtPath<ADConfig>(SampleConfigPath);
|
||||
if (config == null)
|
||||
{
|
||||
config = ScriptableObject.CreateInstance<ADConfig>();
|
||||
AssetDatabase.CreateAsset(config, SampleConfigPath);
|
||||
}
|
||||
|
||||
config.ConfigName = "IAA Ad Debug Sample";
|
||||
config.Id = string.IsNullOrWhiteSpace(config.Id) ? "fill_taku_app_id" : config.Id;
|
||||
config.Key = string.IsNullOrWhiteSpace(config.Key) ? "fill_taku_app_key" : config.Key;
|
||||
config.Key2 = string.IsNullOrWhiteSpace(config.Key2) ? string.Empty : config.Key2;
|
||||
config.BaseAwardAdKeyValue = config.BaseAwardAdKeyValue ?? new AdKeyValue();
|
||||
config.BaseAwardAdKeyValue.key = "rewarded";
|
||||
config.BaseAwardAdKeyValue.value = string.IsNullOrWhiteSpace(config.BaseAwardAdKeyValue.value)
|
||||
? "fill_rewarded_placement"
|
||||
: config.BaseAwardAdKeyValue.value;
|
||||
|
||||
config.BaseInteractionAdKeyValue = config.BaseInteractionAdKeyValue ?? new AdKeyValue();
|
||||
config.BaseInteractionAdKeyValue.key = "interstitial";
|
||||
config.BaseInteractionAdKeyValue.value = string.IsNullOrWhiteSpace(config.BaseInteractionAdKeyValue.value)
|
||||
? "fill_interstitial_placement"
|
||||
: config.BaseInteractionAdKeyValue.value;
|
||||
|
||||
config.BaseSplashAdKeyValue = config.BaseSplashAdKeyValue ?? new AdKeyValue();
|
||||
config.BaseSplashAdKeyValue.key = "splash";
|
||||
config.BaseSplashAdKeyValue.value = string.IsNullOrWhiteSpace(config.BaseSplashAdKeyValue.value)
|
||||
? "optional_splash_placement"
|
||||
: config.BaseSplashAdKeyValue.value;
|
||||
|
||||
config.CommonKeyValues ??= new List<AdKeyValue>();
|
||||
SetOrAddCommonKey(config, "topon.rewarded_auto_load", "true");
|
||||
SetOrAddCommonKey(config, "topon.rewarded_prewarm_on_init", "true");
|
||||
SetOrAddCommonKey(config, "topon.rewarded_max_load_attempts", "3");
|
||||
SetOrAddCommonKey(config, "topon.rewarded_load_retry_delay_ms", "1000");
|
||||
SetOrAddCommonKey(config, "topon.interstitial_auto_load", "true");
|
||||
SetOrAddCommonKey(config, "topon.interstitial_prewarm_on_init", "true");
|
||||
SetOrAddCommonKey(config, "topon.interstitial_max_load_attempts", "2");
|
||||
SetOrAddCommonKey(config, "topon.interstitial_load_retry_delay_ms", "500");
|
||||
|
||||
EditorUtility.SetDirty(config);
|
||||
return config;
|
||||
}
|
||||
|
||||
private static void CreateOrUpdateScene(ADConfig config)
|
||||
{
|
||||
var scene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single);
|
||||
scene.name = "IAAAdDebugSample";
|
||||
|
||||
var root = new GameObject("IAA Ad Debug Sample");
|
||||
var gui = root.AddComponent<IAAAdDebugSampleGui>();
|
||||
gui.adConfig = config;
|
||||
gui.userId = "debug_user_001";
|
||||
gui.rewardedScenario = "reward_debug";
|
||||
gui.interstitialScenario = "interstitial_debug";
|
||||
gui.autoInitialize = true;
|
||||
gui.forcePortrait = true;
|
||||
gui.captureUnityLogs = true;
|
||||
gui.showVerboseState = true;
|
||||
|
||||
EditorSceneManager.SaveScene(scene, SampleScenePath);
|
||||
}
|
||||
|
||||
private static void AppendSceneToBuildSettings(string scenePath)
|
||||
{
|
||||
var scenes = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes);
|
||||
var exists = false;
|
||||
for (var i = 0; i < scenes.Count; i++)
|
||||
{
|
||||
if (scenes[i].path != scenePath)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
scenes[i] = new EditorBuildSettingsScene(scenePath, true);
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
scenes.Add(new EditorBuildSettingsScene(scenePath, true));
|
||||
}
|
||||
|
||||
EditorBuildSettings.scenes = scenes.ToArray();
|
||||
}
|
||||
|
||||
private static void SetOrAddCommonKey(ADConfig config, string key, string value)
|
||||
{
|
||||
foreach (var item in config.CommonKeyValues)
|
||||
{
|
||||
if (item != null && item.key == key)
|
||||
{
|
||||
item.value = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
config.CommonKeyValues.Add(new AdKeyValue
|
||||
{
|
||||
key = key,
|
||||
value = value
|
||||
});
|
||||
}
|
||||
|
||||
private static void EnsureDirectory(string assetPath)
|
||||
{
|
||||
if (AssetDatabase.IsValidFolder(assetPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(Path.GetFullPath(assetPath));
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c488fb4879e14f5cb366ce084ff2b748
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,78 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public static class IAABatchBuildBootstrap
|
||||
{
|
||||
private const string TaskFilePath = "Temp/iaa-batch-task.txt";
|
||||
private static bool _subscribed;
|
||||
private static bool _taskRunning;
|
||||
|
||||
static IAABatchBuildBootstrap()
|
||||
{
|
||||
if (!Application.isBatchMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_subscribed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_subscribed = true;
|
||||
EditorApplication.update += ExecutePendingTaskWhenReady;
|
||||
}
|
||||
|
||||
private static void ExecutePendingTaskWhenReady()
|
||||
{
|
||||
if (!Application.isBatchMode || _taskRunning)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var fullPath = Path.GetFullPath(TaskFilePath);
|
||||
if (!File.Exists(fullPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (EditorApplication.isCompiling || EditorApplication.isUpdating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_taskRunning = true;
|
||||
EditorApplication.update -= ExecutePendingTaskWhenReady;
|
||||
|
||||
var task = File.ReadAllText(fullPath).Trim();
|
||||
File.Delete(fullPath);
|
||||
|
||||
try
|
||||
{
|
||||
switch (task)
|
||||
{
|
||||
case "create-sample":
|
||||
IAAAdDebugSampleCreator.CreateOrUpdateSample();
|
||||
break;
|
||||
case "build-apk":
|
||||
IAAAdAndroidBuild.BuildAndroidTestApk();
|
||||
break;
|
||||
default:
|
||||
Debug.LogWarning($"[IAA Batch] Unknown task: {task}");
|
||||
break;
|
||||
}
|
||||
|
||||
EditorApplication.Exit(0);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogException(exception);
|
||||
EditorApplication.Exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33e31dbdc20d47a78340d49f58d81ef9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,664 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using AnyThinkAds.Api;
|
||||
using Runtime.ADAggregator;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public sealed class IAAAdDebugSampleGui : MonoBehaviour
|
||||
{
|
||||
private const float ReferenceWidth = 1080f;
|
||||
private const float ReferenceHeight = 2340f;
|
||||
private const int MaxLogEntries = 120;
|
||||
private const float StatusRefreshInterval = 1f;
|
||||
|
||||
public ADConfig adConfig;
|
||||
public string userId = "debug_user_001";
|
||||
public string rewardedScenario = "reward_debug";
|
||||
public string interstitialScenario = "interstitial_debug";
|
||||
public bool autoInitialize = true;
|
||||
public bool forcePortrait = true;
|
||||
public bool captureUnityLogs = true;
|
||||
public bool showVerboseState = true;
|
||||
public bool openDebugUiOnButton = true;
|
||||
public bool autoWriteLogsToFile = true;
|
||||
|
||||
private readonly List<string> _logs = new List<string>(MaxLogEntries);
|
||||
private Vector2 _pageScroll;
|
||||
private Vector2 _logScroll;
|
||||
private Vector2 _rewardedStatusScroll;
|
||||
private Vector2 _interstitialStatusScroll;
|
||||
private bool _initInvoked;
|
||||
private bool _initCallbackReceived;
|
||||
private bool _stylesInitialized;
|
||||
private GUIStyle _titleStyle;
|
||||
private GUIStyle _sectionStyle;
|
||||
private GUIStyle _textStyle;
|
||||
private GUIStyle _buttonStyle;
|
||||
private GUIStyle _textFieldStyle;
|
||||
private GUIStyle _logStyle;
|
||||
private bool _rewardedReadyCache;
|
||||
private bool _interstitialReadyCache;
|
||||
private bool _maskOpen;
|
||||
private string _lastEventLog = "<none>";
|
||||
private string _rewardedStatusCache = "Not refreshed yet.";
|
||||
private string _interstitialStatusCache = "Not refreshed yet.";
|
||||
private float _nextStatusRefreshTime;
|
||||
private string _sessionLogFilePath;
|
||||
private string _sessionLogDirectory;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
Screen.sleepTimeout = SleepTimeout.NeverSleep;
|
||||
if (forcePortrait)
|
||||
{
|
||||
Screen.orientation = ScreenOrientation.Portrait;
|
||||
}
|
||||
|
||||
if (captureUnityLogs)
|
||||
{
|
||||
Application.logMessageReceived += OnLogMessageReceived;
|
||||
}
|
||||
|
||||
ADManager.Instance.GLOBAL_ShowAwardVideoBefore += OnRewardedBefore;
|
||||
ADManager.Instance.GLOBAL_ShowAwardVideoComplete += OnRewardedComplete;
|
||||
InitializeLogFile();
|
||||
AppendLog("IAA Ad Debug Sample is ready.");
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (autoInitialize)
|
||||
{
|
||||
TryInitialize();
|
||||
}
|
||||
|
||||
RefreshStatusCaches(true);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (captureUnityLogs)
|
||||
{
|
||||
Application.logMessageReceived -= OnLogMessageReceived;
|
||||
}
|
||||
|
||||
ADManager.Instance.GLOBAL_ShowAwardVideoBefore -= OnRewardedBefore;
|
||||
ADManager.Instance.GLOBAL_ShowAwardVideoComplete -= OnRewardedComplete;
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
EnsureStyles();
|
||||
|
||||
var safeArea = Screen.safeArea;
|
||||
var scaleX = safeArea.width / ReferenceWidth;
|
||||
var scaleY = safeArea.height / ReferenceHeight;
|
||||
var previousMatrix = GUI.matrix;
|
||||
GUI.matrix = Matrix4x4.TRS(
|
||||
new Vector3(safeArea.x, safeArea.y, 0f),
|
||||
Quaternion.identity,
|
||||
new Vector3(scaleX, scaleY, 1f));
|
||||
|
||||
GUILayout.BeginArea(new Rect(24f, 24f, ReferenceWidth - 48f, ReferenceHeight - 48f), GUI.skin.box);
|
||||
_pageScroll = GUILayout.BeginScrollView(_pageScroll, false, true);
|
||||
DrawHeader();
|
||||
DrawSetupSection();
|
||||
DrawStatusSection();
|
||||
DrawControlSection();
|
||||
DrawLogSection();
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.EndArea();
|
||||
|
||||
GUI.matrix = previousMatrix;
|
||||
}
|
||||
|
||||
private void DrawHeader()
|
||||
{
|
||||
GUILayout.Label("IAA Ad Debug Sample", _titleStyle);
|
||||
GUILayout.Label(
|
||||
$"Screen: {Screen.width} x {Screen.height} | SafeArea: {Screen.safeArea.width:0} x {Screen.safeArea.height:0}",
|
||||
_textStyle);
|
||||
GUILayout.Label(
|
||||
$"Reference Layout: {ReferenceWidth:0} x {ReferenceHeight:0} | Orientation: {Screen.orientation}",
|
||||
_textStyle);
|
||||
GUILayout.Space(10f);
|
||||
}
|
||||
|
||||
private void DrawSetupSection()
|
||||
{
|
||||
GUILayout.Label("Setup", _sectionStyle);
|
||||
GUILayout.Label(
|
||||
$"ADConfig Asset: {(adConfig != null ? adConfig.name : "Missing")} | Init Invoked: {_initInvoked} | Init Callback: {_initCallbackReceived}",
|
||||
_textStyle);
|
||||
|
||||
userId = DrawLabeledTextField("User ID", userId);
|
||||
rewardedScenario = DrawLabeledTextField("Rewarded Scenario", rewardedScenario);
|
||||
interstitialScenario = DrawLabeledTextField("Interstitial Scenario", interstitialScenario);
|
||||
|
||||
var rewardedPlacement = adConfig?.BaseAwardAdKeyValue?.value ?? string.Empty;
|
||||
var interstitialPlacement = adConfig?.BaseInteractionAdKeyValue?.value ?? string.Empty;
|
||||
GUILayout.Label($"Rewarded Placement: {DisplayValue(rewardedPlacement)}", _textStyle);
|
||||
GUILayout.Label($"Interstitial Placement: {DisplayValue(interstitialPlacement)}", _textStyle);
|
||||
GUILayout.Space(6f);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Initialize ADManager", _buttonStyle, GUILayout.Height(78f)))
|
||||
{
|
||||
TryInitialize();
|
||||
}
|
||||
if (GUILayout.Button("Open DebugUI", _buttonStyle, GUILayout.Height(78f)))
|
||||
{
|
||||
if (EnsureInitialized("Open DebugUI"))
|
||||
{
|
||||
OpenDebugUi();
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(10f);
|
||||
}
|
||||
|
||||
private void DrawStatusSection()
|
||||
{
|
||||
GUILayout.Label("Runtime Status", _sectionStyle);
|
||||
|
||||
if (_initInvoked)
|
||||
{
|
||||
RefreshStatusCaches();
|
||||
GUILayout.Label($"Rewarded Ready: {_rewardedReadyCache}", _textStyle);
|
||||
GUILayout.Label($"Interstitial Ready: {_interstitialReadyCache}", _textStyle);
|
||||
GUILayout.Label($"Mask Open: {_maskOpen}", _textStyle);
|
||||
GUILayout.Label($"Last EventLog: {_lastEventLog}", _textStyle);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("Rewarded Ready: not initialized", _textStyle);
|
||||
GUILayout.Label("Interstitial Ready: not initialized", _textStyle);
|
||||
}
|
||||
|
||||
var options = ToponAdController.CurrentOptions;
|
||||
if (options != null)
|
||||
{
|
||||
GUILayout.Label(
|
||||
$"Rewarded Auto/Prewarm/Retry: {options.RewardedAutoLoad}/{options.RewardedPrewarmOnInit}/{options.RewardedMaxLoadAttempts}@{options.RewardedLoadRetryDelayMs}ms",
|
||||
_textStyle);
|
||||
GUILayout.Label(
|
||||
$"Interstitial Auto/Prewarm/Retry: {options.InterstitialAutoLoad}/{options.InterstitialPrewarmOnInit}/{options.InterstitialMaxLoadAttempts}@{options.InterstitialLoadRetryDelayMs}ms",
|
||||
_textStyle);
|
||||
GUILayout.Label(
|
||||
$"Local Strategy Asset: {DisplayValue(options.LocalStrategyAssetPath)}",
|
||||
_textStyle);
|
||||
}
|
||||
|
||||
if (showVerboseState && _initInvoked)
|
||||
{
|
||||
RefreshStatusCaches();
|
||||
GUILayout.Space(6f);
|
||||
if (GUILayout.Button("Refresh Status Snapshot", _buttonStyle, GUILayout.Height(64f)))
|
||||
{
|
||||
RefreshStatusCaches(true);
|
||||
AppendLog("Manual status snapshot refreshed.");
|
||||
}
|
||||
|
||||
GUILayout.Label("Rewarded Status", _sectionStyle);
|
||||
_rewardedStatusScroll = GUILayout.BeginScrollView(_rewardedStatusScroll, GUILayout.Height(240f));
|
||||
GUILayout.Label(_rewardedStatusCache, _logStyle);
|
||||
GUILayout.EndScrollView();
|
||||
|
||||
GUILayout.Label("Interstitial Status", _sectionStyle);
|
||||
_interstitialStatusScroll = GUILayout.BeginScrollView(_interstitialStatusScroll, GUILayout.Height(220f));
|
||||
GUILayout.Label(_interstitialStatusCache, _logStyle);
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
GUILayout.Space(10f);
|
||||
}
|
||||
|
||||
private void DrawControlSection()
|
||||
{
|
||||
GUILayout.Label("Ad Actions", _sectionStyle);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Enter Rewarded Scene", _buttonStyle, GUILayout.Height(84f)))
|
||||
{
|
||||
if (EnsureInitialized("Enter Rewarded Scene"))
|
||||
{
|
||||
ADManager.Instance.EnterAdScenario(AD_Type.AwardVideo, rewardedScenario);
|
||||
AppendLog($"Enter rewarded scene requested. scenario={rewardedScenario}");
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Enter Interstitial Scene", _buttonStyle, GUILayout.Height(84f)))
|
||||
{
|
||||
if (EnsureInitialized("Enter Interstitial Scene"))
|
||||
{
|
||||
ADManager.Instance.EnterAdScenario(AD_Type.Interaction, interstitialScenario);
|
||||
AppendLog($"Enter interstitial scene requested. scenario={interstitialScenario}");
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Load Rewarded", _buttonStyle, GUILayout.Height(84f)))
|
||||
{
|
||||
if (EnsureInitialized("Load Rewarded"))
|
||||
{
|
||||
ADManager.Instance.LoadAD(AD_Type.AwardVideo);
|
||||
AppendLog("Manual rewarded load requested.");
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Async Play Rewarded", _buttonStyle, GUILayout.Height(84f)))
|
||||
{
|
||||
if (EnsureInitialized("Play Rewarded"))
|
||||
{
|
||||
ADManager.Instance.AsyncPlayAD(AD_Type.AwardVideo, rewardedScenario, result =>
|
||||
{
|
||||
AppendLog($"Rewarded callback: {result}");
|
||||
});
|
||||
AppendLog($"AsyncPlayAD rewarded requested. scenario={rewardedScenario}");
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Load Interstitial", _buttonStyle, GUILayout.Height(84f)))
|
||||
{
|
||||
if (EnsureInitialized("Load Interstitial"))
|
||||
{
|
||||
ADManager.Instance.LoadAD(AD_Type.Interaction);
|
||||
AppendLog("Manual interstitial load requested.");
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Async Play Interstitial", _buttonStyle, GUILayout.Height(84f)))
|
||||
{
|
||||
if (EnsureInitialized("Play Interstitial"))
|
||||
{
|
||||
ADManager.Instance.AsyncPlayAD(AD_Type.Interaction, interstitialScenario, result =>
|
||||
{
|
||||
AppendLog($"Interstitial callback: {result}");
|
||||
});
|
||||
AppendLog($"AsyncPlayAD interstitial requested. scenario={interstitialScenario}");
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(10f);
|
||||
}
|
||||
|
||||
private void DrawLogSection()
|
||||
{
|
||||
GUILayout.Label("Diagnostics", _sectionStyle);
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Clear Logs", _buttonStyle, GUILayout.Height(70f)))
|
||||
{
|
||||
_logs.Clear();
|
||||
AppendLog("Logs cleared.");
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Copy All Logs", _buttonStyle, GUILayout.Height(70f)))
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = string.Join("\n", _logs);
|
||||
AppendLog($"Copied {_logs.Count} log lines to clipboard.");
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Log Current Strategy", _buttonStyle, GUILayout.Height(70f)))
|
||||
{
|
||||
var options = ToponAdController.CurrentOptions;
|
||||
if (options == null)
|
||||
{
|
||||
AppendLog("Current strategy unavailable: controller not initialized.");
|
||||
}
|
||||
else
|
||||
{
|
||||
AppendLog(
|
||||
$"Strategy => RewardedAuto={options.RewardedAutoLoad}, RewardedPrewarm={options.RewardedPrewarmOnInit}, InterAuto={options.InterstitialAutoLoad}, InterPrewarm={options.InterstitialPrewarmOnInit}");
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Export Logs To File", _buttonStyle, GUILayout.Height(70f)))
|
||||
{
|
||||
ExportVisibleLogsToFile();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Copy Log File Path", _buttonStyle, GUILayout.Height(70f)))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_sessionLogFilePath))
|
||||
{
|
||||
AppendLog("Log file path unavailable.");
|
||||
}
|
||||
else
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = _sessionLogFilePath;
|
||||
AppendLog($"Copied log file path: {_sessionLogFilePath}");
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Label($"Log File: {DisplayValue(_sessionLogFilePath)}", _textStyle);
|
||||
|
||||
_logScroll = GUILayout.BeginScrollView(_logScroll, GUILayout.Height(520f));
|
||||
foreach (var line in _logs)
|
||||
{
|
||||
GUILayout.Label(line, _logStyle);
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
private string DrawLabeledTextField(string label, string value)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label(label, _textStyle, GUILayout.Width(260f));
|
||||
value = GUILayout.TextField(value ?? string.Empty, _textFieldStyle, GUILayout.Height(64f));
|
||||
GUILayout.EndHorizontal();
|
||||
return value;
|
||||
}
|
||||
|
||||
private bool TryInitialize()
|
||||
{
|
||||
if (_initInvoked)
|
||||
{
|
||||
AppendLog("Initialize skipped: ADManager already initialized by sample.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (adConfig == null)
|
||||
{
|
||||
AppendLog("Initialize failed: sample ADConfig asset is missing.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(adConfig.Id) || string.IsNullOrWhiteSpace(adConfig.Key))
|
||||
{
|
||||
AppendLog("Initialize warning: Taku AppId/AppKey is empty. Please fill the sample ADConfig asset.");
|
||||
}
|
||||
|
||||
_initInvoked = true;
|
||||
var controller = new SampleToponAdController(
|
||||
onMaskChanged: isOpen =>
|
||||
{
|
||||
_maskOpen = isOpen;
|
||||
AppendLog($"Mask changed => open={isOpen}");
|
||||
},
|
||||
onEventLog: (eventTable, eventValue, eventMessage) =>
|
||||
{
|
||||
_lastEventLog = $"{eventTable}:{eventValue}:{eventMessage}";
|
||||
AppendLog($"EventLog => table={eventTable}, value={eventValue}, message={eventMessage}");
|
||||
});
|
||||
ADManager.Instance.Init(() =>
|
||||
{
|
||||
_initCallbackReceived = true;
|
||||
AppendLog("ADManager.Init callback received.");
|
||||
}, userId, adConfig, controller);
|
||||
AppendLog($"ADManager.Init invoked with userId={userId}");
|
||||
AppendLog($"Rewarded placement={adConfig.BaseAwardAdKeyValue?.value}, interstitial placement={adConfig.BaseInteractionAdKeyValue?.value}");
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool EnsureInitialized(string actionName)
|
||||
{
|
||||
if (TryInitialize())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
AppendLog($"{actionName} cancelled: initialization failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
private void RefreshStatusCaches(bool force = false)
|
||||
{
|
||||
if (!force && Time.unscaledTime < _nextStatusRefreshTime)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_nextStatusRefreshTime = Time.unscaledTime + StatusRefreshInterval;
|
||||
_rewardedReadyCache = _initInvoked && ADManager.Instance.IsRealy(AD_Type.AwardVideo);
|
||||
_interstitialReadyCache = _initInvoked && ADManager.Instance.IsRealy(AD_Type.Interaction);
|
||||
_rewardedStatusCache = GetRewardedStatusText();
|
||||
_interstitialStatusCache = GetInterstitialStatusText();
|
||||
}
|
||||
|
||||
private string GetRewardedStatusText()
|
||||
{
|
||||
var placement = adConfig?.BaseAwardAdKeyValue?.value;
|
||||
if (string.IsNullOrWhiteSpace(placement))
|
||||
{
|
||||
return "No rewarded placement configured.";
|
||||
}
|
||||
|
||||
var options = ToponAdController.CurrentOptions;
|
||||
if (options?.RewardedAutoLoad ?? true)
|
||||
{
|
||||
return ATRewardedAutoVideo.Instance.checkAutoAdStatus(placement);
|
||||
}
|
||||
|
||||
return ATRewardedVideo.Instance.checkAdStatus(placement);
|
||||
}
|
||||
|
||||
private string GetInterstitialStatusText()
|
||||
{
|
||||
var placement = adConfig?.BaseInteractionAdKeyValue?.value;
|
||||
if (string.IsNullOrWhiteSpace(placement))
|
||||
{
|
||||
return "No interstitial placement configured.";
|
||||
}
|
||||
|
||||
var options = ToponAdController.CurrentOptions;
|
||||
if (options?.InterstitialAutoLoad ?? true)
|
||||
{
|
||||
return ATInterstitialAutoAd.Instance.checkAutoAdStatus(placement);
|
||||
}
|
||||
|
||||
return ATInterstitialAd.Instance.checkAdStatus(placement);
|
||||
}
|
||||
|
||||
private void OnRewardedBefore(string placementId, string scenario)
|
||||
{
|
||||
AppendLog($"Rewarded before show => placement={placementId}, scenario={scenario}");
|
||||
}
|
||||
|
||||
private void OnRewardedComplete(bool completed)
|
||||
{
|
||||
AppendLog($"Rewarded global complete => reward={completed}");
|
||||
}
|
||||
|
||||
private void OnLogMessageReceived(string condition, string stackTrace, LogType type)
|
||||
{
|
||||
if (type != LogType.Error && type != LogType.Exception && type != LogType.Warning)
|
||||
{
|
||||
if (!condition.Contains("[Topon]") &&
|
||||
!condition.Contains("ATSDK") &&
|
||||
!condition.Contains("Rewarded") &&
|
||||
!condition.Contains("Interstitial") &&
|
||||
!condition.Contains("Taku"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AppendLog($"[{type}] {condition}");
|
||||
}
|
||||
|
||||
private void OpenDebugUi()
|
||||
{
|
||||
var options = ToponAdController.CurrentOptions;
|
||||
if (!openDebugUiOnButton)
|
||||
{
|
||||
AppendLog("DebugUI launch disabled by sample toggle.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (options != null && !string.IsNullOrWhiteSpace(options.DebuggerKey))
|
||||
{
|
||||
ATSDKAPI.showDebuggerUI(options.DebuggerKey);
|
||||
AppendLog($"Open DebugUI with debugger key={options.DebuggerKey}");
|
||||
return;
|
||||
}
|
||||
|
||||
ATSDKAPI.showDebuggerUI();
|
||||
AppendLog("Open DebugUI with current SDK configuration.");
|
||||
}
|
||||
|
||||
private void AppendLog(string message)
|
||||
{
|
||||
var line = $"{DateTime.Now:HH:mm:ss} {message}";
|
||||
if (_logs.Count >= MaxLogEntries)
|
||||
{
|
||||
_logs.RemoveAt(0);
|
||||
}
|
||||
|
||||
_logs.Add(line);
|
||||
TryAppendLineToFile(line);
|
||||
_logScroll.y = float.MaxValue;
|
||||
}
|
||||
|
||||
private void InitializeLogFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
_sessionLogDirectory = Path.Combine(Application.persistentDataPath, "IAAAdDebugLogs");
|
||||
Directory.CreateDirectory(_sessionLogDirectory);
|
||||
var fileName = $"iaa-ad-debug-{DateTime.Now:yyyyMMdd-HHmmss}.log";
|
||||
_sessionLogFilePath = Path.Combine(_sessionLogDirectory, fileName);
|
||||
File.WriteAllText(_sessionLogFilePath,
|
||||
$"IAA Ad Debug Sample Log{Environment.NewLine}" +
|
||||
$"Created: {DateTime.Now:yyyy-MM-dd HH:mm:ss}{Environment.NewLine}" +
|
||||
$"persistentDataPath: {Application.persistentDataPath}{Environment.NewLine}" +
|
||||
$"----------------------------------------{Environment.NewLine}");
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
_sessionLogFilePath = null;
|
||||
Debug.LogWarning($"[IAA Sample] Failed to initialize log file: {exception.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void TryAppendLineToFile(string line)
|
||||
{
|
||||
if (!autoWriteLogsToFile || string.IsNullOrWhiteSpace(_sessionLogFilePath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
File.AppendAllText(_sessionLogFilePath, line + Environment.NewLine);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogWarning($"[IAA Sample] Failed to append log file: {exception.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void ExportVisibleLogsToFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_sessionLogDirectory))
|
||||
{
|
||||
InitializeLogFile();
|
||||
}
|
||||
|
||||
var exportPath = Path.Combine(
|
||||
_sessionLogDirectory ?? Application.persistentDataPath,
|
||||
$"iaa-ad-debug-export-{DateTime.Now:yyyyMMdd-HHmmss}.log");
|
||||
File.WriteAllLines(exportPath, _logs);
|
||||
AppendLog($"Exported {_logs.Count} visible log lines to file: {exportPath}");
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
AppendLog($"Export log file failed: {exception.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static string DisplayValue(string value)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value) ? "<empty>" : value;
|
||||
}
|
||||
|
||||
private void EnsureStyles()
|
||||
{
|
||||
if (_stylesInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_stylesInitialized = true;
|
||||
_titleStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 54,
|
||||
fontStyle = FontStyle.Bold,
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
wordWrap = true
|
||||
};
|
||||
_sectionStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 34,
|
||||
fontStyle = FontStyle.Bold,
|
||||
wordWrap = true
|
||||
};
|
||||
_textStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 28,
|
||||
wordWrap = true
|
||||
};
|
||||
_buttonStyle = new GUIStyle(GUI.skin.button)
|
||||
{
|
||||
fontSize = 28,
|
||||
wordWrap = true
|
||||
};
|
||||
_textFieldStyle = new GUIStyle(GUI.skin.textField)
|
||||
{
|
||||
fontSize = 28
|
||||
};
|
||||
_logStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 24,
|
||||
wordWrap = true,
|
||||
richText = false
|
||||
};
|
||||
}
|
||||
|
||||
private sealed class SampleToponAdController : IAdController
|
||||
{
|
||||
private readonly ToponAdController _inner = new ToponAdController();
|
||||
private readonly Action<bool> _onMaskChanged;
|
||||
private readonly Action<string, string, string> _onEventLog;
|
||||
|
||||
public SampleToponAdController(Action<bool> onMaskChanged, Action<string, string, string> onEventLog)
|
||||
{
|
||||
_onMaskChanged = onMaskChanged;
|
||||
_onEventLog = onEventLog;
|
||||
}
|
||||
|
||||
public void Init(ADConfig adConfig, object[] args)
|
||||
{
|
||||
_inner.Init(adConfig, args);
|
||||
}
|
||||
|
||||
public ADPlayer CreateAdPlayer(AD_Type type)
|
||||
{
|
||||
return _inner.CreateAdPlayer(type);
|
||||
}
|
||||
|
||||
public void EventLog(string eventTable, string eventValue, string eventMessage = null)
|
||||
{
|
||||
_onEventLog?.Invoke(eventTable, eventValue, eventMessage);
|
||||
_inner.EventLog(eventTable, eventValue, eventMessage);
|
||||
}
|
||||
|
||||
public void SetMask(bool isOpen)
|
||||
{
|
||||
_onMaskChanged?.Invoke(isOpen);
|
||||
_inner.SetMask(isOpen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53b297b9bf0d4cfca2b77af0fd74c95c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -12,6 +12,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
private Action<bool> _onVideoComplete;
|
||||
private ADListenerAggregator _aggregator;
|
||||
private bool _autoLoadRegistered;
|
||||
private bool _rewardGranted;
|
||||
|
||||
public override void OnInit()
|
||||
{
|
||||
@@ -28,6 +29,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
}
|
||||
|
||||
curState = 0;
|
||||
_rewardGranted = false;
|
||||
_onVideoComplete = onVideoComplete;
|
||||
adListener.onClose = onClose;
|
||||
adListener.onVideoComplete = OnVideoComplete;
|
||||
@@ -117,6 +119,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
public void onRewardedVideoAdPlayStart(string placementId, ATCallbackInfo callbackInfo)
|
||||
{
|
||||
Debug.Log($"[Topon] Rewarded play start. placementId={placementId}");
|
||||
NotifyShowStarted();
|
||||
}
|
||||
|
||||
public void onRewardedVideoAdPlayEnd(string placementId, ATCallbackInfo callbackInfo)
|
||||
@@ -134,7 +137,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
public void onRewardedVideoAdPlayClosed(string placementId, bool isReward, ATCallbackInfo callbackInfo)
|
||||
{
|
||||
Debug.Log($"[Topon] Rewarded closed. placementId={placementId}, reward={isReward}");
|
||||
adListener.OnRewardVerify(isReward, 1, "");
|
||||
adListener.OnRewardVerify(_rewardGranted || isReward, 1, "");
|
||||
adListener.OnAdClose();
|
||||
}
|
||||
|
||||
@@ -146,8 +149,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
public void onReward(string placementId, ATCallbackInfo callbackInfo)
|
||||
{
|
||||
Debug.Log($"[Topon] Rewarded reward callback. placementId={placementId}");
|
||||
adListener.OnRewardVerify(true, 1, "");
|
||||
adListener.OnAdClose();
|
||||
_rewardGranted = true;
|
||||
}
|
||||
|
||||
public void startLoadingADSource(string placementId, ATCallbackInfo callbackInfo)
|
||||
@@ -160,7 +162,6 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
|
||||
public void failToLoadADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message)
|
||||
{
|
||||
OnError(code, message);
|
||||
}
|
||||
|
||||
public void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo)
|
||||
|
||||
@@ -114,6 +114,7 @@ public class InteractionPlayer : ADPlayer, ATInterstitialAdListener
|
||||
public void onInterstitialAdShow(string placementId, ATCallbackInfo callbackInfo)
|
||||
{
|
||||
Debug.Log($"[Topon] Interstitial show. placementId={placementId}");
|
||||
NotifyShowStarted();
|
||||
}
|
||||
|
||||
public void onInterstitialAdFailedToShow(string placementId)
|
||||
@@ -160,7 +161,6 @@ public class InteractionPlayer : ADPlayer, ATInterstitialAdListener
|
||||
|
||||
public void failToLoadADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message)
|
||||
{
|
||||
OnError(code, message);
|
||||
}
|
||||
|
||||
public void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo)
|
||||
@@ -173,7 +173,6 @@ public class InteractionPlayer : ADPlayer, ATInterstitialAdListener
|
||||
|
||||
public void failBiddingADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message)
|
||||
{
|
||||
OnError(code, message);
|
||||
}
|
||||
|
||||
public override void OnPlayRequestStarted()
|
||||
|
||||
Reference in New Issue
Block a user