MOD!
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace Assets.PixelFantasy.PixelHeroes.FantasyHeroes.Scripts.Editor
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
internal static class PackageFeedback
|
||||
{
|
||||
private const string PackageId = "250116";
|
||||
private const string PackageName = "Pixel Hero Maker";
|
||||
|
||||
private static readonly string PrefsKeyImportTime = $"PackageFeedback.ImportTime.{PackageId}";
|
||||
private static readonly string PrefsKeyReviewTime = $"PackageFeedback.ReviewTime.{PackageId}";
|
||||
private static readonly string PrefsKeySkipTime = $"PackageFeedback.SkipTime.{PackageId}";
|
||||
|
||||
static PackageFeedback()
|
||||
{
|
||||
if (EditorPrefs.HasKey(PrefsKeyImportTime))
|
||||
{
|
||||
var time = DateTime.Parse(EditorPrefs.GetString(PrefsKeyImportTime), CultureInfo.InvariantCulture);
|
||||
|
||||
if ((DateTime.UtcNow - time).TotalHours < 1) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorPrefs.SetString(PrefsKeyImportTime, DateTime.UtcNow.ToString(CultureInfo.InvariantCulture));
|
||||
return;
|
||||
}
|
||||
|
||||
if (EditorPrefs.HasKey(PrefsKeyReviewTime)) return;
|
||||
|
||||
if (EditorPrefs.HasKey(PrefsKeySkipTime))
|
||||
{
|
||||
var time = DateTime.Parse(EditorPrefs.GetString(PrefsKeySkipTime), CultureInfo.InvariantCulture);
|
||||
|
||||
if ((DateTime.UtcNow - time).TotalDays < 30) return;
|
||||
}
|
||||
|
||||
var confirm = EditorUtility.DisplayDialog("Package Feedback", $"Would you like to write a review about {PackageName}?\n\nYour feedback is very important for improving and extending our assets. We appreciate your time and have a small gift you!", "Yes", "No");
|
||||
|
||||
EditorPrefs.SetString(confirm ? PrefsKeyReviewTime : PrefsKeySkipTime, DateTime.UtcNow.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
if (confirm)
|
||||
{
|
||||
Application.OpenURL($"https://assetstore.unity.com/packages/slug/{PackageId}#reviews");
|
||||
|
||||
if (EditorUtility.DisplayDialog("Package Feedback Bonus", "We really appreciate your review! We want to gift you our package Simple Encryption as a token of gratitude. With it, you can easily encrypt and decrypt data, compute hashes and create digital signatures.", "Download", "No, thanks"))
|
||||
{
|
||||
Application.OpenURL("https://bit.ly/PackageFeedbackBonus");
|
||||
}
|
||||
}
|
||||
|
||||
Event($"PackageFeedback.{(confirm ? "Yes" : "No")}", "PackageId", PackageId);
|
||||
}
|
||||
|
||||
private static void Event(string eventName, string paramName, string paramValue)
|
||||
{
|
||||
var request = UnityWebRequest.Post("https://hippogames.dev/api/analytics/event", new Dictionary<string, string> { { "eventName", eventName }, { "paramName", paramName }, { "paramValue", paramValue } });
|
||||
|
||||
request.SendWebRequest().completed += _ => request.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3b5a5d8ba248ca4d8196d99120adb5d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 250116
|
||||
packageName: Pixel Hero Maker
|
||||
packageVersion: 3.4
|
||||
assetPath: Assets/OtherPlugins/PixelFantasy/PixelHeroes/FantasyHeroes/Scripts/Editor/PackageFeedback.cs
|
||||
uploadId: 777185
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace Assets.PixelFantasy.PixelHeroes.FantasyHeroes.Scripts.Editor
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
internal static class PackageUpdater
|
||||
{
|
||||
private const string PackageId = "250116";
|
||||
private const string CurrentVersion = "3.4";
|
||||
|
||||
private static readonly string PrefsKeyTime = $"PackageUpdater.Time.{PackageId}";
|
||||
private static readonly string PrefsKeySkip = $"PackageUpdater.Skip.{PackageId}";
|
||||
|
||||
static PackageUpdater()
|
||||
{
|
||||
if (EditorPrefs.HasKey(PrefsKeyTime))
|
||||
{
|
||||
var time = DateTime.Parse(EditorPrefs.GetString(PrefsKeyTime), CultureInfo.InvariantCulture);
|
||||
|
||||
if ((DateTime.UtcNow - time).TotalHours < 24) return;
|
||||
}
|
||||
|
||||
var request = UnityWebRequest.Get($"https://api.assetstore.unity3d.com/package/latest-version/{PackageId}");
|
||||
|
||||
request.SendWebRequest().completed += _ =>
|
||||
{
|
||||
if (request.result == UnityWebRequest.Result.Success)
|
||||
{
|
||||
var packageInfo = JsonUtility.FromJson<PackageInfo>(request.downloadHandler.text);
|
||||
|
||||
if (new Version(packageInfo.version) > new Version(CurrentVersion))
|
||||
{
|
||||
if (EditorPrefs.HasKey(PrefsKeySkip) && EditorPrefs.GetString(PrefsKeySkip) == packageInfo.version) return;
|
||||
|
||||
var confirm = EditorUtility.DisplayDialog("Package Updater", $"{packageInfo.name} ({CurrentVersion}) is outdated. Do you want to update it to the latest version ({packageInfo.version}) via Package Manager?", "Yes", "No");
|
||||
|
||||
if (confirm)
|
||||
{
|
||||
//UnityEditor.PackageManager.UI.Window.Open(PackageId);
|
||||
Application.OpenURL($"https://assetstore.unity.com/packages/slug/{PackageId}");
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorPrefs.SetString(PrefsKeySkip, packageInfo.version);
|
||||
Debug.LogWarning($"{packageInfo.name} ({CurrentVersion}) is outdated. Please update to the latest version ({packageInfo.version}).");
|
||||
}
|
||||
|
||||
EditorPrefs.SetString(PrefsKeyTime, DateTime.UtcNow.ToString(CultureInfo.InvariantCulture));
|
||||
Event($"PackageUpdater.{(confirm ? "Yes" : "No")}", "PackageId", PackageId);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"{packageInfo.name} is up to date.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError(request.error);
|
||||
}
|
||||
|
||||
request.Dispose();
|
||||
};
|
||||
}
|
||||
|
||||
private static void Event(string eventName, string paramName, string paramValue)
|
||||
{
|
||||
var request = UnityWebRequest.Post("https://hippogames.dev/api/analytics/event", new Dictionary<string, string> { { "eventName", eventName }, { "paramName", paramName }, { "paramValue", paramValue } });
|
||||
|
||||
request.SendWebRequest().completed += _ => request.Dispose();
|
||||
}
|
||||
|
||||
private class PackageInfo
|
||||
{
|
||||
public string version;
|
||||
public string name;
|
||||
public string category;
|
||||
public string id;
|
||||
public string publisher;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00293756d9b09b3428a14fcc8920662a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 250116
|
||||
packageName: Pixel Hero Maker
|
||||
packageVersion: 3.4
|
||||
assetPath: Assets/OtherPlugins/PixelFantasy/PixelHeroes/FantasyHeroes/Scripts/Editor/PackageUpdater.cs
|
||||
uploadId: 777185
|
||||
Reference in New Issue
Block a user