public static void ShowPropertiesGUI(ActionListAsset _target) { CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Asset properties", EditorStyles.boldLabel); _target.actionListType = (ActionListType)EditorGUILayout.EnumPopup("When running:", _target.actionListType); if (_target.actionListType == ActionListType.PauseGameplay) { _target.isSkippable = EditorGUILayout.Toggle("Is skippable?", _target.isSkippable); _target.unfreezePauseMenus = EditorGUILayout.Toggle("Unfreeze 'pause' Menus?", _target.unfreezePauseMenus); } _target.canRunMultipleInstances = EditorGUILayout.Toggle("Can run multiple instances?", _target.canRunMultipleInstances); if (!_target.IsSkippable()) { _target.canSurviveSceneChanges = EditorGUILayout.Toggle("Can survive scene changes?", _target.canSurviveSceneChanges); } _target.useParameters = EditorGUILayout.Toggle("Use parameters?", _target.useParameters); if (_target.useParameters) { _target.revertToDefaultParametersAfterRunning = EditorGUILayout.ToggleLeft("Revert to default parameter values after running?", _target.revertToDefaultParametersAfterRunning); } CustomGUILayout.EndVertical(); if (_target.useParameters) { EditorGUILayout.Space(); CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel); ActionListEditor.ShowParametersGUI(null, _target, _target.GetParameters()); CustomGUILayout.EndVertical(); } _target.tagID = ActionListEditor.ShowTagUI(_target.actions.ToArray(), _target.tagID); }
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 OnInspectorGUI() { RuntimeActionList _target = (RuntimeActionList)target; if (Application.isPlaying) { CustomGUILayout.BeginVertical(); EditorGUILayout.ObjectField("Asset source:", _target.assetSource, typeof(ActionListAsset), false); if (_target.useParameters) { CustomGUILayout.EndVertical(); CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel); ActionListEditor.ShowParametersGUI(_target, null, _target.parameters); } CustomGUILayout.EndVertical(); } else { EditorGUILayout.HelpBox("This component should not be added manually - it is added automatically by AC at runtime.", MessageType.Warning); } UnityVersionHandler.CustomSetDirty(_target); }
public override void OnInspectorGUI() { ManagerPackage _target = (ManagerPackage)target; CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Manager asset files", EditorStyles.boldLabel); _target.sceneManager = (SceneManager)EditorGUILayout.ObjectField("Scene manager:", _target.sceneManager, typeof(SceneManager), false); _target.settingsManager = (SettingsManager)EditorGUILayout.ObjectField("Settings manager:", _target.settingsManager, typeof(SettingsManager), false); _target.actionsManager = (ActionsManager)EditorGUILayout.ObjectField("Actions manager:", _target.actionsManager, typeof(ActionsManager), false); _target.variablesManager = (VariablesManager)EditorGUILayout.ObjectField("Variables manager:", _target.variablesManager, typeof(VariablesManager), false); _target.inventoryManager = (InventoryManager)EditorGUILayout.ObjectField("Inventory manager:", _target.inventoryManager, typeof(InventoryManager), false); _target.speechManager = (SpeechManager)EditorGUILayout.ObjectField("Speech manager:", _target.speechManager, typeof(SpeechManager), false); _target.cursorManager = (CursorManager)EditorGUILayout.ObjectField("Cursor manager:", _target.cursorManager, typeof(CursorManager), false); _target.menuManager = (MenuManager)EditorGUILayout.ObjectField("Menu manager:", _target.menuManager, typeof(MenuManager), false); CustomGUILayout.EndVertical(); EditorGUILayout.Space(); if (GUILayout.Button("Assign managers")) { Undo.RecordObject(AdvGame.GetReferences(), "Assign managers"); _target.AssignManagers(); AdventureCreator.RefreshActions(); AdventureCreator.Init(); } EditorUtility.SetDirty(_target); }
public override void OnInspectorGUI() { RememberTransform _target = (RememberTransform)target; CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Transform", EditorStyles.boldLabel); _target.transformSpace = (GlobalLocal)CustomGUILayout.EnumPopup("Co-ordinate space:", _target.transformSpace, "", "The co-ordinate space to store position and rotation values in"); _target.saveParent = CustomGUILayout.Toggle("Save change in Parent?", _target.saveParent, "", "If True, the GameObject's change in parent should be recorded"); _target.saveScenePresence = CustomGUILayout.Toggle("Save scene presence?", _target.saveScenePresence, "", "If True, the GameObject's change in scene presence should be recorded"); if (_target.saveScenePresence) { if (Application.isPlaying && _target.gameObject.IsPersistent()) { EditorGUILayout.HelpBox("Objects that survive scene-changes cannot have their scene presence saved.", MessageType.Warning); } else { _target.linkedPrefabID = CustomGUILayout.IntField("Linked prefab ConstantID:", _target.linkedPrefabID, "", "If non-zero, the Constant ID number of the prefab to re-spawn if not present in the scene, but saveScenePresence = true. If zero, the prefab will be assumed to have the same ID as this."); EditorGUILayout.HelpBox("If the above is non-zero, the Resources prefab with that ID number will be spawned if this is not present in the scene. This allows for multiple instances of the object to be spawned.", MessageType.Info); _target.retainInPrefab = true; EditorGUILayout.HelpBox("This prefab must be placed in a 'Resources' asset folder", MessageType.Info); } } CustomGUILayout.EndVertical(); SharedGUI(); }
public override void ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuGraphic)"; MenuSource source = menu.menuSource; CustomGUILayout.BeginVertical(); 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); } CustomGUILayout.EndVertical(); CustomGUILayout.BeginVertical(); } 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"); } CustomGUILayout.EndVertical(); base.ShowGUI(menu); }
private void ShowColumnsGUI() { 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(); if (exportColumns[i].GetHeader() == "Label") { replaceForwardSlashes = EditorGUILayout.Toggle("Replace '/' with '.'?", replaceForwardSlashes); } CustomGUILayout.EndVertical(); } EditorGUILayout.Space(); if (GUILayout.Button("Add new column")) { exportColumns.Add(new ExportColumn()); } EditorGUILayout.Space(); }
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(); } } }
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(); }
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(); }
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(); }
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 void ShowCursorInfluenceGUI() { CustomGUILayout.BeginVertical(); 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"); followCursorSpeed = CustomGUILayout.Slider("Follow speed:", followCursorSpeed, 0f, 10f, "", "The speed at which the camera follows the cursor."); 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 && 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); } } CustomGUILayout.EndVertical(); }
private void ActionListGUI(string label, string menuTitle, string suffix, string apiPrefix, string tooltip) { actionListOnSave = ActionListAssetMenu.AssetGUI(label, actionListOnSave, menuTitle + "_" + title + "_" + suffix, apiPrefix + ".actionListOnSave", tooltip); if (actionListOnSave && actionListOnSave.NumParameters > 0) { CustomGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); parameterID = Action.ChooseParameterGUI(string.Empty, actionListOnSave.DefaultParameters, parameterID, ParameterType.Integer); bool found = false; foreach (ActionParameter _parameter in actionListOnSave.DefaultParameters) { if (_parameter.parameterType == ParameterType.Integer) { found = true; } } if (found) { if (fixedOption || allowEmptySlots) { EditorGUILayout.LabelField("(= Save ID #)"); } else { EditorGUILayout.LabelField("(= Slot index)"); } } EditorGUILayout.EndHorizontal(); CustomGUILayout.EndVertical(); } }
public override void OnInspectorGUI() { FirstPersonCamera _target = (FirstPersonCamera)target; CustomGUILayout.BeginVertical(); _target.headBob = EditorGUILayout.Toggle("Bob head when moving?", _target.headBob); if (_target.headBob) { _target.headBobMethod = (FirstPersonHeadBobMethod)EditorGUILayout.EnumPopup("Head-bob method:", _target.headBobMethod); if (_target.headBobMethod == FirstPersonHeadBobMethod.BuiltIn) { _target.builtInSpeedFactor = EditorGUILayout.FloatField("Speed factor:", _target.builtInSpeedFactor); _target.bobbingAmount = EditorGUILayout.FloatField("Height change factor:", _target.bobbingAmount); } else if (_target.headBobMethod == FirstPersonHeadBobMethod.CustomAnimation) { _target.headBobSpeedParameter = EditorGUILayout.TextField("Forward speed float parameter:", _target.headBobSpeedParameter); _target.headBobSpeedSideParameter = EditorGUILayout.TextField("Sideways speed float parameter:", _target.headBobSpeedSideParameter); if (_target.GetComponent <Animator>() == null) { EditorGUILayout.HelpBox("This GameObject must have an Animator component attached.", MessageType.Warning); } } else if (_target.headBobMethod == FirstPersonHeadBobMethod.CustomScript) { EditorGUILayout.HelpBox("The component's public method 'GetHeadBobSpeed' will return the desired head-bobbing speed.", MessageType.Info); } } CustomGUILayout.EndVertical(); CustomGUILayout.BeginVertical(); _target.allowMouseWheelZooming = EditorGUILayout.Toggle("Allow mouse-wheel zooming?", _target.allowMouseWheelZooming); if (_target.allowMouseWheelZooming) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Min FOV:", labelWidth); _target.minimumZoom = EditorGUILayout.FloatField(_target.minimumZoom, intWidth); EditorGUILayout.LabelField("Max FOV:", labelWidth); _target.maximumZoom = EditorGUILayout.FloatField(_target.maximumZoom, intWidth); EditorGUILayout.EndHorizontal(); } CustomGUILayout.EndVertical(); CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Constrain pitch-rotation (degrees)"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Min:", labelWidth); _target.minY = EditorGUILayout.FloatField(_target.minY, intWidth); EditorGUILayout.LabelField("Max:", labelWidth); _target.maxY = EditorGUILayout.FloatField(_target.maxY, intWidth); EditorGUILayout.EndHorizontal(); CustomGUILayout.EndVertical(); CustomGUILayout.BeginVertical(); _target.sensitivity = EditorGUILayout.Vector2Field("Freelook sensitivity:", _target.sensitivity); CustomGUILayout.EndVertical(); UnityVersionHandler.CustomSetDirty(_target); }
public void SnapDataGUI(DragTrack _target, bool useAngles) { CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Track regions", EditorStyles.boldLabel); for (int i = 0; i < _target.allTrackSnapData.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Region " + _target.allTrackSnapData[i].ID.ToString()); GUILayout.FlexibleSpace(); if (GUILayout.Button("-")) { Undo.RecordObject(this, "Delete region"); _target.allTrackSnapData.RemoveAt(i); i = -1; break; } EditorGUILayout.EndHorizontal(); _target.allTrackSnapData[i] = _target.allTrackSnapData[i].ShowGUI(_target, useAngles); EditorGUILayout.Space(); if (i < _target.allTrackSnapData.Count - 1) { GUILayout.Box(string.Empty, GUILayout.ExpandWidth(true), GUILayout.Height(1)); } } if (GUILayout.Button("Create new track region")) { Undo.RecordObject(this, "Create track region"); TrackSnapData trackSnapData = new TrackSnapData(0f, GetSnapIDArray(_target.allTrackSnapData)); _target.allTrackSnapData.Add(trackSnapData); } CustomGUILayout.EndVertical(); if (_target.allTrackSnapData.Count > 0) { CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Snapping", EditorStyles.boldLabel); _target.doSnapping = CustomGUILayout.Toggle("Enable region snapping?", _target.doSnapping, string.Empty, "If True, then snapping is enabled and any object attached to the track can snap to pre-set regions along it when let go by the player"); if (_target.doSnapping) { _target.snapSpeed = CustomGUILayout.FloatField("Snap speed:", _target.snapSpeed, string.Empty, "The speed to move by when attached objects snap"); _target.onlySnapOnPlayerRelease = CustomGUILayout.Toggle("Only snap on release?", _target.onlySnapOnPlayerRelease, string.Empty, "If True, then snapping will only occur when the player releases the object - and not when moving on its own accord"); _target.actionListSource = (ActionListSource)CustomGUILayout.EnumPopup("ActionList source:", _target.actionListSource, string.Empty, "The source of ActionLists that can be run when a draggable option snaps to a region."); } CustomGUILayout.EndVertical(); } UnityVersionHandler.CustomSetDirty(_target); }
public static void PropertiesGUI(Cutscene _target) { CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Cutscene properties", EditorStyles.boldLabel); _target.source = (ActionListSource)CustomGUILayout.EnumPopup("Actions source:", _target.source, "", "Where the Actions are stored"); if (_target.source == ActionListSource.AssetFile) { _target.assetFile = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList asset:", _target.assetFile, false, "", "The ActionList asset that stores the Actions"); _target.syncParamValues = CustomGUILayout.Toggle("Sync parameter values?", _target.syncParamValues, "", "If True, the ActionList asset's parameter values will be shared amongst all linked ActionLists"); } _target.actionListType = (ActionListType)CustomGUILayout.EnumPopup("When running:", _target.actionListType, "", "The effect that running the Actions has on the rest of the game"); if (_target.actionListType == ActionListType.PauseGameplay) { _target.isSkippable = CustomGUILayout.Toggle("Is skippable?", _target.isSkippable, "", "If True, the Actions will be skipped when the user presses the 'EndCutscene' Input button"); } _target.triggerTime = CustomGUILayout.Slider("Start delay (s):", _target.triggerTime, 0f, 10f, "", "The delay, in seconds, before the Actions are run when the ActionList is triggered"); _target.autosaveAfter = CustomGUILayout.Toggle("Autosave after?", _target.autosaveAfter, "", "If True, the game will auto-save when the Actions have finished running"); _target.tagID = ShowTagUI(_target.actions.ToArray(), _target.tagID); if (_target.source == ActionListSource.InScene) { _target.useParameters = CustomGUILayout.Toggle("Use parameters?", _target.useParameters, "", "If True, ActionParameters can be used to override values within the Action objects"); } else if (_target.source == ActionListSource.AssetFile && _target.assetFile != null && !_target.syncParamValues && _target.assetFile.useParameters) { _target.useParameters = CustomGUILayout.Toggle("Set local parameter values?", _target.useParameters, "", "If True, parameter values set here will be assigned locally, and not on the ActionList asset"); } CustomGUILayout.EndVertical(); if (_target.useParameters) { if (_target.source == ActionListSource.InScene) { EditorGUILayout.Space(); CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel); ActionListEditor.ShowParametersGUI(_target, null, _target.parameters); CustomGUILayout.EndVertical(); } else if (!_target.syncParamValues && _target.source == ActionListSource.AssetFile && _target.assetFile != null && _target.assetFile.useParameters) { bool isAsset = UnityVersionHandler.IsPrefabFile(_target.gameObject); EditorGUILayout.Space(); CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Local parameter values", EditorStyles.boldLabel); ActionListEditor.ShowLocalParametersGUI(_target.parameters, _target.assetFile.GetParameters(), isAsset); CustomGUILayout.EndVertical(); } } }
protected void NPC_GUI(NPC _target) { CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("NPC settings:", EditorStyles.boldLabel); _target.moveOutOfPlayersWay = CustomGUILayout.Toggle("Keep out of Player's way?", _target.moveOutOfPlayersWay, "", "If True, the NPC will attempt to keep out of the Player's way"); if (_target.moveOutOfPlayersWay) { _target.minPlayerDistance = CustomGUILayout.FloatField("Min. distance to keep:", _target.minPlayerDistance, "", "The minimum distance to keep from the Player"); } CustomGUILayout.EndVertical(); }
public void ShowGUI(int i) { CustomGUILayout.BeginVertical(); GUILayout.Label("Column # : " + header); if (i > 0) { importColumnType = (ImportColumnType)EditorGUILayout.EnumPopup("Import rule:", importColumnType); } CustomGUILayout.EndVertical(); }
public void ShowGUI() { isPlayerLine = CustomGUILayout.Toggle("Player line?", isPlayerLine, "", "If True, the line is spoken by the active Player"); if (isPlayerLine) { if (KickStarter.settingsManager && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow) { playerID = ChoosePlayerGUI(playerID); } } else { // For some reason, dynamically generating an ID number for a Char component destroys the component (?!), so we need to store a GameObject instead and convert to Char in the GUI Char speakerPrefab = (speakerObject != null) ? speakerObject.GetComponent <Char>() : null; speakerPrefab = (Char)CustomGUILayout.ObjectField <Char> ("Speaker prefab:", speakerPrefab, false, "", "The prefab of the character who is speaking the lines on this track"); speakerObject = (speakerPrefab != null) ? speakerPrefab.gameObject : null; if (speakerObject != null) { if (speakerObject.GetComponent <ConstantID>() == null || speakerObject.GetComponent <ConstantID>().constantID == 0) { UnityVersionHandler.AddConstantIDToGameObject <ConstantID> (speakerObject, true); } if (speakerObject.GetComponent <ConstantID>()) { speakerConstantID = speakerObject.GetComponent <ConstantID>().constantID; } if (speakerObject.GetComponent <ConstantID>() == null || speakerConstantID == 0) { EditorGUILayout.HelpBox("A Constant ID number must be assigned to " + speakerObject + ". Attach a ConstantID component and check 'Retain in prefab?'", MessageType.Warning); } else { CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Recorded ConstantID: " + speakerConstantID.ToString(), EditorStyles.miniLabel); CustomGUILayout.EndVertical(); } } } playbackMode = (SpeechTrackPlaybackMode)EditorGUILayout.EnumPopup("Playback mode:", playbackMode); if (playbackMode == SpeechTrackPlaybackMode.Natural) { EditorGUILayout.HelpBox("Speech lines will last as long as the settings in the Speech Manager dictate.", MessageType.Info); } else if (playbackMode == SpeechTrackPlaybackMode.ClipDuration) { EditorGUILayout.HelpBox("Speech lines will last for the duration of their associated Timeline clip.", MessageType.Info); } }
public override void OnInspectorGUI() { GameCamera25D _target = (GameCamera25D)target; CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Background image", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); _target.backgroundImage = (BackgroundImage)CustomGUILayout.ObjectField <BackgroundImage> ("Background:", _target.backgroundImage, true, "", "The BackgroundImage to display underneath all scene objects"); if (_target.backgroundImage) { if (!Application.isPlaying && GUILayout.Button("Set as active", GUILayout.MaxWidth(90f))) { Undo.RecordObject(_target, "Set active background"); _target.SetActiveBackground(); } } else { if (GUILayout.Button("Create", GUILayout.MaxWidth(90f))) { Undo.RecordObject(_target, "Create Background Image"); BackgroundImage newBackgroundImage = SceneManager.AddPrefab("SetGeometry", "BackgroundImage", true, false, true).GetComponent <BackgroundImage>(); string cameraName = _target.gameObject.name; newBackgroundImage.gameObject.name = AdvGame.UniqueName(cameraName + ": Background"); _target.backgroundImage = newBackgroundImage; } } EditorGUILayout.EndHorizontal(); if (MainCamera.AllowProjectionShifting(_target.GetComponent <Camera>())) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Perspective offset", EditorStyles.boldLabel); _target.perspectiveOffset.x = CustomGUILayout.Slider("Horizontal:", _target.perspectiveOffset.x, -0.05f, 0.05f, "", "The horizontal offset in perspective from the camera's centre"); _target.perspectiveOffset.y = CustomGUILayout.Slider("Vertical:", _target.perspectiveOffset.y, -0.05f, 0.05f, "", "The vertical offset in perspective from the camera's centre"); } CustomGUILayout.EndVertical(); if (_target.isActiveEditor) { _target.UpdateCameraSnap(); } UnityVersionHandler.CustomSetDirty(_target); }
protected void SharedGUI(string headerLabel) { SettingsManager settingsManager = AdvGame.GetReferences().settingsManager; EditorGUILayout.BeginVertical(CustomStyles.thinBox); showTracks = CustomGUILayout.ToggleHeader(showTracks, headerLabel); if (showTracks) { List <MusicStorage> storages = Storages; float scrollHeight = Mathf.Min(355f, (storages.Count * 66f) + 5f); scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(scrollHeight)); for (int i = 0; i < storages.Count; i++) { CustomGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(storages[i].ID.ToString() + ":", EditorStyles.boldLabel); if (GUILayout.Button("-", GUILayout.MaxWidth(20f))) { Undo.RecordObject(settingsManager, "Delete entry"); storages.RemoveAt(i); i = 0; return; } EditorGUILayout.EndHorizontal(); storages[i].audioClip = (AudioClip)EditorGUILayout.ObjectField("Clip:", storages[i].audioClip, typeof(AudioClip), false); storages[i].relativeVolume = EditorGUILayout.Slider("Relative volume:", storages[i].relativeVolume, 0f, 1f); CustomGUILayout.EndVertical(); } EditorGUILayout.EndScrollView(); if (GUILayout.Button("Add new clip")) { Undo.RecordObject(settingsManager, "Delete music entry"); storages.Add(new MusicStorage(GetIDArray(storages.ToArray()))); } Storages = storages; } CustomGUILayout.EndVertical(); if (GUI.changed) { EditorUtility.SetDirty(settingsManager); } }
public static void PropertiesGUI(DialogueOption _target) { CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Dialogue Option properties", EditorStyles.boldLabel); _target.source = (ActionListSource)CustomGUILayout.EnumPopup("Actions source:", _target.source, "", "Where the Actions are stored"); if (_target.source == ActionListSource.AssetFile) { _target.assetFile = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList asset:", _target.assetFile, false, "", "The ActionList asset that stores the Actions"); _target.syncParamValues = CustomGUILayout.Toggle("Sync parameter values?", _target.syncParamValues, "", "If True, the ActionList asset's parameter values will be shared amongst all linked ActionLists"); } if (_target.actionListType == ActionListType.PauseGameplay) { _target.isSkippable = CustomGUILayout.Toggle("Is skippable?", _target.isSkippable, "", "If True, the Actions will be skipped when the user presses the 'EndCutscene' Input button"); } _target.tagID = ShowTagUI(_target.actions.ToArray(), _target.tagID); if (_target.source == ActionListSource.InScene) { _target.useParameters = CustomGUILayout.Toggle("Use parameters?", _target.useParameters, "", "If True, ActionParameters can be used to override values within the Action objects"); } else if (_target.source == ActionListSource.AssetFile && _target.assetFile != null && !_target.syncParamValues && _target.assetFile.useParameters) { _target.useParameters = CustomGUILayout.Toggle("Set local parameter values?", _target.useParameters, "", "If True, parameter values set here will be assigned locally, and not on the ActionList asset"); } CustomGUILayout.EndVertical(); if (_target.useParameters) { if (_target.source == ActionListSource.InScene) { EditorGUILayout.Space(); CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel); ShowParametersGUI(_target, null, _target.parameters); CustomGUILayout.EndVertical(); } else if (!_target.syncParamValues && _target.source == ActionListSource.AssetFile && _target.assetFile != null && _target.assetFile.useParameters) { bool isAsset = UnityVersionHandler.IsPrefabFile(_target.gameObject); EditorGUILayout.Space(); CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Local parameter values", EditorStyles.boldLabel); ShowLocalParametersGUI(_target.parameters, _target.assetFile.GetParameters(), isAsset); CustomGUILayout.EndVertical(); } } }
protected void SharedGUI() { ConstantID _target = (ConstantID)target; CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Constant ID number", EditorStyles.boldLabel); _target.autoManual = (AutoManual)CustomGUILayout.EnumPopup("Set:", _target.autoManual, "", "Is the Constant ID set automatically or manually?"); _target.retainInPrefab = CustomGUILayout.Toggle("Retain in prefab?", _target.retainInPrefab, "", "If True, prefabs will share the same Constant ID as their scene-based counterparts"); bool ignoreDirty = false; if (UnityVersionHandler.IsPrefabFile(_target.gameObject)) { // Prefab if (!_target.retainInPrefab && _target.constantID != 0) { _target.constantID = 0; // Don't flag as dirty, otherwise get problems with scene instances ignoreDirty = true; } else if (_target.retainInPrefab && _target.constantID == 0) { _target.SetNewID_Prefab(); } } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("ID:", "The recorded Constant ID number"), GUILayout.Width(50f)); if (_target.autoManual == AutoManual.Automatic) { EditorGUILayout.LabelField(_target.constantID.ToString()); } else { _target.constantID = EditorGUILayout.DelayedIntField(_target.constantID); } if (GUILayout.Button("Copy number")) { EditorGUIUtility.systemCopyBuffer = _target.constantID.ToString(); } EditorGUILayout.EndHorizontal(); CustomGUILayout.EndVertical(); if (!ignoreDirty) { UnityVersionHandler.CustomSetDirty(_target); } }
public override void OnInspectorGUI() { DragTrack_Hinge _target = (DragTrack_Hinge)target; CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Track shape:", EditorStyles.boldLabel); _target.radius = CustomGUILayout.FloatField("Radius:", _target.radius, "", "The track's radius (for visualising in the Scene window)"); if (_target.radius < 0f) { _target.radius = 0f; } _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.Slider("Maximum angle:", _target.maxAngle, 0f, 360, "", "How much an object can be rotated by"); } 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"); if (_target.maxRevolutions < 1) { _target.maxRevolutions = 1; } } } _target.dragMovementCalculation = (DragMovementCalculation)CustomGUILayout.EnumPopup("Movement input:", _target.dragMovementCalculation); if (_target.dragMovementCalculation == DragMovementCalculation.DragVector) { _target.alignDragToFront = CustomGUILayout.ToggleLeft("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"); } else if (_target.dragMovementCalculation == DragMovementCalculation.CursorPosition && !_target.Loops) { _target.preventEndToEndJumping = CustomGUILayout.ToggleLeft("Prevent end-to-end jumping?", _target.preventEndToEndJumping, "", "If True, then the dragged object will be prevented from jumping from one end to the other without first moving somewhere in between"); } _target.discSize = CustomGUILayout.Slider("Gizmo size:", _target.discSize, 0f, 2f, "", "The size of the track's ends, as seen in the Scene window"); CustomGUILayout.EndVertical(); SnapDataGUI(_target, true); UnityVersionHandler.CustomSetDirty(_target); }
public override void OnInspectorGUI() { GameCamera2DDrag _target = (GameCamera2DDrag)target; // X CustomGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("X movement", "How movement along the X-axis is affected"), EditorStyles.boldLabel, GUILayout.Width(130f)); _target.xLock = (RotationLock)EditorGUILayout.EnumPopup(_target.xLock); EditorGUILayout.EndHorizontal(); if (_target.xLock != RotationLock.Locked) { _target.xSpeed = CustomGUILayout.FloatField("Speed:", _target.xSpeed, "", "The speed of X-axis movement"); _target.xAcceleration = CustomGUILayout.FloatField("Acceleration:", _target.xAcceleration, "", "The acceleration of X-axis movement"); _target.xDeceleration = CustomGUILayout.FloatField("Deceleration:", _target.xDeceleration, "", "The deceleration of X-axis movement"); _target.invertX = CustomGUILayout.Toggle("Invert?", _target.invertX, "", "If True, then X-axis movement will be inverted"); _target.xOffset = CustomGUILayout.FloatField("Offset:", _target.xOffset, "", "The X-axis offset"); if (_target.xLock == RotationLock.Limited) { _target.minX = CustomGUILayout.FloatField("Minimum X:", _target.minX, "", "The minimum X-axis value"); _target.maxX = CustomGUILayout.FloatField("Maximum X:", _target.maxX, "", "The maximum X-axis value"); } } CustomGUILayout.EndVertical(); // Y CustomGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Y movement", "How movement along the Y-axis is affected"), EditorStyles.boldLabel, GUILayout.Width(130f)); _target.yLock = (RotationLock)EditorGUILayout.EnumPopup(_target.yLock); EditorGUILayout.EndHorizontal(); if (_target.yLock != RotationLock.Locked) { _target.ySpeed = CustomGUILayout.FloatField("Speed:", _target.ySpeed, "", "The speed of Y-axis movement"); _target.yAcceleration = CustomGUILayout.FloatField("Acceleration:", _target.yAcceleration, "", "The acceleration of Y-axis movement"); _target.yDeceleration = CustomGUILayout.FloatField("Deceleration:", _target.yDeceleration, "", "The deceleration of Y-axis movement"); _target.invertY = CustomGUILayout.Toggle("Invert?", _target.invertY, "", "If True, then Y-axis movement will be inverted"); _target.yOffset = CustomGUILayout.FloatField("Offset:", _target.yOffset, "", "The Y-axis offset"); if (_target.yLock == RotationLock.Limited) { _target.minY = CustomGUILayout.FloatField("Minimum Y:", _target.minY, "", "The minimum Y-axis value"); _target.maxY = CustomGUILayout.FloatField("Maximum Y:", _target.maxY, "", "The maximum Y-axis value"); } } CustomGUILayout.EndVertical(); UnityVersionHandler.CustomSetDirty(_target); }
public override void ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuInteraction)"; MenuSource source = menu.menuSource; CustomGUILayout.BeginVertical(); GetCursorGUI(apiPrefix, source); displayType = (AC_DisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How interactions are displayed"); if (fixedIcon) { alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton", "The name of the input button that triggers the element when pressed"); } if (source == MenuSource.AdventureCreator) { if (displayType != AC_DisplayType.TextOnly && fixedIcon) { 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 { CustomGUILayout.EndVertical(); CustomGUILayout.BeginVertical(); if (fixedIcon) { uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source, "The Unity UI Button this is linked to"); } else { uiSlots = ResizeUISlots(uiSlots, maxSlots); for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI(i, source); } } 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"); linkUIGraphic = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to"); } CustomGUILayout.EndVertical(); base.ShowGUI(menu); }
public override void OnInspectorGUI() { RememberVideoPlayer _target = (RememberVideoPlayer)target; CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Video", EditorStyles.boldLabel); _target.saveClipAsset = CustomGUILayout.Toggle("Save clip asset?", _target.saveClipAsset, "", "If True, the VideoClip assigned in the VideoPlayer component will be stored in save game files."); if (_target.saveClipAsset) { EditorGUILayout.HelpBox("Both the original and new 'Video clip' assets will need placing in a Resources folder.", MessageType.Info); } CustomGUILayout.EndVertical(); SharedGUI(); }
public override void OnInspectorGUI() { _Camera _target = (_Camera)target; EditorGUILayout.HelpBox("Attach this script to a custom Camera type to integrate it with Adventure Creator.", MessageType.Info); _target.isFor2D = CustomGUILayout.Toggle("Is for a 2D game?", _target.isFor2D, "", "Check this box if the scene is in 2D, i.e. makes use of 2D Colliders and Raycasts"); CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Depth of field", EditorStyles.boldLabel); _target.focalDistance = CustomGUILayout.FloatField("Focal distance", _target.focalDistance, "", "The camera's focal distance. When the MainCamera is attached to this camera, it can be read through script with 'AC.KickStarter.mainCamera.GetFocalDistance()' and used to update your post-processing method."); CustomGUILayout.EndVertical(); UnityVersionHandler.CustomSetDirty(_target); }
public override void OnInspectorGUI() { if (_target == null) { return; } CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Conversation settings", EditorStyles.boldLabel); _target.interactionSource = (AC.InteractionSource)CustomGUILayout.EnumPopup("Interaction source:", _target.interactionSource, "", "The source of the commands that are run when an option is chosen"); _target.autoPlay = CustomGUILayout.Toggle("Auto-play lone option?", _target.autoPlay, "", "If True, and only one option is available, then the option will be chosen automatically"); _target.isTimed = CustomGUILayout.Toggle("Is timed?", _target.isTimed, "", "If True, then the Conversation is timed, and the options will only be shown for a fixed period"); if (_target.isTimed) { _target.timer = CustomGUILayout.FloatField("Timer length (s):", _target.timer, "", "The duration, in seconds, that the Conversation is active"); if (_target.options != null && _target.options.Count > 0) { bool noDefault = (_target.defaultOption < 0); noDefault = CustomGUILayout.Toggle("End if timer runs out?", noDefault, "", "If True, the Conversation will end when the timer runs out - and no option will be chosen"); if (noDefault) { _target.defaultOption = -1; } else if (_target.defaultOption < 0) { _target.defaultOption = 0; } } else { _target.defaultOption = -1; } } CustomGUILayout.EndVertical(); EditorGUILayout.Space(); CreateOptionsGUI(); EditorGUILayout.Space(); if (_target.selectedOption != null && _target.options.Contains(_target.selectedOption)) { EditorGUILayout.LabelField("Dialogue option '" + _target.selectedOption.label + "' properties", EditorStyles.boldLabel); EditOptionGUI(_target.selectedOption, _target.interactionSource); } UnityVersionHandler.CustomSetDirty(_target); }