public override void LoadContent() { _font = Resources.GetFont(Resources.FontResources.NinaB); var tempSheet = Resources.GetBitmap(Resources.BitmapResources.pacman); _spriteSheet = new Bitmap(tempSheet.Width, tempSheet.Height); _spriteSheet.DrawImage(0, 0, tempSheet, 0, 0, tempSheet.Width, tempSheet.Height); _spriteSheet.MakeTransparent(Microsoft.SPOT.Presentation.Media.Color.Black); _maze = new Maze(); _maze.Draw(Surface, Host); _pacman = new Player(_spriteSheet, _maze); #region Initialize Bonus Point Sprites _bonus200 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(80, 104, 16, 8) })); _bonus400 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(96, 104, 16, 8) })); _bonus800 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(112, 104, 16, 8) })); _bonus1600 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(128, 104, 16, 8) })); _bonus100 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(0, 112, 16, 8) })); _bonus300 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(16, 112, 16, 8) })); _bonus500 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(32, 112, 16, 8) })); _bonus700 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(48, 112, 16, 8) })); _bonus1000 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(64, 112, 20, 8) })); _bonus2000 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(84, 112, 20, 8) })); _bonus3000 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(106, 112, 20, 8) })); _bonus5000 = new Sprite(new AnimationSequence(_spriteSheet, 0, new Rect[] { new Rect(128, 112, 16, 8) })); #endregion #region Initialize Ghosts _blinky = new Ghost(_spriteSheet, _maze, _pacman, 16, new Personality() { ScatterX = 13 * 16, ScatterY = -2 * 16, TargetOffsetX = 0, TargetOffsetY = 0, HouseX = 7 * 16, HouseY = 7 * 16, StartX = 7 * 16, StartY = 5 * 16 }); _blinky.CurrentDirection = Direction.Left; _pinky = new Ghost(_spriteSheet, _maze, _pacman, 32, new Personality() { ScatterX = 1 * 16, ScatterY = -2 * 16, TargetOffsetX = 4 * 16, TargetOffsetY = 0, HouseX = 6 * 16, HouseY = 7 * 16, StartX = 6 * 16, StartY = 7 * 16 }); _pinky.CurrentDirection = Direction.Left; _inky = new Ghost(_spriteSheet, _maze, _pacman, 48, new Personality() { ScatterX = 14 * 16, ScatterY = 15 * 16, TargetOffsetX = -3 * 16, TargetOffsetY = 0, HouseX = 7 * 16, HouseY = 7 * 16, StartX = 7 * 16, StartY = 7 * 16 }); _inky.CurrentDirection = Direction.Left; _clyde = new Ghost(_spriteSheet, _maze, _pacman, 64, new Personality() { ScatterX = 0 * 16, ScatterY = 15 * 16, TargetOffsetX = 0, TargetOffsetY = -2 * 16, HouseX = 8 * 16, HouseY = 7 * 16, StartX = 8 * 16, StartY = 7 * 16 }); _clyde.CurrentDirection = Direction.Left; #endregion _pacman.Enemies = new Ghost[] { _blinky, _pinky, _inky, _clyde }; #region Add objects to scene AddToScene(_showBonusCountDown); AddToScene(_showBonusScoreCountDown); AddToScene(_maze); AddToScene(_pacman); AddToScene(_blinky); AddToScene(_pinky); AddToScene(_inky); AddToScene(_clyde); #endregion _maze.LevelComplete += MazeLevelComplete; _showBonusCountDown.Expired += BonusCountDown_Expired; MessageService.Instance.Subscribe(typeof(Messages.PacmanDeadMessage), HandlePacmanDeadMessage); MessageService.Instance.Subscribe(typeof(Messages.PacmanAteGhostMessage), HandlePacmanAteGhostMessage); MessageService.Instance.Subscribe(typeof(Messages.AteBonusItemMessage), HandleAteBonusItem); base.LoadContent(); Reset(); }
private EditDesktop() { _lastDesktop = null; Suspended = true; _bmpEnter = Mp.Ui.Resources.Images.GetBitmap(Resources.Images.BitmapResources.enter); _bmpEnter.MakeTransparent(Colors.Fuchsia); Utils.ChangeBitmapColor(_bmpEnter, Colors.Fuchsia, StyleManager.CurrentStyle.ButtonEnabledTextColor); _bmpBackspace = Mp.Ui.Resources.Images.GetBitmap(Resources.Images.BitmapResources.backspace); _bmpBackspace.MakeTransparent(Colors.Fuchsia); Utils.ChangeBitmapColor(_bmpBackspace, Colors.Fuchsia, StyleManager.CurrentStyle.ButtonEnabledTextColor); StyleManager.StyleChanged += (oldStyle, newStyle) => { Utils.ChangeBitmapColor(_bmpEnter, Colors.Fuchsia, newStyle.ButtonEnabledTextColor); Utils.ChangeBitmapColor(_bmpBackspace, Colors.Fuchsia, newStyle.ButtonEnabledTextColor); }; CreateCommonLayout(); int panelHeight = _height - _doneButton.ScreenBottom - _uiMargin; CreateQwertyLayout(_qwertyPanel = new Panel(0, _height - panelHeight, _width, panelHeight)); CreateNumericLayout(_numericPanel = new Panel(0, _height - panelHeight, _width, panelHeight) { _visible = false }); base.AddChild(_qwertyPanel); base.AddChild(_numericPanel); _ignoreAllowedCharsChanges = true; AllowedCharTypes = AllowedCharTypesEnum.All; _ignoreAllowedCharsChanges = false; }