Esempio n. 1
0
        public void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
        {
            if (Game1.player == null)
            {
                return;
            }
            if (Game1.player.currentLocation == null)
            {
                return;
            }
            if (game_loaded == false)
            {
                return;
            }

            if (e.KeyPressed.ToString() == key_binding) //if the key is pressed, load my cusom save function
            {
                if (Game1.activeClickableMenu != null)
                {
                    return;
                }
                else
                {
                    Game1.activeClickableMenu = new Collections_Buy_Back(Game1.viewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2);
                }
            }
        }
Esempio n. 2
0
 private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     if (e.KeyPressed.ToString() == config.modularMenuKey && Game1.activeClickableMenu == null)
     {
         //Game1.activeClickableMenu = new ModularGameMenu(0);
     }
 }
Esempio n. 3
0
 public void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     if (Game1.player == null)
     {
         return;
     }
     if (Game1.player.currentLocation == null)
     {
         return;
     }
     if (game_loaded == false)
     {
         return;
     }
     if (has_input_birthday == true)
     {
         return;
     }
     if (e.KeyPressed.ToString() == key_binding) //if the key is pressed, load my cusom save function
     {
         if (Game1.activeClickableMenu != null)
         {
             return;
         }
         Game1.activeClickableMenu = new StardewValley.Menus.Birthday_Menu();
     }
     //DataLoader_Settings(); //update the key if players changed it while playing.
 }
Esempio n. 4
0
        public void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
        {
            if (Game1.player == null)
            {
                return;
            }
            if (Game1.player.currentLocation == null)
            {
                return;
            }
            if (game_loaded == false)
            {
                return;
            }

            if (e.KeyPressed.ToString() == key_binding) //if the key is pressed, load my cusom save function
            {
                if (Game1.activeClickableMenu != null)
                {
                    return;
                }
                if (StardewValley.Game1.player.currentLocation.name == "ArchaeologyHouse")
                {
                    Game1.activeClickableMenu = new StardewValley.Menus.MuseumMenu();
                }
                else
                {
                    Log.Info("You can't rearrange the museum here!");
                }
            }
        }
 /// <summary>
 /// Fires when a key is pressed to open the music selection menu.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     if (e.KeyPressed.ToString() == Config.KeyBinding && Game1.activeClickableMenu == null)
     {
         Game1.activeClickableMenu = new Framework.Menus.MusicManagerMenu(Game1.viewport.Width, Game1.viewport.Height);
     }
 }
 private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.O)
     {
         Game1.activeClickableMenu = new StardewSymphonyRemastered.Framework.Menus.MusicManagerMenu(Game1.viewport.Width, Game1.viewport.Height);
     }
 }
Esempio n. 7
0
 public void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     //DataLoader_Settings(); //update the key if players changed it while playing.
     if (e.KeyPressed.ToString() == key_binding) //if the key is pressed, load my cusom save function
     {
         my_save();
     }
 }
Esempio n. 8
0
 private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     /*
      *  if (e.KeyPressed==Microsoft.Xna.Framework.Input.Keys.K)
      *  {
      *      //multiplayer.sendMessage(Framework.Features.Stardew.MessageFeatures.FSTRING_SendHUDMessageWithIcon, MessagesExtentions.HUDMessageIconIdentifier, new HUDMessage("My love is like fire",1),Framework.Enums.MessageTypes.messageTypes.SendToSpecific,Game1.otherFarmers.ElementAt(0).Value);
      *  }
      */
 }
