Exemplo n.º 1
0
        void OnGUI()
        {
            UserSettings.Instance.CurrentBranchIndex = EditorGUILayout.Popup("Current Branch", getIndexOfCurrentBranch(), ProjectSettings.Instance.Branches.ToArray());

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

            foreach (Scene scene in ScenesManager.Instance.Scenes)
            {
                EditorGUILayout.BeginHorizontal();

                if (GUILayout.Button("GO"))
                {
                    ScenesManager.Instance.TryOpenScene(scene);
                }

                EditorGUILayout.LabelField(scene.Name);

                ScenesManager.SceneBlockedAtOtherBranchResponse sceneBlockedInOtherBranch = ScenesManager.Instance.IsSceneBlockedInOtherBranch(scene);
                if (sceneBlockedInOtherBranch.IsBlocked || (scene.Blocked && !scene.Owner.Equals(TrelloAPI.Instance.UserName)))
                {
                    GUI.enabled = false;
                }
                bool blocked = EditorGUILayout.Toggle(scene.Blocked);
                GUI.enabled = true;

                if (blocked != scene.Blocked)
                {
                    if (blocked)
                    {
                        tryToBlock(scene);
                    }
                    else
                    {
                        scene.FreeScene();
                    }
                }

                if (sceneBlockedInOtherBranch.IsBlocked)
                {
                    EditorGUILayout.LabelField("Blocked by " + sceneBlockedInOtherBranch.Scene.Owner + " at branch " + sceneBlockedInOtherBranch.BranchName);
                }
                else
                {
                    EditorGUILayout.LabelField(scene.Blocked ? ("Blocked by " + scene.Owner) : string.Empty);
                }


                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndScrollView();

            if (GUILayout.Button("Refresh Info"))
            {
                initInfo();
            }
        }
Exemplo n.º 2
0
 private void tryToBlock(Scene scene)
 {
     ScenesManager.SceneBlockedAtOtherBranchResponse response = ScenesManager.Instance.HasSceneBeenBlockedRecently(scene);
     if (response.IsBlocked)
     {
         EditorUtility.DisplayDialog("Error!", "Scene has been blocked by " + response.Scene.Owner + " at branch " + response.BranchName, "Ok");
     }
     else
     {
         scene.BlockScene();
     }
 }
Exemplo n.º 3
0
 private static void onSceneOpened(UnityEngine.SceneManagement.Scene scene, OpenSceneMode mode)
 {
     if (!BuildPipeline.isBuildingPlayer && ScenesManager.Instance.IsSceneBlockedByOtherMember(scene))
     {
         EditorUtility.DisplayDialog("Warning!", "This scene is blocked by " + ScenesManager.Instance.GetOwnerOf(scene), "Ok");
     }
     else
     {
         ScenesManager.SceneBlockedAtOtherBranchResponse sceneBlockedAtOtherBranch = ScenesManager.Instance.IsSceneBlockedInOtherBranch(scene);
         if (sceneBlockedAtOtherBranch.IsBlocked)
         {
             EditorUtility.DisplayDialog("Warning!", "This scene is blocked by " + sceneBlockedAtOtherBranch.Scene.Owner + " at branch " + sceneBlockedAtOtherBranch.BranchName, "Ok");
         }
     }
 }