Checkout() public static method

Checkout an asset or list of asset from the version control system.

public static Checkout ( Asset asset, CheckoutMode mode ) : Task
asset Asset Asset to checkout.
mode CheckoutMode Tell the Provider to checkout the asset, the .meta file or both.
return Task
示例#1
0
        public void OnGUI()
        {
            float num = (base.position.height - 122f) / 2f;

            GUILayout.Label("Some files could not be checked out:", EditorStyles.boldLabel, new GUILayoutOption[0]);
            Rect screenRect = new Rect(6f, 40f, base.position.width - 12f, num);

            GUILayout.BeginArea(screenRect);
            GUILayout.Box(string.Empty, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true),
                GUILayout.ExpandHeight(true)
            });
            GUILayout.EndArea();
            this.checkoutFailureList.OnGUI(new Rect(screenRect.x + 2f, screenRect.y + 2f, screenRect.width - 4f, screenRect.height - 4f), true);
            GUILayout.Space(20f + num);
            GUILayout.Label("The following files were successfully checked out:", EditorStyles.boldLabel, new GUILayoutOption[0]);
            Rect screenRect2 = new Rect(6f, 40f + num + 40f, base.position.width - 12f, num);

            GUILayout.BeginArea(screenRect2);
            GUILayout.Box(string.Empty, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true),
                GUILayout.ExpandHeight(true)
            });
            GUILayout.EndArea();
            this.checkoutSuccessList.OnGUI(new Rect(screenRect2.x + 2f, screenRect2.y + 2f, screenRect2.width - 4f, screenRect2.height - 4f), true);
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorUserSettings.showFailedCheckout = !GUILayout.Toggle(!EditorUserSettings.showFailedCheckout, "Don't show this window again.", new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            bool enabled = GUI.enabled;

            GUI.enabled = (this.checkoutFailureList.Size > 0);
            if (GUILayout.Button("Retry Check Out", new GUILayoutOption[0]))
            {
                Provider.Checkout(this.assetList, CheckoutMode.Exact);
            }
            GUI.enabled = (this.checkoutSuccessList.Size > 0);
            if (GUILayout.Button("Revert Unchanged", new GUILayoutOption[0]))
            {
                Provider.Revert(this.assetList, RevertMode.Unchanged).SetCompletionAction(CompletionAction.UpdatePendingWindow);
                Provider.Status(this.assetList);
                base.Close();
            }
            GUI.enabled = enabled;
            if (GUILayout.Button("OK", new GUILayoutOption[0]))
            {
                base.Close();
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(12f);
        }
        public void OnGUI()
        {
            float h = (position.height - 122) / 2;

            // TODO: Show the reason: Who has the exclusive lock?
            GUILayout.Label("Some files could not be checked out:", EditorStyles.boldLabel);

            Rect r1 = new Rect(6, 40, position.width - 12, h);

            GUILayout.BeginArea(r1);
            GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            GUILayout.EndArea();
            bool repaint = checkoutFailureList.OnGUI(new Rect(r1.x + 2, r1.y + 2, r1.width - 4, r1.height - 4), true);

            GUILayout.Space(20 + h);
            GUILayout.Label("The following files were successfully checked out:", EditorStyles.boldLabel);

            Rect r2 = new Rect(6, 40 + h + 40, position.width - 12, h);

            GUILayout.BeginArea(r2);
            GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            GUILayout.EndArea();
            repaint |= checkoutSuccessList.OnGUI(new Rect(r2.x + 2, r2.y + 2, r2.width - 4, r2.height - 4), true);

            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();

            EditorUserSettings.showFailedCheckout = !GUILayout.Toggle(!EditorUserSettings.showFailedCheckout, "Don't show this window again.");

            GUILayout.FlexibleSpace();

            bool enabled = GUI.enabled;

            GUI.enabled = checkoutFailureList.Size > 0;

            if (GUILayout.Button("Retry Check Out"))
            {
                Provider.Checkout(assetList, CheckoutMode.Exact);
            }

            GUI.enabled = checkoutSuccessList.Size > 0;

            if (GUILayout.Button("Revert Unchanged"))
            {
                Provider.Revert(assetList, RevertMode.Unchanged).SetCompletionAction(CompletionAction.UpdatePendingWindow);
                Provider.Status(assetList);
                Close();
            }

            GUI.enabled = enabled;

            if (GUILayout.Button("OK"))
            {
                Close();
            }

            GUILayout.EndHorizontal();
            GUILayout.Space(12);

            if (repaint)
            {
                Repaint();
            }
        }