private static void OpenConfirmationMenu(Contract c)
        {
            AwaitingConfirmation = c;
            var menu    = new FrameworkMenu(new Point(185, 35), false);
            var text1   = new TextComponent(new Point(0, 0), "Delivery request: " + c.AmountNeeded + "x " + c.Item.Name);
            var text2   = new TextComponent(new Point(0, 7), "You cannot abandon a contract once you've accepted it.", true, 1F, Color.Red);
            var accept  = new ClickableTextureComponent(new Rectangle(140, 16, 12, 12), Game1.content.Load <Texture2D>("LooseSprites//Cursors").getArea(new Rectangle(128, 256, 64, 64)), OnAccept);
            var decline = new ClickableTextureComponent(new Rectangle(155, 16, 12, 12), Game1.content.Load <Texture2D>("LooseSprites//Cursors").getArea(new Rectangle(192, 256, 64, 64)), OnDecline);

            menu.AddComponent(text1);
            menu.AddComponent(text2);
            menu.AddComponent(accept);
            menu.AddComponent(decline);
            Game1.activeClickableMenu = menu;
        }
        private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
        {
            if (e.KeyPressed.ToString() == "Y")
            {
                Menu = new FrameworkMenu(new Microsoft.Xna.Framework.Point(85, 5 * 11 + 22));
                Menu.AddComponent(new LabelComponent(new Microsoft.Xna.Framework.Point(-3, -16), "Choose destination"));
                clickables.Add(Menu.upperRightCloseButton);

                var r = new ButtonFormComponent(new Microsoft.Xna.Framework.Point(-1, 3 + 11 * 1), 65, "Hello", (t, p, m) => hmm()); //always *4
                var s = new ButtonFormComponent(new Microsoft.Xna.Framework.Point(-1, 3 + 11 * 2), 65, "Bye", (t, p, m) => bleh());  //always *4

                Menu.AddComponent(r);
                Menu.AddComponent(s);
                clickables2.Add(s, 65);
                clickables2.Add(r, 65);
                // clickables.Add(r);
            }
        }
Esempio n. 3
0
        private void ShowConfig(string command, string[] args)
        {
            if (!Context.IsWorldReady)
            {
                return;
            }
            FrameworkMenu        Menu              = new FrameworkMenu(new Point(200, 40));
            TextComponent        label             = new TextComponent(new Point(0, 0), "Webhook URL:");
            TextboxFormComponent webhookUrlTextbox = new TextboxFormComponent(new Point(0, 8), 175, null);
            ButtonFormComponent  setButton         = new ButtonFormComponent(new Point(0, 21), "Set", (t, p, m) => this.SetWebhook(webhookUrlTextbox.Value, Game1.player.farmName));
            Texture2D            icon              = this.Helper.Content.Load <Texture2D>("assets/icon.png");
            TextureComponent     iconTexture       = new TextureComponent(new Rectangle(-16, -16, 16, 16), icon);

            Menu.AddComponent(label);
            Menu.AddComponent(webhookUrlTextbox);
            Menu.AddComponent(setButton);
            Menu.AddComponent(iconTexture);
            Game1.activeClickableMenu = Menu;
        }
        private void checkForBusStop(object sender, EventArgs e)
        {
            if (Game1.player == null)
            {
                return;
            }
            if (Game1.player.currentLocation == null)
            {
                return;
            }
            if (Game1.player.currentLocation.name == "BusStop")
            {
                // Log.AsyncC("Step1");
                MouseState mState = Mouse.GetState();
                if (mState.LeftButton == ButtonState.Pressed)
                {
                    // Log.AsyncC("Step2");
                    // Log.AsyncC(getMouseTile());
                    if (getMouseTile().X == 7 && (getMouseTile().Y == 11 || getMouseTile().Y == 10))
                    {
                        //  Log.AsyncC("Step3");
                        Menu = new FrameworkMenu(new Microsoft.Xna.Framework.Point(85, 5 * 11 + 22));
                        Menu.AddComponent(new LabelComponent(new Microsoft.Xna.Framework.Point(-3, -16), "Choose destination"));
                        clickables.Add(Menu.upperRightCloseButton);

                        var r = new ButtonFormComponent(new Microsoft.Xna.Framework.Point(-1, 3 + 11 * 3), 65, "Sun Drop City", (t, p, m) => hmm());   //always *4
                        var s = new ButtonFormComponent(new Microsoft.Xna.Framework.Point(-1, 3 + 11 * 1), 65, "Pellican Town", (t, p, m) => bleh());  //always *4
                        var d = new ButtonFormComponent(new Microsoft.Xna.Framework.Point(-1, 3 + 11 * 2), 65, "Callico Desert", (t, p, m) => bleh()); //always *4
                        Menu.AddComponent(r);
                        Menu.AddComponent(s);
                        Menu.AddComponent(d);
                        clickables2.Add(s, 65);
                        clickables2.Add(r, 65);
                        clickables2.Add(d, 65);
                    }
                }
            }
        }
