示例#1
0
        private void UpdateEditorView()
        {
            IMGUIContainer inspector          = root.Q <IMGUIContainer>(UXMLNames.InspectorIMGUIWindow);
            Button         saveButton         = root.Q <Button>(UXMLNames.SaveButton);
            Button         deleteButton       = root.Q <Button>(UXMLNames.DeleteButton);
            VisualElement  warningIcon        = root.Q(UXMLNames.WarningIcon);
            VisualElement  createFirstEditor  = root.Q(UXMLNames.CreateFirstEditor);
            VisualElement  createNewEditor    = root.Q(UXMLNames.CreateNewEditor);
            VisualElement  assetPathContainer = root.Q(UXMLNames.AssetPathContainer);

            assetPathContainer?.DisplayShow();
            saveButton?.DisplayHide(); // saveButton.text = "Save";
            deleteButton?.DisplayHide();
            // deleteButton.text = "Delete";
            inspector?.DisplayHide();
            warningIcon?.DisplayHide();
            createFirstEditor?.DisplayHide();
            createNewEditor?.DisplayHide();

            if (deleteButton != null)
            {
                deleteButton.text = "Delete";
            }
            // Debug.Log(state);
            switch (state)
            {
            case CruddyAction.Uninitialized:
                saveButton.text = "Init in Folder";
                assetPathContainer?.DisplayHide();
                saveButton.DisplayShow();
                deleteButton.DisplayHide();
                break;

            case CruddyAction.BrowsingPath:
                assetPathContainer?.DisplayHide();
                saveButton.DisplayHide();
                deleteButton.DisplayHide();
                if (ActiveValues == null || ActiveValues?.Count == 0)
                {
                    createFirstEditor?.DisplayShow();
                }
                else
                {
                    createNewEditor.DisplayShow();
                }

                break;

            case CruddyAction.DefiningNewPathForType:
                assetPathContainer?.DisplayHide();
                saveButton.DisplayShow();
                if (saveButton != null)
                {
                    saveButton.text = "Init in Folder";
                }
                break;

            case CruddyAction.CloningAsset:
                inspector.DisplayShow();
                saveButton.DisplayShow();
                if (saveButton != null)
                {
                    saveButton.text = "Save as New";
                }
                deleteButton.DisplayShow();
                break;

            case CruddyAction.PendingDelete:
                inspector.DisplayShow();
                deleteButton.DisplayShow();
                warningIcon.DisplayShow();
                if (deleteButton != null)
                {
                    deleteButton.text = "Are you Sure?";
                }
                break;

            case CruddyAction.BrowsingAsset:
                inspector.DisplayShow();
                deleteButton.DisplayShow();
                saveButton.DisplayHide();
                break;

            case CruddyAction.PendingUpdate:
                inspector.DisplayShow();
                deleteButton.DisplayShow();
                saveButton.DisplayShow();
                warningIcon.DisplayShow();
                if (saveButton != null)
                {
                    saveButton.text = "Save\n(Overwrite)";
                }
                break;

            case CruddyAction.DefiningNewPathForTypeInitial:
                assetPathContainer?.DisplayHide();
                if (saveButton != null)
                {
                    saveButton.text = "Init in Folder";
                    saveButton.DisplayShow();
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }