private static void StartWindow(string name) { _editPopup = (EditVariablePopupWindow)EditorWindow.GetWindow <EditVariablePopupWindow>(); _editPopup.titleContent = new GUIContent($"Edit {name}"); parameters = EngineGraphUtilities.LoadParameterReference(); _editPopup.minSize = new Vector2(427, 191); }
public static IEnumerator FadeToPosition(Image image, EnumPosition position, NTemplate node, Vector2 point, float duration) { var canvas = DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform; Vector2 pos; if (position != EnumPosition.Custom) { pos = new Vector2(EngineGraphUtilities.GetXPosition(position), .5f); } else { pos = point; } pos = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(image.rectTransform, pos, canvas); var wait = new WaitForSeconds(duration / 2); image.CrossFadeAlpha(0, duration / 2, false); yield return(wait); image.rectTransform.anchoredPosition = pos; image.CrossFadeAlpha(1, duration / 2, false); yield return(wait); node.endedInstruction = true; }
public static IEnumerator SlideDown(Image image1, Image image2, Sprite newImage, NTemplate node, float duration) { image2.CrossFadeAlpha(1, 0, false); image2.gameObject.SetActive(true); image2.sprite = newImage; var trm1 = image1.rectTransform; var trm2 = image2.rectTransform; var center = new Vector2(.5f, .5f); var pos1Begin = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(image1.rectTransform, center, DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform);; var pos1End = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(image1.rectTransform, new Vector2(.5f, -.5f), DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform); var pos2End = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(image2.rectTransform, center, DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform); var pos2Begin = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(image2.rectTransform, new Vector2(.5f, 1.5f), DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform); float lerpValue = 0; float result = 0; yield return(new WaitUntil(() => { trm1.anchoredPosition = Vector2.Lerp(pos1Begin, pos1End, result); trm2.anchoredPosition = Vector2.Lerp(pos2Begin, pos2End, result); lerpValue += Time.deltaTime; result = lerpValue / duration; return result > 1.01; })); image1.gameObject.SetActive(false); node.endedInstruction = true; }
public static IEnumerator SlideToPosition(RectTransform trm, EnumPosition position, NTemplate node, Vector2 point, float duration) { var canvas = DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform; Vector2 posA = trm.anchoredPosition; Vector2 posB; if (position != EnumPosition.Custom) { posB = new Vector2(EngineGraphUtilities.GetXPosition(position), .5f); } else { posB = point; } posB = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(trm, posB, canvas); float lerpValue = 0; float result = 0; yield return(new WaitUntil(() => { trm.anchoredPosition = Vector2.Lerp(posA, posB, result); lerpValue += Time.deltaTime; result = lerpValue / duration; return result >= 1; })); node.endedInstruction = true; }
public static void Instante(Image image, Sprite sprite, EnumPosition position, NTemplate node, Vector2 point, bool reverse = false) { if (!reverse) { image.sprite = sprite; } image.CrossFadeAlpha(reverse? 0 : 1, 0, false); if (!reverse) { Vector2 pos; if (position == EnumPosition.Custom) { pos = point; } else { pos = new Vector2(EngineGraphUtilities.GetXPosition(position), .5f); } image.rectTransform.anchoredPosition = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(image.rectTransform, pos, DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform); } node.endedInstruction = true; }
public static IEnumerator SlideUp(Image image, Sprite sprite, EnumPosition position, NTemplate node, Vector2 point, float duration, bool reverse = false) { if (!reverse) { image.sprite = sprite; } var canvas = DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform; var trm = image.rectTransform; Vector2 posA; Vector2 posB; if (position != EnumPosition.Custom) { posA = new Vector2(EngineGraphUtilities.GetXPosition(position), -.5f); posB = new Vector2(posA.x, .5f); } else { posA = new Vector2(point.x, -.5f); posB = point; } posA = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(trm, posA, canvas); posB = reverse ? posB : EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(trm, posB, canvas); if (reverse) { posA.x = posB.x; } float lerpValue = 0; float result = 0; yield return(new WaitUntil(() => { if (reverse) { trm.anchoredPosition = Vector2.Lerp(posB, posA, result); } else { trm.anchoredPosition = Vector2.Lerp(posA, posB, result); } lerpValue += Time.deltaTime; result = lerpValue / duration; return result >= 1; })); node.endedInstruction = true; }
void SearchButtons(IEnumerable <NAnswer> nodes) { _initialized = true; DialogueDatabase.buttonsActive = new List <Button>(); foreach (var node in nodes) { DialogueDatabase.buttonsActive.Add(DialogueDatabase.activeGraphPlayer.TakeButtonPool()); var temp = DialogueDatabase.buttonsActive.Last().GetComponent <RectTransform>(); temp.anchoredPosition = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(temp, node.buttonPosition, DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform); DialogueDatabase.buttonsActive.Last().GetComponentInChildren <Text>().text = node.answer; DialogueDatabase.buttonsActive.Last().onClick.AddListener(() => SelectAnswer(multiOutput.outputNode.IndexOf(node))); } }
protected override void OnEnable() { //_myStyleSmall = new GUIStyle //{ // fontSize = 10, // fontStyle = FontStyle.Italic, // alignment = TextAnchor.MiddleLeft //}; //_myStyleBig = new GUIStyle //{ // fontSize = 15, // fontStyle = FontStyle.Bold, // alignment = TextAnchor.MiddleCenter, //}; parameters = EngineGraphUtilities.LoadParameterReference(); }
public void DownValue(string param) { if (param == "PlayTimes") { parameters.GetInt("PlayTimes").Value--; } else if (param == "Arcueid bond") { parameters.GetInt("Arcueid bond").Value--; } else if (param == "CatEnds") { parameters.GetInt("CatEnds").Value--; } SaveHelper.SaveChanges(EngineGraphUtilities.LoadParameterReference()); }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; _bold = new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Bold }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "DELAY STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Delay state delay in seconds the execution of the next state.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); GUILayout.Label(new GUIContent("Time:", "Delay time in seconds."), _bold); EditorGUI.BeginChangeCheck(); _node.delay = EditorGUILayout.FloatField(_node.delay); if (EditorGUI.EndChangeCheck()) { EngineGraphUtilities.SetDirty(this); } }
private void OnSceneGUI() { Handles.BeginGUI(); var scene = EditorWindow.GetWindow <SceneView>().camera; Panel(); Vector3 pos = Vector3.zero; Handles.color = Color.black; var tempPos = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(scene.transform as RectTransform, _node.buttonPosition, DialogueDatabase.activeGraphPlayer.GetComponentInParent <Canvas>().transform as RectTransform); pos.x = tempPos.x; pos.y = tempPos.y; Handles.RectangleHandleCap(0, tempPos, Quaternion.identity, 10, EventType.Ignore); Debug.Log(tempPos); Handles.EndGUI(); }
public static void InstanteToPosition(RectTransform trm, EnumPosition position, NTemplate node, Vector2 point) { var canvas = DialogueDatabase.activeGraphPlayer.Canvas.transform as RectTransform; Vector2 pos; if (position != EnumPosition.Custom) { pos = new Vector2(EngineGraphUtilities.GetXPosition(position), .5f); } else { pos = point; } pos = EngineGraphUtilities.FromAbsolutePositionToAnchoredPosition(trm, pos, canvas); trm.anchoredPosition = pos; node.endedInstruction = true; }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "CHANGE FLOW CHART STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField(new GUIContent("Flow chart:", "Flow chart that will be changed.")); GUILayout.BeginVertical("BOX"); var temp = Resources.LoadAll("Data", typeof(EngineGraph)).Select(x => (EngineGraph)x); if (temp.Any()) { var array = temp.Select(x => x.graphName).ToArray(); int arrayIndex = !_node.newGraph ? 0 : temp.IndexOf(x => x == _node.newGraph); arrayIndex = EditorGUILayout.Popup(arrayIndex, array); if (!_node.newGraph || array[arrayIndex] != _node.newGraph.name) { _node.newGraph = temp.ToArray()[arrayIndex]; EngineGraphUtilities.SetDirty(_node); } } GUILayout.EndVertical(); }
public void SwampValue(string param) { BoolSerializedParamVaraible temp; if (param == "Ended") { temp = parameters.GetBool("Ended"); } else if (param == "ArchetypeDefeated") { temp = parameters.GetBool("ArchetypeDefeated"); } else { return; } temp.Value = !temp.Value; SaveHelper.SaveChanges(EngineGraphUtilities.LoadParameterReference()); }
public void InitializeParam() => parameters = EngineGraphUtilities.LoadParameterReference();
void Awake() => parameters = EngineGraphUtilities.LoadParameterReference();
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "ANSWER STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Answer state is one of the desitions that can be selected derived of a Question node.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField(new GUIContent("Desition text:", "Text that appears on the decision button")); _node.answer = EditorGUILayout.TextField(_node.answer); GUILayout.Space(5); EditorGUILayout.LabelField(new GUIContent("Button canvas position:", "Absolute position of the button on the canvas.")); GUILayout.BeginVertical("BOX"); _node.buttonPosition.x = EditorGUILayout.FloatField(new GUIContent("X:", "X absolute value from 0 to 1, of left to right. Center is .5f"), _node.buttonPosition.x); _node.buttonPosition.y = EditorGUILayout.FloatField(new GUIContent("Y:", "Y absolute value from 0 to 1, of down to up. Center is .5f"), _node.buttonPosition.y); GUILayout.EndVertical(); if (_node.buttonPosition.x > 1) { _node.buttonPosition.x = 1; } else if (_node.buttonPosition.x < 0) { _node.buttonPosition.x = 0; } if (_node.buttonPosition.y > 1) { _node.buttonPosition.x = 1; } else if (_node.buttonPosition.y < 0) { _node.buttonPosition.y = 0; } GUILayout.Space(10); _keyBool.target = _node.customKey; _node.customKey = GUILayout.Toggle(_node.customKey, new GUIContent("Custom input key", "Use an input key to select this decision.")); if (EditorGUILayout.BeginFadeGroup(_keyBool.faded)) { GUILayout.BeginVertical("BOX"); _node.myKey = (KeyCode)EditorGUILayout.EnumFlagsField("Input key", _node.myKey); GUILayout.EndVertical(); } EditorGUILayout.EndFadeGroup(); if (EditorGUI.EndChangeCheck()) { EngineGraphUtilities.SetDirty(_node); } }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true, wordWrap = true }; _empty = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter, fontStyle = FontStyle.Italic }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "SET PARAMETER STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Set parameter state can set, add or substract values of the parameters.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); GUILayout.BeginVertical("BOX"); CheckCollection(); if (!_node.data.Any()) { GUILayout.Label("Empty", _empty); } else { EditorGUI.BeginChangeCheck(); List <string> tempArray = new List <string>(); var parameters = _node.parentGraph.parameters.Where(x => { if (x.access == ParamAccessibility.IsLocal) { return(x.graph == _node.parentGraph); } return(true); }); foreach (var item in parameters) { tempArray.Add(item.Name); } foreach (var(Name, ModType, VarType) in _node.data) { GUILayout.BeginVertical("BOX"); var array = tempArray.Where(x => x == Name || !_node.data.Any(y => y.Name == x)).ToArray(); int arrayIndex = array.IndexOf(x => x == Name); arrayIndex = EditorGUILayout.Popup(arrayIndex, array.ToArray()); if (Name != array[arrayIndex]) { var node = _node.parentGraph.parameters.Where(x => x.Name == array[arrayIndex]).First(); _node.data.ChangeParameter(Name, array[arrayIndex], node.Type); EngineGraphUtilities.SetDirty(_node); break; } if (VarType != ParamVariableType.Bool) { _node.data.UpdateCompareType(Name, (EnumModType)EditorGUILayout.EnumPopup(new GUIContent("Setter type:", "Type of setting to modify the parameter."), ModType)); } GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Value:", "Modification value for parameter setting.")); switch (VarType) { case ParamVariableType.Int: _node.data.UpdateValue(Name, EditorGUILayout.IntField(_node.data.GetInt(Name))); break; case ParamVariableType.Float: _node.data.UpdateValue(Name, EditorGUILayout.FloatField(_node.data.GetFloat(Name))); break; case ParamVariableType.Bool: _node.data.UpdateValue(Name, EditorGUILayout.Toggle(_node.data.GetBool(Name))); break; case ParamVariableType.String: _node.data.UpdateValue(Name, EditorGUILayout.TextField(_node.data.GetString(Name))); break; } GUILayout.EndHorizontal(); if (GUILayout.Button("Delete Setter")) { OnRepaint += () => _node.data.UnsuscribeValue(array[arrayIndex]); GUILayout.EndVertical(); break; } GUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { EngineGraphUtilities.SetDirty(_node); } } GUILayout.EndVertical(); var selectedParameters = _node.parentGraph.parameters.Where(x => !_node.data.Contains(x.Name)) .Where(x => { if (x.access == ParamAccessibility.IsLocal) { return(x.graph == _node.parentGraph); } return(true); }); if (selectedParameters.Any()) { if (GUILayout.Button("Add Setter")) { var param = _node.parentGraph.parameters.Where(x => !_node.data.Contains(x.Name)) .Where(x => { if (x.access == ParamAccessibility.IsLocal) { return(x.graph == _node.parentGraph); } return(true); }).First(); _node.data.SuscribeValue(param.Name, EnumModType.Swap, param.Type); EngineGraphUtilities.SetDirty(_node); } } else { EditorGUILayout.HelpBox("The Scene graph don't have more parameters.", MessageType.Warning); } OnRepaint(); OnRepaint = delegate { }; Repaint(); }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "CHANGE CHARACTER SPRITE STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Change Character Sprite state change the sprite for a registed one of a character in the scene.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); if (_characterContainer.data == null || !_characterContainer.data.Any()) { GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have Characters.", MessageType.Warning); _node.character = null; _node.sprite = null; GUILayout.EndVertical(); return; } if (_node.character == null) { _node.character = (DCharacter)_characterContainer.data.Select(x => x as DCharacter).First(); _characterSelected = 0; _node.sprite = _node.character.SpriteForeach().GetValue(0).Item2; _spriteSelected = 0; } var allCharacaters = _characterContainer.data.Select(x => x as DCharacter).Select(x => x.name).ToArray(); GUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField(new GUIContent("Character:", "Select a Character.")); _characterSelected = EditorGUILayout.Popup(_characterSelected, allCharacaters); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { _node.character = (DCharacter)_characterContainer.data.Select(x => x as DCharacter) .GetValue(_characterSelected); EngineGraphUtilities.SetDirty(_node); } GUILayout.Space(5); EditorGUI.BeginChangeCheck(); var allSprites = _node.character.SpriteForeach().Select(x => x.Item1).ToArray(); GUILayout.BeginHorizontal(); if (allSprites.Any()) { EditorGUILayout.LabelField(new GUIContent("Sprite:", "Select an Sprite registed in the Character.")); _spriteSelected = EditorGUILayout.Popup(_spriteSelected, allSprites); } else { GUILayout.EndHorizontal(); GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have Sprites in the Character.", MessageType.Warning); _node.sprite = null; _spriteSelected = 0; GUILayout.EndVertical(); return; } GUILayout.EndHorizontal(); GUILayout.BeginVertical("BOX"); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Duration time:", "Duration of the transition.")); _node.timeDuration = EditorGUILayout.FloatField(_node.timeDuration); GUILayout.EndHorizontal(); if (_node.timeDuration < 0) { _node.timeDuration = 0; } GUILayout.Space(3); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Transition type:", "Type of transition to change sprite.")); var allNames = new string[3] { "Instante", "Crossfade", "Fade Out and In" }; _node.transition = (EnumImageTransition)EditorGUILayout.Popup((int)_node.transition, allNames); if (EditorGUI.EndChangeCheck()) { _node.sprite = _node.character.GetSprite(allSprites[_spriteSelected]); EngineGraphUtilities.SetDirty(_node); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; _bold = new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Bold }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "TEXT STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Text state show text in the text container.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); EditorGUILayout.BeginVertical("BOX"); if (!_node.data.Any()) { EditorGUILayout.LabelField("The state don't have any data.", new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Italic, wordWrap = true }); } else { for (int i = 0; i < _node.data.Count; i++) { EditorGUILayout.BeginVertical("BOX"); var temp = _node.data[i]; EditorGUI.BeginChangeCheck(); temp.IsDialogue = EditorGUILayout.Toggle(new GUIContent("Is a dialogue: ", "Make this text a dialogue text."), temp.IsDialogue); if (temp.IsDialogue) { var allCharacters = _characterContainers.data.Select(x => x as DCharacter).Select(x => x.name); GUILayout.Label(new GUIContent("Character: ", "Select a character of the database."), _bold); if (allCharacters.Any()) { _characterSelected[i] = EditorGUILayout.Popup(_characterSelected[i], allCharacters.ToArray()); temp.Character = (DCharacter)_characterContainers.data[_characterSelected[i]]; } else { GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have charcters registed.", MessageType.Error); GUILayout.EndVertical(); } } GUILayout.Space(2); temp.ClearLastText = EditorGUILayout.Toggle(new GUIContent("Clear text: ", "Clear the previous text"), temp.ClearLastText); if (!temp.ClearLastText) { temp.ContinueParagraph = EditorGUILayout.Toggle(new GUIContent("Continue paragraph: ", "The text will continue the last text, without clearing the canvas."), temp.ContinueParagraph); } GUILayout.Label(new GUIContent("Text: ", "Text that will be show on the canvas."), _bold); temp.Text = GUILayout.TextArea(temp.Text); GUILayout.Space(2); _avancedOptions[i] = EditorGUILayout.Toggle("Avanced options: ", _avancedOptions[i]); if (_avancedOptions[i]) { temp.UseCustomKey = EditorGUILayout.Toggle(new GUIContent("Custom key", "This text use a custom key."), temp.UseCustomKey); if (temp.UseCustomKey) { temp.CustomKey = (KeyCode)EditorGUILayout.EnumPopup(new GUIContent("Key input: ", "The new key input of this node."), temp.CustomKey); } temp.UseDelay = EditorGUILayout.Toggle(new GUIContent("Use delay: ", "Delay the transition to the next text or node."), temp.UseDelay); if (temp.UseDelay) { temp.DelayTime = EditorGUILayout.FloatField("Time: ", temp.DelayTime); if (temp.DelayTime < 0) { temp.DelayTime = 0; } } } if (EditorGUI.EndChangeCheck()) { _node.data[i] = temp; EngineGraphUtilities.SetDirty(_node); } if (GUILayout.Button("Delete")) { int index = i; _OnRepaint += () => _node.data.RemoveAt(index); } EditorGUILayout.EndVertical(); GUILayout.Space(3); } } EditorGUILayout.EndVertical(); _OnRepaint(); if (GUILayout.Button("Add")) { _node.data.Add(new ParadoxTextNodeData() { Text = "", Character = null, ClearLastText = true, ContinueParagraph = false, CustomKey = KeyCode.Return, DelayTime = 0, IsDialogue = false, UseCustomKey = false, UseDelay = false }); _avancedOptions.Add(false); _characterSelected.Add(0); } Repaint(); _OnRepaint = delegate { }; }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "PLAY VOICE STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Play voice state play a clip in the voice channel.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); if (_voiceContainer.data == null || !_voiceContainer.data.Select(x => x as DSoundtrack).Where(x => x.Channel == SoundChannelEnum.Voice).Any()) { GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have Soundtrack Groups of the Voice channel.", MessageType.Warning); _node.voiceGroup = null; _node.voiceClip = null; GUILayout.EndVertical(); return; } if (_node.voiceGroup == null) { _node.voiceGroup = (DSoundtrack)_voiceContainer.data.Select(x => x as DSoundtrack).Where(x => x.Channel == SoundChannelEnum.Voice).First(); _voiceGroupSelected = 0; _node.voiceClip = _node.voiceGroup.Foreach().GetValue(0).Item2; _voiceClipSelected = 0; } var allSoundGroups = _voiceContainer.data.Select(x => x as DSoundtrack).Where(x => x.Channel == SoundChannelEnum.Voice).Select(x => x.name).ToArray(); GUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField(new GUIContent("Voice group:", "Select a Soundtrack Group defined has a Voice channel.")); _voiceGroupSelected = EditorGUILayout.Popup(_voiceGroupSelected, allSoundGroups); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { _node.voiceGroup = (DSoundtrack)_voiceContainer.data.Select(x => x as DSoundtrack) .Where(x => x.Channel == SoundChannelEnum.Voice) .GetValue(_voiceGroupSelected); EngineGraphUtilities.SetDirty(_node); } GUILayout.Space(5); EditorGUI.BeginChangeCheck(); var allVoiceClips = _node.voiceGroup.Foreach().Select(x => x.Item1).ToArray(); GUILayout.BeginHorizontal(); if (allVoiceClips.Any()) { EditorGUILayout.LabelField(new GUIContent("Voice:", "Select a Audio Clip registed in the Soundtrack Group.")); _voiceClipSelected = EditorGUILayout.Popup(_voiceClipSelected, allVoiceClips); } else { GUILayout.EndHorizontal(); GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have Audio Clips in the Soundtrack Group.", MessageType.Warning); _node.voiceClip = null; _voiceClipSelected = 0; GUILayout.EndVertical(); return; } GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { _node.voiceClip = _node.voiceGroup[allVoiceClips[_voiceClipSelected]]; EngineGraphUtilities.SetDirty(_node); } }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "STOP MUSIC STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Stop Muisc state stop the actual clip playing in the music channel.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); GUILayout.BeginVertical(); EditorGUI.BeginChangeCheck(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Duration time:", "Duration of the transition.")); _node.timeDuration = EditorGUILayout.FloatField(_node.timeDuration); if (_node.timeDuration <= 0) { _node.timeDuration = 1; } GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Transition type:", "Type of transition to stopping the music.")); string[] compareTag = new string[2] { "Fade Out", "Instant" }; int selectedTag = (int)_node.transition; selectedTag = EditorGUILayout.Popup(selectedTag, compareTag); GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { _node.transition = (EnumSoundEndTransition)selectedTag; EngineGraphUtilities.SetDirty(_node); } }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "MOVE CHARACTER STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Move Character state move a character in the scene to a specific position.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); if (_characterContainer.data == null || !_characterContainer.data.Any()) { GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have Characters.", MessageType.Warning); _node.character = null; GUILayout.EndVertical(); return; } if (_node.character == null) { _node.character = (DCharacter)_characterContainer.data.Select(x => x as DCharacter).First(); _characterSelected = 0; } var allCharacaters = _characterContainer.data.Select(x => x as DCharacter).Select(x => x.name).ToArray(); GUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField(new GUIContent("Character:", "Select a Character to move.")); _characterSelected = EditorGUILayout.Popup(_characterSelected, allCharacaters); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { _node.character = (DCharacter)_characterContainer.data.Select(x => x as DCharacter) .GetValue(_characterSelected); EngineGraphUtilities.SetDirty(_node); } GUILayout.Space(5); EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical("BOX"); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Duration time:", "Duration of the transition.")); _node.timeDuration = EditorGUILayout.FloatField(_node.timeDuration); GUILayout.EndHorizontal(); if (_node.timeDuration < 0) { _node.timeDuration = 0; } GUILayout.Space(3); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Position: ", "The final position of the character in the canvas.")); _node.position = (EnumPosition)EditorGUILayout.EnumPopup(_node.position); GUILayout.EndHorizontal(); if (_node.position == EnumPosition.Custom) { _node.customPoint = EditorGUILayout.Vector2Field(new GUIContent("Absolute point: ", "0 to 1 from left to right, and down to up."), _node.customPoint); _node.pointClamp = EditorGUILayout.Toggle(new GUIContent("Clamp point: ", "Clamp the point values in the limits of the canvas."), _node.pointClamp); if (_node.pointClamp) { if (_node.customPoint.x < 0) { _node.customPoint.x = 0; } if (_node.customPoint.x > 1) { _node.customPoint.x = 1; } if (_node.customPoint.y < 0) { _node.customPoint.y = 0; } if (_node.customPoint.y > 1) { _node.customPoint.y = 1; } } } GUILayout.Space(3); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Transition type:", "Type of transition to introduce Character.")); _node.transition = (EnumPositionTransition)EditorGUILayout.EnumPopup(_node.transition); if (EditorGUI.EndChangeCheck()) { EngineGraphUtilities.SetDirty(_node); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "PLAY MUSIC STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Play Music state play a loopeable sound in the music channel.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); if (_musicContainer.data == null || !_musicContainer.data.Select(x => x as DSoundtrack).Where(x => x.Channel == SoundChannelEnum.Music).Any()) { GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have Soundtrack Groups of the Music channel.", MessageType.Warning); _node.musicGroup = null; _node.musicClip = null; GUILayout.EndVertical(); return; } if (_node.musicGroup == null) { _node.musicGroup = (DSoundtrack)_musicContainer.data.Select(x => x as DSoundtrack).Where(x => x.Channel == SoundChannelEnum.Music).First(); _musicGroupSelected = 0; _node.musicClip = _node.musicGroup.Foreach().GetValue(0).Item2; _musicClipSelected = 0; } var allMusicGroups = _musicContainer.data.Select(x => x as DSoundtrack).Where(x => x.Channel == SoundChannelEnum.Music).Select(x => x.name).ToArray(); GUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField(new GUIContent("Music group:", "Select a Soundtrack Group defined has a Music channel.")); _musicGroupSelected = EditorGUILayout.Popup(_musicGroupSelected, allMusicGroups); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { _node.musicGroup = (DSoundtrack)_musicContainer.data.Select(x => x as DSoundtrack) .Where(x => x.Channel == SoundChannelEnum.Music) .GetValue(_musicGroupSelected); EngineGraphUtilities.SetDirty(_node); } GUILayout.Space(5); EditorGUI.BeginChangeCheck(); var allMusicClips = _node.musicGroup.Foreach().Select(x => x.Item1).ToArray(); GUILayout.BeginHorizontal(); if (allMusicClips.Any()) { EditorGUILayout.LabelField(new GUIContent("Music:", "Select a Audio Clip registed in the Soundtrack Group.")); _musicClipSelected = EditorGUILayout.Popup(_musicClipSelected, allMusicClips); } else { GUILayout.EndHorizontal(); GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have Audio Clips in the Soundtrack Group.", MessageType.Warning); _node.musicClip = null; _musicClipSelected = 0; GUILayout.EndVertical(); return; } GUILayout.EndHorizontal(); GUILayout.BeginVertical("BOX"); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Duration time:", "Duration of the transition.")); _node.timeDuration = EditorGUILayout.FloatField(_node.timeDuration); GUILayout.EndHorizontal(); if (_node.timeDuration <= 0) { _node.timeDuration = 1; } GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Transition type:", "Type of transition to start the Music.")); string[] compareTag = new string[4] { "Fade In", "Fade Out and In", "Instant", "Crossfade" }; int selectedTag = (int)_node.transition; selectedTag = EditorGUILayout.Popup(selectedTag, compareTag); if (EditorGUI.EndChangeCheck()) { _node.musicClip = _node.musicGroup[allMusicClips[_musicClipSelected]]; _node.transition = (EnumSoundTransition)selectedTag; EngineGraphUtilities.SetDirty(_node); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "CHANGE BACKGROUND STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The change background state remplace the actual background of the scene.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); if (_locationsContainer.data == null || !_locationsContainer.data.Any()) { GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have Location Groups.", MessageType.Warning); _node.locationGroups = null; _node.locationBackground = null; GUILayout.EndVertical(); return; } if (_node.locationGroups == null) { _node.locationGroups = (DLocation)_locationsContainer.data.Select(x => x as DLocation).First(); _backgroundGroupSelected = 0; _node.locationBackground = _node.locationGroups.Foreach().GetValue(0).Item2; _locationBackgroundSelected = 0; } var allBackgroundGroups = _locationsContainer.data.Select(x => x as DLocation).Select(x => x.name).ToArray(); GUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField(new GUIContent("Locataion group:", "Select a Location Group.")); _backgroundGroupSelected = EditorGUILayout.Popup(_backgroundGroupSelected, allBackgroundGroups); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { _node.locationGroups = (DLocation)_locationsContainer.data.Select(x => x as DLocation) .GetValue(_backgroundGroupSelected); EngineGraphUtilities.SetDirty(_node); } GUILayout.Space(5); EditorGUI.BeginChangeCheck(); var allLocationBackgrounds = _node.locationGroups.Foreach().Select(x => x.Item1).ToArray(); GUILayout.BeginHorizontal(); if (allLocationBackgrounds.Any()) { EditorGUILayout.LabelField(new GUIContent("Background:", "Select a Background registed in the Location Group.")); _locationBackgroundSelected = EditorGUILayout.Popup(_locationBackgroundSelected, allLocationBackgrounds); } else { GUILayout.EndHorizontal(); GUILayout.BeginVertical("BOX"); EditorGUILayout.HelpBox("The database don't have Background in the Location Group.", MessageType.Warning); _node.locationBackground = null; _locationBackgroundSelected = 0; GUILayout.EndVertical(); return; } GUILayout.EndHorizontal(); GUILayout.BeginVertical("BOX"); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Duration time:", "Duration of the transition.")); _node.timeDuration = EditorGUILayout.FloatField(_node.timeDuration); GUILayout.EndHorizontal(); if (_node.timeDuration < 0) { _node.timeDuration = 1; } GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Transition type:", "Type of transition to change Backgrounds.")); _node.transition = (EnumImageTransition)EditorGUILayout.EnumPopup(_node.transition); if (EditorGUI.EndChangeCheck()) { _node.locationBackground = _node.locationGroups[allLocationBackgrounds[_locationBackgroundSelected]]; EngineGraphUtilities.SetDirty(_node); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public override void OnInspectorGUI() { _title = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter, stretchWidth = true }; _empty = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter, fontStyle = FontStyle.Italic }; GUILayout.Space(10); GUILayout.Label("PARADOX ENGINE" + "\n" + "CONDITION STATE", _title); GUILayout.Space(10); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); GUILayout.Space(20); EditorGUILayout.LabelField("Info:"); GUILayout.BeginVertical("BOX"); EditorGUILayout.LabelField("\n The Condition state is one of the desitions that can be selected derived of a Conditional branch state.\n", new GUIStyle(GUI.skin.label) { wordWrap = true, fontStyle = FontStyle.Italic }); GUILayout.EndVertical(); GUILayout.Space(10); _node.elseConditional = EditorGUILayout.Toggle("Is else condition", _node.elseConditional); GUILayout.Space(5); GUILayout.Label(new GUIContent("Conditions:", "The conditions to access to this branch."), new GUIStyle(GUI.skin.label) { fontSize = 13, fontStyle = FontStyle.Bold }); GUILayout.BeginVertical("BOX"); CheckCollection(); if (!_node.data.Any()) { GUILayout.Label("Empty", _empty); } else if (_node.elseConditional) { GUILayout.Label("Else condition", _empty); } else { EditorGUI.BeginChangeCheck(); List <string> tempArray = new List <string>(); var parameters = _node.parentGraph.parameters.Where(x => { if (x.access == ParamAccessibility.IsLocal) { return(x.graph == _node.parentGraph); } return(true); }); tempArray = parameters.Select(x => x.Name).ToList(); foreach (var(Name, CompareType, VarType) in _node.data) { GUILayout.BeginVertical("BOX"); var array = tempArray.Where(x => x == Name || !_node.data.Any(y => y.Name == x)).ToArray(); int arrayIndex = array.IndexOf(x => x == Name); arrayIndex = EditorGUILayout.Popup(arrayIndex, array.ToArray()); GUILayout.Space(3); if (Name != array[arrayIndex]) { var node = _node.parentGraph.parameters.Where(x => x.Name == array[arrayIndex]).First(); _node.data.ChangeParameter(Name, array[arrayIndex], node.Type); EngineGraphUtilities.SetDirty(_node); break; } var graphParam = _node.parentGraph.parameters.Where(x => x.Name == Name) .First(); EnumCompareType currentTag = CompareType; if (VarType != ParamVariableType.Bool && VarType != ParamVariableType.String) { _node.data.UpdateCompareType(Name, (EnumCompareType)EditorGUILayout.EnumPopup(new GUIContent("Compare type:", "Type of comparation of the condition."), currentTag)); } GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Value", "Value to compare.")); switch (VarType) { case ParamVariableType.Int: _node.data.UpdateValue(Name, EditorGUILayout.IntField(_node.data.GetInt(Name))); break; case ParamVariableType.Float: _node.data.UpdateValue(Name, EditorGUILayout.FloatField(_node.data.GetFloat(Name))); break; case ParamVariableType.Bool: _node.data.UpdateValue(Name, EditorGUILayout.Toggle(_node.data.GetBool(Name))); break; case ParamVariableType.String: _node.data.UpdateValue(Name, EditorGUILayout.TextField(_node.data.GetString(Name))); break; } GUILayout.EndHorizontal(); if (GUILayout.Button("Delete Condition")) { OnRepaint += () => _node.data.UnsuscribeValue(array[arrayIndex]); GUILayout.EndVertical(); break; } GUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { EngineGraphUtilities.SetDirty(_node); } } GUILayout.EndVertical(); var selectedParameters = _node.parentGraph.parameters.Where(x => !_node.data.Contains(x.Name)) .Where(x => { if (x.access == ParamAccessibility.IsLocal) { return(x.graph == _node.parentGraph); } return(true); }); if (selectedParameters.Any()) { if (GUILayout.Button("Add Condition")) { var paramTemp = _node.parentGraph.parameters.Where(x => { if (x.access == ParamAccessibility.IsLocal) { return(x.graph == _node.parentGraph); } return(true); }) .Where(x => !_node.data.Any(y => y.Name == x.Name)) .First(); _node.data.SuscribeValue(paramTemp.Name, EnumCompareType.Equal, paramTemp.Type); EngineGraphUtilities.SetDirty(_node); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } } else { EditorGUILayout.HelpBox("The Scene graph don't have mode parameters.", MessageType.Warning); } OnRepaint(); OnRepaint = delegate { }; Repaint(); }