// Start is called before the first frame update void Start() { knight1 = GameObject.Find("Knight"); knight2 = GameObject.Find("Knight (1)"); anim1 = knight1.GetComponent <Animator>(); anim2 = knight2.GetComponent <Animator>(); dialogSystem.Show("03StartDialog.txt"); GameObject.Find("Player").GetComponent <CharacterScript>().enabled = false; dialogSystem.DialogEndedEvent += goToVillage; }
/// <summary> /// Callback for "showUpgradeDialog" event. Generates content for the upgrade confirmation /// dialog and enables it. /// </summary> /// <param name="type"></param> public void ShowUpgradeDialog(ETowerType type) { currentType = type; DialogConfig config = new DialogConfig(); int cost = currentType.GetUpgradeCost(); string messageString; if (cost > GameState.CurrentCash) { messageString = "You don't have enough cash. Required: " + cost + ". You have $" + GameState.CurrentCash; // As both buttons won't do anything special in this case, you could leave the callback config.OK = new DialogButton( interactable: false, text: "Upgrade" ); config.Cancel = new DialogButton( text: "Cancel" ); } else { messageString = "Upgrade to " + type.GetString() + " will cost $" + cost + ". You have $" + GameState.CurrentCash; config.OK = new DialogButton( onClick: OnOKClickUpgrade, text: "Upgrade" ); config.Cancel = new DialogButton( onClick: OnCancelClickUpgrade, text: "Cancel" ); } config.Message = messageString; dialogSystem.Show(config); }
/// <summary> /// Callback for the quit button. Brings up the dialog to ask for confirmation. /// </summary> public void OnQuit() { DialogConfig config = new DialogConfig { Message = "Are you sure you want to quit?", OK = new DialogButton( text: "Yes", onClick: Application.Quit ), Cancel = new DialogButton( text: "Cancel" ) }; dialog.Show(config); }
/// <summary> /// Callback for the quit button. Brings up the dialog for confirmation and loads the main scene if confirmed. /// </summary> public void OnQuit() { DialogConfig config = new DialogConfig { Message = "Are you sure you want to return to the Main Menu?", OK = new DialogButton( text: "Yes", onClick: ReturnToMainMenu ), Cancel = new DialogButton( text: "Cancel" ) }; dialog.Show(config); }
public DirectoryCopierFileCopyMode OnFileExists(string file1, string file2) { return(Dispatcher.Invoke(() => { switch (DialogSystem.Show("Conflict", string.Format("The file {0} already exists. Overwrite?", file2))) { case DialogBox.DialogResult.Ok: return DirectoryCopierFileCopyMode.Copy; case DialogBox.DialogResult.No: return DirectoryCopierFileCopyMode.DoNotCopy; case DialogBox.DialogResult.YesAll: return DirectoryCopierFileCopyMode.CopyAll; case DialogBox.DialogResult.Cancel: return DirectoryCopierFileCopyMode.Cancel; default: return DirectoryCopierFileCopyMode.DoNotCopy; } })); }
public void Show() { Dialog.Show(); }
void OnMouseDown() { var activePlayerScript = GameObject.Find("CharacterIcon").GetComponent <ActivePlayer>(); active = activePlayerScript.player.GetComponent <UnityCharacter>(); if (active.isRegiving) { if (this.gameObject.tag != "Player") { message.Show("Передавать вещи можно только своим"); } else { active.Character.Inventory.Artifacts.Remove(active.isToBeRegiven); thisReceiver.Inventory.Artifacts.Add(active.isToBeRegiven); } active.isToBeRegiven = null; active.isRegiving = false; return; } if (this.gameObject.tag == "Player" && !active.isSpellSelected && !active.isArifactSelected) { if (active.isRegiving) { } else { activePlayerScript.ChangePlayer(this.gameObject); } return; } if (active.isArifactSelected) { var artifact = active.Character.Inventory.Artifacts[(int)active.selectedArtifactIndex]; if (active.isArifactSelected && artifact.IsFightOnly && !fightSystem.FightStarted) { message.Show("Не к чему бороться в мирное время"); return; } if (active.isArifactSelected && artifact.Used) { message.Show("Нельзя использовать один артефакт за ход дважды"); return; } if (artifact.IsFightOnly) { artifact.Used = true; } var recepient = this.GetComponent <UnityCharacter>().Character; if (this.tag == "Enemy" || this.tag == "Player") { bool isForOneTime = artifact.IsRechargeable; if (artifact.HasPower) { //active.Character.Inventory.ActivateArtifact((int)active.selectedArtifactIndex, thisReceiver, 3); System.Random random = new System.Random(); try { Cast(random.Next(0, Math.Min((int)artifact.Power, (int)thisReceiver.MaxHp)) + 1); } catch { } } else { try { Cast(1); } catch { } } // if (isForOneTime) { active.isArifactSelected = false; active.selectedArtifactIndex = 0; var artifactButton = GameObject.Find("Canvas").transform.Find("Buttons").Find("InventoryButton").Find("Slot").GetComponent <Image>(); artifactButton.sprite = null; artifactButton.color = Color.white; } } else { if (this.gameObject.name == "granny") { if (artifact.Name == "Цветочки") { if (questSystem.GetByTag("GrannyQuest") != null && !questSystem.GetByTag("GrannyQuest").IsFinished) { active.Character.Inventory.ExchangeArtifact(recepient, (int)active.selectedArtifactIndex); dialogSystem.Show("03VillageGrannyCompleting.txt"); this.transform.Find("QuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); } else { dialogSystem.Show("03VillageGrannyBase.txt"); return; } } else { dialogSystem.Show("03VillageGrannyDontWant.txt"); return; } } else if (this.gameObject.name == "Well" && questSystem.GetByTag("SaintWater") != null && !questSystem.GetByTag("SaintWater").IsFinished) { if (artifact.GetType() == typeof(CatFishScripts.Artifacts.LivingWaterBottle)) { active.Character.Inventory.ExchangeArtifact(recepient, (int)active.selectedArtifactIndex); message.Show("Вы освятили колодец"); this.transform.Find("QuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); } } else if (this.gameObject.name == "oldboy") { if (artifact.Name == "Грибы") { if (questSystem.GetByTag("Mushrooms") != null && !questSystem.GetByTag("Mushrooms").IsFinished) { int i = 0; while (i < active.Character.Inventory.Artifacts.Count) { if (active.Character.Inventory.Artifacts[i].Name == "Грибы") { active.Character.Inventory.ExchangeArtifact(recepient, i); i--; } i++; } if (recepient.Inventory.Artifacts.Count == 8) { dialogSystem.Show("04OldBoyFinish.txt"); this.transform.Find("QuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); } } else { dialogSystem.Show("04OldBoyCompleting.txt"); return; } } else { dialogSystem.Show("04OldBoyCompleting.txt"); return; } } else if (this.gameObject.name == "elf") { if (artifact.GetType() == typeof(CatFishScripts.Artifacts.BasiliskEye)) { if (questSystem.GetByTag("ElfQuest") != null && !questSystem.GetByTag("ElfQuest").IsFinished) { active.Character.Inventory.ExchangeArtifact(recepient, (int)active.selectedArtifactIndex); } } else { return; } } active.isArifactSelected = false; active.selectedArtifactIndex = 0; var artifactButton = GameObject.Find("Canvas").transform.Find("Buttons").Find("InventoryButton").Find("Slot").GetComponent <Image>(); artifactButton.sprite = null; artifactButton.color = Color.white; } } if (active.isSpellSelected) { var spell = (active.Character as Magician).SpellsList.Spells[(int)active.selectedSpellIndex]; try { CastSpell(spell.Power); } catch (Exception ex) { message.Show(ex.Message); } active.isSpellSelected = false; active.selectedSpellIndex = 0; var spellButton = GameObject.Find("Canvas").transform.transform.Find("Buttons").Find("SpellbookButton").Find("Slot").GetComponent <Image>(); spellButton.sprite = null; spellButton.color = Color.white; } }
public void FinishQuest() { if (questSystem.GetByTag(questTag) == null || questSystem.GetByTag(questTag).IsFinished) { return; } questSystem.GetByTag(questTag).IsFinished = true; //Debug.Log("Шкаф открыт"); ////////////////////////////////////////// if (this.transform.parent.name == "FlatWardrobe" && questTag == "Clothing") { dialogSystem.Show("01Rat.txt"); GameObject.Find("Rat").GetComponent <VisibleScript>().Enable(); questSystem.Add(new CatFishScripts.Quest("RatKill", null, "Убейте крысу")); } if (this.transform.parent.name == "Rat" && questTag == "RatKill") { dialogSystem.Show("01RatKill.txt"); GameObject.Find("FlatDoor").GetComponent <DoorScript>().isAccessible = true; questSystem.Add(new CatFishScripts.Quest("BuyNewClothes", null, "Купите новую одежду")); GameObject.Find("Saving").GetComponent <SaveManager>().Save(); } if (this.transform.parent.name == "MagicClothes" && questTag == "BuyNewClothes") { questSystem.Add(new CatFishScripts.Quest("MoveToVillage", null, "???")); GameObject.Find("Saving").GetComponent <SaveManager>().Save(); SceneManager.LoadScene("03-Castle"); } if (this.transform.parent.name == "bool" && questTag == "BullQuest") { questSystem.Add(new CatFishScripts.Quest("BullKilledQuest", null, "Поговорите со старейшиной")); GameObject.Find("Saving").GetComponent <SaveManager>().Save(); } if (this.transform.parent.name == "OldMan" && questTag == "OldManQuest") { GameObject.Find("ExitBlocker").GetComponent <ExitBlockerScript>().isOpened = true; } if (this.transform.parent.name == "Well" && questTag == "SaintWater") { questSystem.Add(new CatFishScripts.Quest("SaintWaterTell", null, "Поговорите с диаконом")); } if (this.transform.parent.name == "SaintBrother" && questTag == "SaintWaterTell") { GameObject saint = this.transform.parent.gameObject; GameObject.Find("Player").GetComponent <UnityCharacter>().satellites.Add(this.awards[1].GetComponent <UnityCharacter>()); saint.SetActive(false); } ///////////////////////////////////// if (awards != null) { foreach (var award in awards) { if (award != null) { if (!award.activeSelf) { award.SetActive(true); } award.GetComponent <VisibleScript>().Enable(); } } } questSystem.ActiveQuests--; if (questSystem.demonstrator.gameObject.activeSelf) { questSystem.demonstrator.Hide(); questSystem.demonstrator.Show(); } }
// Start is called before the first frame update void Start() { dialogSystem.Show("01Awake.txt"); questSystem = GameObject.Find("QuestSystem").GetComponent <QuestSystem>(); questSystem.Add(new CatFishScripts.Quest("Clothing", null, "Одеться на важную встречу.")); }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.tag == "PickUpUnique") { if (Input.GetKey(KeyCode.E)) { if (!CharacterHas(collision)) { PickUp(collision); } else { dialogSystem.Show("UniqueTwicePickUp.txt"); } } } if (collision.gameObject.tag == "Door") { if (Input.GetKey(KeyCode.E)) { DoorScript door = collision.gameObject.GetComponent <DoorScript>(); if (door.isAccessible) { door.Open(); if (collision.name == "FlatDoor") { saveManager.Save(); SceneManager.LoadScene("02-Secondhand"); } if (collision.name == "FlatWardrobe") { collision.transform.Find("QuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); door.isAccessible = false; } } else { if (collision.name == "FlatDoor") { dialogSystem.Show("01EarlyDoor.txt"); } if (collision.name == "FlatDoor") { dialogSystem.Show("01EarlyDoor.txt"); } // message.Show("Кажется, мне туда ещё рано..."); } } } if (collision.gameObject.tag == "PickUp") { if (Input.GetKey(KeyCode.E)) { PickUp(collision); } } if (collision.gameObject.tag == "PickUpSpell") { if (Input.GetKey(KeyCode.E)) { PickUpSpell(collision); } } if (collision.gameObject.name == "MagicClothes") { if (Input.GetKey(KeyCode.E)) { collision.transform.Find("QuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); } } if (collision.gameObject.tag == "ExitBlocker") { var blocker = collision.GetComponent <ExitBlockerScript>(); if (blocker.isOpened) { if (SceneManager.GetActiveScene().name == "03-Castle") { } if (SceneManager.GetActiveScene().name == "04-Village") { saveManager.Save(); SceneManager.LoadScene("05-Forest"); } if (SceneManager.GetActiveScene().name == "05-Forest") { saveManager.Save(); SceneManager.LoadScene("06-Town"); } if (SceneManager.GetActiveScene().name == "06-Town") { saveManager.Save(); SceneManager.LoadScene("07-Castle"); } } else { // Debug.Log((dialogSystem == null).ToString()+ "d" + this.gameObject.name); GameObject.Find("DialogSystem").GetComponent <DialogSystem>().Show("WrongWay.txt"); } } if (collision.gameObject.tag == "Talkable") { if (Input.GetKey(KeyCode.E)) { if (collision.name == "granny") { var quest = questSystem.GetByTag("GrannyQuest"); if (quest == null || !quest.IsFinished) { dialogSystem.Show("03VillageGranny.txt"); questSystem.Add(new CatFishScripts.Quest("GrannyQuest", null, "Собрать цветы для зелья")); } else { dialogSystem.Show("03VillageGrannyCompleted.txt"); } } if (collision.name == "OldMan") { var quest = questSystem.GetByTag("BullQuest"); var quest2 = questSystem.GetByTag("OldManQuest"); collision.transform.Find("???QuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); if (quest == null || quest2 == null) { dialogSystem.Show("03VillageOldMan.txt"); questSystem.Add(new CatFishScripts.Quest("BullQuest", null, "Успокоить быка на поле")); questSystem.Add(new CatFishScripts.Quest("OldManQuest", null, "Помочь людям в деревне")); } else { if (questSystem.GetByTag("BullKilledQuest") == null || questSystem.GetByTag("SaintWaterTell") == null || !questSystem.GetByTag("SaintWaterTell").IsFinished || questSystem.GetByTag("GrannyQuest") == null || !questSystem.GetByTag("GrannyQuest").IsFinished) { dialogSystem.Show("03VillageOldManCompleting.txt"); return; } collision.transform.Find("MainQuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); collision.transform.Find("BullKilledQuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); dialogSystem.Show("03VillageOldManCompleted.txt"); } } if (collision.name == "SaintBrother") { var quest = questSystem.GetByTag("SaintWater"); if (quest == null) { dialogSystem.Show("03SaintBrotherStart.txt"); questSystem.Add(new CatFishScripts.Quest("SaintWater", null, "Освятите колодец")); } else if (!quest.IsFinished) { dialogSystem.Show("03SaintBrotherCompleting.txt"); } else { collision.transform.Find("QuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); dialogSystem.Show("03SaintBrotherCompleted.txt"); } } if (collision.name == "oldboy") { var quest = questSystem.GetByTag("Mushrooms"); if (quest == null) { dialogSystem.Show("04OldBoyStart.txt"); questSystem.Add(new CatFishScripts.Quest("Mushrooms", null, "Соберите съедобные грибы")); } else { //collision.transform.Find("QuestReceiver").GetComponent<QuestReceiver>().FinishQuest(); dialogSystem.Show("04OldBoyFinish.txt"); } } if (collision.name == "goblin") { dialogSystem.Show("04Goblin.txt"); } if (collision.name == "priest") { dialogSystem.Show("03Priest.txt"); } if (collision.name == "gnome" || collision.name == "gnome2") { dialogSystem.Show("05Gnomes.txt"); } if (collision.name == "warrior") { dialogSystem.Show("05Security.txt"); } if (collision.name == "warrior") { dialogSystem.Show("05Security.txt"); } if (collision.name == "Mag") { dialogSystem.Show("06Mag.txt"); } if (collision.name == "elf") { var quest = questSystem.GetByTag("ElfQuest"); if (quest == null) { dialogSystem.Show("05ElfStart.txt"); questSystem.Add(new CatFishScripts.Quest("ElfQuest", null, "Помогите эльфу")); } else if (GameObject.Find("goblin").GetComponent <UnityCharacter>().Character.Condition == CatFishScripts.Characters.Character.ConditionType.dead && collision.GetComponent <UnityCharacter>().Character.Inventory.Artifacts.Count == 1) { collision.transform.Find("QuestReceiver").GetComponent <QuestReceiver>().FinishQuest(); dialogSystem.Show("05ElfEnd.txt"); } else if (quest.IsFinished) { dialogSystem.Show("05ElfFullEnd.txt"); } } } } }