/// <summary> /// This constructor creates the object without defining the bounds. /// It also sets up the following SMAPI event handlers /// <list> /// <item> /// /// <term>Display Rendering HUD</term> /// <description> /// Used to draw the button before the HUD is rendered. /// For more information see <see cref="ButtonToolbarToggle.Display_RenderingHud(object sender, StardewModdingAPI.Events.RenderingHudEventArgs e)">. /// </description> /// /// </item> /// /// <item> /// /// <term>Input Button Pressed</term> /// <description> /// Used to toggle toolbar position when the button is clicked. /// For more information see <see cref="ButtonToolbarToggle.Input_ButtonPressed(object sender, StardewModdingAPI.Events.ButtonPressedEventArgs e)">. /// </description> /// /// </item> /// </list> /// </summary> /// <param name="toolbarOption">This is the <c>Option</c> used to represent the toolbar toggle being either on or off.</param> public ButtonToolbarToggle(Options.Option toolbarOption) { this.ToolbarOption = toolbarOption; ModEntry.Helper.Events.Display.RenderingHud += Display_RenderingHud; ModEntry.Helper.Events.Input.ButtonPressed += Input_ButtonPressed; }
/// <summary> /// Constructor, sets up the following SMAPI events. /// <item> /// /// <term>Menu Changed</term> /// <description> /// Used to enable and disable SMAPI events, as well as get menu information from the base game. /// For more information see <see cref="CustomSort.Display_MenuChanged(object sender, StardewModdingAPI.Events.MenuChangedEventArgs e)">. /// </description> /// /// </item> /// </list> /// </summary> /// <param name="sortOption">This is the <c>Option</c> used to represent the custom sort toggle being either on or off.</param> public CustomSort(Options.Option sortOption) { this.sortOption = sortOption; this.organiseButton = new ClickableTextureComponent("", new Rectangle(0, 0, 64, 64), "", "StarTweaks Organise", Game1.mouseCursors, new Rectangle(162, 440, 16, 16), 4f, false); ModEntry.Helper.Events.Display.MenuChanged += Display_MenuChanged; }
/// <summary> /// Primary constructor, also sets up SMAPI events. /// Sets up the following SMAPI events; /// <list> /// <item> /// /// <term>Game loop Save loaded</term> /// <description> /// Used to replace base toolbar with custom toolbar. /// For more information see <see cref="CustomToolbar.GameLoop_SaveLoaded(object, StardewModdingAPI.Events.SaveLoadedEventArgs)">. /// </description> /// /// </item> /// </list> /// </summary> /// /// <remarks> /// Contains heavy use of SMAPI Reflection, in order to obtain private fields from the base class. /// </remarks> /// /// <param name="toolbarOption">This is the <c>Option</c> used to represent the toolbar toggle being either on or off.</param> public CustomToolbar(Options.Option toolbarOption) : base() { this.toggleButton = new ButtonToolbarToggle(toolbarOption); this.buttonList = ModEntry.Helper.Reflection.GetField <List <ClickableComponent> >(this, "buttons").GetValue(); this.transparency = ModEntry.Helper.Reflection.GetField <float>(this, "transparency").GetValue(); this.hoverItem = ModEntry.Helper.Reflection.GetField <Item>(this, "hoverItem").GetValue(); this.hoverTitle = ModEntry.Helper.Reflection.GetField <string>(this, "hoverTitle").GetValue(); ModEntry.Helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded; }
public Portefeuille(double[] spot, double[] deltas, Portefeuille pfPrec, double r, Options.Option option, int date) { // Constructeur qui crée un portefeuille rebalancé this.nbActions = deltas.ToList(); this.option = option; double valeurActu = pfPrec.actu(spot, r, pfPrec); this.tauxSansRisque = valeurActu; for (int i = 0; i < deltas.Length; i++) { this.tauxSansRisque -= deltas[i] * spot[i]; } this.date = date; }
public Portefeuille(double prixOption, double[] deltas, double[] spot, Options.Option option, int date) { this.option = option; this.nbActions = new List <double>(deltas); double montantAction = 0; if (deltas.Count() != spot.Count()) { throw new Exception("La taille des actions et des deltas ne correspond pas !"); } for (int i = 0; i < deltas.Count(); i++) { montantAction += deltas[i] * spot[i]; } this.date = date; tauxSansRisque = prixOption - montantAction; }
public DataHisto(Options.Option option) { this.option = option; }
/// <summary> /// This constructor is used when the full arguments are given. /// Calls the constructor that only takes <paramref name="toolbarOption"/>. /// Note that the width and height of the button is 32x32. /// </summary> /// <param name="toolbarOption">This is the <c>Option</c> used to represent the toolbar toggle being either on or off.</param> /// <param name="x">This is the x position the button is being initalised at.</param> /// <param name="y">This is the y position the button is being initalised at.</param> public ButtonToolbarToggle(Options.Option toolbarOption, int x, int y) : this(toolbarOption) { this.Bounds = new Rectangle(x, y, 32, 32); }
public void Initialize() { option1 = new Options.Option(100, 100, new Point(3, 4)); option2 = new Options.Option(200, 100, new Point(3, 4)); }
public DataSimu(Options.Option option) { this.option = option; }