コード例 #1
0
        public static int DrawPages(GUIContent pagesGUI)
        {
            GUIUtils.StartBox();

            EditorGUILayout.BeginHorizontal();

            int r = 0;

            if (GUIUtils.Button(pageBackGUI, GUIStyles.toolbarButton, pageButtonWidth))
            {
                r = -1;
            }

            TextAnchor ol = GUIStyles.label.alignment;

            GUIStyles.label.alignment = TextAnchor.LowerCenter;
            GUIUtils.Label(pagesGUI);
            GUIStyles.label.alignment = ol;

            if (GUIUtils.Button(pageFwdGUI, GUIStyles.toolbarButton, pageButtonWidth))
            {
                r = 1;
            }

            EditorGUILayout.EndHorizontal();
            GUIUtils.EndBox();

            return(r);
        }
コード例 #2
0
 void DrawGenIDsForPack(AssetObjectPack pack)
 {
     if (GUIUtils.Button(new GUIContent("Update IDs in Directory"), GUIStyles.button, Colors.selected, Colors.black))
     {
         string msg = "Generating IDs will rename assets without IDs, are you sure?";
         if (EditorUtility.DisplayDialog("Generate IDs", msg, "Generate IDs", "Cancel"))
         {
             UpdateIDsForPack(pack);
         }
     }
 }
コード例 #3
0
        bool DrawPackParameters(EditorProp parameters)
        {
            bool anyChange = false;

            GUIUtils.StartBox();
            GUIUtils.Label(new GUIContent("<b>Asset Object Default Parameters:</b>"));
            GUIUtils.StartBox(Colors.darkGray);
            string dupName;

            if (parameters.ContainsDuplicateNames(out dupName))
            {
                GUIUtils.HelpBox(string.Format("\nMultiple parameters named:\n\t<i>'{0}'</i>\n", dupName), MessageType.Error);
            }
            GUIUtils.StartBox(1);
            int deleteParamIndex = -1;

            for (int i = 0; i < parameters.arraySize; i++)
            {
                UnityEngine.GUI.enabled = i != 0;
                EditorGUILayout.BeginHorizontal();
                if (GUIUtils.SmallDeleteButton())
                {
                    deleteParamIndex = i;
                }
                if (DrawPackParameter(parameters[i]))
                {
                    anyChange = true;
                }
                EditorGUILayout.EndHorizontal();
                UnityEngine.GUI.enabled = true;
            }
            if (deleteParamIndex >= 0)
            {
                parameters.DeleteAt(deleteParamIndex, "manual parameter delete");
                anyChange = true;
            }
            GUIUtils.BeginIndent();
            if (GUIUtils.Button(new GUIContent("Add Parameter"), GUIStyles.miniButton, Colors.green, Colors.black, true))
            {
                parameters.AddNew("New Parameter");
                anyChange = true;
            }
            GUIUtils.EndIndent();
            GUIUtils.EndBox(1);
            GUIUtils.EndBox();
            GUIUtils.EndBox();
            return(anyChange);
        }
コード例 #4
0
        bool DrawDeletePackButton()
        {
            bool delete = false;

            GUIUtils.StartBox(0);
            if (GUIUtils.Button(new GUIContent("Delete Pack"), GUIStyles.button, Colors.red, Colors.white))
            {
                if (EditorUtility.DisplayDialog("Delete Pack", "Are you sure you want to delete this pack?", "Delete Pack", "Cancel"))
                {
                    packs.DeleteAt(displayPackIndex, "Deleted pack");
                    delete = true;
                }
            }
            GUIUtils.EndBox(0);
            return(delete);
        }
コード例 #5
0
        bool DrawTopPackSelectionTabs(int packsSize)
        {
            GUIUtils.StartBox(1);

            EditorGUILayout.BeginHorizontal();
            if (packsSize != 0)
            {
                GUIContent[] tabGUIs = packsSize.Generate(i => new GUIContent(packs[i][nameField].stringValue)).ToArray();
                GUIUtils.Tabs(tabGUIs, ref displayPackIndex);
            }
            bool addedPack = false;

            if (GUIUtils.Button(new GUIContent("Add New Pack"), GUIStyles.toolbarButton, Colors.green, Colors.black))
            {
                AddNewPackToPacksList(packs);
                addedPack = true;
            }

            EditorGUILayout.EndHorizontal();
            GUIUtils.EndBox(1);
            return(addedPack);
        }
