private void ArrowGUI(Arrow arrow, string label) { if (arrow != null) { ArrowPrompt _target = (ArrowPrompt)target; arrow.isPresent = EditorGUILayout.Toggle("Provide?", arrow.isPresent); if (arrow.isPresent) { arrow.texture = (Texture2D)EditorGUILayout.ObjectField("Icon texture:", arrow.texture, typeof(Texture2D), true); EditorGUILayout.BeginHorizontal(); arrow.linkedCutscene = (Cutscene)EditorGUILayout.ObjectField("Linked Cutscene:", arrow.linkedCutscene, typeof(Cutscene), true); if (arrow.linkedCutscene == null) { if (GUILayout.Button("Create", GUILayout.MaxWidth(60f))) { Undo.RecordObject(_target, "Auto-create Cutscene"); Cutscene newCutscene = SceneManager.AddPrefab("Logic", "Cutscene", true, false, true).GetComponent <Cutscene>(); newCutscene.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + ": " + label); arrow.linkedCutscene = newCutscene; } } EditorGUILayout.EndHorizontal(); } } }
private void ArrowGUI(Arrow arrow, ActionListSource source, string label) { if (arrow != null) { ArrowPrompt _target = (ArrowPrompt)target; arrow.isPresent = CustomGUILayout.Toggle("Provide?", arrow.isPresent, "", "If True, the Arrow is defined and used in the ArrowPrompt"); if (arrow.isPresent) { arrow.texture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Icon texture:", arrow.texture, true, "", "The texture to draw on-screen"); EditorGUILayout.BeginHorizontal(); if (source == ActionListSource.InScene) { arrow.linkedCutscene = ActionListAssetMenu.CutsceneGUI("Linked Cutscene", arrow.linkedCutscene, _target.gameObject.name + ": " + label, "The Cutscene to run when the Arrow is triggered"); } else if (source == ActionListSource.AssetFile) { arrow.linkedActionList = ActionListAssetMenu.AssetGUI("Linked ActionList:", arrow.linkedActionList, _target.gameObject.name + "_" + label, "", "The ActionList asset to run when the Arrow is triggered"); } EditorGUILayout.EndHorizontal(); } } }
/** * <summary>Unregisters an ArrowPrompt, so that it is no longer updated</summary> * <param name = "_object">The ArrowPrompt to unregister</param> */ public void Unregister(ArrowPrompt _object) { if (arrowPrompts.Contains(_object)) { arrowPrompts.Remove(_object); } }
/** * <summary>Registers an ArrowPrompt, so that it can be updated</summary> * <param name = "_object">The ArrowPrompt to register</param> */ public void Register(ArrowPrompt _object) { if (!arrowPrompts.Contains(_object)) { arrowPrompts.Add(_object); } }
public override void OnInspectorGUI() { ArrowPrompt _target = (ArrowPrompt)target; EditorGUILayout.BeginVertical("Button"); GUILayout.Label("Settings", EditorStyles.boldLabel); _target.arrowPromptType = (ArrowPromptType)EditorGUILayout.EnumPopup("Input type:", _target.arrowPromptType); _target.disableHotspots = EditorGUILayout.ToggleLeft("Disable Hotspots when active?", _target.disableHotspots); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); GUILayout.Label("Up arrow", EditorStyles.boldLabel); ArrowGUI(_target.upArrow, "Up"); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); GUILayout.Label("Left arrow", EditorStyles.boldLabel); ArrowGUI(_target.leftArrow, "Left"); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); GUILayout.Label("Right arrow", EditorStyles.boldLabel); ArrowGUI(_target.rightArrow, "Right"); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); GUILayout.Label("Down arrow", EditorStyles.boldLabel); ArrowGUI(_target.downArrow, "Down"); EditorGUILayout.EndVertical(); if (GUI.changed) { EditorUtility.SetDirty(_target); } }
public override void OnInspectorGUI() { ArrowPrompt _target = (ArrowPrompt)target; CustomGUILayout.BeginVertical(); GUILayout.Label("Settings", EditorStyles.boldLabel); _target.arrowPromptType = (ArrowPromptType)CustomGUILayout.EnumPopup("Input type:", _target.arrowPromptType, "", "What kind of input the arrows respond to"); _target.disableHotspots = CustomGUILayout.ToggleLeft("Disable Hotspots when active?", _target.disableHotspots, "", "If True, then Hotspots will be disabled when the arrows are on screen"); _target.positionFactor = CustomGUILayout.Slider("Position factor:", _target.positionFactor, 0.5f, 4f, "", "A factor for the arrow position"); _target.scaleFactor = CustomGUILayout.Slider("Scale factor:", _target.scaleFactor, 0.5f, 4f, "", "A factor for the arrow size"); _target.source = (ActionListSource)CustomGUILayout.EnumPopup("Actions source:", _target.source, "", "Where the Actions are stored when not being run"); CustomGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); GUILayout.Label("Up arrow", EditorStyles.boldLabel); ArrowGUI(_target.upArrow, _target.source, "Up"); CustomGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); GUILayout.Label("Left arrow", EditorStyles.boldLabel); ArrowGUI(_target.leftArrow, _target.source, "Left"); CustomGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); GUILayout.Label("Right arrow", EditorStyles.boldLabel); ArrowGUI(_target.rightArrow, _target.source, "Right"); CustomGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); GUILayout.Label("Down arrow", EditorStyles.boldLabel); ArrowGUI(_target.downArrow, _target.source, "Down"); CustomGUILayout.EndVertical(); UnityVersionHandler.CustomSetDirty(_target); }
public override void OnInspectorGUI() { ArrowPrompt _target = (ArrowPrompt)target; EditorGUILayout.BeginVertical("Button"); GUILayout.Label("Settings", EditorStyles.boldLabel); _target.arrowPromptType = (ArrowPromptType)EditorGUILayout.EnumPopup("Input type:", _target.arrowPromptType); _target.disableHotspots = EditorGUILayout.ToggleLeft("Disable Hotspots when active?", _target.disableHotspots); _target.positionFactor = EditorGUILayout.Slider("Position factor:", _target.positionFactor, 0.5f, 4f); _target.scaleFactor = EditorGUILayout.Slider("Scale factor:", _target.scaleFactor, 0.5f, 4f); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); GUILayout.Label("Up arrow", EditorStyles.boldLabel); ArrowGUI(_target.upArrow, "Up"); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); GUILayout.Label("Left arrow", EditorStyles.boldLabel); ArrowGUI(_target.leftArrow, "Left"); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); GUILayout.Label("Right arrow", EditorStyles.boldLabel); ArrowGUI(_target.rightArrow, "Right"); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); GUILayout.Label("Down arrow", EditorStyles.boldLabel); ArrowGUI(_target.downArrow, "Down"); EditorGUILayout.EndVertical(); UnityVersionHandler.CustomSetDirty(_target); }
/** * <summary>Unregisters an ArrowPrompt, so that it is no longer updated</summary> * <param name = "_object">The ArrowPrompt to unregister</param> */ public void Unregister(ArrowPrompt _object) { arrowPrompts.Remove(_object); }
/** * <summary>Registers an ArrowPrompt, so that it can be updated</summary> * <param name = "_object">The ArrowPrompt to register</param> */ public void Register(ArrowPrompt _object) { arrowPrompts.Add(_object); }