Esempio n. 5
0
        public static void Init()
        {
            Menu = new FrameworkMenu(new Point(200, 140));
            int rank = AssociationHandler.Main.Rank;

            Menu.AddComponent(new ButtonFormComponent(new Point(0, 0), 80, "Shipment Eval", OnShipEvalButton));
            Menu.AddComponent(new ButtonFormComponent(new Point(100, 0), 80, "Blessing of Luck", OnLuckButton));

            Menu.AddComponent(new ButtonFormComponent(new Point(0, 20), 80, "Organize Banquet", OnBanquetButton));
            Menu.AddComponent(new ButtonFormComponent(new Point(100, 20), 80, "Speed Boost", OnSpeedButton));

            Menu.AddComponent(new ButtonFormComponent(new Point(0, 40), 80, "Dousing Plane", OnPlaneButton));
            Menu.AddComponent(new ButtonFormComponent(new Point(100, 40), 80, "Care Packages", OnCareButton));

            Menu.AddComponent(new ButtonFormComponent(new Point(0, 60), 80, "Weather Machine", OnWeatherButton));
            Menu.AddComponent(new ButtonFormComponent(new Point(100, 60), 80, "W.I.P.", OnWip1Button));

            Menu.AddComponent(new ButtonFormComponent(new Point(100, 80), 80, "W.I.P.", OnWip2Button));
        }
 public static void Update()
 {
     Init();
     for (int i = 0; i < 8; i++)
     {
         if (i <= 3)
         {
             foreach (var component in GenerateContractComponent(AssociationHandler.Main.AvailableContracts[i],
                                                                 new Point(44 * i, 30)))
             {
                 Menu.AddComponent(component);
             }
         }
         else
         {
             foreach (var component in GenerateContractComponent(AssociationHandler.Main.AvailableContracts[i],
                                                                 new Point(44 * (i - 4), 75)))
             {
                 Menu.AddComponent(component);
             }
         }
     }
 }
        public static void Init()
        {
            for (int i = 0; i < 8; i++)
            {
                if (i <= 3)
                {
                    Bg[i] = new ClickableTextureComponent(new Rectangle(44 * i, 30, 48, 48), Game1.content.Load <Texture2D>("LooseSprites//DialogBoxGreen"), OnContractButton);
                    var temp = new TextureComponent(new Rectangle(44 * i + 8, 30 + 8, 32, 32), Game1.content.Load <Texture2D>("LooseSprites//Cursors").getArea(new Rectangle(268, 470, 16, 16)));
                    temp.Layer = 3;
                    Crosses[i] = temp;
                }
                else
                {
                    Bg[i] = new ClickableTextureComponent(new Rectangle(44 * (i - 4), 75, 48, 48), Game1.content.Load <Texture2D>("LooseSprites//DialogBoxGreen"), OnContractButton);
                    var temp = new TextureComponent(new Rectangle(44 * (i - 4) + 8, 75 + 8, 32, 32), Game1.content.Load <Texture2D>("LooseSprites//Cursors").getArea(new Rectangle(268, 470, 16, 16)));
                    temp.Layer = 3;
                    Crosses[i] = temp;
                }
            }

            if (Menu != null)
            {
                Menu.ClearComponents();
            }
            Menu = new FrameworkMenu(new Point(200, 140), false);
            foreach (var bg in Bg)
            {
                Menu.AddComponent(bg);
            }
            Menu.AddComponent(HeaderText);
            Menu.AddComponent(DescText1);
            Menu.AddComponent(DescText2);
            Menu.AddComponent(DescText3);
            Menu.AddComponent(DescText4);
            Menu.AddComponent(BackButton);
        }
 private static void AddToMenu(IMenuComponent comp, int layer = 1)
 {
     comp.Layer = layer;
     Menu.AddComponent(comp);
 }
