refactor: removed noise from class names

This commit is contained in:
2025-07-09 22:21:01 +03:00
parent cd66eeeeef
commit 9bf6cabe23
13 changed files with 56 additions and 101 deletions

View File

@@ -0,0 +1,34 @@
using Microsoft.Xna.Framework.Graphics;
using Syntriax.Engine.Core;
using Syntriax.Engine.Integration.MonoGame;
namespace Pong.Behaviours;
public class ScoreLabel(bool IsLeft) : Label, IFirstFrameUpdate
{
public readonly bool IsLeft = IsLeft;
private PongManager pongManager = null!;
public void FirstActiveFrame()
{
MonoGameWindow monoGameWindow = Universe.FindRequiredBehaviour<MonoGameWindowContainer>().Window;
Font = monoGameWindow.Content.Load<SpriteFont>("UbuntuMono");
pongManager = Universe.FindRequiredBehaviour<PongManager>();
pongManager.OnScoreUpdated += UpdateScores;
pongManager.OnReset += UpdateScores;
UpdateScores(pongManager);
}
private void UpdateScores(PongManager pongManager)
{
if (IsLeft)
Text = pongManager.ScoreLeft.ToString();
else
Text = pongManager.ScoreRight.ToString();
}
}