protected void Draw(HorrorData horror, Quest.Monster m) { Game game = Game.Get(); // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG)) { Object.Destroy(go); } string text = horror.text.Translate().Replace("{0}", m.monsterData.name.Translate()); UIElement ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-14), 0.5f, 28, 8); ui.SetText(text); new UIElementBorder(ui); game.quest.log.Add(new Quest.LogEntry(text.Replace("\n", "\\n"))); ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-6f), 9, 12, 2); ui.SetText(CommonStringKeys.FINISHED); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(Destroyer.Dialog); new UIElementBorder(ui); MonsterDialogMoM.DrawMonster(m, true); }
public void CreateMoveWindow() { if (monster.currentActivation.ad.move.fullKey.Length == 0) { activated(); return; } Destroyer.Dialog(); DialogBox db = new DialogBox(new Vector2(15, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 30, 2), monster.monsterData.name); db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); db.AddBorder(); float offset = 2.5f; UIElement ui = new UIElement(); ui.SetLocation(10, offset, UIScaler.GetWidthUnits() - 20, 4); ui.SetText(monster.currentActivation.move.Replace("\\n", "\n")); new UIElementBorder(ui); // Add this to the log Game.Get().quest.log.Add(new Quest.LogEntry(monster.currentActivation.move.Replace("\n", "\\n"))); offset += 4.5f; new TextButton(new Vector2(UIScaler.GetHCenter(-6f), offset), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { activated(); }); MonsterDialogMoM.DrawMonster(monster); }
public void Attack() { Destroyer.Dialog(); UIElement ui = new UIElement(); ui.SetLocation(10, 0.5f, UIScaler.GetWidthUnits() - 20, 8); ui.SetText(attackText); new UIElementBorder(ui); ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-6), 9, 12, 2); if (monster.damage == monster.GetHealth()) { ui.SetText(CommonStringKeys.FINISHED, Color.gray); new UIElementBorder(ui, Color.gray); } else { ui.SetText(CommonStringKeys.FINISHED); ui.SetButton(Destroyer.Dialog); new UIElementBorder(ui); } ui.SetFontSize(UIScaler.GetMediumFont()); MonsterDialogMoM.DrawMonster(monster); MonsterDialogMoM.DrawMonsterHealth(monster, delegate { Attack(); }); }
public void AttackOptions() { // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG)) { Object.Destroy(go); } DialogBox db = new DialogBox(new Vector2(UIScaler.GetHCenter(-10f), 0.5f), new Vector2(20, 2), ATTACK_PROMPT); db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); db.AddBorder(); float offset = 3f; foreach (string type in attackType) { string tmpType = type; new TextButton(new Vector2(UIScaler.GetHCenter(-6f), offset), new Vector2(12, 2), new StringKey("val", tmpType), delegate { Attack(tmpType); }); offset += 2.5f; } if (monster.damage == monster.GetHealth()) { new TextButton(new Vector2(UIScaler.GetHCenter(-4f), offset), new Vector2(8, 2), CommonStringKeys.CANCEL, delegate {; }, Color.gray); } else { new TextButton(new Vector2(UIScaler.GetHCenter(-4f), offset), new Vector2(8, 2), CommonStringKeys.CANCEL, delegate { Destroyer.Dialog(); }); } MonsterDialogMoM.DrawMonster(monster); MonsterDialogMoM.DrawMonsterHealth(monster, delegate { AttackOptions(); }); }
public void CreateMoveWindow() { if (monster.currentActivation.ad.move.key.Length == 0) { activated(); return; } Destroyer.Dialog(); DialogBox db = new DialogBox(new Vector2(15, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 30, 2), monster.monsterData.name); db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); db.AddBorder(); float offset = 2.5f; db = new DialogBox(new Vector2(10, offset), new Vector2(UIScaler.GetWidthUnits() - 20, 4), new StringKey(monster.currentActivation.move.Replace("\\n", "\n"), false)); db.AddBorder(); offset += 4.5f; new TextButton(new Vector2(UIScaler.GetHCenter(-6f), offset), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { activated(); }); MonsterDialogMoM.DrawMonster(monster); }
public void CreateAttackWindow() { Destroyer.Dialog(); // ability box - name header UIElement ui = new UIElement(); ui.SetLocation(15, 0.5f, UIScaler.GetWidthUnits() - 30, 2); ui.SetText(monster.monsterData.name); ui.SetFontSize(UIScaler.GetMediumFont()); new UIElementBorder(ui); float offset = 2.5f; ui = new UIElement(); ui.SetLocation(10, offset, UIScaler.GetWidthUnits() - 20, 4); ui.SetText(monster.currentActivation.masterActions.Replace("\\n", "\n")); new UIElementBorder(ui); // Add this to the log Game.Get().quest.log.Add(new Quest.LogEntry(monster.currentActivation.masterActions.Replace("\n", "\\n"))); offset += 4.5f; ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-6f), offset, 12, 2); ui.SetText(CommonStringKeys.FINISHED); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(activated); new UIElementBorder(ui); MonsterDialogMoM.DrawMonster(monster); }
override public void CreateWindow(bool singleStep = false) { // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG)) { Object.Destroy(go); } // ability box - name header UIElement ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-9f), 0.5f, 18, 2); ui.SetText(monster.monsterData.name); ui.SetFontSize(UIScaler.GetMediumFont()); new UIElementBorder(ui); float offset = 2.5f; if (monster.currentActivation.effect.Length > 0) { // ability text string textKey = monster.currentActivation.effect.Replace("\\n", "\n"); // Add this to the log Game.Get().quest.log.Add(new Quest.LogEntry(textKey.Replace("\n", "\\n"))); ui = new UIElement(); ui.SetLocation(10, offset, UIScaler.GetWidthUnits() - 20, 4); ui.SetText(textKey); new UIElementBorder(ui); offset += 4.5f; } ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-9f), offset, 18, 2); ui.SetText(MONSTER_ATTACKS); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(CreateAttackWindow); new UIElementBorder(ui); offset += 2.5f; ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-9f), offset, 18, 2); ui.SetText(monster.currentActivation.ad.moveButton); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(CreateMoveWindow); new UIElementBorder(ui); MonsterDialogMoM.DrawMonster(monster); }
public void AttackOptions() { // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG)) { Object.Destroy(go); } UIElement ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-10), 0.5f, 20, 2); ui.SetText(ATTACK_PROMPT); ui.SetFontSize(UIScaler.GetMediumFont()); new UIElementBorder(ui); float offset = 3f; foreach (string type in monster.monsterData.GetAttackTypes()) { string tmpType = type; ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-6f), offset, 12, 2); ui.SetText(new StringKey("val", tmpType)); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(delegate { Attack(tmpType); }); new UIElementBorder(ui); offset += 2.5f; } ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-4f), offset, 8, 2); if (monster.damage == monster.GetHealth()) { ui.SetText(CommonStringKeys.CANCEL, Color.gray); new UIElementBorder(ui, Color.gray); } else { ui.SetText(CommonStringKeys.CANCEL); ui.SetButton(Destroyer.Dialog); new UIElementBorder(ui); } ui.SetFontSize(UIScaler.GetMediumFont()); MonsterDialogMoM.DrawMonster(monster); MonsterDialogMoM.DrawMonsterHealth(monster, delegate { AttackOptions(); }); }
public HorrorCheck(Quest.Monster m) { Game game = Game.Get(); List <HorrorData> horrors = new List <HorrorData>(); foreach (KeyValuePair <string, HorrorData> kv in game.cd.horrorChecks) { if (m.monsterData.sectionName.Equals("Monster" + kv.Value.monster)) { horrors.Add(kv.Value); } } QuestMonster qm = m.monsterData as QuestMonster; if (horrors.Count == 0 && qm != null && qm.derivedType.Length > 0) { foreach (KeyValuePair <string, HorrorData> kv in game.cd.horrorChecks) { if (qm.derivedType.Equals("Monster" + kv.Value.monster)) { horrors.Add(kv.Value); } } } // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog")) { Object.Destroy(go); } string text = horrors[Random.Range(0, horrors.Count)].text.Translate().Replace("{0}", m.monsterData.name.Translate()); DialogBox db = new DialogBox(new Vector2(10, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 20, 8), new StringKey(null, text, false)); db.AddBorder(); new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { Destroyer.Dialog(); }); MonsterDialogMoM.DrawMonster(m); }
public void Attack() { Destroyer.Dialog(); DialogBox db = new DialogBox(new Vector2(10, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 20, 8), new StringKey(null, attackText, false)); db.AddBorder(); if (monster.damage == monster.GetHealth()) { new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate {; }, Color.grey); } else { new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { Destroyer.Dialog(); }); } MonsterDialogMoM.DrawMonster(monster); MonsterDialogMoM.DrawMonsterHealth(monster, delegate { Attack(); }); }
public void Draw() { Destroyer.Dialog(); DialogBox db = new DialogBox(new Vector2(10, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 20, 8), new StringKey(text, false)); db.AddBorder(); int health = Mathf.RoundToInt(m.monsterData.health) + Game.Get().quest.GetHeroCount(); if (m.damage == health) { new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate {; }, Color.gray); } else { new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { Destroyer.Dialog(); }); } MonsterDialogMoM.DrawMonster(m); MonsterDialogMoM.DrawMonsterHealth(m, delegate { Draw(); }); }
public void Draw() { Destroyer.Dialog(); UIElement ui = new UIElement(); ui.SetLocation(10, 0.5f, UIScaler.GetWidthUnits() - 20, 8); ui.SetText(text); new UIElementBorder(ui); if (m.damage == m.GetHealth()) { new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate {; }, Color.gray); } else { new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { Destroyer.Dialog(); }); } MonsterDialogMoM.DrawMonster(m); MonsterDialogMoM.DrawMonsterHealth(m, delegate { Draw(); }); }
public void AttackOptions() { // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog")) { Object.Destroy(go); } DialogBox db = new DialogBox(new Vector2(UIScaler.GetHCenter(-10f), 0.5f), new Vector2(20, 2), ATTACK_PROMPT); db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); db.AddBorder(); float offset = 3f; foreach (string type in attackType) { string tmpType = type; // Make first character upper case string nameType = System.Char.ToUpper(type[0]) + type.Substring(1); new TextButton(new Vector2(UIScaler.GetHCenter(-6f), offset), new Vector2(12, 2), new StringKey(nameType, false), delegate { Attack(tmpType); }); offset += 2.5f; } int health = Mathf.RoundToInt(monster.monsterData.health) + Game.Get().quest.GetHeroCount(); if (monster.damage == health) { new TextButton(new Vector2(UIScaler.GetHCenter(-4f), offset), new Vector2(8, 2), CommonStringKeys.CANCEL, delegate {; }, Color.gray); } else { new TextButton(new Vector2(UIScaler.GetHCenter(-4f), offset), new Vector2(8, 2), CommonStringKeys.CANCEL, delegate { Destroyer.Dialog(); }); } MonsterDialogMoM.DrawMonster(monster); MonsterDialogMoM.DrawMonsterHealth(monster, delegate { AttackOptions(); }); }
override public void CreateWindow(bool singleStep = false) { // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog")) { Object.Destroy(go); } // ability box - name header DialogBox db = new DialogBox(new Vector2(UIScaler.GetHCenter(-9f), 0.5f), new Vector2(18, 2), monster.monsterData.name); db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); db.AddBorder(); float offset = 2.5f; if (monster.currentActivation.effect.Length > 0) { // ability text string textKey = monster.currentActivation.effect.Replace("\\n", "\n"); db = new DialogBox(new Vector2(10, offset), new Vector2(UIScaler.GetWidthUnits() - 20, 4), new StringKey(textKey, false)); db.AddBorder(); offset += 4.5f; } new TextButton(new Vector2(UIScaler.GetHCenter(-9f), offset), new Vector2(18, 2), MONSTER_ATTACKS, delegate { CreateAttackWindow(); }); offset += 2.5f; new TextButton( new Vector2(UIScaler.GetHCenter(-9f), offset), new Vector2(18, 2), monster.currentActivation.ad.moveButton, delegate { CreateMoveWindow(); }); MonsterDialogMoM.DrawMonster(monster); }
public void CreateAttackWindow() { Destroyer.Dialog(); // ability box - name header DialogBox db = new DialogBox(new Vector2(15, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 30, 2), monster.monsterData.name); db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); db.AddBorder(); float offset = 2.5f; db = new DialogBox( new Vector2(10, offset), new Vector2(UIScaler.GetWidthUnits() - 20, 4), monster.currentActivation.ad.masterActions); db.AddBorder(); offset += 4.5f; new TextButton(new Vector2(UIScaler.GetHCenter(-6f), offset), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { activated(); }); MonsterDialogMoM.DrawMonster(monster); }
// Trigger next event in stack public void TriggerEvent() { Game game = Game.Get(); // First check if things need to be added to the queue at end round if (game.roundControl.CheckNewRound()) { return; } // No events to trigger if (eventStack.Count == 0) { return; } // Get the next event Event e = eventStack.Pop(); currentEvent = e; // Move to another quest if (e is StartQuestEvent) { // This loads the game game.quest.ChangeQuest((e as StartQuestEvent).name); return; } // Event may have been disabled since added if (e.Disabled()) { currentEvent = null; TriggerEvent(); return; } // Play audio if (game.cd.TryGet(e.qEvent.audio, out AudioData audioData)) { game.audioControl.Play(audioData.file); } else if (e.qEvent.audio.Length > 0) { game.audioControl.Play(Quest.FindLocalisedMultimediaFile(e.qEvent.audio, Path.GetDirectoryName(game.quest.qd.questPath))); } // Set Music if (e.qEvent.music.Count > 0) { List <string> music = new List <string>(); foreach (string s in e.qEvent.music) { if (game.cd.TryGet(s, out AudioData musicData)) { music.Add(musicData.file); } else { music.Add(Quest.FindLocalisedMultimediaFile(s, Path.GetDirectoryName(game.quest.qd.questPath))); } } game.audioControl.PlayMusic(music); if (music.Count > 0) { game.quest.music = new List <string>(e.qEvent.music); } } // Perform var operations game.quest.vars.Perform(e.qEvent.operations); // Update morale change if (game.gameType is D2EGameType) { game.quest.AdjustMorale(0); } if (game.quest.vars.GetValue("$restock") == 1) { game.quest.GenerateItemSelection(); } // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG)) { UnityEngine.Object.Destroy(go); } // If this is a monster event then add the monster group if (e is MonsterEvent) { MonsterEvent qe = (MonsterEvent)e; qe.MonsterEventSelection(); // Is this type new? Quest.Monster oldMonster = null; foreach (Quest.Monster m in game.quest.monsters) { if (m.monsterData.sectionName.Equals(qe.cMonster.sectionName)) { // Matched existing monster oldMonster = m; } } // Add the new type if (!game.gameType.MonstersGrouped() || oldMonster == null) { var monster = new Quest.Monster(qe); game.quest.monsters.Add(monster); game.monsterCanvas.UpdateList(); // Update monster var game.quest.vars.SetValue("#monsters", game.quest.monsters.Count); } // There is an existing group, but now it is unique else if (qe.qMonster.unique) { oldMonster.unique = true; oldMonster.uniqueText = qe.qMonster.uniqueText; oldMonster.uniqueTitle = qe.GetUniqueTitle(); oldMonster.healthMod = Mathf.RoundToInt(qe.qMonster.uniqueHealthBase + (Game.Get().quest.GetHeroCount() * qe.qMonster.uniqueHealthHero)); } // Display the location(s) if (qe.qEvent.locationSpecified && e.qEvent.display) { game.tokenBoard.AddMonster(qe); } } // Highlight a space on the board if (e.qEvent.highlight) { game.tokenBoard.AddHighlight(e.qEvent); } // Is this a shop? List <string> itemList = new List <string>(); foreach (string s in e.qEvent.addComponents) { if (s.IndexOf("QItem") == 0) { // Fix #998 if (game.gameType.TypeName() == "MoM" && itemList.Count == 1) { ValkyrieDebug.Log("WARNING: only one QItem can be used in event " + e.qEvent.sectionName + ", ignoring other items"); break; } itemList.Add(s); } } // Add board components game.quest.Add(e.qEvent.addComponents, itemList.Count > 1); // Remove board components game.quest.Remove(e.qEvent.removeComponents); // Move camera if (e.qEvent.locationSpecified && !(e.qEvent is QuestData.UI)) { CameraController.SetCamera(e.qEvent.location); } if (e.qEvent is QuestData.Puzzle) { QuestData.Puzzle p = e.qEvent as QuestData.Puzzle; if (p.puzzleClass.Equals("slide")) { new PuzzleSlideWindow(e); } if (p.puzzleClass.Equals("code")) { new PuzzleCodeWindow(e); } if (p.puzzleClass.Equals("image")) { new PuzzleImageWindow(e); } if (p.puzzleClass.Equals("tower")) { new PuzzleTowerWindow(e); } return; } // Set camera limits if (e.qEvent.minCam) { CameraController.SetCameraMin(e.qEvent.location); } if (e.qEvent.maxCam) { CameraController.SetCameraMax(e.qEvent.location); } // Is this a shop? if (itemList.Count > 1 && !game.quest.boardItems.ContainsKey("#shop")) { game.quest.boardItems.Add("#shop", new ShopInterface(itemList, Game.Get(), e.qEvent.sectionName)); game.quest.ordered_boardItems.Add("#shop"); } else if (!e.qEvent.display) { // Only raise dialog if there is text, otherwise auto confirm var firstEnabledButtonIndex = e.qEvent.buttons .TakeWhile(b => !IsButtonEnabled(b, game.quest.vars)) .Count(); EndEvent(firstEnabledButtonIndex); } else { if (monsterImage != null) { MonsterDialogMoM.DrawMonster(monsterImage, true); if (monsterHealth) { } } new DialogWindow(e); } }