Esempio n. 9
0
        private void GameEvents_UpdateTick(object s, EventArgs e)
        {
            if (!Game1.hasLoadedGame || Game1.CurrentEvent != null)
            {
                return;
            }
            GameEvents.UpdateTick  -= GameEvents_UpdateTick;
            MenuEvents.MenuChanged += MenuEvents_MenuChanged;
            Destinations            = new Dictionary <string, ButtonFormComponent>();
            foreach (KeyValuePair <string, string> item in DestinationData)
            {
                switch (item.Key)
                {
                case "Farm":
                    if (!Config.FarmDestinationEnabled)
                    {
                        continue;
                    }
                    break;

                case "Desert":
                    if (!Config.DesertDestinationEnabled)
                    {
                        continue;
                    }
                    break;

                case "Woods":
                    if (!Config.WoodsDestinationEnabled)
                    {
                        continue;
                    }
                    break;

                case "Beach":
                    if (!Config.BeachDestinationEnabled)
                    {
                        continue;
                    }
                    break;

                case "Forest":
                    if (!Config.WizardDestinationEnabled)
                    {
                        continue;
                    }
                    break;
                }
                Destinations.Add(item.Key, new ButtonFormComponent(new Microsoft.Xna.Framework.Point(-1, 3 + 11 * Destinations.Count), 65, item.Value, (t, p, m) => AnswerResolver(item.Key)));
            }
            Menu = new FrameworkMenu(new Microsoft.Xna.Framework.Point(85, Destinations.Count * 11 + 22));
            Menu.AddComponent(new LabelComponent(new Microsoft.Xna.Framework.Point(-3, -16), "Choose destination"));
            foreach (ButtonFormComponent c in Destinations.Values)
            {
                Menu.AddComponent(c);
            }
            // # Farm
            if (Config.FarmDestinationEnabled && !Config.UseCustomFarmDestination)
            {
                try
                {
                    GameLocation farm = Game1.getFarm();
                    if (Config.AlternateFarmMinecart)
                    {
                        farm.SetTile(18, 5, 483, "Front", "untitled tile sheet");
                        farm.SetTile(19, 5, 484, "Front", "untitled tile sheet");
                        farm.SetTile(19, 5, 217, "Buildings", "untitled tile sheet");
                        farm.SetTile(20, 5, 485, "Front", "untitled tile sheet");

                        farm.SetTile(18, 6, 508, "Buildings", "untitled tile sheet");
                        farm.SetTile(19, 6, 509, "Back", "untitled tile sheet");
                        farm.SetTile(20, 6, 510, "Buildings", "untitled tile sheet");

                        farm.SetTile(18, 7, 533, "Buildings", "untitled tile sheet");
                        farm.SetTile(19, 7, 534, "Back", "untitled tile sheet");
                        farm.SetTile(20, 7, 535, "Buildings", "untitled tile sheet");

                        farm.SetTile(19, 6, 933, "Buildings", "untitled tile sheet");
                        farm.SetTile(19, 7, 958, "Buildings", "MinecartTransport", "untitled tile sheet");
                    }
                    else
                    {
                        // Clear annoying flower
                        farm.removeTile(79, 12, "Buildings");
                        // Cut dark short
                        farm.SetTile(77, 11, 375, "Back", "untitled tile sheet");
                        farm.SetTile(78, 11, 376, "Back", "untitled tile sheet");
                        farm.SetTile(79, 11, 376, "Back", "untitled tile sheet");
                        // Lay tracks
                        farm.SetTile(78, 12, 729, "Back", "untitled tile sheet");
                        farm.SetTile(78, 13, 754, "Back", "untitled tile sheet");
                        farm.SetTile(78, 14, 755, "Back", "untitled tile sheet");
                        farm.SetTile(79, 12, 730, "Back", "untitled tile sheet");
                        // Trim grass
                        farm.SetTile(77, 13, 175, "Back", "untitled tile sheet");
                        farm.SetTile(77, 14, 175, "Back", "untitled tile sheet");
                        farm.SetTile(77, 15, 175, "Back", "untitled tile sheet");
                        farm.SetTile(78, 15, 175, "Back", "untitled tile sheet");
                        farm.SetTile(79, 13, 175, "Back", "untitled tile sheet");
                        farm.SetTile(79, 14, 175, "Back", "untitled tile sheet");
                        farm.SetTile(79, 15, 175, "Back", "untitled tile sheet");
                        // Clean up fence
                        farm.SetTile(78, 11, 436, "Buildings", "untitled tile sheet");
                        farm.removeTile(78, 14, "Buildings");
                        // Plop down minecart
                        farm.SetTile(78, 12, 933, "Buildings", "untitled tile sheet");
                        farm.SetTile(78, 13, 958, "Buildings", "MinecartTransport", "untitled tile sheet");
                        // Keep exit clear
                        farm.setTileProperty(78, 14, "Back", "NoFurniture", "T");
                    }
                }
                catch (Exception err)
                {
                    Monitor.Log(LogLevel.Error, "Could not patch the Farm due to a unknown error", err);
                }
            }
            if (Config.DesertDestinationEnabled)
            {
                try
                {
                    // # Desert
                    GameLocation          desert = Game1.getLocationFromName("Desert");
                    xTile.Tiles.TileSheet parent = Game1.getLocationFromName("Mountain").map.GetTileSheet("outdoors");
                    desert.map.AddTileSheet(new xTile.Tiles.TileSheet("z_path_objects_custom_sheet", desert.map, parent.ImageSource, parent.SheetSize, parent.TileSize));
                    desert.map.DisposeTileSheets(Game1.mapDisplayDevice);
                    desert.map.LoadTileSheets(Game1.mapDisplayDevice);
                    if (Config.AlternateDesertMinecart)
                    {
                        // Backdrop
                        desert.SetTile(33, 1, 221, "Front", "desert-new");
                        desert.SetTile(34, 1, 222, "Front", "desert-new");
                        desert.SetTile(35, 1, 223, "Front", "desert-new");

                        desert.SetTile(33, 2, 237, "Front", "desert-new");
                        desert.SetTile(34, 2, 254, "Buildings", "desert-new");
                        desert.SetTile(34, 2, 238, "Front", "desert-new");
                        desert.SetTile(35, 2, 239, "Front", "desert-new");

                        desert.SetTile(33, 3, 253, "Buildings", "desert-new");
                        desert.SetTile(34, 3, 254, "Buildings", "desert-new");
                        desert.SetTile(35, 3, 255, "Buildings", "desert-new");

                        desert.SetTile(33, 4, 269, "Buildings", "desert-new");
                        desert.SetTile(34, 4, 270, "Back", "desert-new");
                        desert.SetTile(35, 4, 271, "Buildings", "desert-new");
                        // Cart
                        desert.SetTile(34, 3, 933, "Front", "z_path_objects_custom_sheet");
                        desert.SetTile(34, 4, 958, "Buildings", "MinecartTransport", "z_path_objects_custom_sheet");
                    }
                    else
                    {
                        // Backdrop
                        desert.SetTile(33, 39, 221, "Front", "desert-new");
                        desert.SetTile(34, 39, 222, "Front", "desert-new");
                        desert.SetTile(35, 39, 223, "Front", "desert-new");

                        desert.SetTile(33, 40, 237, "Front", "desert-new");
                        desert.SetTile(34, 40, 254, "Buildings", "desert-new");
                        desert.SetTile(34, 40, 238, "Front", "desert-new");
                        desert.SetTile(35, 40, 239, "Front", "desert-new");

                        desert.SetTile(33, 41, 253, "Buildings", "desert-new");
                        desert.SetTile(34, 41, 254, "Buildings", "desert-new");
                        desert.SetTile(35, 41, 255, "Buildings", "desert-new");

                        desert.SetTile(33, 42, 269, "Buildings", "desert-new");
                        desert.SetTile(34, 42, 270, "Back", "desert-new");
                        desert.SetTile(35, 42, 271, "Buildings", "desert-new");
                        // Cart
                        desert.SetTile(34, 41, 933, "Front", "z_path_objects_custom_sheet");
                        desert.SetTile(34, 42, 958, "Buildings", "MinecartTransport", "z_path_objects_custom_sheet");
                    }
                }
                catch (Exception err)
                {
                    Monitor.Log(LogLevel.Error, "Could not patch the Desert due to a unknown error", err);
                }
            }
            if (Config.WoodsDestinationEnabled)
            {
                try
                {
                    // # Woods
                    GameLocation woods = Game1.getLocationFromName("Woods");
                    woods.SetTile(46, 3, 933, "Front", "untitled tile sheet");
                    woods.SetTile(46, 4, 958, "Buildings", "MinecartTransport", "untitled tile sheet");
                }
                catch (Exception err)
                {
                    Monitor.Log(LogLevel.Error, "Could not patch the Woods due to a unknown error", err);
                }
            }
            if (Config.WizardDestinationEnabled)
            {
                try
                {
                    // # Wizard
                    GameLocation forest = Game1.getLocationFromName("Forest");
                    forest.SetTile(13, 37, 483, "Front", "outdoors");
                    forest.SetTile(14, 37, 484, "Front", "outdoors");
                    forest.SetTile(14, 37, 217, "Buildings", "outdoors");
                    forest.SetTile(15, 37, 485, "Front", "outdoors");

                    forest.SetTile(13, 38, 508, "Buildings", "outdoors");
                    forest.SetTile(14, 38, 509, "Back", "outdoors");
                    forest.SetTile(15, 38, 510, "Buildings", "outdoors");

                    forest.SetTile(13, 39, 533, "Buildings", "outdoors");
                    forest.SetTile(15, 39, 535, "Buildings", "outdoors");

                    forest.SetTile(14, 38, 933, "Buildings", "outdoors");
                    forest.SetTile(14, 39, 958, "Buildings", "MinecartTransport", "outdoors");
                }
                catch (Exception err)
                {
                    Monitor.Log(LogLevel.Error, "Could not patch the Forest due to a unknown error", err);
                }
            }
            if (Config.BeachDestinationEnabled)
            {
                try
                {
                    // # Beach
                    GameLocation          beach  = Game1.getLocationFromName("Beach");
                    xTile.Tiles.TileSheet parent = Game1.getLocationFromName("Mountain").map.GetTileSheet("outdoors");
                    beach.map.AddTileSheet(new xTile.Tiles.TileSheet("z_path_objects_custom_sheet", beach.map, parent.ImageSource, parent.SheetSize, parent.TileSize));
                    beach.map.DisposeTileSheets(Game1.mapDisplayDevice);
                    beach.map.LoadTileSheets(Game1.mapDisplayDevice);
                    beach.removeTile(67, 2, "Buildings");
                    beach.removeTile(67, 5, "Buildings");
                    beach.removeTile(67, 4, "Buildings");
                    beach.SetTile(67, 2, 933, "Buildings", "z_path_objects_custom_sheet");
                    beach.SetTile(67, 3, 958, "Buildings", "MinecartTransport", "z_path_objects_custom_sheet");
                }
                catch (Exception err)
                {
                    Monitor.Log(LogLevel.Error, "Could not patch the Beach due to a unknown error", err);
                }
            }
        }
