示例#1
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="monitor">Encapsulates monitoring and logging for SMAPI.</param>
        /// <param name="reflection">Simplifies access to private game code.</param>
        /// <param name="eventManager">Manages SMAPI events for mods.</param>
        /// <param name="modHooks">Handles mod hooks provided by the game.</param>
        /// <param name="multiplayer">The core multiplayer logic.</param>
        /// <param name="exitGameImmediately">Immediately exit the game without saving. This should only be invoked when an irrecoverable fatal error happens that risks save corruption or game-breaking bugs.</param>
        /// <param name="onGameContentLoaded">Raised after the game finishes loading its initial content.</param>
        /// <param name="onGameUpdating">Raised when XNA is updating its state (roughly 60 times per second).</param>
        /// <param name="onPlayerInstanceUpdating">Raised when the game instance for a local split-screen player is updating (once per <see cref="OnGameUpdating"/> per player).</param>
        /// <param name="onGameExiting">Raised before the game exits.</param>
        public SGameRunner(Monitor monitor, Reflector reflection, EventManager eventManager, SModHooks modHooks, SMultiplayer multiplayer, Action <string> exitGameImmediately, Action onGameContentLoaded, Action <GameTime, Action> onGameUpdating, Action <SGame, GameTime, Action> onPlayerInstanceUpdating, Action onGameExiting)
        {
            // init XNA
            // @todo Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef;

            // hook into game
            this.ModHooks = modHooks;

            // init SMAPI
            this.Monitor                  = monitor;
            this.Events                   = eventManager;
            this.Reflection               = reflection;
            this.Multiplayer              = multiplayer;
            this.ExitGameImmediately      = exitGameImmediately;
            this.OnGameContentLoaded      = onGameContentLoaded;
            this.OnGameUpdating           = onGameUpdating;
            this.OnPlayerInstanceUpdating = onPlayerInstanceUpdating;
            this.OnGameExiting            = onGameExiting;
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="playerIndex">The player index.</param>
 /// <param name="instanceIndex">The instance index.</param>
 /// <param name="monitor">Encapsulates monitoring and logging for SMAPI.</param>
 /// <param name="reflection">Simplifies access to private game code.</param>
 /// <param name="eventManager">Manages SMAPI events for mods.</param>
 /// <param name="input">Manages the game's input state.</param>
 /// <param name="modHooks">Handles mod hooks provided by the game.</param>
 /// <param name="multiplayer">The core multiplayer logic.</param>
 /// <param name="exitGameImmediately">Immediately exit the game without saving. This should only be invoked when an irrecoverable fatal error happens that risks save corruption or game-breaking bugs.</param>
 /// <param name="onUpdating">Raised when the instance is updating its state (roughly 60 times per second).</param>
 internal void PreInitialize(PlayerIndex playerIndex, int instanceIndex, Monitor monitor, Reflector reflection, EventManager eventManager, SInputState input, SModHooks modHooks, SMultiplayer multiplayer, Action <string> exitGameImmediately, Action onInitialized, Action onContentLoaded, Action <SGame, GameTime, Action> onUpdating, Action <SGame, GameTime, Action> onPlayerInstanceUpdating)
 {
     this.OnInitialized            = onInitialized;
     this.OnContentLoaded          = onContentLoaded;
     this.OnUpdating               = onUpdating;
     this.OnPlayerInstanceUpdating = onPlayerInstanceUpdating;
 }