From d0670730959c986b0d9f18b864eed20c14df259f Mon Sep 17 00:00:00 2001 From: DucNV Date: Mon, 22 Jan 2024 10:52:37 +0700 Subject: [PATCH] fix control panel iap draw and notification prepare --- VirtueSky/ControlPanel/CPIapDrawer.cs | 2 +- .../Runtime/NotificationPrepare.cs | 24 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/VirtueSky/ControlPanel/CPIapDrawer.cs b/VirtueSky/ControlPanel/CPIapDrawer.cs index 90c708b7..43b03610 100644 --- a/VirtueSky/ControlPanel/CPIapDrawer.cs +++ b/VirtueSky/ControlPanel/CPIapDrawer.cs @@ -33,7 +33,7 @@ public static void OnDrawIap(Rect position, ref StatePanelControl statePanelCont #endif } - if (GUILayout.Button("Create Iap Purchase Product Event")) + if (GUILayout.Button("Create Iap Is Purchase Product Event")) { #if VIRTUESKY_IAP IapWindowEditor.CreateIsPurchaseProductEvent(); diff --git a/VirtueSky/Notifications/Runtime/NotificationPrepare.cs b/VirtueSky/Notifications/Runtime/NotificationPrepare.cs index 04a7077f..a071156a 100644 --- a/VirtueSky/Notifications/Runtime/NotificationPrepare.cs +++ b/VirtueSky/Notifications/Runtime/NotificationPrepare.cs @@ -14,17 +14,20 @@ public class NotificationPrepare : BaseMono private void Start() { - var strs = new List(); - - foreach (var variable in notificationVariables) + if (Application.isMobilePlatform) { - if (!variable.bigPicture) continue; - if (!strs.Contains(variable.namePicture)) strs.Add(variable.namePicture); - } + var strs = new List(); - foreach (string s in strs) - { - App.StartCoroutine(PrepareImage(Application.persistentDataPath, s)); + foreach (var variable in notificationVariables) + { + if (!variable.bigPicture) continue; + if (!strs.Contains(variable.namePicture)) strs.Add(variable.namePicture); + } + + foreach (string s in strs) + { + App.StartCoroutine(PrepareImage(Application.persistentDataPath, s)); + } } } @@ -32,7 +35,8 @@ private IEnumerator PrepareImage(string destDir, string filename) { string path = Path.Combine(destDir, filename); if (File.Exists(path)) yield break; - using var uwr = UnityWebRequest.Get(Path.Combine(Application.streamingAssetsPath, filename)); + using var uwr = + UnityWebRequest.Get(Path.Combine(Application.streamingAssetsPath, filename)); yield return uwr.SendWebRequest(); File.WriteAllBytes(path, uwr.downloadHandler.data); }