Add ParrelSync and netcode
This commit is contained in:
22
Assets/ParrelSync/Editor/AssetModBlock/EditorQuit.cs
Normal file
22
Assets/ParrelSync/Editor/AssetModBlock/EditorQuit.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEditor;
|
||||
namespace ParrelSync
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public class EditorQuit
|
||||
{
|
||||
/// <summary>
|
||||
/// Is editor being closed
|
||||
/// </summary>
|
||||
static public bool IsQuiting { get; private set; }
|
||||
static void Quit()
|
||||
{
|
||||
IsQuiting = true;
|
||||
}
|
||||
|
||||
static EditorQuit()
|
||||
{
|
||||
IsQuiting = false;
|
||||
EditorApplication.quitting += Quit;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/ParrelSync/Editor/AssetModBlock/EditorQuit.cs.meta
Normal file
11
Assets/ParrelSync/Editor/AssetModBlock/EditorQuit.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf2888ff90706904abc2d851c3e59e00
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
namespace ParrelSync
|
||||
{
|
||||
/// <summary>
|
||||
/// For preventing assets being modified from the clone instance.
|
||||
/// </summary>
|
||||
public class ParrelSyncAssetModificationProcessor : UnityEditor.AssetModificationProcessor
|
||||
{
|
||||
public static string[] OnWillSaveAssets(string[] paths)
|
||||
{
|
||||
if (ClonesManager.IsClone() && Preferences.AssetModPref.Value)
|
||||
{
|
||||
if (paths != null && paths.Length > 0 && !EditorQuit.IsQuiting)
|
||||
{
|
||||
EditorUtility.DisplayDialog(
|
||||
ClonesManager.ProjectName + ": Asset modifications saving detected and blocked",
|
||||
"Asset modifications saving are blocked in the clone instance. \n\n" +
|
||||
"This is a clone of the original project. \n" +
|
||||
"Making changes to asset files via the clone editor is not recommended. \n" +
|
||||
"Please use the original editor window if you want to make changes to the project files.",
|
||||
"ok"
|
||||
);
|
||||
foreach (var path in paths)
|
||||
{
|
||||
Debug.Log("Attempting to save " + path + " are blocked.");
|
||||
}
|
||||
}
|
||||
return new string[0] { };
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 755e570bd21b39440a923056e60f1450
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user