Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronSaikovski committed Apr 4, 2024
1 parent d7810de commit 6d60024
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 53 deletions.
4 changes: 2 additions & 2 deletions Crossword.Parser/ParseCrosswordData.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Crossword.Entities;

using Crossword.Entities;

namespace Crossword.Parser;

public sealed partial class CrosswordParser
Expand Down
40 changes: 24 additions & 16 deletions Crossword.UI/DrawCreditsLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,30 @@ public static partial class CrosswordUI
/// <param name="labelFont"></param>
public static void DrawCreditsLabel(Panel mainPanel, Label creditsLabel, int posLeft, int posBottom, DynamicSpriteFont labelFont)
{
try
{
//Max score label
mainPanel.Widgets.Remove(creditsLabel);
creditsLabel.Text = GameConstants.CreditsText;
creditsLabel.TextColor = UIConstants.CreditsColor;
creditsLabel.Left = posLeft;
creditsLabel.Font = labelFont;
creditsLabel.Top = posBottom + UIConstants.ClListSpacer + UIConstants.SquareHeight + UIConstants.SquareHeight/2;
mainPanel.Widgets.Add(creditsLabel);

}
catch (Exception ex)
{
throw;
}
// try
// {
// //Max score label
// mainPanel.Widgets.Remove(creditsLabel);
// creditsLabel.Text = GameConstants.CreditsText;
// creditsLabel.TextColor = UIConstants.CreditsColor;
// creditsLabel.Left = posLeft;
// creditsLabel.Font = labelFont;
// creditsLabel.Top = posBottom + UIConstants.ClListSpacer + UIConstants.SquareHeight + UIConstants.SquareHeight/2;
// mainPanel.Widgets.Add(creditsLabel);
//
// }
// catch (Exception ex)
// {
// throw;
// }
//Max score label
mainPanel.Widgets.Remove(creditsLabel);
creditsLabel.Text = GameConstants.CreditsText;
creditsLabel.TextColor = UIConstants.CreditsColor;
creditsLabel.Left = posLeft;
creditsLabel.Font = labelFont;
creditsLabel.Top = posBottom + UIConstants.ClListSpacer + UIConstants.SquareHeight + UIConstants.SquareHeight/2;
mainPanel.Widgets.Add(creditsLabel);
}

#endregion
Expand Down
102 changes: 67 additions & 35 deletions Crossword.UI/DrawCrosswordScore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,77 @@ public static partial class CrosswordUI
/// Draws the crossword score and updates the values
public static void DrawCrosswordScore(Panel mainPanel, Label currentScoreLabel, Label maxScoreLabel, bool isFinished, int crosswordScore, int numQuestions, DynamicSpriteFont labelFont, int posBottom)
{
try
{
if (!isFinished)
{
//Current score label
mainPanel.Widgets.Remove(currentScoreLabel);
currentScoreLabel.Text = $"Your Score: {crosswordScore.ToString()}";
currentScoreLabel.TextColor = UIConstants.ScoreColor;
currentScoreLabel.Left = UIConstants.ClListSpacer * 40;
currentScoreLabel.Font = labelFont;
currentScoreLabel.Top = posBottom + UIConstants.ClListSpacer * 2;
mainPanel.Widgets.Add(currentScoreLabel);
}
else
{
//Game over label
mainPanel.Widgets.Remove(currentScoreLabel);
currentScoreLabel.Text = "GAME OVER!";
currentScoreLabel.TextColor = UIConstants.ScoreColor;
currentScoreLabel.Left = UIConstants.ClListSpacer * 40;
currentScoreLabel.Font = labelFont;
currentScoreLabel.Top = posBottom + UIConstants.ClListSpacer * 2;
mainPanel.Widgets.Add(currentScoreLabel);
}

//Max score label
mainPanel.Widgets.Remove(maxScoreLabel);
maxScoreLabel.Text = $"Max Score: {numQuestions.ToString()}";
maxScoreLabel.TextColor = UIConstants.ScoreColor;
maxScoreLabel.Left = UIConstants.ClListSpacer * 40;
maxScoreLabel.Font = labelFont;
maxScoreLabel.Top = posBottom + UIConstants.ClListSpacer * 6;
mainPanel.Widgets.Add(maxScoreLabel);
// try
// {
// if (!isFinished)
// {
// //Current score label
// mainPanel.Widgets.Remove(currentScoreLabel);
// currentScoreLabel.Text = $"Your Score: {crosswordScore.ToString()}";
// currentScoreLabel.TextColor = UIConstants.ScoreColor;
// currentScoreLabel.Left = UIConstants.ClListSpacer * 40;
// currentScoreLabel.Font = labelFont;
// currentScoreLabel.Top = posBottom + UIConstants.ClListSpacer * 2;
// mainPanel.Widgets.Add(currentScoreLabel);
// }
// else
// {
// //Game over label
// mainPanel.Widgets.Remove(currentScoreLabel);
// currentScoreLabel.Text = "GAME OVER!";
// currentScoreLabel.TextColor = UIConstants.ScoreColor;
// currentScoreLabel.Left = UIConstants.ClListSpacer * 40;
// currentScoreLabel.Font = labelFont;
// currentScoreLabel.Top = posBottom + UIConstants.ClListSpacer * 2;
// mainPanel.Widgets.Add(currentScoreLabel);
// }
//
// //Max score label
// mainPanel.Widgets.Remove(maxScoreLabel);
// maxScoreLabel.Text = $"Max Score: {numQuestions.ToString()}";
// maxScoreLabel.TextColor = UIConstants.ScoreColor;
// maxScoreLabel.Left = UIConstants.ClListSpacer * 40;
// maxScoreLabel.Font = labelFont;
// maxScoreLabel.Top = posBottom + UIConstants.ClListSpacer * 6;
// mainPanel.Widgets.Add(maxScoreLabel);
//
// }
// catch (Exception ex)
// {
// throw;
// }

if (!isFinished)
{
//Current score label
mainPanel.Widgets.Remove(currentScoreLabel);
currentScoreLabel.Text = $"Your Score: {crosswordScore.ToString()}";
currentScoreLabel.TextColor = UIConstants.ScoreColor;
currentScoreLabel.Left = UIConstants.ClListSpacer * 40;
currentScoreLabel.Font = labelFont;
currentScoreLabel.Top = posBottom + UIConstants.ClListSpacer * 2;
mainPanel.Widgets.Add(currentScoreLabel);
}
catch (Exception ex)
else
{
throw;
//Game over label
mainPanel.Widgets.Remove(currentScoreLabel);
currentScoreLabel.Text = "GAME OVER!";
currentScoreLabel.TextColor = UIConstants.ScoreColor;
currentScoreLabel.Left = UIConstants.ClListSpacer * 40;
currentScoreLabel.Font = labelFont;
currentScoreLabel.Top = posBottom + UIConstants.ClListSpacer * 2;
mainPanel.Widgets.Add(currentScoreLabel);
}

//Max score label
mainPanel.Widgets.Remove(maxScoreLabel);
maxScoreLabel.Text = $"Max Score: {numQuestions.ToString()}";
maxScoreLabel.TextColor = UIConstants.ScoreColor;
maxScoreLabel.Left = UIConstants.ClListSpacer * 40;
maxScoreLabel.Font = labelFont;
maxScoreLabel.Top = posBottom + UIConstants.ClListSpacer * 6;
mainPanel.Widgets.Add(maxScoreLabel);
}
#endregion
}

0 comments on commit 6d60024

Please sign in to comment.