Skip to content

Commit

Permalink
Code updated
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurits committed Sep 17, 2020
1 parent 02ab6b7 commit 389d455
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 43 deletions.
5 changes: 5 additions & 0 deletions Simon says/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="dlls"/>
</assemblyBinding>
</runtime>
</configuration>
2 changes: 1 addition & 1 deletion Simon says/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions Simon says/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private void OnCorrectSequence(object sender, CorrectEventArgs e)

private void OnGameOver(object sender, OverEventArgs e)
{
MessageBox.Show("Game over.\nTotal score: " + e.Score.ToString());
MessageBox.Show("Your total score is: " + e.Score.ToString(),"Game over");
this.simonBoard.ScoreTotal = 0;
}

Expand Down Expand Up @@ -225,6 +225,15 @@ private void frmSimon_FormClosing(object sender, FormClosingEventArgs e)
SaveProgramSettings(_programSettings);
}

private void frmSimon_Shown(object sender, EventArgs e)
{
// Send Close event to the splash screen
using (var closeSplashEvent = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.ManualReset, "CloseSplashScreenEvent"))
{
closeSplashEvent.Set();
}
}

private void frmSimon_Resize(object sender, EventArgs e)
{
// Force the client area to be painted again
Expand Down Expand Up @@ -274,7 +283,9 @@ private void toolStripMain_Start_Click(object sender, EventArgs e)
private void toolStripMain_Stop_Click(object sender, EventArgs e)
{
_Game.Stop();
string strScore = simonBoard.ScoreTotal.ToString();
this.simonBoard.Stop();
MessageBox.Show("Your total score is: " + strScore, "Game stopped");
}
private void toolStripMain_Settings_Click(object sender, EventArgs e)
{
Expand Down Expand Up @@ -500,8 +511,8 @@ private void LoadDefaultSettings(ProgramSettings<string, string> settings)
}


#endregion Application settings

#endregion Application settings

}
}
34 changes: 0 additions & 34 deletions Simon says/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -229,38 +229,4 @@
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>143, 17</value>
</metadata>
<data name="simonBoard.DefaultButtonList" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAKMDbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLlNpbmdsZSwgbXNj
b3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdh
NWM1NjE5MzRlMDg5XSxbU3lzdGVtLlN0cmluZywgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3Vs
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBW
ZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0
ZTA4OV1dLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tl
eVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAERTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5MaXN0
YDFbW1N5c3RlbS5WYWx1ZVR1cGxlYDNbW1N5c3RlbS5JbnQzMgMAAAAGX2l0ZW1zBV9zaXplCF92ZXJz
aW9uAwAArAJTeXN0ZW0uVmFsdWVUdXBsZW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GAAAACEZGMDAwMEZGAfn////7////AQAAAAAAg0MGCAAA
AAhGRkZGRkYwMAH3////+////wIAAAAAAMRDBgoAAAAIRkYwMEZGMDAB9f////v///8DAAAAAAClQwYM
AAAACEZGRkYwMDAwAfP////7////BAAAAACAiUMGDgAAAAhGRmM3MTU4NQHx////+////wUAAAAAgIlD
BhAAAAAIRkY4MDAwODAB7/////v///8GAAAAAICJQwYSAAAACEZGOGEyYmUyAe3////7////BwAAAACA
iUMGFAAAAAhGRjBkOThiYQHr////+////wgAAAAAgIlDBhYAAAAIRkY5YWNkMzIB6f////v///8JAAAA
AICJQwYYAAAACEZGZmZhNTAwAef////7////AAAAAAAAAAAKAeb////7////AAAAAAAAAAAKAeX////7
////AAAAAAAAAAAKAeT////7////AAAAAAAAAAAKAeP////7////AAAAAAAAAAAKAeL////7////AAAA
AAAAAAAKCw==
</value>
</data>
</root>
1 change: 1 addition & 0 deletions Simon says/Simon says.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
<Content Include="images\settings.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images\Simon splash.png" />
<Content Include="images\simon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
Binary file added Simon says/images/simon splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions SimonBoard/CustomBoard.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions SimonBoard/CustomBoard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ protected override void OnPaint(PaintEventArgs e)
dc.FillRectangle(solidBrush, rc);

ComputeBoardRectangles();
AlignLabels();

// Draw outer circle
solidBrush = new SolidBrush(_OuterColor);
Expand All @@ -533,6 +534,10 @@ protected override void OnResize(EventArgs e)
base.OnResize(e);

System.Diagnostics.Debug.WriteLine("Board OnResize 1 — Values: "+ String.Join(", ", _buttons.Select(c => c.Value).ToArray()));

// If the window is minimized, there is no need to redraw the board and buttons
if (this.ParentForm == null) return; // There's a resize event before the parent is assigned
if (this.ParentForm.WindowState == FormWindowState.Minimized) return;

//Invalidate();
AlignLabels();
Expand Down Expand Up @@ -639,11 +644,15 @@ private void AlignLabels()
// ComputeBoardRectangles();

// Score text boxes
lblScoreCurrent.Width = Convert.ToInt32(0.9 * _InnerRect.Width);
lblScoreCurrent.Height = Convert.ToInt32(0.2 * lblScoreCurrent.Width);
//lblScoreCurrent.Width = Convert.ToInt32(0.9 * _InnerRect.Width);
//lblScoreCurrent.Height = Convert.ToInt32(0.2 * lblScoreCurrent.Width);
//lblScoreCurrent.Font = new Font(lblScoreCurrent.Font.FontFamily.Name, 0.65f * lblScoreCurrent.Height);
lblScoreCurrent.Font = new Font(lblScoreCurrent.Font.FontFamily.Name, 0.12f * _InnerRect.Width);
lblScoreCurrent.Location = new Point((this.ClientRectangle.Width - lblScoreCurrent.Width) / 2, this.ClientRectangle.Height / 2 - lblScoreCurrent.Height);
lblScoreTotal.Width = Convert.ToInt32(0.9 * _InnerRect.Width);
lblScoreTotal.Height = Convert.ToInt32(0.2 * lblScoreTotal.Width);
//lblScoreTotal.Width = Convert.ToInt32(0.9 * _InnerRect.Width);
//lblScoreTotal.Height = Convert.ToInt32(0.2 * lblScoreTotal.Width);
//lblScoreTotal.Font = new Font(lblScoreTotal.Font.FontFamily.Name, 0.65f * lblScoreTotal.Height);
lblScoreTotal.Font = new Font(lblScoreTotal.Font.FontFamily.Name, 0.12f * _InnerRect.Width);
lblScoreTotal.Location = new Point((this.ClientRectangle.Width - lblScoreTotal.Width) / 2, this.ClientRectangle.Height / 2 );
}

Expand Down Expand Up @@ -687,6 +696,7 @@ public void Stop()
{
_buttons[i].Clicked = false;
}
ScoreTotal = 0;
}
}

Expand Down

0 comments on commit 389d455

Please sign in to comment.