Example #1
0
        /// <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();
            }
        }
Example #2
0
        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());
 }
Example #6
0
File: Ties.cs Project: hnjm/NetLib
 protected void TriggerChange()
 => ChangedValue?.Invoke(this);
Example #7
0
File: Camera.cs Project: tivtag/Fly
 private void OnPositionChanged(object sender, ChangedValue <Atom.Math.Vector2> e)
 {
     this.RefreshView();
 }
Example #8
0
 public void IfValueIsChanged(int a, int b) => ChangedValue?.Invoke(this, new IfChanged(a, b));