public override void OnInspectorGUI() { if (_target == null) { return; } if (Application.isPlaying) { EditorGUILayout.LabelField("Menu name:", _target.menuName); EditorGUILayout.LabelField("Element name:", _target.elementName); EditorGUILayout.LabelField("Slot number:", _target.slot.ToString()); EditorGUILayout.LabelField("Is visible?", _target.IsVisible().ToString()); if (GUILayout.Button("Interact")) { _target.Interact(); } } else { _target.menuName = CustomGUILayout.TextField("Menu name:", _target.menuName, "", "The name of the associated Menu"); _target.elementName = CustomGUILayout.TextField("Element name:", _target.elementName, "", "The name of the associated MenuElement in the Menu above"); _target.slot = CustomGUILayout.IntField("Slot number (optional):", _target.slot, "", "The slot index of the associated MenuElement"); } _target.setTextLabels = CustomGUILayout.Toggle("Set guiText / TextMesh labels?", _target.setTextLabels, "", "If True, then any GUIText or TextMesh components will have their text values overridden by that of the associated MenuElement"); UnityVersionHandler.CustomSetDirty(_target); }
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); }
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); }
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 void ShowStartDataGUI(string apiPrefix) { GUILayout.Label("Starting point data for Player " + ID.ToString() + ": " + ((playerOb) ? 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) { CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Recorded ConstantID: " + startingPlayerStartID.ToString(), EditorStyles.miniLabel); CustomGUILayout.EndVertical(); } } }
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); }
public override void ShowGUI(Menu menu) { string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")"; 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"); anchor = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor"); textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects"); dragType = (DragElementType)CustomGUILayout.EnumPopup("Drag type:", dragType, apiPrefix + ".dragType"); if (dragType == DragElementType.SingleElement) { elementName = CustomGUILayout.TextField("Element name:", elementName, apiPrefix + ".elementName"); } dragRect = EditorGUILayout.RectField("Drag boundary:", dragRect); EditorGUILayout.EndVertical(); base.ShowGUI(menu); }
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; } CustomGUILayout.BeginVertical(); 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); CustomGUILayout.EndVertical(); base.ShowGUI(menu); }
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); }
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(); }
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); }
private void IconsGUI() { // Make sure unhandledCursorInteractions is the same length as cursorIcons while (unhandledCursorInteractions.Count < cursorIcons.Count) { unhandledCursorInteractions.Add(null); } while (unhandledCursorInteractions.Count > cursorIcons.Count) { unhandledCursorInteractions.RemoveAt(unhandledCursorInteractions.Count + 1); } // List icons foreach (CursorIcon _cursorIcon in cursorIcons) { int i = cursorIcons.IndexOf(_cursorIcon); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Icon ID:", GUILayout.MaxWidth(145)); EditorGUILayout.LabelField(_cursorIcon.id.ToString(), GUILayout.MaxWidth(120)); GUILayout.FlexibleSpace(); if (GUILayout.Button(Resource.CogIcon, GUILayout.Width(20f), GUILayout.Height(15f))) { SideMenu(i); } EditorGUILayout.EndHorizontal(); _cursorIcon.label = CustomGUILayout.TextField("Label:", _cursorIcon.label, "AC.KickStarter.cursorManager.GetCursorIconFromID (" + i + ").label"); if (KickStarter.settingsManager != null && KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { EditorGUILayout.LabelField("Input button:", _cursorIcon.GetButtonName()); } _cursorIcon.ShowGUI(true, true, "Texture:", cursorRendering, "AC.KickStarter.cursorManager.GetCursorIconFromID (" + i + ")"); if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { string autoName = _cursorIcon.label + "_Unhandled_Interaction"; unhandledCursorInteractions[i] = ActionListAssetMenu.AssetGUI("Unhandled interaction", unhandledCursorInteractions[i], "AC.KickStarter.cursorManager.unhandledCursorInteractions[" + i + "]", autoName); _cursorIcon.dontCycle = CustomGUILayout.Toggle("Leave out of Cursor cycle?", _cursorIcon.dontCycle, "AC.KickStarter.cursorManager.GetCursorIconFromID (" + i + ").dontCycle"); } } if (GUILayout.Button("Create new icon")) { Undo.RecordObject(this, "Add icon"); cursorIcons.Add(new CursorIcon(GetIDArray())); } passUnhandledHotspotAsParameter = CustomGUILayout.ToggleLeft("Pass Hotspot as GameObject parameter?", passUnhandledHotspotAsParameter, "AC.KickStarter.cursorManager.passUnhandledHotspotAsParameter"); if (passUnhandledHotspotAsParameter) { EditorGUILayout.HelpBox("The Hotspot will be set as the Unhandled interaction's first parameter, which must be set to type 'GameObject'.", MessageType.Info); } }
public TrackSnapData ShowGUI(DragTrack dragTrack, bool useAngles) { label = CustomGUILayout.TextField("Editor label:", label, string.Empty, "The region's label when displayed in Actions."); bool isEnabled = !isDisabled; isEnabled = CustomGUILayout.Toggle("Is enabled?", isEnabled, string.Empty, "If True, the region is enabled"); isDisabled = !isEnabled; positionAlong = CustomGUILayout.Slider("Centre " + ((useAngles) ? "angle" : "position:"), positionAlong, 0f, 1f, string.Empty, "How far along the track (as a decimal) the region lies."); width = CustomGUILayout.Slider("Catchment size:", width, 0f, 1f, string.Empty, "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, string.Empty, "What colour to draw handles in the Scene with."); if (dragTrack.doSnapping) { if (dragTrack.actionListSource == ActionListSource.InScene) { cutsceneOnSnap = (Cutscene)CustomGUILayout.ObjectField <Cutscene> ("Cutscene on snap:", cutsceneOnSnap, true, "", "An optional Cutscene to run when a Draggable object snaps to this region"); } else if (dragTrack.actionListSource == ActionListSource.AssetFile) { actionListAssetOnSnap = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on snap:", actionListAssetOnSnap, false, "", "An optional ActionList asset to run when a Draggable object snaps to this region"); } } if (dragTrack.TypeSupportsSnapConnections()) { if (connections.Count == 0) { TrackSnapConnection trackSnapConnection = new TrackSnapConnection(); connections.Add(trackSnapConnection); } for (int i = 0; i < connections.Count; i++) { EditorGUILayout.BeginHorizontal(); connections[i] = connections[i].ShowGUI(dragTrack, i); if (GUILayout.Button("+", GUILayout.MaxWidth(20f))) { Undo.RecordObject(dragTrack, "Add connection"); TrackSnapConnection trackSnapConnection = new TrackSnapConnection(); connections.Insert(i + 1, trackSnapConnection); i = -1; break; } if (connections.Count > 1 && GUILayout.Button("-", GUILayout.MaxWidth(20f))) { Undo.RecordObject(dragTrack, "Delete connection"); connections.RemoveAt(i); i = -1; break; } EditorGUILayout.EndHorizontal(); } } return(this); }
public void ShowGUIStart(Menu menu) { string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")"; EditorGUILayout.Space(); title = CustomGUILayout.TextField("Element name:", title, apiPrefix + ".title", "A text identifier for use in Actions and custom scripts"); isVisible = CustomGUILayout.Toggle("Is visible?", isVisible, apiPrefix + ".IsVisible", "If True, the element is enabled and visible"); EditorGUILayout.EndVertical(); ShowGUI(menu); }
public void ShowGUIStart(Menu menu) { string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")"; EditorGUILayout.Space(); title = CustomGUILayout.TextField("Element name:", title, apiPrefix + ".title"); isVisible = CustomGUILayout.Toggle("Is visible?", isVisible, apiPrefix + ".isVisible"); EditorGUILayout.EndVertical(); ShowGUI(menu); }
private string EditField(string label, string field, bool multiLine, string api = "") { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(label, GUILayout.Width(85f)); if (multiLine) { field = CustomGUILayout.TextArea(field, GUILayout.MaxWidth(570f), api); } else { field = CustomGUILayout.TextField(field, GUILayout.MaxWidth(570f), api); } EditorGUILayout.EndHorizontal(); return(field); }
protected void SharedGUIOne(AC.Char _target) { _target.GetAnimEngine(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Animation settings:", EditorStyles.boldLabel); _target.animationEngine = (AnimationEngine)CustomGUILayout.EnumPopup("Animation engine:", _target.animationEngine, "", "The animation engine that the character relies on for animation playback"); if (_target.animationEngine == AnimationEngine.Custom) { _target.customAnimationClass = CustomGUILayout.TextField("Script name:", _target.customAnimationClass, "", "The class name of the AnimEngine ScriptableObject subclass that animates the character"); } _target.motionControl = (MotionControl)CustomGUILayout.EnumPopup("Motion control:", _target.motionControl, "", "How motion is controlled"); EditorGUILayout.EndVertical(); _target.GetAnimEngine().CharSettingsGUI(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Movement settings:", EditorStyles.boldLabel); if (_target.GetMotionControl() == MotionControl.Automatic) { _target.walkSpeedScale = CustomGUILayout.FloatField("Walk speed scale:", _target.walkSpeedScale, "", "The movement speed when walking"); _target.runSpeedScale = CustomGUILayout.FloatField("Run speed scale:", _target.runSpeedScale, "", "The movement speed when running"); _target.acceleration = CustomGUILayout.FloatField("Acceleration:", _target.acceleration, "", "The acceleration factor"); _target.deceleration = CustomGUILayout.FloatField("Deceleration:", _target.deceleration, "", "The deceleration factor"); _target.runDistanceThreshold = CustomGUILayout.FloatField("Minimum run distance:", _target.runDistanceThreshold, "", "The minimum distance between the character and its destination for running to be possible"); } if (_target.GetMotionControl() != MotionControl.Manual) { _target.turnSpeed = CustomGUILayout.FloatField("Turn speed:", _target.turnSpeed, "", "The turn speed"); if (_target.GetAnimEngine().isSpriteBased) { _target.turn2DCharactersIn3DSpace = CustomGUILayout.Toggle("Turn root object in 3D?", _target.turn2DCharactersIn3DSpace, "", "If True, then the root object of a 2D, sprite-based character will rotate around the Z-axis. Otherwise, turning will be simulated and the actual rotation will be unaffected"); } } _target.turnBeforeWalking = CustomGUILayout.Toggle("Turn before walking?", _target.turnBeforeWalking, "", "If True, the character will turn on the spot to face their destination before moving"); _target.retroPathfinding = CustomGUILayout.Toggle("Retro-style movement?", _target.retroPathfinding, "", "Enables 'retro-style' movement when pathfinding, where characters ignore Acceleration and Deceleration values, and turn instantly when moving"); _target.headTurnSpeed = CustomGUILayout.Slider("Head turn speed:", _target.headTurnSpeed, 0.1f, 20f, "", "The speed of head-turning"); if (_target is Player && AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.PlayerCanReverse()) { _target.reverseSpeedFactor = CustomGUILayout.Slider("Reverse speed factor:", _target.reverseSpeedFactor, 0f, 1f, "", "The factor by which speed is reduced when reversing"); } EditorGUILayout.EndVertical(); }
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); } CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Previous scene activation", 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"); } if (KickStarter.settingsManager != null && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow) { _target.limitByActive = (PlayerStartActiveOption)CustomGUILayout.EnumPopup("Limit by active:", _target.limitByActive, "", "Lets you limit activation to active or inactive Players only"); _target.limitByPlayer = CustomGUILayout.Toggle("Limit by Player?", _target.limitByPlayer, "", "If True, then only specific Players can use this when entering from a previous scene"); if (_target.limitByPlayer) { _target.playerIDs = ChoosePlayerGUI(_target.playerIDs); } } CustomGUILayout.EndVertical(); CustomGUILayout.BeginVertical(); 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 activate?", _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"); } CustomGUILayout.EndVertical(); UnityVersionHandler.CustomSetDirty(_target); }
private ShapeKey KeyGUI(ShapeKey shapeKey, string[] blendShapeNames) { EditorGUILayout.LabelField("Shape key " + shapeKey.label, EditorStyles.boldLabel); shapeKey.label = CustomGUILayout.TextField("Key label:", shapeKey.label, "", "An editor-friendly name of the blendshape"); if (blendShapeNames != null && blendShapeNames.Length > 0) { shapeKey.index = CustomGUILayout.Popup("Blendshape:", shapeKey.index, blendShapeNames, "", "The Blendshape that this relates to"); } else { shapeKey.index = CustomGUILayout.IntField("BlendShape index:", shapeKey.index, "", "The Blendshape that this relates to"); } return(shapeKey); }
private ShapeGroup GroupGUI(ShapeGroup shapeGroup, string[] blendShapeNames) { EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Shape group " + shapeGroup.label, EditorStyles.boldLabel); shapeGroup.label = CustomGUILayout.TextField("Group label:", shapeGroup.label, "", "The editor-friendly name of the group"); shapeGroup.shapeKeys = AllKeysGUI(shapeGroup.shapeKeys); if (selectedKey != null && shapeGroup.shapeKeys.Contains(selectedKey)) { selectedKey = KeyGUI(selectedKey, blendShapeNames); } EditorGUILayout.EndVertical(); return(shapeGroup); }
public void ShowGUI() { string defaultName = "ActiveInput_" + Label; label = CustomGUILayout.TextField("Label:", label, string.Empty, "An Editor-friendly name"); inputName = CustomGUILayout.TextField("Input button:", inputName, string.Empty, "The name of the Input button, as defined in the Input Manager"); inputType = (SimulateInputType)CustomGUILayout.EnumPopup("Input type:", inputType, string.Empty, "What type of input is expected"); if (inputType == SimulateInputType.Axis) { axisThreshold = CustomGUILayout.Slider("Axis threshold:", axisThreshold, -1f, 1f, string.Empty, "The threshold value for the axis to trigger the ActionListAsset"); } else if (inputType == SimulateInputType.Button) { buttonType = (ActiveInputButtonType)CustomGUILayout.EnumPopup("Responds to:", buttonType, string.Empty, "What type of button press this responds to"); } enabledOnStart = CustomGUILayout.Toggle("Enabled by default?", enabledOnStart, string.Empty, "If True, the active input is enabled when the game begins"); gameState = (GameState)CustomGUILayout.EnumPopup("Available when game is:", gameState, string.Empty, "What state the game must be in for the actionListAsset to run"); actionListAsset = ActionListAssetMenu.AssetGUI("ActionList when triggered:", actionListAsset, defaultName, string.Empty, "The ActionListAsset to run when the input button is pressed"); }
private void OnGUI() { if (AdvGame.GetReferences().settingsManager == null) { EditorGUILayout.HelpBox("A Settings Manager must be assigned before this window can display correctly.", MessageType.Warning); return; } SettingsManager settingsManager = AdvGame.GetReferences().settingsManager; sceneAttributes = settingsManager.sceneAttributes; EditorGUILayout.HelpBox("Values for attributes defined here can be set in the Scene Manager, and checked using the 'Scene: Check attribute' Action.", MessageType.Info); EditorGUILayout.Space(); CreateAttributesGUI(); if (selectedSceneAttribute != null && sceneAttributes.Contains(selectedSceneAttribute)) { EditorGUILayout.Space(); string apiPrefix = "AC.KickStarter.variablesManager.GetProperty (" + selectedSceneAttribute.id + ")"; EditorGUILayout.BeginVertical(CustomStyles.thinBox); EditorGUILayout.LabelField("Inventory property '" + selectedSceneAttribute.label + "' properties", CustomStyles.subHeader); EditorGUILayout.Space(); selectedSceneAttribute.label = CustomGUILayout.TextField("Name:", selectedSceneAttribute.label, apiPrefix + ".label"); selectedSceneAttribute.type = (VariableType)CustomGUILayout.EnumPopup("Type:", selectedSceneAttribute.type, apiPrefix + ".type"); if (selectedSceneAttribute.type == VariableType.PopUp) { selectedSceneAttribute.popUps = VariablesManager.PopupsGUI(selectedSceneAttribute.popUps); } EditorGUILayout.EndVertical(); } settingsManager.sceneAttributes = sceneAttributes; if (GUI.changed) { EditorUtility.SetDirty(settingsManager); } }
public override void OnInspectorGUI() { if (_target.GetComponent <Char>() == null) { EditorGUILayout.HelpBox("This component must be placed alongside either the NPC or Player component.", MessageType.Warning); } _target.skinnedMeshRenderer = (SkinnedMeshRenderer)CustomGUILayout.ObjectField <SkinnedMeshRenderer> ("Skinned Mesh Renderer:", _target.skinnedMeshRenderer, true, "", "The SkinnedMeshRenderer to affect"); _target.materialIndex = CustomGUILayout.IntField("Material to affect (index):", _target.materialIndex, "", "The index of the material to affect"); _target.propertyName = CustomGUILayout.TextField("Texture property name:", _target.propertyName, "", "The material's property name that will be replaced"); _target.LimitTextureArray(); for (int i = 0; i < _target.textures.Count; i++) { _target.textures[i] = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Texture for phoneme #" + i.ToString() + ":", _target.textures[i], false, "", "The Texture that corresponds to the phoneme defined in the Phonemes Editor"); } UnityVersionHandler.CustomSetDirty(_target); }
public void ShowGUI(string apiPrefix) { string _label = label + ":"; if (string.IsNullOrEmpty(label)) { _label = "Property " + id.ToString() + ":"; } switch (type) { case VariableType.Boolean: if (val != 1) { val = 0; } val = CustomGUILayout.Popup(_label, val, boolType, apiPrefix + ".BooleanValue", "The property's value for this item"); break; case VariableType.Integer: val = CustomGUILayout.IntField(_label, val, apiPrefix + ".IntegerValue", "The property's value for this item"); break; case VariableType.PopUp: val = CustomGUILayout.Popup(_label, val, GenerateEditorPopUpLabels(), apiPrefix + ".IntegerValue", "The property's value for this item"); break; case VariableType.String: textVal = CustomGUILayout.TextField(_label, textVal, apiPrefix + ".TextValue", "The property's value for this item"); break; case VariableType.Float: floatVal = CustomGUILayout.FloatField(_label, floatVal, apiPrefix + ".FloatValue", "The property's value for this item"); break; case VariableType.Vector3: vector3Val = CustomGUILayout.Vector3Field(_label, vector3Val, apiPrefix + ".Vector3Value", "The property's value for this item"); break; } }
public override void ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuCycle)"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); if (source != AC.MenuSource.AdventureCreator) { cycleUIBasis = (CycleUIBasis)CustomGUILayout.EnumPopup("UI basis:", cycleUIBasis, apiPrefix + ".cycleUIBasis", "What kind of UI element the Cycle is linked to"); if (cycleUIBasis == CycleUIBasis.Button) { uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source, "The Unity UI Button this is linked to"); } else if (cycleUIBasis == CycleUIBasis.Dropdown) { #if UNITY_5_3_OR_NEWER uiDropdown = LinkedUiGUI <Dropdown> (uiDropdown, "Linked Dropdown:", source); #else EditorGUILayout.HelpBox("This option is only available with Unity 5.4 or newer.", MessageType.Info); #endif } uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible"); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); } cycleType = (AC_CycleType)CustomGUILayout.EnumPopup("Cycle type:", cycleType, apiPrefix + ".cycleType", "What the value links to"); if (source == MenuSource.AdventureCreator || cycleUIBasis == CycleUIBasis.Button) { label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label", "The text that's displayed on-screen, which prefixes the varying text"); } if (cycleType == AC_CycleType.CustomScript || cycleType == AC_CycleType.Variable) { int numOptions = optionsArray.Count; numOptions = EditorGUILayout.IntField("Number of choices:", optionsArray.Count); if (numOptions < 0) { numOptions = 0; } if (numOptions < optionsArray.Count) { optionsArray.RemoveRange(numOptions, optionsArray.Count - numOptions); } else if (numOptions > optionsArray.Count) { if (numOptions > optionsArray.Capacity) { optionsArray.Capacity = numOptions; } for (int i = optionsArray.Count; i < numOptions; i++) { optionsArray.Add(""); } } for (int i = 0; i < optionsArray.Count; i++) { optionsArray [i] = CustomGUILayout.TextField("Choice #" + i.ToString() + ":", optionsArray [i], apiPrefix + ".optionsArray[" + i.ToString() + "]"); } if (cycleType == AC_CycleType.CustomScript) { if (optionsArray.Count > 0) { selected = CustomGUILayout.IntField("Default option #:", selected, apiPrefix + ".selected"); } ShowClipHelp(); } else if (cycleType == AC_CycleType.Variable) { varID = AdvGame.GlobalVariableGUI("Global integer var:", varID, VariableType.Integer, "The Global Integer variable that's value will be synced with the cycle"); } actionListOnClick = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on click:", actionListOnClick, false, apiPrefix + ".actionListOnClick", "The ActionList asset to run when the element is clicked on"); } 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); }
private void ButtonGUI(Button button, string suffix, InteractionSource source, bool isForInventory = false) { bool isEnabled = !button.isDisabled; isEnabled = EditorGUILayout.Toggle("Enabled:", isEnabled); button.isDisabled = !isEnabled; if (source == InteractionSource.AssetFile) { EditorGUILayout.BeginHorizontal(); button.assetFile = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("Interaction:", button.assetFile, false, "", "The ActionList asset to run"); if (button.assetFile == null) { if (GUILayout.Button("Create", autoWidth)) { string defaultName = GenerateInteractionName(suffix, true); #if !(UNITY_WP8 || UNITY_WINRT) defaultName = System.Text.RegularExpressions.Regex.Replace(defaultName, "[^\\w\\._]", ""); #else defaultName = ""; #endif button.assetFile = ActionListAssetMenu.CreateAsset(defaultName); } } else if (GUILayout.Button("", CustomStyles.IconNodes)) { ActionListEditorWindow.Init(button.assetFile); } EditorGUILayout.EndHorizontal(); if (button.assetFile != null && button.assetFile.useParameters && button.assetFile.parameters.Count > 0) { EditorGUILayout.BeginHorizontal(); button.parameterID = Action.ChooseParameterGUI("Hotspot parameter:", button.assetFile.parameters, button.parameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this Hotspot"); EditorGUILayout.EndHorizontal(); if (isForInventory) { button.invParameterID = Action.ChooseParameterGUI("Inventory item parameter:", button.assetFile.parameters, button.invParameterID, ParameterType.InventoryItem, -1, "The Inventory Item parameter to automatically assign as the used item"); } } } else if (source == InteractionSource.CustomScript) { button.customScriptObject = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Object with script:", button.customScriptObject, true, "", "The GameObject with the custom script to run"); button.customScriptFunction = CustomGUILayout.TextField("Message to send:", button.customScriptFunction, "", "The name of the function to run"); if (isForInventory) { EditorGUILayout.HelpBox("If the receiving function has an integer parameter, the Inventory item's ID will be passed to it.", MessageType.Info); } } else if (source == InteractionSource.InScene) { EditorGUILayout.BeginHorizontal(); button.interaction = (Interaction)CustomGUILayout.ObjectField <Interaction> ("Interaction:", button.interaction, true, "", "The Interaction ActionList to run"); if (button.interaction == null) { if (GUILayout.Button("Create", autoWidth)) { Undo.RecordObject(_target, "Create Interaction"); Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>(); newInteraction.gameObject.name = GenerateInteractionName(suffix, false); button.interaction = newInteraction; } } else { if (GUILayout.Button("", CustomStyles.IconNodes)) { ActionListEditorWindow.Init(button.interaction); } } EditorGUILayout.EndHorizontal(); if (button.interaction != null && button.interaction.source == ActionListSource.InScene && button.interaction.useParameters && button.interaction.parameters.Count > 0) { EditorGUILayout.BeginHorizontal(); button.parameterID = Action.ChooseParameterGUI("Hotspot parameter:", button.interaction.parameters, button.parameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this Hotspot"); EditorGUILayout.EndHorizontal(); if (isForInventory) { button.invParameterID = Action.ChooseParameterGUI("Inventory item parameter:", button.interaction.parameters, button.invParameterID, ParameterType.InventoryItem, -1, "The Inventory Item parameter to automatically assign as the used item"); } } else if (button.interaction != null && button.interaction.source == ActionListSource.AssetFile && button.interaction.assetFile != null && button.interaction.assetFile.useParameters && button.interaction.assetFile.parameters.Count > 0) { EditorGUILayout.BeginHorizontal(); button.parameterID = Action.ChooseParameterGUI("Hotspot parameter:", button.interaction.assetFile.parameters, button.parameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this Hotspot"); EditorGUILayout.EndHorizontal(); if (isForInventory) { button.invParameterID = Action.ChooseParameterGUI("Inventory item parameter:", button.interaction.assetFile.parameters, button.invParameterID, ParameterType.InventoryItem, -1, "The Inventory Item parameter to automatically assign as the used item"); } } } button.playerAction = (PlayerAction)CustomGUILayout.EnumPopup("Player action:", button.playerAction, "", "What the Player prefab does after clicking the Hotspot, but before the Interaction itself is run"); if (button.playerAction == PlayerAction.WalkTo || button.playerAction == PlayerAction.WalkToMarker) { if (button.playerAction == PlayerAction.WalkToMarker && _target.walkToMarker == null) { EditorGUILayout.HelpBox("You must assign a 'Walk-to marker' above for this option to work.", MessageType.Warning); } button.isBlocking = CustomGUILayout.Toggle("Cutscene while moving?", button.isBlocking, "", "If True, then gameplay will be blocked while the Player moves"); button.faceAfter = CustomGUILayout.Toggle("Face after moving?", button.faceAfter, "", "If True, then the Player will face the Hotspot after reaching the Marker"); if (button.playerAction == PlayerAction.WalkTo) { button.setProximity = CustomGUILayout.Toggle("Set minimum distance?", button.setProximity, "", "If True, then the Interaction will be run once the Player is within a certain distance of the Hotspot"); if (button.setProximity) { button.proximity = CustomGUILayout.FloatField("Proximity:", button.proximity, "", "The proximity the Player must be within"); } } } }
public override void OnInspectorGUI() { if (AdvGame.GetReferences() == null) { ACDebug.LogError("A References file is required - please use the Adventure Creator window to create one."); EditorGUILayout.LabelField("No References file found!"); } else { if (AdvGame.GetReferences().inventoryManager) { inventoryManager = AdvGame.GetReferences().inventoryManager; } if (AdvGame.GetReferences().cursorManager) { cursorManager = AdvGame.GetReferences().cursorManager; } if (AdvGame.GetReferences().settingsManager) { settingsManager = AdvGame.GetReferences().settingsManager; } if (Application.isPlaying) { if (_target.gameObject.layer != LayerMask.NameToLayer(settingsManager.hotspotLayer)) { EditorGUILayout.HelpBox("Current state: OFF", MessageType.Info); } } if (_target.lineID > -1) { EditorGUILayout.LabelField("Speech Manager ID:", _target.lineID.ToString()); } _target.interactionSource = (AC.InteractionSource)CustomGUILayout.EnumPopup("Interaction source:", _target.interactionSource, "", "The source of the commands that are run when an option is chosen"); _target.hotspotName = CustomGUILayout.TextField("Label (if not name):", _target.hotspotName, "", "The display name, if not the GameObject's name"); _target.highlight = (Highlight)CustomGUILayout.ObjectField <Highlight> ("Object to highlight:", _target.highlight, true, "", "The Highlight component that controls any highlighting effects associated with the Hotspot"); if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.hotspotDrawing == ScreenWorld.WorldSpace) { _target.iconSortingLayer = CustomGUILayout.TextField("Icon sorting layer:", _target.iconSortingLayer, "", "The 'Sorting Layer' of the icon's SpriteRenderer"); _target.iconSortingOrder = CustomGUILayout.IntField("Icon sprite order:", _target.iconSortingOrder, "", "The 'Order in Layer' of the icon's SpriteRenderer"); } EditorGUILayout.BeginHorizontal(); _target.centrePoint = (Transform)CustomGUILayout.ObjectField <Transform> ("Centre point (override):", _target.centrePoint, true, "", "A Transform that represents the centre of the Hotspot, if it is not physically at the same point as the Hotspot's GameObject itself"); if (_target.centrePoint == null) { if (GUILayout.Button("Create", autoWidth)) { string prefabName = "Hotspot centre: " + _target.gameObject.name; GameObject go = SceneManager.AddPrefab("Navigation", "HotspotCentre", true, false, false); go.name = prefabName; go.transform.position = _target.transform.position; _target.centrePoint = go.transform; go.transform.parent = _target.transform; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); _target.walkToMarker = (Marker)CustomGUILayout.ObjectField <Marker> ("Walk-to Marker:", _target.walkToMarker, true, "", "The Marker that the player can optionally automatically walk to before an Interaction runs"); if (_target.walkToMarker == null) { if (GUILayout.Button("Create", autoWidth)) { string prefabName = "Marker"; if (SceneSettings.IsUnity2D()) { prefabName += "2D"; } Marker newMarker = SceneManager.AddPrefab("Navigation", prefabName, true, false, true).GetComponent <Marker>(); newMarker.gameObject.name += (": " + _target.gameObject.name); newMarker.transform.position = _target.transform.position; _target.walkToMarker = newMarker; } } EditorGUILayout.EndHorizontal(); _target.limitToCamera = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Limit to camera:", _target.limitToCamera, true, "", "If assigned, then the Hotspot will only be interactive when the assigned _Camera is active"); EditorGUILayout.BeginHorizontal(); _target.interactiveBoundary = (InteractiveBoundary)CustomGUILayout.ObjectField <InteractiveBoundary> ("Interactive boundary:", _target.interactiveBoundary, true, "", "If assigned, then the Hotspot will only be interactive when the player is within this Trigger Collider's boundary"); if (_target.interactiveBoundary == null) { if (GUILayout.Button("Create", autoWidth)) { string prefabName = "InteractiveBoundary"; if (SceneSettings.IsUnity2D()) { prefabName += "2D"; } InteractiveBoundary newInteractiveBoundary = SceneManager.AddPrefab("Logic", prefabName, true, false, true).GetComponent <InteractiveBoundary>(); newInteractiveBoundary.gameObject.name += (": " + _target.gameObject.name); newInteractiveBoundary.transform.position = _target.transform.position; _target.interactiveBoundary = newInteractiveBoundary; UnityVersionHandler.PutInFolder(newInteractiveBoundary.gameObject, "_Hotspots"); } } EditorGUILayout.EndHorizontal(); _target.drawGizmos = CustomGUILayout.Toggle("Draw yellow cube?", _target.drawGizmos, "", "If True, then a Gizmo may be drawn in the Scene window at the Hotspots's position"); if (settingsManager != null && (settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction || settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot || settingsManager.interactionMethod == AC_InteractionMethod.CustomScript)) { _target.oneClick = CustomGUILayout.Toggle("Single 'Use' Interaction?", _target.oneClick, "", "If True, then clicking the Hotspot will run the Hotspot's first interaction in useButtons, regardless of the Settings Manager's Interaction method"); if (_target.oneClick && settingsManager.interactionMethod == AC_InteractionMethod.CustomScript) { EditorGUILayout.HelpBox("The above property can be accessed by reading the Hotspot script's IsSingleInteraction() method.", MessageType.Info); } } if (_target.oneClick || (settingsManager != null && settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)) { if (settingsManager != null && settingsManager.interactionMethod == AC_InteractionMethod.CustomScript) { } else { _target.doubleClickingHotspot = (DoubleClickingHotspot)CustomGUILayout.EnumPopup("Double-clicking:", _target.doubleClickingHotspot, "", "The effect that double-clicking on the Hotspot has"); } } if (settingsManager != null && settingsManager.playerFacesHotspots) { _target.playerTurnsHead = CustomGUILayout.Toggle("Players turn heads when active?", _target.playerTurnsHead, "", "If True, then the player will turn their head when the Hotspot is selected"); } EditorGUILayout.Space(); UseInteractionGUI(); if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive || settingsManager.interactionMethod == AC_InteractionMethod.CustomScript) { EditorGUILayout.Space(); LookInteractionGUI(); } EditorGUILayout.Space(); InvInteractionGUI(); EditorGUILayout.Space(); UnhandledInvInteractionGUI(); } UnityVersionHandler.CustomSetDirty(_target); }
public void ShowGUI(string apiPrefix, List <string> binList) { Upgrade(); label = CustomGUILayout.TextField("Name:", label, apiPrefix + ".label", "The item's Editor name"); altLabel = CustomGUILayout.TextField("Label (if not name):", altLabel, apiPrefix + ".altLabel", "The item's in-game name, if not label"); bool isPronoun = !canBeLowerCase; isPronoun = CustomGUILayout.Toggle("Name is pronoun?", isPronoun, "!" + apiPrefix + ".canBeLowerCase", "If False, the name will be lower-cased when inside sentences."); canBeLowerCase = !isPronoun; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Category:", "The category that the item belongs to"), GUILayout.Width(146f)); if (KickStarter.inventoryManager.bins.Count > 0) { int binNumber = KickStarter.inventoryManager.GetBinSlot(binID); binNumber = CustomGUILayout.Popup(binNumber, binList.ToArray(), apiPrefix + ".binID"); binID = KickStarter.inventoryManager.bins[binNumber].id; } else { binID = -1; EditorGUILayout.LabelField("No categories defined!", EditorStyles.miniLabel, GUILayout.Width(146f)); } EditorGUILayout.EndHorizontal(); carryOnStart = CustomGUILayout.Toggle("Carry on start?", carryOnStart, apiPrefix + ".carryOnStart", "If True, the Player carries the item when the game begins"); if (carryOnStart && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.playerSwitching == PlayerSwitching.Allow && !AdvGame.GetReferences().settingsManager.shareInventory) { carryOnStartNotDefault = CustomGUILayout.Toggle("Non-default Player(s)?", carryOnStartNotDefault, apiPrefix + ".carryOnStartNotDefault", "If True, then a Player prefab that is not the default carries the item when the game begins"); if (carryOnStartNotDefault) { carryOnStartIDs = ChoosePlayerGUI(carryOnStartIDs, apiPrefix + ".carryOnStartID"); } } canCarryMultiple = CustomGUILayout.Toggle("Can carry multiple?", canCarryMultiple, apiPrefix + ".canCarryMultiple", "If True, then multiple instances of the item can be carried at once"); if (carryOnStart && canCarryMultiple) { count = CustomGUILayout.IntField("Quantity on start:", count, apiPrefix + ".count", "The number of instances that the player is carrying when the game begins"); } else { count = 1; } if (canCarryMultiple) { if (maxCount == 0) { maxCount = 999; } maxCount = CustomGUILayout.IntField("Slot capacity:", maxCount, apiPrefix + ".maxCount", "The number of instances of the item that can occupy a single inventory slot"); if (maxCount < 1) { maxCount = 1; } if (maxCount > 1) { itemStackingMode = (ItemStackingMode)CustomGUILayout.EnumPopup("Selection mode:", itemStackingMode, apiPrefix + ".itemStackingMode", "How to select items when multiple are in a given slot"); } } overrideUseSyntax = CustomGUILayout.Toggle("Override 'Use' syntax?", overrideUseSyntax, apiPrefix + ".overrideUseSyntax", "If True, then the item has its own 'Use X on Y' syntax when selected"); if (overrideUseSyntax) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f)); hotspotPrefix1.label = EditorGUILayout.TextField(hotspotPrefix1.label, GUILayout.MaxWidth(80f)); EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f)); hotspotPrefix2.label = EditorGUILayout.TextField(hotspotPrefix2.label, GUILayout.MaxWidth(80f)); EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f)); EditorGUILayout.EndHorizontal(); } linkedPrefab = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Linked prefab:", linkedPrefab, false, apiPrefix + ".linkedPrefab", "A GameObject that can be associated with the item, for the creation of e.g. 3D inventory items (through scripting only)"); if (linkedPrefab != null) { EditorGUILayout.HelpBox("This reference is accessible through scripting, or via Inventory parameter in the 'Object: Add or remove' Action.", MessageType.Info); } CustomGUILayout.DrawUILine(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Main graphic:", "The item's main graphic"), GUILayout.Width(145)); tex = (Texture)CustomGUILayout.ObjectField <Texture> (tex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".tex"); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Active graphic:", "The item's 'highlighted' graphic"), GUILayout.Width(145)); activeTex = (Texture)CustomGUILayout.ObjectField <Texture> (activeTex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".activeTex"); EditorGUILayout.EndHorizontal(); if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.selectInventoryDisplay == SelectInventoryDisplay.ShowSelectedGraphic) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Selected graphic:", "The item's 'selected' graphic"), GUILayout.Width(145)); selectedTex = (Texture)CustomGUILayout.ObjectField <Texture> (selectedTex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".selectedTex"); EditorGUILayout.EndHorizontal(); } if (AdvGame.GetReferences().cursorManager != null) { CursorManager cursorManager = AdvGame.GetReferences().cursorManager; if (cursorManager.inventoryHandling == InventoryHandling.ChangeCursor || cursorManager.inventoryHandling == InventoryHandling.ChangeCursorAndHotspotLabel) { cursorIcon.ShowGUI(true, true, "Cursor (optional):", cursorManager.cursorRendering, apiPrefix + ".cursorIcon", "A Cursor that, if assigned, will be used in place of the 'tex' Texture when the item is selected on the cursor"); CustomGUILayout.DrawUILine(); } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Standard interactions", CustomStyles.subHeader); if (KickStarter.settingsManager && KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.cursorManager) { List <string> iconList = new List <string> (); foreach (CursorIcon icon in KickStarter.cursorManager.cursorIcons) { iconList.Add(icon.id.ToString() + ": " + icon.label); } if (KickStarter.cursorManager.cursorIcons.Count > 0) { foreach (InvInteraction interaction in interactions) { EditorGUILayout.BeginHorizontal(); int invNumber = GetIconSlot(interaction.icon.id); invNumber = EditorGUILayout.Popup(invNumber, iconList.ToArray()); interaction.icon = KickStarter.cursorManager.cursorIcons[invNumber]; int i = interactions.IndexOf(interaction); string autoName = label + "_" + interaction.icon.label; interaction.actionList = ActionListAssetMenu.AssetGUI("", interaction.actionList, autoName, apiPrefix + ".interactions[" + i + "].actionList", "The ActionList to run when the interaction is triggered"); if (GUILayout.Button(string.Empty, CustomStyles.IconCog)) { SideInteractionMenu(interactions.IndexOf(interaction)); } EditorGUILayout.EndHorizontal(); } } else { EditorGUILayout.HelpBox("No interaction icons defined - please use the Cursor Manager", MessageType.Warning); } if (GUILayout.Button("Add interaction")) { Undo.RecordObject(KickStarter.inventoryManager, "Add new interaction"); interactions.Add(new InvInteraction(KickStarter.cursorManager.cursorIcons[0])); } } else { string autoName = label + "_Use"; useActionList = ActionListAssetMenu.AssetGUI("Use:", useActionList, autoName, apiPrefix + ".useActionList", "The ActionList asset to run when using the item is used"); if (KickStarter.cursorManager && KickStarter.cursorManager.allowInteractionCursorForInventory && KickStarter.cursorManager.cursorIcons.Count > 0) { int useCursor_int = KickStarter.cursorManager.GetIntFromID(useIconID) + 1; if (useIconID == -1) { useCursor_int = 0; } useCursor_int = CustomGUILayout.Popup("Use cursor icon:", useCursor_int, KickStarter.cursorManager.GetLabelsArray(true), apiPrefix + ".useIconID", "The Cursor to show when hovering over the item"); if (useCursor_int == 0) { useIconID = -1; } else if (KickStarter.cursorManager.cursorIcons.Count > (useCursor_int - 1)) { useIconID = KickStarter.cursorManager.cursorIcons[useCursor_int - 1].id; } } else { useIconID = 0; } autoName = label + "_Examine"; lookActionList = ActionListAssetMenu.AssetGUI("Examine:", lookActionList, autoName, apiPrefix + ".lookActionList", "The ActionListAsset to run when the item is examined"); } if (KickStarter.settingsManager && KickStarter.settingsManager.CanSelectItems(false)) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Unhandled interactions", CustomStyles.subHeader); string autoName = label + "_Unhandled_Hotspot"; unhandledActionList = ActionListAssetMenu.AssetGUI("Unhandled use on Hotspot:", unhandledActionList, autoName, apiPrefix + ".unhandledActionList", "The ActionList asset to run when using the item on a Hotspot is unhandled"); autoName = label + "_Unhandled_Combine"; unhandledCombineActionList = ActionListAssetMenu.AssetGUI("Unhandled combine:", unhandledCombineActionList, autoName, apiPrefix + ".unhandledCombineActionList", "The ActionListAsset to run when using the item on another InvItem is unhandled"); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Combine interactions", CustomStyles.subHeader); for (int i = 0; i < combineActionList.Count; i++) { EditorGUILayout.BeginHorizontal(); int invNumber = KickStarter.inventoryManager.GetArraySlot(combineID[i]); invNumber = EditorGUILayout.Popup(invNumber, KickStarter.inventoryManager.GetLabelList()); combineID[i] = KickStarter.inventoryManager.items[invNumber].id; string autoName = label + "_Combine_" + KickStarter.inventoryManager.GetLabelList()[invNumber]; combineActionList[i] = ActionListAssetMenu.AssetGUI(string.Empty, combineActionList[i], autoName, apiPrefix + ".combineActionList[" + i + "]", "A List of all 'Combine' InvInteraction objects associated with the item"); if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth)) { Undo.RecordObject(KickStarter.inventoryManager, "Delete combine event"); combineActionList.RemoveAt(i); combineID.RemoveAt(i); break; } EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Add combine event")) { Undo.RecordObject(KickStarter.inventoryManager, "Add new combine event"); combineActionList.Add(null); combineID.Add(0); } // List all "reverse" inventory combinations string reverseCombinations = string.Empty; foreach (InvItem otherItem in KickStarter.inventoryManager.items) { if (otherItem != this) { if (otherItem.combineID.Contains(id)) { reverseCombinations += "- " + otherItem.label + "\n"; continue; } } } if (reverseCombinations.Length > 0) { EditorGUILayout.Space(); EditorGUILayout.HelpBox("The following inventory items have combine interactions that reference this item:\n" + reverseCombinations, MessageType.Info); } if (KickStarter.inventoryManager.invVars.Count > 0) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Properties", CustomStyles.subHeader); RebuildProperties(); // UI for setting property values if (vars.Count > 0) { foreach (InvVar invVar in vars) { invVar.ShowGUI(apiPrefix + ".GetProperty (" + invVar.id + ")"); } } else { EditorGUILayout.HelpBox("No properties have been defined that this inventory item can use.", MessageType.Info); } } }
public override void CharSettingsGUI() { #if UNITY_EDITOR if (!tk2DIntegration.IsDefinePresent()) { EditorGUILayout.HelpBox("'tk2DIsPresent' must be listed in your Unity Player Setting's 'Scripting define symbols' for AC's 2D Toolkit integration to work.", MessageType.Warning); } EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Standard 2D animations", EditorStyles.boldLabel); character.talkingAnimation = TalkingAnimation.Standard; character.spriteChild = (Transform)CustomGUILayout.ObjectField <Transform> ("Sprite child:", character.spriteChild, true, "", "The sprite Transform, which should be a child GameObject"); character.idleAnimSprite = CustomGUILayout.TextField("Idle name:", character.idleAnimSprite, "", "The name of the 'Idle' animation(s), without suffix"); character.walkAnimSprite = CustomGUILayout.TextField("Walk name:", character.walkAnimSprite, "", "The name of the 'Walk' animation(s), without suffix"); character.runAnimSprite = CustomGUILayout.TextField("Run name:", character.runAnimSprite, "", "The name of the 'Run' animation(s), without suffix"); character.talkAnimSprite = CustomGUILayout.TextField("Talk name:", character.talkAnimSprite, "", "The name of the 'Talk' animation(s), without suffix"); character.spriteDirectionData.ShowGUI(); character.angleSnapping = AngleSnapping.None; if (character.spriteDirectionData.HasDirections()) { character.frameFlipping = (AC_2DFrameFlipping)CustomGUILayout.EnumPopup("Frame flipping:", character.frameFlipping, "", "The type of frame-flipping to use"); if (character.frameFlipping != AC_2DFrameFlipping.None) { character.flipCustomAnims = CustomGUILayout.Toggle("Flip custom animations?", character.flipCustomAnims, "", "If True, then custom animations will also be flipped"); } } if (SceneSettings.CameraPerspective != CameraPerspective.TwoD) { character.rotateSprite3D = (RotateSprite3D)CustomGUILayout.EnumPopup("Rotate sprite to:", character.rotateSprite3D, "", "The method by which the character should face the camera"); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(" ", GUILayout.Width(9)); listExpectedAnimations = EditorGUILayout.Foldout(listExpectedAnimations, "List expected animations?"); EditorGUILayout.EndHorizontal(); if (listExpectedAnimations) { string result = "\n"; result = ShowExpected(character, character.idleAnimSprite, result); result = ShowExpected(character, character.walkAnimSprite, result); result = ShowExpected(character, character.runAnimSprite, result); if (character.talkingAnimation == TalkingAnimation.Standard) { result = ShowExpected(character, character.talkAnimSprite, result); } EditorGUILayout.HelpBox("The following animations are required, based on the settings above:" + result, MessageType.Info); } EditorGUILayout.EndVertical(); if (GUI.changed && character != null) { EditorUtility.SetDirty(character); } #endif }
public override void ShowGUI(Menu menu) { string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); inventoryBoxType = (AC_InventoryBoxType)CustomGUILayout.EnumPopup("Inventory box type:", inventoryBoxType, apiPrefix + ".inventoryBoxType"); if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript) { maxSlots = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots"); isClickable = true; } else if (inventoryBoxType == AC_InventoryBoxType.DisplaySelected) { isClickable = false; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected) { isClickable = true; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.Container) { isClickable = true; maxSlots = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots"); selectItemsAfterTaking = CustomGUILayout.Toggle("Select item after taking?", selectItemsAfterTaking, apiPrefix + ".selectItemsAfterTaking"); } else { isClickable = true; if (source == MenuSource.AdventureCreator) { numSlots = CustomGUILayout.IntField("Test slots:", numSlots, apiPrefix + ".numSlots"); } maxSlots = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots"); } if (inventoryBoxType == AC_InventoryBoxType.HotspotBased) { limitToDefinedInteractions = CustomGUILayout.ToggleLeft("Only show items referenced in Interactions?", limitToDefinedInteractions, apiPrefix + ".limitToDefinedInteractions"); if (maxSlots == 1) { alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton"); } } displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType"); if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator) { EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning); } if (inventoryBoxType != AC_InventoryBoxType.DisplaySelected && inventoryBoxType != AC_InventoryBoxType.DisplayLastSelected && source == MenuSource.AdventureCreator) { slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f, apiPrefix + ".slotSpacing"); orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation"); if (orientation == ElementOrientation.Grid) { gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth"); } } if (inventoryBoxType == AC_InventoryBoxType.CustomScript) { ShowClipHelp(); } uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When slot is empty:", uiHideStyle, apiPrefix + ".uiHideStyle"); if (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel); uiSlots = ResizeUISlots(uiSlots, maxSlots); for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI(i, source); } linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic); // Don't show if Single and Default or Custom Script if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript) { if (KickStarter.settingsManager != null && KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple) { uiPointerState = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState"); } } else { uiPointerState = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState"); } } EditorGUILayout.EndVertical(); if (CanBeLimitedByCategory()) { ShowCategoriesUI(apiPrefix); } base.ShowGUI(menu); }