public TrackSnapConnection ShowGUI(DragTrack ownTrack, int i)
 {
     connectedTrack = (DragTrack)CustomGUILayout.ObjectField <DragTrack> ("Connected track " + i + ":", connectedTrack, true, "", "A connected track that a draggable object can transfer to when positioned at this point.");
     if (connectedTrack)
     {
         if (connectedTrack == ownTrack)
         {
             ACDebug.LogWarning(ownTrack + " cannot connect to itself", connectedTrack);
             connectedTrack = null;
         }
         else if (connectedTrack.allTrackSnapData == null || connectedTrack.allTrackSnapData.Count == 0)
         {
             //EditorGUILayout.HelpBox ("Cannot connect to this track - no snap regions defined!", MessageType.Warning);
             ACDebug.LogWarning(ownTrack + " cannot connect to track " + connectedTrack + ", - no snap regions defined", connectedTrack);
             connectedTrack = null;
         }
         else if (!connectedTrack.TypeSupportsSnapConnections())
         {
             //EditorGUILayout.HelpBox ("This track type does not support connections.", MessageType.Warning);
             ACDebug.LogWarning(ownTrack + " cannot connect to track " + connectedTrack + ", - this track type does not support connections", connectedTrack);
             connectedTrack = null;
         }
     }
     return(this);
 }
Esempio n. 2
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuInput)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");
            if (source == MenuSource.AdventureCreator)
            {
                inputType = (AC_InputType)CustomGUILayout.EnumPopup("Input type:", inputType, apiPrefix + ".inputType", "What kind of characters can be entered in by the player");
                label     = EditorGUILayout.TextField("Default text:", label);
                if (inputType == AC_InputType.AlphaNumeric)
                {
                    allowSpaces = CustomGUILayout.Toggle("Allow spaces?", allowSpaces, apiPrefix + ".allowSpace", "If True, then spaces are recognised");
                }
                characterLimit = CustomGUILayout.IntField("Character limit:", characterLimit, apiPrefix + ".characterLimit", "The character limit on text that can be entered");

                                #if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_2018_3_OR_NEWER
                EditorGUILayout.HelpBox("For the character limit to be obeyed on Android and iOS, Unity 2018.3 or later must be used.", MessageType.Info);
                                #endif

                linkedButton     = CustomGUILayout.TextField("'Enter' key's linked Button:", linkedButton, apiPrefix + ".linkedPrefab", "The name of the MenuButton element that is synced with the 'Return' key when this element is active");
                requireSelection = CustomGUILayout.ToggleLeft("Require selection to accept input?", requireSelection, apiPrefix + ".requireSelection", "If True, then the element will need to be selected before it receives input");
            }
            else
            {
                uiInput = LinkedUiGUI <InputField> (uiInput, "Linked InputField:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Esempio n. 3
0
        public static ActionListAsset AssetGUI(string label, ActionListAsset actionListAsset, string api = "", string defaultName = "")
        {
            EditorGUILayout.BeginHorizontal();
            actionListAsset = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> (label, actionListAsset, false, api);

            if (actionListAsset == null)
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                {
                                        #if !(UNITY_WP8 || UNITY_WINRT)
                    defaultName = System.Text.RegularExpressions.Regex.Replace(defaultName, "[^\\w\\_]", "");
                                        #else
                    defaultName = "";
                                        #endif

                    if (defaultName != "")
                    {
                        actionListAsset = ActionListAssetMenu.CreateAsset(defaultName);
                    }
                    else
                    {
                        actionListAsset = ActionListAssetMenu.CreateAsset();
                    }
                }
            }

            EditorGUILayout.EndHorizontal();
            return(actionListAsset);
        }
Esempio n. 4
0
        private void ShowNodeCommandGUI(Paths _target, int i)
        {
            if (_target.nodeCommands.Count > i)
            {
                if (_target.commandSource == ActionListSource.InScene)
                {
                    _target.nodeCommands[i].cutscene = ActionListAssetMenu.CutsceneGUI("Cutscene on reach:", _target.nodeCommands[i].cutscene, _target.name + "_OnReachNode_" + i.ToString(), "", "The Cutscene to run when the node is reached");

                    if (_target.nodeCommands[i].cutscene != null && _target.nodeCommands[i].cutscene.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].cutscene.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
                else
                {
                    _target.nodeCommands[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList on reach:", _target.nodeCommands[i].actionListAsset, _target.name + "_OnReachNode_" + i.ToString(), "", "The ActionList asset to run when the node is reached");

                    if (_target.nodeCommands[i].actionListAsset != null && _target.nodeCommands[i].actionListAsset.NumParameters > 0)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].actionListAsset.DefaultParameters, _target.nodeCommands[i].parameterID);
                    }
                }

                if ((_target.commandSource == ActionListSource.InScene && _target.nodeCommands[i].cutscene != null) ||
                    (_target.commandSource == ActionListSource.AssetFile && _target.nodeCommands[i].actionListAsset != null))
                {
                    _target.nodeCommands[i].pausesCharacter = CustomGUILayout.Toggle("Character waits during?", _target.nodeCommands[i].pausesCharacter, string.Empty, "If True, then the character moving along the path will stop moving while the cutscene is run");
                }
            }
        }
