/// <summary> /// Called when the gold has changed. /// Notifies subscribers when the availability of an upgrade purchase has changed. /// </summary> /// <param name="gold">The changed gold.</param> private void OnGoldChangeHandler(ChangedValue <long> gold) { long cost = settings.GetUpgradeCost(level); if ((gold.OldValue < cost && gold.NewValue >= cost) || (gold.OldValue >= cost && gold.NewValue < cost)) { UpdateButtons(); } }
public static void GetValue(string name, int max, int coun) { ProgressBar progress = new ProgressBar(); progress.MinValue = 0; progress.MaxValue = max; if (max != coun) { progress.CurrentValue = coun; progress.ProgressName = name; progress.ButtonState = false; } else { progress.CurrentValue = 0; progress.ProgressName = ""; progress.ButtonState = true; } ChangedValue?.Invoke(progress); }
/// <summary> /// Gets the jumping text from the given changed value. /// </summary> /// <param name="value">The changed value.</param> /// <returns>The jumping text.</returns> private static string GetJumpingText(ChangedValue <long> value) { var difference = value.NewValue - value.OldValue; return(difference.ToString("+#;-#;0")); // "+#;-#;0" - Its showing the sign next to the value. }
/// <summary> /// Jumps the text of gold. /// </summary> /// <param name="gold">The changed gold.</param> private void JumpTextGold(ChangedValue <long> gold) { var jumpingText = GetJumpingText(gold); jumpingTextFrameResult.Append(jumpingText + "\n"); }
/// <summary> /// Called when [on gold change]. /// </summary> /// <param name="gold">The changed gold.</param> private void OnGoldChangeHandler(ChangedValue <long> gold) { JumpTextGold(gold); UpdateTextGold(gold.NewValue.ToString()); }
protected void TriggerChange() => ChangedValue?.Invoke(this);
private void OnPositionChanged(object sender, ChangedValue <Atom.Math.Vector2> e) { this.RefreshView(); }
public void IfValueIsChanged(int a, int b) => ChangedValue?.Invoke(this, new IfChanged(a, b));