Skip to content

Commit

Permalink
Added AlphaChanged method to controls
Browse files Browse the repository at this point in the history
  • Loading branch information
bittiez committed Feb 9, 2024
1 parent 6efb55d commit 12ead91
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/ClassicUO.Client/Game/UI/Controls/Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public abstract class Control
private Control _parent;
private uint timetoclose = uint.MaxValue;
private bool delayedDispose = false;
private float alpha = 1.0f;

protected Control(Control parent = null)
{
Expand Down Expand Up @@ -126,7 +127,15 @@ public Point Location

public bool IsFocused { get; set; }

public float Alpha { get; set; } = 1.0f;
public float Alpha
{
get => alpha; set
{
float old = alpha;
alpha = value;
AlphaChanged(old, value);
}
}

public List<Control> Children { get; }

Expand Down Expand Up @@ -273,8 +282,6 @@ public void UpdateOffset(int x, int y)
}
}



public virtual bool Draw(UltimaBatcher2D batcher, int x, int y)
{
if (IsDisposed)
Expand Down Expand Up @@ -663,6 +670,13 @@ public virtual void OnHitTestSuccess(int x, int y, ref Control res)
{
}

/// <summary>
/// Invoked when alpha is changed on a control
/// </summary>
/// <param name="oldValue"></param>
/// <param name="newValue"></param>
public virtual void AlphaChanged(float oldValue, float newValue) { };

Check failure on line 678 in src/ClassicUO.Client/Game/UI/Controls/Control.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Semicolon after method or accessor block is not valid

Check failure on line 678 in src/ClassicUO.Client/Game/UI/Controls/Control.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Semicolon after method or accessor block is not valid

public Control GetFirstControlAcceptKeyboardInput()
{
if (_acceptKeyboardInput)
Expand Down

0 comments on commit 12ead91

Please sign in to comment.