Ejemplo n.º 1
0
        private static void Events_LoadContent(object o, EventArgs e)
        {
            Log.AsyncY("Initializing Debug Assets...");
            DebugPixel = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            DebugPixel.SetData(new[] { Color.White });

#if DEBUG
            StardewModdingAPI.Log.Async("REGISTERING BASE CUSTOM ITEM");
            SObject so = new SObject();
            so.Name         = "Mario Block";
            so.CategoryName = "SMAPI Test Mod";
            so.Description  = "It's a block from Mario!\nLoaded in realtime by SMAPI.";
            so.Texture      = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(_modContentPaths[0] + "\\Test.png", FileMode.Open));
            so.IsPassable   = true;
            so.IsPlaceable  = true;
            StardewModdingAPI.Log.Async("REGISTERED WITH ID OF: " + SGame.RegisterModItem(so));

            //StardewModdingAPI.Log.Async("REGISTERING SECOND CUSTOM ITEM");
            //SObject so2 = new SObject();
            //so2.Name = "Mario Painting";
            //so2.CategoryName = "SMAPI Test Mod";
            //so2.Description = "It's a painting of a creature from Mario!\nLoaded in realtime by SMAPI.";
            //so2.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(_modContentPaths[0] + "\\PaintingTest.png", FileMode.Open));
            //so2.IsPassable = true;
            //so2.IsPlaceable = true;
            //StardewModdingAPI.Log.Async("REGISTERED WITH ID OF: " + SGame.RegisterModItem(so2));

            Command.CallCommand("load");
#endif
        }
Ejemplo n.º 2
0
        public static void ConsoleInputThread()
        {
            string input = string.Empty;

            while (true)
            {
                Command.CallCommand(Console.ReadLine());
            }
        }
Ejemplo n.º 3
0
        public static void ConsoleInputThread()
        {
            var input = string.Empty;

            while (!ready)
            {
                ;
            }
            //SDV is running
            Log.AsyncY("SDV Loaded Into Memory");

            //Create definition to listen for input
            Log.AsyncY("Initializing Console Input Thread...");

            // The only command in the API (at least it should be, for now)
            Command.RegisterCommand("help", "Lists all commands | 'help <cmd>' returns command description").CommandFired += help_CommandFired;
            //Command.RegisterCommand("crash", "crashes sdv").CommandFired += delegate { Game1.player.draw(null); };

            //Subscribe to events
            ControlEvents.KeyPressed += Events_KeyPressed;
            GameEvents.LoadContent   += Events_LoadContent;
            //Events.MenuChanged += Events_MenuChanged; //Idk right now

            Log.AsyncY("Applying Final SDV Tweaks...");
            //Game's in memory now, send the event
            Log.AsyncY("Game Loaded");
            GameEvents.InvokeGameLoaded();

            Log.AsyncY("Type 'help' for help, or 'help <cmd>' for a command's usage");
            while (true)
            {
                var cmds = Console.ReadLine();
                if (cmds != null)
                {
                    Command.CallCommand(cmds);
                }
            }
        }
Ejemplo n.º 4
0
 public static void CallCommand(string input)
 {
     Program.DeprecationManager.Warn($"an old version of {nameof(Command)}.{nameof(Command.CallCommand)}", "1.1", DeprecationLevel.Notice);
     Command.CallCommand(input, Program.GetLegacyMonitorForMod());
 }