コード例 #6
0
        void OnGUI()
        {
            if (CloseIfError())
            {
                Close();
                return;
            }

            UnityEngine.Event inputEvent = UnityEngine.Event.current;

            bool mouseUp = inputEvent.rawType == EventType.MouseUp;

            GUIUtils.StartBox(1);

            GUI.backgroundColor = Colors.white;
            scrollPos           = EditorGUILayout.BeginScrollView(scrollPos);

            Vector2 mousePos = inputEvent.mousePosition;

            baseSystem.GetDirectoryTreeElement(0).DrawDirectoryTreeElement(mouseUp, mousePos);

            baseSystem.dragDropHandler.UpdateLoopReceiverOnly(mousePos);

            EditorGUILayout.EndScrollView();

            GUILayout.FlexibleSpace();

            if (GUIUtils.Button(closeGUI, GUIStyles.button, Colors.blue, Colors.black))
            {
                Close();
            }

            GUIUtils.EndBox(1);

            baseSystem.serializedObject.SaveObject();
        }
コード例 #7
0
ファイル: GUI.cs プロジェクト: tiredamage42/AssetObjectsPack
        void DrawButtonBase(Rect rect, bool drawSelected, bool drawBackground, bool guiEnabled, Color32 textColor, FontStyle fontStyle = FontStyle.Normal)
        {
            isShown = true;

            GUIStyle style = GUIStyles.toolbarButton;

            TextAnchor a  = style.alignment;
            Texture2D  t  = style.normal.background;
            Texture2D  th = style.active.background;

            style.fontStyle = fontStyle;

            style.normal.background = (!drawSelected && !drawBackground) ? null : t;
            style.active.background = (!drawSelected && !drawBackground) ? null : th;

            style.alignment = TextAnchor.MiddleLeft;

            Color32 txtColor = drawSelected ? Colors.black : textColor;

            GUI.enabled = guiEnabled;

            bool pressed = GUIUtils.Button(gui, style, Colors.Toggle(drawSelected), txtColor, rect);

            GUI.enabled = true;

            style.normal.background = t;
            style.active.background = th;

            style.alignment = a;
            style.fontStyle = FontStyle.Normal;

            if (pressed)
            {
                baseSystem.clickedElement = this;
            }
        }
コード例 #8
0
        public void OnGUI()
        {
            multiSetParameterIndex = -1;

            if (CloseIfError())
            {
                Close();
                return;
            }

            GUIUtils.StartBox(1);

            if (!selectionSystem.hasSelection)
            {
                GUIUtils.Label(noAOsGUI);
            }
            else
            {
                bool drawingSingle = selectionSystem.singleSelected;

                SelectionElement firstSelected = selectionSystem.firstSelected;

                EditorProp assetObjectProp = drawingSingle ? AOStateMachineEditor.GetAOatPoolID(currentState, firstSelected.refIndex) : multiEditAssetObjectProp;

                if (assetObjectProp == null)
                {
                    GUIUtils.Label(noAOsGUI);
                }
                else
                {
                    // GUIUtils.Label(drawingSingle ? new GUIContent("<b>" + firstSelected.path + "</b>") : selectEditGUI);
                    GUIUtils.Label(drawingSingle ? new GUIContent("<b>" + firstSelected.gui.text + "</b>") : selectEditGUI);

                    GUILayout.FlexibleSpace();

                    GUIUtils.BeginIndent();
                    DrawAOParameters(drawingSingle, assetObjectProp);
                    GUIUtils.EndIndent();

                    GUILayout.FlexibleSpace();

                    bool setMessages   = DrawMessaging(AOStateMachineEditor.messageBlocksField, sendMessagesGUI, assetObjectProp, drawingSingle);
                    bool setConditions = DrawMessaging(AOStateMachineEditor.conditionsBlockField, conditionsGUI, assetObjectProp, drawingSingle);

                    if (!drawingSingle)
                    {
                        if (multiSetParameterIndex != -1)
                        {
                            CopyParameters(
                                selectionSystem.GetReferenceIndiciesInSelectionOrAllShown(false).Generate(i => AOStateMachineEditor.GetAOatPoolID(currentState, i)),
                                multiEditAssetObjectProp,
                                multiSetParameterIndex
                                );
                        }
                        if (setMessages || setConditions)
                        {
                            CopyTextBlock(
                                selectionSystem.GetReferenceIndiciesInSelectionOrAllShown(false).Generate(i => AOStateMachineEditor.GetAOatPoolID(currentState, i)),
                                multiEditAssetObjectProp,
                                setMessages ? AOStateMachineEditor.messageBlocksField : AOStateMachineEditor.conditionsBlockField
                                );
                        }
                    }
                }
            }

            GUILayout.FlexibleSpace();
            if (GUIUtils.Button(closeGUI, GUIStyles.button, Colors.blue, Colors.black))
            {
                Close();
            }

            GUIUtils.EndBox(1);
            stateMachineEditor.so.SaveObject();
        }