Ejemplo n.º 1
0
        internal void AskForUpgrade()
        {
            if (Game1.getFarm().isThereABuildingUnderConstruction())
            {
                Game1.drawObjectDialogue(Helper.Translation.Get("robin.busy"));
                return;
            }

            List <Response> cabinNames = new List <Response>();

            foreach (var cabin in ModUtility.GetCabins())
            {
                string displayInfo  = null;
                var    cabinIndoors = ((Cabin)cabin.indoors.Value);

                //if the cabin is occupied, we ignore it
                if (cabinIndoors.owner.Name != "")
                {
                    continue;
                }

                switch (cabinIndoors.upgradeLevel)
                {
                case 0:
                    displayInfo = $"{cabin.buildingType.Value} {Helper.Translation.Get("robin.hu1_materials") }";
                    break;

                case 1:
                    displayInfo = $"{cabin.buildingType.Value} {Helper.Translation.Get("robin.hu2_materials") }";
                    break;

                case 2:
                    displayInfo = $"{cabin.buildingType.Value} {Helper.Translation.Get("robin.hu3_materials") }";
                    break;
                }
                if (displayInfo != null)
                {
                    cabinNames.Add(new Response(cabin.nameOfIndoors, displayInfo));
                }
            }

            if (cabinNames.Count > 0)
            {
                cabinNames.Add(new Response("Cancel", Helper.Translation.Get("menu.cancel_option")));
                //Game1.activeClickableMenu = new CabinQuestionsBox("Which Cabin would you like to upgrade?", cabinNames);
                Game1.currentLocation.createQuestionDialogue(
                    Helper.Translation.Get("robin.whichcabin_question"),
                    cabinNames.ToArray(),
                    delegate(Farmer who, string answer)
                {
                    Game1.activeClickableMenu = null;
                    HouseUpgradeAccept(ModUtility.GetCabin(answer));
                }
                    );
            }
        }
Ejemplo n.º 2
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (this.transitioning)
            {
                return;
            }
            if (this.characterIndexInDialogue < this.getCurrentString().Length - 1)
            {
                this.characterIndexInDialogue = this.getCurrentString().Length - 1;
            }
            else
            {
                if (this.safetyTimer > 0)
                {
                    return;
                }
                if (this.isQuestion)
                {
                    if (this.selectedResponse == -1)
                    {
                        return;
                    }
                    this.questionFinishPauseTimer = Game1.eventUp ? 600 : 200;
                    this.transitioning            = true;
                    this.transitionInitialized    = false;
                    this.transitioningBigger      = true;

                    Game1.dialogueUp = false;

                    UpgradeCabins.houseUpgradeAccept(ModUtility.GetCabin(this.responses[this.selectedResponse].responseKey));
                    this.selectedResponse = -1;
                    this.tryOutro();
                    return;
                }

                this.characterIndexInDialogue = 0;

                if (!this.transitioning)
                {
                    Game1.playSound("smallSelect");
                }
                this.setUpIcons();
                this.safetyTimer = 750;
                if (this.getCurrentString() == null || this.getCurrentString().Length > 20)
                {
                    return;
                }
                this.safetyTimer -= 200;
            }
        }