diff --git a/Assets/Samples~/IAAAdDebugSample/Configs/IAAAdDebugSampleConfig.asset b/Assets/Samples~/IAAAdDebugSample/Configs/IAAAdDebugSampleConfig.asset new file mode 100644 index 0000000..66608cb --- /dev/null +++ b/Assets/Samples~/IAAAdDebugSample/Configs/IAAAdDebugSampleConfig.asset @@ -0,0 +1,68 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b31b835f394db4a51957c3f0f3ac32, type: 3} + m_Name: IAAAdDebugSampleConfig + m_EditorClassIdentifier: + ConfigName: TapADN IAA Ad Debug Sample + Id: your_tapadn_media_id + Key: your_tapadn_media_key + Key2: your_game_media_name + BaseAwardAdKeyValue: + key: rewarded + value: your_rewarded_space_id + BaseInteractionAdKeyValue: + key: interstitial + value: your_interstitial_space_id + BaseSplashAdKeyValue: + key: splash + value: your_splash_space_id + CommonKeyValues: + - key: tapadn.debug + value: true + - key: tapadn.channel + value: unity_sample + - key: tapadn.sub_channel + value: debug + - key: tapadn.rewarded_auto_load + value: true + - key: tapadn.rewarded_prewarm_on_init + value: false + - key: tapadn.rewarded_max_load_attempts + value: 2 + - key: tapadn.rewarded_load_retry_delay_ms + value: 750 + - key: tapadn.rewarded_show_timeout_ms + value: 20000 + - key: tapadn.reward_name + value: sample_reward + - key: tapadn.reward_amount + value: 1 + - key: tapadn.interstitial_auto_load + value: true + - key: tapadn.interstitial_prewarm_on_init + value: false + - key: tapadn.interstitial_max_load_attempts + value: 1 + - key: tapadn.interstitial_load_retry_delay_ms + value: 500 + - key: tapadn.interstitial_show_timeout_ms + value: 20000 + - key: tapadn.splash_auto_load + value: true + - key: tapadn.splash_prewarm_on_init + value: false + - key: tapadn.splash_max_load_attempts + value: 1 + - key: tapadn.splash_load_retry_delay_ms + value: 500 + - key: tapadn.splash_show_timeout_ms + value: 20000 diff --git a/Assets/Samples~/IAAAdDebugSample/Configs/IAAAdDebugSampleConfig.asset.meta b/Assets/Samples~/IAAAdDebugSample/Configs/IAAAdDebugSampleConfig.asset.meta new file mode 100644 index 0000000..ba79141 --- /dev/null +++ b/Assets/Samples~/IAAAdDebugSample/Configs/IAAAdDebugSampleConfig.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8fd78b2d95994175a8e05b397563d178 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Samples~/IAAAdDebugSample/README.md b/Assets/Samples~/IAAAdDebugSample/README.md index 34262aa..b7299bc 100644 --- a/Assets/Samples~/IAAAdDebugSample/README.md +++ b/Assets/Samples~/IAAAdDebugSample/README.md @@ -1,5 +1,47 @@ # TapADN IAA Ad Debug Sample -This optional sample is intentionally lightweight. Import it in a host project, create an `ADConfig`, and initialize with `TapadnCommercialization.InitADManager(...)` to validate rewarded, interstitial, and splash slots. +## Files -The main package does not import debug scenes or editor panels by default. +- Scene: + - `Assets/Samples/IAAAdDebugSample/Scenes/IAAAdDebugSample.unity` +- Config: + - `Assets/Samples/IAAAdDebugSample/Configs/IAAAdDebugSampleConfig.asset` +- Runtime GUI: + - `Assets/Samples/IAAAdDebugSample/Runtime/TapadnIAAAdDebugSampleGui.cs` + +## Setup + +1. Import this sample from Package Manager. +2. Open `IAAAdDebugSampleConfig.asset`. +3. Fill these fields: + - `Id` = TapADN / Dirichlet MediaId. + - `Key` = MediaKey. + - `Key2` = MediaName. + - `BaseAwardAdKeyValue.value` = rewarded SpaceId. + - `BaseInteractionAdKeyValue.value` = interstitial SpaceId. + - `BaseSplashAdKeyValue.value` = splash SpaceId. +4. Open `IAAAdDebugSample.unity`. +5. Build and run on Android device. + +## Debug Panel + +The scene uses an IMGUI panel and supports: + +- Initialize `ADManager`. +- Enter rewarded/interstitial/splash scenarios. +- Load rewarded/interstitial/splash. +- Async play rewarded/interstitial/splash. +- View ready state and TapADN init status. +- Copy logs to clipboard. +- Export logs to `Application.persistentDataPath/TapadnIAAAdDebugLogs`. + +## Default Strategy + +- `tapadn.debug=true` +- `tapadn.channel=unity_sample` +- Rewarded/interstitial/splash all use auto-ad mode by default. +- Prewarm is off by default to keep the first test action explicit. + +## Notes + +This sample is optional and lives under `Samples~`, so it is not imported into game projects unless explicitly selected. diff --git a/Assets/Samples~/IAAAdDebugSample/Runtime/TapadnIAAAdDebugSampleGui.cs b/Assets/Samples~/IAAAdDebugSample/Runtime/TapadnIAAAdDebugSampleGui.cs new file mode 100644 index 0000000..dfe3f77 --- /dev/null +++ b/Assets/Samples~/IAAAdDebugSample/Runtime/TapadnIAAAdDebugSampleGui.cs @@ -0,0 +1,602 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Runtime.ADAggregator; +using UnityEngine; + +public sealed class TapadnIAAAdDebugSampleGui : MonoBehaviour +{ + private const float ReferenceWidth = 1080f; + private const float ReferenceHeight = 2340f; + private const int MaxLogEntries = 140; + 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 string splashScenario = "splash_debug"; + public bool autoInitialize = true; + public bool forcePortrait = true; + public bool captureUnityLogs = true; + public bool showVerboseState = true; + public bool autoWriteLogsToFile = true; + + private readonly List _logs = new List(MaxLogEntries); + private Vector2 _pageScroll; + private Vector2 _logScroll; + 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 _splashReadyCache; + private bool _maskOpen; + private string _lastEventLog = ""; + 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("TapADN 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("TapADN 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 Scene", rewardedScenario); + interstitialScenario = DrawLabeledTextField("Interstitial Scene", interstitialScenario); + splashScenario = DrawLabeledTextField("Splash Scene", splashScenario); + + GUILayout.Label($"MediaId: {DisplayValue(adConfig?.Id)}", _textStyle); + GUILayout.Label($"Rewarded SpaceId: {DisplayValue(adConfig?.BaseAwardAdKeyValue?.value)}", _textStyle); + GUILayout.Label($"Interstitial SpaceId: {DisplayValue(adConfig?.BaseInteractionAdKeyValue?.value)}", _textStyle); + GUILayout.Label($"Splash SpaceId: {DisplayValue(adConfig?.BaseSplashAdKeyValue?.value)}", _textStyle); + GUILayout.Space(6f); + + if (GUILayout.Button("Initialize ADManager", _buttonStyle, GUILayout.Height(78f))) + { + TryInitialize(); + } + + 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($"Splash Ready: {_splashReadyCache}", _textStyle); + GUILayout.Label($"Mask Open: {_maskOpen}", _textStyle); + GUILayout.Label($"Last EventLog: {_lastEventLog}", _textStyle); + GUILayout.Label($"Last SDK Version: {DisplayValue(TapadnAdController.LastSdkVersion)}", _textStyle); + GUILayout.Label($"Last Init Error: {DisplayValue(TapadnAdController.LastInitError)}", _textStyle); + } + else + { + GUILayout.Label("Status unavailable before initialization.", _textStyle); + } + + var options = TapadnAdController.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( + $"Splash Auto/Prewarm/Retry: {options.SplashAutoLoad}/{options.SplashPrewarmOnInit}/{options.SplashMaxLoadAttempts}@{options.SplashLoadRetryDelayMs}ms", + _textStyle); + GUILayout.Label( + $"Channel/SubChannel/Debug: {DisplayValue(options.Channel)}/{DisplayValue(options.SubChannel)}/{options.Debug}", + _textStyle); + } + + if (showVerboseState && GUILayout.Button("Refresh Status Snapshot", _buttonStyle, GUILayout.Height(64f))) + { + RefreshStatusCaches(true); + AppendLog("Manual status snapshot refreshed."); + } + + GUILayout.Space(10f); + } + + private void DrawControlSection() + { + GUILayout.Label("Ad Actions", _sectionStyle); + + GUILayout.BeginHorizontal(); + DrawEnterButton("Enter Rewarded", AD_Type.AwardVideo, rewardedScenario); + DrawEnterButton("Enter Interstitial", AD_Type.Interaction, interstitialScenario); + DrawEnterButton("Enter Splash", AD_Type.Splash, splashScenario); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + DrawLoadButton("Load Rewarded", AD_Type.AwardVideo); + DrawLoadButton("Load Interstitial", AD_Type.Interaction); + DrawLoadButton("Load Splash", AD_Type.Splash); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + DrawPlayButton("Play Rewarded", AD_Type.AwardVideo, rewardedScenario); + DrawPlayButton("Play Interstitial", AD_Type.Interaction, interstitialScenario); + DrawPlayButton("Play Splash", AD_Type.Splash, splashScenario); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Close Interstitial", _buttonStyle, GUILayout.Height(70f))) + { + ADManager.Instance.CloseAd(AD_Type.Interaction); + AppendLog("Close interstitial requested."); + } + + if (GUILayout.Button("Close Splash", _buttonStyle, GUILayout.Height(70f))) + { + ADManager.Instance.CloseAd(AD_Type.Splash); + AppendLog("Close splash requested."); + } + GUILayout.EndHorizontal(); + + GUILayout.Space(10f); + } + + private void DrawEnterButton(string label, AD_Type adType, string scenario) + { + if (!GUILayout.Button(label, _buttonStyle, GUILayout.Height(84f))) + { + return; + } + + if (EnsureInitialized(label)) + { + ADManager.Instance.EnterAdScenario(adType, scenario); + AppendLog($"Enter scenario requested. type={adType}, scenario={scenario}"); + } + } + + private void DrawLoadButton(string label, AD_Type adType) + { + if (!GUILayout.Button(label, _buttonStyle, GUILayout.Height(84f))) + { + return; + } + + if (EnsureInitialized(label)) + { + ADManager.Instance.LoadAD(adType); + AppendLog($"Manual load requested. type={adType}"); + } + } + + private void DrawPlayButton(string label, AD_Type adType, string scenario) + { + if (!GUILayout.Button(label, _buttonStyle, GUILayout.Height(84f))) + { + return; + } + + if (EnsureInitialized(label)) + { + ADManager.Instance.AsyncPlayAD(adType, scenario, result => + { + AppendLog($"{adType} callback: {result}"); + }); + AppendLog($"AsyncPlayAD requested. type={adType}, scenario={scenario}"); + } + } + + 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 Options", _buttonStyle, GUILayout.Height(70f))) + { + LogCurrentOptions(); + } + 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(300f)); + 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: MediaId/MediaKey is empty. Please fill the sample ADConfig asset."); + } + + _initInvoked = true; + var controller = new SampleTapadnAdController( + isOpen => + { + _maskOpen = isOpen; + AppendLog($"Mask changed => open={isOpen}"); + }, + (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={adConfig.BaseAwardAdKeyValue?.value}, interstitial={adConfig.BaseInteractionAdKeyValue?.value}, splash={adConfig.BaseSplashAdKeyValue?.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); + _splashReadyCache = _initInvoked && ADManager.Instance.IsRealy(AD_Type.Splash); + } + + private void LogCurrentOptions() + { + var options = TapadnAdController.CurrentOptions; + if (options == null) + { + AppendLog("Current options unavailable: controller not initialized."); + return; + } + + AppendLog($"Options => mediaId={options.MediaId}, channel={options.Channel}, sub={options.SubChannel}, debug={options.Debug}, rewardAuto={options.RewardedAutoLoad}, interAuto={options.InterstitialAutoLoad}, splashAuto={options.SplashAutoLoad}"); + } + + 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("[TapADN]") && + !condition.Contains("[Dirichlet]") && + !condition.Contains("Rewarded") && + !condition.Contains("Interstitial") && + !condition.Contains("Splash")) + { + return; + } + } + + AppendLog($"[{type}] {condition}"); + } + + 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, "TapadnIAAAdDebugLogs"); + Directory.CreateDirectory(_sessionLogDirectory); + var fileName = $"tapadn-iaa-debug-{DateTime.Now:yyyyMMdd-HHmmss}.log"; + _sessionLogFilePath = Path.Combine(_sessionLogDirectory, fileName); + File.WriteAllText(_sessionLogFilePath, + $"TapADN 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($"[TapADN 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($"[TapADN Sample] Failed to append log file: {exception.Message}"); + } + } + + private void ExportVisibleLogsToFile() + { + try + { + if (string.IsNullOrWhiteSpace(_sessionLogDirectory)) + { + InitializeLogFile(); + } + + var exportPath = Path.Combine( + _sessionLogDirectory ?? Application.persistentDataPath, + $"tapadn-iaa-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) ? "" : value; + } + + private void EnsureStyles() + { + if (_stylesInitialized) + { + return; + } + + _stylesInitialized = true; + _titleStyle = new GUIStyle(GUI.skin.label) + { + fontSize = 50, + 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 = 26, + 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 SampleTapadnAdController : IAdController + { + private readonly TapadnAdController _inner = new TapadnAdController(); + private readonly Action _onMaskChanged; + private readonly Action _onEventLog; + + public SampleTapadnAdController(Action onMaskChanged, Action 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); + } + } +} diff --git a/Assets/Samples~/IAAAdDebugSample/Runtime/TapadnIAAAdDebugSampleGui.cs.meta b/Assets/Samples~/IAAAdDebugSample/Runtime/TapadnIAAAdDebugSampleGui.cs.meta new file mode 100644 index 0000000..70d2b6d --- /dev/null +++ b/Assets/Samples~/IAAAdDebugSample/Runtime/TapadnIAAAdDebugSampleGui.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c5d159f54f34916a2d7f9d581e2be91 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Samples~/IAAAdDebugSample/Scenes.meta b/Assets/Samples~/IAAAdDebugSample/Scenes.meta new file mode 100644 index 0000000..aa3139f --- /dev/null +++ b/Assets/Samples~/IAAAdDebugSample/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b5b8f842b31a4591b1ab7ec3b48d8404 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Samples~/IAAAdDebugSample/Scenes/IAAAdDebugSample.unity b/Assets/Samples~/IAAAdDebugSample/Scenes/IAAAdDebugSample.unity new file mode 100644 index 0000000..a6fcd3f --- /dev/null +++ b/Assets/Samples~/IAAAdDebugSample/Scenes/IAAAdDebugSample.unity @@ -0,0 +1,275 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &320557560 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 320557563} + - component: {fileID: 320557562} + - component: {fileID: 320557561} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &320557561 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 320557560} + m_Enabled: 1 +--- !u!20 &320557562 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 320557560} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &320557563 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 320557560} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &924544598 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 924544600} + - component: {fileID: 924544599} + m_Layer: 0 + m_Name: TapADN IAA Ad Debug Sample + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &924544599 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 924544598} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2c5d159f54f34916a2d7f9d581e2be91, type: 3} + m_Name: + m_EditorClassIdentifier: + adConfig: {fileID: 11400000, guid: 8fd78b2d95994175a8e05b397563d178, type: 2} + userId: debug_user_001 + rewardedScenario: reward_debug + interstitialScenario: interstitial_debug + splashScenario: splash_debug + autoInitialize: 1 + forcePortrait: 1 + captureUnityLogs: 1 + showVerboseState: 1 + autoWriteLogsToFile: 1 +--- !u!4 &924544600 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 924544598} + serializedVersion: 2 + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 320557563} + - {fileID: 924544600} diff --git a/Assets/Samples~/IAAAdDebugSample/Scenes/IAAAdDebugSample.unity.meta b/Assets/Samples~/IAAAdDebugSample/Scenes/IAAAdDebugSample.unity.meta new file mode 100644 index 0000000..4da93f9 --- /dev/null +++ b/Assets/Samples~/IAAAdDebugSample/Scenes/IAAAdDebugSample.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3ff28844898f476ca641c889799fe82b +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: