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); }
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); }
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(); } }
protected void OnGUI() { if (AdvGame.GetReferences().settingsManager == null) { EditorGUILayout.HelpBox ("A Settings Manager must be assigned before this window can display correctly.", MessageType.Warning); return; } if (KickStarter.settingsManager) { EditorGUILayout.BeginVertical (CustomStyles.thinBox); showOptions = CustomGUILayout.ToggleHeader (showOptions, "Ambience settings"); if (showOptions) { KickStarter.settingsManager.playAmbienceWhilePaused = CustomGUILayout.ToggleLeft ("Can play when game is paused?", KickStarter.settingsManager.playAmbienceWhilePaused, "AC.KickStarter.settingsManager.playAmbienceWhilePaused", "If True, then ambience can play when the game is paused"); KickStarter.settingsManager.loadAmbienceFadeTime = CustomGUILayout.Slider ("Fade time after loading:", KickStarter.settingsManager.loadAmbienceFadeTime, 0f, 5f, "AC.KickStarter.settingsManager.loadAmbienceFadeTime", "The fade-in duration when resuming ambience audio after loading a save game"); if (KickStarter.settingsManager.loadAmbienceFadeTime > 0f) { KickStarter.settingsManager.crossfadeAmbienceWhenLoading = CustomGUILayout.ToggleLeft ("Crossfade after loading?", KickStarter.settingsManager.crossfadeAmbienceWhenLoading, "AC.KickStarter.settingsManager.crossfadeAmbienceWhenLoading", "If True, previously-playing ambience audio will be crossfaded out upon loading"); } KickStarter.settingsManager.restartAmbienceTrackWhenLoading = CustomGUILayout.ToggleLeft ("Restart track after loading?", KickStarter.settingsManager.restartAmbienceTrackWhenLoading, "AC.KickStarter.settingsManager.restartAmbienceTrackWhenLoading", "If True, then the ambience track at the time of saving will be resumed from the start upon loading"); if (GUI.changed) { EditorUtility.SetDirty (KickStarter.settingsManager); } } EditorGUILayout.Space (); CustomGUILayout.EndVertical (); } SharedGUI("Ambience tracks"); }
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() { 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); }
private void ShowActionTypeGUI() { if (selectedClass == null || string.IsNullOrEmpty(selectedClass.fileName)) { return; } EditorGUILayout.BeginVertical(CustomStyles.thinBox); showActionType = CustomGUILayout.ToggleHeader(showActionType, selectedClass.GetFullTitle()); if (showActionType) { SpeechLine.ShowField("Name:", selectedClass.GetFullTitle(), false); SpeechLine.ShowField("Filename:", selectedClass.fileName + ".cs", false); SpeechLine.ShowField("Description:", selectedClass.description, true); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Node colour:", GUILayout.Width(85f)); selectedClass.color = EditorGUILayout.ColorField(selectedClass.color); EditorGUILayout.EndHorizontal(); if (!string.IsNullOrEmpty(defaultClassName) && selectedClass.fileName == defaultClassName) { EditorGUILayout.HelpBox("This is marked as the default Action", MessageType.Info); } else { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Is enabled?", GUILayout.Width(85f)); selectedClass.isEnabled = EditorGUILayout.Toggle(selectedClass.isEnabled); EditorGUILayout.EndHorizontal(); } } CustomGUILayout.EndVertical(); }
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.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); }
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 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.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); }
public override void OnInspectorGUI() { _target = (Variables)target; ShowSettings(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showVariablesList = CustomGUILayout.ToggleHeader(showVariablesList, "Component variables"); if (showVariablesList) { selectedVar = VariablesManager.ShowVarList(selectedVar, _target.vars, VariableLocation.Component, varFilter, _target.filter, typeFilter, !Application.isPlaying, _target); } CustomGUILayout.EndVertical(); if (selectedVar != null && !_target.vars.Contains(selectedVar)) { selectedVar = null; } if (selectedVar != null) { EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showProperties = CustomGUILayout.ToggleHeader(showProperties, "Variable '" + selectedVar.label + "' properties"); if (showProperties) { VariablesManager.ShowVarGUI(selectedVar, VariableLocation.Component, !Application.isPlaying, null, string.Empty, _target); } CustomGUILayout.EndVertical(); } UnityVersionHandler.CustomSetDirty(_target); }
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 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 ShowCustomGUI() { EditorGUILayout.BeginVertical(CustomStyles.thinBox); showCustom = CustomGUILayout.ToggleHeader(showCustom, "Custom Action scripts"); if (showCustom) { if (customFolderPaths.Count == 0) { customFolderPaths.Add(string.Empty); } for (int i = 0; i < customFolderPaths.Count; i++) { customFolderPaths[i] = ShowCustomFolderGUI(i); } int lastIndex = customFolderPaths.Count - 1; if (lastIndex >= 0) { int lastButOneIndex = lastIndex - 1; if (!string.IsNullOrEmpty(customFolderPaths[lastIndex])) { customFolderPaths.Add(string.Empty); } else if (lastButOneIndex >= 0 && string.IsNullOrEmpty(customFolderPaths[lastButOneIndex])) { customFolderPaths.RemoveAt(lastIndex); } } } GUILayout.Space(3f); CustomGUILayout.EndVertical(); }
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(); }
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 void ShowGUI(int i) { CustomGUILayout.BeginVertical(); GUILayout.Label("Column # : " + header); if (i > 0) { importColumnType = (ImportColumnType)EditorGUILayout.EnumPopup("Import rule:", importColumnType); } CustomGUILayout.EndVertical(); }
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() { 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() { 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 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(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 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); }
protected void ShowBindingsUI(TimelineAsset timelineAsset, List <ActionParameter> parameters) { if (timelineAsset == null) { return; } if (newBindings == null || timelineAsset.outputTrackCount != newBindings.Length) { BindingData[] tempBindings = new BindingData[newBindings.Length]; for (int i = 0; i < newBindings.Length; i++) { tempBindings[i] = new BindingData(newBindings[i]); } newBindings = new BindingData[timelineAsset.outputTrackCount]; for (int i = 0; i < newBindings.Length; i++) { if (i < tempBindings.Length) { newBindings[i] = new BindingData(tempBindings[i]); } else { newBindings[i] = new BindingData(); } } } string[] popUpLabels = new string[newBindings.Length]; for (int i = 0; i < newBindings.Length; i++) { string trackName = (timelineAsset.GetOutputTrack(i) != null) ? timelineAsset.GetOutputTrack(i).name : " Track"; if (string.IsNullOrEmpty(trackName)) { trackName = " Unnamed"; } popUpLabels[i] = "#" + i.ToString() + ": " + trackName; } EditorGUILayout.BeginVertical(CustomStyles.thinBox); rebindTrackIndex = EditorGUILayout.Popup("Select a track:", rebindTrackIndex, popUpLabels); ShowBindingUI(rebindTrackIndex, parameters); if (newBindings.Length > 1) { EditorGUILayout.HelpBox("All bindings will be affected - not just the one selected above.", MessageType.Info); } CustomGUILayout.EndVertical(); }