Exemplo n.º 1
0
        private SetRate(bool luxuries) : base(100, 80, DialogWidth(luxuries), DialogHeight(luxuries))
        {
            _luxuries  = luxuries;
            _menuItems = MenuOptions(luxuries).ToArray();

            DialogBox.DrawText($"Select new {ScreenName} rate...", 0, 15, 5, 5);
        }
Exemplo n.º 2
0
        internal CaravanChoice(Caravan unit, City city) : base(100, 80, 136, DialogHeight(unit, city))
        {
            _city = city;
            _unit = unit;

            DialogBox.DrawText($"Will you?", 0, 15, 5, 5);
        }
Exemplo n.º 3
0
        public ChooseGovernment() : base(100, 64, 86, DialogHeight)
        {
            _availableGovernments = Game.HumanPlayer.AvailableGovernments.ToArray();

            DialogBox.DrawText("Select type of", 0, 15, 5, 5);
            DialogBox.DrawText("Government...", 0, 15, 5, 13);
        }
Exemplo n.º 4
0
        internal SelectAdvanceAfterCityCapture(Player player, IList <IAdvance> advances) : base(100, 80, 135, DialogHeight(advances.Count))
        {
            _player   = player ?? throw new ArgumentNullException(nameof(player));
            _advances = advances ?? throw new ArgumentNullException(nameof(advances));

            DialogBox.DrawText($"Select one...", 0, 15, 5, 5);
        }
Exemplo n.º 5
0
        internal DiplomatCity(City enemyCity, Diplomat diplomat) : base(100, 80, 145, DialogHeight())
        {
            _enemyCity = enemyCity ?? throw new ArgumentNullException(nameof(enemyCity));
            _diplomat  = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            DialogBox.DrawText($"{_enemyCity.Player.TribeName} diplomat arrives", 0, 15, 5, 5);
            DialogBox.DrawText($"in {_enemyCity.Name}", 0, 15, 5, 5 + Resources.GetFontHeight(FONT_ID));
        }
Exemplo n.º 6
0
        public OverwritePlugin(string source, string destination) : base(70, 80, 164, 39)
        {
            _source      = source;
            _destination = destination;
            _filename    = Path.GetFileName(destination);

            DialogBox.DrawText("Overwrite existing plugin", 0, 15, 5, 5);
            DialogBox.DrawText($"file {_filename}?", 0, 15, 5, 13);
        }
Exemplo n.º 7
0
        internal DiplomatBribe(BaseUnitLand unitToBribe, Diplomat diplomat) : base(100, 80, 135, DialogHeight(unitToBribe, diplomat.Player.Gold))
        {
            _unitToBribe = unitToBribe ?? throw new ArgumentNullException(nameof(unitToBribe));
            _diplomat    = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            _bribeCost = BribeCost(unitToBribe);
            _canBribe  = CanBribe(unitToBribe, diplomat.Player.Gold);

            DialogBox.DrawText($"{unitToBribe.Player.TribeName} {unitToBribe.Name}", 0, 15, 5, 5);
            DialogBox.DrawText($"will desert for ${_bribeCost}", 0, 15, 5, 5 + Resources.GetFontHeight(FONT_ID));
            DialogBox.DrawText($"Treasury ${diplomat.Player.Gold}", 0, 15, 5, 5 + (2 * Resources.GetFontHeight(FONT_ID)));
        }
Exemplo n.º 8
0
        internal WeakAttack(BaseUnit unit, int relX, int relY)
            : base(100, 80, WIDE, DialogHeight())
        {
            _dX   = relX;
            _dY   = relY;
            _unit = unit;

            string prompt = unit.PartMoves >= 2 ? "2" : "1";

            prompt += "/3 strength?";
            DialogBox.DrawText($"Attack at", 0, 15, 5, 5);
            DialogBox.DrawText(prompt, 0, 15, 5, 5 + FontHigh);
        }
Exemplo n.º 9
0
        internal DiplomatSabotage(City enemyCity, Diplomat diplomat) : base(60, 80, 220, 56)
        {
            _enemyCity = enemyCity ?? throw new ArgumentNullException(nameof(enemyCity));
            _diplomat  = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            IBitmap spyPortrait = Icons.Spy;

            Palette palette = Common.DefaultPalette;

            for (int i = 144; i < 256; i++)
            {
                palette[i] = spyPortrait.Palette[i];
            }
            this.SetPalette(palette);

            DialogBox.AddLayer(spyPortrait, 2, 2);

            DialogBox.DrawText($"Spies Report", 0, 15, 45, 5);
            DialogBox.DrawText(_diplomat.Sabotage(_enemyCity), 0, 15, 45, 5 + Resources.GetFontHeight(FONT_ID));
            DialogBox.DrawText($"in {_enemyCity.Name}", 0, 15, 45, 5 + (2 * Resources.GetFontHeight(FONT_ID)));
        }
