コード例 #1
0
 /// <summary>Add a Check Input Handler to a machine</summary>
 /// <param name="machineId">Id of the machine that this should handle</param>
 /// <param name="inputHandler">The Input Handler that returns whether or not to accept an input Func(StardewValley.Object dropIn, StardewValley.Object machine, string machineid)</param>
 public void setInputHandler(string machineId, Func <StardewValley.Object, StardewValley.Object, string, bool> inputHandler)
 {
     if (CustomFarmingReduxMod.machineHandlers.ContainsKey(machineId))
     {
         CustomFarmingReduxMod.machineHandlers[machineId].CheckInput = inputHandler;
     }
     else
     {
         MachineHandler handler = new MachineHandler(null, inputHandler, null);
         CustomFarmingReduxMod.machineHandlers.AddOrReplace(machineId, handler);
     }
 }
コード例 #2
0
 /// <summary>Add Click Action Handler to a machine</summary>
 /// <param name="machineId">Id of the machine that this should handle</param>
 /// <param name="clickHandler">The Action invoked when clicking the machine Action(StardewValley.Object machine)</param>
 public void setClickHandler(string machineId, Action <StardewValley.Object> clickHandler)
 {
     if (CustomFarmingReduxMod.machineHandlers.ContainsKey(machineId))
     {
         CustomFarmingReduxMod.machineHandlers[machineId].ClickAction = clickHandler;
     }
     else
     {
         MachineHandler handler = new MachineHandler(null, null, clickHandler);
         CustomFarmingReduxMod.machineHandlers.AddOrReplace(machineId, handler);
     }
 }
コード例 #3
0
 /// <summary>Add an Output Handler to a machine</summary>
 /// <param name="machineId">Id of the machine that this should handle</param>
 /// <param name="outputHandler">The Output Handler that returns the output Func(StardewValley.Object dropIn, StardewValley.Object machine, string machineid, string recipeName)</param>
 public void setOutputHandler(string machineId, Func <StardewValley.Object, StardewValley.Object, string, string, StardewValley.Object> outputHandler)
 {
     if (CustomFarmingReduxMod.machineHandlers.ContainsKey(machineId))
     {
         CustomFarmingReduxMod.machineHandlers[machineId].GetOutput = outputHandler;
     }
     else
     {
         MachineHandler handler = new MachineHandler(outputHandler, null, null);
         CustomFarmingReduxMod.machineHandlers.AddOrReplace(machineId, handler);
     }
 }