private void DrawActionElement(Rect rect, int index, bool isActive, bool isFocused) { GUILayout.BeginArea(rect); var action = actionsList.list[index] as GeoAction; GUILayout.BeginHorizontal(); GUILayout.Label(action.Name, GUILayout.MaxWidth(rect.width * 0.2f)); //Action Parameters GUILayout.BeginVertical(GUILayout.MaxWidth(rect.width * 0.6f)); if (action is EnterAction) { var specialized = action as EnterAction; specialized.OnlyFromOutside = EditorGUILayout.Toggle("Only from outside", specialized.OnlyFromOutside); } if (action is ExitAction) { var specialized = action as ExitAction; specialized.OnlyFromInside = EditorGUILayout.Toggle("Only from inside", specialized.OnlyFromInside); } if (action is InspectAction) { var specialized = action as InspectAction; specialized.Inside = EditorGUILayout.Toggle("On range", specialized.Inside); } if (action is LookToAction) { var specialized = action as LookToAction; specialized.Inside = EditorGUILayout.Toggle("On range", specialized.Inside); specialized.Center = EditorGUILayout.Toggle("Look to center", specialized.Center); if (!specialized.Center) { specialized.Direction = EditorGUILayout.Vector2Field("Look to direction", specialized.Direction); } } GUILayout.EndVertical(); // Conditions and effects GUILayout.BeginVertical(GUILayout.MaxWidth(rect.width * 0.2f)); if (GUILayout.Button("Conditions")) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(action.Conditions); } if (GUILayout.Button("Effects")) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(action.Effects); } GUILayout.EndVertical(); // End eleemnt GUILayout.EndHorizontal(); GUILayout.EndArea(); }
public override void Draw(int aID) { GUILayout.Label(TC.get("Cutscene.CutsceneEndReached")); GUILayout.Space(20); GUILayout.BeginArea(selectorRect); selectedOption = GUILayout.SelectionGrid(selectedOption, possibleOptions, 3, GUILayout.Width(0.9f * windowWidth)); if (selectedOption != selectedOptionLast) { ChangeSelectedOption(selectedOption); } GUILayout.EndArea(); GUILayout.BeginArea(goesToNewSceneRect); if (selectedOption == 2) { GUILayout.BeginHorizontal(); GUILayout.Label(TC.get("NextScene.Title")); selectedSceneNext = EditorGUILayout.Popup(selectedSceneNext, joinedNextScenesList); if (selectedSceneNext != selectedSceneNextLast) { ChangeSelectedNextScene(selectedSceneNext); } if (GUILayout.Button(TC.get("GeneralText.EditEffects"))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[ GameRources.GetInstance().selectedCutsceneIndex].getEffects()); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(TC.get("NextScene.Transition")); selectedTransitionType = EditorGUILayout.Popup(selectedTransitionType, transitionTypes); if (selectedTransitionType != selectedTransitionTypeLast) { ChangeSelectedTransitionType(selectedTransitionType); } GUILayout.Label(TC.get("NextScene.TransitionTime")); timeString = GUILayout.TextField(timeString, 3); timeString = Regex.Replace(timeString, @"[^0-9 ]", ""); if (!timeString.Equals(timeStringLast)) { ChangeSelectedTransitionTime(timeString); } GUILayout.EndHorizontal(); } GUILayout.EndArea(); }
protected override void DrawInspector() { selectedQR = QRController.Instance.QRCodes[QRController.Instance.SelectedQRCode]; EditorGUI.BeginChangeCheck(); // Delayed in order to use content to render the QR var newContent = EditorGUILayout.DelayedTextField("QR.QRCodeEditorWindow.Content".Traslate(), selectedQR.Content); if (EditorGUI.EndChangeCheck()) { selectedQR.Content = newContent; } EditorGUILayout.LabelField("Search.Documentation".Traslate()); selectedQR.Documentation = EditorGUILayout.TextArea(selectedQR.Documentation, GUILayout.Height(200)); // Conditions and Effects using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("Conditions.Title".Traslate())) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(selectedQR.Conditions); } if (GUILayout.Button("Element.Effects".Traslate())) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(selectedQR.Effects); } } // QRCODE and buttons if (GUILayout.Button("QR.QRCodeEditorWindow.Save".Traslate())) { SaveQR(selectedQR); } if (GUILayout.Button("QR.QRCodeEditorWindow.Print".Traslate())) { PrintQR(selectedQR); } }
public override void Draw(int aID) { GUILayout.BeginArea(actionTableRect); GUILayout.BeginHorizontal(); GUILayout.Box(TC.get("Element.Action"), GUILayout.Width(windowWidth * 0.39f)); GUILayout.Box(TC.get("ActionsList.NeedsGoTo"), GUILayout.Width(windowWidth * 0.39f)); GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.1f)); GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.ExpandWidth(false)); // Action table for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions().Count; i++) { if (i == selectedAction) { GUI.skin = selectedAreaSkin; } else { GUI.skin = noBackgroundSkin; } tmpTex = (Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getConditions() .getBlocksCount() > 0 ? conditionsTex : noConditionsTex); GUILayout.BeginHorizontal(); if (i == selectedAction) { int t = Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getType(); if (t == Controller.ACTION_USE_WITH || t == Controller.ACTION_GIVE_TO || t == Controller.ACTION_DRAG_TO) { selectedTarget = EditorGUILayout.Popup( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .getTypeName(), selectedTarget, joinedNamesList, GUILayout.Width(windowWidth * 0.39f)); if (selectedTarget != selectedTargetLast) { ChangeActionTarget(selectedTarget); } } else { GUILayout.Label( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .getTypeName(), GUILayout.Width(windowWidth * 0.39f)); } if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER) { if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f))) { OnActionSelectionChange(i); } } else { GUILayout.BeginHorizontal(GUILayout.Width(windowWidth * 0.39f)); Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].setNeedsGoTo( GUILayout.Toggle( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .getNeedsGoTo(), "")); Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .setKeepDistance( EditorGUILayout.IntField( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .getKeepDistance())); GUILayout.EndHorizontal(); } if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.1f))) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getConditions ()); } } else { if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getTypeName(), GUILayout.Width(windowWidth * 0.39f))) { OnActionSelectionChange(i); } if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER) { if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f))) { OnActionSelectionChange(i); } } else { if ( GUILayout.Button( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getNeedsGoTo().ToString(), GUILayout.Width(windowWidth * 0.39f))) { OnActionSelectionChange(i); } } if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.1f))) { OnActionSelectionChange(i); } } GUILayout.EndHorizontal(); GUI.skin = defaultSkin; } GUILayout.EndScrollView(); GUILayout.EndArea(); /* * Right panel */ GUILayout.BeginArea(rightPanelRect); GUI.skin = noBackgroundSkin; if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth))) { addMenu.menu.ShowAsContext(); } if (GUILayout.Button(duplicateTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList() .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]); } //if (GUILayout.Button(moveUp, GUILayout.MaxWidth(0.08f * windowWidth))) //{ // Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ // GameRources.GetInstance().selectedCharacterIndex].getActionsList().moveElementUp(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ // GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]); //} //if (GUILayout.Button(moveDown, GUILayout.MaxWidth(0.08f * windowWidth))) //{ // Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ // GameRources.GetInstance().selectedCharacterIndex].getActionsList().moveElementDown(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ // GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]); //} if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList() .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction], false); if (selectedAction >= 0) { selectedAction--; } } GUI.skin = defaultSkin; GUILayout.EndArea(); GUILayout.BeginArea(descriptionRect); GUILayout.Label(TC.get("Action.Documentation")); GUILayout.Space(20); documentation = GUILayout.TextArea(documentation); if (!documentation.Equals(documentationLast)) { OnDocumentationChanged(documentation); } GUILayout.EndArea(); GUILayout.BeginArea(effectsRect); if (selectedAction < 0) { GUI.enabled = false; } if (GUILayout.Button(TC.get("Element.Effects"))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction] .getEffects()); } GUI.enabled = true; GUILayout.EndArea(); }
public void draw() { if (closeStyle == null) { closeStyle = new GUIStyle(GUI.skin.button); closeStyle.padding = new RectOffset(0, 0, 0, 0); closeStyle.margin = new RectOffset(0, 5, 2, 0); closeStyle.normal.textColor = Color.red; closeStyle.focused.textColor = Color.red; closeStyle.active.textColor = Color.red; closeStyle.hover.textColor = Color.red; } GUIStyle style = new GUIStyle(); style.padding = new RectOffset(5, 5, 5, 5); EditorGUILayout.BeginVertical(); EditorGUILayout.HelpBox(TC.get("ConversationEditor.AtLeastOne"), MessageType.None); bool infoShown = false; if (myNode.getLineCount() > 0) { bool isScrolling = false; if (myNode.getLineCount() > 10) { scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.MinWidth(360), GUILayout.Height(190)); isScrolling = true; } for (int i = 0; i < myNode.getLineCount(); i++) { EditorGUILayout.BeginHorizontal(); bool showInfo = false; EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent(TC.get("ConversationEditor.Option") + " " + i + ": ")).x; myNode.getLine(i).setText(EditorGUILayout.TextField(TC.get("ConversationEditor.Option") + " " + i + ": ", myNode.getLine(i).getText(), GUILayout.Width(200))); tmpTex = (myNode.getLine(i).getConditions().getConditionsList().Count > 0 ? conditionsTex : noConditionsTex); if (GUILayout.Button(tmpTex, noBackgroundSkin.button, GUILayout.Width(15), GUILayout.Height(15))) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(myNode.getLine(i).getConditions()); } if (GUILayout.Button(linkTex, noBackgroundSkin.button, GUILayout.Width(15), GUILayout.Height(15))) { parent.startSetChild(this.myNode, i); } if (GUILayout.Button("X", closeStyle, GUILayout.Width(15), GUILayout.Height(15))) { myNode.removeLine(i); myNode.removeChild(i); } ; EditorGUILayout.EndHorizontal(); } if (isScrolling) { EditorGUILayout.EndScrollView(); } } EditorGUILayout.BeginHorizontal(); GUIContent bttext = new GUIContent(TC.get("ConversationEditor.AddOptionChild")); Rect btrect = GUILayoutUtility.GetRect(bttext, style); if (GUI.Button(btrect, bttext)) { myNode.addLine(new ConversationLine("Player", "")); parent.addChild(this.myNode, new DialogueConversationNode()); } ; tmpTex = (myNode.getEffects().getEffects().Count > 0 ? effectTex : noEffectTex); if (GUILayout.Button(tmpTex, noBackgroundSkin.button, GUILayout.Width(24), GUILayout.Height(24))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(myNode.getEffects()); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }
public override void Draw(int aID) { if (selectedQR == null) { GUILayout.Label("Please select or create a new QR."); return; } EditorGUILayout.BeginVertical(); { EditorGUI.BeginChangeCheck(); // Delayed in order to use content to render the QR selectedQR.Content = EditorGUILayout.DelayedTextField("Content", selectedQR.Content); if (EditorGUI.EndChangeCheck()) { RegenerateQR(); } EditorGUILayout.LabelField("Documentation"); selectedQR.Documentation = EditorGUILayout.TextArea(selectedQR.Documentation, GUILayout.Height(200)); // Conditions and Effects EditorGUILayout.BeginHorizontal(); { if (GUILayout.Button("Conditions")) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(selectedQR.Conditions); } if (GUILayout.Button("Effects")) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(selectedQR.Effects); } } EditorGUILayout.EndHorizontal(); // QRCODE and buttons EditorGUILayout.BeginHorizontal(); { var rect = EditorGUILayout.BeginVertical("preBackground", GUILayout.Width(Rect.width * .75f), GUILayout.ExpandHeight(true)); { GUILayout.BeginHorizontal(); { var hw = Mathf.Min(rect.height * .9f, rect.width * .7f); GUI.DrawTexture(new Rect(rect.x + rect.width / 2f - hw / 2f, rect.y + rect.height / 2f - hw / 2f, hw, hw), qrCodeImage); } GUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); { if (GUILayout.Button("Save")) { var fileName = EditorUtility.SaveFilePanel("Save the QR code", "", "qrcode", "png"); if (fileName != null) { File.WriteAllBytes(fileName, qrCodeImage.EncodeToPNG()); } } if (GUILayout.Button("Print")) { var printDialog = new PrintDialog(); var printDocument = new PrintDocument(); printDialog.Document = printDocument; printDocument.PrintPage += new PrintPageEventHandler((object sender, PrintPageEventArgs ev) => { float leftMargin = ev.PageBounds.Left; float topMargin = ev.PageBounds.Top; // Calculate the number of lines per page. var center = new Vector2(ev.PageBounds.Width, ev.PageBounds.Height) / 2; var qrwh = Mathf.Min(ev.PageBounds.Width, ev.PageBounds.Height) * (3f / 4f); // Only 3/4 of the space var rectangleF = new System.Drawing.RectangleF(center.x - (qrwh / 2f), center.y - (qrwh / 2f), qrwh, qrwh); var qrBitmap = new System.Drawing.Bitmap(qrCodeImage.width, qrCodeImage.height); Color pixelColor; for (int i = 0; i < qrCodeImage.width; i++) { for (int j = qrCodeImage.height - 1; j >= 0; j--) { pixelColor = qrCodeImage.GetPixel(i, qrCodeImage.height - 1 - j); qrBitmap.SetPixel(i, j, System.Drawing.Color.FromArgb( Mathf.RoundToInt(255 * pixelColor.a), Mathf.RoundToInt(255 * pixelColor.r), Mathf.RoundToInt(255 * pixelColor.g), Mathf.RoundToInt(255 * pixelColor.b))); } } ev.Graphics.DrawImage(qrBitmap, rectangleF); ev.HasMorePages = false; }); var result = printDialog.ShowDialog(); // If the result is OK then print the document. if (result == DialogResult.OK) { printDocument.Print(); } } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); }
public void Awake() { resourcesEditor = new ResourcesEditor { ShowResourcesList = true }; conditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/conditions-24x24"); noConditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/no-conditions-24x24"); actionsList = new DataControlList() { footerHeight = 25, elementHeight = 40, Columns = new System.Collections.Generic.List <ColumnList.Column>() { new ColumnList.Column() { Text = TC.get("ActionsList.ActionName"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(150) } }, new ColumnList.Column() { Text = TC.get("DescriptionList.Description"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } }, new ColumnList.Column() { Text = TC.get("ActionsList.NeedsGoTo"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(120) } }, new ColumnList.Column() { Text = TC.get("ActionsList.Conditions"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(70) } }, new ColumnList.Column() { Text = TC.get("Element.Effects"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(70) } } }, drawCell = (rect, index, column, isActive, isFocused) => { var action = actionsList.list[index] as ActionDataControl; switch (column) { case 0: { var name = action.getContent() is CustomAction ? ((CustomAction)action.getContent()).getName() : action.getTypeName(); var leftHalf = new Rect(rect); leftHalf.width /= 2f; var rightHalf = new Rect(leftHalf); rightHalf.x += leftHalf.width; if (action.hasIdTarget()) { rightHalf.height = 25; EditorGUI.LabelField(leftHalf, name); if (!isActive) { EditorGUI.LabelField(rightHalf, !string.IsNullOrEmpty(action.getIdTarget()) ? action.getIdTarget() : "---"); } else { EditorGUI.BeginChangeCheck(); string selected = string.Empty; string[] choices = new string[0]; switch ((action.getContent() as Action).getType()) { case Action.DRAG_TO: case Action.CUSTOM_INTERACT: choices = Controller.Instance.IdentifierSummary.combineIds(new System.Type[] { typeof(Item), typeof(NPC), typeof(ActiveArea) }); break; case Action.GIVE_TO: choices = Controller.Instance.IdentifierSummary.getIds <NPC>(); break; case Action.USE_WITH: choices = Controller.Instance.IdentifierSummary.combineIds(new System.Type[] { typeof(Item), typeof(ActiveArea) }); break; } var selectedIndex = EditorGUI.Popup(rightHalf, System.Array.FindIndex(choices, action.getIdTarget().Equals), choices); if (EditorGUI.EndChangeCheck()) { if (selectedIndex >= 0 && selectedIndex < choices.Length) { selected = choices[selectedIndex]; action.setIdTarget(selected); } } } } else if (action.getType() == Controller.ACTION_TALK_TO) { EditorGUI.LabelField(leftHalf, name); var triggerConversationEffect = action.getEffects().getEffects().Find(e => e is TriggerConversationEffect) as TriggerConversationEffect; if (triggerConversationEffect != null) { var conversationId = triggerConversationEffect.getTargetId(); if (GUI.Button(rightHalf, "Open")) { var conversationsList = Controller.Instance.SelectedChapterDataControl.getConversationsList(); var conversation = conversationsList.getConversations().Find(c => c.getId() == conversationId); Controller.Instance.SelectElement(conversation); } } } else { EditorGUI.LabelField(rect, name); } } break; case 1: EditorGUI.BeginChangeCheck(); var documentation = EditorGUI.TextArea(rect, action.getDocumentation() ?? string.Empty); if (EditorGUI.EndChangeCheck()) { action.setDocumentation(documentation); } break; case 2: if (Controller.Instance.PlayerMode == Controller.FILE_ADVENTURE_1STPERSON_PLAYER) { EditorGUI.LabelField(rect, TC.get("ActionsList.NotRelevant")); } else { var leftHalf = new Rect(rect); leftHalf.width /= 2f; var rightHalf = new Rect(leftHalf); rightHalf.x += leftHalf.width; EditorGUI.BeginChangeCheck(); var needsToGo = EditorGUI.Toggle(leftHalf, action.getNeedsGoTo()); if (EditorGUI.EndChangeCheck()) { action.setNeedsGoTo(needsToGo); } EditorGUI.BeginChangeCheck(); var distance = EditorGUI.IntField(rightHalf, action.getKeepDistance()); if (EditorGUI.EndChangeCheck()) { action.setKeepDistance(distance); } ; } break; case 3: if (GUI.Button(rect, action.getConditions().getBlocksCount() > 0 ? conditionsTex : noConditionsTex)) { ConditionEditorWindow window = ScriptableObject.CreateInstance <ConditionEditorWindow>(); window.Init(action.getConditions()); } break; case 4: if (GUI.Button(rect, "Effects")) { EffectEditorWindow window = ScriptableObject.CreateInstance <EffectEditorWindow>(); window.Init(action.getEffects()); } break; } } }; actionsList.onSelectCallback += (list) => { var i = list.index; var actions = ActionsListDataControl.getActions(); customAction = i != -1 && actions[i] is CustomActionDataControl ? actions[i] as CustomActionDataControl : null; if (customAction != null) { resourcesEditor.Data = customAction; } }; actionsList.onRemoveCallback += (list) => { customAction = null; }; }
public override void Draw(int aID) { GUILayout.BeginArea(tableRect); GUILayout.BeginHorizontal(); GUILayout.Box(TC.get("ActiveAreasList.Id"), GUILayout.Width(windowWidth * 0.54f)); GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.14f)); GUILayout.Box(TC.get("ActiveAreasList.Documentation"), GUILayout.Width(windowWidth * 0.18f)); GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList().Count; i++) { if (i == selectedArea) { GUI.skin = selectedAreaSkin; } GUILayout.BeginHorizontal(); if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList()[i].getId(), GUILayout.Width(windowWidth * 0.54f))) { OnSelectionChanged(i); } if (GUILayout.Button(conditionTex, GUILayout.Width(windowWidth * 0.14f))) { OnSelectionChanged(i); ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList()[i] .getConditions()); } if (GUILayout.Button(TC.get("GeneralText.EditDocumentation"), GUILayout.Width(windowWidth * 0.18f))) { OnSelectionChanged(i); } GUILayout.EndHorizontal(); GUI.skin = defaultSkin; } GUILayout.EndScrollView(); GUILayout.EndArea(); /* * Right panel */ GUILayout.BeginArea(rightPanelRect); GUI.skin = noBackgroundSkin; if (GUILayout.Button(addTexture, GUILayout.MaxWidth(0.08f * windowWidth))) { ActiveAreaNewName window = (ActiveAreaNewName)ScriptableObject.CreateInstance(typeof(ActiveAreaNewName)); window.Init(this, "IdObject"); } if (GUILayout.Button(duplicateImg, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList() .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]); } if (GUILayout.Button(moveUp, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList() .moveElementUp(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]); } if (GUILayout.Button(moveDown, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList() .moveElementDown(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]); } if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList() .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea], false); if (selectedArea >= 0) { selectedArea--; } if (selectedAction >= 0) { selectedAction--; } } GUI.skin = defaultSkin; GUILayout.EndArea(); /** * ACTION EDITOR */ GUILayout.BeginArea(actionRect); GUILayout.BeginHorizontal(); GUILayout.Box(TC.get("Element.Action"), GUILayout.Width(windowWidth * 0.39f)); GUILayout.Box(TC.get("ActionsList.NeedsGoTo"), GUILayout.Width(windowWidth * 0.39f)); GUILayout.Box(TC.get("Element.Effects") + "/" + TC.get("SmallAction.Conditions"), GUILayout.Width(windowWidth * 0.1f)); GUILayout.EndHorizontal(); scrollPositionAction = GUILayout.BeginScrollView(scrollPositionAction, GUILayout.ExpandWidth(false)); if (selectedArea >= 0) { // Action table for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea] .getActionsList().getActions().Count; i++) { if (i == selectedAction) { GUI.skin = selectedAreaSkin; } else { GUI.skin = noBackgroundSkin; } GUILayout.BeginHorizontal(); if (i == selectedAction) { GUILayout.Label( Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[ selectedArea ].getActionsList().getActions()[i].getTypeName(), GUILayout.Width(windowWidth * 0.39f)); if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER) { if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f))) { selectedAction = i; } } else { GUILayout.BeginHorizontal(GUILayout.Width(windowWidth * 0.39f)); Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[ selectedArea].getActionsList().getActions()[i].setNeedsGoTo( GUILayout.Toggle( Controller.getInstance() .getSelectedChapterDataControl() .getScenesList() .getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList() .getActiveAreas()[selectedArea].getActionsList().getActions()[i] .getNeedsGoTo(), "")); Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[ selectedArea].getActionsList().getActions()[i].setKeepDistance( EditorGUILayout.IntField( Controller.getInstance() .getSelectedChapterDataControl() .getScenesList() .getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList() .getActiveAreas()[selectedArea].getActionsList().getActions()[i] .getKeepDistance())); GUILayout.EndHorizontal(); } GUILayout.BeginVertical(); if (GUILayout.Button(TC.get("ActiveAreasList.Conditions"), GUILayout.Width(windowWidth * 0.1f))) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init( Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[ selectedArea ].getActionsList().getActions()[i].getConditions()); } if (GUILayout.Button(TC.get("Element.Effects"), GUILayout.Width(windowWidth * 0.1f))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init( Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[ selectedArea ].getActionsList().getActions()[i].getEffects()); } if (GUILayout.Button(TC.get("SmallAction.EditNotEffects"), GUILayout.Width(windowWidth * 0.1f))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init( Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[ selectedArea ].getActionsList().getActions()[i].getNotEffectsController()); } GUILayout.EndVertical(); } else { if ( GUILayout.Button( Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[ selectedArea].getActionsList().getActions()[i].getTypeName(), GUILayout.Width(windowWidth * 0.39f))) { selectedAction = i; } if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER) { if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f))) { selectedAction = i; } } else { if ( GUILayout.Button( Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[ selectedArea].getActionsList().getActions()[i].getNeedsGoTo().ToString(), GUILayout.Width(windowWidth * 0.39f))) { selectedAction = i; } } } GUILayout.EndHorizontal(); GUI.skin = defaultSkin; } } GUILayout.EndScrollView(); GUILayout.EndArea(); /* * Right action panel */ GUILayout.BeginArea(actionRightPanelRect); GUI.skin = noBackgroundSkin; if (GUILayout.Button(addTexture, GUILayout.MaxWidth(0.08f * windowWidth))) { addMenu.menu.ShowAsContext(); } if (GUILayout.Button(duplicateImg, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea] .getActionsList() .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea] .getActionsList().getActions()[selectedAction]); } if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea] .getActionsList() .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea] .getActionsList().getActions()[selectedAction], false); if (selectedAction >= 0) { selectedAction--; } } GUI.skin = defaultSkin; GUILayout.EndArea(); if (backgroundPath != "") { GUILayout.BeginArea(infoPreviewRect); // Show preview dialog if (GUILayout.Button(TC.get("DefaultClickAction.ShowDetails") + "/" + TC.get("GeneralText.Edit"))) { ActiveAreasEditor window = (ActiveAreasEditor)ScriptableObject.CreateInstance(typeof(ActiveAreasEditor)); window.Init(this, Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex], selectedArea); } GUILayout.EndArea(); GUI.DrawTexture(previewRect, backgroundPreviewTex, ScaleMode.ScaleToFit); } else { GUILayout.BeginArea(infoPreviewRect); GUILayout.Button("No background!"); GUILayout.EndArea(); } }
public override void Draw(int aID) { GUILayout.BeginArea(tableRect); GUILayout.BeginHorizontal(); GUILayout.Box(TC.get("ExitsList.NextScene"), GUILayout.Width(windowWidth * 0.24f)); GUILayout.Box(TC.get("ExitsList.Transition"), GUILayout.Width(windowWidth * 0.14f)); GUILayout.Box(TC.get("ExitsList.Appearance"), GUILayout.Width(windowWidth * 0.34f)); GUILayout.Box(TC.get("ExitsList.ConditionsAndEffects"), GUILayout.Width(windowWidth * 0.14f)); GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList().Count; i++) { if (i == selectedExit) { GUI.skin = selectedAreaSkin; } else { GUI.skin = noBackgroundSkin; } GUILayout.BeginHorizontal(); if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getNextSceneId(), GUILayout.Width(windowWidth * 0.24f))) { ChangeExitSelection(i); } // When is selected - show transition menu if (selectedExit == i) { GUILayout.BeginVertical(); selectedTransitionType = EditorGUILayout.Popup(selectedTransitionType, transitionTypes, GUILayout.Width(windowWidth * 0.12f), GUILayout.MaxWidth(windowWidth * 0.12f)); if (selectedTransitionType != selectedTransitionTypeLast) { ChangeSelectedTransitionType(selectedTransitionType); } transitionTimeString = GUILayout.TextField(transitionTimeString, 3, GUILayout.Width(windowWidth * 0.12f), GUILayout.MaxWidth(windowWidth * 0.12f)); transitionTimeString = Regex.Replace(transitionTimeString, @"[^0-9 ]", ""); if (!transitionTimeString.Equals(transitionTimeStringLast)) { ChangeSelectedTransitionTime(transitionTimeString); } GUILayout.EndVertical(); } // When is not selected - show normal text else { if (GUILayout.Button(TC.get("GeneralText.Edit"), GUILayout.Width(windowWidth * 0.14f))) { ChangeExitSelection(i); } } if (GUILayout.Button(TC.get("GeneralText.Edit"), GUILayout.Width(windowWidth * 0.34f))) { ChangeExitSelection(i); ExitsAppearance window = (ExitsAppearance)ScriptableObject.CreateInstance(typeof(ExitsAppearance)); window.Init(this, "", selectedExit); } if (selectedExit == i) { GUILayout.BeginVertical(); if (GUILayout.Button(TC.get("Exit.EditConditions"), GUILayout.Width(windowWidth * 0.14f))) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getConditions()); } if (GUILayout.Button(TC.get("GeneralText.EditEffects"), GUILayout.Width(windowWidth * 0.14f))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getEffects()); } if (GUILayout.Button(TC.get("Exit.EditPostEffects"), GUILayout.Width(windowWidth * 0.14f))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getPostEffects()); } if (GUILayout.Button(TC.get("Exit.EditNotEffects"), GUILayout.Width(windowWidth * 0.14f))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getNotEffects()); } GUILayout.EndVertical(); } else { if (GUILayout.Button(TC.get("GeneralText.Edit"), GUILayout.Width(windowWidth * 0.14f))) { ChangeExitSelection(i); } } GUILayout.EndHorizontal(); GUI.skin = defaultSkin; } GUILayout.EndScrollView(); GUILayout.EndArea(); /* * Right panel */ GUILayout.BeginArea(rightPanelRect); GUI.skin = noBackgroundSkin; if (GUILayout.Button(addTexture, GUILayout.MaxWidth(0.08f * windowWidth))) { ExitNewLinkTo window = (ExitNewLinkTo)ScriptableObject.CreateInstance(typeof(ExitNewLinkTo)); window.Init(this); } if (GUILayout.Button(duplicateImg, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList() .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExits()[selectedExit]); } if (GUILayout.Button(moveUp, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList() .moveElementUp(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExits()[selectedExit]); } if (GUILayout.Button(moveDown, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList() .moveElementDown(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExits()[selectedExit]); } if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList() .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getExitsList().getExits()[selectedExit], false); } GUI.skin = defaultSkin; GUILayout.EndArea(); if (backgroundPath != "") { GUILayout.BeginArea(infoPreviewRect); // Show preview dialog if (GUILayout.Button(TC.get("DefaultClickAction.ShowDetails") + "/" + TC.get("GeneralText.Edit"))) { ExitsEditor window = (ExitsEditor)ScriptableObject.CreateInstance(typeof(ExitsEditor)); window.Init(this, Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex], selectedExit); } GUILayout.EndArea(); GUI.DrawTexture(previewRect, backgroundPreviewTex, ScaleMode.ScaleToFit); } else { GUILayout.BeginArea(infoPreviewRect); GUILayout.Button("No background!"); GUILayout.EndArea(); } }
public void draw() { if (closeStyle == null) { closeStyle = new GUIStyle(GUI.skin.button); closeStyle.padding = new RectOffset(0, 0, 0, 0); closeStyle.margin = new RectOffset(0, 5, 2, 0); closeStyle.normal.textColor = Color.red; closeStyle.focused.textColor = Color.red; closeStyle.active.textColor = Color.red; closeStyle.hover.textColor = Color.red; } if (buttonstyle == null) { buttonstyle = new GUIStyle(); buttonstyle.padding = new RectOffset(5, 5, 5, 5); } GUIStyle style = new GUIStyle(); style.padding = new RectOffset(5, 5, 5, 5); EditorGUILayout.BeginVertical(); EditorGUILayout.HelpBox(TC.get("ConversationEditor.AtLeastOne"), MessageType.None); bool infoShown = false; if (myNode.getLineCount() > 0) { bool isScrolling = false; if (myNode.getLineCount() > 10) { scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.MinWidth(360), GUILayout.Height(190)); isScrolling = true; } for (int i = 0; i < myNode.getLineCount(); i++) { EditorGUILayout.BeginHorizontal(); //myNode.getLine(i).IsEntityFragment = EditorGUILayout.Toggle("Is entity: ", frg.IsEntityFragment); bool showInfo = false; EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent(TC.get("ConversationEditor.Speaker"))).x; myNode.getLine(i).setName(npc[EditorGUILayout.Popup(TC.get("ConversationEditor.Speaker"), npc.IndexOf(myNode.getLine(i).getName()), npc.ToArray())]); EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent(TC.get("ConversationEditor.Line"))).x; myNode.getLine(i).setText(EditorGUILayout.TextField(TC.get("ConversationEditor.Line"), myNode.getLine(i).getText(), GUILayout.Width(200))); tmpTex = (myNode.getLine(i).getConditions().getConditionsList().Count > 0 ? conditionsTex : noConditionsTex); if (GUILayout.Button(tmpTex, noBackgroundSkin.button, GUILayout.Width(15), GUILayout.Height(15))) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(myNode.getLine(i).getConditions()); } if (GUILayout.Button("X", closeStyle, GUILayout.Width(15), GUILayout.Height(15))) { myNode.removeLine(i); } ; EditorGUILayout.EndHorizontal(); } if (isScrolling) { EditorGUILayout.EndScrollView(); } } GUIContent bttext = new GUIContent(TC.get("ConversationLine.DefaultText")); Rect btrect = GUILayoutUtility.GetRect(bttext, style); if (GUI.Button(btrect, bttext)) { myNode.addLine(new ConversationLine(TC.get("ConversationLine.PlayerName"), "")); } ; EditorGUILayout.HelpBox(TC.get("ConversationEditor.NodeOption"), MessageType.None); EditorGUILayout.BeginHorizontal(); GUI.enabled = (myNode.getChildCount() == 0) || myNode.getType() == ConversationNodeViewEnum.OPTION; bttext = new GUIContent(TC.get("ConversationEditor.CreateChild")); btrect = GUILayoutUtility.GetRect(bttext, buttonstyle); if (GUI.Button(btrect, bttext)) { parent.addChild(myNode, new DialogueConversationNode()); } GUI.enabled = true; bttext = new GUIContent(TC.get("ConversationEditor.SetChild")); btrect = GUILayoutUtility.GetRect(bttext, buttonstyle); if (GUI.Button(btrect, bttext)) { parent.startSetChild(this.myNode, 0); } tmpTex = (myNode.getEffects().getEffects().Count > 0 ? effectTex : noEffectTex); if (GUILayout.Button(tmpTex, noBackgroundSkin.button, GUILayout.Width(24), GUILayout.Height(24))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(myNode.getEffects()); } GUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }
public override void Draw(int aID) { GUILayout.BeginArea(macroTableRect); GUILayout.Box(TC.get("MacrosList.ID"), GUILayout.Width(0.85f * windowWidth)); scrollPosition = GUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl().getMacros().Count; i++) { if (i != selectedMacro) { GUI.skin = noBackgroundSkin; if ( GUILayout.Button( Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl().getMacros()[ i].getId(), GUILayout.Width(0.85f * windowWidth))) { OnSelectedMacroChanged(i); } } else { GUI.skin = selectedAreaSkin; macroName = GUILayout.TextField(macroName, GUILayout.Width(0.85f * windowWidth)); if (!macroName.Equals(macroNameLast)) { OnMacroNameChanged(macroName); } } GUI.skin = defaultSkin; } GUILayout.EndScrollView(); GUILayout.EndArea(); /* * Right panel */ GUILayout.BeginArea(rightPanelRect); GUI.skin = noBackgroundSkin; if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl() .addElement(Controller.MACRO, "Macro" + Random.Range(0, 10000).ToString()); } if (GUILayout.Button(duplicateTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl() .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl().getMacros()[selectedMacro]); } if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl() .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl().getMacros()[selectedMacro], false); selectedMacro = -1; } GUI.skin = defaultSkin; GUILayout.EndArea(); if (selectedMacro != -1) { GUILayout.Space(10); GUILayout.BeginArea(descriptionRect); GUILayout.Label(TC.get("Macro.Documentation")); GUILayout.Space(10); macroDocumentation = GUILayout.TextArea(macroDocumentation, GUILayout.MinHeight(0.15f * windowHeight)); if (!macroDocumentation.Equals(macroDocumentationLast)) { OnMacroDocumentationChanged(macroDocumentation); } GUILayout.EndArea(); GUILayout.BeginArea(effectsRect); if (GUILayout.Button(TC.get("Element.Effects"))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(Controller.getInstance() .getSelectedChapterDataControl() .getMacrosListDataControl().getMacros()[selectedMacro].getController()); } GUILayout.EndArea(); } }
public override void Draw(int aID) { /* * Timer table */ GUILayout.BeginArea(timerTableRect); GUILayout.BeginHorizontal(); GUILayout.Box(TC.get("TimersList.Timer"), GUILayout.MaxWidth(windowWidth * 0.3f)); GUILayout.Box(TC.get("TimersList.Time"), GUILayout.MaxWidth(windowWidth * 0.3f)); GUILayout.Box(TC.get("TimersList.Display"), GUILayout.MaxWidth(windowWidth * 0.3f)); GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers().Count; i++) { if (i == selectedTimer) { GUI.skin = selectedAreaSkin; } else { GUI.skin = noBackgroundSkin; } GUILayout.BeginHorizontal(); if (i == selectedTimer) { if (GUILayout.Button("Timer #" + i, GUILayout.MaxWidth(windowWidth * 0.3f))) { OnTimerSelectedChange(i); } timerTime = GUILayout.TextField(timerTime, GUILayout.MaxWidth(windowWidth * 0.3f)); timerTime = (Regex.Match(timerTime, "^[0-9]{1,4}$").Success ? timerTime : timerTimeLast); if (timerTime != timerTimeLast) { OnTimerTime(timerTime); } Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[i].setShowTime(GUILayout .Toggle( Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[i] .isShowTime(), "", GUILayout.MaxWidth(windowWidth * 0.3f))); } else { if (GUILayout.Button("Timer #" + i, GUILayout.MaxWidth(windowWidth * 0.3f))) { OnTimerSelectedChange(i); } if ( GUILayout.Button( Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[i].getTime() .ToString(), GUILayout.MaxWidth(windowWidth * 0.3f))) { OnTimerSelectedChange(i); } if ( GUILayout.Button( Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[i].isShowTime().ToString(), GUILayout.MaxWidth(windowWidth * 0.3f))) { OnTimerSelectedChange(i); } } GUILayout.EndHorizontal(); GUI.skin = defaultSkin; } GUILayout.EndScrollView(); GUILayout.EndArea(); /* * Right panel */ GUILayout.BeginArea(rightPanelRect); GUI.skin = noBackgroundSkin; if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getTimersList().addElement(Controller.TIMER, ""); } if (GUILayout.Button(duplicateTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance() .getSelectedChapterDataControl() .getTimersList() .duplicateElement( Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer]); } if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance() .getSelectedChapterDataControl() .getTimersList() .deleteElement( Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer], false); } GUI.skin = defaultSkin; GUILayout.EndArea(); /* * Properties panel */ if (selectedTimer != -1 && Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer] != null) { GUILayout.BeginArea(settingsTable); GUILayout.Label(TC.get("Timer.Documentation")); fullTimerDescription = GUILayout.TextArea(fullTimerDescription, GUILayout.MinHeight(0.1f * windowHeight)); if (fullTimerDescription != fullTimerDescriptionLast) { OnTimerDocumentationChanged(fullTimerDescription); } GUILayout.FlexibleSpace(); GUILayout.Label(TC.get("TimersList.Time")); GUILayout.BeginHorizontal(); if ( !Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer] .isShowTime()) { GUI.enabled = false; } GUILayout.Label(TC.get("Timer.DisplayName")); displayName = GUILayout.TextField(displayName); if (displayName != displayNameLast) { OnTimerDisplayNameChanged(displayName); } Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].setCountDown(GUILayout.Toggle(Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].isCountDown(), TC.get("Timer.CountDown"))); Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].setShowWhenStopped(GUILayout.Toggle(Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].isShowWhenStopped(), TC.get("Timer.ShowWhenStopped"))); GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(TC.get("Timer.LoopControl")); Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].setMultipleStarts(GUILayout.Toggle(Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].isMultipleStarts(), TC.get("Timer.MultipleStarts"))); GUILayout.Label(TC.get("Timer.MultipleStartsDesc"), smallFontStyle); Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].setRunsInLoop(GUILayout.Toggle(Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].isRunsInLoop(), TC.get("Timer.RunsInLoop"))); GUILayout.Label( TC.get("Timer.RunsInLoopDesc"), smallFontStyle); GUILayout.FlexibleSpace(); GUILayout.Label(TC.get("Timer.InitConditions")); if (GUILayout.Button(TC.get("GeneralText.EditInitConditions"))) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].getInitConditions()); } GUILayout.FlexibleSpace(); GUILayout.Label(TC.get("Timer.EndConditions")); Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].setUsesEndCondition( GUILayout.Toggle(Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].isUsesEndCondition(), TC.get("Timer.UsesEndConditionShort"))); if ( !Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer] .isUsesEndCondition()) { GUI.enabled = false; } if (GUILayout.Button(TC.get("GeneralText.EditEndConditions"))) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].getEndConditions()); } GUI.enabled = true; GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.Label(TC.get("Timer.Effects"), GUILayout.Width(0.45f * windowWidth)); GUILayout.Label(TC.get("Timer.PostEffects"), GUILayout.Width(0.45f * windowWidth)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button(TC.get("GeneralText.EditEffects"), GUILayout.Width(0.45f * windowWidth))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].getEffects()); } if (GUILayout.Button(TC.get("GeneralText.EditPostEffects"), GUILayout.Width(0.45f * windowWidth))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(Controller.getInstance() .getSelectedChapterDataControl() .getTimersList().getTimers()[selectedTimer].getPostEffects()); } GUILayout.EndHorizontal(); GUILayout.EndArea(); } }