Exemplo n.º 10
0
        public DisbandUnit(City city, IUnit unit) : base(58, 72, TextPictures(city, unit).Max(b => b.Width) + 52, 62)
        {
            bool    modernGovernment   = Human.HasAdvance <Invention>();
            Picture governmentPortrait = Icons.GovernmentPortrait(Human.Government, Advisor.Defense, modernGovernment);

            Color[] palette = Common.GamePlay.Palette;
            for (int i = 144; i < 256; i++)
            {
                palette[i] = governmentPortrait.Palette[i];
            }
            _canvas.SetPalette(palette);

            DialogBox.AddLayer(governmentPortrait, 2, 2);
            DialogBox.DrawText("Defense Minister:", 0, 15, 47, 4);
            DialogBox.FillRectangle(11, 47, 11, 94, 1);

            _textLines = TextPictures(city, unit);
            for (int i = 0; i < _textLines.Length; i++)
            {
                DialogBox.AddLayer(_textLines[i], 47, (_textLines[i].Height * i) + 13);
            }
        }
Exemplo n.º 11
0
        public AdvisorMessage(Advisor advisor, string[] message, bool leftAlign) : base((leftAlign ? 38 : 58), 72, DialogWidth(message), 62)
        {
            bool    modernGovernment   = Human.HasAdvance <Invention>();
            IBitmap governmentPortrait = Icons.GovernmentPortrait(Human.Government, advisor, modernGovernment);

            // TODO fire-eggs common operation
            Palette palette = Common.DefaultPalette;

            for (int i = 144; i < 256; i++)
            {
                palette[i] = governmentPortrait.Palette[i];
            }
            this.SetPalette(palette);

            _textLines = TextBitmaps(message);
            DialogBox.AddLayer(governmentPortrait, 2, 2);
            DialogBox.DrawText($"{advisorNames[(int)advisor]}:", 0, 15, 47, 4);
            DialogBox.FillRectangle(47, 11, Resources.GetText($"{advisorNames[(int)advisor]}:", 0, 15).Width + 1, 1, 11);
            for (int i = 0; i < _textLines.Length; i++)
            {
                DialogBox.AddLayer(_textLines[i], 47, (_textLines[i].Height * i) + 13);
            }
        }
Exemplo n.º 12
0
        public AdvisorMessage(Advisor advisor, string[] message, bool leftAlign) : base((leftAlign ? 38 : 58), 72, DialogWidth(message) + 52, 62)
        {
            Cursor = MouseCursor.None;

            string[] advisorNames       = new string[] { "Defense Minister", "Domestic Advisor", "Foreign Minister", "Science Advisor" };
            bool     modernGovernment   = Human.HasAdvance <Invention>();
            Picture  governmentPortrait = Icons.GovernmentPortrait(Human.Government, advisor, modernGovernment);

            Color[] palette = Common.GamePlay.Palette;
            for (int i = 144; i < 256; i++)
            {
                palette[i] = governmentPortrait.Palette[i];
            }
            _canvas.SetPalette(palette);

            _textLines = TextBitmaps(message);
            DialogBox.AddLayer(governmentPortrait, 2, 2);
            DialogBox.DrawText($"{advisorNames[(int)advisor]}:", 0, 15, 47, 4);
            DialogBox.FillRectangle(11, 47, 11, Resources.Instance.GetText($"{advisorNames[(int)advisor]}:", 0, 15).Width + 1, 1);
            for (int i = 0; i < _textLines.Length; i++)
            {
                DialogBox.AddLayer(_textLines[i], 47, (_textLines[i].Height * i) + 13);
            }
        }
Exemplo n.º 13
0
        internal DiplomatIncite(City cityToIncite, Diplomat diplomat) : base(100, 80, 180, 56)
        {
            _cityToIncite = cityToIncite ?? throw new ArgumentNullException(nameof(cityToIncite));
            _diplomat     = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            IBitmap spyPortrait = Icons.Spy;

            Palette palette = Common.DefaultPalette;

            for (int i = 144; i < 256; i++)
            {
                palette[i] = spyPortrait.Palette[i];
            }
            this.SetPalette(palette);

            DialogBox.AddLayer(spyPortrait, 2, 2);

            _inciteCost = Diplomat.InciteCost(cityToIncite);
            _canIncite  = Diplomat.CanIncite(cityToIncite, diplomat.Player.Gold);

            DialogBox.DrawText($"Spies Report", 0, 15, 45, 5);
            DialogBox.DrawText($"Dissidents in {_cityToIncite.Name}", 0, 15, 45, 5 + Resources.GetFontHeight(FONT_ID));
            DialogBox.DrawText($"will revolt for ${_inciteCost}", 0, 15, 45, 5 + (2 * Resources.GetFontHeight(FONT_ID)));
        }
