diff --git a/Images/UPM_1.png b/Images/UPM_1.png new file mode 100644 index 0000000..d9c496d Binary files /dev/null and b/Images/UPM_1.png differ diff --git a/Images/UPM_2.png b/Images/UPM_2.png new file mode 100644 index 0000000..5f769f8 Binary files /dev/null and b/Images/UPM_2.png differ diff --git a/ParrelSync/Editor/ClonesManager.cs b/ParrelSync/Editor/ClonesManager.cs index c37f057..4a87489 100644 --- a/ParrelSync/Editor/ClonesManager.cs +++ b/ParrelSync/Editor/ClonesManager.cs @@ -108,7 +108,7 @@ public static Project CreateCloneFromPath(string sourceProjectPath) ClonesManager.LinkFolders(sourceProject.packagesPath, cloneProject.packagesPath); ClonesManager.LinkFolders(sourceProject.autoBuildPath, cloneProject.autoBuildPath); ClonesManager.LinkFolders(sourceProject.localPackages, cloneProject.localPackages); - + ClonesManager.RegisterClone(cloneProject); return cloneProject; @@ -165,6 +165,8 @@ private static string GetApplicationPath() return EditorApplication.applicationPath; case RuntimePlatform.OSXEditor: return EditorApplication.applicationPath + "/Contents/MacOS/Unity"; + case RuntimePlatform.LinuxEditor: + return EditorApplication.applicationPath; default: throw new System.NotImplementedException("Platform has not supported yet ;("); } @@ -190,12 +192,12 @@ public static bool IsCloneProjectRunning(string projectPath) if (Preferences.AlsoCheckUnityLockFileStaPref.Value) return File.Exists(UnityLockFilePath) && FileUtilities.IsFileLocked(UnityLockFilePath); else - return File.Exists(UnityLockFilePath); + return File.Exists(UnityLockFilePath); case (RuntimePlatform.OSXEditor): //Mac editor won't lock "UnityLockfile" file when project is being opened return File.Exists(UnityLockFilePath); case (RuntimePlatform.LinuxEditor): - throw new System.NotImplementedException("IsCloneProjectRunning: No linux implementation yet."); + return File.Exists(UnityLockFilePath); default: throw new System.NotImplementedException("IsCloneProjectRunning: Unsupport Platfrom: " + Application.platform); } @@ -244,8 +246,13 @@ public static void DeleteClone(string cloneProjectPath) break; case (RuntimePlatform.LinuxEditor): - throw new System.NotImplementedException("No linux support yet :("); - //break; + Debug.Log("Attempting to delete folder \"" + cloneProjectPath + "\""); + identifierFile = Path.Combine(cloneProjectPath, ClonesManager.ArgumentFileName); + File.Delete(identifierFile); + + FileUtil.DeleteFileOrDirectory(cloneProjectPath); + + break; default: Debug.LogWarning("Not in a known editor. Where are you!?"); break; @@ -305,6 +312,22 @@ private static void CreateLinkMac(string sourcePath, string destinationPath) ClonesManager.ExecuteBashCommand(command); } + /// + /// Creates a symlink between destinationPath and sourcePath (Linux version). + /// + /// + /// + private static void CreateLinkLinux(string sourcePath, string destinationPath) + { + sourcePath = sourcePath.Replace(" ", "\\ "); + destinationPath = destinationPath.Replace(" ", "\\ "); + var command = $"ln -s {sourcePath} {destinationPath}"; + + Debug.Log("Linux Symlink " + command); + + ClonesManager.ExecuteBashCommand(command); + } + /// /// Creates a symlink between destinationPath and sourcePath (Windows version). /// @@ -343,8 +366,8 @@ public static void LinkFolders(string sourcePath, string destinationPath) CreateLinkMac(sourcePath, destinationPath); break; case (RuntimePlatform.LinuxEditor): - throw new System.NotImplementedException("LinkFolders: No linux support yet."); - //break; + CreateLinkLinux(sourcePath, destinationPath); + break; default: Debug.LogWarning("Not in a known editor. Application.platform: " + Application.platform); break; @@ -375,7 +398,7 @@ public static bool IsClone() isCloneFileExistCache = File.Exists(cloneFilePath); } - return (bool) isCloneFileExistCache; + return (bool)isCloneFileExistCache; } /// @@ -534,7 +557,7 @@ private static void CopyDirectoryWithProgressBarRecursive(DirectoryInfo source, copiedBytes += file.Length; /// Display the progress bar. - float progress = (float) copiedBytes / (float) totalBytes; + float progress = (float)copiedBytes / (float)totalBytes; bool cancelCopy = EditorUtility.DisplayCancelableProgressBar( progressBarPrefix + "Copying '" + source.FullName + "' to '" + destination.FullName + "'...", "(" + (progress * 100f).ToString("F2") + "%) Copying file '" + file.Name + "'...", @@ -623,11 +646,11 @@ private static void ExecuteBashCommand(string command) } } } - + public static void OpenProjectInFileExplorer(string path) - { - System.Diagnostics.Process.Start(@path); + { + System.Diagnostics.Process.Start(@path); } #endregion } -} \ No newline at end of file +} diff --git a/ParrelSync/Editor/ClonesManagerWindow.cs b/ParrelSync/Editor/ClonesManagerWindow.cs index a4ca805..4693367 100644 --- a/ParrelSync/Editor/ClonesManagerWindow.cs +++ b/ParrelSync/Editor/ClonesManagerWindow.cs @@ -34,19 +34,6 @@ private static void InitWindow() private void OnGUI() { - if (Application.platform == RuntimePlatform.LinuxEditor) - { - EditorGUILayout.HelpBox( - "Sorry, but " + ClonesManager.ProjectName + " doesn't support Linux currently.\n" + - "Please create a feature request on GitHub issue page if you want it to be added.", - MessageType.Info); - if (GUILayout.Button("Open GitHub issue Page")) - { - Application.OpenURL(ExternalLinks.GitHubIssue); - } - return; - } - /// If it is a clone project... if (ClonesManager.IsClone()) { diff --git a/ParrelSync/Editor/UpdateChecker.cs b/ParrelSync/Editor/UpdateChecker.cs index 2aa1493..3d3ab6d 100644 --- a/ParrelSync/Editor/UpdateChecker.cs +++ b/ParrelSync/Editor/UpdateChecker.cs @@ -10,7 +10,8 @@ namespace ParrelSync.Update /// public class UpdateChecker { - const string LocalVersionFilePath = "Assets/ParrelSync/VERSION.txt"; + //const string LocalVersionFilePath = "Assets/ParrelSync/VERSION.txt"; + public const string LocalVersion = "1.4.1"; [MenuItem("ParrelSync/Check for update", priority = 20)] static void CheckForUpdate() { @@ -18,8 +19,11 @@ static void CheckForUpdate() { try { - string localVersionText = AssetDatabase.LoadAssetAtPath(LocalVersionFilePath).text; - Debug.Log("Local version text : " + localVersionText); + //This won't work with UPM packages + //string localVersionText = AssetDatabase.LoadAssetAtPath(LocalVersionFilePath).text; + + string localVersionText = LocalVersion; + Debug.Log("Local version text : " + LocalVersion); string latesteVersionText = client.DownloadString(ExternalLinks.RemoteVersionURL); Debug.Log("latest version text got: " + latesteVersionText); @@ -48,11 +52,11 @@ static void CheckForUpdate() catch (Exception exp) { Debug.LogError("Error with checking update. Exception: " + exp); - EditorUtility.DisplayDialog("Update Error","Error with checking update. \nSee console fore more details.", + EditorUtility.DisplayDialog("Update Error","Error with checking update. \nSee console for more details.", "OK" ); } } } } -} \ No newline at end of file +} diff --git a/ParrelSync/package.json b/ParrelSync/package.json new file mode 100644 index 0000000..b35755c --- /dev/null +++ b/ParrelSync/package.json @@ -0,0 +1,10 @@ +{ + "name": "com.veriorpies.parrelsync", + "displayName": "ParrelSync", + "version": "1.4.1", + "unity": "2018.4", + "description": "ParrelSync is a Unity editor extension that allows users to test multiplayer gameplay without building the project by having another Unity editor window opened and mirror the changes from the original project.", + "license": "MIT", + "keywords": [ "Networking", "Utils", "Editor", "Extensions" ], + "dependencies": {} +} \ No newline at end of file diff --git a/ParrelSync/package.json.meta b/ParrelSync/package.json.meta new file mode 100644 index 0000000..4ced740 --- /dev/null +++ b/ParrelSync/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a2a889c264e34b47a7349cbcb2cbedd7 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/README.md b/README.md index 63a3be2..3aa4e99 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,37 @@ ParrelSync is a Unity editor extension that allows users to test multiplayer gam 3. Protected assets from being modified by other clone instances 4. Handy APIs to speed up testing workflows ## Installation + 1. Backup your project folder or use a version control system such as [Git](https://git-scm.com/) or [SVN](https://subversion.apache.org/) 2. Download .unitypackage from the [latest release](https://github.com/VeriorPies/ParrelSync/releases) and import it to your project. -3. Parrel Sync should appreared in the menu item bar after imported +3. ParrelSync should appreared in the menu item bar after imported ![UpdateButtonInMenu](https://github.com/VeriorPies/ParrelSync/raw/master/Images/AfterImported.png) Check out the [Installation-and-Update](https://github.com/VeriorPies/ParrelSync/wiki/Installation-and-Update) page for more details. +### UPM Package +ParrelSync can also be installed via UPM package. +After Unity 2019.3.4f1, Unity 2020.1a21, which support path query parameter of git package. You can install ParrelSync by adding the following to Package Manager. + +``` +https://github.com/VeriorPies/ParrelSync.git?path=/ParrelSync +``` + + +![UPM_Image](https://github.com/VeriorPies/ParrelSync/raw/master/Images/UPM_1.png?raw=true) ![UPM_Image2](https://github.com/VeriorPies/ParrelSync/raw/master/Images/UPM_2.png?raw=true) + +or by adding + +``` +"com.veriorpies.parrelsync": "https://github.com/VeriorPies/ParrelSync.git?path=/ParrelSync" +``` + +to the `Packages/manifest.json` file + ## Supported Platform -Currently, ParrelSync supports Windows and macOS editors. -Please create a [feature request](https://github.com/VeriorPies/ParrelSync/issues/new/choose) if you want Linux support to be added. +Currently, ParrelSync supports Windows, macOS and Linux editors. +Please create a [feature request](https://github.com/VeriorPies/ParrelSync/issues/new/choose) if you want support to be added. ParrelSync has been tested with the following Unity version. However, it should also work with other versions as well. * *2020.1.2f1*