Skip to content

Commit

Permalink
1.2.3.0 Pause timer when game window closed
Browse files Browse the repository at this point in the history
  • Loading branch information
hunter2actual committed Dec 7, 2024
1 parent 5f88614 commit 8c4d06c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
8 changes: 4 additions & 4 deletions DalamudMinesweeper.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Author": "hunter2_",
"Name": "Minesweeper",
"InternalName": "DalamudMinesweeper",
"AssemblyVersion": "1.2.2.0",
"AssemblyVersion": "1.2.3.0",
"Description": "Logic puzzle in which you find and flag hidden mines.\n\nLeft click to uncover a square, right click to place a flag.\nThe game ends when all safe squares have been uncovered.\nClick the smiley face to start a new game.",
"ApplicableVersion": "any",
"Tags": [
Expand All @@ -18,9 +18,9 @@
"LoadPriority": 0,
"Punchline": "Classic puzzle game.",
"AcceptsFeedback": true,
"DownloadLinkInstall": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/1.2.2.0/latest.zip",
"DownloadLinkUpdate": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/1.2.2.0/latest.zip",
"DownloadLinkInstall": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/1.2.3.0/latest.zip",
"DownloadLinkUpdate": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/1.2.3.0/latest.zip",
"IconUrl": "https://raw.githubusercontent.com/hunter2actual/DalamudMinesweeper/master/images/icon.png",
"Changelog": "Consider game won when all safe cells revealed, even if not all mines are flagged (thanks cheege)"
"Changelog": "Pause timer when game window closed"
}
]
2 changes: 1 addition & 1 deletion DalamudMinesweeper/DalamudMinesweeper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="Dalamud.Plugin.Bootstrap.targets" />

<PropertyGroup>
<Version>1.2.2.0</Version>
<Version>1.2.3.0</Version>
<Description>A logic puzzle featuring hidden mines.</Description>
<PackageProjectUrl>https://github.com/hunter2actual/DalamudMinesweeper</PackageProjectUrl>
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>
Expand Down
5 changes: 3 additions & 2 deletions DalamudMinesweeper/DalamudMinesweeper.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"Author": "hunter2_",
"Name": "Minesweeper",
"Punchline": "Classic puzzle game.",
"Description": "Logic puzzle in which you find and flag hidden mines. \nLeft click to uncover a square, right click to place a flag. \nClick a number that has the right number of flags to reveal adjacent tiles. \nThe game ends when all mines are flagged and all safe squares have been uncovered. \nClick the smiley face to start a new game.", "ApplicableVersion": "any",
"Tags": [
"Description": "Logic puzzle in which you find and flag hidden mines.\n\nLeft click to uncover a square, right click to place a flag.\nThe game ends when all safe squares have been uncovered.\nClick the smiley face to start a new game.",
"ApplicableVersion": "any",
"Tags": [
"minesweeper",
"minigame",
"puzzle"
Expand Down
11 changes: 11 additions & 0 deletions DalamudMinesweeper/Game/MinesweeperGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,15 @@ public int NumUnflaggedMines()

public int ElapsedGameTime => (int) _stopwatch.Elapsed.TotalSeconds;
public long ElapsedGameTimeMs => _stopwatch.ElapsedMilliseconds;
public void Pause()
{
if (_firstMoveTaken)
_stopwatch.Stop();
}

public void Resume()
{
if (_firstMoveTaken)
_stopwatch.Start();
}
}
12 changes: 12 additions & 0 deletions DalamudMinesweeper/Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ public override void Draw()
_footer.Draw(bottomLeft - _footerHeightPxVec2);
}

public override void OnClose()
{
_game.Pause();
base.OnClose();
}

public override void OnOpen()
{
_game.Resume();
base.OnOpen();
}

private MinesweeperGame InitialiseGame()
{
_game = new MinesweeperGame(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Dalamud plugin for FFXIV.

How to play:
- Left click to uncover a square, right click to place a flag.
- The game ends when all mines are flagged and all safe squares have been uncovered.
- The game ends when all safe squares have been uncovered.
- Click the smiley face to start a new game.

Features:
Expand Down

0 comments on commit 8c4d06c

Please sign in to comment.