diff --git a/Def.cs b/Def.cs index 51e011b..a3d6399 100644 --- a/Def.cs +++ b/Def.cs @@ -2,8 +2,9 @@ // WindowsPhoneSpeedyBlupi.Def + namespace WindowsPhoneSpeedyBlupi -{ +{ public static class Def { @@ -86,7 +87,7 @@ namespace WindowsPhoneSpeedyBlupi public enum KeyboardPress { - None, Up, Right, Down, Left, LeftControl, Space, Escape, Pause + None = 0, Up = 1, Right = 2, Down = 3, Left = 4, LeftControl = 5, Space = 6, Escape = 7, Pause = 8 } public const int LXIMAGE = 640; diff --git a/Game1.cs b/Game1.cs index 034d7fd..f5d90e4 100644 --- a/Game1.cs +++ b/Game1.cs @@ -2,7 +2,7 @@ // WindowsPhoneSpeedyBlupi.Game1 using System; using Microsoft.Xna.Framework; -//using Microsoft.Xna.Framework.GamerServices;//todo remove me +using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input.Touch; using Microsoft.Xna.Framework.Media; @@ -298,7 +298,7 @@ namespace WindowsPhoneSpeedyBlupi return; case Def.ButtonGlygh.InitBuy: case Def.ButtonGlygh.TrialBuy: - MarketPlace.Show(PlayerIndex.One); + Guide.Show(PlayerIndex.One); SetPhase(Def.Phase.Init); return; case Def.ButtonGlygh.InitRanking: @@ -924,7 +924,7 @@ namespace WindowsPhoneSpeedyBlupi fadeOutPhase = Def.Phase.None; inputPad.Phase = this.phase; playSetup = this.phase == Def.Phase.PlaySetup; - isTrialMode = TrialMode.IsTrialModeEnabled(); + isTrialMode = Guide.IsTrialMode; phaseTime = 0; missionToStart2 = -1; decor.StopSound(); @@ -969,11 +969,7 @@ namespace WindowsPhoneSpeedyBlupi decor.MemorizeDoors(gameData); gameData.Write(); } - //public void SetFullScreen(bool isFullScreen) - //{ - // this.graphics.IsFullScreen = isFullScreen; - // graphics.ToggleFullScreen(); - //} + public void ToggleFullScreen() { this.graphics.ToggleFullScreen(); diff --git a/InputPad.cs b/InputPad.cs index 78a8fb1..f6379a3 100644 --- a/InputPad.cs +++ b/InputPad.cs @@ -217,7 +217,7 @@ namespace WindowsPhoneSpeedyBlupi this.gameData = gameData; pressedGlyphs = new List(); accelSensor = new Accelerometer(); - accelSensor.CurrentValueChanged += HandleAccelSensorCurrentValueChanged; + ((SensorBase)(object)accelSensor).CurrentValueChanged += HandleAccelSensorCurrentValueChanged; accelSlider = new Slider { TopLeftCorner = new TinyPoint @@ -292,7 +292,7 @@ namespace WindowsPhoneSpeedyBlupi float screenHeight = game1.getGraphics().GraphicsDevice.Viewport.Height; float screenRatio = screenWidth / screenHeight; - if (Def.PLATFORM == Platform.Android &&screenRatio < 1.3333333333333333) + if (Def.PLATFORM == Platform.Android &&screenRatio > 1.3333333333333333) { for (int i = 0; i < touchesOrClicks.Count; i++) { @@ -328,12 +328,12 @@ namespace WindowsPhoneSpeedyBlupi KeyboardState newState = Keyboard.GetState(); { - if (newState.IsKeyDown(Keys.LeftControl)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.LeftControl))); - if (newState.IsKeyDown(Keys.Up)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.Up))); - if (newState.IsKeyDown(Keys.Right)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.Right))); - if (newState.IsKeyDown(Keys.Down)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.Down))); - if (newState.IsKeyDown(Keys.Left)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.Left))); - if (newState.IsKeyDown(Keys.Space)) touchesOrClicks.Add(createTinyPoint(-1, Misc.keyboardPressToInt(KeyboardPress.Space))); + if (newState.IsKeyDown(Keys.LeftControl)) touchesOrClicks.Add(createTinyPoint(-1, (int) KeyboardPress.LeftControl)); + if (newState.IsKeyDown(Keys.Up)) touchesOrClicks.Add(createTinyPoint(-1, (int)KeyboardPress.Up)); + if (newState.IsKeyDown(Keys.Right)) touchesOrClicks.Add(createTinyPoint(-1, (int)KeyboardPress.Right)); + if (newState.IsKeyDown(Keys.Down)) touchesOrClicks.Add(createTinyPoint(-1, (int)KeyboardPress.Down)); + if (newState.IsKeyDown(Keys.Left)) touchesOrClicks.Add(createTinyPoint(-1, (int)KeyboardPress.Left)); + if (newState.IsKeyDown(Keys.Space)) touchesOrClicks.Add(createTinyPoint(-1, (int)KeyboardPress.Space)); } if (newState.IsKeyDown(Keys.F11)) { @@ -352,7 +352,7 @@ namespace WindowsPhoneSpeedyBlupi { keyboardPressed = true; } - KeyboardPress keyboardPress = keyboardPressed ? Misc.intToKeyboardPress(touchOrClick.Y) : KeyboardPress.None; + KeyboardPress keyboardPress = keyboardPressed ? (KeyboardPress)touchOrClick.Y : KeyboardPress.None; keyPressedUp = keyboardPress == KeyboardPress.Up ? true : keyPressedUp; keyPressedDown = keyboardPress == KeyboardPress.Down ? true : keyPressedDown; keyPressedLeft = keyboardPress == KeyboardPress.Left ? true : keyPressedLeft; diff --git a/Microsoft.Xna.Framework.GamerServices/Guide.cs b/Microsoft.Xna.Framework.GamerServices/Guide.cs new file mode 100644 index 0000000..b105acb --- /dev/null +++ b/Microsoft.Xna.Framework.GamerServices/Guide.cs @@ -0,0 +1,13 @@ +using System.Diagnostics; + +namespace Microsoft.Xna.Framework.GamerServices +{ + public static class Guide + { + public static void Show(PlayerIndex playerIndex) + { + Debug.Write("The Market Place should now be shown."); + } + public static bool IsTrialMode { get; set; } + } +} diff --git a/TrialMode.cs b/Microsoft.Xna.Framework.GamerServices/TrialMode.cs similarity index 90% rename from TrialMode.cs rename to Microsoft.Xna.Framework.GamerServices/TrialMode.cs index dfe6e8f..6eea272 100644 --- a/TrialMode.cs +++ b/Microsoft.Xna.Framework.GamerServices/TrialMode.cs @@ -1,9 +1,9 @@ using System; using System.IO; -namespace WindowsPhoneSpeedyBlupi +namespace Xna.Framework.GamerServices { - public class TrialMode + internal class TrialMode { private static DateTime trialStartTime; @@ -13,7 +13,7 @@ namespace WindowsPhoneSpeedyBlupi trialStartTime = DateTime.Now; } - public static Boolean IsTrialModeExpired() + public static bool IsTrialModeExpired() { return IsTrialMode7DaysLimitExpired() || IsTrialMode10MinutesLimitExpired(); } @@ -46,7 +46,7 @@ namespace WindowsPhoneSpeedyBlupi private static int trialModeEnabled = -1; public static bool IsTrialModeEnabled() { - if(trialModeEnabled == 1) + if (trialModeEnabled == 1) { return true; } @@ -55,7 +55,7 @@ namespace WindowsPhoneSpeedyBlupi { return false; } - + const string TRIAL_MODE_ENABLED_TXT = "trialModeEnabled.txt"; var trialModeEnabledString = File.Exists(TRIAL_MODE_ENABLED_TXT) ? File.ReadAllText(TRIAL_MODE_ENABLED_TXT) : "0"; var trialModeEnabledLocal = trialModeEnabledString.Equals("1"); diff --git a/Misc.cs b/Misc.cs index 80fd0c9..70a2625 100644 --- a/Misc.cs +++ b/Misc.cs @@ -122,36 +122,5 @@ namespace WindowsPhoneSpeedyBlupi return true; } - public static KeyboardPress intToKeyboardPress(int i) { - switch (i) - { - case 0: return KeyboardPress.None; - case 1: return KeyboardPress.Up; - case 2: return KeyboardPress.Right; - case 3: return KeyboardPress.Down; - case 4: return KeyboardPress.Left; - case 5: return KeyboardPress.LeftControl; - case 6: return KeyboardPress.Space; - case 7: return KeyboardPress.Escape; - case 8: return KeyboardPress.Pause; - default: Debug.WriteLine("Unsupported number for KeyboardPress: " + i); return KeyboardPress.None; - } - } - public static int keyboardPressToInt(KeyboardPress kp) - { - switch (kp) - { - case KeyboardPress.None: return 0; - case KeyboardPress.Up: return 1; - case KeyboardPress.Right: return 2; - case KeyboardPress.Down: return 3; - case KeyboardPress.Left: return 4; - case KeyboardPress.LeftControl: return 5; - case KeyboardPress.Space: return 6; - case KeyboardPress.Escape: return 7; - case KeyboardPress.Pause: return 8; - default: throw new Exception("Unsupported KeyboardPress: " + kp); - } - } } } \ No newline at end of file