From: <kro...@us...> - 2007-05-24 20:13:29
|
Revision: 433 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=433&view=rev Author: kroko_koenig Date: 2007-05-24 13:13:23 -0700 (Thu, 24 May 2007) Log Message: ----------- Version 0.1 Added Paths: ----------- trunk/plugins/My Minesweeper/Release/ trunk/plugins/My Minesweeper/Release/Skin/ trunk/plugins/My Minesweeper/Release/Skin/MyMinesweeper.xml trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/ trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/ trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/ trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/ trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bomb.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bombexplode.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bottomborder.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bottomleftcorner.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bottomrightcorner.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check0sel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check0unsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check1sel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check1unsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check2sel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check2unsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check3sel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check3unsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check4sel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check4unsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check5sel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check5unsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check6sel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check6unsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check7sel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check7unsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check8sel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check8unsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/leftborder.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/markedasbom.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/markedasbomsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/questionmark.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/questionmarksel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/rightborder.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/topborder.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/topleftcorner.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/toprightcorner.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/unchecksel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/uncheckunsel.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/cool.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/ohno.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/sad.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/smile.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/hover_my_minesweeper.png trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/ trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/bomb.wav trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/highscore.wav trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/tick.wav trunk/plugins/My Minesweeper/Source/ trunk/plugins/My Minesweeper/Source/MyMinesweeper/ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.cs trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.csproj trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.csproj.user trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/Properties/ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/Properties/AssemblyInfo.cs trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/minesweeper.png trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/minesweeperDisabled.png trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.sln trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.suo trunk/plugins/My Minesweeper/minesweeper.jpg trunk/plugins/My Minesweeper/readme.txt Added: trunk/plugins/My Minesweeper/Release/Skin/MyMinesweeper.xml =================================================================== --- trunk/plugins/My Minesweeper/Release/Skin/MyMinesweeper.xml (rev 0) +++ trunk/plugins/My Minesweeper/Release/Skin/MyMinesweeper.xml 2007-05-24 20:13:23 UTC (rev 433) @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<window> + <id>32327501</id> + <defaultcontrol>2</defaultcontrol> + <allowoverlay>yes</allowoverlay> + <autohidetopbar>yes</autohidetopbar> + <controls> + <import>common.time.xml</import> + <control> + <description>Minesweeper label</description> + <type>label</type> + <posX>55</posX> + <posY>20</posY> + <align>left</align> + <font>font48</font> + <label>Minesweeper</label> + <textcolor>20ffffff</textcolor> + <id>1</id> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>BackGround</description> + <type>image</type> + <id>1</id> + <posX>0</posX> + <posY>0</posY> + <width>720</width> + <height>576</height> + <texture>background.png</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>11</id> + <posX>250</posX> + <posY>70</posY> + <label>Minesweeper</label> + <font>font16</font> + <align>right</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Start</description> + <type>button</type> + <id>2</id> + <posX>60</posX> + <posY>97</posY> + <label>Start</label> + <onleft>2</onleft> + <onright>21</onright> + <onup>8</onup> + <ondown>4</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Level</description> + <type>button</type> + <id>4</id> + <posX>60</posX> + <posY>131</posY> + <label>Level: Amateur</label> + <onleft>4</onleft> + <onright>21</onright> + <onup>2</onup> + <ondown>8</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Smily</description> + <type>image</type> + <id>1</id> + <posX>60</posX> + <posY>185</posY> + <width>60</width> + <height>60</height> + <texture>#minesweeper_smiley</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>5</id> + <posX>70</posX> + <posY>264</posY> + <label>#minesweeper_bombs</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>6</id> + <posX>70</posX> + <posY>298</posY> + <label>#minesweeper_seconds</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>7</id> + <posX>70</posX> + <posY>332</posY> + <label>#minesweeper_record</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Whatsthis</description> + <type>button</type> + <id>8</id> + <posX>60</posX> + <posY>361</posY> + <label>What's this?</label> + <onleft>8</onleft> + <onright>21</onright> + <onup>4</onup> + <ondown>2</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + + <control> + <description>hidden hex</description> + <type>image</type> + <id>1200</id> + <posX>280</posX> + <posY>120</posY> + <width>20</width> + <height>20</height> + <texture>\Minesweeper\Board\topleftcorner.jpg</texture> + </control> + </controls> +</window> Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bomb.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bomb.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bombexplode.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bombexplode.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bottomborder.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bottomborder.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bottomleftcorner.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bottomleftcorner.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bottomrightcorner.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/bottomrightcorner.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check0sel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check0sel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check0unsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check0unsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check1sel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check1sel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check1unsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check1unsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check2sel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check2sel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check2unsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check2unsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check3sel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check3sel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check3unsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check3unsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check4sel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check4sel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check4unsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check4unsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check5sel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check5sel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check5unsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check5unsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check6sel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check6sel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check6unsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check6unsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check7sel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check7sel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check7unsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check7unsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check8sel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check8sel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check8unsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/check8unsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/leftborder.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/leftborder.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/markedasbom.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/markedasbom.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/markedasbomsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/markedasbomsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/questionmark.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/questionmark.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/questionmarksel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/questionmarksel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/rightborder.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/rightborder.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/topborder.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/topborder.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/topleftcorner.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/topleftcorner.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/toprightcorner.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/toprightcorner.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/unchecksel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/unchecksel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/uncheckunsel.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/Board/uncheckunsel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/cool.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/cool.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/ohno.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/ohno.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/sad.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/sad.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/smile.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/Minesweeper/smile.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/hover_my_minesweeper.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Media/hover_my_minesweeper.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/bomb.wav =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/bomb.wav ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/highscore.wav =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/highscore.wav ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/tick.wav =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/Skin/SimpleMP/Sounds/tick.wav ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.cs =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.cs (rev 0) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.cs 2007-05-24 20:13:23 UTC (rev 433) @@ -0,0 +1,1065 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + + +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; +using System.Drawing; + +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +using MediaPortal.Util; +using MediaPortal.Configuration; + +namespace MediaPortal.GUI.MyMinesweeper +{ + [PluginIcons("MyMinesweeper.minesweeper.png", "MyMinesweeper.minesweeperDisabled.png")] + public class MyMinesweeper : GUIWindow, ISetupForm + { + #region SkinControl + + [SkinControlAttribute(2)] + protected GUIButtonControl BtnStart = null; + [SkinControlAttribute(4)] + protected GUIButtonControl BtnLevel = null; + [SkinControlAttribute(8)] + protected GUIButtonControl BtnWhatsThis = null; + + #endregion + + #region Private variables + + string Level = "Am"; // Choosen level + bool GameOver = false; // not game over + bool GameON = false; // Game is on + + int[,] board = new int[30, 30]; + int[,] bombs = new int[30, 30]; + bool initBoard = false; + + int bx = 10; + int by = 10; + int bcnt = 10; + + int time = 0; + string time_rec = "999"; + string time_name = "unknown"; + + string t_pro; + string t_nor; + string t_am; + + string n_pro; + string n_nor; + string n_am; + + int ID = 0; + + private static OnActionHandler ah; + + // game ticker for the timer + private System.Windows.Forms.Timer _Game = new System.Windows.Forms.Timer(); + + int[] posX = { -1, 0, 1, -1, 1, -1 , 0 , 1 }; + int[] posY = { -1, -1, -1, 0, 0, 1, 1, 1 }; + + #endregion + + #region ISetupForm Members + + // Returns the name of the plugin which is shown in the plugin menu + public string PluginName() + { + return "My Minesweeper"; + } + + // Returns the description of the plugin is shown in the plugin menu + public string Description() + { + return "My Minesweeper"; + } + + // Returns the author of the plugin which is shown in the plugin menu + public string Author() + { + return "Mark Koenig (kroko)"; + } + + // show the setup dialog + public void ShowPlugin() + { + MessageBox.Show("Nothing to configure, this is just an example"); + } + + // Indicates whether plugin can be enabled/disabled + public bool CanEnable() + { + return true; + } + + // get ID of windowplugin belonging to this setup + public int GetWindowId() + { + return 32327501; + } + + // Indicates if plugin is enabled by default; + public bool DefaultEnabled() + { + return true; + } + + // indicates if a plugin has its own setup screen + public bool HasSetup() + { + return false; + } + + /// <summary> + /// If the plugin should have its own button on the main menu of MediaPortal then it + /// should return true to this method, otherwise if it should not be on home + /// it should return false + /// </summary> + /// <param name="strButtonText">text the button should have</param> + /// <param name="strButtonImage">image for the button, or empty for default</param> + /// <param name="strButtonImageFocus">image for the button, or empty for default</param> + /// <param name="strPictureImage">subpicture for the button or empty for none</param> + /// <returns>true : plugin needs its own button on home + /// false : plugin does not need its own button on home</returns> + + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + if (xmlreader.GetValue("general", "myprefix")=="no") + { + strButtonText = "Minesweeper"; + } + else + { + strButtonText = "My Minesweeper"; + } + + } + //strButtonText = PluginName(); + strButtonImage = String.Empty; + strButtonImageFocus = String.Empty; + strPictureImage = @"hover_my_minesweeper.png"; + return true; + } + + #endregion + + public override int GetID + { + get + { + return 32327501; + } + set + { + base.GetID = value; + } + } + + public override bool Init() + { + if (ah == null) ah = new OnActionHandler(OnAction2); + bool result = Load(GUIGraphicsContext.Skin + @"\MyMinesweeper.xml"); + return result; + } + + #region Actions + + public override void OnAction(Action action) + { + base.OnAction(action); + } + + public void OnAction2(Action action) + { + switch (action.wID) + { + case Action.ActionType.ACTION_KEY_PRESSED: + switch (action.m_key.KeyChar) + { + case '1': + SetBomb(); + break; + case '2': + SetQuest(); + break; + case '3': + Check9(); + break; + case '0': + NewGame(); + break; + } + break; + } + } + + #endregion + + public override bool OnMessage(GUIMessage message) + { + if (message.Message == GUI.Library.GUIMessage.MessageType.GUI_MSG_SETFOCUS) + { + ID = message.TargetControlId; + } + return base.OnMessage(message); + } + + public void Dispose() + { + _Game.Stop(); + _Game.Tick -= new EventHandler(_Game_Tick); + } + + protected override void OnPageLoad() + { + + // start game ticker + _Game.Interval = 1000; + _Game.Tick += new EventHandler(_Game_Tick); + _Game.Start(); + + base.OnPageLoad(); + + LoadSettings(); + + NewGame(); + ShowLevel(); + + GUIGraphicsContext.OnNewAction -= ah; + GUIGraphicsContext.OnNewAction += ah; + + GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); + GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); + + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); + + } + + protected override void OnPageDestroy(int new_windowId) + { + _Game.Stop(); + _Game.Tick -= new EventHandler(_Game_Tick); + + SaveSettings(); + } + + protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) + { + if ((controlId >= 500) && (!GameOver)) + { + GameON = true; + + int y = controlId - 500; + y = (int)y / 30; + + int x = controlId - 500; + x = x - (y * 30); + + x = x - 1; + y = y - 1; + + if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + + SetPlace(pt); + } + } + + + if (control == BtnWhatsThis) + { + OnBtnWhatsThis(); + } + if (control == BtnLevel) + { + OnBtnLevel(); + } + if (control == BtnStart) + { + NewGame(); + } + + + } + + protected override void OnShowContextMenu() + { + base.OnShowContextMenu(); + } + + private void CreateButton(int ID, int posx, int posy, int height, int width, string focusimg, string nofocusimg) + { + GUIButtonControl button = new GUIButtonControl(GetID, ID, posx, posy, width, height, focusimg, nofocusimg); + button.AllocResources(); + GUIControl btnControl = (GUIControl)button; + Add(ref btnControl); + } + + void _Game_Tick(object sender, EventArgs e) + { + if ((!GameOver) && (time<999) && (GameON == true)) + { + time++; + } + GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); + GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); + } + + private void OnBtnWhatsThis() + { + GUIDialogText dlg = (GUIDialogText)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TEXT); + dlg.SetHeading("What's Minesweeper"); + dlg.SetText("Your goal in Minesweeper is to discover all\n" + + "hidden mines as soon as possible. If you click\n" + + "on a hidden mine it will explode and the game\n" + + "ends.\n" + + "Game board design by Mikael S\xF6derstr\xF6m\n\n" + + "OK check actual position\n" + + "1 mark as bomb\n" + + "2 mark as not sure\n" + + "3 check surrounding\n" + + "0 new game\n\n" + + "Good luck\nMark Koenig (kroko)"); + dlg.DoModal(GetID); + } + + private void OnBtnLevel() + { //Choose level for the game + { + if (Level == "Nor") + { + Level = "Pro"; + } + else if (Level == "Pro") + { + Level = "Am"; + } + else + { + Level = "Nor"; + } + NewGame(); + ShowLevel(); + } + } + + private void ShowLevel() + { + if (Level == "Pro") + { + GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Professional"); + } + if (Level == "Am") + { + GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Amateur"); + } + if (Level == "Nor") + { + GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Normal"); + } + } + + private void Init_board() + { + // get position from the start button + int StartX = GetControl(1200).XPosition; + int StartY = GetControl(1200).YPosition; + // Disable level control + GUIControl.HideControl(GetID, 1200); + + try + { + int StartT = GetControl(500).XPosition; + } + catch + { + initBoard = false; + } + + if (!initBoard) + { + initBoard = true; + + // set start button navigation + GetControl(2).SetNavigation(8, 4, 2, 531); + + for (int y = 0; y < (by+2); y++) + { + for (int x = 0; x < (bx+2); x++) + { + int nr = 500 + x + (y * 30); + + int xp = StartX + (20 * x); + int yp = StartY + (20 * y); + + //default navigation + int up = nr - 30; + int dn = nr + 30; + int le = nr - 1; + int ri = nr + 1; + //top bottom navigation + if ((y == 0) || (y==by+1)) + { + up = nr; + dn = nr; + le = nr; + ri = nr; + } + //left right navigation + if ((x == 0) || (x == bx + 1)) + { + up = nr; + dn = nr; + le = nr; + ri = nr; + } + //left to start + if (x == 1) + { + le = 2; + } + // right stop + if (x == bx) + { + ri = nr; + } + // top stop + if (y == 1) + { + up = nr; + } + // right stop + if (y == by) + { + dn = nr; + } + + CreateButton(nr, xp, yp, 20, 20, "#F" + nr, "#NF" + nr); + GetControl(nr).SetNavigation(up, dn, le, ri); + + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); + + } + } + for (int x = 0; x < (bx + 2); x++) + { + int nr = 500 + x; + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\topborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\topborder.png"); + } + for (int x = 0; x < (bx + 2); x++) + { + int nr = 500 + (30*(by+1)) + x; + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bottomborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bottomborder.png"); + } + for (int y = 0; y < by; y++) + { + int nr = 530 + (y*30); + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\leftborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\leftborder.png"); + nr = nr + bx + 1; + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\rightborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\rightborder.png"); + } + GUIPropertyManager.SetProperty("#F" + 500, @"\Minesweeper\Board\topleftcorner.png"); + GUIPropertyManager.SetProperty("#NF" + 500, @"\Minesweeper\Board\topleftcorner.png"); + GUIPropertyManager.SetProperty("#F" + (501+bx), @"\Minesweeper\Board\toprightcorner.png"); + GUIPropertyManager.SetProperty("#NF" + (501+bx), @"\Minesweeper\Board\toprightcorner.png"); + + GUIPropertyManager.SetProperty("#F" + (500+(30*(by+1))), @"\Minesweeper\Board\bottomleftcorner.png"); + GUIPropertyManager.SetProperty("#NF" + (500+(30*(by+1))), @"\Minesweeper\Board\bottomleftcorner.png"); + GUIPropertyManager.SetProperty("#F" + (501+(30*(by+1)+bx)), @"\Minesweeper\Board\bottomrightcorner.png"); + GUIPropertyManager.SetProperty("#NF" + (501+(30*(by+1)+bx)), @"\Minesweeper\Board\bottomrightcorner.png"); + + } + + GUIControl.FocusControl(GetID, 531); + } + + private void SetPlace(Point pos) + { + if ((bombs[pos.X, pos.Y] != 0) && (board[pos.X, pos.Y] != 9)) + { + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\sad.png"); + GameOver = true; + MediaPortal.Util.Utils.PlaySound("bomb.wav", false, true); + EndGame(); + board[pos.X, pos.Y] = 12; + SetPoint(pos); + } + if (board[pos.X, pos.Y] == 20) + { + board[pos.X, pos.Y] = GetValue(pos); + SetPoint(pos); + if (board[pos.X, pos.Y] == 0) + { + EmptyPos(); + } + if (Finished() == true) + { + CheckAllBoms(); + GameOver = true; + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\cool.png"); + CheckHiScore(); + } + } + } + + private void SetPoint(Point pos) + { + int nr = 531 + (pos.Y * 30) + pos.X; + + if (board[pos.X, pos.Y] == 0) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check0sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check0unsel.png"); + } + if (board[pos.X, pos.Y] == 1) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check1sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check1unsel.png"); + } + if (board[pos.X, pos.Y] == 2) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check2sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check2unsel.png"); + } + if (board[pos.X, pos.Y] == 3) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check3sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check3unsel.png"); + } + if (board[pos.X, pos.Y] == 4) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check4sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check4unsel.png"); + } + if (board[pos.X, pos.Y] == 5) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check5sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check5unsel.png"); + } + if (board[pos.X, pos.Y] == 6) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check6sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check6unsel.png"); + } + if (board[pos.X, pos.Y] == 7) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check7sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check7unsel.png"); + } + if (board[pos.X, pos.Y] == 8) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check8sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check8unsel.png"); + } + if (board[pos.X, pos.Y] == 9) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\markedasbomsel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\markedasbom.png"); + } + if (board[pos.X, pos.Y] == 10) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\questionmarksel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\questionmark.png"); + } + if (board[pos.X, pos.Y] == 11) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bomb.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bomb.png"); + } + if (board[pos.X, pos.Y] == 12) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bombexplode.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bombexplode.png"); + } + if (board[pos.X, pos.Y] == 20) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); + } + } + + private void NewGame() + { + GameOver = false; + GameON = false; + time = 0; + ID = 0; + + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); + + if (Level == "Am") + { + bx = 10; + by = 10; + bcnt = 10; + time_rec = t_am; + time_name = n_am; + } + if (Level == "Nor") + { + bx = 15; + by = 15; + bcnt = 40; + time_rec = t_nor; + time_name = n_nor; + } + if (Level == "Pro") + { + bx = 20; + by = 20; + bcnt = 100; + time_rec = t_pro; + time_name = n_pro; + } + + GUIPropertyManager.SetProperty("#minesweeper_record", "Record: " + time_rec + "s - " + time_name); + + // remove controls from form + try + { + for (int i = 500; i < 1180; i++) + { + Remove(i); + } + } + catch + { + + } + + for (int i = 0; i < 30; i++) + { + for (int j = 0; j < 30; j++) + { // 20 = not checked + board[i, j] = 20; + // no bombs + bombs[i, j] = 0; + } + } + + Random rnd = new Random(); + + for (int i = 0; i < bcnt ; i++) + { + int x = rnd.Next(0,bx); + int y = rnd.Next(0,by); + if (bombs[x, y] == 1) + { // already bomb + i = i - 1; + } + else + { + Point px = new Point(); + px.X=x; + px.Y=y; + if (GetValue(px) < 4) + { + bombs[x, y] = 1; + } + else + { + i = i - 1; + } + } + + } + + Init_board(); + } + + private int GetValue(Point pos) + { + int val=0; + + for (int i = 0; i < 8; i++) + { + int x = pos.X + posX[i]; + int y = pos.Y + posY[i]; + if ((x>=0) && (y>=0) && (x<bx) && (y<by)) + { + if (bombs[x, y] != 0) + { + val++; + } + } + + } + return val; + } + + private int GetMBombs(Point pos) + { + int val = 0; + + for (int i = 0; i < 8; i++) + { + int x = pos.X + posX[i]; + int y = pos.Y + posY[i]; + if ((x >= 0) && (y >= 0) && (x < 30) && (y < 30)) + { + if (board[x, y] == 9) + { + val++; + } + } + + } + return val; + } + + private void EndGame() + { + for (int y = 0; y < by; y++) + { + for (int x = 0; x < bx; x++) + { + if (bombs[x, y] != 0) + { + board[x, y] = 11; + Point pos = new Point(); + pos.X = x; + pos.Y = y; + SetPoint(pos); + } + } + } + } + + private void EmptyPos() + { + bool rep = true; + + while (rep) + { + rep = false; + for (int y = 0; y < by; y++) + { + for (int x = 0; x < bx; x++) + { + if (board[x, y] == 0) + { + // bomb counter = 0 + int cnt = 0; + for (int i = 0; i < 8; i++) + { + int x1 = x + posX[i]; + int y1 = y + posY[i]; + if ((x1 >= 0) && (y1 >= 0) && (x1 < bx) && (y1 < by)) + { + if (bombs[x1, y1] != 0) + { // found bomb + cnt++; + } + } + } + + if (cnt == 0) + { + for (int i = 0; i < 8; i++) + { + int x1 = x + posX[i]; + int y1 = y + posY[i]; + if ((x1 >= 0) && (y1 >= 0) && (x1 < bx) && (y1 < by)) + { + if (board[x1, y1] == 20) + { + Point pos = new Point(); + pos.X = x1; + pos.Y = y1; + + board[x1, y1] = GetValue(pos) ; + SetPoint(pos); + rep = true; + } + } + } + } + } + } + } + } + + } + + private void SetBomb() + { + if ((ID >= 500) && (!GameOver)) + { + GameON = true; + + int y = ID - 500; + y = (int)y / 30; + + int x = ID - 500; + x = x - (y * 30); + + x = x - 1; + y = y - 1; + + int val = board[x, y]; + + if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) + { + if (val == 20) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + board[x, y] = 9; + SetPoint(pt); + bcnt--; + } + if (val == 9) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + board[x, y] = 20; + SetPoint(pt); + bcnt++; + } + } + if (Finished() == true) + { + CheckAllBoms(); + GameOver = true; + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\cool.png"); + CheckHiScore(); + } + } + } + + private void SetQuest() + { + if ((ID >= 500) && (!GameOver)) + { + GameON = true; + + int y = ID - 500; + y = (int)y / 30; + + int x = ID - 500; + x = x - (y * 30); + + x = x - 1; + y = y - 1; + + int val = board[x, y]; + + if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) + { + if (val == 20) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + board[x, y] = 10; + SetPoint(pt); + } + if (val == 10) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + board[x, y] = 20; + SetPoint(pt); + } + } + } + } + + private void Check9() + { + if ((ID >= 500) && (!GameOver) && (GameON)) + { + int y = ID - 500; + y = (int)y / 30; + + int x = ID - 500; + x = x - (y * 30); + + x = x - 1; + y = y - 1; + + if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) + { + int val = board[x, y]; + Point pt = new Point(); + pt.X = x; + pt.Y = y; + + if (val == GetMBombs(pt)) + { + for (int i = 0; i < 8; i++) + { + Point px = new Point(); + px.X = x + posX[i]; + px.Y = y + posY[i]; + + if ((px.X >= 0) && (px.Y >= 0) && (px.X < bx) && (px.Y < by)) + { + SetPlace(px); + } + } + ... [truncated message content] |
From: <che...@us...> - 2007-05-27 11:09:32
|
Revision: 480 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=480&view=rev Author: chef_koch Date: 2007-05-27 04:09:30 -0700 (Sun, 27 May 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/My Minesweeper/Skin/ Removed Paths: ------------- trunk/plugins/My Minesweeper/Release/Skin/ Copied: trunk/plugins/My Minesweeper/Skin (from rev 473, trunk/plugins/My Minesweeper/Release/Skin) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 11:13:56
|
Revision: 482 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=482&view=rev Author: chef_koch Date: 2007-05-27 04:13:53 -0700 (Sun, 27 May 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml trunk/plugins/My Minesweeper/Release/skin/_default/Media/ trunk/plugins/My Minesweeper/Release/skin/_default/Sounds/ Removed Paths: ------------- trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml trunk/plugins/My Minesweeper/Skin/SimpleMP/Media/ trunk/plugins/My Minesweeper/Skin/SimpleMP/Sounds/ Copied: trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml (from rev 480, trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml) =================================================================== --- trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml (rev 0) +++ trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml 2007-05-27 11:13:53 UTC (rev 482) @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<window> + <id>32327501</id> + <defaultcontrol>2</defaultcontrol> + <allowoverlay>yes</allowoverlay> + <autohidetopbar>yes</autohidetopbar> + <controls> + <import>common.time.xml</import> + <control> + <description>Minesweeper label</description> + <type>label</type> + <posX>55</posX> + <posY>20</posY> + <align>left</align> + <font>font48</font> + <label>Minesweeper</label> + <textcolor>20ffffff</textcolor> + <id>1</id> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>BackGround</description> + <type>image</type> + <id>1</id> + <posX>0</posX> + <posY>0</posY> + <width>720</width> + <height>576</height> + <texture>background.png</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>11</id> + <posX>250</posX> + <posY>70</posY> + <label>Minesweeper</label> + <font>font16</font> + <align>right</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Start</description> + <type>button</type> + <id>2</id> + <posX>60</posX> + <posY>97</posY> + <label>Start</label> + <onleft>2</onleft> + <onright>21</onright> + <onup>8</onup> + <ondown>4</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Level</description> + <type>button</type> + <id>4</id> + <posX>60</posX> + <posY>131</posY> + <label>Level: Amateur</label> + <onleft>4</onleft> + <onright>21</onright> + <onup>2</onup> + <ondown>8</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Smily</description> + <type>image</type> + <id>1</id> + <posX>60</posX> + <posY>185</posY> + <width>60</width> + <height>60</height> + <texture>#minesweeper_smiley</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>5</id> + <posX>70</posX> + <posY>264</posY> + <label>#minesweeper_bombs</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>6</id> + <posX>70</posX> + <posY>298</posY> + <label>#minesweeper_seconds</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>7</id> + <posX>70</posX> + <posY>332</posY> + <label>#minesweeper_record</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Whatsthis</description> + <type>button</type> + <id>8</id> + <posX>60</posX> + <posY>361</posY> + <label>What's this?</label> + <onleft>8</onleft> + <onright>21</onright> + <onup>4</onup> + <ondown>2</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + + <control> + <description>hidden hex</description> + <type>image</type> + <id>1200</id> + <posX>280</posX> + <posY>120</posY> + <width>20</width> + <height>20</height> + <texture>\Minesweeper\Board\topleftcorner.jpg</texture> + </control> + </controls> +</window> Copied: trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml (from rev 480, trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml) =================================================================== --- trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml (rev 0) +++ trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml 2007-05-27 11:13:53 UTC (rev 482) @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<window> + <id>32327501</id> + <defaultcontrol>2</defaultcontrol> + <allowoverlay>yes</allowoverlay> + <autohidetopbar>yes</autohidetopbar> + <controls> + <import>common.time.xml</import> + <control> + <description>Minesweeper label</description> + <type>label</type> + <posX>55</posX> + <posY>20</posY> + <align>left</align> + <font>font48</font> + <label>Minesweeper</label> + <textcolor>20ffffff</textcolor> + <id>1</id> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>BackGround</description> + <type>image</type> + <id>1</id> + <posX>0</posX> + <posY>0</posY> + <width>720</width> + <height>576</height> + <texture>background.png</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>11</id> + <posX>250</posX> + <posY>70</posY> + <label>Minesweeper</label> + <font>font16</font> + <align>right</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Start</description> + <type>button</type> + <id>2</id> + <posX>60</posX> + <posY>97</posY> + <label>Start</label> + <onleft>2</onleft> + <onright>21</onright> + <onup>8</onup> + <ondown>4</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Level</description> + <type>button</type> + <id>4</id> + <posX>60</posX> + <posY>131</posY> + <label>Level: Amateur</label> + <onleft>4</onleft> + <onright>21</onright> + <onup>2</onup> + <ondown>8</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Smily</description> + <type>image</type> + <id>1</id> + <posX>60</posX> + <posY>185</posY> + <width>60</width> + <height>60</height> + <texture>#minesweeper_smiley</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>5</id> + <posX>70</posX> + <posY>264</posY> + <label>#minesweeper_bombs</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>6</id> + <posX>70</posX> + <posY>298</posY> + <label>#minesweeper_seconds</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>7</id> + <posX>70</posX> + <posY>332</posY> + <label>#minesweeper_record</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Whatsthis</description> + <type>button</type> + <id>8</id> + <posX>60</posX> + <posY>361</posY> + <label>What's this?</label> + <onleft>8</onleft> + <onright>21</onright> + <onup>4</onup> + <ondown>2</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + + <control> + <description>hidden hex</description> + <type>image</type> + <id>1200</id> + <posX>280</posX> + <posY>120</posY> + <width>20</width> + <height>20</height> + <texture>\Minesweeper\Board\topleftcorner.jpg</texture> + </control> + </controls> +</window> Copied: trunk/plugins/My Minesweeper/Release/skin/_default/Media (from rev 480, trunk/plugins/My Minesweeper/Skin/SimpleMP/Media) Copied: trunk/plugins/My Minesweeper/Release/skin/_default/Sounds (from rev 480, trunk/plugins/My Minesweeper/Skin/SimpleMP/Sounds) Deleted: trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml =================================================================== --- trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml 2007-05-27 11:11:22 UTC (rev 481) +++ trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml 2007-05-27 11:13:53 UTC (rev 482) @@ -1,148 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<window> - <id>32327501</id> - <defaultcontrol>2</defaultcontrol> - <allowoverlay>yes</allowoverlay> - <autohidetopbar>yes</autohidetopbar> - <controls> - <import>common.time.xml</import> - <control> - <description>Minesweeper label</description> - <type>label</type> - <posX>55</posX> - <posY>20</posY> - <align>left</align> - <font>font48</font> - <label>Minesweeper</label> - <textcolor>20ffffff</textcolor> - <id>1</id> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>BackGround</description> - <type>image</type> - <id>1</id> - <posX>0</posX> - <posY>0</posY> - <width>720</width> - <height>576</height> - <texture>background.png</texture> - </control> - <control> - <description>text label</description> - <type>label</type> - <id>11</id> - <posX>250</posX> - <posY>70</posY> - <label>Minesweeper</label> - <font>font16</font> - <align>right</align> - <textcolor>ffffffff</textcolor> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>Start</description> - <type>button</type> - <id>2</id> - <posX>60</posX> - <posY>97</posY> - <label>Start</label> - <onleft>2</onleft> - <onright>21</onright> - <onup>8</onup> - <ondown>4</ondown> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>Level</description> - <type>button</type> - <id>4</id> - <posX>60</posX> - <posY>131</posY> - <label>Level: Amateur</label> - <onleft>4</onleft> - <onright>21</onright> - <onup>2</onup> - <ondown>8</ondown> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>Smily</description> - <type>image</type> - <id>1</id> - <posX>60</posX> - <posY>185</posY> - <width>60</width> - <height>60</height> - <texture>#minesweeper_smiley</texture> - </control> - <control> - <description>text label</description> - <type>label</type> - <id>5</id> - <posX>70</posX> - <posY>264</posY> - <label>#minesweeper_bombs</label> - <font>font12</font> - <align>Left</align> - <textcolor>ffffffff</textcolor> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>text label</description> - <type>label</type> - <id>6</id> - <posX>70</posX> - <posY>298</posY> - <label>#minesweeper_seconds</label> - <font>font12</font> - <align>Left</align> - <textcolor>ffffffff</textcolor> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>text label</description> - <type>label</type> - <id>7</id> - <posX>70</posX> - <posY>332</posY> - <label>#minesweeper_record</label> - <font>font12</font> - <align>Left</align> - <textcolor>ffffffff</textcolor> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>Whatsthis</description> - <type>button</type> - <id>8</id> - <posX>60</posX> - <posY>361</posY> - <label>What's this?</label> - <onleft>8</onleft> - <onright>21</onright> - <onup>4</onup> - <ondown>2</ondown> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - - <control> - <description>hidden hex</description> - <type>image</type> - <id>1200</id> - <posX>280</posX> - <posY>120</posY> - <width>20</width> - <height>20</height> - <texture>\Minesweeper\Board\topleftcorner.jpg</texture> - </control> - </controls> -</window> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kro...@us...> - 2007-07-27 08:05:11
|
Revision: 772 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=772&view=rev Author: kroko_koenig Date: 2007-07-27 01:05:05 -0700 (Fri, 27 Jul 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.csproj trunk/plugins/My Minesweeper/Source/MyMinesweeper/Properties/AssemblyInfo.cs trunk/plugins/My Minesweeper/readme.txt Added Paths: ----------- trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_de.xml trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_en.xml trunk/plugins/My Minesweeper/Source/MyMinesweeper/LocalizeStrings.cs Added: trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_de.xml =================================================================== --- trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_de.xml (rev 0) +++ trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_de.xml 2007-07-27 08:05:05 UTC (rev 772) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<Language name="German" characters="255"> + <Section name="unmapped"> + <String id="0" prefix="Mein ">Minesweeper</String> + <String id="1">Neues Spiel</String> + <String id="4">Zeit</String> + <String id="6">GAME OVER</String> + <String id="9">Spielgeräusche</String> + <String id="10">Stufe: </String> + <String id="11">leicht</String> + <String id="12">mittel</String> + <String id="13">schwer</String> + <String id="31">Was ist Minesweeper?</String> + <String id="32">Das Ziel bei Minesweeper ist es,alle +versteckten Minen so schnell wie möglich zu finden. Wenn du +auf eine versteckte Mine klickt's, explodiert diese und das +Spiel ist zu Ende. + +Spielfeld Design von Mikael Söderström + +OK prüfe aktuelle Position +1 markiere als Bombe +2 markiere als Fragezeichen +3 prüfe die Umgebung +0 neues Spiel + +Viel Glück +Mark König 2007 (kroko)</String> + + </Section> +</Language> \ No newline at end of file Added: trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_en.xml =================================================================== --- trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_en.xml (rev 0) +++ trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_en.xml 2007-07-27 08:05:05 UTC (rev 772) @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Language name="English" characters="255"> + <Section name="unmapped"> + <String id="0" prefix="My ">Minesweeper</String> + <String id="1">New Game</String> + <String id="4">Time</String> + <String id="6">GAME OVER</String> + <String id="9">Sounds</String> + <String id="10">Level: </String> + <String id="11">easy</String> + <String id="12">medium</String> + <String id="13">difficult</String> + <String id="31">What's Minesweeper</String> + <String id="32">Your goal in Minesweeper is to discover all +hidden mines as soon as possible. If you click +on a hidden mine it will explode and the game +ends. + +Game board design by Mikael Söderström + +OK check actual position +1 mark as bomb +2 mark as not sure +3 check surrounding +0 new game + +Good luck +Mark Koenig 2007 (kroko)</String> + </Section> +</Language> \ No newline at end of file Modified: trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml =================================================================== --- trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml 2007-07-26 16:23:52 UTC (rev 771) +++ trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml 2007-07-27 08:05:05 UTC (rev 772) @@ -13,7 +13,7 @@ <posY>20</posY> <align>left</align> <font>font48</font> - <label>Minesweeper</label> + <label>#header_label</label> <textcolor>20ffffff</textcolor> <id>1</id> <animation effect="fade" time="150">WindowOpen</animation> @@ -35,7 +35,7 @@ <id>11</id> <posX>250</posX> <posY>70</posY> - <label>Minesweeper</label> + <label>#header_label</label> <font>font16</font> <align>right</align> <textcolor>ffffffff</textcolor> @@ -48,10 +48,10 @@ <id>2</id> <posX>60</posX> <posY>97</posY> - <label>Start</label> + <label>New game</label> <onleft>2</onleft> <onright>21</onright> - <onup>8</onup> + <onup>10</onup> <ondown>4</ondown> <animation effect="fade" time="150">WindowOpen</animation> <animation effect="fade" time="150">WindowClose</animation> @@ -62,20 +62,32 @@ <id>4</id> <posX>60</posX> <posY>131</posY> - <label>Level: Amateur</label> + <label>Level: easy</label> <onleft>4</onleft> <onright>21</onright> <onup>2</onup> - <ondown>8</ondown> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> + <ondown>5</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> </control> + <control> + <description>Sounds</description> + <type>togglebutton</type> + <id>5</id> + <posX>60</posX> + <posY>165</posY> + <label>Sounds</label> + <onleft>5</onleft> + <onright>21</onright> + <onup>4</onup> + <ondown>10</ondown> + </control> <control> <description>Smily</description> <type>image</type> - <id>1</id> + <id>6</id> <posX>60</posX> - <posY>185</posY> + <posY>220</posY> <width>60</width> <height>60</height> <texture>#minesweeper_smiley</texture> @@ -83,9 +95,9 @@ <control> <description>text label</description> <type>label</type> - <id>5</id> + <id>7</id> <posX>70</posX> - <posY>264</posY> + <posY>300</posY> <label>#minesweeper_bombs</label> <font>font12</font> <align>Left</align> @@ -96,9 +108,9 @@ <control> <description>text label</description> <type>label</type> - <id>6</id> + <id>8</id> <posX>70</posX> - <posY>298</posY> + <posY>330</posY> <label>#minesweeper_seconds</label> <font>font12</font> <align>Left</align> @@ -109,9 +121,9 @@ <control> <description>text label</description> <type>label</type> - <id>7</id> + <id>9</id> <posX>70</posX> - <posY>332</posY> + <posY>350</posY> <label>#minesweeper_record</label> <font>font12</font> <align>Left</align> @@ -122,20 +134,20 @@ <control> <description>Whatsthis</description> <type>button</type> - <id>8</id> + <id>10</id> <posX>60</posX> - <posY>361</posY> + <posY>400</posY> <label>What's this?</label> <onleft>8</onleft> <onright>21</onright> - <onup>4</onup> + <onup>5</onup> <ondown>2</ondown> <animation effect="fade" time="150">WindowOpen</animation> <animation effect="fade" time="150">WindowClose</animation> </control> <control> - <description>hidden hex</description> + <description>hidden corner</description> <type>image</type> <id>1200</id> <posX>280</posX> Modified: trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml =================================================================== --- trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml 2007-07-26 16:23:52 UTC (rev 771) +++ trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml 2007-07-27 08:05:05 UTC (rev 772) @@ -13,7 +13,7 @@ <posY>20</posY> <align>left</align> <font>font48</font> - <label>Minesweeper</label> + <label>#header_label</label> <textcolor>20ffffff</textcolor> <id>1</id> <animation effect="fade" time="150">WindowOpen</animation> @@ -35,7 +35,7 @@ <id>11</id> <posX>250</posX> <posY>70</posY> - <label>Minesweeper</label> + <label>#header_label</label> <font>font16</font> <align>right</align> <textcolor>ffffffff</textcolor> @@ -48,10 +48,10 @@ <id>2</id> <posX>60</posX> <posY>97</posY> - <label>Start</label> + <label>New game</label> <onleft>2</onleft> <onright>21</onright> - <onup>8</onup> + <onup>10</onup> <ondown>4</ondown> <animation effect="fade" time="150">WindowOpen</animation> <animation effect="fade" time="150">WindowClose</animation> @@ -62,20 +62,32 @@ <id>4</id> <posX>60</posX> <posY>131</posY> - <label>Level: Amateur</label> + <label>Level: easy</label> <onleft>4</onleft> <onright>21</onright> <onup>2</onup> - <ondown>8</ondown> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> + <ondown>5</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> </control> + <control> + <description>Sounds</description> + <type>togglebutton</type> + <id>5</id> + <posX>60</posX> + <posY>165</posY> + <label>Sounds</label> + <onleft>5</onleft> + <onright>21</onright> + <onup>4</onup> + <ondown>10</ondown> + </control> <control> <description>Smily</description> <type>image</type> - <id>1</id> + <id>6</id> <posX>60</posX> - <posY>185</posY> + <posY>220</posY> <width>60</width> <height>60</height> <texture>#minesweeper_smiley</texture> @@ -83,9 +95,9 @@ <control> <description>text label</description> <type>label</type> - <id>5</id> + <id>7</id> <posX>70</posX> - <posY>264</posY> + <posY>300</posY> <label>#minesweeper_bombs</label> <font>font12</font> <align>Left</align> @@ -96,9 +108,9 @@ <control> <description>text label</description> <type>label</type> - <id>6</id> + <id>8</id> <posX>70</posX> - <posY>298</posY> + <posY>330</posY> <label>#minesweeper_seconds</label> <font>font12</font> <align>Left</align> @@ -109,9 +121,9 @@ <control> <description>text label</description> <type>label</type> - <id>7</id> + <id>9</id> <posX>70</posX> - <posY>332</posY> + <posY>350</posY> <label>#minesweeper_record</label> <font>font12</font> <align>Left</align> @@ -122,20 +134,20 @@ <control> <description>Whatsthis</description> <type>button</type> - <id>8</id> + <id>10</id> <posX>60</posX> - <posY>361</posY> + <posY>400</posY> <label>What's this?</label> <onleft>8</onleft> <onright>21</onright> - <onup>4</onup> + <onup>5</onup> <ondown>2</ondown> <animation effect="fade" time="150">WindowOpen</animation> <animation effect="fade" time="150">WindowClose</animation> </control> <control> - <description>hidden hex</description> + <description>hidden corner</description> <type>image</type> <id>1200</id> <posX>280</posX> Added: trunk/plugins/My Minesweeper/Source/MyMinesweeper/LocalizeStrings.cs =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/LocalizeStrings.cs (rev 0) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/LocalizeStrings.cs 2007-07-27 08:05:05 UTC (rev 772) @@ -0,0 +1,260 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.IO; +using System.Globalization; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Xml; +using MediaPortal.Util; +using MediaPortal.GUI.Library; +using MediaPortal.Configuration; +using MediaPortal.Localisation; + +namespace MediaPortal.GUI.MyMinesweeper +{ + /// <summary> + /// This class will hold all text used in the application + /// The text is loaded for the current language from + /// the file language/[language]/strings.xml + /// </summary> + public class GUILocalizeStrings + { + #region Variables + static LocalisationProvider _stringProvider; + static Dictionary<string, string> _cultures; + static string[] _languages; + #endregion + + #region Constructors/Destructors + // singleton. Dont allow any instance of this class + private GUILocalizeStrings() + { + } + + static public void Dispose() + { + if (_stringProvider != null) + _stringProvider.Dispose(); + } + #endregion + + #region Public Methods + /// <summary> + /// Public method to load the text from a strings/xml file into memory + /// </summary> + /// <param name="strFileName">Contains the filename+path for the string.xml file</param> + /// <returns> + /// true when text is loaded + /// false when it was unable to load the text + /// </returns> + //[Obsolete("This method has changed", true)] + static public bool Load(string language) + { + bool isPrefixEnabled = true; + + using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true); + + string directory = Config.GetSubFolder(Config.Dir.Language, "MyMinesweeper"); + string cultureName = null; + if (language != null) + cultureName = GetCultureName(language); + + Log.Info(" Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled); + + _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); + + GUIGraphicsContext.CharsInCharacterSet = _stringProvider.Characters; + + return true; + } + + static public string CurrentLanguage() + { + if (_stringProvider == null) + Load(null); + + return _stringProvider.CurrentLanguage.EnglishName; + } + + static public void ChangeLanguage(string language) + { + if (_stringProvider == null) + Load(language); + else + _stringProvider.ChangeLanguage(GetCultureName(language)); + } + + /// <summary> + /// Get the translation for a given id and format the sting with + /// the given parameters + /// </summary> + /// <param name="dwCode">id of text</param> + /// <param name="parameters">parameters used in the formating</param> + /// <returns> + /// string containing the translated text + /// </returns> + static public string Get(int dwCode, object[] parameters) + { + if (_stringProvider == null) + Load(null); + + string translation = _stringProvider.GetString("unmapped", dwCode); + // if parameters or the translation is null, return the translation. + if ((translation == null) || (parameters == null)) + { + return translation; + } + // return the formatted string. If formatting fails, log the error + // and return the unformatted string. + try + { + return String.Format(translation, parameters); + } + catch (System.FormatException e) + { + Log.Error("Error formatting translation with id {0}", dwCode); + Log.Error("Unformatted translation: {0}", translation); + Log.Error(e); + return translation; + } + } + + /// <summary> + /// Get the translation for a given id + /// </summary> + /// <param name="dwCode">id of text</param> + /// <returns> + /// string containing the translated text + /// </returns> + static public string Get(int dwCode) + { + if (_stringProvider == null) + Load(null); + + string translation = _stringProvider.GetString("unmapped", dwCode); + + if (translation == null) + { + Log.Error("No translation found for id {0}", dwCode); + return String.Empty; + } + + return translation; + } + + static public void LocalizeLabel(ref string strLabel) + { + if (_stringProvider == null) + Load(null); + + if (strLabel == null) strLabel = String.Empty; + if (strLabel == "-") strLabel = ""; + if (strLabel == "") return; + // This can't be a valid string code if the first character isn't a number. + // This check will save us from catching unnecessary exceptions. + if (!char.IsNumber(strLabel, 0)) + return; + + int dwLabelID; + + try + { + dwLabelID = System.Int32.Parse(strLabel); + } + catch (FormatException e) + { + Log.Error(e); + strLabel = String.Empty; + return; + } + + strLabel = _stringProvider.GetString("unmapped", dwLabelID); + if (strLabel == null) + { + Log.Error("No translation found for id {0}", dwLabelID); + strLabel = String.Empty; + } + } + + public static string LocalSupported() + { + if (_stringProvider == null) + Load(null); + + CultureInfo culture = _stringProvider.GetBestLanguage(); + + return culture.EnglishName; + } + + public static string[] SupportedLanguages() + { + if (_languages == null) + { + if (_stringProvider == null) + Load(null); + + CultureInfo[] cultures = _stringProvider.AvailableLanguages(); + + SortedList sortedLanguages = new SortedList(); + foreach (CultureInfo culture in cultures) + sortedLanguages.Add(culture.EnglishName, culture.EnglishName); + + _languages = new string[sortedLanguages.Count]; + + for (int i = 0; i < sortedLanguages.Count; i++) + { + _languages[i] = (string)sortedLanguages.GetByIndex(i); + } + } + + return _languages; + } + + static public string GetCultureName(string language) + { + if (_cultures == null) + { + _cultures = new Dictionary<string, string>(); + + CultureInfo[] cultureList = CultureInfo.GetCultures(CultureTypes.AllCultures); + + for (int i = 0; i < cultureList.Length; i++) + { + _cultures.Add(cultureList[i].EnglishName, cultureList[i].Name); + } + } + + if (_cultures.ContainsKey(language)) + return _cultures[language]; + + return null; + } + #endregion + } +} \ No newline at end of file Modified: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs 2007-07-26 16:23:52 UTC (rev 771) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs 2007-07-27 08:05:05 UTC (rev 772) @@ -34,28 +34,43 @@ using MediaPortal.Dialogs; using MediaPortal.Util; using MediaPortal.Configuration; +using MediaPortal.Localisation; namespace MediaPortal.GUI.MyMinesweeper { [PluginIcons("MyMinesweeper.minesweeper.png", "MyMinesweeper.minesweeperDisabled.png")] - public class MyMinesweeper : GUIWindow, ISetupForm + public class MyMinesweeperGUI : GUIWindow, ISetupForm { + #region enums + + private enum Level + { + Easy = 0, + Medium = 1, + Hard = 2 + } + + #endregion + #region SkinControl [SkinControlAttribute(2)] - protected GUIButtonControl BtnStart = null; + protected GUIButtonControl btnStart = null; [SkinControlAttribute(4)] - protected GUIButtonControl BtnLevel = null; - [SkinControlAttribute(8)] - protected GUIButtonControl BtnWhatsThis = null; + protected GUIButtonControl btnLevel = null; + [SkinControlAttribute(5)] + protected GUIToggleButtonControl btnSound = null; + [SkinControlAttribute(10)] + protected GUIButtonControl btnWhatsThis = null; #endregion #region Private variables - string Level = "Am"; // Choosen level + Level _currentLevel = Level.Easy; bool GameOver = false; // not game over bool GameON = false; // Game is on + bool _soundOn = true; int[,] board = new int[30, 30]; int[,] bombs = new int[30, 30]; @@ -153,19 +168,7 @@ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) { - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - if (xmlreader.GetValue("general", "myprefix")=="no") - { - strButtonText = "Minesweeper"; - } - else - { - strButtonText = "My Minesweeper"; - } - - } - //strButtonText = PluginName(); + strButtonText = MyMinesweeper.GUILocalizeStrings.Get(0); ; strButtonImage = String.Empty; strButtonImageFocus = String.Empty; strPictureImage = @"hover_my_minesweeper.png"; @@ -174,6 +177,8 @@ #endregion + #region Overrides + public override int GetID { get @@ -188,59 +193,23 @@ public override bool Init() { + MyMinesweeper.GUILocalizeStrings.Load(GUI.Library.GUILocalizeStrings.CurrentLanguage()); + if (ah == null) ah = new OnActionHandler(OnAction2); + bool result = Load(GUIGraphicsContext.Skin + @"\MyMinesweeper.xml"); return result; } - #region Actions - - public override void OnAction(Action action) - { - base.OnAction(action); - } - - public void OnAction2(Action action) - { - switch (action.wID) - { - case Action.ActionType.ACTION_KEY_PRESSED: - switch (action.m_key.KeyChar) - { - case '1': - SetBomb(); - break; - case '2': - SetQuest(); - break; - case '3': - Check9(); - break; - case '0': - NewGame(); - break; - } - break; - } - } - - #endregion - public override bool OnMessage(GUIMessage message) { if (message.Message == GUI.Library.GUIMessage.MessageType.GUI_MSG_SETFOCUS) { - ID = message.TargetControlId; + ID = message.TargetControlId; } return base.OnMessage(message); } - public void Dispose() - { - _Game.Stop(); - _Game.Tick -= new EventHandler(_Game_Tick); - } - protected override void OnPageLoad() { @@ -253,8 +222,7 @@ LoadSettings(); - NewGame(); - ShowLevel(); + OnBtnStart(); GUIGraphicsContext.OnNewAction -= ah; GUIGraphicsContext.OnNewAction += ah; @@ -264,6 +232,13 @@ GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); + // set localized labels for static controls + GUIPropertyManager.SetProperty("#header_label", MyMinesweeper.GUILocalizeStrings.Get(0)); // MyMinesweeper + GUIControl.SetControlLabel(GetID, btnStart.GetID, MyMinesweeper.GUILocalizeStrings.Get(1)); // New Game + GUIControl.SetControlLabel(GetID, btnSound.GetID, MyMinesweeper.GUILocalizeStrings.Get(9)); // Sounds + GUIControl.SetControlLabel(GetID, btnWhatsThis.GetID, MyMinesweeper.GUILocalizeStrings.Get(31)); // What is MyMinesweeper? + + UpdateButtonStates(); } protected override void OnPageDestroy(int new_windowId) @@ -295,24 +270,29 @@ pt.X = x; pt.Y = y; + OnRenderSound("tick.wav"); + SetPlace(pt); } } - if (control == BtnWhatsThis) + if (control == btnWhatsThis) { OnBtnWhatsThis(); } - if (control == BtnLevel) + if (control == btnLevel) { OnBtnLevel(); } - if (control == BtnStart) + if (control == btnStart) { - NewGame(); + OnBtnStart(); } - + if (control == btnSound ) + { + OnBtnSound(); + } } @@ -321,76 +301,226 @@ base.OnShowContextMenu(); } - private void CreateButton(int ID, int posx, int posy, int height, int width, string focusimg, string nofocusimg) + #endregion + + #region Implementation + + private void OnBtnStart() { - GUIButtonControl button = new GUIButtonControl(GetID, ID, posx, posy, width, height, focusimg, nofocusimg); - button.AllocResources(); - GUIControl btnControl = (GUIControl)button; - Add(ref btnControl); + GameOver = false; + GameON = false; + time = 0; + ID = 0; + + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); + + if (_currentLevel == Level.Easy) + { + bx = 10; + by = 10; + bcnt = 10; + time_rec = t_am; + time_name = n_am; + } + if (_currentLevel == Level.Medium) + { + bx = 15; + by = 15; + bcnt = 40; + time_rec = t_nor; + time_name = n_nor; + } + if (_currentLevel == Level.Hard) + { + bx = 20; + by = 20; + bcnt = 100; + time_rec = t_pro; + time_name = n_pro; + } + + GUIPropertyManager.SetProperty("#minesweeper_record", "Record: " + time_rec + "s - " + time_name); + + // remove controls from form + try + { + for (int i = 500; i < 1180; i++) + { + Remove(i); + } + } + catch + { + + } + + for (int i = 0; i < 30; i++) + { + for (int j = 0; j < 30; j++) + { // 20 = not checked + board[i, j] = 20; + // no bombs + bombs[i, j] = 0; + } + } + + Random rnd = new Random(); + + for (int i = 0; i < bcnt; i++) + { + int x = rnd.Next(0, bx); + int y = rnd.Next(0, by); + if (bombs[x, y] == 1) + { // already bomb + i = i - 1; + } + else + { + Point px = new Point(); + px.X = x; + px.Y = y; + if (GetValue(px) < 4) + { + bombs[x, y] = 1; + } + else + { + i = i - 1; + } + } + + } + + Init_board(); } - void _Game_Tick(object sender, EventArgs e) - { - if ((!GameOver) && (time<999) && (GameON == true)) + private void OnBtnLevel() + { //Choose level for the game { - time++; + switch (_currentLevel) + { + case Level.Easy: + _currentLevel = Level.Medium; + break; + case Level.Medium: + _currentLevel = Level.Hard; + break; + case Level.Hard: + _currentLevel = Level.Easy; + break; + } + + OnBtnStart(); + + UpdateButtonStates(); } - GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); - GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); } + private void OnBtnSound() + { + _soundOn = btnSound.Selected; + UpdateButtonStates(); + } + private void OnBtnWhatsThis() { GUIDialogText dlg = (GUIDialogText)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TEXT); - dlg.SetHeading("What's Minesweeper"); - dlg.SetText("Your goal in Minesweeper is to discover all\n" + - "hidden mines as soon as possible. If you click\n" + - "on a hidden mine it will explode and the game\n" + - "ends.\n" + - "Game board design by Mikael S\xF6derstr\xF6m\n\n" + - "OK check actual position\n" + - "1 mark as bomb\n" + - "2 mark as not sure\n" + - "3 check surrounding\n" + - "0 new game\n\n" + - "Good luck\nMark Koenig (kroko)"); + dlg.SetHeading(MyMinesweeper.GUILocalizeStrings.Get(31)); // help dialog heading + dlg.SetText(MyMinesweeper.GUILocalizeStrings.Get(32)); // help dialog text dlg.DoModal(GetID); } - private void OnBtnLevel() - { //Choose level for the game + private void OnRenderSound(string strFilePath) + { + if (_soundOn) { - if (Level == "Nor") - { - Level = "Pro"; - } - else if (Level == "Pro") - { - Level = "Am"; - } - else - { - Level = "Nor"; - } - NewGame(); - ShowLevel(); + MediaPortal.Util.Utils.PlaySound(strFilePath, false, true); } } - private void ShowLevel() + private void UpdateButtonStates() { - if (Level == "Pro") + // enable/disable buttons + btnSound.Selected = _soundOn; + + // refresh label for btnLevel + string strLine = MyMinesweeper.GUILocalizeStrings.Get(10); // Level: + switch (_currentLevel) { - GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Professional"); + case Level.Easy: + strLine += MyMinesweeper.GUILocalizeStrings.Get(11); // easy + break; + case Level.Medium: + strLine += MyMinesweeper.GUILocalizeStrings.Get(12); // medium + break; + case Level.Hard: + strLine += MyMinesweeper.GUILocalizeStrings.Get(13); // difficult + break; } - if (Level == "Am") + GUIControl.SetControlLabel(GetID, btnLevel.GetID, strLine); + + // refresh label for btnMode + strLine = MyMinesweeper.GUILocalizeStrings.Get(20); // Mode: Play vs + + } + + #endregion + + public void Dispose() + { + _Game.Stop(); + _Game.Tick -= new EventHandler(_Game_Tick); + } + + #region Actions + + public override void OnAction(Action action) + { + base.OnAction(action); + } + + public void OnAction2(Action action) + { + switch (action.wID) { - GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Amateur"); + case Action.ActionType.ACTION_KEY_PRESSED: + switch (action.m_key.KeyChar) + { + case '1': + SetBomb(); + break; + case '2': + SetQuest(); + break; + case '3': + Check9(); + break; + case '0': + OnBtnStart(); + break; + } + break; } - if (Level == "Nor") + } + + #endregion + + private void CreateButton(int ID, int posx, int posy, int height, int width, string focusimg, string nofocusimg) + { + GUIButtonControl button = new GUIButtonControl(GetID, ID, posx, posy, width, height, focusimg, nofocusimg); + button.AllocResources(); + GUIControl btnControl = (GUIControl)button; + Add(ref btnControl); + } + + void _Game_Tick(object sender, EventArgs e) + { + if ((!GameOver) && (time<999) && (GameON == true)) { - GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Normal"); + time++; } + GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); + GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); } private void Init_board() @@ -518,7 +648,7 @@ { GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\sad.png"); GameOver = true; - MediaPortal.Util.Utils.PlaySound("bomb.wav", false, true); + OnRenderSound ("bomb.wav"); EndGame(); board[pos.X, pos.Y] = 12; SetPoint(pos); @@ -615,97 +745,8 @@ GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); } - } + } - private void NewGame() - { - GameOver = false; - GameON = false; - time = 0; - ID = 0; - - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); - - if (Level == "Am") - { - bx = 10; - by = 10; - bcnt = 10; - time_rec = t_am; - time_name = n_am; - } - if (Level == "Nor") - { - bx = 15; - by = 15; - bcnt = 40; - time_rec = t_nor; - time_name = n_nor; - } - if (Level == "Pro") - { - bx = 20; - by = 20; - bcnt = 100; - time_rec = t_pro; - time_name = n_pro; - } - - GUIPropertyManager.SetProperty("#minesweeper_record", "Record: " + time_rec + "s - " + time_name); - - // remove controls from form - try - { - for (int i = 500; i < 1180; i++) - { - Remove(i); - } - } - catch - { - - } - - for (int i = 0; i < 30; i++) - { - for (int j = 0; j < 30; j++) - { // 20 = not checked - board[i, j] = 20; - // no bombs - bombs[i, j] = 0; - } - } - - Random rnd = new Random(); - - for (int i = 0; i < bcnt ; i++) - { - int x = rnd.Next(0,bx); - int y = rnd.Next(0,by); - if (bombs[x, y] == 1) - { // already bomb - i = i - 1; - } - else - { - Point px = new Point(); - px.X=x; - px.Y=y; - if (GetValue(px) < 4) - { - bombs[x, y] = 1; - } - else - { - i = i - 1; - } - } - - } - - Init_board(); - } - private int GetValue(Point pos) { int val=0; @@ -994,6 +1035,7 @@ { if (time < int.Parse (time_rec)) { + OnRenderSound("highscore.wav"); time_rec = time.ToString(); VirtualKeyboard menu = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); @@ -1015,17 +1057,17 @@ private void SetScore() { - if (Level == "Pro") + if (_currentLevel == Level.Hard) { t_pro = time_rec; n_pro = time_name; } - if (Level == "Am") + if (_currentLevel == Level.Easy ) { t_am = time_rec; n_am = time_name; } - if (Level == "Nor") + if (_currentLevel == Level.Medium) { t_nor = time_rec; n_nor = time_name; Modified: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.csproj =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.csproj 2007-07-26 16:23:52 UTC (rev 771) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.csproj 2007-07-27 08:05:05 UTC (rev 772) @@ -14,7 +14,7 @@ <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> + <OutputPath>..\..\..\..\..\..\Mediaportal\xbmc\bin\Debug\plugins\Windows\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> @@ -30,12 +30,12 @@ <ItemGroup> <Reference Include="Core, Version=1.0.2681.38747, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\MediaPortal\xbmc\bin\Debug\Core.dll</HintPath> + <HintPath>..\..\..\..\..\..\Mediaportal\xbmc\bin\Debug\Core.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\MediaPortal\xbmc\bin\Debug\plugins\windows\Dialogs.dll</HintPath> + <HintPath>..\..\..\..\..\..\Mediaportal\xbmc\bin\Debug\plugins\Windows\Dialogs.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="System" /> @@ -45,11 +45,12 @@ <Reference Include="System.Xml" /> <Reference Include="Utils, Version=1.0.2681.38745, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\MediaPortal\xbmc\bin\Debug\Utils.dll</HintPath> + <HintPath>..\..\..\..\..\..\Mediaportal\xbmc\bin\Debug\Utils.dll</HintPath> <Private>False</Private> </Reference> </ItemGroup> <ItemGroup> + <Compile Include="LocalizeStrings.cs" /> <Compile Include="MyMinesweeper.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> @@ -66,7 +67,7 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>cd "$(SolutionDir)" -call postbuild.bat "$(TargetPath)" "$(TargetFileName)"</PostBuildEvent> + <PostBuildEvent> + </PostBuildEvent> </PropertyGroup> </Project> \ No newline at end of file Modified: trunk/plugins/My Minesweeper/Source/MyMinesweeper/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/Properties/AssemblyInfo.cs 2007-07-26 16:23:52 UTC (rev 771) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/Properties/AssemblyInfo.cs 2007-07-27 08:05:05 UTC (rev 772) @@ -31,5 +31,5 @@ // // Sie können alle Werte angeben oder die standardmäßigen Revisions- und Buildnummern // übernehmen, indem Sie "*" eingeben: -[assembly: AssemblyVersion("0.1.0.0")] -[assembly: AssemblyFileVersion("0.1.0")] +[assembly: AssemblyVersion("0.2.0.0")] +[assembly: AssemblyFileVersion("0.2.0")] Modified: trunk/plugins/My Minesweeper/readme.txt =================================================================== --- trunk/plugins/My Minesweeper/readme.txt 2007-07-26 16:23:52 UTC (rev 771) +++ trunk/plugins/My Minesweeper/readme.txt 2007-07-27 08:05:05 UTC (rev 772) @@ -1,7 +1,16 @@ Minesweeper ------------------- +Version 0.2 +----------- + - MediaPortal 0.2.3.0 ready + - added option to enable/disable sounds, while playing + - added sound for click and highscore + - plugin should be full localisable now + - minor improvements + Version 0.1 +----------- -Initial release Copy the plugin and skin files into your favorite skin folder. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kro...@us...> - 2008-03-29 20:13:52
|
Revision: 1559 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1559&view=rev Author: kroko_koenig Date: 2008-03-29 13:13:49 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Update version to 0.2 for release Modified Paths: -------------- trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_de.xml trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_en.xml trunk/plugins/My Minesweeper/Source/MyMinesweeper/LocalizeStrings.cs trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs trunk/plugins/My Minesweeper/readme.txt Added Paths: ----------- trunk/plugins/My Minesweeper/Release/plugins/Windows/MyMinesweeper.dll Modified: trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_de.xml =================================================================== --- trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_de.xml 2008-03-29 19:33:18 UTC (rev 1558) +++ trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_de.xml 2008-03-29 20:13:49 UTC (rev 1559) @@ -25,7 +25,7 @@ 0 neues Spiel Viel Glück -Mark König 2007 (kroko)</String> +Mark König 2008 (kroko)</String> </Section> </Language> \ No newline at end of file Modified: trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_en.xml =================================================================== --- trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_en.xml 2008-03-29 19:33:18 UTC (rev 1558) +++ trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/strings_en.xml 2008-03-29 20:13:49 UTC (rev 1559) @@ -25,6 +25,6 @@ 0 new game Good luck -Mark Koenig 2007 (kroko)</String> +Mark Koenig 2008 (kroko)</String> </Section> </Language> \ No newline at end of file Added: trunk/plugins/My Minesweeper/Release/plugins/Windows/MyMinesweeper.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Minesweeper/Release/plugins/Windows/MyMinesweeper.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/plugins/My Minesweeper/Source/MyMinesweeper/LocalizeStrings.cs =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/LocalizeStrings.cs 2008-03-29 19:33:18 UTC (rev 1558) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/LocalizeStrings.cs 2008-03-29 20:13:49 UTC (rev 1559) @@ -1,7 +1,7 @@ -#region Copyright (C) 2005-2007 Team MediaPortal +#region Copyright (C) 2005-2008 Team MediaPortal /* - * Copyright (C) 2005-2007 Team MediaPortal + * Copyright (C) 2005-2008 Team MediaPortal * http://www.team-mediaportal.com * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs 2008-03-29 19:33:18 UTC (rev 1558) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs 2008-03-29 20:13:49 UTC (rev 1559) @@ -1,7 +1,7 @@ -#region Copyright (C) 2005-2007 Team MediaPortal +#region Copyright (C) 2005-2008 Team MediaPortal /* - * Copyright (C) 2005-2007 Team MediaPortal + * Copyright (C) 2005-2008 Team MediaPortal * http://www.team-mediaportal.com * * This Program is free software; you can redistribute it and/or modify @@ -38,1070 +38,1070 @@ namespace MediaPortal.GUI.MyMinesweeper { - [PluginIcons("MyMinesweeper.minesweeper.png", "MyMinesweeper.minesweeperDisabled.png")] - public class MyMinesweeperGUI : GUIWindow, ISetupForm + [PluginIcons("MyMinesweeper.minesweeper.png", "MyMinesweeper.minesweeperDisabled.png")] + public class MyMinesweeperGUI : GUIWindow, ISetupForm + { + #region enums + + private enum Level { - #region enums + Easy = 0, + Medium = 1, + Hard = 2 + } - private enum Level - { - Easy = 0, - Medium = 1, - Hard = 2 - } + #endregion - #endregion + #region SkinControl - #region SkinControl + [SkinControlAttribute(2)] + protected GUIButtonControl btnStart = null; + [SkinControlAttribute(4)] + protected GUIButtonControl btnLevel = null; + [SkinControlAttribute(5)] + protected GUIToggleButtonControl btnSound = null; + [SkinControlAttribute(10)] + protected GUIButtonControl btnWhatsThis = null; - [SkinControlAttribute(2)] - protected GUIButtonControl btnStart = null; - [SkinControlAttribute(4)] - protected GUIButtonControl btnLevel = null; - [SkinControlAttribute(5)] - protected GUIToggleButtonControl btnSound = null; - [SkinControlAttribute(10)] - protected GUIButtonControl btnWhatsThis = null; + #endregion - #endregion + #region Private variables - #region Private variables + Level _currentLevel = Level.Easy; + bool GameOver = false; // not game over + bool GameON = false; // Game is on + bool _soundOn = true; - Level _currentLevel = Level.Easy; - bool GameOver = false; // not game over - bool GameON = false; // Game is on - bool _soundOn = true; + int[,] board = new int[30, 30]; + int[,] bombs = new int[30, 30]; + bool initBoard = false; - int[,] board = new int[30, 30]; - int[,] bombs = new int[30, 30]; - bool initBoard = false; + int bx = 10; + int by = 10; + int bcnt = 10; - int bx = 10; - int by = 10; - int bcnt = 10; + int time = 0; + string time_rec = "999"; + string time_name = "unknown"; - int time = 0; - string time_rec = "999"; - string time_name = "unknown"; + string t_pro; + string t_nor; + string t_am; - string t_pro; - string t_nor; - string t_am; + string n_pro; + string n_nor; + string n_am; - string n_pro; - string n_nor; - string n_am; + int ID = 0; - int ID = 0; + private static OnActionHandler ah; - private static OnActionHandler ah; + // game ticker for the timer + private System.Windows.Forms.Timer _Game = new System.Windows.Forms.Timer(); - // game ticker for the timer - private System.Windows.Forms.Timer _Game = new System.Windows.Forms.Timer(); + int[] posX = { -1, 0, 1, -1, 1, -1, 0, 1 }; + int[] posY = { -1, -1, -1, 0, 0, 1, 1, 1 }; - int[] posX = { -1, 0, 1, -1, 1, -1 , 0 , 1 }; - int[] posY = { -1, -1, -1, 0, 0, 1, 1, 1 }; + #endregion - #endregion + #region ISetupForm Members - #region ISetupForm Members + // Returns the name of the plugin which is shown in the plugin menu + public string PluginName() + { + return "My Minesweeper"; + } - // Returns the name of the plugin which is shown in the plugin menu - public string PluginName() - { - return "My Minesweeper"; - } + // Returns the description of the plugin is shown in the plugin menu + public string Description() + { + return "My Minesweeper"; + } - // Returns the description of the plugin is shown in the plugin menu - public string Description() - { - return "My Minesweeper"; - } + // Returns the author of the plugin which is shown in the plugin menu + public string Author() + { + return "Mark Koenig 2008 (kroko)"; + } - // Returns the author of the plugin which is shown in the plugin menu - public string Author() - { - return "Mark Koenig (kroko)"; - } + // show the setup dialog + public void ShowPlugin() + { + MessageBox.Show("Nothing to configure, this is just an example"); + } - // show the setup dialog - public void ShowPlugin() - { - MessageBox.Show("Nothing to configure, this is just an example"); - } + // Indicates whether plugin can be enabled/disabled + public bool CanEnable() + { + return true; + } - // Indicates whether plugin can be enabled/disabled - public bool CanEnable() - { - return true; - } + // get ID of windowplugin belonging to this setup + public int GetWindowId() + { + return 32327501; + } - // get ID of windowplugin belonging to this setup - public int GetWindowId() - { - return 32327501; - } + // Indicates if plugin is enabled by default; + public bool DefaultEnabled() + { + return true; + } - // Indicates if plugin is enabled by default; - public bool DefaultEnabled() - { - return true; - } + // indicates if a plugin has its own setup screen + public bool HasSetup() + { + return false; + } - // indicates if a plugin has its own setup screen - public bool HasSetup() - { - return false; - } + /// <summary> + /// If the plugin should have its own button on the main menu of MediaPortal then it + /// should return true to this method, otherwise if it should not be on home + /// it should return false + /// </summary> + /// <param name="strButtonText">text the button should have</param> + /// <param name="strButtonImage">image for the button, or empty for default</param> + /// <param name="strButtonImageFocus">image for the button, or empty for default</param> + /// <param name="strPictureImage">subpicture for the button or empty for none</param> + /// <returns>true : plugin needs its own button on home + /// false : plugin does not need its own button on home</returns> - /// <summary> - /// If the plugin should have its own button on the main menu of MediaPortal then it - /// should return true to this method, otherwise if it should not be on home - /// it should return false - /// </summary> - /// <param name="strButtonText">text the button should have</param> - /// <param name="strButtonImage">image for the button, or empty for default</param> - /// <param name="strButtonImageFocus">image for the button, or empty for default</param> - /// <param name="strPictureImage">subpicture for the button or empty for none</param> - /// <returns>true : plugin needs its own button on home - /// false : plugin does not need its own button on home</returns> + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + strButtonText = MyMinesweeper.GUILocalizeStrings.Get(0); ; + strButtonImage = String.Empty; + strButtonImageFocus = String.Empty; + strPictureImage = @"hover_my_minesweeper.png"; + return true; + } - public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) - { - strButtonText = MyMinesweeper.GUILocalizeStrings.Get(0); ; - strButtonImage = String.Empty; - strButtonImageFocus = String.Empty; - strPictureImage = @"hover_my_minesweeper.png"; - return true; - } + #endregion - #endregion + #region Overrides - #region Overrides + public override int GetID + { + get + { + return 32327501; + } + set + { + base.GetID = value; + } + } - public override int GetID - { - get - { - return 32327501; - } - set - { - base.GetID = value; - } - } + public override bool Init() + { + MyMinesweeper.GUILocalizeStrings.Load(GUI.Library.GUILocalizeStrings.CurrentLanguage()); - public override bool Init() - { - MyMinesweeper.GUILocalizeStrings.Load(GUI.Library.GUILocalizeStrings.CurrentLanguage()); + if (ah == null) ah = new OnActionHandler(OnAction2); - if (ah == null) ah = new OnActionHandler(OnAction2); + bool result = Load(GUIGraphicsContext.Skin + @"\MyMinesweeper.xml"); + return result; + } - bool result = Load(GUIGraphicsContext.Skin + @"\MyMinesweeper.xml"); - return result; - } + public override bool OnMessage(GUIMessage message) + { + if (message.Message == GUI.Library.GUIMessage.MessageType.GUI_MSG_SETFOCUS) + { + ID = message.TargetControlId; + } + return base.OnMessage(message); + } - public override bool OnMessage(GUIMessage message) - { - if (message.Message == GUI.Library.GUIMessage.MessageType.GUI_MSG_SETFOCUS) - { - ID = message.TargetControlId; - } - return base.OnMessage(message); - } + protected override void OnPageLoad() + { - protected override void OnPageLoad() - { + // start game ticker + _Game.Interval = 1000; + _Game.Tick += new EventHandler(_Game_Tick); + _Game.Start(); - // start game ticker - _Game.Interval = 1000; - _Game.Tick += new EventHandler(_Game_Tick); - _Game.Start(); + base.OnPageLoad(); - base.OnPageLoad(); + LoadSettings(); - LoadSettings(); + OnBtnStart(); - OnBtnStart(); + GUIGraphicsContext.OnNewAction -= ah; + GUIGraphicsContext.OnNewAction += ah; - GUIGraphicsContext.OnNewAction -= ah; - GUIGraphicsContext.OnNewAction += ah; + GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); + GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); - GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); - GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); + // set localized labels for static controls + GUIPropertyManager.SetProperty("#header_label", MyMinesweeper.GUILocalizeStrings.Get(0)); // MyMinesweeper + GUIControl.SetControlLabel(GetID, btnStart.GetID, MyMinesweeper.GUILocalizeStrings.Get(1)); // New Game + GUIControl.SetControlLabel(GetID, btnSound.GetID, MyMinesweeper.GUILocalizeStrings.Get(9)); // Sounds + GUIControl.SetControlLabel(GetID, btnWhatsThis.GetID, MyMinesweeper.GUILocalizeStrings.Get(31)); // What is MyMinesweeper? - // set localized labels for static controls - GUIPropertyManager.SetProperty("#header_label", MyMinesweeper.GUILocalizeStrings.Get(0)); // MyMinesweeper - GUIControl.SetControlLabel(GetID, btnStart.GetID, MyMinesweeper.GUILocalizeStrings.Get(1)); // New Game - GUIControl.SetControlLabel(GetID, btnSound.GetID, MyMinesweeper.GUILocalizeStrings.Get(9)); // Sounds - GUIControl.SetControlLabel(GetID, btnWhatsThis.GetID, MyMinesweeper.GUILocalizeStrings.Get(31)); // What is MyMinesweeper? + UpdateButtonStates(); + } - UpdateButtonStates(); - } + protected override void OnPageDestroy(int new_windowId) + { + _Game.Stop(); + _Game.Tick -= new EventHandler(_Game_Tick); - protected override void OnPageDestroy(int new_windowId) - { - _Game.Stop(); - _Game.Tick -= new EventHandler(_Game_Tick); + SaveSettings(); + } - SaveSettings(); - } + protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) + { + if ((controlId >= 500) && (!GameOver)) + { + GameON = true; - protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) - { - if ((controlId >= 500) && (!GameOver)) - { - GameON = true; + int y = controlId - 500; + y = (int)y / 30; - int y = controlId - 500; - y = (int)y / 30; + int x = controlId - 500; + x = x - (y * 30); - int x = controlId - 500; - x = x - (y * 30); + x = x - 1; + y = y - 1; - x = x - 1; - y = y - 1; + if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; - if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) - { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - - SetPlace(pt); - } - } - - - if (control == btnWhatsThis) - { - OnBtnWhatsThis(); - } - if (control == btnLevel) - { - OnBtnLevel(); - } - if (control == btnStart) - { - OnBtnStart(); - } - if (control == btnSound ) - { - OnBtnSound(); - } - + SetPlace(pt); } + } - protected override void OnShowContextMenu() - { - base.OnShowContextMenu(); - } - #endregion + if (control == btnWhatsThis) + { + OnBtnWhatsThis(); + } + if (control == btnLevel) + { + OnBtnLevel(); + } + if (control == btnStart) + { + OnBtnStart(); + } + if (control == btnSound) + { + OnBtnSound(); + } - #region Implementation + } - private void OnBtnStart() - { - GameOver = false; - GameON = false; - time = 0; - ID = 0; + protected override void OnShowContextMenu() + { + base.OnShowContextMenu(); + } - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); + #endregion - if (_currentLevel == Level.Easy) - { - bx = 10; - by = 10; - bcnt = 10; - time_rec = t_am; - time_name = n_am; - } - if (_currentLevel == Level.Medium) - { - bx = 15; - by = 15; - bcnt = 40; - time_rec = t_nor; - time_name = n_nor; - } - if (_currentLevel == Level.Hard) - { - bx = 20; - by = 20; - bcnt = 100; - time_rec = t_pro; - time_name = n_pro; - } + #region Implementation - GUIPropertyManager.SetProperty("#minesweeper_record", "Record: " + time_rec + "s - " + time_name); + private void OnBtnStart() + { + GameOver = false; + GameON = false; + time = 0; + ID = 0; - // remove controls from form - try - { - for (int i = 500; i < 1180; i++) - { - Remove(i); - } - } - catch - { - - } + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); - for (int i = 0; i < 30; i++) - { - for (int j = 0; j < 30; j++) - { // 20 = not checked - board[i, j] = 20; - // no bombs - bombs[i, j] = 0; - } - } + if (_currentLevel == Level.Easy) + { + bx = 10; + by = 10; + bcnt = 10; + time_rec = t_am; + time_name = n_am; + } + if (_currentLevel == Level.Medium) + { + bx = 15; + by = 15; + bcnt = 40; + time_rec = t_nor; + time_name = n_nor; + } + if (_currentLevel == Level.Hard) + { + bx = 20; + by = 20; + bcnt = 100; + time_rec = t_pro; + time_name = n_pro; + } - Random rnd = new Random(); + GUIPropertyManager.SetProperty("#minesweeper_record", "Record: " + time_rec + "s - " + time_name); - for (int i = 0; i < bcnt; i++) - { - int x = rnd.Next(0, bx); - int y = rnd.Next(0, by); - if (bombs[x, y] == 1) - { // already bomb - i = i - 1; - } - else - { - Point px = new Point(); - px.X = x; - px.Y = y; - if (GetValue(px) < 4) - { - bombs[x, y] = 1; - } - else - { - i = i - 1; - } - } + // remove controls from form + try + { + for (int i = 500; i < 1180; i++) + { + Remove(i); + } + } + catch + { - } + } - Init_board(); + for (int i = 0; i < 30; i++) + { + for (int j = 0; j < 30; j++) + { // 20 = not checked + board[i, j] = 20; + // no bombs + bombs[i, j] = 0; } + } - private void OnBtnLevel() - { //Choose level for the game - { - switch (_currentLevel) - { - case Level.Easy: - _currentLevel = Level.Medium; - break; - case Level.Medium: - _currentLevel = Level.Hard; - break; - case Level.Hard: - _currentLevel = Level.Easy; - break; - } + Random rnd = new Random(); - OnBtnStart(); - - UpdateButtonStates(); - } + for (int i = 0; i < bcnt; i++) + { + int x = rnd.Next(0, bx); + int y = rnd.Next(0, by); + if (bombs[x, y] == 1) + { // already bomb + i = i - 1; } - - private void OnBtnSound() + else { - _soundOn = btnSound.Selected; - UpdateButtonStates(); + Point px = new Point(); + px.X = x; + px.Y = y; + if (GetValue(px) < 4) + { + bombs[x, y] = 1; + } + else + { + i = i - 1; + } } - private void OnBtnWhatsThis() - { - GUIDialogText dlg = (GUIDialogText)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TEXT); - dlg.SetHeading(MyMinesweeper.GUILocalizeStrings.Get(31)); // help dialog heading - dlg.SetText(MyMinesweeper.GUILocalizeStrings.Get(32)); // help dialog text - dlg.DoModal(GetID); - } + } - private void OnRenderSound(string strFilePath) + Init_board(); + } + + private void OnBtnLevel() + { //Choose level for the game + { + switch (_currentLevel) { - if (_soundOn) - { - MediaPortal.Util.Utils.PlaySound(strFilePath, false, true); - } + case Level.Easy: + _currentLevel = Level.Medium; + break; + case Level.Medium: + _currentLevel = Level.Hard; + break; + case Level.Hard: + _currentLevel = Level.Easy; + break; } - private void UpdateButtonStates() - { - // enable/disable buttons - btnSound.Selected = _soundOn; + OnBtnStart(); - // refresh label for btnLevel - string strLine = MyMinesweeper.GUILocalizeStrings.Get(10); // Level: - switch (_currentLevel) - { - case Level.Easy: - strLine += MyMinesweeper.GUILocalizeStrings.Get(11); // easy - break; - case Level.Medium: - strLine += MyMinesweeper.GUILocalizeStrings.Get(12); // medium - break; - case Level.Hard: - strLine += MyMinesweeper.GUILocalizeStrings.Get(13); // difficult - break; - } - GUIControl.SetControlLabel(GetID, btnLevel.GetID, strLine); + UpdateButtonStates(); + } + } - // refresh label for btnMode - strLine = MyMinesweeper.GUILocalizeStrings.Get(20); // Mode: Play vs + private void OnBtnSound() + { + _soundOn = btnSound.Selected; + UpdateButtonStates(); + } - } + private void OnBtnWhatsThis() + { + GUIDialogText dlg = (GUIDialogText)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TEXT); + dlg.SetHeading(MyMinesweeper.GUILocalizeStrings.Get(31)); // help dialog heading + dlg.SetText(MyMinesweeper.GUILocalizeStrings.Get(32)); // help dialog text + dlg.DoModal(GetID); + } - #endregion + private void OnRenderSound(string strFilePath) + { + if (_soundOn) + { + MediaPortal.Util.Utils.PlaySound(strFilePath, false, true); + } + } - public void Dispose() - { - _Game.Stop(); - _Game.Tick -= new EventHandler(_Game_Tick); - } + private void UpdateButtonStates() + { + // enable/disable buttons + btnSound.Selected = _soundOn; - #region Actions + // refresh label for btnLevel + string strLine = MyMinesweeper.GUILocalizeStrings.Get(10); // Level: + switch (_currentLevel) + { + case Level.Easy: + strLine += MyMinesweeper.GUILocalizeStrings.Get(11); // easy + break; + case Level.Medium: + strLine += MyMinesweeper.GUILocalizeStrings.Get(12); // medium + break; + case Level.Hard: + strLine += MyMinesweeper.GUILocalizeStrings.Get(13); // difficult + break; + } + GUIControl.SetControlLabel(GetID, btnLevel.GetID, strLine); - public override void OnAction(Action action) - { - base.OnAction(action); - } + // refresh label for btnMode + strLine = MyMinesweeper.GUILocalizeStrings.Get(20); // Mode: Play vs - public void OnAction2(Action action) - { - switch (action.wID) - { - case Action.ActionType.ACTION_KEY_PRESSED: - switch (action.m_key.KeyChar) - { - case '1': - SetBomb(); - break; - case '2': - SetQuest(); - break; - case '3': - Check9(); - break; - case '0': - OnBtnStart(); - break; - } - break; - } - } + } - #endregion + #endregion - private void CreateButton(int ID, int posx, int posy, int height, int width, string focusimg, string nofocusimg) - { - GUIButtonControl button = new GUIButtonControl(GetID, ID, posx, posy, width, height, focusimg, nofocusimg); - button.AllocResources(); - GUIControl btnControl = (GUIControl)button; - Add(ref btnControl); - } + public void Dispose() + { + _Game.Stop(); + _Game.Tick -= new EventHandler(_Game_Tick); + } - void _Game_Tick(object sender, EventArgs e) - { - if ((!GameOver) && (time<999) && (GameON == true)) - { - time++; - } - GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); - GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); - } + #region Actions - private void Init_board() - { - // get position from the start button - int StartX = GetControl(1200).XPosition; - int StartY = GetControl(1200).YPosition; - // Disable level control - GUIControl.HideControl(GetID, 1200); + public override void OnAction(Action action) + { + base.OnAction(action); + } - try - { - int StartT = GetControl(500).XPosition; - } - catch - { - initBoard = false; - } + public void OnAction2(Action action) + { + switch (action.wID) + { + case Action.ActionType.ACTION_KEY_PRESSED: + switch (action.m_key.KeyChar) + { + case '1': + SetBomb(); + break; + case '2': + SetQuest(); + break; + case '3': + Check9(); + break; + case '0': + OnBtnStart(); + break; + } + break; + } + } - if (!initBoard) - { - initBoard = true; + #endregion - // set start button navigation - GetControl(2).SetNavigation(8, 4, 2, 531); + private void CreateButton(int ID, int posx, int posy, int height, int width, string focusimg, string nofocusimg) + { + GUIButtonControl button = new GUIButtonControl(GetID, ID, posx, posy, width, height, focusimg, nofocusimg); + button.AllocResources(); + GUIControl btnControl = (GUIControl)button; + Add(ref btnControl); + } - for (int y = 0; y < (by+2); y++) - { - for (int x = 0; x < (bx+2); x++) - { - int nr = 500 + x + (y * 30); + void _Game_Tick(object sender, EventArgs e) + { + if ((!GameOver) && (time < 999) && (GameON == true)) + { + time++; + } + GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); + GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); + } - int xp = StartX + (20 * x); - int yp = StartY + (20 * y); + private void Init_board() + { + // get position from the start button + int StartX = GetControl(1200).XPosition; + int StartY = GetControl(1200).YPosition; + // Disable level control + GUIControl.HideControl(GetID, 1200); - //default navigation - int up = nr - 30; - int dn = nr + 30; - int le = nr - 1; - int ri = nr + 1; - //top bottom navigation - if ((y == 0) || (y==by+1)) - { - up = nr; - dn = nr; - le = nr; - ri = nr; - } - //left right navigation - if ((x == 0) || (x == bx + 1)) - { - up = nr; - dn = nr; - le = nr; - ri = nr; - } - //left to start - if (x == 1) - { - le = 2; - } - // right stop - if (x == bx) - { - ri = nr; - } - // top stop - if (y == 1) - { - up = nr; - } - // right stop - if (y == by) - { - dn = nr; - } + try + { + int StartT = GetControl(500).XPosition; + } + catch + { + initBoard = false; + } - CreateButton(nr, xp, yp, 20, 20, "#F" + nr, "#NF" + nr); - GetControl(nr).SetNavigation(up, dn, le, ri); + if (!initBoard) + { + initBoard = true; - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); - - } - } - for (int x = 0; x < (bx + 2); x++) - { - int nr = 500 + x; - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\topborder.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\topborder.png"); - } - for (int x = 0; x < (bx + 2); x++) - { - int nr = 500 + (30*(by+1)) + x; - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bottomborder.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bottomborder.png"); - } - for (int y = 0; y < by; y++) - { - int nr = 530 + (y*30); - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\leftborder.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\leftborder.png"); - nr = nr + bx + 1; - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\rightborder.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\rightborder.png"); - } - GUIPropertyManager.SetProperty("#F" + 500, @"\Minesweeper\Board\topleftcorner.png"); - GUIPropertyManager.SetProperty("#NF" + 500, @"\Minesweeper\Board\topleftcorner.png"); - GUIPropertyManager.SetProperty("#F" + (501+bx), @"\Minesweeper\Board\toprightcorner.png"); - GUIPropertyManager.SetProperty("#NF" + (501+bx), @"\Minesweeper\Board\toprightcorner.png"); - - GUIPropertyManager.SetProperty("#F" + (500+(30*(by+1))), @"\Minesweeper\Board\bottomleftcorner.png"); - GUIPropertyManager.SetProperty("#NF" + (500+(30*(by+1))), @"\Minesweeper\Board\bottomleftcorner.png"); - GUIPropertyManager.SetProperty("#F" + (501+(30*(by+1)+bx)), @"\Minesweeper\Board\bottomrightcorner.png"); - GUIPropertyManager.SetProperty("#NF" + (501+(30*(by+1)+bx)), @"\Minesweeper\Board\bottomrightcorner.png"); - } + // set start button navigation + GetControl(2).SetNavigation(8, 4, 2, 531); - GUIControl.FocusControl(GetID, 531); - } - - private void SetPlace(Point pos) + for (int y = 0; y < (by + 2); y++) { - if ((bombs[pos.X, pos.Y] != 0) && (board[pos.X, pos.Y] != 9)) - { - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\sad.png"); - GameOver = true; - OnRenderSound ("bomb.wav"); - EndGame(); - board[pos.X, pos.Y] = 12; - SetPoint(pos); - } - if (board[pos.X, pos.Y] == 20) - { - board[pos.X, pos.Y] = GetValue(pos); - SetPoint(pos); + for (int x = 0; x < (bx + 2); x++) + { + int nr = 500 + x + (y * 30); - OnRenderSound("tick.wav"); + int xp = StartX + (20 * x); + int yp = StartY + (20 * y); - if (board[pos.X, pos.Y] == 0) - { - EmptyPos(); - } - if (Finished() == true) - { - CheckAllBoms(); - GameOver = true; - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\cool.png"); - CheckHiScore(); - } - } - } - - private void SetPoint(Point pos) - { - int nr = 531 + (pos.Y * 30) + pos.X; - - if (board[pos.X, pos.Y] == 0) + //default navigation + int up = nr - 30; + int dn = nr + 30; + int le = nr - 1; + int ri = nr + 1; + //top bottom navigation + if ((y == 0) || (y == by + 1)) { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check0sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check0unsel.png"); + up = nr; + dn = nr; + le = nr; + ri = nr; } - if (board[pos.X, pos.Y] == 1) + //left right navigation + if ((x == 0) || (x == bx + 1)) { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check1sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check1unsel.png"); + up = nr; + dn = nr; + le = nr; + ri = nr; } - if (board[pos.X, pos.Y] == 2) + //left to start + if (x == 1) { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check2sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check2unsel.png"); + le = 2; } - if (board[pos.X, pos.Y] == 3) + // right stop + if (x == bx) { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check3sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check3unsel.png"); + ri = nr; } - if (board[pos.X, pos.Y] == 4) + // top stop + if (y == 1) { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check4sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check4unsel.png"); + up = nr; } - if (board[pos.X, pos.Y] == 5) + // right stop + if (y == by) { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check5sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check5unsel.png"); + dn = nr; } - if (board[pos.X, pos.Y] == 6) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check6sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check6unsel.png"); - } - if (board[pos.X, pos.Y] == 7) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check7sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check7unsel.png"); - } - if (board[pos.X, pos.Y] == 8) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check8sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check8unsel.png"); - } - if (board[pos.X, pos.Y] == 9) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\markedasbomsel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\markedasbom.png"); - } - if (board[pos.X, pos.Y] == 10) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\questionmarksel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\questionmark.png"); - } - if (board[pos.X, pos.Y] == 11) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bomb.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bomb.png"); - } - if (board[pos.X, pos.Y] == 12) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bombexplode.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bombexplode.png"); - } - if (board[pos.X, pos.Y] == 20) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); - } - } - private int GetValue(Point pos) - { - int val=0; + CreateButton(nr, xp, yp, 20, 20, "#F" + nr, "#NF" + nr); + GetControl(nr).SetNavigation(up, dn, le, ri); - for (int i = 0; i < 8; i++) - { - int x = pos.X + posX[i]; - int y = pos.Y + posY[i]; - if ((x>=0) && (y>=0) && (x<bx) && (y<by)) - { - if (bombs[x, y] != 0) - { - val++; - } - } + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); - } - return val; + } } - - private int GetMBombs(Point pos) + for (int x = 0; x < (bx + 2); x++) { - int val = 0; + int nr = 500 + x; + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\topborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\topborder.png"); + } + for (int x = 0; x < (bx + 2); x++) + { + int nr = 500 + (30 * (by + 1)) + x; + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bottomborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bottomborder.png"); + } + for (int y = 0; y < by; y++) + { + int nr = 530 + (y * 30); + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\leftborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\leftborder.png"); + nr = nr + bx + 1; + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\rightborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\rightborder.png"); + } + GUIPropertyManager.SetProperty("#F" + 500, @"\Minesweeper\Board\topleftcorner.png"); + GUIPropertyManager.SetProperty("#NF" + 500, @"\Minesweeper\Board\topleftcorner.png"); + GUIPropertyManager.SetProperty("#F" + (501 + bx), @"\Minesweeper\Board\toprightcorner.png"); + GUIPropertyManager.SetProperty("#NF" + (501 + bx), @"\Minesweeper\Board\toprightcorner.png"); - for (int i = 0; i < 8; i++) - { - int x = pos.X + posX[i]; - int y = pos.Y + posY[i]; - if ((x >= 0) && (y >= 0) && (x < 30) && (y < 30)) - { - if (board[x, y] == 9) - { - val++; - } - } + GUIPropertyManager.SetProperty("#F" + (500 + (30 * (by + 1))), @"\Minesweeper\Board\bottomleftcorner.png"); + GUIPropertyManager.SetProperty("#NF" + (500 + (30 * (by + 1))), @"\Minesweeper\Board\bottomleftcorner.png"); + GUIPropertyManager.SetProperty("#F" + (501 + (30 * (by + 1) + bx)), @"\Minesweeper\Board\bottomrightcorner.png"); + GUIPropertyManager.SetProperty("#NF" + (501 + (30 * (by + 1) + bx)), @"\Minesweeper\Board\bottomrightcorner.png"); + } - } - return val; - } + GUIControl.FocusControl(GetID, 531); + } - private void EndGame() + private void SetPlace(Point pos) + { + if ((bombs[pos.X, pos.Y] != 0) && (board[pos.X, pos.Y] != 9)) + { + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\sad.png"); + GameOver = true; + OnRenderSound("bomb.wav"); + EndGame(); + board[pos.X, pos.Y] = 12; + SetPoint(pos); + } + if (board[pos.X, pos.Y] == 20) + { + board[pos.X, pos.Y] = GetValue(pos); + SetPoint(pos); + + OnRenderSound("tick.wav"); + + if (board[pos.X, pos.Y] == 0) { - for (int y = 0; y < by; y++) - { - for (int x = 0; x < bx; x++) - { - if (bombs[x, y] != 0) - { - board[x, y] = 11; - Point pos = new Point(); - pos.X = x; - pos.Y = y; - SetPoint(pos); - } - } - } + EmptyPos(); } - - private void EmptyPos() + if (Finished() == true) { - bool rep = true; + CheckAllBoms(); + GameOver = true; + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\cool.png"); + CheckHiScore(); + } + } + } - while (rep) - { - rep = false; - for (int y = 0; y < by; y++) - { - for (int x = 0; x < bx; x++) - { - if (board[x, y] == 0) - { - // bomb counter = 0 - int cnt = 0; - for (int i = 0; i < 8; i++) - { - int x1 = x + posX[i]; - int y1 = y + posY[i]; - if ((x1 >= 0) && (y1 >= 0) && (x1 < bx) && (y1 < by)) - { - if (bombs[x1, y1] != 0) - { // found bomb - cnt++; - } - } - } + private void SetPoint(Point pos) + { + int nr = 531 + (pos.Y * 30) + pos.X; - if (cnt == 0) - { - for (int i = 0; i < 8; i++) - { - int x1 = x + posX[i]; - int y1 = y + posY[i]; - if ((x1 >= 0) && (y1 >= 0) && (x1 < bx) && (y1 < by)) - { - if (board[x1, y1] == 20) - { - Point pos = new Point(); - pos.X = x1; - pos.Y = y1; + if (board[pos.X, pos.Y] == 0) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check0sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check0unsel.png"); + } + if (board[pos.X, pos.Y] == 1) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check1sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check1unsel.png"); + } + if (board[pos.X, pos.Y] == 2) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check2sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check2unsel.png"); + } + if (board[pos.X, pos.Y] == 3) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check3sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check3unsel.png"); + } + if (board[pos.X, pos.Y] == 4) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check4sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check4unsel.png"); + } + if (board[pos.X, pos.Y] == 5) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check5sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check5unsel.png"); + } + if (board[pos.X, pos.Y] == 6) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check6sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check6unsel.png"); + } + if (board[pos.X, pos.Y] == 7) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check7sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check7unsel.png"); + } + if (board[pos.X, pos.Y] == 8) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check8sel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check8unsel.png"); + } + if (board[pos.X, pos.Y] == 9) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\markedasbomsel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\markedasbom.png"); + } + if (board[pos.X, pos.Y] == 10) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\questionmarksel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\questionmark.png"); + } + if (board[pos.X, pos.Y] == 11) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bomb.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bomb.png"); + } + if (board[pos.X, pos.Y] == 12) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bombexplode.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bombexplode.png"); + } + if (board[pos.X, pos.Y] == 20) + { + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); + } + } - board[x1, y1] = GetValue(pos) ; - SetPoint(pos); - rep = true; - } - } - } - } - } - } - } - } - + private int GetValue(Point pos) + { + int val = 0; + + for (int i = 0; i < 8; i++) + { + int x = pos.X + posX[i]; + int y = pos.Y + posY[i]; + if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) + { + if (bombs[x, y] != 0) + { + val++; + } } - private void SetBomb() + } + return val; + } + + private int GetMBombs(Point pos) + { + int val = 0; + + for (int i = 0; i < 8; i++) + { + int x = pos.X + posX[i]; + int y = pos.Y + posY[i]; + if ((x >= 0) && (y >= 0) && (x < 30) && (y < 30)) { - if ((ID >= 500) && (!GameOver)) - { - GameON = true; + if (board[x, y] == 9) + { + val++; + } + } - int y = ID - 500; - y = (int)y / 30; + } + return val; + } - int x = ID - 500; - x = x - (y * 30); + private void EndGame() + { + for (int y = 0; y < by; y++) + { + for (int x = 0; x < bx; x++) + { + if (bombs[x, y] != 0) + { + board[x, y] = 11; + Point pos = new Point(); + pos.X = x; + pos.Y = y; + SetPoint(pos); + } + } + } + } - x = x - 1; - y = y - 1; + private void EmptyPos() + { + bool rep = true; - int val = board[x, y]; + while (rep) + { + rep = false; + for (int y = 0; y < by; y++) + { + for (int x = 0; x < bx; x++) + { + if (board[x, y] == 0) + { + // bomb counter = 0 + int cnt = 0; + for (int i = 0; i < 8; i++) + { + int x1 = x + posX[i]; + int y1 = y + posY[i]; + if ((x1 >= 0) && (y1 >= 0) && (x1 < bx) && (y1 < by)) + { + if (bombs[x1, y1] != 0) + { // found bomb + cnt++; + } + } + } - if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) + if (cnt == 0) + { + for (int i = 0; i < 8; i++) { - if (val == 20) + int x1 = x + posX[i]; + int y1 = y + posY[i]; + if ((x1 >= 0) && (y1 >= 0) && (x1 < bx) && (y1 < by)) + { + if (board[x1, y1] == 20) { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - board[x, y] = 9; - SetPoint(pt); - bcnt--; + Point pos = new Point(); + pos.X = x1; + pos.Y = y1; + + board[x1, y1] = GetValue(pos); + SetPoint(pos); + rep = true; } - if (val == 9) - { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - board[x, y] = 20; - SetPoint(pt); - bcnt++; - } + } } - if (Finished() == true) - { - CheckAllBoms(); - GameOver = true; - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\cool.png"); - CheckHiScore(); - } + } } + } } + } - private void SetQuest() - { - if ((ID >= 500) && (!GameOver)) - { - GameON = true; + } - int y = ID - 500; - y = (int)y / 30; + private void SetBomb() + { + if ((ID >= 500) && (!GameOver)) + { + GameON = true; - int x = ID - 500; - x = x - (y * 30); + int y = ID - 500; + y = (int)y / 30; - x = x - 1; - y = y - 1; + int x = ID - 500; + x = x - (y * 30); - int val = board[x, y]; + x = x - 1; + y = y - 1; - if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) - { - if (val == 20) - { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - board[x, y] = 10; - SetPoint(pt); - } - if (val == 10) - { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - board[x, y] = 20; - SetPoint(pt); - } - } - } - } + int val = board[x, y]; - private void Check9() + if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) { - if ((ID >= 500) && (!GameOver) && (GameON)) - { - int y = ID - 500; - y = (int)y / 30; + if (val == 20) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + board[x, y] = 9; + SetPoint(pt); + bcnt--; + } + if (val == 9) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + board[x, y] = 20; + SetPoint(pt); + bcnt++; + } + } + if (Finished() == true) + { + CheckAllBoms(); + GameOver = true; + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\cool.png"); + CheckHiScore(); + } + } + } - int x = ID - 500; - x = x - (y * 30); + private void SetQuest() + { + if ((ID >= 500) && (!GameOver)) + { + GameON = true; - x = x - 1; - y = y - 1; + int y = ID - 500; + y = (int)y / 30; - if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) - { - int val = board[x, y]; - Point pt = new Point(); - pt.X = x; - pt.Y = y; + int x = ID - 500; + x = x - (y * 30); - if (val == GetMBombs(pt)) - { - for (int i = 0; i < 8; i++) - { - Point px = new Point(); - px.X = x + posX[i]; - px.Y = y + posY[i]; + x = x - 1; + y = y - 1; - if ((px.X >= 0) && (px.Y >= 0) && (px.X < bx) && (px.Y < by)) - { - SetPlace(px); - } - } - } - } - } + int val = board[x, y]; - } - - private void CheckAllBoms() + if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) { - for (int y = 0; y < by; y++) - { - for (int x = 0; x < bx; x++) - { - if ((board[x,y]==20) && (bombs[x,y]==1)) - { - board[x, y] = 9; - Point px = new Point(); - px.X = x; - px.Y = y; - SetPoint(px); - } - } - } - bcnt = 0; + if (val == 20) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + board[x, y] = 10; + SetPoint(pt); + } + if (val == 10) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + board[x, y] = 20; + SetPoint(pt); + } } + } + } - private bool Finished() + private void Check9() +... [truncated message content] |