示例#1
0
 public void KeyPressed_Save_Load_Menu(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     if (e.KeyPressed.ToString() == Save_Anywhere_V2.Save_Utilities.Config_Utilities.key_binding) //if the key is pressed, load my cusom save function
     {
         if (Game1.activeClickableMenu != null)
         {
             return;
         }
         try {
             Save_Anywhere_V2.Save_Utilities.GameUtilities.save_game();
         }
         catch
         {
         }
     }
 }
        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);
            }
        }
示例#3
0
 public void KeyPressed_Save_Load_Menu(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     try
     {
         if (e.KeyPressed.ToString() == Save_Anywhere_V2.Save_Utilities.Config_Utilities.key_binding) //if the key is pressed, load my cusom save function
         {
             if (Game1.activeClickableMenu != null)
             {
                 return;
             }
             try
             {
                 Save_Anywhere_V2.Save_Utilities.GameUtilities.save_game();
             }
             catch (Exception exc)
             {
                 Log.Info(exc);
             }
         }
     }
     catch (Exception ex)
     {
         try
         {
             Newtonsoft.Json.JsonSerializer serializer = new Newtonsoft.Json.JsonSerializer();
             serializer.NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore;
             serializer.TypeNameHandling      = Newtonsoft.Json.TypeNameHandling.All;
             serializer.Formatting            = Newtonsoft.Json.Formatting.Indented;
             serializer.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
             using (StreamWriter sw = new StreamWriter(Path.Combine(Error_Path, "Mod_State.json")))
             {
                 using (Newtonsoft.Json.JsonWriter writer2 = new Newtonsoft.Json.JsonTextWriter(sw))
                 {
                     serializer.Serialize(writer2, this, typeof(Save_Anywhere_V2.Mod_Core));
                 }
             }
         }
         catch (Exception exc)
         {
             Log.Info(exc);
         }
         Stardew_Omegasis_Utilities.Mod.Error_Handling.Log_Error(new List <string>(), ex);
     }
 }
示例#4
0
        private void ShopCall(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
        {
            if (e.KeyPressed.ToString() == "J")
            {
                Log.AsyncC("Mouse Position " + Game1.getMousePosition());
            }

            if (e.KeyPressed.ToString() == "O")
            {
                Game1.activeClickableMenu = new Revitalize.Menus.CarpenterMenu(false);
            }

            // Game1.currentSeason = "spring";
            Game1.player.money = 9999;
            //  Log.AsyncG(Game1.tileSize);

            //Game1.timeOfDay = 2500;
            if (Game1.activeClickableMenu != null)
            {
                return;
            }
            if (e.KeyPressed.ToString() == key_binding)
            {
                List <Item> objShopList  = new List <Item>();
                List <Item> newInventory = new List <Item>();

                TextureDataNode font;
                Dictionaries.spriteFontList.TryGetValue("0", out font);
                objShopList.Add(new TestMachine(3, Vector2.Zero, Util.invertColor(LightColors.White), LightColors.White, false, 9, true));
                objShopList.Add(new SpriteFontObject(0, Vector2.Zero, font.path, Color.White));
                objShopList.Add(new Magic.Alchemy.Objects.BagofHolding(0, Vector2.Zero, new List <List <Item> >()
                {
                    new List <Item>()
                    {
                        Capacity = 6
                    },
                    new List <Item>()
                    {
                        Capacity = 10
                    },
                    new List <Item>()
                    {
                        Capacity = 15
                    }
                }, Color.White));
                //  objShopList.Add(new Spawner(3, Vector2.Zero, 9));
                objShopList.Add(new Light(0, Vector2.Zero, LightColors.Aquamarine, LightColors.Aquamarine, false));
                objShopList.Add(new Quarry(3, Vector2.Zero, 9, "copper"));
                objShopList.Add(new Quarry(3, Vector2.Zero, 9, "iron"));
                objShopList.Add(new Spawner(3, Vector2.Zero, 9));
                // objShopList.Add(new StardewValley.Tools.Raft());
                objShopList.Add(new Decoration(3, Vector2.Zero));
                objShopList.Add(new StardewValley.Object(495, 1));
                objShopList.Add(new StardewValley.Object(496, 1));
                objShopList.Add(new StardewValley.Object(497, 1));
                objShopList.Add(new StardewValley.Object(498, 1));
                objShopList.Add(new StardewValley.Object(770, 1));

                //objShopList.Add(Canvas.addCanvasWithCheck(0, Vector2.Zero, Canvas.blankTexture, null));

                objShopList.Add(new StardewValley.Object(475, 1));
                foreach (var v in objShopList)
                {
                    newInventory.Add(v);
                    //   Log.AsyncG("GRRR");
                }
                objShopList.Add(new GiftPackage(1, "Generic Gift Package", Vector2.Zero, newInventory, 1000, Util.invertColor(LightColors.Orange)));

                // my_shop_list.Add((new Decoration(1120, Vector2.Zero)));
                objShopList.Add(new ExtraSeeds(1, Vector2.Zero));
                objShopList.Add(new ExtraSeeds(2, Vector2.Zero));


                foreach (KeyValuePair <int, Spell> v in Dictionaries.spellList)
                {
                    objShopList.Add(v.Value);
                }

                List <StardewValley.Item> trash = new List <StardewValley.Item>();
                foreach (var v in objShopList)
                {
                    if (v == null)
                    {
                        trash.Add(v);
                    }
                }
                foreach (var v in trash)
                {
                    Log.AsyncC("TRASH");
                    objShopList.Remove(v);
                }

                Game1.activeClickableMenu = new StardewValley.Menus.ShopMenu(objShopList, 0, null);

                if (Game1.player == null)
                {
                    return;
                }
            }


            if (e.KeyPressed.ToString() == key_binding2)
            {
                gametick = true;
            }

            if (e.KeyPressed.ToString() == "J")
            {
                //if(Game1.activeclickablemenu is TitleMenu or CharacterCreationMenu
                if (Game1.player.currentLocation.name != "Farm")
                {
                    Game1.activeClickableMenu = new FarmOptionsMenu();
                }
                else
                {
                    Game1.showRedMessage("Can't change farm map here!");
                }
            }

            if (e.KeyPressed.ToString() == "V")
            {
                newDebris();
            }

            if (e.KeyPressed.ToString() == "U")
            {
                Serialize.cleanUpWorld();
            }

            if (e.KeyPressed.ToString() == "G")
            {
                WeatherDebrisSystem.speedUpWindAndClear(0.001f);
            }

            if (e.KeyPressed.ToString() == "J")
            {
                Log.AsyncC("Player Position " + Game1.player.getTileLocation());
                Log.AsyncC("Mouse Position " + Game1.currentCursorTile);
            }
        }
示例#5
0
 private static void Events_KeyPressed(object o, EventArgsKeyPressed e)
 {
 }