public float DepreciatedMoMActivations(float offset) { UIElement ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 11.5f, 1); ui.SetText("DEPRECIATED Activations", Color.red); offset += 1; int index; for (index = 0; index < monsterComponent.activations.Length; index++) { int i = index; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 11.5f, 1); ui.SetText(monsterComponent.activations[index]); ui.SetButton(delegate { QuestEditorData.SelectComponent(monsterComponent.activations[i]); }); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(11.5f, offset, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { RemoveActivation(i); }); new UIElementBorder(ui, Color.red); offset += 1; } return(offset + 1); }
public float AddInspect(float offset) { if (!(game.gameType is MoMGameType)) { return(offset); } UIElement ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 5, 1); ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "INSPECT"))); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(5, offset, 13.5f, 1); ui.SetText(itemComponent.inspect); ui.SetButton(delegate { PickInpsect(); }); new UIElementBorder(ui); if (itemComponent.inspect.Length > 0) { ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset, 1, 1); ui.SetText("<b>⇨</b>", Color.blue); ui.SetButton(delegate { QuestEditorData.SelectComponent(itemComponent.inspect); }); new UIElementBorder(ui, Color.blue); } return(offset + 2); }
override public void Update() { base.Update(); Game game = Game.Get(); TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(4, 1), CommonStringKeys.ACTIVATION, delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 0), new Vector2(15, 1), new StringKey(null, name.Substring("Activation".Length), false), delegate { QuestEditorData.ListActivation(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton( new Vector2(19, 0), new Vector2(1, 1), CommonStringKeys.E, delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); if (game.gameType is MoMGameType) { MoMActivation(); } else { Activation(); } }
public float DrawMoMActivations(float offset) { if (monsterComponent.activations.Length > 1) { return(DepreciatedMoMActivations(offset)); } if (monsterComponent.activations.Length == 1 && !game.quest.qd.components.ContainsKey(monsterComponent.activations[0])) { return(DepreciatedMoMActivations(offset)); } UIElement ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 5, 1); ui.SetText(new StringKey("val", "X_COLON", ACTIVATIONS)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(5, offset, 13.5f, 1); ui.SetButton(delegate { SetActivation(); }); new UIElementBorder(ui); if (monsterComponent.activations.Length > 0) { ui.SetText(monsterComponent.activations[0]); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset, 1, 1); ui.SetText("<b>⇨</b>", Color.cyan); ui.SetTextAlignment(TextAnchor.LowerCenter); ui.SetButton(delegate { QuestEditorData.SelectComponent(monsterComponent.activations[0]); }); new UIElementBorder(ui, Color.cyan); } return(offset + 2); }
public ToolsButton() { Game game = Game.Get(); if (!game.editMode) { return; } UIElement ui = new UIElement(Game.QUESTUI); ui.SetLocation(UIScaler.GetRight(-6), 0, 6, 1); ui.SetText(new StringKey("val", "COMPONENTS")); ui.SetButton(delegate { QuestEditorData.TypeSelect(); }); new UIElementBorder(ui); ui = new UIElement(Game.QUESTUI); ui.SetLocation(UIScaler.GetRight(-10), 0, 4, 1); ui.SetText(TOOLS); ui.SetButton(EditorTools.Create); new UIElementBorder(ui); ui = new UIElement(Game.QUESTUI); ui.SetLocation(UIScaler.GetRight(-18), 0, 8, 1); ui.SetText(new StringKey("val", "SAVE_TEST")); ui.SetButton(Test); new UIElementBorder(ui); }
override public void Update() { base.Update(); CameraController.SetCamera(mPlaceComponent.location); Game game = Game.Get(); TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(4, 1), CommonStringKeys.MPLACE, delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 0), new Vector2(15, 1), new StringKey(null, name.Substring("MPlace".Length), false), delegate { QuestEditorData.ListMPlace(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), CommonStringKeys.E, delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); DialogBox db = new DialogBox(new Vector2(0, 2), new Vector2(4, 1), CommonStringKeys.POSITION); db.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 2), new Vector2(1, 1), CommonStringKeys.POSITION_SNAP, delegate { GetPosition(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); StringKey rotateKey = new StringKey("val", "RIGHT"); if (mPlaceComponent.rotate) { rotateKey = new StringKey("val", "DOWN"); } tb = new TextButton(new Vector2(0, 4), new Vector2(8, 1), new StringKey("val", "ROTATE_TO", rotateKey), delegate { Rotate(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); StringKey mast = new StringKey("val", "MONSTER_MINION"); if (mPlaceComponent.master) { mast = new StringKey("val", "MONSTER_MASTER"); } tb = new TextButton(new Vector2(0, 6), new Vector2(8, 1), mast, delegate { MasterToggle(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); game.tokenBoard.AddHighlight(mPlaceComponent.location, "MonsterLoc", "editor"); }
protected override void AddTitle() { UIElement ui = new UIElement(Game.EDITOR); ui.SetLocation(1, 0, 20, 1); ui.SetText(game.gameType.QuestName()); ui.SetButton(delegate { QuestEditorData.TypeSelect(); }); ui.SetBGColor(Color.black); new UIElementBorder(ui); }
protected virtual void AddTitle() { UIElement ui = new UIElement(Game.EDITOR); ui.SetLocation(1, 0, 20, 1); ui.SetText(name); ui.SetButton(delegate { QuestEditorData.TypeSelect(component.typeDynamic); }); ui.SetBGColor(Color.black); new UIElementBorder(ui); }
override public void Update() { base.Update(); Game game = Game.Get(); CameraController.SetCamera(doorComponent.location); TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(3, 1), CommonStringKeys.DOOR, delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(3, 0), new Vector2(16, 1), new StringKey(null, name.Substring("Door".Length), false), delegate { QuestEditorData.ListDoor(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), CommonStringKeys.E, delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); DialogBox db = new DialogBox(new Vector2(0, 2), new Vector2(4, 1), CommonStringKeys.POSITION); db.ApplyTag("editor"); // This is a snapped position tb = new TextButton(new Vector2(4, 2), new Vector2(1, 1), CommonStringKeys.POSITION_SNAP, delegate { GetPosition(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(0, 4), new Vector2(8, 1), new StringKey("val", "ROTATION", doorComponent.rotation), delegate { Rotate(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(0, 6), new Vector2(8, 1), COLOR, delegate { Colour(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(0, 8), new Vector2(8, 1), CommonStringKeys.EVENT, delegate { QuestEditorData.SelectAsEvent(name); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); game.tokenBoard.AddHighlight(doorComponent.location, "DoorAnchor", "editor"); game.quest.ChangeAlpha(doorComponent.sectionName, 1f); }
override public void Update() { base.Update(); Game game = Game.Get(); TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(4, 1), CommonStringKeys.QUEST, delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); nameDBE = new DialogBoxEditable( new Vector2(0, 2), new Vector2(20, 1), game.quest.qd.quest.name.Translate(), delegate { UpdateQuestName(); }); nameDBE.ApplyTag("editor"); nameDBE.AddBorder(); descriptionDBE = new DialogBoxEditable( new Vector2(0, 4), new Vector2(20, 6), game.quest.qd.quest.description.Translate(true), delegate { UpdateQuestDesc(); }); descriptionDBE.ApplyTag("editor"); descriptionDBE.AddBorder(); DialogBox db = new DialogBox(new Vector2(0, 11), new Vector2(9, 1), REQUIRED_EXPANSIONS); db.ApplyTag("editor"); tb = new TextButton(new Vector2(9, 11), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { QuestAddPack(); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); int offset = 12; int index; for (index = 0; index < 15; index++) { if (game.quest.qd.quest.packs.Length > index) { int i = index; db = new DialogBox(new Vector2(0, offset), new Vector2(9, 1), new StringKey("val", game.quest.qd.quest.packs[index])); db.AddBorder(); db.ApplyTag("editor"); tb = new TextButton(new Vector2(9, offset++), new Vector2(1, 1), CommonStringKeys.MINUS, delegate { QuestRemovePack(i); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } } }
// Item renamed public void RenameFinished() { // Remove all not allowed characters from name string newName = System.Text.RegularExpressions.Regex.Replace(rename.value, "[^A-Za-z0-9_]", ""); // Must have a name if (newName == string.Empty) { return; } // Add type string baseName = component.typeDynamic + newName; // Find first available unique name string name = baseName; // If nothing has changed, skip renaming if (component.sectionName.Equals(baseName, System.StringComparison.Ordinal)) { return; } Game game = Game.Get(); int i = 0; while (game.quest.qd.components.ContainsKey(name)) { name = baseName + i++; } // Update all references to this component foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components) { kv.Value.ChangeReference(component.sectionName, name); } LocalizationRead.dicts["qst"].RenamePrefix(component.sectionName + ".", name + "."); // Old Localization Entryes need to be renamed? Maybe not // Change all entrys related with old name to key new name //LocalizationRead.dicts["qst"].ChangeReference(component.sectionName, name); // Remove component by old name game.quest.qd.components.Remove(component.sectionName); game.quest.Remove(component.sectionName); component.sectionName = name; // Add component with new name game.quest.qd.components.Add(component.sectionName, component); game.quest.Add(component.sectionName); // Reselect with new name QuestEditorData.SelectComponent(component.sectionName); }
// Start the editor from old version public QuestEditorData(QuestEditorData old) { Game.Get().qed = this; selectionStack = new Stack <EditorComponent>(); if (old == null || old.selection == null) { // Start at the quest component SelectQuest(); } else { selectionStack = old.selectionStack; selectionStack.Push(old.selection); Back(); } }
virtual public float AddHeroSelection(float offset) { UIElement ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 6, 1); ui.SetText(new StringKey("val", "X_COLON", SELECTION)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(6, offset, 12.5f, 1); ui.SetText(eventComponent.heroListName); ui.SetButton(delegate { SetHighlight(); }); new UIElementBorder(ui); if (game.quest.qd.components.ContainsKey(eventComponent.heroListName)) { ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset, 1, 1); ui.SetText("<b>⇨</b>", Color.cyan); ui.SetTextAlignment(TextAnchor.LowerCenter); ui.SetButton(delegate { QuestEditorData.SelectComponent(eventComponent.heroListName); }); new UIElementBorder(ui, Color.cyan); } offset++; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(6, offset, 3, 1); ui.SetText(new StringKey("val", "X_COLON", MIN)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(9, offset, 2, 1); ui.SetText(eventComponent.minHeroes.ToString()); ui.SetButton(delegate { SetHeroCount(false); }); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(11, offset, 3, 1); ui.SetText(new StringKey("val", "X_COLON", MAX)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(14, offset, 2, 1); ui.SetText(eventComponent.maxHeroes.ToString()); ui.SetButton(delegate { SetHeroCount(true); }); new UIElementBorder(ui); return(offset + 2); }
public float AddPlacementComponenets(float offset) { for (int heroes = 2; heroes < 5; heroes++) { int h = heroes; UIElement ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 18, 1); ui.SetText(new StringKey("val", "NUMBER_HEROS", heroes)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { MonsterPlaceAdd(h); }); new UIElementBorder(ui, Color.green); for (int i = 0; i < spawnComponent.placement[heroes].Length; i++) { int mSlot = i; string place = spawnComponent.placement[heroes][i]; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { MonsterPlaceRemove(h, mSlot); }); new UIElementBorder(ui, Color.red); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(1.5f, offset, 17, 1); ui.SetText(place); ui.SetButton(delegate { MonsterPlaceAdd(h, mSlot); }); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetTextAlignment(TextAnchor.LowerCenter); ui.SetText("<b>⇨</b>", Color.cyan); ui.SetButton(delegate { QuestEditorData.SelectComponent(place); }); new UIElementBorder(ui, Color.cyan); } offset++; } return(offset); }
public float DrawD2EActivations(float offset) { UIElement ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 18, 1); ui.SetText(new StringKey("val", "X_COLON", ACTIVATIONS)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { AddActivation(); }); new UIElementBorder(ui, Color.green); int index; for (index = 0; index < monsterComponent.activations.Length; index++) { int i = index; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 17, 1); ui.SetText(monsterComponent.activations[index]); ui.SetButton(delegate { AddActivation(i); }); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(17.5f, offset, 1, 1); ui.SetText("<b>⇨</b>", Color.cyan); ui.SetTextAlignment(TextAnchor.LowerCenter); ui.SetButton(delegate { QuestEditorData.SelectComponent("Activation" + monsterComponent.activations[i]); }); new UIElementBorder(ui, Color.cyan); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { RemoveActivation(i); }); new UIElementBorder(ui, Color.red); offset++; } return(offset + 1); }
// Update redraws the selection UI virtual public void Update() { RefreshReference(); game = Game.Get(); float scrollPos = -14.5f * UIScaler.GetPixelsPerUnit(); if (scrollArea != null && !scrollArea.ObjectDestroyed()) { scrollPos = scrollArea.GetScrollPosition(); } Clean(); AddScrollArea(); float offset = 0; offset = DrawComponentSelection(offset); offset = AddSubComponents(offset); offset = AddSource(offset); offset = AddComment(offset); scrollArea.SetScrollSize(offset); scrollArea.SetScrollPosition(scrollPos); UIElement ui = new UIElement(Game.EDITOR); ui.SetLocation(0, 0, 1, 1); ui.SetText("<b>⇦</b>", Color.cyan); ui.SetTextAlignment(TextAnchor.LowerCenter); ui.SetButton(delegate { QuestEditorData.Back(); }); ui.SetBGColor(Color.black); new UIElementBorder(ui, Color.cyan); AddTitle(); }
// Item renamed public void RenameFinished() { // Trim non alpha numeric string newName = System.Text.RegularExpressions.Regex.Replace(rename.value, "[^A-Za-z0-9_]", ""); // Must have a name if (newName.Equals("")) { return; } // Add type string baseName = component.typeDynamic + newName; // Find first available unique name string name = baseName; Game game = Game.Get(); int i = 0; while (game.quest.qd.components.ContainsKey(name)) { name = baseName + i++; } // Update all references to this component foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components) { kv.Value.ChangeReference(component.sectionName, name); } // Remove component by old name game.quest.qd.components.Remove(component.sectionName); game.quest.Remove(component.sectionName); component.sectionName = name; // Add component with new name game.quest.qd.components.Add(component.sectionName, component); game.quest.Add(component.sectionName); // Reselect with new name QuestEditorData.SelectComponent(component.sectionName); }
override public void Update() { base.Update(); CameraController.SetCamera(monsterComponent.location); Game game = Game.Get(); TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(3, 1), CommonStringKeys.SPAWN, delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(3, 0), new Vector2(16, 1), new StringKey(name.Substring("Spawn".Length), false), delegate { QuestEditorData.ListSpawn(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), CommonStringKeys.E, delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); int offset = 1; DialogBox db = null; for (int heroes = 2; heroes < 5; heroes++) { int h = heroes; db = new DialogBox(new Vector2(0, offset), new Vector2(5, 1), new StringKey("val", "NUMBER_HEROS", new StringKey(heroes.ToString(), false))); db.ApplyTag("editor"); tb = new TextButton(new Vector2(19, offset++), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { MonsterPlaceAdd(h); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); for (int i = 0; i < 8; i++) { if (monsterComponent.placement[heroes].Length > i) { int mSlot = i; string place = monsterComponent.placement[heroes][i]; tb = new TextButton(new Vector2(0, offset), new Vector2(1, 1), CommonStringKeys.MINUS, delegate { MonsterPlaceRemove(h, mSlot); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(1, offset), new Vector2(19, 1), new StringKey(place, false), delegate { QuestEditorData.SelectComponent(place); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } offset++; } } game.tokenBoard.AddHighlight(monsterComponent.location, "MonsterLoc", "editor"); }
override public float AddSubComponents(float offset) { offset = AddPosition(offset); offset = AddSubEventComponents(offset); offset = AddEventDialog(offset); offset = AddEventTrigger(offset); UIElement ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 4, 1); ui.SetText(new StringKey("val", "X_COLON", AUDIO)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(4, offset++, 10, 1); ui.SetText(eventComponent.audio); ui.SetButton(delegate { SetAudio(); }); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(1.5f, offset, 10, 1); ui.SetText(new StringKey("val", "X_COLON", MUSIC)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(11.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { AddMusic(0); }); new UIElementBorder(ui, Color.green); int index; for (index = 0; index < eventComponent.music.Count; index++) { int i = index; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { RemoveMusic(i); }); new UIElementBorder(ui, Color.red); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(1.5f, offset, 10, 1); ui.SetText(eventComponent.music[index]); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(11.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { AddMusic(i + 1); }); new UIElementBorder(ui, Color.green); } offset++; if (game.gameType is D2EGameType || game.gameType is IAGameType) { offset = AddHeroSelection(offset); } ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 18, 1); ui.SetText(ADD_COMPONENTS); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { AddVisibility(true); }); new UIElementBorder(ui, Color.green); for (index = 0; index < eventComponent.addComponents.Length; index++) { int i = index; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetText(eventComponent.addComponents[index]); ui.SetButton(delegate { AddVisibility(true, i); }); if (game.quest.qd.components.ContainsKey(eventComponent.addComponents[i])) { ui.SetLocation(0.5f, offset, 17, 1); UIElement link = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); link.SetLocation(17.5f, offset, 1, 1); link.SetText("<b>⇨</b>", Color.cyan); link.SetTextAlignment(TextAnchor.LowerCenter); link.SetButton(delegate { QuestEditorData.SelectComponent(eventComponent.addComponents[i]); }); new UIElementBorder(link, Color.cyan); } else { ui.SetLocation(0.5f, offset, 18, 1); } new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { RemoveVisibility(i, true); }); new UIElementBorder(ui, Color.red); } offset++; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 18, 1); ui.SetText(REMOVE_COMPONENTS); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { AddVisibility(false); }); new UIElementBorder(ui, Color.green); for (index = 0; index < eventComponent.removeComponents.Length; index++) { int i = index; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetText(eventComponent.removeComponents[index]); ui.SetButton(delegate { AddVisibility(false, i); }); if (game.quest.qd.components.ContainsKey(eventComponent.removeComponents[i])) { ui.SetLocation(0.5f, offset, 17, 1); UIElement link = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); link.SetLocation(17.5f, offset, 1, 1); link.SetText("<b>⇨</b>", Color.cyan); link.SetTextAlignment(TextAnchor.LowerCenter); link.SetButton(delegate { QuestEditorData.SelectComponent(eventComponent.removeComponents[i]); }); new UIElementBorder(link, Color.cyan); } else { ui.SetLocation(0.5f, offset, 18, 1); } new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { RemoveVisibility(i, false); }); new UIElementBorder(ui, Color.red); } offset++; offset = AddNextEventComponents(offset); offset = AddEventVarConditionComponents(offset); offset = AddEventVarOperationComponents(offset); Highlight(); return(offset); }
public void ConfirmDelete() { QuestEditorData.DeleteCurrentComponent(); }
// Update redraws the selection UI virtual public void Update() { Clean(); // Back button is common to all components TextButton tb = new TextButton(new Vector2(0, 29), new Vector2(3, 1), "Back", delegate { QuestEditorData.Back(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); }
// Select a component for editing public static void SelectComponent(string name) { Game game = Game.Get(); QuestEditorData qed = game.qed; // Quest is a special component if (name.Equals("Quest")) { SelectQuest(); return; } // These are special strings for creating new objects if (name.Equals("{NEW:Tile}")) { qed.NewTile(); return; } if (name.Equals("{NEW:Door}")) { qed.NewDoor(); return; } if (name.Equals("{NEW:Token}")) { qed.NewToken(); return; } if (name.Equals("{NEW:UI}")) { qed.NewUI(); return; } if (name.Equals("{NEW:Spawn}")) { qed.NewSpawn(); return; } if (name.Equals("{NEW:MPlace}")) { qed.NewMPlace(); return; } if (name.Equals("{NEW:QItem}")) { qed.NewItem(); return; } if (name.Equals("{NEW:CustomMonster}")) { qed.NewCustomMonster(); return; } if (name.Equals("{NEW:Activation}")) { qed.NewActivation(); return; } if (name.Equals("{NEW:Event}")) { qed.NewEvent(); return; } if (name.Equals("{NEW:Puzzle}")) { qed.NewPuzzle(); return; } // This may happen to due rename/delete if (!game.quest.qd.components.ContainsKey(name)) { SelectQuest(); } // Determine the component type and select if (game.quest.qd.components[name] is QuestData.Tile) { SelectAsTile(name); return; } if (game.quest.qd.components[name] is QuestData.Door) { SelectAsDoor(name); return; } if (game.quest.qd.components[name] is QuestData.Token) { SelectAsToken(name); return; } if (game.quest.qd.components[name] is QuestData.UI) { SelectAsUI(name); return; } if (game.quest.qd.components[name] is QuestData.Spawn) { SelectAsSpawn(name); return; } if (game.quest.qd.components[name] is QuestData.MPlace) { SelectAsMPlace(name); return; } if (game.quest.qd.components[name] is QuestData.Puzzle) { SelectAsPuzzle(name); return; } if (game.quest.qd.components[name] is QuestData.QItem) { SelectAsItem(name); return; } if (game.quest.qd.components[name] is QuestData.CustomMonster) { SelectAsCustomMonster(name); return; } if (game.quest.qd.components[name] is QuestData.Activation) { SelectAsActivation(name); return; } if (game.quest.qd.components[name] is QuestData.Event) { SelectAsEvent(name); return; } }
override public void Update() { base.Update(); Game game = Game.Get(); TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(6, 1), "UniqueMonster", delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(6, 0), new Vector2(13, 1), name.Substring("UniqueMonster".Length), delegate { QuestEditorData.ListUniqueMonster(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), "E", delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); DialogBox db = new DialogBox(new Vector2(0, 2), new Vector2(3, 1), "Base:"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(3, 2), new Vector2(18, 1), monsterComponent.baseMonster, delegate { SetBase(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); db = new DialogBox(new Vector2(0, 4), new Vector2(3, 1), "Name:"); db.ApplyTag("editor"); if (monsterComponent.baseMonster.Length == 0 || monsterComponent.monsterName.Length > 0) { nameDBE = new DialogBoxEditable(new Vector2(3, 4), new Vector2(14, 1), monsterComponent.monsterName, delegate { UpdateName(); }); nameDBE.ApplyTag("editor"); nameDBE.AddBorder(); if (monsterComponent.baseMonster.Length > 0) { tb = new TextButton(new Vector2(17, 4), new Vector2(3, 1), "Reset", delegate { ClearName(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } } else { tb = new TextButton(new Vector2(17, 4), new Vector2(3, 1), "Set", delegate { SetName(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } //string imagePath //string imagePlace db = new DialogBox(new Vector2(0, 6), new Vector2(17, 1), "Info:"); db.ApplyTag("editor"); if (monsterComponent.baseMonster.Length == 0 || monsterComponent.info.key.Length > 0) { infoDBE = new DialogBoxEditable(new Vector2(0, 7), new Vector2(20, 8), monsterComponent.info.Translate(), delegate { UpdateInfo(); }); infoDBE.ApplyTag("editor"); infoDBE.AddBorder(); if (monsterComponent.baseMonster.Length > 0) { tb = new TextButton(new Vector2(17, 6), new Vector2(3, 1), "Reset", delegate { ClearInfo(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } } else { tb = new TextButton(new Vector2(17, 6), new Vector2(3, 1), "Set", delegate { SetInfo(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } //string[] activations //string[] traits db = new DialogBox(new Vector2(0, 15), new Vector2(3, 1), "Health:"); db.ApplyTag("editor"); if (monsterComponent.baseMonster.Length == 0 || monsterComponent.healthDefined) { healthDBE = new DialogBoxEditable(new Vector2(3, 15), new Vector2(14, 1), monsterComponent.health.ToString(), delegate { UpdateHealth(); }); healthDBE.ApplyTag("editor"); healthDBE.AddBorder(); if (monsterComponent.baseMonster.Length > 0) { tb = new TextButton(new Vector2(17, 15), new Vector2(3, 1), "Reset", delegate { ClearHealth(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } } else { tb = new TextButton(new Vector2(17, 15), new Vector2(3, 1), "Set", delegate { SetHealth(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } }
override public float AddSubEventComponents(float offset) { spawnComponent = component as QuestData.Spawn; UIElement ui = null; if (game.gameType is D2EGameType) { ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 6, 1); ui.SetText(new StringKey("val", "X_COLON", MONSTER_UNIQUE)); if (!spawnComponent.unique) { ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(6, offset, 3, 1); ui.SetText(CommonStringKeys.FALSE); ui.SetButton(delegate { UniqueToggle(); }); new UIElementBorder(ui); offset += 2; } else { ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(6, offset, 3, 1); ui.SetText(CommonStringKeys.TRUE); ui.SetButton(delegate { UniqueToggle(); }); new UIElementBorder(ui); offset += 2; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 5, 1); ui.SetText(new StringKey("val", "X_COLON", UNIQUE_TITLE)); uniqueTitleUIE = new UIElementEditable(Game.EDITOR, scrollArea.GetScrollTransform()); uniqueTitleUIE.SetLocation(5, offset, 14.5f, 1); uniqueTitleUIE.SetText(spawnComponent.uniqueTitle.Translate()); uniqueTitleUIE.SetSingleLine(); uniqueTitleUIE.SetButton(delegate { UpdateUniqueTitle(); }); new UIElementBorder(uniqueTitleUIE); offset += 2; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset++, 20, 1); ui.SetText(new StringKey("val", "X_COLON", UNIQUE_INFO)); uniqueTextUIE = new UIElementEditablePaneled(Game.EDITOR, scrollArea.GetScrollTransform()); uniqueTextUIE.SetLocation(0.5f, offset, 19, 18); uniqueTextUIE.SetText(spawnComponent.uniqueText.Translate()); offset += uniqueTextUIE.HeightToTextPadding(1); uniqueTextUIE.SetButton(delegate { UpdateUniqueText(); }); new UIElementBorder(uniqueTextUIE); offset += 1; } } ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 5, 1); ui.SetText(new StringKey("val", "X_COLON", HEALTH)); healthUIE = new UIElementEditable(Game.EDITOR, scrollArea.GetScrollTransform()); healthUIE.SetLocation(5, offset, 3, 1); healthUIE.SetText(spawnComponent.uniqueHealthBase.ToString()); healthUIE.SetSingleLine(); healthUIE.SetButton(delegate { UpdateHealth(); }); new UIElementBorder(healthUIE); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(8, offset, 7, 1); ui.SetText(new StringKey("val", "X_COLON", HEALTH_HERO)); healthHeroUIE = new UIElementEditable(Game.EDITOR, scrollArea.GetScrollTransform()); healthHeroUIE.SetLocation(15, offset, 3, 1); healthHeroUIE.SetText(spawnComponent.uniqueHealthHero.ToString()); healthHeroUIE.SetSingleLine(); healthHeroUIE.SetButton(delegate { UpdateHealthHero(); }); new UIElementBorder(healthHeroUIE); offset += 2; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(1.5f, offset, 17, 1); ui.SetText(new StringKey("val", "X_COLON", TYPES)); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { MonsterTypeAdd(0); }); new UIElementBorder(ui, Color.green); int i = 0; for (i = 0; i < spawnComponent.mTypes.Length; i++) { int mSlot = i; string mName = spawnComponent.mTypes[i]; if (mName.IndexOf("Monster") == 0) { mName = mName.Substring("Monster".Length); } if ((spawnComponent.mTypes.Length > 1) || (spawnComponent.mTraitsRequired.Length > 0) || (spawnComponent.mTraitsPool.Length > 0)) { ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { MonsterTypeRemove(mSlot); }); new UIElementBorder(ui, Color.red); } ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); if (game.quest.qd.components.ContainsKey(spawnComponent.mTypes[i])) { ui.SetLocation(1.5f, offset, 16, 1); UIElement link = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); link.SetLocation(17.5f, offset, 1, 1); link.SetText("<b>⇨</b>", Color.cyan); link.SetTextAlignment(TextAnchor.LowerCenter); link.SetButton(delegate { QuestEditorData.SelectComponent(spawnComponent.mTypes[mSlot]); }); new UIElementBorder(link, Color.cyan); } else { ui.SetLocation(1.5f, offset, 17, 1); } ui.SetText(mName); ui.SetButton(delegate { MonsterTypeReplace(mSlot); }); new UIElementBorder(ui); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { MonsterTypeAdd(mSlot + 1); }); new UIElementBorder(ui, Color.green); } offset++; float traitOffset = offset; ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 8, 1); ui.SetText(REQ_TRAITS); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(8.5f, offset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { MonsterTraitsAdd(); }); new UIElementBorder(ui, Color.green); for (i = 0; i < spawnComponent.mTraitsRequired.Length; i++) { int mSlot = i; string mName = spawnComponent.mTraitsRequired[i]; if ((spawnComponent.mTypes.Length > 0) || (spawnComponent.mTraitsRequired.Length > 1) || (spawnComponent.mTraitsPool.Length > 0)) { ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(0.5f, offset, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { MonsterTraitsRemove(mSlot); }); new UIElementBorder(ui, Color.red); } ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(1.5f, offset++, 8, 1); ui.SetText(new StringKey("val", mName)); ui.SetButton(delegate { MonsterTraitReplace(mSlot); }); new UIElementBorder(ui); } ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(10.5f, traitOffset, 8, 1); ui.SetText(POOL_TRAITS); ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(18.5f, traitOffset++, 1, 1); ui.SetText(CommonStringKeys.PLUS, Color.green); ui.SetButton(delegate { MonsterTraitsAdd(true); }); new UIElementBorder(ui, Color.green); for (int j = 0; j < spawnComponent.mTraitsPool.Length; j++) { int mSlot = j; string mName = spawnComponent.mTraitsPool[j]; if ((spawnComponent.mTypes.Length > 0) || (spawnComponent.mTraitsRequired.Length > 0) || (spawnComponent.mTraitsPool.Length > 1)) { ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(10.5f, traitOffset, 1, 1); ui.SetText(CommonStringKeys.MINUS, Color.red); ui.SetButton(delegate { MonsterTraitsRemove(mSlot, true); }); new UIElementBorder(ui, Color.red); } ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform()); ui.SetLocation(11.5f, traitOffset++, 8, 1); ui.SetText(new StringKey("val", mName)); ui.SetButton(delegate { MonsterTraitReplace(mSlot, true); }); new UIElementBorder(ui); } if (traitOffset > offset) { offset = traitOffset; } offset++; if (game.gameType is D2EGameType || game.gameType is IAGameType) { offset = AddPlacementComponenets(offset); } return(offset); }
override public void Update() { base.Update(); if (eventComponent.locationSpecified) { CameraController.SetCamera(eventComponent.location); } Game game = Game.Get(); string type = QuestData.Event.type; if (eventComponent is QuestData.Door) { type = QuestData.Door.type; } if (eventComponent is QuestData.Monster) { type = QuestData.Monster.type; } if (eventComponent is QuestData.Token) { type = QuestData.Token.type; } TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(4, 1), type, delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 0), new Vector2(15, 1), name.Substring(type.Length), delegate { QuestEditorData.ListEvent(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), "E", delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); DialogBox db = new DialogBox(new Vector2(0, 2), new Vector2(4, 1), "Position"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 2), new Vector2(1, 1), "><", delegate { GetPosition(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(5, 2), new Vector2(1, 1), "~", delegate { GetPosition(false); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); if (!eventComponent.GetType().IsSubclassOf(typeof(QuestData.Event))) { if (eventComponent.minCam) { tb = new TextButton(new Vector2(7, 2), new Vector2(4, 1), "Min Cam", delegate { PositionTypeCycle(); }); } else if (eventComponent.maxCam) { tb = new TextButton(new Vector2(7, 2), new Vector2(4, 1), "Max Cam", delegate { PositionTypeCycle(); }); } else if (!eventComponent.locationSpecified) { tb = new TextButton(new Vector2(7, 2), new Vector2(4, 1), "Unused", delegate { PositionTypeCycle(); }); } else if (eventComponent.highlight) { tb = new TextButton(new Vector2(7, 2), new Vector2(4, 1), "Highlight", delegate { PositionTypeCycle(); }); } else { tb = new TextButton(new Vector2(7, 2), new Vector2(4, 1), "Camera", delegate { PositionTypeCycle(); }); } tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } tb = new TextButton(new Vector2(12, 2), new Vector2(3, 1), "Vars", delegate { QuestEditorData.SelectAsEventVars(name); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(16, 2), new Vector2(4, 1), "Next Events", delegate { QuestEditorData.SelectAsEventNextEvent(name); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); db = new DialogBox(new Vector2(0, 3), new Vector2(20, 1), "Dialog:"); db.ApplyTag("editor"); eventTextDBE = new DialogBoxEditable(new Vector2(0, 4), new Vector2(20, 8), eventComponent.originalText, delegate { UpdateText(); }); eventTextDBE.ApplyTag("editor"); eventTextDBE.AddBorder(); db = new DialogBox(new Vector2(0, 12), new Vector2(4, 1), "Trigger:"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 12), new Vector2(10, 1), eventComponent.trigger, delegate { SetTrigger(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); db = new DialogBox(new Vector2(0, 14), new Vector2(4, 1), "Selection:"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 14), new Vector2(8, 1), eventComponent.heroListName, delegate { SetHighlight(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); db = new DialogBox(new Vector2(12, 14), new Vector2(2, 1), "Min"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(14, 14), new Vector2(2, 1), eventComponent.minHeroes.ToString(), delegate { SetHeroCount(false); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); db = new DialogBox(new Vector2(16, 14), new Vector2(2, 1), "Max"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(18, 14), new Vector2(2, 1), eventComponent.maxHeroes.ToString(), delegate { SetHeroCount(true); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); db = new DialogBox(new Vector2(0, 16), new Vector2(9, 1), "Add Components:"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(9, 16), new Vector2(1, 1), "+", delegate { AddVisibility(true); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); int offset = 17; int index; for (index = 0; index < 12; index++) { if (eventComponent.addComponents.Length > index) { int i = index; db = new DialogBox(new Vector2(0, offset), new Vector2(9, 1), eventComponent.addComponents[index]); db.AddBorder(); db.ApplyTag("editor"); tb = new TextButton(new Vector2(9, offset++), new Vector2(1, 1), "-", delegate { RemoveVisibility(i, true); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } } db = new DialogBox(new Vector2(10, 16), new Vector2(9, 1), "Remove Components:"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 16), new Vector2(1, 1), "+", delegate { AddVisibility(false); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); offset = 17; for (index = 0; index < 12; index++) { if (eventComponent.removeComponents.Length > index) { int i = index; db = new DialogBox(new Vector2(10, offset), new Vector2(9, 1), eventComponent.removeComponents[index]); db.AddBorder(); db.ApplyTag("editor"); tb = new TextButton(new Vector2(19, offset++), new Vector2(1, 1), "-", delegate { RemoveVisibility(i, false); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } } if (eventComponent.locationSpecified || eventComponent.maxCam || eventComponent.minCam) { game.tokenBoard.AddHighlight(eventComponent.location, "EventLoc", "editor"); } }
override public void Update() { base.Update(); Game game = Game.Get(); CameraController.SetCamera(tileComponent.location); TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(3, 1), "Tile", delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(3, 0), new Vector2(16, 1), name.Substring("Tile".Length), delegate { QuestEditorData.ListTile(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), "E", delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(0, 2), new Vector2(20, 1), tileComponent.tileSideName, delegate { ChangeTileSide(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); DialogBox db = new DialogBox(new Vector2(0, 4), new Vector2(4, 1), "Position"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 4), new Vector2(1, 1), "><", delegate { GetPosition(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(0, 6), new Vector2(8, 1), "Rotation (" + tileComponent.rotation + ")", delegate { TileRotate(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); game.tokenBoard.AddHighlight(tileComponent.location, "TileAnchor", "editor"); game.quest.ChangeAlpha(tileComponent.name, 1f); }
override public void Update() { base.Update(); if (eventComponent.locationSpecified) { CameraController.SetCamera(eventComponent.location); } Game game = Game.Get(); string type = QuestData.Event.type; if (eventComponent is QuestData.Door) { type = QuestData.Door.type; } if (eventComponent is QuestData.Monster) { type = QuestData.Monster.type; } if (eventComponent is QuestData.Token) { type = QuestData.Token.type; } TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(4, 1), type, delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 0), new Vector2(15, 1), name.Substring(type.Length), delegate { QuestEditorData.ListEvent(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), "E", delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); float offset = 2; DialogBox db = new DialogBox(new Vector2(0, offset), new Vector2(19, 1), "Tests:"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(19, offset), new Vector2(1, 1), "+", delegate { AddTestOp(); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); offset++; foreach (QuestData.Event.VarOperation op in eventComponent.conditions) { QuestData.Event.VarOperation tmp = op; db = new DialogBox(new Vector2(0, offset), new Vector2(9, 1), op.var); db.AddBorder(); db.ApplyTag("editor"); tb = new TextButton(new Vector2(9, offset), new Vector2(2, 1), op.operation, delegate { SetTestOpp(tmp); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(11, offset), new Vector2(8, 1), op.value, delegate { SetValue(tmp); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, offset), new Vector2(1, 1), "-", delegate { RemoveOp(tmp); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); offset++; } offset++; db = new DialogBox(new Vector2(0, offset), new Vector2(19, 1), "Assign:"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(19, offset), new Vector2(1, 1), "+", delegate { AddAssignOp(); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); offset++; foreach (QuestData.Event.VarOperation op in eventComponent.operations) { QuestData.Event.VarOperation tmp = op; db = new DialogBox(new Vector2(0, offset), new Vector2(9, 1), op.var); db.AddBorder(); db.ApplyTag("editor"); tb = new TextButton(new Vector2(9, offset), new Vector2(2, 1), op.operation, delegate { SetAssignOpp(tmp); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(11, offset), new Vector2(8, 1), op.value, delegate { SetValue(tmp); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, offset), new Vector2(1, 1), "-", delegate { RemoveOp(tmp); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); offset++; } if (eventComponent.locationSpecified) { game.tokenBoard.AddHighlight(eventComponent.location, "EventLoc", "editor"); } }
override public void Update() { base.Update(); CameraController.SetCamera(monsterComponent.location); Game game = Game.Get(); TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(4, 1), "Monster", delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 0), new Vector2(15, 1), name.Substring("Monster".Length), delegate { QuestEditorData.ListMonster(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), "E", delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); int offset = 1; DialogBox db = null; for (int heroes = 2; heroes < 5; heroes++) { int h = heroes; db = new DialogBox(new Vector2(0, offset), new Vector2(5, 1), heroes + " Heros:"); db.ApplyTag("editor"); tb = new TextButton(new Vector2(19, offset++), new Vector2(1, 1), "+", delegate { MonsterPlaceAdd(h); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); for (int i = 0; i < 8; i++) { if (monsterComponent.placement[heroes].Length > i) { int mSlot = i; string place = monsterComponent.placement[heroes][i]; tb = new TextButton(new Vector2(0, offset), new Vector2(1, 1), "-", delegate { MonsterPlaceRemove(h, mSlot); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); tb = new TextButton(new Vector2(1, offset), new Vector2(19, 1), place, delegate { QuestEditorData.SelectComponent(place); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } offset++; } } game.tokenBoard.AddHighlight(monsterComponent.location, "MonsterLoc", "editor"); }
override public void Update() { base.Update(); //Game game = Game.Get(); TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(5, 1), CommonStringKeys.STARTING_ITEM, delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(5, 0), new Vector2(14, 1), new StringKey(null, name.Substring("StartingItem".Length), false), delegate { QuestEditorData.ListStartingItem(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), CommonStringKeys.E, delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); DialogBox db = new DialogBox(new Vector2(0, 2), new Vector2(19, 1), new StringKey("val", "X_COLON", CommonStringKeys.ITEM)); db.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 2), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { AddItem(); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); float offset = 3; for (int i = 0; i < itemComponent.itemName.Length; i++) { int tmp = i; db = new DialogBox(new Vector2(0, offset), new Vector2(19, 1), new StringKey(null, itemComponent.itemName[i], false)); db.ApplyTag("editor"); if (itemComponent.traits.Length > 0 || itemComponent.itemName.Length > 1) { tb = new TextButton(new Vector2(19, offset), new Vector2(1, 1), CommonStringKeys.MINUS, delegate { RemoveItem(tmp); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } offset++; } offset++; db = new DialogBox(new Vector2(0, offset), new Vector2(16, 1), new StringKey("val", "X_COLON", CommonStringKeys.TRAITS)); db.ApplyTag("editor"); tb = new TextButton(new Vector2(17, offset++), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { AddTrait(); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); for (int i = 0; i < itemComponent.traits.Length; i++) { int tmp = i; db = new DialogBox(new Vector2(0, offset), new Vector2(16, 1), new StringKey("val", itemComponent.traits[i])); db.ApplyTag("editor"); if (itemComponent.traits.Length > 1 || itemComponent.itemName.Length > 0) { tb = new TextButton(new Vector2(17, offset), new Vector2(1, 1), CommonStringKeys.MINUS, delegate { RemoveTrait(tmp); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } offset++; } }
override public void Update() { base.Update(); if (eventComponent.locationSpecified) { CameraController.SetCamera(eventComponent.location); } Game game = Game.Get(); string type = QuestData.Event.type; if (eventComponent is QuestData.Door) { type = QuestData.Door.type; } if (eventComponent is QuestData.Spawn) { type = QuestData.Spawn.type; } if (eventComponent is QuestData.Token) { type = QuestData.Token.type; } TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(4, 1), new StringKey(null, type, false), delegate { QuestEditorData.TypeSelect(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(4, 0), new Vector2(15, 1), new StringKey(null, name.Substring(type.Length), false), delegate { QuestEditorData.ListEvent(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft; tb.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), CommonStringKeys.E, delegate { Rename(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); string randomButton = "Ordered"; if (eventComponent.randomEvents) { randomButton = "Random"; } tb = new TextButton(new Vector2(0, 1), new Vector2(3, 1), new StringKey("val", randomButton), delegate { ToggleRandom(); }); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); DialogBox db = new DialogBox(new Vector2(3, 1), new Vector2(3, 1), new StringKey("val", "X_COLON", QUOTA)); db.ApplyTag("editor"); // Quota dont need translation quotaDBE = new DialogBoxEditable( new Vector2(6, 1), new Vector2(2, 1), eventComponent.quota.ToString(), delegate { SetQuota(); }); quotaDBE.ApplyTag("editor"); quotaDBE.AddBorder(); db = new DialogBox(new Vector2(8, 1), new Vector2(11, 1), new StringKey("val", "X_COLON", BUTTONS)); db.ApplyTag("editor"); tb = new TextButton(new Vector2(19, 1), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { AddButton(); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); int offset = 2; int button = 1; int index = 0; int lastButtonOffset = 0; buttonDBE = new List <DialogBoxEditable>(); foreach (List <string> l in eventComponent.nextEvent) { lastButtonOffset = offset; int buttonTmp = button++; StringKey buttonLabel = eventComponent.buttons[buttonTmp - 1]; string colorRGB = ColorUtil.FromName(eventComponent.buttonColors[buttonTmp - 1]); Color c = Color.white; c[0] = (float)System.Convert.ToInt32(colorRGB.Substring(1, 2), 16) / 255f; c[1] = (float)System.Convert.ToInt32(colorRGB.Substring(3, 2), 16) / 255f; c[2] = (float)System.Convert.ToInt32(colorRGB.Substring(5, 2), 16) / 255f; tb = new TextButton(new Vector2(0, offset), new Vector2(3, 1), new StringKey("val", "COLOR"), delegate { SetButtonColor(buttonTmp); }, c); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); DialogBoxEditable buttonEdit = new DialogBoxEditable( new Vector2(3, offset++), new Vector2(16, 1), buttonLabel.Translate(), delegate { UpdateButtonLabel(buttonTmp); }); buttonEdit.ApplyTag("editor"); buttonEdit.AddBorder(); buttonDBE.Add(buttonEdit); index = 0; foreach (string s in l) { int i = index++; tb = new TextButton(new Vector2(0, offset), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { AddEvent(i, buttonTmp); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); db = new DialogBox(new Vector2(1, offset), new Vector2(18, 1), new StringKey(null, s, false)); db.AddBorder(); db.ApplyTag("editor"); tb = new TextButton(new Vector2(19, offset++), new Vector2(1, 1), CommonStringKeys.MINUS, delegate { RemoveEvent(i, buttonTmp); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } int tmp = index; tb = new TextButton(new Vector2(0, offset), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { AddEvent(tmp, buttonTmp); }, Color.green); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); offset++; } if (lastButtonOffset != 0) { tb = new TextButton(new Vector2(19, lastButtonOffset), new Vector2(1, 1), CommonStringKeys.MINUS, delegate { RemoveButton(); }, Color.red); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont(); tb.ApplyTag("editor"); } if (eventComponent.locationSpecified) { game.tokenBoard.AddHighlight(eventComponent.location, "EventLoc", "editor"); } }