Skip to content

Commit

Permalink
fix control panel iap draw and notification prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
GrayWolf52 committed Jan 22, 2024
1 parent 25fe9a4 commit d067073
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VirtueSky/ControlPanel/CPIapDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
24 changes: 14 additions & 10 deletions VirtueSky/Notifications/Runtime/NotificationPrepare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,29 @@ public class NotificationPrepare : BaseMono

private void Start()
{
var strs = new List<string>();

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<string>();

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));
}
}
}

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);
}
Expand Down

0 comments on commit d067073

Please sign in to comment.