Add ParrelSync and netcode
This commit is contained in:
78
Assets/ParrelSync/Editor/NonCore/AskFeedbackDialog.cs
Normal file
78
Assets/ParrelSync/Editor/NonCore/AskFeedbackDialog.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
namespace ParrelSync.NonCore
|
||||
{
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// A simple script to display feedback/star dialog after certain time of project being opened/re-compiled.
|
||||
/// Will only pop-up once unless "Remind me next time" are chosen.
|
||||
/// Removing this file from project wont effect any other functions.
|
||||
/// </summary>
|
||||
[InitializeOnLoad]
|
||||
public class AskFeedbackDialog
|
||||
{
|
||||
const string InitializeOnLoadCountKey = "ParrelSync_InitOnLoadCount", StopShowingKey = "ParrelSync_StopShowFeedBack";
|
||||
static AskFeedbackDialog()
|
||||
{
|
||||
if (EditorPrefs.HasKey(StopShowingKey)) { return; }
|
||||
|
||||
int InitializeOnLoadCount = EditorPrefs.GetInt(InitializeOnLoadCountKey, 0);
|
||||
if (InitializeOnLoadCount > 20)
|
||||
{
|
||||
ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorPrefs.SetInt(InitializeOnLoadCountKey, InitializeOnLoadCount + 1);
|
||||
}
|
||||
}
|
||||
|
||||
//[MenuItem("ParrelSync/(Debug)Show AskFeedbackDialog ")]
|
||||
private static void ShowDialog()
|
||||
{
|
||||
int option = EditorUtility.DisplayDialogComplex("Do you like " + ParrelSync.ClonesManager.ProjectName + "?",
|
||||
"Do you like " + ParrelSync.ClonesManager.ProjectName + "?\n" +
|
||||
"If so, please don't hesitate to star it on GitHub and contribute to the project!",
|
||||
"Star on GitHub",
|
||||
"Close",
|
||||
"Remind me next time"
|
||||
);
|
||||
|
||||
switch (option)
|
||||
{
|
||||
// First parameter.
|
||||
case 0:
|
||||
Debug.Log("AskFeedbackDialog: Star on GitHub selected");
|
||||
EditorPrefs.SetBool(StopShowingKey, true);
|
||||
EditorPrefs.DeleteKey(InitializeOnLoadCountKey);
|
||||
Application.OpenURL(ExternalLinks.GitHubHome);
|
||||
break;
|
||||
// Second parameter.
|
||||
case 1:
|
||||
Debug.Log("AskFeedbackDialog: Close and never show again.");
|
||||
EditorPrefs.SetBool(StopShowingKey, true);
|
||||
EditorPrefs.DeleteKey(InitializeOnLoadCountKey);
|
||||
break;
|
||||
// Third parameter.
|
||||
case 2:
|
||||
Debug.Log("AskFeedbackDialog: Remind me next time");
|
||||
EditorPrefs.SetInt(InitializeOnLoadCountKey, 0);
|
||||
break;
|
||||
default:
|
||||
//Debug.Log("Close windows.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// For debug purpose
|
||||
///// </summary>
|
||||
//[MenuItem("ParrelSync/(Debug)Delete AskFeedbackDialog keys")]
|
||||
//private static void DebugDeleteAllKeys()
|
||||
//{
|
||||
// EditorPrefs.DeleteKey(InitializeOnLoadCountKey);
|
||||
// EditorPrefs.DeleteKey(StopShowingKey);
|
||||
// Debug.Log("AskFeedbackDialog keys deleted");
|
||||
//}
|
||||
}
|
||||
}
|
||||
11
Assets/ParrelSync/Editor/NonCore/AskFeedbackDialog.cs.meta
Normal file
11
Assets/ParrelSync/Editor/NonCore/AskFeedbackDialog.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 894412a5b602e6c4ba2cf2d01f4f92b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/ParrelSync/Editor/NonCore/OtherMenuItem.cs
Normal file
26
Assets/ParrelSync/Editor/NonCore/OtherMenuItem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace ParrelSync.NonCore
|
||||
{
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public class OtherMenuItem
|
||||
{
|
||||
[MenuItem("ParrelSync/GitHub/View this project on GitHub", priority = 10)]
|
||||
private static void OpenGitHub()
|
||||
{
|
||||
Application.OpenURL(ExternalLinks.GitHubHome);
|
||||
}
|
||||
|
||||
[MenuItem("ParrelSync/GitHub/View FAQ", priority = 11)]
|
||||
private static void OpenFAQ()
|
||||
{
|
||||
Application.OpenURL(ExternalLinks.FAQ);
|
||||
}
|
||||
|
||||
[MenuItem("ParrelSync/GitHub/View Issues", priority = 12)]
|
||||
private static void OpenGitHubIssues()
|
||||
{
|
||||
Application.OpenURL(ExternalLinks.GitHubIssue);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/ParrelSync/Editor/NonCore/OtherMenuItem.cs.meta
Normal file
11
Assets/ParrelSync/Editor/NonCore/OtherMenuItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7191fa4bfa12ae749b27f73ed292eaf1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user