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);
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            //base.OnInspectorGUI();
            GUIUtils.StartCustomEditor();
            EditorGUI.indentLevel++;
            GUIUtils.StartBox();
            GUIUtils.DrawProp(so["gizmoColor"], new GUIContent("Gizmo Color"));
            GUIUtils.Space();
            GUIUtils.DrawProp(so["behavior"], new GUIContent("Cue Behavior"));

            EditorProp repeats = so["repeats"];

            GUIUtils.DrawProp(repeats, new GUIContent("Repeats", "How Many times this cue repeats"));
            if (repeats.intValue < 1)
            {
                repeats.SetValue(1);
            }
            if (HasSubCues())
            {
                GUIUtils.DrawToggleProp(so["useRandomPlaylist"], new GUIContent("Use Random Sub-Cue", "Plays one sub-cue at random, not all sequentially"));
            }
            GUIUtils.EndBox();
            EditorGUI.indentLevel--;
            GUIUtils.EndCustomEditor(so);
        }
Exemplo n.º 3
0
 public static void DrawPacksErrors(string errors)
 {
     if (errors.IsEmpty())
     {
         return;
     }
     GUIUtils.StartBox();
     GUIUtils.HelpBox(errors, MessageType.Error);
     GUIUtils.EndBox();
 }
Exemplo n.º 4
0
        void DrawUpdateIDsButton()
        {
            AssetObjectPack displayPack = packsManager.packs[displayPackIndex];

            if (!displayPack.isCustom)
            {
                GUIUtils.StartBox();
                DrawGenIDsForPack(displayPack);
                GUIUtils.EndBox();
            }
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        void OnGUI()
        {
            GUIUtils.StartCustomEditor();
            GUIUtils.StartBox(0);

            GUIUtils.Tabs(outerTabs, ref outerTab);
            GUIUtils.EndBox(0);

            GUIUtils.StartBox(0);
            EditorGUILayout.BeginHorizontal();
            GUIUtils.Tabs(helpTabs[outerTab], ref innerTab, GUIUtils.FitContent.Largest, true, TextAnchor.MiddleLeft);
            EditorGUILayout.TextArea(helpTexts[outerTab][innerTab], GUIStyles.helpBox, windowHeight);
            EditorGUILayout.EndHorizontal();
            GUIUtils.EndBox(0);

            bool changed = GUIUtils.EndCustomEditorWindow();
        }
        void DrawElementsView(Vector2 mousePos, bool mouseUp,

                                                     // GUIContent pagesGUI,
                              out bool searchChanged //,
                                                     // out int pageOffset,
                              )
        {
            GUIUtils.StartBox(0);

            EditorGUILayout.BeginHorizontal();

            DrawMainElementsList(mousePos, mouseUp, out searchChanged);

            EditorGUILayout.EndHorizontal();

            GUIUtils.EndBox();

            //pagination gui
            // pageOffset = DrawPages(pagesGUI);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        bool DrawPackFields(EditorProp pack)
        {
            GUILayoutOption w = GUILayout.Width(100);

            bool changedVar = false;

            GUIUtils.StartBox(1);
            //name
            changedVar = GUIUtils.DrawTextProp(pack[nameField], new GUIContent("Pack Name"), GUIUtils.TextFieldType.Normal, false, "name", w) || changedVar;

            GUIUtils.DrawToggleProp(pack[isCustomField], new GUIContent("Custom Objects", "Does the pack consist of custom objects that arent represented by assets in the project?"), w);

            GUIUtils.Space();

            bool isCustom = pack[isCustomField].boolValue;

            if (!isCustom)
            {
                //asset type
                changedVar = CheckedVariable(pack[assetTypeField], new GUIContent("Asset Type", "The asset type or component the pack targets.\nMust inherit from UnityEngine.Object"), w) || changedVar;
                DrawHelpBox(pack[assetTypeField], IsValidTypeString, InvalidAssetTypeError);
                //directory
                changedVar = GUIUtils.DrawDirectoryField(pack[dirField], new GUIContent("Objects Directory", "The directory where the assets are held"), true, w) || changedVar;
                DrawHelpBox(pack[dirField], IsValidDirectory, InvalidDirectoryError);
                //file extensions
                changedVar = CheckedVariable(pack[extensionsField], new GUIContent("File Extensions", "The file extensions to look for in the directory, seperated by commas.\nExample: '.fbx, .wav, .mp3'"), w) || changedVar;
                DrawHelpBox(pack[extensionsField], FileExtensionValid, InvalidFileExtensionsError);
            }
            else
            {
                changedVar = CheckedVariable(pack[assetTypeField], new GUIContent("Icon Asset Type", "The asset type or component to use for the icon.\nMust inherit from UnityEngine.Object"), w) || changedVar;
                DrawHelpBox(pack[assetTypeField], IsValidTypeString, InvalidAssetTypeError);
            }
            GUIUtils.EndBox(1);
            return(changedVar);
        }
        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();
        }
Exemplo n.º 12
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();
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            bool isSmoothSnap = so[snapStyleField].enumValueIndex == (int)Cue.SnapPlayerStyle.Smooth;

            GUIUtils.StartCustomEditor();

            GUIUtils.StartBox(0);
            EditorGUILayout.BeginHorizontal();
            GUIUtils.Label(msgBlocksLabel);
            if (GUIUtils.SmallButton(new GUIContent("", "Paste"), Colors.green, Colors.black))
            {
                for (int i = 0; i < 4; i++)
                {
                    so[messageBlocksField][i].SetValue(copiedMessages[i]);
                }
            }
            if (GUIUtils.SmallButton(new GUIContent("", "Copy"), Colors.yellow, Colors.black))
            {
                for (int i = 0; i < 4; i++)
                {
                    copiedMessages[i] = so[messageBlocksField][i].stringValue;
                }
            }
            if (GUIUtils.SmallDeleteButton())
            {
                for (int i = 0; i < 4; i++)
                {
                    so[messageBlocksField][i].SetValue("");
                }
            }
            EditorGUILayout.EndHorizontal();
            GUIUtils.Tabs((isSmoothSnap ? 4 : 3).Generate(i => tabLbls[i]).ToArray(), ref currentMsgBlock);
            GUIUtils.DrawMultiLineExpandableString(so[messageBlocksField][currentMsgBlock], false, "mesage block", 50);
            GUIUtils.EndBox(1);


            GUIUtils.StartBox(1);
            EditorGUI.indentLevel++;
            GUIUtils.DrawEnumProp(
                so[snapStyleField], snapStyleGUI,
                (int i) => (Cue.SnapPlayerStyle)i,
                (System.Enum s) => (int)((Cue.SnapPlayerStyle)s)
                );

            if (isSmoothSnap)
            {
                EditorGUI.indentLevel++;
                GUIUtils.DrawProp(so[smoothPosTimeField], positionTimeGUI);
                GUIUtils.DrawProp(so[smoothRotTimeField], rotationTimeGUI);
                GUIUtils.DrawToggleProp(so[playImmediateField], playImmediateGUI);
                EditorGUI.indentLevel--;
            }

            GUIUtils.DrawProp(so[positionOffsetField], positionOffsetGUI);
            GUIUtils.DrawProp(so[rotationOffsetField], rotationOffsetGUI);
            GUIUtils.EndBox(1);

            GUIUtils.Space();
            EditorGUI.indentLevel--;
            GUIUtils.Label(new GUIContent("<b>The following variables wont be used if the cue has sub-cues:</b>"));
            EditorGUI.indentLevel++;

            GUIUtils.StartBox(1);
            GUIUtils.DrawProp(so[overrideDurationField], overrideDurationGUI);
            EditorGUI.indentLevel--;
            GUIUtils.Space();
            GUIUtils.DrawObjArrayProp <Event>(so[eventsField]);
            GUIUtils.EndBox(1);

            GUIUtils.EndCustomEditor(so);
        }