Esempio n. 9
0
 private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     if (e.KeyPressed == Keys.U)
     {
         List <Item> shopInventory         = new List <Item>();
         string      ModdedCropsFolderName = "RuneFactoryCropsMod";
         shopInventory.Add((Item) new ModularSeeds(1, Path.Combine(ModdedCropsFolderName, "SeedsGraphics.xnb"), Path.Combine(ModdedCropsFolderName, "SeedsData.xnb"), Path.Combine(ModdedCropsFolderName, "CropsGraphics.xnb"), Path.Combine(ModdedCropsFolderName, "CropsData.xnb"), Path.Combine(ModdedCropsFolderName, "CropsObjectTexture.xnb"), Path.Combine(ModdedCropsFolderName, "CropsObjectData.xnb"))
         {
             stack = 5
         });
         shopInventory.Add((Item) new PlanterBox(1, Vector2.Zero, Path.Combine(ModdedCropsFolderName, "PlanterBox.png"), Path.Combine(ModdedCropsFolderName, "PlanterBox.xnb")));
         shopInventory.Add((Item) new ModularCropObject(816, 1, Path.Combine(ModdedCropsFolderName, "CropsObjectTexture.xnb"), Path.Combine(ModdedCropsFolderName, "CropsObjectData.xnb")));
         Game1.activeClickableMenu = new StardewValley.Menus.ShopMenu(shopInventory);
     }
 }
        private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
        {
            if (!Context.IsWorldReady)
            {
                return;
            }

            // place fully grown crops to test harvesting capabilities
            if (e.KeyPressed == Keys.B)
            {
                if (Game1.player.ActiveObject == null || (Game1.player.ActiveObject != null && Game1.player.ActiveObject.category != StardewValley.Object.SeedsCategory))
                {
                    Game1.showRedMessage("Please select a seed as your active object.");
                    return;
                }
                else
                {
                    int seedIndex = Game1.player.ActiveObject.parentSheetIndex;

                    for (int tileX = 0; tileX < Game1.currentLocation.map.Layers[0].LayerWidth; ++tileX)
                    {
                        for (int tileY = 0; tileY < Game1.currentLocation.map.Layers[0].LayerHeight; ++tileY)
                        {
                            if (Game1.currentLocation.doesTileHaveProperty(tileX, tileY, "Diggable", "Back") != null)
                            {
                                Vector2 key = new Vector2(tileX, tileY);
                                Game1.currentLocation.makeHoeDirt(key);

                                if (Game1.currentLocation.terrainFeatures.ContainsKey(key))
                                {
                                    HoeDirt dirt = Game1.currentLocation.terrainFeatures[key] as HoeDirt;
                                    if (dirt != null /* && dirt.canPlantThisSeedHere(seedIndex, tileX, tileY)*/)
                                    {
                                        dirt.plant(seedIndex, tileX, tileY, Game1.player);
                                        dirt.crop.growCompletely();
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (e.KeyPressed == Keys.Z)
            {
                this.Monitor.Log($"Your location: ({Game1.player.getTileLocationPoint()})");
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Example for running code. Can call code whenever such as at a certain time of day, event, action occured, etc. This one uses key presses.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
 {
     if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.J)
     {
         mySoundManager.playSound("sound1");
     }
     if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.K)
     {
         mySoundManager.stopSound("sound1");
     }
     if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.L)
     {
         mySoundManager.pauseSound("sound1");
     }
     if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.O)
     {
         mySoundManager.resumeSound("sound1");
     }
 }
Esempio n. 12
0
        private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
        {
            //   FieldInfo f = Game1.activeClickableMenu.GetType().GetField("subMenu", BindingFlags.NonPublic | BindingFlags.Instance);
            //Log.AsyncG(l.GetType());
            //  Game1.activeClickableMenu.GetType().GetProperty("subMenu").GetValue(Game1.activeClickableMenu, null);

            /*
             * MethodInfo dynMethod = l.GetType().GetMethod("receiveScrollWheelAction",
             * BindingFlags.Public | BindingFlags.Instance);
             *
             * dynMethod.Invoke(l, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Public, null, new object[] { -1 }, null);
             */


            if (e.KeyPressed.ToString() == "R")
            {
                changeSubMenuTitleScreen();
            }
        }
Esempio n. 13
0
        public void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
        {
            if (Game1.player == null)
            {
                return;
            }
            if (Game1.player.currentLocation == null)
            {
                return;
            }
            if (game_loaded == false)
            {
                return;
            }

            if (e.KeyPressed.ToString() == key_binding) //if the key is pressed, load my cusom save function
            {
                if (Game1.activeClickableMenu != null)
                {
                    return;
                }
                my_menu();
            }
        }
Esempio n. 14
0
        private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
        {
            //J key for shop
            #region
            if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.J)
            {
                CoreMonitor.Log("OK THE J KEY WAS PRESSED!");
                List <Item> shoppingList          = new List <Item>();
                StarAI.PathFindingCore.TileNode t = new StarAI.PathFindingCore.TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.ColorsList.Aqua));
                if (t == null)
                {
                    CoreMonitor.Log("WTF?????");
                }
                try
                {
                    if (t == null)
                    {
                        return;
                    }
                    shoppingList.Add((Item)t);
                    Game1.activeClickableMenu = new StardewValley.Menus.ShopMenu(shoppingList);
                }
                catch (Exception err)
                {
                    CoreMonitor.Log(Convert.ToString(err));
                }
            }
            #endregion

            //K key for placing a tile.
            #region
            if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.K)
            {
                CoreMonitor.Log("OK THE K KEY WAS PRESSED!");

                StarAI.PathFindingCore.TileNode t = new StarAI.PathFindingCore.TileNode(1, Vector2.Zero, Path.Combine("Tiles", "GenericUncoloredTile.xnb"), Path.Combine("Tiles", "TileData.xnb"), StardustCore.IlluminateFramework.Colors.randomColor());
                if (t == null)
                {
                    CoreMonitor.Log("WTF?????");
                }
                try
                {
                    if (t == null)
                    {
                        return;
                    }
                    CoreMonitor.Log(new Vector2(Game1.player.getTileX() * Game1.tileSize, Game1.player.getTileY() * Game1.tileSize).ToString());

                    int       xPos = (int)(Game1.player.getTileX()) * Game1.tileSize;
                    int       yPos = (int)(Game1.player.getTileY()) * Game1.tileSize;
                    Rectangle r    = new Rectangle(xPos, yPos, Game1.tileSize, Game1.tileSize);
                    Vector2   pos  = new Vector2(r.X, r.Y);
                    bool      ok   = StarAI.PathFindingCore.TileNode.checkIfICanPlaceHere(t, pos, Game1.player.currentLocation);
                    if (ok == false)
                    {
                        return;
                    }
                    t.placementAction(Game1.currentLocation, Game1.player.getTileX() * Game1.tileSize, Game1.player.getTileY() * Game1.tileSize);
                    //t.setAdjacentTiles(true);
                }
                catch (Exception err)
                {
                    CoreMonitor.Log(Convert.ToString(err));
                }
            }
            #endregion

            if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.U)
            {
                ExecutionCore.TaskList.printAllTaskMetaData();
            }

            if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.O)
            {
                foreach (var v in Game1.player.currentLocation.map.TileSheets)
                {
                    foreach (var q in Game1.player.currentLocation.map.Layers)
                    {
                        string[] s     = q.ToString().Split(':');
                        string   layer = s[1].Trim();
                        if (Game1.player.currentLocation.map.GetLayer(layer) == null)
                        {
                            ModCore.CoreMonitor.Log("SHITTTTTT: " + layer, LogLevel.Error);
                        }
                        int tileIndex = Game1.player.currentLocation.getTileIndexAt((int)Game1.player.getTileX() / Game1.tileSize, (int)Game1.player.getTileY() / Game1.tileSize, layer);
                        if (tileIndex == -1)
                        {
                            continue;
                        }
                        //ModCore.CoreMonitor.Log("Position: " + (Game1.player.getTileLocation() / Game1.tileSize).ToString(), LogLevel.Warn);
                        //ModCore.CoreMonitor.Log("Layer: " + layer, LogLevel.Warn);
                        //ModCore.CoreMonitor.Log("Index: " + tileIndex.ToString(), LogLevel.Warn);
                        //ModCore.CoreMonitor.Log("Image Source: " + v.ImageSource, LogLevel.Warn);

                        if (layer == "Buildings")
                        {
                            TileExceptionNode tileException = new TileExceptionNode(v.ImageSource, tileIndex);
                            foreach (var tile in PathFindingCore.Utilities.ignoreCheckTiles)
                            {
                                if (tile.imageSource == tileException.imageSource && tile.index == tileException.index)
                                {
                                    ModCore.CoreMonitor.Log("Tile exception already initialized!");
                                    return; //tile is already initialized.
                                }
                            }
                            PathFindingCore.Utilities.ignoreCheckTiles.Add(tileException);
                            tileException.serializeJson(Path.Combine(ModCore.CoreHelper.DirectoryPath, PathFindingCore.Utilities.folderForExceptionTiles));
                            //StardustCore.ModCore.SerializationManager.
                        }
                    }
                }
            }
        }