|
From: <che...@us...> - 2007-05-27 01:20:02
|
Revision: 458
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=458&view=rev
Author: chef_koch
Date: 2007-05-26 18:20:00 -0700 (Sat, 26 May 2007)
Log Message:
-----------
added option to enable/disabled sound effects
Modified Paths:
--------------
trunk/plugins/My Hexxagon/Skin/SimpleMP/MyHexxagon.xml
trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon/MyHexxagon.cs
trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon/MyHexxagon.csproj
Added Paths:
-----------
trunk/plugins/My Hexxagon/Skin/BlueTwo/MyHexxagon.xml
trunk/plugins/My Hexxagon/language/
trunk/plugins/My Hexxagon/language/MyHexxagon/
trunk/plugins/My Hexxagon/language/MyHexxagon/strings_de.xml
trunk/plugins/My Hexxagon/language/MyHexxagon/strings_en.xml
Added: trunk/plugins/My Hexxagon/Skin/BlueTwo/MyHexxagon.xml
===================================================================
--- trunk/plugins/My Hexxagon/Skin/BlueTwo/MyHexxagon.xml (rev 0)
+++ trunk/plugins/My Hexxagon/Skin/BlueTwo/MyHexxagon.xml 2007-05-27 01:20:00 UTC (rev 458)
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<window>
+ <id>1234711</id>
+ <defaultcontrol>2</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
+ <autohidetopbar>yes</autohidetopbar>
+ <controls>
+ <import>common.time.xml</import>
+ <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>header label</description>
+ <type>label</type>
+ <id>1</id>
+ <posX>250</posX>
+ <posY>70</posY>
+ <label>#header_label</label>
+ <font>font16</font>
+ <align>right</align>
+ <textcolor>White</textcolor>
+ <animation effect="fade" time="200">WindowOpen</animation>
+ <animation effect="fade" time="200">WindowClose</animation>
+ </control>
+ <control>
+ <description>button group</description>
+ <type>group</type>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <animation effect="slide" time="250" start="-300,0">WindowOpen</animation>
+ <animation effect="slide" time="500" end="0,-300">WindowClose</animation>
+ <posX>60</posX>
+ <posY>97</posY>
+ <layout>StackLayout</layout>
+ <control>
+ <description>Start</description>
+ <type>button</type>
+ <id>2</id>
+ <onleft>2</onleft>
+ <onright>22</onright>
+ <onup>6</onup>
+ <ondown>15</ondown>
+ </control>
+ <control>
+ <description>Board</description>
+ <type>button</type>
+ <id>15</id>
+ <onleft>15</onleft>
+ <onright>22</onright>
+ <onup>2</onup>
+ <ondown>10</ondown>
+ </control>
+ <control>
+ <description>Undo</description>
+ <type>button</type>
+ <id>10</id>
+ <onleft>10</onleft>
+ <onright>22</onright>
+ <onup>15</onup>
+ <ondown>3</ondown>
+ </control>
+ <control>
+ <description>Mode</description>
+ <type>button</type>
+ <id>3</id>
+ <onleft>3</onleft>
+ <onright>3</onright>
+ <onup>10</onup>
+ <ondown>4</ondown>
+ </control>
+ <control>
+ <description>Level</description>
+ <type>button</type>
+ <id>4</id>
+ <onleft>4</onleft>
+ <onright>4</onright>
+ <onup>3</onup>
+ <ondown>5</ondown>
+ </control>
+ <control>
+ <description>Sounds</description>
+ <type>togglebutton</type>
+ <id>5</id>
+ <onleft>5</onleft>
+ <onright>5</onright>
+ <onup>4</onup>
+ <ondown>6</ondown>
+ </control>
+ <control>
+ <description>Round</description>
+ <type>button</type>
+ <id>1</id>
+ <label>#Round</label>
+ <font>font12</font>
+ <enabled>false</enabled>
+ <textureFocus>-</textureFocus>
+ <textureNoFocus>-</textureNoFocus>
+ </control>
+ <control>
+ <description>Player: / GameOver</description>
+ <type>button</type>
+ <id>1</id>
+ <label>#Player</label>
+ <font>font12</font>
+ <enabled>false</enabled>
+ <textureFocus>-</textureFocus>
+ <textureNoFocus>-</textureNoFocus>
+ </control>
+ <control>
+ <description>Whatsthis</description>
+ <type>button</type>
+ <id>6</id>
+ <onleft>6</onleft>
+ <onright>6</onright>
+ <onup>5</onup>
+ <ondown>2</ondown>
+ </control>
+ </control>
+ <control>
+ <description>text label</description>
+ <type>label</type>
+ <id>12</id>
+ <posX>70</posX>
+ <posY>394</posY>
+ <label>#Ply1.Count</label>
+ <font>font12</font>
+ <align>Left</align>
+ <textcolor>ff000000</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>13</id>
+ <posX>70</posX>
+ <posY>424</posY>
+ <label>#Ply2.Count</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>progress bar</description>
+ <type>progress</type>
+ <id>8</id>
+ <posX>100</posX>
+ <posY>394</posY>
+ <width>180</width>
+ <label>#Ply1.Percentage</label>
+ <visible>yes</visible>
+ <animation effect="fade" time="150">WindowOpen</animation>
+ <animation effect="fade" time="150">WindowClose</animation>
+ </control>
+ <control>
+ <description>progress bar</description>
+ <type>progress</type>
+ <id>9</id>
+ <posX>100</posX>
+ <posY>424</posY>
+ <width>180</width>
+ <label>#Ply2.Percentage</label>
+ <visible>yes</visible>
+ <animation effect="fade" time="150">WindowOpen</animation>
+ <animation effect="fade" time="150">WindowClose</animation>
+ </control>
+ <control>
+ <description>hidden hex</description>
+ <type>image</type>
+ <id>198</id>
+ <posX>270</posX>
+ <posY>220</posY>
+ <width>40</width>
+ <height>60</height>
+ <texture>\Hexxagon\MyHexx01.png</texture>
+ </control>
+ <control>
+ <description>text label</description>
+ <type>label</type>
+ <id>14</id>
+ <posX>70</posX>
+ <posY>458</posY>
+ <label>#Time</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>
+ </controls>
+</window>
Modified: trunk/plugins/My Hexxagon/Skin/SimpleMP/MyHexxagon.xml
===================================================================
--- trunk/plugins/My Hexxagon/Skin/SimpleMP/MyHexxagon.xml 2007-05-26 20:39:02 UTC (rev 457)
+++ trunk/plugins/My Hexxagon/Skin/SimpleMP/MyHexxagon.xml 2007-05-27 01:20:00 UTC (rev 458)
@@ -1,230 +1,198 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window>
- <id>1234711</id>
- <defaultcontrol>2</defaultcontrol>
+ <id>1234711</id>
+ <defaultcontrol>2</defaultcontrol>
<allowoverlay>yes</allowoverlay>
<autohidetopbar>yes</autohidetopbar>
<controls>
- <import>common.time.xml</import>
- <control>
- <description>Hexxagon label</description>
- <type>label</type>
- <posX>55</posX>
- <posY>20</posY>
- <align>left</align>
- <font>font48</font>
- <label>Hexxagon</label>
- <textcolor>20ffffff</textcolor>
- <id>1</id>
+ <import>common.time.xml</import>
+ <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>header label</description>
+ <type>label</type>
+ <id>1</id>
+ <posX>250</posX>
+ <posY>70</posY>
+ <label>#header_label</label>
+ <font>font16</font>
+ <align>right</align>
+ <textcolor>White</textcolor>
<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>button group</description>
+ <type>group</type>
+ <animation effect="fade" time="150">WindowOpen</animation>
+ <animation effect="fade" time="150">WindowClose</animation>
+ <posX>60</posX>
+ <posY>97</posY>
+ <layout>StackLayout</layout>
+ <control>
+ <description>Start</description>
+ <type>button</type>
+ <id>2</id>
+ <onleft>2</onleft>
+ <onright>22</onright>
+ <onup>6</onup>
+ <ondown>15</ondown>
</control>
- <control>
- <description>text label</description>
- <type>label</type>
- <id>11</id>
- <posX>250</posX>
- <posY>70</posY>
- <label>Hexxagon</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>
+ <description>Board</description>
+ <type>button</type>
+ <id>15</id>
+ <onleft>15</onleft>
+ <onright>22</onright>
+ <onup>2</onup>
+ <ondown>10</ondown>
</control>
- <control>
- <description>Start</description>
- <type>button</type>
- <id>2</id>
- <posX>60</posX>
- <posY>97</posY>
- <label>Start</label>
- <onleft>2</onleft>
- <onright>22</onright>
- <onup>6</onup>
- <ondown>15</ondown>
- <animation effect="fade" time="150">WindowOpen</animation>
- <animation effect="fade" time="150">WindowClose</animation>
+ <control>
+ <description>Undo</description>
+ <type>button</type>
+ <id>10</id>
+ <onleft>10</onleft>
+ <onright>22</onright>
+ <onup>15</onup>
+ <ondown>3</ondown>
</control>
- <control>
- <description>Board</description>
- <type>button</type>
- <id>15</id>
- <posX>60</posX>
- <posY>131</posY>
- <label>Board: 1</label>
- <onleft>15</onleft>
- <onright>22</onright>
- <onup>2</onup>
- <ondown>10</ondown>
- <animation effect="fade" time="150">WindowOpen</animation>
- <animation effect="fade" time="150">WindowClose</animation>
+ <control>
+ <description>Mode</description>
+ <type>button</type>
+ <id>3</id>
+ <onleft>3</onleft>
+ <onright>3</onright>
+ <onup>10</onup>
+ <ondown>4</ondown>
</control>
- <control>
- <description>Undo</description>
- <type>button</type>
- <id>10</id>
- <posX>60</posX>
- <posY>165</posY>
- <label>Undo</label>
- <onleft>2</onleft>
- <onright>22</onright>
- <onup>15</onup>
- <ondown>3</ondown>
- <animation effect="fade" time="150">WindowOpen</animation>
- <animation effect="fade" time="150">WindowClose</animation>
+ <control>
+ <description>Level</description>
+ <type>button</type>
+ <id>4</id>
+ <onleft>4</onleft>
+ <onright>4</onright>
+ <onup>3</onup>
+ <ondown>5</ondown>
</control>
- <control>
- <description>Mode</description>
- <type>button</type>
- <id>3</id>
- <posX>60</posX>
- <posY>199</posY>
- <label>Mode: Play vs Computer</label>
- <onleft>3</onleft>
- <onright>3</onright>
- <onup>10</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>233</posY>
- <label>Level: Amateur</label>
- <onleft>4</onleft>
- <onright>4</onright>
- <onup>3</onup>
- <ondown>6</ondown>
- <animation effect="fade" time="150">WindowOpen</animation>
- <animation effect="fade" time="150">WindowClose</animation>
+ <control>
+ <description>Sounds</description>
+ <type>togglebutton</type>
+ <id>5</id>
+ <onleft>5</onleft>
+ <onright>5</onright>
+ <onup>4</onup>
+ <ondown>6</ondown>
</control>
<control>
- <description>text label</description>
- <type>label</type>
- <id>5</id>
- <posX>70</posX>
- <posY>272</posY>
- <label>#Round</label>
- <font>font12</font>
- <align>Left</align>
- <textcolor>ffffffff</textcolor>
+ <description>Round</description>
+ <type>button</type>
+ <id>1</id>
+ <label>#Round</label>
+ <font>font12</font>
+ <enabled>false</enabled>
+ <textureFocus>-</textureFocus>
+ <textureNoFocus>-</textureNoFocus>
+ </control>
+ <control>
+ <description>Player: / GameOver</description>
+ <type>button</type>
+ <id>1</id>
+ <label>#Player</label>
+ <font>font12</font>
+ <enabled>false</enabled>
+ <textureFocus>-</textureFocus>
+ <textureNoFocus>-</textureNoFocus>
+ </control>
+ <control>
+ <description>Whatsthis</description>
+ <type>button</type>
+ <id>6</id>
+ <onleft>6</onleft>
+ <onright>6</onright>
+ <onup>5</onup>
+ <ondown>2</ondown>
+ </control>
+ </control>
+ <control>
+ <description>text label</description>
+ <type>label</type>
+ <id>12</id>
+ <posX>70</posX>
+ <posY>394</posY>
+ <label>#Ply1.Count</label>
+ <font>font12</font>
+ <align>Left</align>
+ <textcolor>ff000000</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>306</posY>
- <label>#Player</label>
- <font>font12</font>
- <align>Left</align>
- <textcolor>ffffffff</textcolor>
+ </control>
+ <control>
+ <description>text label</description>
+ <type>label</type>
+ <id>13</id>
+ <posX>70</posX>
+ <posY>424</posY>
+ <label>#Ply2.Count</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>6</id>
- <posX>60</posX>
- <posY>335</posY>
- <label>What's this?</label>
- <onleft>6</onleft>
- <onright>6</onright>
- <onup>3</onup>
- <ondown>2</ondown>
+ </control>
+ <control>
+ <description>progress bar</description>
+ <type>progress</type>
+ <id>8</id>
+ <posX>100</posX>
+ <posY>394</posY>
+ <width>180</width>
+ <label>#Ply1.Percentage</label>
+ <visible>yes</visible>
<animation effect="fade" time="150">WindowOpen</animation>
<animation effect="fade" time="150">WindowClose</animation>
- </control>
-
- <control>
- <description>text label</description>
- <type>label</type>
- <id>12</id>
- <posX>70</posX>
- <posY>394</posY>
- <label>#Ply1.Count</label>
- <font>font12</font>
- <align>Left</align>
- <textcolor>ff000000</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>13</id>
- <posX>70</posX>
- <posY>424</posY>
- <label>#Ply2.Count</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>progress bar</description>
- <type>progress</type>
- <id>8</id>
- <posX>100</posX>
- <posY>394</posY>
- <width>180</width>
- <label>#Ply1.Percentage</label>
- <visible>yes</visible>
+ </control>
+ <control>
+ <description>progress bar</description>
+ <type>progress</type>
+ <id>9</id>
+ <posX>100</posX>
+ <posY>424</posY>
+ <width>180</width>
+ <label>#Ply2.Percentage</label>
+ <visible>yes</visible>
<animation effect="fade" time="150">WindowOpen</animation>
<animation effect="fade" time="150">WindowClose</animation>
- </control>
- <control>
- <description>progress bar</description>
- <type>progress</type>
- <id>9</id>
- <posX>100</posX>
- <posY>424</posY>
- <width>180</width>
- <label>#Ply2.Percentage</label>
- <visible>yes</visible>
+ </control>
+ <control>
+ <description>hidden hex</description>
+ <type>image</type>
+ <id>198</id>
+ <posX>270</posX>
+ <posY>220</posY>
+ <width>40</width>
+ <height>60</height>
+ <texture>\Hexxagon\MyHexx01.png</texture>
+ </control>
+ <control>
+ <description>text label</description>
+ <type>label</type>
+ <id>14</id>
+ <posX>70</posX>
+ <posY>458</posY>
+ <label>#Time</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>hidden hex</description>
- <type>image</type>
- <id>198</id>
- <posX>270</posX>
- <posY>220</posY>
- <width>40</width>
- <height>60</height>
- <texture>\Hexxagon\MyHexx01.png</texture>
- </control>
- <control>
- <description>text label</description>
- <type>label</type>
- <id>14</id>
- <posX>70</posX>
- <posY>458</posY>
- <label>#Time</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>
- </controls>
+ </control>
+ </controls>
</window>
Modified: trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon/MyHexxagon.cs
===================================================================
--- trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon/MyHexxagon.cs 2007-05-26 20:39:02 UTC (rev 457)
+++ trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon/MyHexxagon.cs 2007-05-27 01:20:00 UTC (rev 458)
@@ -34,43 +34,65 @@
namespace MediaPortal.GUI.MyHexxagon
{
- [PluginIcons("MyHexxagon.hexxagon.png", "MyHexxagon.hexxagonDisabled.png")]
- public class MyHexxagonGUI : GUIWindow, ISetupForm
+ [PluginIcons("MyHexxagon.hexxagon.png", "MyHexxagon.hexxagonDisabled.png")]
+ public class MyHexxagonGUI : GUIWindow, ISetupForm
+ {
+ #region enums
+
+ private enum Level
{
- #region SkinControl
- [SkinControlAttribute(2)]
- protected GUIButtonControl BtnStart = null;
- [SkinControlAttribute(3)]
- protected GUIButtonControl BtnMode = null;
- [SkinControlAttribute(4)]
- protected GUIButtonControl BtnLevel = null;
- [SkinControlAttribute(6)]
- protected GUIButtonControl BtnWhatsThis = null;
- [SkinControlAttribute(10)]
- protected GUIButtonControl BtnUndo = null;
- [SkinControlAttribute(15)]
- protected GUIButtonControl BtnBoard = null;
+ Easy = 0,
+ Medium = 1,
+ Hard = 2
+ }
- #endregion
+ private enum Mode
+ {
+ PlayerVsComputer = 0,
+ PlayerVsPlayer = 1
+ }
- #region Private variables
+ #endregion
- int ActPly = 0; // actual player
- string Mode = "1p"; // one player
- string Level = "Am"; // Choosen level
+ #region SkinControl
- int player = 4; // constant player
- int computer = 6; // constant computer
+ [SkinControlAttribute(2)]
+ protected GUIButtonControl btnStart = null;
+ [SkinControlAttribute(3)]
+ protected GUIButtonControl btnMode = null;
+ [SkinControlAttribute(4)]
+ protected GUIButtonControl btnLevel = null;
+ [SkinControlAttribute(5)]
+ protected GUIToggleButtonControl btnSound = null;
+ [SkinControlAttribute(6)]
+ protected GUIButtonControl btnWhatsThis = null;
+ [SkinControlAttribute(10)]
+ protected GUIButtonControl btnUndo = null;
+ [SkinControlAttribute(15)]
+ protected GUIButtonControl btnBoard = null;
- int wait = 0; // init wait timer for computer
+ #endregion
- int time = 0; // timer for game
- int boardNo = 1; // default board
+ #region Private variables
- int[] time_rec = { 999, 999, 999, 999, 999 };
+ Level _currentLevel = Level.Easy;
+ Mode _currentMode = Mode.PlayerVsComputer;
+ bool _soundOn = true;
- // init board
- int[] board = {0,0,0,0,0,0,0,0,0,0, // 0-9
+ int ActPly = 0; // actual player
+
+ int player = 4; // constant player
+ int computer = 6; // constant computer
+
+ int wait = 0; // init wait timer for computer
+
+ int time = 0; // timer for game
+ int boardNo = 1; // default board
+
+ int[] time_rec = { 999, 999, 999, 999, 999 };
+
+ // init board
+ int[] board = {0,0,0,0,0,0,0,0,0,0, // 0-9
0,0,0,0,0,0,0,0,0,0, //10-19
0,0,1,1,1,1,1,0,0,0, //20-29
0,0,1,1,1,1,1,1,0,0, //30-39
@@ -85,1160 +107,1218 @@
0,0,0,0,0,0,0,0,0,0, //120-129
0,0,0}; //130-132
- int[,] rem_board = new int [80,140];
- bool initBoard = false;
+ int[,] rem_board = new int[80, 140];
+ bool initBoard = false;
- // distances for moves
- int[] MoveDouble = { 10, 11, 1, -10, -11, -1 };
- int[] MoveJump = { 9, 20, 21, 22, 12, 2, -9, -20, -21, -22, -12, -2 };
+ // distances for moves
+ int[] MoveDouble = { 10, 11, 1, -10, -11, -1 };
+ int[] MoveJump = { 9, 20, 21, 22, 12, 2, -9, -20, -21, -22, -12, -2 };
- // last selected move
- int lastHexx = 0;
+ // last selected move
+ int lastHexx = 0;
- // init counter
- int cntPly1 = 0;
- int cntPly2 = 0;
- int round = 1;
+ // init counter
+ int cntPly1 = 0;
+ int cntPly2 = 0;
+ int round = 1;
- // some help arrays for draw the board
- int[] Draw = { 22, 32, 42, 52, 62, 73, 84, 95, 106 };
- int[] DrawCnt = { 5, 6, 7, 8, 9, 8, 7, 6, 5 };
+ // some help arrays for draw the board
+ int[] Draw = { 22, 32, 42, 52, 62, 73, 84, 95, 106 };
+ int[] DrawCnt = { 5, 6, 7, 8, 9, 8, 7, 6, 5 };
- // values on the baord
- // Off Double Jump On1 On1Select On2 On2Select
- // 1 2 3 4 5 6 7
+ // values on the baord
+ // Off Double Jump On1 On1Select On2 On2Select
+ // 1 2 3 4 5 6 7
- private int[] ani01 = { 0, 0, 0, 0, 0, 0, 0, 0 };
- // possible moves 0-5, player 6 , cnt 7
- private int[] ani02 = { 0, 0 , 0};
- // last move, player, counter
-
- // game ticker for the computer
- private System.Windows.Forms.Timer _Game = new System.Windows.Forms.Timer();
+ private int[] ani01 = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ // possible moves 0-5, player 6 , cnt 7
+ private int[] ani02 = { 0, 0, 0 };
+ // last move, player, counter
- #endregion
+ // game ticker for the computer
+ private System.Windows.Forms.Timer _Game = new System.Windows.Forms.Timer();
- #region ISetupForm Members
+ #endregion
- // Returns the name of the plugin which is shown in the plugin menu
- public string PluginName()
- {
- return "My Hexxagon";
- }
+ #region ISetupForm Members
- // Returns the description of the plugin is shown in the plugin menu
- public string Description()
- {
- return "My Hexxagon";
- }
+ // Returns the name of the plugin which is shown in the plugin menu
+ public string PluginName()
+ {
+ return "My Hexxagon";
+ }
- // Returns the author of the plugin which is shown in the plugin menu
- public string Author()
- {
- return "Mark Koenig (kroko)";
- }
+ // Returns the description of the plugin is shown in the plugin menu
+ public string Description()
+ {
+ return "My Hexxagon";
+ }
- // show the setup dialog
- public void ShowPlugin()
- {
- MessageBox.Show("Nothing to configure, this is just an example");
- }
+ // Returns the author of the plugin which is shown in the plugin menu
+ public string Author()
+ {
+ return "Mark Koenig (kroko)";
+ }
- // Indicates whether plugin can be enabled/disabled
- public bool CanEnable()
- {
- return true;
- }
+ // show the setup dialog
+ public void ShowPlugin()
+ {
+ MessageBox.Show("Nothing to configure, this is just an example");
+ }
- // get ID of windowplugin belonging to this setup
- public int GetWindowId()
- {
- return 1234711;
- }
+ // Indicates whether plugin can be enabled/disabled
+ public bool CanEnable()
+ {
+ return true;
+ }
- // Indicates if plugin is enabled by default;
- public bool DefaultEnabled()
- {
- return true;
- }
+ // get ID of windowplugin belonging to this setup
+ public int GetWindowId()
+ {
+ return 1234711;
+ }
- // indicates if a plugin has its own setup screen
- public bool HasSetup()
- {
- return false;
- }
+ // Indicates if plugin is enabled by default;
+ public bool DefaultEnabled()
+ {
+ return true;
+ }
- /// <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>
+ // indicates if a plugin has its own setup screen
+ public bool HasSetup()
+ {
+ return false;
+ }
- public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
- {
- strButtonText = PluginName();
- strButtonImage = String.Empty;
- strButtonImageFocus = String.Empty;
- strPictureImage = @"hover_my hexxagon.png";
- return true;
- }
+ /// <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>
- #endregion
+ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText = PluginName();
+ strButtonImage = String.Empty;
+ strButtonImageFocus = String.Empty;
+ strPictureImage = @"hover_my hexxagon.png";
+ return true;
+ }
- public override int GetID
- {
- get
- {
- return 1234711;
- }
- set
- {
- base.GetID = value;
- }
- }
+ #endregion
- public override bool Init()
- {
- bool result = Load(GUIGraphicsContext.Skin + @"\MyHexxagon.xml");
- return result;
- }
+ #region Overrides
- public override bool OnMessage(GUIMessage message)
- {
- return base.OnMessage(message);
- }
+ public override int GetID
+ {
+ get
+ {
+ return 1234711;
+ }
+ set
+ {
+ base.GetID = value;
+ }
+ }
- public void Dispose()
- {
- _Game.Stop();
- _Game.Tick -= new EventHandler(_Game_Tick);
- }
+ public override bool Init()
+ {
+ MyHexxagon.GUILocalizeStrings.Load(GUI.Library.GUILocalizeStrings.CurrentLanguage());
- protected override void OnPageLoad()
- {
+ bool result = Load(GUIGraphicsContext.Skin + @"\MyHexxagon.xml");
+ return result;
+ }
- // start game ticker
- _Game.Interval = 100;
- _Game.Tick += new EventHandler(_Game_Tick);
- _Game.Start();
+ public override bool OnMessage(GUIMessage message)
+ {
+ return base.OnMessage(message);
+ }
- base.OnPageLoad();
+ protected override void OnPageLoad()
+ {
- // get position from the start button
- int StartX = GetControl(198).XPosition;
- int StartY = GetControl(198).YPosition;
- // Disable level control
- GUIControl.HideControl(GetID, 198);
+ // start game ticker
+ _Game.Interval = 100;
+ _Game.Tick += new EventHandler(_Game_Tick);
+ _Game.Start();
- try
- {
- int StartT = GetControl(22).XPosition;
- }
- catch
- {
- initBoard = false;
- }
+ base.OnPageLoad();
- if (initBoard == false)
- {
- initBoard = true;
- // draw buttons
- for (int j = 0; j < 9; j++)
- {
- for (int i = 0; i < DrawCnt[j]; i++)
- {
+ // get position from the start button
+ int StartX = GetControl(198).XPosition;
+ int StartY = GetControl(198).YPosition;
+ // Disable level control
+ GUIControl.HideControl(GetID, 198);
- int Nr = Draw[j] + i;
- int XPos = StartX + (j * 45);
- int YPos = 0;
+ try
+ {
+ int StartT = GetControl(22).XPosition;
+ }
+ catch
+ {
+ initBoard = false;
+ }
- if (j < 5)
- YPos = StartY + (i * 37) - (19 * j);
+ if (initBoard == false)
+ {
+ initBoard = true;
+ // draw buttons
+ for (int j = 0; j < 9; j++)
+ {
+ for (int i = 0; i < DrawCnt[j]; i++)
+ {
- if (j > 4)
- YPos = StartY + (i * 37) - (19 * (8 - j));
+ int Nr = Draw[j] + i;
+ int XPos = StartX + (j * 45);
+ int YPos = 0;
- CreateButton(Nr, XPos, YPos, 40, 60, "#F" + Nr, "#NF" + Nr);
+ if (j < 5)
+ YPos = StartY + (i * 37) - (19 * j);
- //default navigation
- int up = Nr - 1;
- int dn = Nr + 1;
- int le = Nr - 10;
- int ri = Nr + 10;
+ if (j > 4)
+ YPos = StartY + (i * 37) - (19 * (8 - j));
- //make it easier to navigate
- if (j == 0 || j == 2 || j == 4 || j == 6 || j == 8)
- {
- le = Nr - 11;
- ri = Nr + 11;
- }
- //block to top
- if (i == 0)
- up = Nr;
- //block to bottom
- if (i == (DrawCnt[j] - 1))
- dn = Nr;
- //goto to start on left side
- if (j == 0)
- le = 2;
- //block to right
- if (j == 8)
- ri = Nr;
- // some exeption top row
- if (i == 0)
- {
- if (j == 2 || j == 4)
- {
- le = Nr - 10;
- }
- if (j == 5 || j == 7)
- {
- ri = Nr + 11;
- }
- }
- // some exeption bottom row
- if ((i == 5 && j == 1) || (i == 7 && j == 3))
- le = Nr - 11;
- if ((i == 8 && j == 4) || (i == 6 && j == 6))
- ri = Nr + 10;
+ CreateButton(Nr, XPos, YPos, 40, 60, "#F" + Nr, "#NF" + Nr);
- //SetNavigation(U, D, L, R)
- GetControl(Nr).SetNavigation(up, dn, le, ri);
+ //default navigation
+ int up = Nr - 1;
+ int dn = Nr + 1;
+ int le = Nr - 10;
+ int ri = Nr + 10;
- }
- }
+ //make it easier to navigate
+ if (j == 0 || j == 2 || j == 4 || j == 6 || j == 8)
+ {
+ le = Nr - 11;
+ ri = Nr + 11;
}
-
+ //block to top
+ if (i == 0)
+ up = Nr;
+ //block to bottom
+ if (i == (DrawCnt[j] - 1))
+ dn = Nr;
+ //goto to start on left side
+ if (j == 0)
+ le = 2;
+ //block to right
+ if (j == 8)
+ ri = Nr;
+ // some exeption top row
+ if (i == 0)
+ {
+ if (j == 2 || j == 4)
+ {
+ le = Nr - 10;
+ }
+ if (j == 5 || j == 7)
+ {
+ ri = Nr + 11;
+ }
+ }
+ // some exeption bottom row
+ if ((i == 5 && j == 1) || (i == 7 && j == 3))
+ le = Nr - 11;
+ if ((i == 8 && j == 4) || (i == 6 && j == 6))
+ ri = Nr + 10;
- // Disable level control
- GUIControl.DisableControl(GetID, 4);
+ //SetNavigation(U, D, L, R)
+ GetControl(Nr).SetNavigation(up, dn, le, ri);
- // Draw field
- ResetBoard();
- SetLevel();
- Count();
- UpdateBoard();
+ }
}
+ }
- protected override void OnPageDestroy(int new_windowId)
+
+ // Disable level control
+ GUIControl.DisableControl(GetID, btnLevel.GetID);
+
+ // Draw field
+ ResetBoard();
+ SetLevel();
+ Count();
+ UpdateBoard();
+
+ UpdateButtonStates();
+ }
+
+ protected override void OnPageDestroy(int new_windowId)
+ {
+ _Game.Stop();
+ _Game.Tick -= new EventHandler(_Game_Tick);
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
+ {
+ if (control == btnStart)
+ OnBtnStart();
+ else if (control == btnLevel)
+ OnBtnLevel();
+ else if (control == btnMode)
+ OnBtnMode();
+ else if (control == btnSound)
+ OnBtnSound();
+ else if (control == btnWhatsThis)
+ OnBtnWhatsThis();
+ else if (control == btnUndo)
+ OnBtnUndo();
+ else if (control == btnBoard)
+ OnBtnBoard();
+
+ // check if some has clicked
+ if (board[controlId] == ActPly)
+ {
+ if (ActPly == 4 || (ActPly == 6 && _currentMode == Mode.PlayerVsPlayer))
{
- _Game.Stop();
- _Game.Tick -= new EventHandler(_Game_Tick);
+ Select(ActPly, controlId);
}
+ }
+ if (board[controlId] == 2 || board[controlId] == 3)
+ Move(ActPly, controlId);
+ }
- protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
- {
- if (control == BtnWhatsThis)
- OnBtnWhatsThis();
- if (control == BtnUndo)
- OnBtnUndo();
- if (control == BtnBoard)
- OnBtnBoard();
- if (control == BtnStart)
- {
- ActPly = 4; // Player 1 starts
- round = 1; // reset round counter
+ protected override void OnShowContextMenu()
+ {
+ base.OnShowContextMenu();
+ }
- time = 0;
+ #endregion
- ResetBoard();
- SetLevel();
+ #region Implementation
+
+ private void OnBtnStart()
+ {
+ ActPly = 4; // Player 1 starts
+ round = 1; // reset round counter
- Count();
+ time = 0;
- for (int i = 0; i < 133; i++)
- {
- rem_board[0,i] = board [i];
- }
+ ResetBoard();
+ SetLevel();
- // draw field
- UpdateBoard();
+ Count();
- }
- if (control == BtnLevel)
- OnBtnLevel();
- if (control == BtnMode )
- OnBtnMode();
+ for (int i = 0; i < 133; i++)
+ {
+ rem_board[0, i] = board[i];
+ }
- // check if some has clicked
- if (board[controlId] == ActPly)
- {
- if (ActPly == 4 || (ActPly == 6 && Mode == "2p"))
- {
- Select(ActPly, controlId);
- }
- }
- if (board[controlId] == 2 || board[controlId] == 3)
- Move(ActPly, controlId);
- }
+ // draw field
+ UpdateBoard();
- protected override void OnShowContextMenu()
- {
- base.OnShowContextMenu();
- }
+ UpdateButtonStates();
+ }
- 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);
- }
+ private void OnBtnLevel()
+ {
+ //Choose level for the game
+ if (!(ActPly == 0 || (round == 1 && ActPly == player)))
+ return;
- void _Game_Tick(object sender, EventArgs e)
- {
+ switch (_currentLevel)
+ {
+ case Level.Easy:
+ _currentLevel = Level.Medium;
+ break;
+ case Level.Medium:
+ _currentLevel = Level.Hard;
+ break;
+ case Level.Hard:
+ _currentLevel = Level.Easy;
+ break;
+ }
- if ((ActPly > 0) && (round>1))
- time++;
- if (round <=1)
- time = 0;
+ UpdateButtonStates();
+ }
+ private void OnBtnMode()
+ {
+ //Choose mode for the game
+ if (!(ActPly == 0 || (round == 1 && ActPly == player)))
+ return;
- GUIPropertyManager.SetProperty("#Time", "Time: " + (time/10).ToString() + "s");
+ switch (_currentMode)
+ {
+ case Mode.PlayerVsComputer:
+ _currentMode = Mode.PlayerVsPlayer;
+ break;
+ case Mode.PlayerVsPlayer:
+ _currentMode = Mode.PlayerVsComputer;
+ break;
+ }
+ UpdateButtonStates();
+ }
- if ((round > 1) && (ActPly!=0))
- {
- GUIControl.EnableControl(GetID, 10); // Undo
- }
- else
- {
- GUIControl.DisableControl(GetID, 10); // Undo
- }
+ private void OnBtnSound()
+ {
+ _soundOn = btnSound.Selected;
+ UpdateButtonStates();
+ }
- // wait some time
- if (wait > 0)
- wait = wait - 1;
+ private void OnBtnWhatsThis()
+ {
+ GUIDialogText dlg = (GUIDialogText)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TEXT);
+ dlg.SetHeading(MyHexxagon.GUILocalizeStrings.Get(31)); // help dialog heading
+ dlg.SetText(MyHexxagon.GUILocalizeStrings.Get(32)); // help dialog text
+ dlg.DoModal(GetID);
+ }
- if (wait == 0 && ActPly == computer)
- {
- if (Mode=="1p")
- // move the computer
- CompSelect();
- }
+ private void OnBtnUndo()
+ {
+ if (round <= 1)
+ return;
- // ------------------------------------------------
- // animation 01
+ for (int i = 0; i < 133; i++)
+ {
+ board[i] = rem_board[round - 2, i];
+ }
+ round = round - 1;
+ ActPly = player;
+ Count();
+ UpdateBoard();
- if ((ani01[0] != 0) && (ani01[7] > 0))
- {
- int tmp;
- // select different color
- if (board[ani01[0]]== player)
- {
- tmp = computer;
- }
- else
- {
- tmp = player;
- }
+ UpdateButtonStates();
+ }
- // last animation
- if (ani01[7] == 1)
- {
- tmp = ani01[06];
- }
+ private void OnBtnBoard()
+ {
+ //Choose mode for the game
+ if (!(ActPly == 0 || (round == 1 && ActPly == player)))
+ return;
- // set board take over
- for (int i = 0; i < 6; i++)
- {
- if (board[ani01[i]] != 0)
- {
- board[ani01[i]] = tmp;
- }
- }
- UpdateBoard();
- ani01[7]--;
- }
- // ------------------------------------------------
- // animation 02
+ switch (boardNo)
+ {
+ case 1:
+ boardNo = 2;
+ break;
+ case 2:
+ boardNo = 3;
+ break;
+ case 3:
+ boardNo = 4;
+ break;
+ case 4:
+ boardNo = 5;
+ break;
+ case 5:
+ boardNo = 1;
+ break;
+ }
- if ((ani02[0] != 0) && (ani02[2] > 0))
- {
- int tmp;
- // select different
- if (board[ani02[0]] != 1)
- {
- tmp = 1;
- }
- else
- {
- tmp = ani02[1];
- }
+ ResetBoard();
+ SetLevel();
+ Count();
+ UpdateBoard();
- // last animation
- if (ani02[2] == 1)
- {
- tmp = ani02[01];
- }
+ UpdateButtonStates();
+ }
- board[ani02[0]] = tmp;
+ private void OnRenderSound(string strFilePath)
+ {
+ if (_soundOn)
+ {
+ MediaPortal.Util.Utils.PlaySound(strFilePath, false, true);
+ }
+ }
- UpdateBoard();
- ani02[2]--;
+ private void UpdateButtonStates()
+ {
+ GUIPropertyManager.SetProperty("#header_label", MyHexxagon.GUILocalizeStrings.Get(0)); // MyHexxagon
- }
+ GUIControl.SetControlLabel(GetID, btnStart.GetID, MyHexxagon.GUILocalizeStrings.Get(1)); // Start
+ //btnStart.Disabled = (Player != 0);
- }
+ string strLine = MyHexxagon.GUILocalizeStrings.Get(10); // Level:
+ switch (_currentLevel)
+ {
+ case Level.Easy:
+ strLine += MyHexxagon.GUILocalizeStrings.Get(11); // easy
+ break;
+ case Level.Medium:
+ strLine += MyHexxagon.GUILocalizeStrings.Get(12); // medium
+ break;
+ case Level.Hard:
+ strLine += MyHexxagon.GUILocalizeStrings.Get(13); // difficult
+ break;
+ }
+ GUIControl.SetControlLabel(GetID, btnLevel.GetID, strLine);
+ //btnLevel.Disabled = ((Player != 0) || (_currentMode == Mode.PlayerVsPlayer));
- private void UpdateBoard()
- {
- // draw the board
- for (int i = 22; i < 111; i++)
- {
- if (board[i] == 1)
- {
- GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx01F.png");
- GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx01.png");
- }
- if (board[i] == 2)
- {
- GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx02F.png");
- GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx02.png");
- }
- if (board[i] == 3)
- {
- GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx03F.png");
- GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx03.png");
- }
- if (board[i] == 4)
- {
- GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx04F.png");
- GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx04.png");
- }
- if (board[i] == 5)
- {
- GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx05F.png");
- GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx05.png");
- }
- if (board[i] == 6)
- {
- GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx06F.png");
- GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx06.png");
- }
- if (board[i] == 7)
- {
- GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx07F.png");
- GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx07.png");
- }
- if (board[i] == 10)
- {
- GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx0X.png");
- GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx0X.png");
- }
- if (ActPly == 4)
- GUIPropertyManager.SetProperty("#Player", "Player 1");
- if (ActPly == 6)
- GUIPropertyManager.SetProperty("#Player", "Player 2");
- if (ActPly == 0)
- GUIPropertyManager.SetProperty("#Player", "Game over");
+ strLine = MyHexxagon.GUILocalizeStrings.Get(20); // Mode: Play vs
+ switch (_currentMode)
+ {
+ case Mode.PlayerVsComputer:
+ strLine += MyHexxagon.GUILocalizeStrings.Get(21); // Comp
+ break;
+ case Mode.PlayerVsPlayer:
+ strLine += MyHexxagon.GUILocalizeStrings.Get(22); // Player
+ break;
+ }
+ GUIControl.SetControlLabel(GetID, btnMode.GetID, strLine);
+ //btnMode.Disabled = (Player != 0);
- // display counter and so on
- GUIPropertyManager.SetProperty("#Round", "Round: 1");
- GUIPropertyManager.SetProperty("#Ply1.Count", cntPly1.ToString());
- GUIPropertyManager.SetProperty("#Ply2.Count", cntPly2.ToString());
+ GUIControl.SetControlLabel(GetID, btnSound.GetID, MyHexxagon.GUILocalizeStrings.Get(9)); // Sounds
+ btnSound.Selected = _soundOn;
- int p1 = (100 * cntPly1 / 58);
- int p2 = (100 * cntPly2 / 58);
+ GUIControl.SetControlLabel(GetID, btnWhatsThis.GetID, MyHexxagon.GUILocalizeStrings.Get(31)); // What is MyConnect?
+ GUIControl.SetControlLabel(GetID, btnUndo.GetID, MyHexxagon.GUILocalizeStrings.Get(8)); // Undo
+ GUIControl.SetControlLabel(GetID, btnBoard.GetID, MyHexxagon.GUILocalizeStrings.Get(7) + ": " + boardNo.ToString()); // Board: 1
+ }
- GUIPropertyManager.SetProperty("#Ply1.Percentage", p1.ToString());
- GUIPropertyManager.SetProperty("#Ply2.Percentage", p2.ToString());
- GUIPropertyManager.SetProperty("#Round", "Round: " + round.ToString());
- }
- }
+ #endregion
- private void Select(int ply, int pos)
- {
- // not game over
- if (ActPly != 0)
- {
- // remember selected pos
- lastHexx = pos;
- // reset old selection
- for (int i = 22; i < 111; i++)
- {
- if (board[i] == 2)
- board[i] = 1;
- if (board[i] == 3)
- board[i] = 1;
- if (board[i] == 5)
- board[i] = 4;
- if (board[i] == 7)
- board[i] = 6;
- }
- // display selected pos
- board[pos] = ply + 1;
- MediaPortal.Util.Utils.PlaySound("HexxSelect.wav", false, true);
- // draw selection for double
- for (int i = 0; i < 6; i++)
- {
- // if not occupied and visible
- if (board[pos + MoveDouble[i]] == 1)
- board[pos + MoveDouble[i]] = 2;
- }
- // draw selection for jumpe
- for (int i = 0; i < 12; i++)
- {
- // if not occupied and visible
- if (board[pos + MoveJump[i]] == 1)
- board[pos + MoveJump[i]] = 3;
- }
- UpdateBoard();
- }
- }
+ public void Dispose()
+ {
+ _Game.Stop();
+ _Game.Tick -= new EventHandler(_Game_Tick);
+ }
- private void Move(int ply, int pos)
- {
- if (board[pos] == 2)
- {
- // double
- board[pos] = ply;
+ 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);
+ }
- ani02[0] = pos;
- ani02[1] = ply;
- ani02[2] = 10;
+ void _Game_Tick(object sender, EventArgs e)
+ {
- Check(ply, pos);
- MediaPortal.Util.Utils.PlaySound("HexxDouble.wav", false, true);
- }
- if (board[pos] == 3)
- {
- // jump
- board[lastHexx] = 1;
- board[pos] = ply;
+ if ((ActPly > 0) && (round > 1))
+ time++;
+ if (round <= 1)
+ time = 0;
- ani02[0] = pos;
- ani02[1] = ply;
- ani02[2] = 10;
+ GUIPropertyManager.SetProperty("#Time", MyHexxagon.GUILocalizeStrings.Get(4) + ": " + (time / 10).ToString() + "s"); // Time: 5s
- Check(ply, pos);
- MediaPortal.Util.Utils.PlaySound("HexxMove.wav", false, true);
- }
- // clear selection on the board
- for (int i = 22; i < 111; i++)
- {
- if (board[i] == 2)
- board[i] = 1;
- if (board[i] == 3)
- board[i] = 1;
- if (board[i] == 5)
- board[i] = 4;
- if (board[i] == 7)
- board[i] = 6;
- }
+ UpdateButtonStates();
+ if ((round > 1) && (ActPly != 0))
+ {
+ GUIControl.EnableControl(GetID, btnUndo.GetID); // Undo
+ }
+ else
+ {
+ GUIControl.DisableControl(GetID, btnUndo.GetID); // Undo
+ }
- // reset last stored
- lastHexx = 0;
+ // wait some time
+ if (wait > 0)
+ wait = wait - 1;
- NextPlayer();
- UpdateBoard();
+ if (wait == 0 && ActPly == computer)
+ {
+ if (_currentMode == Mode.PlayerVsComputer)
+ // move the computer
+ CompSelect();
+ }
+ // ------------------------------------------------
+ // animation 01
+
+ if ((ani01[0] != 0) && (ani01[7] > 0))
+ {
+ int tmp;
+ // select different color
+ if (board[ani01[0]] == player)
+ {
+ tmp = computer;
}
+ else
+ {
+ tmp = player;
+ }
- private void Check(int ply, int pos)
+ // last animation
+ if (ani01[7] == 1)
{
- int cnt = 0;
- // reset ani
- for (int i = 0; i < 6; i++)
- {
- ani01[i] = 0;
- }
- // remember player
- ani01[6] = ply;
+ tmp = ani01[06];
+ }
- // after move turn arround all surrounding tokens
- for (int i = 0; i < 6; i++)
- {
- int next = ply + 2;
- if (next > 6) next = 4;
+ // set board take over
+ for (int i = 0; i < 6; i++)
+ {
+ if (board[ani01[i]] != 0)
+ {
+ board[ani01[i]] = tmp;
+ }
+ }
+ UpdateBoard();
+ ani01[7]--;
+ }
+ // ------------------------------------------------
+ // animation 02
- if (board[pos + MoveDouble[i]] == next)
- {
- //SetFlowDirection board
- board[pos + MoveDouble[i]] = ply;
- // set values for animation
- ani01[7] = 10; // counter for animation
- ani01[cnt]=pos + MoveDouble[i];
- cnt++;
- }
- }
+ if ((ani02[0] != 0) && (ani02[2] > 0))
+ {
+ int tmp;
+ // select different
+ if (board[ani02[0]] != 1)
+ {
+ tmp = 1;
}
+ else
+ {
+ tmp = ani02[1];
+ }
- private void NextPlayer()
+ // last animation
+ if (ani02[2] == 1)
{
- if (ActPly == 4)
- {
- ActPly = 6;
- wait = 25;
- }
- else
- {
- ActPly = 4;
+ tmp = ani02[01];
+ }
- for (int i = 0; i < 133; i++)
- {
- rem_board[round, i] = board[i];
- }
+ board[ani02[0]] = tmp;
- round = round + 1;
-
- }
- // check if there is a move left
- NoMove(ActPly);
+ UpdateBoard();
+ ani02[2]--;
+
+ }
+
+ }
+
+ private void UpdateBoard()
+ {
+ // draw the board
+ for (int i = 22; i < 111; i++)
+ {
+ if (board[i] == 1)
+ {
+ GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx01F.png");
+ GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx01.png");
}
+ if (board[i] == 2)
+ {
+ GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx02F.png");
+ GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx02.png");
+ }
+ if (board[i] == 3)
+ {
+ GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx03F.png");
+ GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx03.png");
+ }
+ if (board[i] == 4)
+ {
+ GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx04F.png");
+ GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx04.png");
+ }
+ if (board[i] == 5)
+ {
+ GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx05F.png");
+ GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx05.png");
+ }
+ if (board[i] == 6)
+ {
+ GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx06F.png");
+ GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx06.png");
+ }
+ if (board[i] == 7)
+ {
+ GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx07F.png");
+ GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx07.png");
+ }
+ if (board[i] == 10)
+ {
+ GUIPropertyManager.SetProperty("#F" + i, @"\Hexxagon\MyHexx0X.png");
+ GUIPropertyManager.SetProperty("#NF" + i, @"\Hexxagon\MyHexx0X.png");
+ }
+ if (ActPly == 4)
+ GUIPropertyManager.SetProperty("#Player", MyHexxagon.GUILocalizeStrings.Get(2) + " 1"); // PLAYER 1
+ if (ActPly == 6)
+ GUIPropertyManager.SetProperty("#Player", MyHexxagon.GUILocalizeStrings.Get(2) + " 2"); // PLAYER 2
+ if (ActPly == 0)
+ GUIPropertyManager.SetProperty("#Player", MyHexxagon.GUILocalizeStrings.Get(6)); // GAME OVER
- private void NoMove(int ply)
+ // display counter and so on
+ GUIPropertyManager.SetProperty("#Round", MyHexxagon.GUILocalizeStrings.Get(5) + "1"); // Round: 1
+ GUIPropertyManager.SetProperty("#Ply1.Count", cntPly1.ToString());
+ GUIPropertyManager.SetProperty("#Ply2.Count", cntPly2.ToString());
+
...
[truncated message content] |