Esempio n. 5
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source == MenuSource.AdventureCreator)
            {
                GetCursorGUI();
                displayType = (AC_DisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");

                if (displayType != AC_DisplayType.TextOnly)
                {
                    overrideTexture = CustomGUILayout.Toggle("Override icon texture?", overrideTexture, apiPrefix + ".overrideTexture");
                }
            }
            else
            {
                uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
                uiPointerState        = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                displayType = (AC_DisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");
                GetCursorGUI();
            }
            alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton");
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
        private void ShowColumnsGUI()
        {
            string[] languagesArray = speechManager.languages.ToArray();

            EditorGUILayout.LabelField("Define columns", CustomStyles.subHeader);
            EditorGUILayout.Space();
            for (int i = 0; i < exportColumns.Count; i++)
            {
                CustomGUILayout.BeginVertical();

                EditorGUILayout.BeginHorizontal();
                exportColumns[i].ShowFieldSelector(i);

                if (GUILayout.Button("", CustomStyles.IconCog))
                {
                    SideMenu(i);
                }
                EditorGUILayout.EndHorizontal();

                exportColumns[i].ShowLanguageSelector(languagesArray);

                CustomGUILayout.EndVertical();
            }

            EditorGUILayout.Space();
            if (GUILayout.Button("Add new column"))
            {
                exportColumns.Add(new ExportColumn());
            }

            EditorGUILayout.Space();
        }
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuGraphic)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source != MenuSource.AdventureCreator)
            {
                uiImageType = (UIImageType)EditorGUILayout.EnumPopup(new GUIContent("UI image type:", "The type of UI component to link to"), uiImageType);
                if (uiImageType == UIImageType.Image)
                {
                    uiImage = LinkedUiGUI <Image> (uiImage, "Linked Image:", source);
                }
                else if (uiImageType == UIImageType.RawImage)
                {
                    uiRawImage = LinkedUiGUI <RawImage> (uiRawImage, "Linked Raw Image:", source);
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            graphicType = (AC_GraphicType)CustomGUILayout.EnumPopup("Graphic type:", graphicType, apiPrefix + ".graphicType", "The type of graphic that is shown");
            if (graphicType == AC_GraphicType.Normal)
            {
                graphic.ShowGUI(false, false, "Texture:", CursorRendering.Software, apiPrefix + ".graphic", "The texture to display");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Esempio n. 8
0
        private void UnhandledInvInteractionGUI()
        {
            CustomGUILayout.BeginVertical();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Unhandled Inventory interaction", EditorStyles.boldLabel);

            if (!_target.provideUnhandledInvInteraction)
            {
                if (GUILayout.Button(addContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Create unhandled inventory interaction");
                    _target.provideUnhandledInvInteraction = true;
                }
            }
            else
            {
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Delete unhandled inventory interaction");
                    _target.provideUnhandledInvInteraction = false;
                }
            }
            EditorGUILayout.EndHorizontal();

            if (_target.provideUnhandledInvInteraction)
            {
                EditorGUILayout.Space();
                ButtonGUI(_target.unhandledInvButton, "Unhandled inventory", _target.interactionSource, true);
                EditorGUILayout.HelpBox("This interaction will override any 'unhandled' ones defined in the Inventory Manager.", MessageType.Info);
            }

            CustomGUILayout.EndVertical();
        }
Esempio n. 9
0
        public void ShowGUI()
        {
            CustomGUILayout.MultiLineLabelGUI("Scene number:", sceneNumber.ToString());
            CustomGUILayout.MultiLineLabelGUI("Active NavMesh:", navMesh.ToString());
            CustomGUILayout.MultiLineLabelGUI("Default PlayerStart:", playerStart.ToString());
            CustomGUILayout.MultiLineLabelGUI("Default SortingMap:", sortingMap.ToString());
            CustomGUILayout.MultiLineLabelGUI("Default TintMap:", tintMap.ToString());
            CustomGUILayout.MultiLineLabelGUI("OnStart cutscene:", onStartCutscene.ToString());
            CustomGUILayout.MultiLineLabelGUI("OnLoadCutscene:", onLoadCutscene.ToString());

            EditorGUILayout.LabelField("Remember data:");
            if (allScriptData != null && allScriptData.Count > 0)
            {
                foreach (ScriptData scriptData in allScriptData)
                {
                    RememberData rememberData = SaveSystem.FileFormatHandler.DeserializeObject <RememberData> (scriptData.data);
                    if (rememberData != null)
                    {
                        CustomGUILayout.MultiLineLabelGUI("   " + rememberData.GetType().ToString() + ":", EditorJsonUtility.ToJson(rememberData, true));
                    }
                }
            }

            if (allTransformData != null && allTransformData.Count > 0)
            {
                foreach (TransformData transformData in allTransformData)
                {
                    CustomGUILayout.MultiLineLabelGUI("   " + transformData.GetType().ToString() + ":", EditorJsonUtility.ToJson(transformData, true));
                }
            }

            CustomGUILayout.MultiLineLabelGUI("Active ActionLists:", activeLists.ToString());
            CustomGUILayout.MultiLineLabelGUI("Local Variables:", localVariablesData);
        }
Esempio n. 10
0
        private void LookInteractionGUI()
        {
            CustomGUILayout.BeginVertical();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Examine interaction", EditorStyles.boldLabel);

            if (!_target.provideLookInteraction)
            {
                if (GUILayout.Button(addContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Create examine interaction");
                    _target.provideLookInteraction = true;
                }
            }
            else
            {
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Delete examine interaction");
                    _target.provideLookInteraction = false;
                }
            }

            EditorGUILayout.EndHorizontal();
            if (_target.provideLookInteraction)
            {
                ButtonGUI(_target.lookButton, "Examine", _target.interactionSource);
            }
            CustomGUILayout.EndVertical();
        }
Esempio n. 11
0
        private void UnhandledUseInteractionGUI()
        {
            CustomGUILayout.BeginVertical();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Unhandled Use interaction", EditorStyles.boldLabel);

            if (!_target.provideUnhandledUseInteraction)
            {
                if (GUILayout.Button(addContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Create unhandled use interaction");
                    _target.provideUnhandledUseInteraction = true;
                }
            }
            else
            {
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Delete unhandled use interaction");
                    _target.provideUnhandledUseInteraction = false;
                }
            }
            EditorGUILayout.EndHorizontal();

            if (_target.provideUnhandledUseInteraction)
            {
                EditorGUILayout.Space();
                ButtonGUI(_target.unhandledUseButton, "Unhandled use", _target.interactionSource, false);
                EditorGUILayout.HelpBox("If the Interaction field is empty, the Cursor Manager's 'Unhandled interaction' asset file will be run following the Player action.", MessageType.Info);
            }

            CustomGUILayout.EndVertical();
        }
Esempio n. 12
0
        public override void OnInspectorGUI()
        {
            Highlight _target = (Highlight)target;

            _target.highlightWhenSelected = CustomGUILayout.ToggleLeft("Enable when associated Hotspot is selected?", _target.highlightWhenSelected, "", "If True, then the Highlight effect will be enabled automatically when the Hotspot is selected");
            _target.brightenMaterials     = CustomGUILayout.ToggleLeft("Auto-brighten materials when enabled?", _target.brightenMaterials, "", "If True, then Materials associated with the GameObject's Renderer will be affected. Otherwise, their intended values will be calculated, but not applied, allowing for custom effects to be achieved");
            if (_target.brightenMaterials)
            {
                _target.affectChildren = CustomGUILayout.ToggleLeft("Also affect child Renderer components?", _target.affectChildren, "", "If True, then child Renderer GameObjects will be brightened as well");
            }
            _target.maxHighlight  = CustomGUILayout.Slider("Maximum highlight intensity:", _target.maxHighlight, 1f, 5f, "", "The maximum highlight intensity (1 = no effect)");
            _target.fadeTime      = CustomGUILayout.Slider("Transition time (s):", _target.fadeTime, 0f, 5f, "", "The fade time for the highlight transition effect");
            _target.flashHoldTime = CustomGUILayout.Slider("Flash hold time (s)", _target.flashHoldTime, 0f, 5f, "", "The length of time that a flash will hold for");

            _target.callEvents = CustomGUILayout.ToggleLeft("Call custom events?", _target.callEvents, "", "If True, then custom events can be called when highlighting the object");
            if (_target.callEvents)
            {
                this.serializedObject.Update();
                EditorGUILayout.PropertyField(this.serializedObject.FindProperty("onHighlightOn"), true);
                EditorGUILayout.PropertyField(this.serializedObject.FindProperty("onHighlightOff"), true);
                this.serializedObject.ApplyModifiedProperties();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Esempio n. 13
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuInteraction)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source == MenuSource.AdventureCreator)
            {
                GetCursorGUI();
                displayType = (AC_DisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How interactions are displayed");

                if (displayType != AC_DisplayType.TextOnly)
                {
                    overrideTexture = CustomGUILayout.Toggle("Override icon texture?", overrideTexture, apiPrefix + ".overrideTexture", "If True, the element's texture can be set independently of the associated interaction icon set within the Cursor Manager");
                }
            }
            else
            {
                uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source, "The Unity UI Button this is linked to");
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible");
                uiPointerState        = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState", "What pointer state registers as a 'click' for Unity UI Menus");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                displayType = (AC_DisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How interactions are displayed");
                GetCursorGUI();
            }
            alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton", "The name of the input button that triggers the element when pressed");
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
        protected void OnGUI()
        {
            if (AdvGame.GetReferences().settingsManager == null)
            {
                EditorGUILayout.HelpBox ("A Settings Manager must be assigned before this window can display correctly.", MessageType.Warning);
                return;
            }

            if (KickStarter.settingsManager)
            {
                EditorGUILayout.BeginVertical (CustomStyles.thinBox);
                showOptions = CustomGUILayout.ToggleHeader (showOptions, "Ambience settings");
                if (showOptions)
                {
                    KickStarter.settingsManager.playAmbienceWhilePaused = CustomGUILayout.ToggleLeft ("Can play when game is paused?", KickStarter.settingsManager.playAmbienceWhilePaused, "AC.KickStarter.settingsManager.playAmbienceWhilePaused", "If True, then ambience can play when the game is paused");
                    KickStarter.settingsManager.loadAmbienceFadeTime = CustomGUILayout.Slider ("Fade time after loading:", KickStarter.settingsManager.loadAmbienceFadeTime, 0f, 5f, "AC.KickStarter.settingsManager.loadAmbienceFadeTime", "The fade-in duration when resuming ambience audio after loading a save game");
                    if (KickStarter.settingsManager.loadAmbienceFadeTime > 0f)
                    {
                        KickStarter.settingsManager.crossfadeAmbienceWhenLoading = CustomGUILayout.ToggleLeft ("Crossfade after loading?", KickStarter.settingsManager.crossfadeAmbienceWhenLoading, "AC.KickStarter.settingsManager.crossfadeAmbienceWhenLoading", "If True, previously-playing ambience audio will be crossfaded out upon loading");
                    }
                    KickStarter.settingsManager.restartAmbienceTrackWhenLoading = CustomGUILayout.ToggleLeft ("Restart track after loading?", KickStarter.settingsManager.restartAmbienceTrackWhenLoading, "AC.KickStarter.settingsManager.restartAmbienceTrackWhenLoading", "If True, then the ambience track at the time of saving will be resumed from the start upon loading");

                    if (GUI.changed)
                    {
                        EditorUtility.SetDirty (KickStarter.settingsManager);
                    }
                }

                EditorGUILayout.Space ();
                CustomGUILayout.EndVertical ();
            }

            SharedGUI("Ambience tracks");
        }
Esempio n. 15
0
        private void ShowCustomGUI()
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showCustom = CustomGUILayout.ToggleHeader(showCustom, "Custom Action scripts");
            if (showCustom)
            {
                for (int i = 0; i < customFolderPaths.Count; i++)
                {
                    customFolderPaths[i] = ShowCustomFolderGUI(i);
                }

                int lastIndex = customFolderPaths.Count - 1;
                if (lastIndex >= 0)
                {
                    int lastButOneIndex = lastIndex - 1;

                    if (!string.IsNullOrEmpty(customFolderPaths[lastIndex]))
                    {
                        customFolderPaths.Add(string.Empty);
                    }
                    else if (lastButOneIndex >= 0 && string.IsNullOrEmpty(customFolderPaths[lastButOneIndex]))
                    {
                        customFolderPaths.RemoveAt(lastIndex);
                    }
                }
            }
            EditorGUILayout.EndVertical();
        }
Esempio n. 16
0
        public override void OnInspectorGUI()
        {
            _target = (Variables)target;

            ShowSettings();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showVariablesList = CustomGUILayout.ToggleHeader(showVariablesList, "Component variables");
            if (showVariablesList)
            {
                selectedVar = VariablesManager.ShowVarList(selectedVar, _target.vars, VariableLocation.Component, varFilter, _target.filter, typeFilter, !Application.isPlaying, _target);
            }
            CustomGUILayout.EndVertical();

            if (selectedVar != null && !_target.vars.Contains(selectedVar))
            {
                selectedVar = null;
            }

            if (selectedVar != null)
            {
                EditorGUILayout.Space();
                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                showProperties = CustomGUILayout.ToggleHeader(showProperties, "Variable '" + selectedVar.label + "' properties");
                if (showProperties)
                {
                    VariablesManager.ShowVarGUI(selectedVar, VariableLocation.Component, !Application.isPlaying, null, string.Empty, _target);
                }
                CustomGUILayout.EndVertical();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Esempio n. 17
0
        private void BinsGUI()
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            EditorGUILayout.LabelField("Categories", CustomStyles.subHeader);
            EditorGUILayout.Space();

            foreach (InvBin bin in bins)
            {
                EditorGUILayout.BeginHorizontal();

                bin.label = CustomGUILayout.TextField("", bin.label, "AC.KickStarter.inventoryManager.GetCategory (" + bin.id + ").label");

                if (GUILayout.Button(deleteContent, EditorStyles.miniButton, GUILayout.MaxWidth(20f)))
                {
                    Undo.RecordObject(this, "Delete category: " + bin.label);
                    bins.Remove(bin);
                    break;
                }
                EditorGUILayout.EndHorizontal();
            }
            if (GUILayout.Button("Create new category"))
            {
                Undo.RecordObject(this, "Add category");
                List <int> idArray = new List <int>();
                foreach (InvBin bin in bins)
                {
                    idArray.Add(bin.id);
                }
                idArray.Sort();
                bins.Add(new InvBin(idArray.ToArray()));
            }

            EditorGUILayout.EndVertical();
        }
Esempio n. 18
0
 public TrackSnapData ShowGUI(bool useAngles)
 {
     positionAlong = CustomGUILayout.Slider("Snap to " + ((useAngles) ? "angle" : "position:"), positionAlong, 0f, 1f, "", "How far along the track (as a decimal) to snap to.");
     width         = CustomGUILayout.Slider("Catchment size:", width, 0f, 1f, "", "How far apart from the snapping point (as a decimal of the track's length) the object can be for this to be enforced.");
     gizmoColor    = CustomGUILayout.ColorField("Editor colour:", gizmoColor, "", "What colour to draw handles in the Scene with.");
     return(this);
 }
Esempio n. 19
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");
            if (source == MenuSource.AdventureCreator)
            {
                inputType = (AC_InputType)CustomGUILayout.EnumPopup("Input type:", inputType, apiPrefix + ".inputType");
                label     = EditorGUILayout.TextField("Default text:", label);
                if (inputType == AC_InputType.AlphaNumeric)
                {
                    allowSpaces = CustomGUILayout.Toggle("Allow spaces?", allowSpaces, apiPrefix + ".allowSpace");
                }
                characterLimit = CustomGUILayout.IntField("Character limit:", characterLimit, apiPrefix + ".characterLimit");

                linkedButton = CustomGUILayout.TextField("'Enter' key's linked Button:", linkedButton, apiPrefix + ".linkedPrefab");
            }
            else
            {
                uiInput = LinkedUiGUI <InputField> (uiInput, "Linked InputField:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Esempio n. 20
0
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

            if (KickStarter.sceneSettings != null && KickStarter.sceneSettings.defaultPlayerStart == _target)
            {
                EditorGUILayout.HelpBox("This PlayerStart is the scene's default, and will be used if a more appropriate one is not found.", MessageType.Info);
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Previous scene that activates", EditorStyles.boldLabel);
            _target.chooseSceneBy = (ChooseSceneBy)CustomGUILayout.EnumPopup("Choose scene by:", _target.chooseSceneBy, "", "The way in which the previous scene is identified by");
            if (_target.chooseSceneBy == ChooseSceneBy.Name)
            {
                _target.previousSceneName = CustomGUILayout.TextField("Previous scene:", _target.previousSceneName, "", "The name of the previous scene to check for");
            }
            else
            {
                _target.previousScene = CustomGUILayout.IntField("Previous scene:", _target.previousScene, "", "The build-index number of the previous scene to check for");
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Camera settings", EditorStyles.boldLabel);
            _target.cameraOnStart = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Camera on start:", _target.cameraOnStart, true, "", "The AC _Camera that should be made active when the Player starts the scene from this point");
            _target.fadeInOnStart = CustomGUILayout.Toggle("Fade in on start?", _target.fadeInOnStart, "", "If True, then the MainCamera will fade in when the Player starts the scene from this point");
            if (_target.fadeInOnStart)
            {
                _target.fadeSpeed = CustomGUILayout.FloatField("Fade speed:", _target.fadeSpeed, "", "The speed of the fade");
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Esempio n. 21
0
        private void ShowActionTypeGUI()
        {
            if (selectedClass == null)
            {
                return;
            }

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showActionType = CustomGUILayout.ToggleHeader(showActionType, selectedClass.GetFullTitle());
            if (showActionType)
            {
                SpeechLine.ShowField("Name:", selectedClass.GetFullTitle(), false);
                SpeechLine.ShowField("Filename:", selectedClass.fileName + ".cs", false);
                SpeechLine.ShowField("Description:", selectedClass.description, true);

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Node colour:", GUILayout.Width(85f));
                selectedClass.color = EditorGUILayout.ColorField(selectedClass.color);
                EditorGUILayout.EndHorizontal();

                if (!string.IsNullOrEmpty(defaultClassName) && selectedClass.fileName == defaultClassName)
                {
                    EditorGUILayout.HelpBox("This is marked as the default Action", MessageType.Info);
                }
                else
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Is enabled?", GUILayout.Width(85f));
                    selectedClass.isEnabled = EditorGUILayout.Toggle(selectedClass.isEnabled);
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndVertical();
        }
Esempio n. 22
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuTimer)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            timerType = (AC_TimerType)CustomGUILayout.EnumPopup("Timer type:", timerType, apiPrefix + ".timerType");
            if (timerType == AC_TimerType.LoadingProgress && AdvGame.GetReferences().settingsManager != null && !AdvGame.GetReferences().settingsManager.useAsyncLoading)
            {
                EditorGUILayout.HelpBox("Loading progress cannot be displayed unless asynchonised loading is enabled within the Settings Manager.", MessageType.Warning);
            }
            doInvert = CustomGUILayout.Toggle("Invert value?", doInvert, apiPrefix + ".doInvert");

            if (source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Timer texture:", GUILayout.Width(145f));
                timerTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (timerTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".timerTexture");
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
            }
            EditorGUILayout.EndVertical();

            if (source == MenuSource.AdventureCreator)
            {
                EndGUI(apiPrefix);
            }
        }
Esempio n. 23
0
        public void ShowGUI(string apiPrefix)
        {
            label = CustomGUILayout.TextField("Label:", label, apiPrefix + ".label");
            if (labelLineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", labelLineID.ToString());
            }

            if (ID >= 2)
            {
                stateType = (ObjectiveStateType)CustomGUILayout.EnumPopup("State type:", stateType, apiPrefix + ".stateType");
            }
            else
            {
                EditorGUILayout.LabelField("State type: " + stateType.ToString());
            }

            EditorGUILayout.BeginHorizontal();
            CustomGUILayout.LabelField("Description:", GUILayout.Width(140f), apiPrefix + ".description");
            EditorStyles.textField.wordWrap = true;
            description = CustomGUILayout.TextArea(description, GUILayout.MaxWidth(800f), apiPrefix + ".description");
            EditorGUILayout.EndHorizontal();
            if (descriptionLineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", descriptionLineID.ToString());
            }
        }
        public override void OnInspectorGUI()
        {
            FootstepSounds _target = (FootstepSounds)target;

            EditorGUILayout.Space();
            _target.footstepSounds = ShowClipsGUI(_target.footstepSounds, "Walking sounds");
            EditorGUILayout.Space();
            _target.runSounds = ShowClipsGUI(_target.runSounds, "Running sounds (optional)");
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            _target.character = (Char)CustomGUILayout.ObjectField <Char> ("Character:", _target.character, true, "", "The Player or NPC that this component is for");
            if (_target.doGroundedCheck)
            {
                _target.doGroundedCheck = CustomGUILayout.ToggleLeft("Only play when grounded?", _target.doGroundedCheck, "", "If True, sounds will only play when the character is grounded");
            }
            _target.soundToPlayFrom = (Sound)CustomGUILayout.ObjectField <Sound> ("Sound to play from:", _target.soundToPlayFrom, true, "", "The Sound object to play from");

            _target.footstepPlayMethod = (FootstepSounds.FootstepPlayMethod)CustomGUILayout.EnumPopup("Play sounds:", _target.footstepPlayMethod, "", "How the sounds are played");
            if (_target.footstepPlayMethod == FootstepSounds.FootstepPlayMethod.Automatically)
            {
                _target.walkSeparationTime = CustomGUILayout.FloatField("Walking separation time (s):", _target.walkSeparationTime, "", "The separation time between sounds when walking");
                _target.runSeparationTime  = CustomGUILayout.FloatField("Running separation time (s):", _target.runSeparationTime, "", "The separation time between sounds when running");
            }
            else if (_target.footstepPlayMethod == FootstepSounds.FootstepPlayMethod.ViaAnimationEvents)
            {
                EditorGUILayout.HelpBox("A sound will be played whenever this component's PlayFootstep function is run. This component should be placed on the same GameObject as the Animator.", MessageType.Info);
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            DragTrack_Hinge _target = (DragTrack_Hinge)target;

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Track shape:", EditorStyles.boldLabel);

            _target.radius       = CustomGUILayout.FloatField("Radius:", _target.radius, "", "The track's radius (for visualising in the Scene window)");
            _target.handleColour = CustomGUILayout.ColorField("Handles colour:", _target.handleColour, "", "The colour of Scene window Handles");

            _target.doLoop = CustomGUILayout.Toggle("Is looped?", _target.doLoop, "", "If True, then objects can be rotated a full revolution");
            if (!_target.doLoop)
            {
                _target.maxAngle = CustomGUILayout.FloatField("Maximum angle:", _target.maxAngle, "", "How much an object can be rotated by");

                if (_target.maxAngle > 360f)
                {
                    _target.maxAngle = 360f;
                }
            }
            else
            {
                _target.limitRevolutions = CustomGUILayout.Toggle("Limit revolutions?", _target.limitRevolutions, "", "If True, then the number of revolutions an object can rotate is limited");
                if (_target.limitRevolutions)
                {
                    _target.maxRevolutions = CustomGUILayout.IntField("Max revolutions:", _target.maxRevolutions, "", "The maximum number of revolutions an object can be rotated by");
                }
            }

            _target.alignDragToFront = CustomGUILayout.Toggle("Align drag vector to front?", _target.alignDragToFront, "", "If True, then the calculated drag vector will be based on the track's orientation, rather than the object being rotated, so that the input drag vector will always need to be the same direction");

            EditorGUILayout.EndVertical();

            SharedGUI(false);
        }
Esempio n. 26
0
        public override void OnInspectorGUI()
        {
            DragTrack_Curved _target = (DragTrack_Curved)target;

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Track shape:", EditorStyles.boldLabel);

            _target.radius       = CustomGUILayout.FloatField("Radius:", _target.radius, "", "The track's radius");
            _target.handleColour = CustomGUILayout.ColorField("Handles colour:", _target.handleColour, "", "The colour of Scene window Handles");

            _target.doLoop = CustomGUILayout.Toggle("Is looped?", _target.doLoop, "", "If True, then the track forms a complete loop");
            if (!_target.doLoop)
            {
                _target.maxAngle = CustomGUILayout.FloatField("Maximum angle:", _target.maxAngle, "", "The angle of the tracks's curve");

                if (_target.maxAngle > 360f)
                {
                    _target.maxAngle = 360f;
                }
            }

            EditorGUILayout.EndVertical();

            SharedGUI(true);
        }
Esempio n. 27
0
        public void ShowStartDataGUI(string apiPrefix)
        {
            GUILayout.Label("Starting point data for Player " + ID.ToString() + ": " + ((playerOb != null) ? playerOb.name : "(EMPTY)"), EditorStyles.boldLabel);

            chooseSceneBy = (ChooseSceneBy)CustomGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
            switch (chooseSceneBy)
            {
            case ChooseSceneBy.Name:
                startingSceneName = CustomGUILayout.TextField("Scene name:", startingSceneName);
                break;

            case ChooseSceneBy.Number:
                startingSceneIndex = CustomGUILayout.IntField("Scene index:", startingSceneIndex);
                break;
            }

            useSceneDefaultPlayerStart = EditorGUILayout.Toggle("Use default PlayerStart?", useSceneDefaultPlayerStart);
            if (!useSceneDefaultPlayerStart)
            {
                PlayerStart playerStart = ConstantID.GetComponent <PlayerStart> (startingPlayerStartID);
                playerStart           = (PlayerStart)CustomGUILayout.ObjectField <PlayerStart> ("PlayerStart:", playerStart, true, apiPrefix + ".startingPlayerStartID", "The PlayerStart that this character starts from.");
                startingPlayerStartID = FieldToID <PlayerStart> (playerStart, startingPlayerStartID);

                if (startingPlayerStartID != 0)
                {
                    EditorGUILayout.BeginVertical("Button");
                    EditorGUILayout.LabelField("Recorded ConstantID: " + startingPlayerStartID.ToString(), EditorStyles.miniLabel);
                    EditorGUILayout.EndVertical();
                }
            }
        }
Esempio n. 28
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuDrag)";

            MenuSource source = menu.menuSource;

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.HelpBox("This Element type is not necessary in Unity's UI, as it can be recreated using ScrollBars and ScrollRects.", MessageType.Info);
                return;
            }

            EditorGUILayout.BeginVertical("Button");
            label       = CustomGUILayout.TextField("Button text:", label, apiPrefix + ".label", "The text that's displayed on-screen");
            anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor", "The text alignment");
            textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects", "The special FX applied to the text");

            dragType = (DragElementType)CustomGUILayout.EnumPopup("Drag type:", dragType, apiPrefix + ".dragType", "What the MenuDrag can be used to move");
            if (dragType == DragElementType.SingleElement)
            {
                elementName = CustomGUILayout.TextField("Element name:", elementName, apiPrefix + ".elementName", "The name of the element (within the same menu) that can be dragged");
            }

            dragRect = EditorGUILayout.RectField(new GUIContent("Drag boundary:", "The boundary that the " + dragType.ToString().ToLower() + " can be moved within"), dragRect);

            ChangeCursorGUI(menu);

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Esempio n. 29
0
        public void ShowCursorInfluenceGUI()
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Cursor influence", EditorStyles.boldLabel);
            followCursor = CustomGUILayout.Toggle("Follow cursor?", followCursor, "", "If True, then the camera will rotate towards the cursor's position on-screen");
            if (followCursor)
            {
                cursorInfluence           = CustomGUILayout.Vector2Field("Panning factor:", cursorInfluence, "", "The influence that the cursor's position has on rotation");
                constrainCursorInfluenceX = CustomGUILayout.ToggleLeft("Constrain panning in X direction?", constrainCursorInfluenceX, "", "If True, then camera rotation according to the cursor's X position will be limited");
                if (constrainCursorInfluenceX)
                {
                    limitCursorInfluenceX[0] = CustomGUILayout.Slider("Minimum X constraint:", limitCursorInfluenceX[0], -1.4f, 0f, "", "The cursor influence's lower limit in the X-direction");
                    limitCursorInfluenceX[1] = CustomGUILayout.Slider("Maximum X constraint:", limitCursorInfluenceX[1], 0f, 1.4f, "", "The cursor influence's upper limit in the X-direction");
                }
                constrainCursorInfluenceY = CustomGUILayout.ToggleLeft("Constrain panning in Y direction?", constrainCursorInfluenceY, "", "If True, then camera rotation according to the cursor's Y position will be limited");
                if (constrainCursorInfluenceY)
                {
                    limitCursorInfluenceY[0] = CustomGUILayout.Slider("Minimum Y constraint:", limitCursorInfluenceY[0], -1.4f, 0f, "", "The cursor influence's lower limit in the Y-direction");
                    limitCursorInfluenceY[1] = CustomGUILayout.Slider("Maximum Y constraint:", limitCursorInfluenceY[1], 0f, 1.4f, "", "The cursor influence's upper limit in the Y-direction");
                }

                if (Application.isPlaying && KickStarter.mainCamera != null && KickStarter.mainCamera.attachedCamera == this)
                {
                    EditorGUILayout.HelpBox("Changes made to this panel will not be felt until the MainCamera switches to this camera again.", MessageType.Info);
                }
            }
            EditorGUILayout.EndVertical();
        }
Esempio n. 30
0
        private void ShowEditingGUI()
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showEditing = CustomGUILayout.ToggleHeader(showEditing, "ActionList editing settings");
            if (showEditing)
            {
                displayActionsInInspector   = CustomGUILayout.Toggle("List Actions in Inspector?", displayActionsInInspector, "AC.KickStarter.actionsManager.displayActionsInInspector", "If True, then Actions can be displayed in an ActionList's Inspector window");
                displayActionsInEditor      = (DisplayActionsInEditor)CustomGUILayout.EnumPopup("Actions in Editor are:", displayActionsInEditor, "AC.KickStarter.actionsManager.displayActionsInEditor", "How Actions are arranged in the ActionList Editor window");
                actionListEditorScrollWheel = (ActionListEditorScrollWheel)CustomGUILayout.EnumPopup("Using scroll-wheel:", actionListEditorScrollWheel, "AC.KickStarter.actionsManager.actionListEditorScrollWheel", "The effect the mouse scrollwheel has inside the ActionList Editor window");

                                #if UNITY_EDITOR_OSX
                string altKey = "Option";
                                #else
                string altKey = "Alt";
                                #endif
                if (actionListEditorScrollWheel == ActionListEditorScrollWheel.ZoomsWindow)
                {
                    EditorGUILayout.HelpBox("Panning is possible by holding down the middle-mouse button, or by scrolling with the " + altKey + " key pressed.", MessageType.Info);
                }
                else
                {
                    EditorGUILayout.HelpBox("Zooming is possible by scrolling with the " + altKey + " key pressed.", MessageType.Info);
                }

                autoPanNearWindowEdge = CustomGUILayout.Toggle("Auto-panning in Editor?", autoPanNearWindowEdge, "AC.KickStarter.actionListManager.autoPanNearWindowEdge", "If True, the ActionList Editor will pan automatically when dragging the cursor near the window's edge");
                panSpeed      = CustomGUILayout.FloatField((actionListEditorScrollWheel == ActionListEditorScrollWheel.PansWindow) ? "Panning speed:" : "Zoom speed:", panSpeed, "AC.KickStarter.actionsManager.panSpeed", "The speed factor for panning/zooming");
                invertPanning = CustomGUILayout.Toggle("Invert panning in Editor?", invertPanning, "AC.KickStarter.actionsManager.invertPanning", "If True, then panning is inverted in the ActionList Editor window (useful for Macbooks)");
                allowMultipleActionListWindows = CustomGUILayout.Toggle("Allow multiple Editors?", allowMultipleActionListWindows, "AC.KickStarter.actionsManager.allowMultipleActionListWindows", "If True, then multiple ActionList Editor windows can be opened at once");
            }
            EditorGUILayout.EndVertical();
        }