com.amanotes.gdk 0.2.48 → 0.2.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/Editor/AmaGDKEditor.cs +149 -63
- package/Editor/AmaGDKExtra.cs +31 -0
- package/Editor/AmaGDKExtra.cs.meta +11 -0
- package/Editor/Extra/GDKAutoBuild.cs +891 -0
- package/Editor/Extra/GDKAutoBuild.cs.meta +3 -0
- package/Editor/Extra/GDKProjectCP.cs +158 -0
- package/Editor/Extra/GDKProjectCP.cs.meta +11 -0
- package/Editor/Extra.meta +8 -0
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +1 -1
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AndroidPostProcessor.unitypackage +0 -0
- package/Extra/{AmaGDKProject.unitypackage.meta → AndroidPostProcessor.unitypackage.meta} +1 -1
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/CheckDiskSpace.unitypackage.meta +7 -0
- package/Extra/SDKVersionTracking.unitypackage +0 -0
- package/Extra/SDKVersionTracking.unitypackage.meta +7 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Runtime/AmaGDK.Adapters.cs +0 -4
- package/Runtime/AmaGDK.Ads.cs +92 -31
- package/Runtime/AmaGDK.Analytics.cs +97 -64
- package/Runtime/AmaGDK.IAP.cs +39 -45
- package/Runtime/AmaGDK.RemoteConfig.cs +76 -52
- package/Runtime/AmaGDK.UserProfile.cs +106 -124
- package/Runtime/AmaGDK.cs +46 -35
- package/Runtime/Internal/AmaGDK.Event.cs +185 -0
- package/Runtime/Internal/AmaGDK.Event.cs.meta +3 -0
- package/Runtime/Internal/AmaGDK.Internal.cs +4 -0
- package/Runtime/Internal/AmaGDK.Utils.cs +85 -24
- package/Runtime/Klavar/Attributes.meta +0 -4
- package/Runtime/Klavar.meta +0 -4
- package/package.json +1 -1
- package/Extra/AmaGDKProject.unitypackage +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using System.Linq;
|
|
5
|
+
using UnityEditor.SceneManagement;
|
|
6
|
+
|
|
7
|
+
namespace Amanotes
|
|
8
|
+
{
|
|
9
|
+
internal class GDKProjectCP : EditorWindow
|
|
10
|
+
{
|
|
11
|
+
private static GDKProjectCP _window;
|
|
12
|
+
static Texture2D iconScene;
|
|
13
|
+
static Texture2D iconPlay;
|
|
14
|
+
static Texture2D iconFolder;
|
|
15
|
+
static GUIStyle productNameStyle;
|
|
16
|
+
static string projectPath;
|
|
17
|
+
|
|
18
|
+
private static int activeSceneIndex;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
[MenuItem("Window/AmaGDK/Project Control Panel")]
|
|
22
|
+
private static void ShowWindow()
|
|
23
|
+
{
|
|
24
|
+
if (_window != null) return;
|
|
25
|
+
|
|
26
|
+
iconScene = AssetPreview.GetMiniTypeThumbnail(typeof(SceneAsset));
|
|
27
|
+
_window = CreateInstance<GDKProjectCP>();
|
|
28
|
+
_window.titleContent = new GUIContent("Project CP", iconScene, "GDK Project Control Panel");
|
|
29
|
+
_window.Show();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void Init()
|
|
33
|
+
{
|
|
34
|
+
if (iconScene == null) iconScene = AssetPreview.GetMiniTypeThumbnail(typeof(SceneAsset));
|
|
35
|
+
iconPlay = EditorGUIUtility.FindTexture("PlayButton");
|
|
36
|
+
iconFolder = EditorGUIUtility.FindTexture("Folder Icon");
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
productNameStyle = new GUIStyle(EditorStyles.largeLabel)
|
|
40
|
+
{
|
|
41
|
+
alignment = TextAnchor.MiddleCenter,
|
|
42
|
+
fontSize = 32
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
projectPath = Application.dataPath;
|
|
46
|
+
List<string> arr = projectPath.Split('/').ToList();
|
|
47
|
+
arr.RemoveAt(arr.Count - 1);
|
|
48
|
+
|
|
49
|
+
if (arr.Count > 3)
|
|
50
|
+
{
|
|
51
|
+
arr.RemoveRange(0, arr.Count - 3);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
projectPath = string.Join("/", arr);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static void DrawBigPlayButton()
|
|
58
|
+
{
|
|
59
|
+
EditorBuildSettingsScene[] scenes = EditorBuildSettings.scenes;
|
|
60
|
+
if (scenes.Length == 0)
|
|
61
|
+
{
|
|
62
|
+
EditorGUILayout.HelpBox("No scene in Build Setting!", MessageType.Warning);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
EditorBuildSettingsScene scene = scenes[activeSceneIndex];
|
|
67
|
+
|
|
68
|
+
GUILayout.BeginHorizontal();
|
|
69
|
+
{
|
|
70
|
+
EditorGUILayout.Space();
|
|
71
|
+
GUILayout.BeginVertical();
|
|
72
|
+
{
|
|
73
|
+
GUILayout.Space(16);
|
|
74
|
+
GUILayout.Label(scene.path);
|
|
75
|
+
activeSceneIndex = EditorGUILayout.IntSlider(activeSceneIndex, 0, scenes.Length - 1);
|
|
76
|
+
}
|
|
77
|
+
GUILayout.EndVertical();
|
|
78
|
+
if (GUILayout.Button(iconPlay, GUILayout.Width(64f), GUILayout.Height(64f)))
|
|
79
|
+
{
|
|
80
|
+
OpenScene(scene.path, true);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
GUILayout.EndHorizontal();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static void OpenScene(string scenePath, bool play)
|
|
87
|
+
{
|
|
88
|
+
if (EditorApplication.isPlaying)
|
|
89
|
+
{
|
|
90
|
+
EditorApplication.isPlaying = false;
|
|
91
|
+
}
|
|
92
|
+
else
|
|
93
|
+
{
|
|
94
|
+
EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
|
|
95
|
+
EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single);
|
|
96
|
+
if (play) EditorApplication.isPlaying = true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static void DrawProjectInfo()
|
|
101
|
+
{
|
|
102
|
+
GUILayout.Label(PlayerSettings.productName, productNameStyle);
|
|
103
|
+
|
|
104
|
+
var projectPathContent = new GUIContent(projectPath, iconFolder, "click to open folder");
|
|
105
|
+
|
|
106
|
+
if (GUILayout.Button(projectPathContent, EditorStyles.toolbarButton))
|
|
107
|
+
{
|
|
108
|
+
EditorUtility.RevealInFinder(Application.dataPath);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static void DrawListScenes()
|
|
113
|
+
{
|
|
114
|
+
EditorBuildSettingsScene[] listScenes = EditorBuildSettings.scenes;
|
|
115
|
+
int n = Mathf.Min(listScenes.Length, listScenes.Length);
|
|
116
|
+
|
|
117
|
+
GUILayout.BeginVertical();
|
|
118
|
+
{
|
|
119
|
+
for (var i = 0; i < n; i++)
|
|
120
|
+
{
|
|
121
|
+
EditorBuildSettingsScene scene = listScenes[i];
|
|
122
|
+
if (!scene.enabled) continue;
|
|
123
|
+
|
|
124
|
+
GUILayout.BeginHorizontal();
|
|
125
|
+
{
|
|
126
|
+
var asset = AssetDatabase.LoadAssetAtPath<SceneAsset>(scene.path);
|
|
127
|
+
|
|
128
|
+
if (GUILayout.Button(iconScene, EditorStyles.toolbarButton, GUILayout.Width(25f)))
|
|
129
|
+
{
|
|
130
|
+
OpenScene(scene.path, false);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
EditorGUILayout.ObjectField(asset, typeof(SceneAsset), false);
|
|
134
|
+
|
|
135
|
+
if (GUILayout.Button(iconPlay, EditorStyles.toolbarButton, GUILayout.Width(25f)))
|
|
136
|
+
{
|
|
137
|
+
OpenScene(scene.path, true);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
GUILayout.EndHorizontal();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
GUILayout.EndVertical();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
public void OnGUI()
|
|
148
|
+
{
|
|
149
|
+
if (productNameStyle == null) Init();
|
|
150
|
+
|
|
151
|
+
DrawProjectInfo();
|
|
152
|
+
EditorGUILayout.Space();
|
|
153
|
+
DrawBigPlayButton();
|
|
154
|
+
EditorGUILayout.Space();
|
|
155
|
+
DrawListScenes();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -35,7 +35,7 @@ namespace Amanotes.Editor
|
|
|
35
35
|
public SemVer sdkVersion;
|
|
36
36
|
|
|
37
37
|
public bool sdkInstalled => sdkVersion > SemVer.ZERO;
|
|
38
|
-
public bool adapterInstalled =>
|
|
38
|
+
public bool adapterInstalled => adapterVersion > SemVer.ZERO;
|
|
39
39
|
|
|
40
40
|
public string ToTSVString()
|
|
41
41
|
{
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -27,15 +27,11 @@ namespace Amanotes.Core.Internal
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
#if UNITY_EDITOR
|
|
31
|
-
status = Status.Ready;
|
|
32
|
-
#else
|
|
33
30
|
status = Status.Initialize;
|
|
34
31
|
Init(success =>
|
|
35
32
|
{
|
|
36
33
|
status = success ? Status.Ready : Status.Failed;
|
|
37
34
|
});
|
|
38
|
-
#endif
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
37
|
|
package/Runtime/AmaGDK.Ads.cs
CHANGED
|
@@ -9,6 +9,8 @@ using static Amanotes.Core.AmaGDK;
|
|
|
9
9
|
|
|
10
10
|
namespace Amanotes.Core
|
|
11
11
|
{
|
|
12
|
+
|
|
13
|
+
|
|
12
14
|
public static class AdExtension
|
|
13
15
|
{
|
|
14
16
|
public static IAdCallback OnAdOpened(this IAdCallback ad, Action callback)
|
|
@@ -18,7 +20,7 @@ namespace Amanotes.Core
|
|
|
18
20
|
Ads.context.onOpened += callback;
|
|
19
21
|
return ad;
|
|
20
22
|
}
|
|
21
|
-
|
|
23
|
+
|
|
22
24
|
public static IAdCallback OnRewardReceived(this IAdCallback ad, Action callback)
|
|
23
25
|
{
|
|
24
26
|
if (!MakeSureAdNotNull(ad)) return null;
|
|
@@ -26,7 +28,7 @@ namespace Amanotes.Core
|
|
|
26
28
|
Ads.context.onRewardReceived += callback;
|
|
27
29
|
return ad;
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
|
|
30
32
|
public static IAdCallback OnAdClicked(this IAdCallback ad, Action callback)
|
|
31
33
|
{
|
|
32
34
|
if (!MakeSureAdNotNull(ad)) return null;
|
|
@@ -34,7 +36,7 @@ namespace Amanotes.Core
|
|
|
34
36
|
Ads.context.onClicked += callback;
|
|
35
37
|
return ad;
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
|
|
38
40
|
public static IAdCallback OnAdShowFailed(this IAdCallback ad, Action callback)
|
|
39
41
|
{
|
|
40
42
|
if (!MakeSureAdNotNull(ad)) return null;
|
|
@@ -42,7 +44,7 @@ namespace Amanotes.Core
|
|
|
42
44
|
Ads.context.onShowFailed += callback;
|
|
43
45
|
return ad;
|
|
44
46
|
}
|
|
45
|
-
|
|
47
|
+
|
|
46
48
|
public static IAdCallback OnAdShowSuccess(this IAdCallback ad, Action callback)
|
|
47
49
|
{
|
|
48
50
|
if (!MakeSureAdNotNull(ad)) return null;
|
|
@@ -50,7 +52,7 @@ namespace Amanotes.Core
|
|
|
50
52
|
Ads.context.onShowSuccess += callback;
|
|
51
53
|
return ad;
|
|
52
54
|
}
|
|
53
|
-
|
|
55
|
+
|
|
54
56
|
public static IAdCallback OnAdClosed(this IAdCallback ad, Action callback)
|
|
55
57
|
{
|
|
56
58
|
if (!MakeSureAdNotNull(ad)) return null;
|
|
@@ -99,6 +101,27 @@ namespace Amanotes.Core
|
|
|
99
101
|
}
|
|
100
102
|
public partial class AmaGDK // Ads module
|
|
101
103
|
{
|
|
104
|
+
public static partial class Event
|
|
105
|
+
{
|
|
106
|
+
public const string INTER_REQUEST = nameof(INTER_REQUEST);
|
|
107
|
+
public const string INTER_SHOW_CALLED = nameof(INTER_SHOW_CALLED);
|
|
108
|
+
public const string INTER_SHOW_READY = nameof(INTER_SHOW_READY);
|
|
109
|
+
public const string INTER_SHOW_NOT_READY = nameof(INTER_SHOW_NOT_READY); // reason: string
|
|
110
|
+
public const string INTER_SHOW_BEGIN = nameof(INTER_SHOW_BEGIN); // always call result: true / false
|
|
111
|
+
public const string INTER_SHOW_END = nameof(INTER_SHOW_END); // always call result: true / false
|
|
112
|
+
|
|
113
|
+
public const string REWARD_REQUEST = nameof(REWARD_REQUEST);
|
|
114
|
+
public const string REWARD_VIDEO_SHOW_CALLED = nameof(REWARD_VIDEO_SHOW_CALLED);
|
|
115
|
+
public const string REWARD_VIDEO_SHOW_READY = nameof(REWARD_VIDEO_SHOW_READY);
|
|
116
|
+
public const string REWARD_VIDEO_SHOW_NOT_READY = nameof(REWARD_VIDEO_SHOW_NOT_READY); // reason: string
|
|
117
|
+
// public const string REWARD_VIDEO_REWARD_GRANTED = nameof(REWARD_VIDEO_REWARD_GRANTED);
|
|
118
|
+
public const string REWARD_VIDEO_SHOW_BEGIN = nameof(REWARD_VIDEO_SHOW_BEGIN); // always call result: true / false
|
|
119
|
+
public const string REWARD_VIDEO_SHOW_END = nameof(REWARD_VIDEO_SHOW_END); // always call result: true / false
|
|
120
|
+
|
|
121
|
+
public const string BANNER_SHOW = nameof(BANNER_SHOW);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
102
125
|
[Serializable]
|
|
103
126
|
internal class AdStat
|
|
104
127
|
{
|
|
@@ -177,6 +200,41 @@ namespace Amanotes.Core
|
|
|
177
200
|
internal protected static AdAdapter _adapter;
|
|
178
201
|
internal protected static float _savedVolume = -1;
|
|
179
202
|
internal protected static float _savedTimeScale = -1;
|
|
203
|
+
|
|
204
|
+
public static void OnInter_Request(Action callback)
|
|
205
|
+
{
|
|
206
|
+
dispatcher.AddListener(Event.INTER_REQUEST, callback, false);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
public static void OnInter_ShowCalled(Action callback)
|
|
210
|
+
{
|
|
211
|
+
dispatcher.AddListener(Event.INTER_SHOW_CALLED, callback, false);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
public static void OnReward_ShowCalled(Action callback)
|
|
215
|
+
{
|
|
216
|
+
dispatcher.AddListener(Event.REWARD_VIDEO_SHOW_CALLED, callback, false);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
public static void OnInter_ShowReady(Action callback)
|
|
220
|
+
{
|
|
221
|
+
dispatcher.AddListener(Event.INTER_SHOW_READY, callback, false);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
public static void OnReward_ShowReady(Action callback)
|
|
225
|
+
{
|
|
226
|
+
dispatcher.AddListener(Event.REWARD_VIDEO_SHOW_READY, callback, false);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
public static void OnInter_ShowNotReady(Action<AdShowReadyStatus> callback)
|
|
230
|
+
{
|
|
231
|
+
dispatcher.AddListener(Event.INTER_SHOW_NOT_READY, callback, false);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
public static void OnReward_ShowNotReady(Action<AdShowReadyStatus> callback)
|
|
235
|
+
{
|
|
236
|
+
dispatcher.AddListener(Event.REWARD_VIDEO_SHOW_NOT_READY, callback, false);
|
|
237
|
+
}
|
|
180
238
|
}
|
|
181
239
|
|
|
182
240
|
public partial class Ads // Public
|
|
@@ -247,10 +305,11 @@ namespace Amanotes.Core
|
|
|
247
305
|
|
|
248
306
|
if (_adapter == null)
|
|
249
307
|
{
|
|
250
|
-
//Debug.LogWarning("Adapter not found???");
|
|
251
308
|
return;
|
|
252
309
|
}
|
|
253
310
|
|
|
311
|
+
|
|
312
|
+
dispatcher.Dispatch(Event.BANNER_SHOW);
|
|
254
313
|
_adapter.ShowBanner(_showingBannerPosition);
|
|
255
314
|
}
|
|
256
315
|
|
|
@@ -314,6 +373,7 @@ namespace Amanotes.Core.Internal
|
|
|
314
373
|
public int adShowTimeoutInSecs = 5;
|
|
315
374
|
public BannerPosition bannerPosition = BannerPosition.BOTTOM;
|
|
316
375
|
public bool autoLogEvent = true;
|
|
376
|
+
public bool checkInternet = true;
|
|
317
377
|
|
|
318
378
|
public bool enableInterstitial = true;
|
|
319
379
|
public bool enableRewarded = true;
|
|
@@ -344,8 +404,6 @@ namespace Amanotes.Core.Internal
|
|
|
344
404
|
public abstract void HideBanner();
|
|
345
405
|
|
|
346
406
|
// Internally used
|
|
347
|
-
internal protected abstract void HandleBeforeAdShow();
|
|
348
|
-
internal protected abstract void HandleAfterAdShow();
|
|
349
407
|
internal protected abstract void SetUserId(string userId);
|
|
350
408
|
}
|
|
351
409
|
|
|
@@ -524,6 +582,9 @@ namespace Amanotes.Core.Internal
|
|
|
524
582
|
_isRequesting = true;
|
|
525
583
|
Log("[Ad] LoadAdRoutine: RequestAd()");
|
|
526
584
|
RequestAd();
|
|
585
|
+
dispatcher.Dispatch(
|
|
586
|
+
_isInterstitial ? AmaGDK.Event.INTER_REQUEST : AmaGDK.Event.REWARD_REQUEST
|
|
587
|
+
);
|
|
527
588
|
|
|
528
589
|
int timeout = Config.ad.adLoadTimeoutInSecs;
|
|
529
590
|
var counter = 0;
|
|
@@ -581,7 +642,9 @@ namespace Amanotes.Core.Internal
|
|
|
581
642
|
AdStat stat = Ads.localData.GetStat(adType);
|
|
582
643
|
stat.callCount++;
|
|
583
644
|
stat.lastCallTime = Time.realtimeSinceStartup;
|
|
584
|
-
|
|
645
|
+
dispatcher.Dispatch(
|
|
646
|
+
_isInterstitial ? AmaGDK.Event.INTER_SHOW_CALLED : AmaGDK.Event.REWARD_VIDEO_SHOW_CALLED
|
|
647
|
+
);
|
|
585
648
|
|
|
586
649
|
if (_showAdRoutine != null) _instance.StopCoroutine(_showAdRoutine);
|
|
587
650
|
_showAdRoutine = _instance.StartCoroutine(ShowAdRoutine());
|
|
@@ -597,7 +660,7 @@ namespace Amanotes.Core.Internal
|
|
|
597
660
|
StartLoadAd();
|
|
598
661
|
}
|
|
599
662
|
|
|
600
|
-
|
|
663
|
+
TriggerOnAfterAdShow();
|
|
601
664
|
if (_showAdRoutine == null) return;
|
|
602
665
|
_instance.StopCoroutine(_showAdRoutine);
|
|
603
666
|
_showAdRoutine = null;
|
|
@@ -648,7 +711,7 @@ namespace Amanotes.Core.Internal
|
|
|
648
711
|
if (_loadState != LoadAdsState.Requesting) StartLoadAd();
|
|
649
712
|
var counter = 0;
|
|
650
713
|
bool? hasInternet = null;
|
|
651
|
-
_instance.StartCoroutine(WebUtils.CheckInternet(result => hasInternet = result));
|
|
714
|
+
if (adConfig.checkInternet) _instance.StartCoroutine(WebUtils.CheckInternet(result => hasInternet = result));
|
|
652
715
|
|
|
653
716
|
var wait1Sec = new WaitForSecondsRealtime(1f);
|
|
654
717
|
while (counter < timeout || timeout == -1)
|
|
@@ -657,7 +720,7 @@ namespace Amanotes.Core.Internal
|
|
|
657
720
|
counter++;
|
|
658
721
|
|
|
659
722
|
// finish checking internet & result is false
|
|
660
|
-
if (hasInternet == false)
|
|
723
|
+
if (adConfig.checkInternet && hasInternet == false)
|
|
661
724
|
{
|
|
662
725
|
Log("[Ad] Stop WaitForAd : No internet!");
|
|
663
726
|
_showState = ShowAdsState.ShowFail;
|
|
@@ -682,10 +745,9 @@ namespace Amanotes.Core.Internal
|
|
|
682
745
|
|
|
683
746
|
_showState = ShowAdsState.Showing;
|
|
684
747
|
OnAdShowReadyStatus(true, AdShowReadyStatus.Ready);
|
|
685
|
-
|
|
748
|
+
TriggerBeforeAdShow();
|
|
686
749
|
ShowAd();
|
|
687
|
-
|
|
688
|
-
AdShowContext context = Ads.context;
|
|
750
|
+
|
|
689
751
|
while (!context.potentiallyCompleted)
|
|
690
752
|
{
|
|
691
753
|
yield return null; // callback as quickly as possible
|
|
@@ -750,14 +812,14 @@ namespace Amanotes.Core.Internal
|
|
|
750
812
|
}
|
|
751
813
|
|
|
752
814
|
localData.Save();
|
|
753
|
-
|
|
815
|
+
TriggerOnAfterAdShow();
|
|
754
816
|
|
|
755
817
|
Log($"[Ad] {adType} ShowAdRoutineCompleted: {isSuccess}\n{JsonUtility.ToJson(Ads.context)}");
|
|
756
818
|
Ads.context = null;
|
|
757
819
|
_showState = ShowAdsState.None;
|
|
758
820
|
}
|
|
759
821
|
|
|
760
|
-
private void
|
|
822
|
+
private void TriggerBeforeAdShow()
|
|
761
823
|
{
|
|
762
824
|
bool willSaveVolume = Config.ad.autoMute
|
|
763
825
|
&& AudioListener.volume > 0
|
|
@@ -779,11 +841,11 @@ namespace Amanotes.Core.Internal
|
|
|
779
841
|
Time.timeScale = 0;
|
|
780
842
|
}
|
|
781
843
|
|
|
844
|
+
dispatcher.Dispatch(_isInterstitial ? AmaGDK.Event.INTER_SHOW_BEGIN : AmaGDK.Event.REWARD_VIDEO_SHOW_BEGIN);
|
|
782
845
|
Ads.context.onBeforeAdOpen?.Invoke();
|
|
783
|
-
Ads._adapter.HandleBeforeAdShow();
|
|
784
846
|
}
|
|
785
847
|
|
|
786
|
-
private void
|
|
848
|
+
private void TriggerOnAfterAdShow()
|
|
787
849
|
{
|
|
788
850
|
bool willRestoreVolume = Config.ad.autoMute
|
|
789
851
|
&& AudioListener.volume == 0
|
|
@@ -804,8 +866,9 @@ namespace Amanotes.Core.Internal
|
|
|
804
866
|
Time.timeScale = Ads._savedTimeScale;
|
|
805
867
|
Ads._savedTimeScale = -1;
|
|
806
868
|
}
|
|
807
|
-
|
|
808
|
-
|
|
869
|
+
|
|
870
|
+
bool isSuccess = _showState == ShowAdsState.ShowSuccess;
|
|
871
|
+
dispatcher.Dispatch(_isInterstitial ? AmaGDK.Event.INTER_SHOW_END : AmaGDK.Event.REWARD_VIDEO_SHOW_END, isSuccess);
|
|
809
872
|
}
|
|
810
873
|
|
|
811
874
|
// Default implementation
|
|
@@ -877,20 +940,18 @@ namespace Amanotes.Core.Internal
|
|
|
877
940
|
Ads.context.onAdShowReadyStatus?.Invoke(status);
|
|
878
941
|
if (status == AdShowReadyStatus.Ready)
|
|
879
942
|
{
|
|
880
|
-
|
|
943
|
+
dispatcher.Dispatch(
|
|
944
|
+
_isInterstitial ? AmaGDK.Event.INTER_SHOW_READY : AmaGDK.Event.REWARD_VIDEO_SHOW_READY
|
|
945
|
+
);
|
|
881
946
|
} else if (status == AdShowReadyStatus.NoInternet || status == AdShowReadyStatus.TimeOut || status == AdShowReadyStatus.Wifi3GDisabled)
|
|
882
947
|
{
|
|
883
|
-
|
|
948
|
+
dispatcher.Dispatch(
|
|
949
|
+
_isInterstitial ? AmaGDK.Event.INTER_SHOW_NOT_READY : AmaGDK.Event.REWARD_VIDEO_SHOW_NOT_READY,
|
|
950
|
+
status
|
|
951
|
+
);
|
|
884
952
|
}
|
|
885
953
|
}
|
|
886
|
-
|
|
887
|
-
protected virtual void OnAdShowCalled()
|
|
888
|
-
{ }
|
|
889
|
-
protected virtual void OnAdShowReady()
|
|
890
|
-
{ }
|
|
891
|
-
protected virtual void OnAdShowNotReady(AdShowReadyStatus status)
|
|
892
|
-
{ }
|
|
893
|
-
|
|
954
|
+
|
|
894
955
|
protected void OnAdOpen()
|
|
895
956
|
{
|
|
896
957
|
Log($"[Ad] {adType} OnAdOpen");
|