Esempio n. 10
0
        internal static void GameEvents_UpdateTick(object s, EventArgs e)
        {
            if (!Farmhand.API.Game.HasLoadedGame || Farmhand.API.Game.CurrentEvent != null)
            {
                return;
            }

            GameEvents.OnAfterUpdateTick -= GameEvents_UpdateTick;
            GameEvents.OnHalfSecondTick  += GameEvents_HalfSecondTick;
            Menu = new FrameworkMenu(new Point(256, 168));
            TablistComponent           tablist = new TablistComponent(new Rectangle(0, 0, Menu.ZoomEventRegion.Width, Menu.ZoomEventRegion.Height));
            Rectangle                  size    = tablist.ZoomEventRegion;
            GenericCollectionComponent page1A  =
                new GenericCollectionComponent(new Rectangle(0, 0, size.Width, size.Height));

            Page1B = new FormCollectionComponent(new Rectangle(0, 0, size.Width / 2, size.Height));
            GenericCollectionComponent page2 =
                new GenericCollectionComponent(new Rectangle(0, 0, size.Width, size.Height));
            GenericCollectionComponent page3 = new ScrollableCollectionComponent(new Rectangle(0, 0, size.Width, size.Height));

            Menu.AddComponent(tablist);

            tablist.AddTab(2, page1A);
            tablist.AddTab(4, page2);
            tablist.AddTab(6, page3);

            page1A.AddComponent(Page1B);
            page1A.AddComponent(
                new ButtonFormComponent(
                    new Point(size.Width / 2, 0),
                    "Toggle Enabled",
                    (t, c, m) =>
            {
                Page1B.Disabled = !Page1B.Disabled;
                Console.WriteLine("Form state changed: " + (Page1B.Disabled ? "Disabled" : "Enabled"));
            }));

            Page1B.AddComponent(new LabelComponent(new Point(0, -38), "Form Components"));
            Page1B.AddComponent(new CheckboxFormComponent(new Point(0, 2), "Example Checkbox", CheckboxChanged));
            Page1B.AddComponent(new PlusMinusFormComponent(new Point(0, 12), 0, 100, PlusMinusChanged));
            Page1B.AddComponent(new SliderFormComponent(new Point(0, 22), 3, IntSliderChanged));
            Page1B.AddComponent(new SliderFormComponent(new Point(0, 32), 12, IntSliderChanged));
            Page1B.AddComponent(new SliderFormComponent(new Point(0, 42), 20, IntSliderChanged));
            Page1B.AddComponent(
                new DropdownFormComponent(
                    new Point(0, 51),
                    new List <string>()
            {
                "First", "Second", "Third", "Fourth"
            },
                    DropdownChanged));
            Page1B.AddComponent(
                new DropdownFormComponent(
                    new Point(0, 65),
                    new List <string>()
            {
                "#1", "#2", "#3", "#4", "#5", "#6", "#7", "#8", "#9", "#10", "#11", "#12"
            },
                    DropdownChanged));
            Page1B.AddComponent(new ButtonFormComponent(new Point(0, 78), "Test Button", ButtonClicked));
            Page1B.AddComponent(new TextboxFormComponent(new Point(0, 90), TextboxChanged));
            Page1B.AddComponent(new TextboxFormComponent(new Point(0, 105), TextboxChanged));

            page2.AddComponent(new LabelComponent(new Point(0, -38), "Generic Components"));
            page2.AddComponent(new HeartsComponent(new Point(0, 0), 3, 10));
            page2.AddComponent(new ClickableHeartsComponent(new Point(0, 10), 8, 10, HeartsChanged));
            page2.AddComponent(Prog);
            page2.AddComponent(new TextureComponent(new Rectangle(0, 30, 16, 16), Game1.objectSpriteSheet, new Rectangle(0, 0, 16, 16)));
            page2.AddComponent(new ClickableTextureComponent(new Rectangle(20, 30, 16, 16), Game1.objectSpriteSheet, ButtonClicked, new Rectangle(0, 0, 16, 16)));
            page2.AddComponent(
                new ClickableTextureComponent(
                    new Rectangle(40, 30, 16, 16),
                    Game1.objectSpriteSheet,
                    ButtonClicked,
                    new Rectangle(0, 0, 16, 16),
                    false));
            page2.AddComponent(new TextComponent(new Point(0, 50), "Static text component"));
            page2.AddComponent(new ClickableTextComponent(new Point(0, 60), "Clickable text component", ButtonClicked));
            page2.AddComponent(new ClickableTextComponent(new Point(0, 70), "Clickable text component", ButtonClicked, false));

            for (var c = 0; c < 41; c++)
            {
                page3.AddComponent(new HeartsComponent(new Point(0, 10 * c), c, 40));
            }

            Example = new FrameworkMenu(new Point(256, 128), false);

            ExampleList = new GenericCollectionComponent(new Rectangle(0, 0, Example.ZoomEventRegion.Width, Example.ZoomEventRegion.Height));
            Example.AddComponent(ExampleList);

            Rectangle r = new Rectangle(0, 0, Example.ZoomEventRegion.Width, 32);

            ExampleList.AddComponent(new FrameComponent(r, Game1.mouseCursors, new Rectangle(384, 396, 15, 15)));
            ExampleList.AddComponent(new ClickableTextureComponent(r, Game1.mouseCursors, ExampleClicked, new Rectangle(383, 395, 1, 1), false));

            ExamplePopup =
                new TablistComponent(
                    new Rectangle(0, -10, Example.ZoomEventRegion.Width, Example.ZoomEventRegion.Height + 10));
            Example.AddComponent(ExamplePopup);
            ExamplePopup.Visible = false;

            ExamplePopupClose = new ClickableTextureComponent(new Rectangle(ExamplePopup.ZoomEventRegion.Width, -11, 12, 12), Game1.mouseCursors, Example2Clicked, new Rectangle(337, 494, 12, 12));
            Example.AddComponent(ExamplePopupClose);
            ExamplePopupClose.Visible = false;

            GenericCollectionComponent tab1 = new GenericCollectionComponent(ExamplePopup.ZoomEventRegion);
            GenericCollectionComponent tab2 = new GenericCollectionComponent(ExamplePopup.ZoomEventRegion);

            ExamplePopup.AddTab(102, tab1);
            ExamplePopup.AddTab(112, tab2);

            tab1.AddComponent(new TextComponent(new Point(0, 0), "Example Mod, by Example User", true, 1.5f, Color.Black));
            tab1.AddComponent(new TextComponent(new Point(0, 20), "Example Description for the Example Mod by Example User"));

            tab2.AddComponent(new TextComponent(new Point(0, 0), "Normally the mod-specific config elements would show here"));
        }
