예제 #1
0
 public static void RequestStatus(string assetPath, VCSettings.EReflectionLevel reflectionLevel)
 {
     if (VCSettings.VCEnabled)
     {
         VersionControlStatus assetStatus = VCCommands.Instance.GetAssetStatus(assetPath);
         if (assetStatus.assetPath != null)
         {
             if (reflectionLevel == VCSettings.EReflectionLevel.Remote && assetStatus.reflectionLevel != VCReflectionLevel.Pending && assetStatus.reflectionLevel != VCReflectionLevel.Repository)
             {
                 VCCommands.Instance.RequestStatus(assetStatus.assetPath.Compose(), StatusLevel.Remote);
             }
             else if (reflectionLevel == VCSettings.EReflectionLevel.Local && assetStatus.reflectionLevel == VCReflectionLevel.None)
             {
                 VCCommands.Instance.RequestStatus(assetStatus.assetPath.Compose(), StatusLevel.Previous);
             }
         }
     }
 }
예제 #2
0
        private static AssetMoveResult OnWillMoveAsset(string from, string to)
        {
            if (!UseTeamLicence)
            {
                return(AssetMoveResult.DidNotMove);
            }

            VersionControlStatus status = VCCommands.Instance.GetAssetStatus(from);

            if (VCUtility.ManagedByRepository(status))
            {
                if (DisplayConfirmationDialog("Move", from, status))
                {
                    string topUnversionedFolder;
                    if (InUnversionedParentFolder(to, out topUnversionedFolder))
                    {
                        int result = EditorUtility.DisplayDialogComplex("Add Folder?", "Versioned files are moved into an unversioned folder. Add following unversioned folder first?\n\n" + topUnversionedFolder, "Yes", "No", "Cancel");
                        if (result == 0)
                        {
                            VCCommands.Instance.Add(new[] { topUnversionedFolder });
                            VCCommands.Instance.Status(new[] { topUnversionedFolder }, StatusLevel.Local);
                        }
                        if (result == 2)
                        {
                            return(AssetMoveResult.FailedMove);
                        }
                    }
                    if (InUnversionedParentFolder(from, out topUnversionedFolder))
                    {
                        return(AssetMoveResult.DidNotMove);
                    }
                    if (VCCommands.Instance.Move(from, to))
                    {
                        DebugLog.Log("Version Control Move: " + from + " => " + to);
                        return(AssetMoveResult.DidMove);
                    }
                    return(AssetMoveResult.DidNotMove);
                }
                return(AssetMoveResult.FailedMove);
            }
            return(AssetMoveResult.DidNotMove);
        }
예제 #3
0
        private static void ReMoveAssetOnVC(string from, string to)
        {
            VersionControlStatus status = VCCommands.Instance.GetAssetStatus(from);
            string topUnversionedFolder;

            if (VCUtility.ManagedByRepository(status) && !InUnversionedParentFolder(from, out topUnversionedFolder))
            {
                if (DisplayConfirmationDialog("Move", from, status))
                {
                    if (InUnversionedParentFolder(to, out topUnversionedFolder))
                    {
                        string msg    = "Versioned files are moved into an unversioned folder. Add following unversioned folder first?\n\n" + topUnversionedFolder;
                        int    result = EditorUtility.DisplayDialogComplex("Add Folder?", msg, "Yes", "No", "Cancel");
                        if (result == 0)
                        {
                            MoveAssetBack(from, to);
                            VCCommands.Instance.Add(new[] { topUnversionedFolder });
                            VCCommands.Instance.Status(new[] { topUnversionedFolder }, StatusLevel.Local);
                        }
                        if (result == 1)
                        {
                            VCCommands.Instance.Delete(new[] { from }, OperationMode.Force);
                            return;
                        }
                        if (result == 2)
                        {
                            MoveAssetBack(from, to);
                            return;
                        }
                    }
                    else
                    {
                        MoveAssetBack(from, to);
                    }

                    VCCommands.Instance.Move(from, to);
                    AssetDatabase.Refresh();
                    GameObjectToAssetPathCache.ClearObjectToAssetPathCache();
                }
            }
        }
예제 #4
0
        private static bool DisplayConfirmationDialog(string command, string assetPath, VersionControlStatus assetStatus)
        {
            bool acceptOperation = true;

            if (assetStatus.lockStatus == VCLockStatus.LockedOther)
            {
                acceptOperation = EditorUtility.DisplayDialog(command + " on repository?", assetPath + "\nis " + Terminology.getlock + " by [" + assetStatus.owner + "], are you sure you want to " + command + "?", command, "Cancel");
            }
            if (acceptOperation && assetStatus.fileStatus == VCFileStatus.Modified)
            {
                acceptOperation = EditorUtility.DisplayDialog(command + " on repository?", assetPath + "\nFile is modified on repository, are you sure you want to " + command + "?", command, "Cancel");
            }
            return(acceptOperation);
        }
예제 #5
0
 public static bool ManagedByRepository(VersionControlStatus assetStatus)
 {
     return(assetStatus.fileStatus != VCFileStatus.Unversioned && !ComposedString.IsNullOrEmpty(assetStatus.assetPath) && !Application.isPlaying);
 }