Exemplo n.º 14
0
        private IEnumerator StartItemMenu(Pokemon selectedPokemon)
        {
            int chosenIndex;

            Dialog.UndrawChoiceBox();
            Dialog.DrawDialogBox();
            if (!string.IsNullOrEmpty(selectedPokemon.getHeldItem()))
            {
                yield return(StartCoroutine(
                                 Dialog.DrawText(selectedPokemon.getName() + " is holding " +
                                                 selectedPokemon.getHeldItem() + ".")));

                var choices = new[]
                {
                    "Swap", "Take", "Cancel"
                };
                const int SWAP_INDEX = 2;
                const int TAKE_INDEX = 1;
                Dialog.DrawChoiceBox(choices);
                yield return(new WaitForSeconds(0.2f));

                yield return(StartCoroutine(Dialog.DrawChoiceBox(choices)));

                chosenIndex = Dialog.chosenIndex;
                switch (chosenIndex)
                {
                case SWAP_INDEX:
                {
                    yield return(StartSwappingItem(selectedPokemon));

                    break;
                }

                case TAKE_INDEX:
                {
                    yield return(StartTakingItem(selectedPokemon));

                    break;
                }
                }
            }
            else
            {
                yield return
                    (StartCoroutine(
                         Dialog.DrawText(selectedPokemon.getName() + " isn't holding anything.")));

                var choices = new[]
                {
                    "Give", "Cancel"
                };
                const int GIVE_INDEX = 1;
                Dialog.DrawChoiceBox(choices);
                yield return(new WaitForSeconds(0.2f));

                yield return(StartCoroutine(Dialog.DrawChoiceBox(choices)));

                chosenIndex = Dialog.chosenIndex;
                if (chosenIndex == GIVE_INDEX)
                {
                    yield return(StartGivingItem(selectedPokemon));
                }
            }
            yield return(new WaitForSeconds(0.2f));
        }
