Add ParrelSync and netcode

This commit is contained in:
2024-08-21 18:13:06 +02:00
parent 1a9e2a3ee8
commit 6e037b4d06
42 changed files with 2078 additions and 15 deletions

View 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");
//}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 894412a5b602e6c4ba2cf2d01f4f92b5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7191fa4bfa12ae749b27f73ed292eaf1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: