public AdvancedFeaturesWindowMacros(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions) : base(aStartPos, aContent, aStyle, aOptions) { macroList = new DataControlList() { RequestRepaint = Repaint, footerHeight = 25, elementHeight = 40, Columns = new System.Collections.Generic.List <ColumnList.Column>() { new ColumnList.Column() { Text = TC.get("MacrosList.ID"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(150) } }, new ColumnList.Column() { Text = TC.get("Macro.Documentation"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } }, new ColumnList.Column() { Text = TC.get("Element.Effects"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(220) } } }, drawCell = (rect, index, column, isActive, isFocused) => { var macro = macroList.list[index] as MacroDataControl; switch (column) { case 0: EditorGUI.BeginChangeCheck(); var id = EditorGUI.DelayedTextField(rect, macro.getId()); if (EditorGUI.EndChangeCheck()) { macro.setId(id); } break; case 1: EditorGUI.BeginChangeCheck(); var documentation = EditorGUI.TextArea(rect, macro.getDocumentation() ?? string.Empty); if (EditorGUI.EndChangeCheck()) { macro.setDocumentation(documentation); } break; case 2: if (GUI.Button(rect, TC.get("GeneralText.EditEffects"))) { EffectEditorWindow window = ScriptableObject.CreateInstance <EffectEditorWindow>(); window.Init(macro.getController()); } break; } } }; }
protected DataControlListEditorWindowExtension(Rect rect, GUIContent content, GUIStyle style, params GUILayoutOption[] options) : base(rect, content, style, options) { dataControlList = new DataControlList() { RequestRepaint = Repaint, footerHeight = 25, elementHeight = 25, headerHeight = 0, Columns = new List <ColumnList.Column>() { new ColumnList.Column() { Text = "" /*, SizeOptions = GUILayout.ExpandWidth(true)*/ } }, drawElementCallback = OnDrawElement, onSelectCallback = OnSelect }; dataControlList.onRemoveCallback = (list) => { list.index = -1; OnSelect(list); }; }
public ChapterPreview(Rect rect, GUIContent content, GUIStyle style, params GUILayoutOption[] options) : base(rect, content, style, options) { ProjectConfigData.addConsumer(this); PreviewTitle = "Chapter.Preview".Traslate(); noBackground = Controller.ResourceManager.getImage(SpecialAssetPaths.ASSET_EMPTY_BACKGROUND); sceneColors = new Dictionary <string, Color>(); positions = new Positions(); images = new Dictionary <string, Texture2D>(); sizes = new Dictionary <string, Vector2>(); // SceneList sceneList = new DataControlList() { RequestRepaint = Repaint, footerHeight = 10, elementHeight = 20, Columns = new List <ColumnList.Column>() { new ColumnList.Column() { Text = TC.get("Element.Name1"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } }, new ColumnList.Column() { Text = "Open", SizeOptions = new GUILayoutOption[] { GUILayout.Width(250) } } }, drawCell = (cellRect, row, column, isActive, isFocused) => { var scene = ((ScenesListDataControl)sceneList.DataControl).getScenes()[row]; switch (column) { case 0: GUI.Label(cellRect, scene.getId()); break; case 1: if (GUI.Button(cellRect, TC.get("GeneralText.Edit"))) { GameRources.GetInstance().selectedSceneIndex = row; } break; } } }; Layout(); EditorApplication.update += UpdatePositions; }
public void Init(ProgressDataControl progressDataControl) { this.progress = progressDataControl; progressList = new DataControlList() { RequestRepaint = Repaint, Columns = new List <ColumnList.Column>() { new ColumnList.Column() { Text = "Analytics.Milestone.Time".Traslate() } }, drawCell = (rect, row, column, isActive, isFocused) => { var milestone = progressList.list[row] as MilestoneDataControl; if (milestone == null) { return; } switch (column) { default: if (GUI.Button(rect, milestone.getContent().ToString())) { MilestoneEditorWindow.ShowMilestoneEditor(rect, milestone); } break; case 1: EditorGUI.BeginChangeCheck(); var newProgress = EditorGUI.Slider(rect, "", milestone.getProgress(), 0, 1); if (EditorGUI.EndChangeCheck()) { milestone.setProgress(newProgress); } break; } } }; progressColumn = new ColumnList.Column() { Text = "Analytics.Completable.Progress".Traslate() }; }
protected void Awake() { scoresList = new DataControlList() { RequestRepaint = Repaint, Columns = new List <ColumnList.Column>() { new ColumnList.Column() { Text = "Sub scores" } }, drawCell = (rect, row, column, isActive, isFocused) => { CompletablesWindow.ScoreEditor(rect, scoresList.list[row] as ScoreDataControl); } }; }
public ScenesWindowBarriers(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, SceneEditor sceneEditor, params GUILayoutOption[] aOptions) : base(aStartPos, aContent, aStyle, sceneEditor, aOptions) { conditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/conditions-24x24"); noConditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/no-conditions-24x24"); PreviewTitle = "Scene.Preview".Traslate(); barriersList = new DataControlList() { RequestRepaint = Repaint, elementHeight = 20, Columns = new List <ColumnList.Column>() { new ColumnList.Column() // Layer column { Text = TC.get("Barriers.Name"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } }, new ColumnList.Column() // Enabled Column { Text = TC.get("Conditions.Title"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } } }, drawCell = (columnRect, row, column, isActive, isFocused) => { var element = barriersList.list[row] as BarrierDataControl; switch (column) { case 0: EditorGUI.LabelField(columnRect, "Barrier: " + (row + 1)); break; case 1: if (GUI.Button(columnRect, element.getConditions().getBlocksCount() > 0 ? conditionsTex : noConditionsTex)) { barriersList.index = row; ConditionEditorWindow window = ScriptableObject.CreateInstance <ConditionEditorWindow>(); window.Init(element.getConditions()); } break; } }, onSelectCallback = (list) => { sceneEditor.SelectedElement = barriersList.list[list.index] as BarrierDataControl; }, onRemoveCallback = (list) => { sceneEditor.SelectedElement = null; } }; sceneEditor.onSelectElement += (element) => { if (element is BarrierDataControl) { barriersList.index = barriersList.list.IndexOf(element as BarrierDataControl); } else { barriersList.index = -1; } }; }
public DialogNodeEditor() { conditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/conditions-24x24"); noConditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/no-conditions-24x24"); effectTex = Resources.Load <Texture2D>("EAdventureData/img/icons/effects/32x32/has-macro"); noEffectTex = Resources.Load <Texture2D>("EAdventureData/img/icons/effects/32x32/macro"); noBackgroundSkin = Resources.Load <GUISkin>("EAdventureData/skin/EditorNoBackgroundSkin"); noBackgroundSkin.button.margin = new RectOffset(1, 1, 1, 1); noBackgroundSkin.button.padding = new RectOffset(0, 0, 0, 0); closeStyle = new GUIStyle(GUI.skin.button) { padding = new RectOffset(0, 0, 0, 0), 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; buttonstyle = new GUIStyle() { padding = new RectOffset(5, 5, 5, 5) }; linesList = new DataControlList { Columns = new List <ColumnList.Column> { new ColumnList.Column { Text = "Speaker", SizeOptions = new GUILayoutOption[] { GUILayout.MaxWidth(60) } }, new ColumnList.Column { Text = "Emote", SizeOptions = new GUILayoutOption[] { GUILayout.MaxWidth(30) } }, new ColumnList.Column { Text = "Line", SizeOptions = new GUILayoutOption[] { GUILayout.MinWidth(250), GUILayout.ExpandWidth(true) } }, new ColumnList.Column { Text = "Cond.", SizeOptions = new GUILayoutOption[] { GUILayout.MaxWidth(30) } } }, drawCell = (rect, index, column, isActive, isFocused) => { var line = this.linesList.list[index] as ConversationLineDataControl; BubbleType bubbleType = GetBubbleType(line); var text = line.getText(); // Mark the line as selected as soon as any click is performed in the line if (Event.current.isMouse && Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) { linesList.index = index; } // Extract the bubble type if (bubbleType.Identifier != "-") { text = text.Remove(0, bubbleType.Identifier.Length + 2); } switch (column) { case 0: // Speaker var npc = new List <string> { TC.get("ConversationLine.PlayerName") }; npc.AddRange(Controller.Instance.IdentifierSummary.getIds <NPC>()); var speaker = line.getName().Equals("Player") ? 0 : npc.IndexOf(line.getName()); EditorGUI.BeginChangeCheck(); var newSpeaker = EditorGUI.Popup(rect, speaker, npc.ToArray()); if (EditorGUI.EndChangeCheck()) { var newSpeakerName = newSpeaker == 0 ? "Player" : npc[newSpeaker]; line.setName(newSpeakerName); } break; case 1: // Bubble type // Control if (GUI.Button(rect, bubbleType.Identifier)) { bubbleType = BubbleTypes.FirstOrDefault(b => bubbleType.Next == b.Identifier); // Reinsert the bubble type if (bubbleType.Identifier != "-") { text = "#" + bubbleType.Identifier + " " + text; } line.setText(text); } break; case 2: // Text EditorGUI.BeginChangeCheck(); var newText = EditorGUI.TextField(rect, text); if (EditorGUI.EndChangeCheck()) { // Reinsert the bubble type if (bubbleType.Identifier != "-") { newText = "#" + bubbleType.Identifier + " " + newText; } line.setText(newText); } break; case 3: // Conditions var hasConditions = line.getConditions().getBlocksCount() > 0; if (GUI.Button(rect, hasConditions ? conditionsTex : noConditionsTex, noBackgroundSkin.button)) { ConditionEditorWindow.ShowAtPosition(line.getConditions(), new Rect(rect.x + rect.width, rect.y, 0, 0)); } break; } } }; }
public CompletablesWindow(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions) : base(aStartPos, aContent, aStyle, aOptions) { completablesList = new DataControlList() { RequestRepaint = Repaint, Columns = new List <ColumnList.Column>() { new ColumnList.Column() { Text = TC.get("Analytics.Completable.Id") }, new ColumnList.Column() { Text = TC.get("Analytics.Completable.Start") }, new ColumnList.Column() { Text = TC.get("Analytics.Completable.End") }, new ColumnList.Column() { Text = TC.get("Analytics.Completable.Progress") }, new ColumnList.Column() { Text = TC.get("Analytics.Completable.Score") }, new ColumnList.Column() { Text = TC.get("Repeatable"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(70) } } }, drawCell = (rect, row, column, isActive, isFocused) => { var completable = completablesList.list[row] as CompletableDataControl; switch (column) { case 0: completable.renameElement(EditorGUI.TextField(rect, completable.getId())); break; case 1: if (GUI.Button(rect, completable.getStart().getContent().ToString())) { MilestoneEditorWindow.ShowMilestoneEditor(rect, completable.getStart()); } break; case 2: if (GUI.Button(rect, completable.getEnd().getContent().ToString())) { MilestoneEditorWindow.ShowMilestoneEditor(rect, completable.getEnd()); } break; case 3: if (GUI.Button(rect, TC.get("Analytics.Completable.Define"))) { ProgressEditorWindow.ShowProgressEditor(rect, completable.getProgress()); } break; case 4: { if (Available) { ScoreEditor(rect, completable.getScore()); } else { EditorGUI.HelpBox(rect, TC.get("Condition.Var.Warning"), MessageType.Error); } } break; case 5: completable.setRepeatable(GUI.Toggle(rect, completable.getRepeatable(), "?")); break; } } }; }
public BooksWindowContents(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions) : base(aStartPos, aContent, aStyle, aOptions) { PreviewTitle = "Book.Preview".Traslate(); elementTitles = new Dictionary <int, string> { { Controller.BOOK_TITLE_PARAGRAPH, "Element.Name14" }, { Controller.BOOK_TEXT_PARAGRAPH, "Element.Name15" }, { Controller.BOOK_BULLET_PARAGRAPH, "Element.Name16" }, { Controller.BOOK_IMAGE_PARAGRAPH, "Element.Name17" } }; elementIcons = new Dictionary <int, Texture2D> { { Controller.BOOK_TITLE_PARAGRAPH, Resources.Load <Texture2D>("EAdventureData/img/icons/titleBookParagraph") }, { Controller.BOOK_TEXT_PARAGRAPH, Resources.Load <Texture2D>("EAdventureData/img/icons/textBookParagraph") }, { Controller.BOOK_BULLET_PARAGRAPH, Resources.Load <Texture2D>("EAdventureData/img/icons/bulletBookParagraph") }, { Controller.BOOK_IMAGE_PARAGRAPH, Resources.Load <Texture2D>("EAdventureData/img/icons/imageBookParagraph") } }; imageChooser = new FileChooser { Label = "", FileType = FileType.BOOK_IMAGE_PARAGRAPH }; bookContentsList = new DataControlList { Columns = { new ColumnList.Column { Text = "BookParagraphsList.ParagraphType", SizeOptions = new GUILayoutOption[]{ GUILayout.Width(150) } }, new ColumnList.Column { Text = "BookParagraphsList.Content", SizeOptions = new GUILayoutOption[]{ GUILayout.ExpandWidth(true) } } }, drawCell = (rect, row, column, isActive, isFocused) => { var content = bookContentsList.list[row] as BookParagraphDataControl; switch (column) { default: Debug.LogError("Column number out of bounds"); break; case 0: { var height = rect.height; var icon = elementIcons[content.getType()]; var text = elementTitles[content.getType()].Traslate(); var imageRect = new Rect(1, 1, icon.width, icon.height).GUIAdapt(rect); var titleRect = new Rect(height, 0, rect.width - height, height).GUIAdapt(rect); GUI.DrawTexture(imageRect, icon, ScaleMode.ScaleAndCrop); GUI.Label(titleRect, text); } break; case 1: { if (isActive) { var isImage = content.getType() == Controller.BOOK_IMAGE_PARAGRAPH; if (isImage) { EditorGUI.BeginChangeCheck(); imageChooser.Path = content.getParagraphContent(); imageChooser.Do(rect); if (EditorGUI.EndChangeCheck()) { content.setParagraphImagePath(imageChooser.Path); } } else { EditorGUI.BeginChangeCheck(); var newContent = GUI.TextArea(rect, content.getParagraphContent()); if (EditorGUI.EndChangeCheck()) { content.setParagraphTextContent(newContent); } } } else { GUI.Label(rect, content.getParagraphContent()); } } break; } } }; bookDrawer = new BookDrawer(Controller.ResourceManager); }
public ScenesWindowExits(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, SceneEditor sceneEditor, params GUILayoutOption[] aOptions) : base(aStartPos, aContent, aStyle, sceneEditor, aOptions) { new ExitTransitionComponent(Rect.zero, new GUIContent(""), aStyle); new ExitAppearanceComponent(Rect.zero, new GUIContent(""), aStyle); new ExitConditionsAndEffectsComponent(Rect.zero, new GUIContent(""), aStyle); new ExitPlayerPositionComponent(Rect.zero, new GUIContent(""), aStyle); conditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/conditions-24x24"); noConditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/no-conditions-24x24"); exitsList = new DataControlList() { RequestRepaint = Repaint, elementHeight = 20, Columns = new List <ColumnList.Column>() { new ColumnList.Column() // Layer column { Text = TC.get("ExitsList.NextScene"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } }, new ColumnList.Column() // Enabled Column { Text = TC.get("Conditions.Title"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } } }, drawCell = (columnRect, row, column, isActive, isFocused) => { var element = exitsList.list[row] as ExitDataControl; switch (column) { case 0: if (isActive) { var selected = sceneNames.ToList().IndexOf(element.getNextSceneId()); EditorGUI.BeginChangeCheck(); var newId = sceneNames[EditorGUI.Popup(columnRect, selected == -1 ? 0 : selected, sceneNames)]; if (EditorGUI.EndChangeCheck()) { element.setNextSceneId(newId == "---" ? "" : newId); } } else { GUI.Label(columnRect, element.getNextSceneId()); } break; case 1: if (GUI.Button(columnRect, element.getConditions().getBlocksCount() > 0 ? conditionsTex : noConditionsTex)) { exitsList.index = row; ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(element.getConditions()); } break; } }, onSelectCallback = (list) => { sceneEditor.SelectedElement = exitsList.list[list.index] as ExitDataControl; }, onRemoveCallback = (list) => { sceneEditor.SelectedElement = null; } }; sceneEditor.onSelectElement += (element) => { if (element is ExitDataControl) { exitsList.index = exitsList.list.IndexOf(element as ExitDataControl); } else { exitsList.index = -1; } }; }
public AdvancedFeaturesWindowListOfTimers(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions) : base(aStartPos, aContent, aStyle, aOptions) { smallFontStyle = new GUIStyle(); smallFontStyle.fontSize = 8; timerList = new DataControlList() { RequestRepaint = Repaint, footerHeight = 25, elementHeight = 25, Columns = new System.Collections.Generic.List <ColumnList.Column>() { new ColumnList.Column() { Text = TC.get("TimersList.Timer"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } }, new ColumnList.Column() { Text = TC.get("TimersList.Time"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } }, new ColumnList.Column() { Text = TC.get("TimersList.Display"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } } }, drawCell = (rect, index, column, isActive, isFocused) => { var timer = timerList.list[index] as TimerDataControl; switch (column) { case 0: EditorGUI.BeginChangeCheck(); var id = EditorGUI.DelayedTextField(rect, timer.getDisplayName()); if (EditorGUI.EndChangeCheck()) { timer.setDisplayName(id); } break; case 1: EditorGUI.BeginChangeCheck(); var time = System.Math.Max(0, EditorGUI.LongField(rect, timer.getTime())); if (EditorGUI.EndChangeCheck()) { timer.setTime(time); } break; case 2: EditorGUI.BeginChangeCheck(); var showTime = EditorGUI.Toggle(rect, timer.isShowTime()); if (EditorGUI.EndChangeCheck()) { timer.setShowTime(showTime); } break; } } }; }
public OptionNodeEditor() { conditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/conditions-24x24"); noConditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/no-conditions-24x24"); linkTex = Resources.Load <Texture2D>("EAdventureData/img/icons/linkNode"); noLinkTex = Resources.Load <Texture2D>("EAdventureData/img/icons/deleteNodeLink"); effectTex = Resources.Load <Texture2D>("EAdventureData/img/icons/effects/32x32/has-macro"); noEffectTex = Resources.Load <Texture2D>("EAdventureData/img/icons/effects/32x32/macro"); answerTex = Resources.Load <Texture2D>("EAdventureData/img/icons/answer"); questionTex = Resources.Load <Texture2D>("EAdventureData/img/icons/question"); shuffleTex = Resources.Load <Texture2D>("EAdventureData/img/icons/shuffle"); answerContent = new GUIContent(answerTex); questionContent = new GUIContent(questionTex); shuffleContent = new GUIContent(shuffleTex); noBackgroundSkin = Resources.Load <GUISkin>("EAdventureData/skin/EditorNoBackgroundSkin"); noBackgroundSkin.button.margin = new RectOffset(1, 1, 1, 1); noBackgroundSkin.button.padding = new RectOffset(0, 0, 0, 0); closeStyle = new GUIStyle(GUI.skin.button) { padding = new RectOffset(0, 0, 0, 0), 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; linesList = new DataControlList { Columns = new List <ColumnList.Column> { new ColumnList.Column { Text = "", SizeOptions = new GUILayoutOption[] { GUILayout.MaxWidth(20) } }, new ColumnList.Column { Text = "Text", SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.MinWidth(100) } }, new ColumnList.Column { Text = "¿✓?", SizeOptions = new GUILayoutOption[] { GUILayout.MaxWidth(25) } }, new ColumnList.Column { Text = "Cond.", SizeOptions = new GUILayoutOption[] { GUILayout.MaxWidth(25) } }, new ColumnList.Column { Text = "Child", SizeOptions = new GUILayoutOption[] { GUILayout.MaxWidth(25) } } }, drawCell = (rect, index, column, isActive, isFocused) => { // Mark the line as selected as soon as any click is performed in the line if (Event.current.isMouse && Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) { linesList.index = index; } var line = this.linesList.list[index] as ConversationLineDataControl; switch (column) { case 0: GUI.Label(rect, index.ToString()); break; case 1: // Text EditorGUI.BeginChangeCheck(); var newText = EditorGUI.TextField(rect, line.getText()); if (EditorGUI.EndChangeCheck()) { line.setText(newText); } break; case 2: // Correct DoCorrectEditor(rect, line); break; case 3: // Conditions DoConditionsEditor(rect, line.getConditions()); break; case 4: // Child DoChildEditor(rect, index); break; } } }; }
public AdvancedFeaturesWindowGlobalStates(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions) : base(aStartPos, aContent, aStyle, aOptions) { conditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/conditions-24x24"); noConditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/no-conditions-24x24"); globalStateList = new DataControlList() { RequestRepaint = Repaint, footerHeight = 25, elementHeight = 40, Columns = new System.Collections.Generic.List <ColumnList.Column>() { new ColumnList.Column() { Text = TC.get("GlobalStatesList.ID"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(150) } }, new ColumnList.Column() { Text = TC.get("GlobalState.Documentation"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } }, new ColumnList.Column() { Text = TC.get("GlobalState.Conditions"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(220) } } }, drawCell = (rect, index, column, isActive, isFocused) => { var globalState = globalStateList.list[index] as GlobalStateDataControl; switch (column) { case 0: EditorGUI.BeginChangeCheck(); var id = EditorGUI.DelayedTextField(rect, globalState.getId()); if (EditorGUI.EndChangeCheck()) { globalState.setId(id); } break; case 1: EditorGUI.BeginChangeCheck(); var documentation = EditorGUI.TextArea(rect, globalState.getDocumentation() ?? string.Empty); if (EditorGUI.EndChangeCheck()) { globalState.setDocumentation(documentation); } break; case 2: if (GUI.Button(rect, globalState.getController().getBlocksCount() > 0 ? conditionsTex : noConditionsTex)) { ConditionEditorWindow window = ScriptableObject.CreateInstance <ConditionEditorWindow>(); window.Init(globalState.getController()); } break; } } }; }
public ScenesWindowActiveAreas(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, SceneEditor sceneEditor, params GUILayoutOption[] aOptions) : base(aStartPos, aContent, aStyle, sceneEditor, aOptions) { new ActiveAreaActionsComponent(Rect.zero, new GUIContent(""), aStyle); new ActiveAreaDescriptionsComponent(Rect.zero, new GUIContent(""), aStyle); PreviewTitle = "Scene.Preview".Traslate(); conditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/conditions-24x24"); noConditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/no-conditions-24x24"); activeAreasList = new DataControlList() { RequestRepaint = Repaint, elementHeight = 20, Columns = new List <ColumnList.Column>() { new ColumnList.Column() // Layer column { Text = TC.get("ElementList.Layer"), SizeOptions = new GUILayoutOption[] { GUILayout.Width(50) } }, new ColumnList.Column() // Element name { Text = TC.get("ElementList.Title"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } }, new ColumnList.Column() // Enabled Column { Text = TC.get("Conditions.Title"), SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) } } }, drawCell = (columnRect, row, column, isActive, isFocused) => { var element = activeAreasList.list[row] as ActiveAreaDataControl; switch (column) { case 0: GUI.Label(columnRect, row.ToString()); break; case 1: if (isActive) { EditorGUI.BeginChangeCheck(); var newId = EditorGUI.DelayedTextField(columnRect, element.getId()); if (EditorGUI.EndChangeCheck()) { element.renameElement(newId); } } else { GUI.Label(columnRect, element.getId()); } break; case 2: if (GUI.Button(columnRect, element.getConditions().getBlocksCount() > 0 ? conditionsTex : noConditionsTex)) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(element.getConditions()); } break; } }, onSelectCallback = (list) => { sceneEditor.SelectedElement = activeAreasList.list[list.index] as ExitDataControl; }, onRemoveCallback = (list) => { sceneEditor.SelectedElement = null; } }; sceneEditor.onSelectElement += (element) => { if (element is ActiveAreaDataControl) { activeAreasList.index = activeAreasList.list.IndexOf(element as ActiveAreaDataControl); } else { activeAreasList.index = -1; } }; }