diff --git a/Crossword.Parser/ParseCrosswordData.cs b/Crossword.Parser/ParseCrosswordData.cs index c3b0792..c75d21e 100644 --- a/Crossword.Parser/ParseCrosswordData.cs +++ b/Crossword.Parser/ParseCrosswordData.cs @@ -1,6 +1,6 @@ -using System; -using Crossword.Entities; + using Crossword.Entities; + namespace Crossword.Parser; public sealed partial class CrosswordParser diff --git a/Crossword.UI/DrawCreditsLabel.cs b/Crossword.UI/DrawCreditsLabel.cs index b806e7d..a69240e 100644 --- a/Crossword.UI/DrawCreditsLabel.cs +++ b/Crossword.UI/DrawCreditsLabel.cs @@ -20,22 +20,30 @@ public static partial class CrosswordUI /// 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 diff --git a/Crossword.UI/DrawCrosswordScore.cs b/Crossword.UI/DrawCrosswordScore.cs index 7c971f4..9a998e1 100644 --- a/Crossword.UI/DrawCrosswordScore.cs +++ b/Crossword.UI/DrawCrosswordScore.cs @@ -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 } \ No newline at end of file