Exemplo n.º 15
0
 public ConfirmQuit() : base(100, 80, 104, 39)
 {
     DialogBox.DrawText("Are you sure you", 0, 15, 5, 5);
     DialogBox.DrawText("want to Quit?", 0, 15, 5, 13);
 }
        private IEnumerator interact()
        {
            if (Player.player.setCheckBusyWith(this.gameObject))
            {
                busy = true;

                //calculate Player's position relative to target object's and set direction accordingly.
                float xDistance = this.transform.position.x - Player.player.transform.position.x;
                float zDistance = this.transform.position.z - Player.player.transform.position.z;
                if (xDistance >= Mathf.Abs(zDistance))
                {
                    //Mathf.Abs() converts zDistance to a positive always.
                    updateDirection(3);
                } //this allows for better accuracy when checking orientation.
                else if (xDistance <= Mathf.Abs(zDistance) * -1)
                {
                    updateDirection(1);
                }
                else if (zDistance >= Mathf.Abs(xDistance))
                {
                    updateDirection(2);
                }
                else
                {
                    updateDirection(0);
                }

                if (!defeated)
                {
                    //Play INTRO BGM
                    BgmHandler.main.PlayOverlay(introBGM, samplesLoopStart);

                    //Display all of the confrontation Dialog.
                    for (int i = 0; i < trainerConfrontDialog.Length; i++)
                    {
                        Dialog.DrawDialogBox();
                        yield return(Dialog.StartCoroutine(Dialog.DrawText(trainerConfrontDialog[i])));

                        while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                        {
                            yield return(null);
                        }
                        Dialog.UnDrawDialogBox();
                    }

                    //custom cutouts not yet implemented
                    StartCoroutine(ScreenFade.main.FadeCutout(false, ScreenFade.slowedSpeed, null));

                    //Automatic LoopStart usage not yet implemented
                    SceneScript.main.Battle.gameObject.SetActive(true);
                    if (trainer.battleBGM != null)
                    {
                        BgmHandler.main.PlayOverlay(trainer.battleBGM, trainer.samplesLoopStart);
                    }
                    else
                    {
                        BgmHandler.main.PlayOverlay(SceneScript.main.Battle.defaultTrainerBGM,
                                                    SceneScript.main.Battle.defaultTrainerBGMLoopStart);
                    }
                    SceneScript.main.Battle.gameObject.SetActive(false);
                    yield return(new WaitForSeconds(1.6f));

                    SceneScript.main.Battle.gameObject.SetActive(true);
                    StartCoroutine(SceneScript.main.Battle.Control(trainer));

                    while (SceneScript.main.Battle.gameObject.activeSelf)
                    {
                        yield return(null);
                    }

                    //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                    yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));

                    if (SceneScript.main.Battle.victor == 0)
                    {
                        defeated         = true;
                        recentlyDefeated = true;
                        //Display all of the defeated Dialog. (if any)
                        for (int i = 0; i < trainerDefeatDialog.Length; i++)
                        {
                            Dialog.DrawDialogBox();
                            yield return(Dialog.StartCoroutine(Dialog.DrawText(trainerDefeatDialog[i])));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }
                            Dialog.UnDrawDialogBox();
                        }
                    }
                }
                else
                {
                    //Display all of the post defeat Dialog.
                    for (int i = 0; i < trainerPostDefeatDialog.Length; i++)
                    {
                        Dialog.DrawDialogBox();
                        yield return(Dialog.StartCoroutine(Dialog.DrawText(trainerPostDefeatDialog[i])));

                        while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                        {
                            yield return(null);
                        }
                        Dialog.UnDrawDialogBox();
                    }
                }

                busy = false;
                Player.player.unsetCheckBusyWith(this.gameObject);
            }
        }
        public IEnumerator interact()
        {
            if (Player.player.setCheckBusyWith(this.gameObject))
            {
                AudioClip itemGetMFX = (TM)
                ? Resources.Load <AudioClip>("Audio/mfx/GetGood")
                : Resources.Load <AudioClip>("Audio/mfx/GetDecent");
                BgmHandler.main.PlayMFX(itemGetMFX);

                string firstLetter = item.Substring(0, 1).ToLowerInvariant();
                Dialog.DrawDialogBox();
                if (TM)
                {
                    Dialog.StartCoroutine(Dialog.DrawText(
                                              SaveData.currentSave.playerName + " found TM" + ItemDatabase.getItem(item).getTMNo() + ": " + item +
                                              "!"));
                }
                else
                {
                    if (quantity > 1)
                    {
                        Dialog.StartCoroutine(Dialog.DrawText(SaveData.currentSave.playerName + " found " + item + "s!"));
                    }
                    else if (firstLetter == "a" || firstLetter == "e" || firstLetter == "i" || firstLetter == "o" ||
                             firstLetter == "u")
                    {
                        Dialog.StartCoroutine(Dialog.DrawText(SaveData.currentSave.playerName + " found an " + item + "!"));
                    }
                    else
                    {
                        Dialog.StartCoroutine(Dialog.DrawText(SaveData.currentSave.playerName + " found a " + item + "!"));
                    }
                }
                yield return(new WaitForSeconds(itemGetMFX.length));

                bool itemAdd = SaveData.currentSave.Bag.addItem(item, quantity);

                Dialog.DrawDialogBox();
                if (itemAdd)
                {
                    itemSprite.enabled   = false;
                    itemShadow.enabled   = false;
                    transform.position   = new Vector3(transform.position.x, transform.position.y - 1f, transform.position.z);
                    transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);

                    if (TM)
                    {
                        yield return
                            (Dialog.StartCoroutine(Dialog.DrawTextSilent(
                                                       SaveData.currentSave.playerName + " put the TM" + ItemDatabase.getItem(item).getTMNo() +
                                                       " away into the bag.")));
                    }
                    else
                    {
                        if (quantity > 1)
                        {
                            yield return
                                (Dialog.StartCoroutine(Dialog.DrawTextSilent(
                                                           SaveData.currentSave.playerName + " put the " + item + "s away into the bag.")));
                        }
                        else
                        {
                            yield return
                                (Dialog.StartCoroutine(Dialog.DrawTextSilent(
                                                           SaveData.currentSave.playerName + " put the " + item + " away into the bag.")));
                        }
                    }
                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    Dialog.UnDrawDialogBox();

                    Player.player.unsetCheckBusyWith(this.gameObject);
                    gameObject.SetActive(false);
                }
                else
                {
                    yield return(Dialog.StartCoroutine(Dialog.DrawTextSilent("But there was no room...")));

                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    Dialog.UnDrawDialogBox();

                    Player.player.unsetCheckBusyWith(this.gameObject);
                }
            }
        }
Exemplo n.º 18
0
 public Revolution() : base(64, 80, 231, 31)
 {
     DialogBox.DrawText("Are you sure you want a REVOLUTION?", 0, 15, 5, 5);
 }