Skip to content

Commit

Permalink
Merge pull request #87 from asadm/MockMode-V3
Browse files Browse the repository at this point in the history
Mock Mode Updates
  • Loading branch information
SaadBazaz authored Sep 5, 2024
2 parents 95c5f1f + 28cefcc commit a9b9483
Show file tree
Hide file tree
Showing 131 changed files with 12,656 additions and 635 deletions.
2 changes: 1 addition & 1 deletion Assets/Editor/Src.meta → Assets/ParrelSync.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Editor.meta → Assets/ParrelSync/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Assets/ParrelSync/Editor/AssetModBlock/EditorQuit.cs
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions Assets/ParrelSync/Editor/AssetModBlock/EditorQuit.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -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;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a9b9483

Please sign in to comment.