Exemplo n.º 1
0
 /*********
 ** Public methods
 *********/
 /****
 ** Constructors
 ****/
 /// <summary>Construct an instance.</summary>
 /// <param name="metadata">Provides metadata that's not available from the game data directly.</param>
 /// <param name="translations">Provides translations stored in the mod folder.</param>
 /// <param name="reflection">Simplifies access to private game code.</param>
 /// <param name="customFarming">Handles the logic for integrating with the Custom Farming Redux mod.</param>
 public TargetFactory(Metadata metadata, ITranslationHelper translations, IReflectionHelper reflection, CustomFarmingReduxIntegration customFarming)
 {
     this.Metadata      = metadata;
     this.Translations  = translations;
     this.Reflection    = reflection;
     this.CustomFarming = customFarming;
 }
Exemplo n.º 2
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="customFarmingRedux">The Custom Farming Redux integration.</param>
 /// <param name="producerFrameworkMod">The Producer Framework Mod integration.</param>
 /// <param name="metadata">Provides metadata that's not available from the game data directly.</param>
 public GameHelper(CustomFarmingReduxIntegration customFarmingRedux, ProducerFrameworkModIntegration producerFrameworkMod, Metadata metadata)
 {
     this.DataParser           = new DataParser(this);
     this.CustomFarmingRedux   = customFarmingRedux;
     this.ProducerFrameworkMod = producerFrameworkMod;
     this.Metadata             = metadata;
 }
Exemplo n.º 3
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="customFarmingRedux">The Custom Farming Redux integration.</param>
 /// <param name="producerFrameworkMod">The Producer Framework Mod integration.</param>
 /// <param name="metadata">Provides metadata that's not available from the game data directly.</param>
 /// <param name="reflection">Simplifies access to protected code.</param>
 public GameHelper(CustomFarmingReduxIntegration customFarmingRedux, ProducerFrameworkModIntegration producerFrameworkMod, Metadata metadata, IReflectionHelper reflection)
 {
     this.DataParser           = new DataParser(this);
     this.CustomFarmingRedux   = customFarmingRedux;
     this.ProducerFrameworkMod = producerFrameworkMod;
     this.Metadata             = metadata;
     this.WorldItemScanner     = new WorldItemScanner(reflection);
 }
Exemplo n.º 4
0
        /*********
        ** Private methods
        *********/
        /****
        ** Event handlers
        ****/
        /// <summary>The method invoked on the first update tick, once all mods are initialised.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            if (!this.IsDataValid)
            {
                return;
            }

            // initialise functionality
            var customFarming = new CustomFarmingReduxIntegration(this.Helper.ModRegistry, this.Monitor);

            this.GameHelper     = new GameHelper(customFarming);
            this.TargetFactory  = new TargetFactory(this.Metadata, this.Helper.Translation, this.Helper.Reflection, this.GameHelper);
            this.DebugInterface = new DebugInterface(this.GameHelper, this.TargetFactory, this.Config, this.Monitor);
        }
Exemplo n.º 5
0
        /*********
        ** Private methods
        *********/
        /****
        ** Event handlers
        ****/
        /// <summary>The method invoked on the first update tick, once all mods are initialized.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            if (!this.IsDataValid)
            {
                return;
            }

            // get mod APIs
            JsonAssetsIntegration jsonAssets = new JsonAssetsIntegration(this.Helper.ModRegistry, this.Monitor);

            // initialize functionality
            var customFarming     = new CustomFarmingReduxIntegration(this.Helper.ModRegistry, this.Monitor);
            var producerFramework = new ProducerFrameworkModIntegration(this.Helper.ModRegistry, this.Monitor);

            this.GameHelper     = new GameHelper(customFarming, producerFramework, this.Metadata);
            this.TargetFactory  = new TargetFactory(this.Helper.Reflection, this.GameHelper, jsonAssets, new SubjectFactory(this.Metadata, this.Helper.Translation, this.Helper.Reflection, this.GameHelper, this.Config));
            this.DebugInterface = new DebugInterface(this.GameHelper, this.TargetFactory, this.Config, this.Monitor);
        }
Exemplo n.º 6
0
        /*********
        ** Private methods
        *********/
        /****
        ** Event handlers
        ****/
        /// <summary>The method invoked on the first update tick, once all mods are initialised.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void GameEvents_FirstUpdateTick(object sender, EventArgs e)
        {
            if (!this.IsDataValid)
            {
                return;
            }

            // initialise functionality
            var customFarming = new CustomFarmingReduxIntegration(this.Helper.ModRegistry, this.Monitor);

            this.TargetFactory  = new TargetFactory(this.Metadata, this.Helper.Translation, this.Helper.Reflection, customFarming);
            this.DebugInterface = new DebugInterface(this.TargetFactory, this.Config, this.Monitor);

            // hook up events
            TimeEvents.AfterDayStarted          += this.TimeEvents_AfterDayStarted;
            GraphicsEvents.OnPostRenderHudEvent += this.GraphicsEvents_OnPostRenderHudEvent;
            MenuEvents.MenuClosed     += this.MenuEvents_MenuClosed;
            InputEvents.ButtonPressed += this.InputEvents_ButtonPressed;
            if (this.Config.HideOnKeyUp)
            {
                InputEvents.ButtonReleased += this.InputEvents_ButtonReleased;
            }
        }
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="obj">The underlying in-game object.</param>
 /// <param name="tilePosition">The object's tile position in the current location (if applicable).</param>
 /// <param name="reflection">Simplifies access to private game code.</param>
 /// <param name="customFarming">Handles the logic for integrating with the Custom Farming Redux mod.</param>
 public CustomFarmingObjectTarget(Object obj, Vector2?tilePosition, IReflectionHelper reflection, CustomFarmingReduxIntegration customFarming)
     : base(obj, tilePosition, reflection)
 {
     this.CustomSprite = customFarming.IsLoaded
         ? customFarming.GetTexture(obj)
         : null;
 }
Exemplo n.º 8
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="customFarmingRedux">The Custom Farming Redux integration.</param>
 public GameHelper(CustomFarmingReduxIntegration customFarmingRedux)
 {
     this.DataParser         = new DataParser(this);
     this.CustomFarmingRedux = customFarmingRedux;
 }
Exemplo n.º 9
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="customFarmingRedux">The Custom Farming Redux integration.</param>
 /// <param name="metadata">Provides metadata that's not available from the game data directly.</param>
 public GameHelper(CustomFarmingReduxIntegration customFarmingRedux, Metadata metadata)
 {
     this.DataParser         = new DataParser(this);
     this.CustomFarmingRedux = customFarmingRedux;
     this.Metadata           = metadata;
 }