Esempio n. 11
0
        private static void OpenConfirmationMenu(string type)
        {
            string label1 = "";
            string label2 = "";

            AwaitingConfirmation = type;
            var str = "Inactive";

            switch (type)
            {
            case "ship":
                label1 = "Let your shipment for today be evaluated by the Association to earn extra Reputation.";
                label2 = "Cost: 15x Favor";
                break;

            case "luck":
                label1 = "Let a blessing to Yoba slightly increase your luck for today.";
                label2 = "Cost: 10x Favor";
                break;

            case "banquet":
                label1 = "Organize a Banquet for Pelican Town, everyone is gonna be very happy about this!";
                label2 = "Cost: 25x Favor";
                break;

            case "speed":
                if (AssociationHandler.Main.Speed)
                {
                    str = "Active";
                }
                label1 = "A shipment of very strong coffee every morning! Guaranteed to speed up your day!";
                label2 = "Cost: 5x Favor per day     //     Currently " + str;
                break;

            case "douse":
                label1 = "Charter a dousing plane to water all your crops for today.";
                label2 = "Cost: 8x Favor";
                break;

            case "care":
                if (AssociationHandler.Main.Care)
                {
                    str = "Active";
                }
                label1 = "Sends Care Packages to the villagers of Pelican Town every day.";
                label2 = "Cost: 2x Favor per day     //     Currently " + str;
                break;

            case "weather":
                label1 = "Make it rain tomorrow! W.I.P. (adding more weather options)";
                label2 = "Cost: 8x Favor";
                break;
            }
            var menu    = new FrameworkMenu(new Point(185, 35), false);
            var text1   = new TextComponent(new Point(0, 0), label1);
            var text2   = new TextComponent(new Point(0, 7), label2);
            var accept  = new ClickableTextureComponent(new Rectangle(140, 16, 12, 12), Game1.content.Load <Texture2D>("LooseSprites//Cursors").getArea(new Rectangle(128, 256, 64, 64)), OnAccept);
            var decline = new ClickableTextureComponent(new Rectangle(155, 16, 12, 12), Game1.content.Load <Texture2D>("LooseSprites//Cursors").getArea(new Rectangle(192, 256, 64, 64)), OnDecline);

            menu.AddComponent(text1);
            menu.AddComponent(text2);
            menu.AddComponent(accept);
            menu.AddComponent(decline);
            Game1.activeClickableMenu = menu;
        }