// ------------- Window Preparation ----------------// /// <summary> /// Load a new page for each of the view types /// </summary> public WindowViewModel() { OrdersVM = new OrdersViewModel(); LoadOrderCommand = new BoundingCommand(LoadOrder); CustomerVM = new CustomerViewModel(); LoadCustomerCommand = new BoundingCommand(LoadCustomer); ProductVM = new ProductViewModel(); LoadProductCommand = new BoundingCommand(LoadProduct); MetricVM = new MetricsViewModel(); LoadMetricCommand = new BoundingCommand(LoadMetric); }
protected override void Initialize() { //Here we map the buttons and keys to our Action enum buttonsMap = new Dictionary <Buttons, ICommand>(); keysMap = new Dictionary <Keys, ICommand>(); level = new Levels.Level1(graphics); level.Initialize(); playerController = level.getPlayerController(); //BUNCH O BLOCKS TEMPORARY!!!!!! //bunchOBlocks[0] = new BlockContext(BlockContext.Blocks.BRICK, new Vector2(100, 250)); //bunchOBlocks[1] = new BlockContext(BlockContext.Blocks.USED, new Vector2(150, 250)); //bunchOBlocks[2] = new BlockContext(BlockContext.Blocks.QUESTION, new Vector2(200, 250)); //bunchOBlocks[3] = new BlockContext(BlockContext.Blocks.STAIR, new Vector2(250, 250)); //bunchOBlocks[4] = new BlockContext(BlockContext.Blocks.FLOOR, new Vector2(300, 250)); //bunchOBlocks[5] = new BlockContext(BlockContext.Blocks.HIDDEN, new Vector2(350, 250)); //add entities //entities.Add(bunchOBlocks[0]); //entities.Add(bunchOBlocks[1]); //entities.Add(bunchOBlocks[2]); //entities.Add(bunchOBlocks[3]); //entities.Add(bunchOBlocks[4]); //entities.Add(bunchOBlocks[5]); //entities.Add(player); //entities.Add(redGoombaSprite); //entities.Add(redKoopaSprite); //entities.Add(greenKoopaSprite); //entities.Add(_1UpMushroomSprite); //entities.Add(staticCoinSprite); //entities.Add(blockCoinSprite); //entities.Add(fireFlowerSprite); //entities.Add(starmanSprite); //entities.Add(superMushroomSprite); // Instances of commands ICommand quitCommand = new QuitCommand(this); ICommand moveLeftCommand = new MoveLeftCommand(playerController); ICommand moveRightCommand = new MoveRightCommand(playerController); ICommand jumpCommand = new JumpCommand(playerController); ICommand crouchCommand = new CrouchCommand(playerController); ICommand fireballCommand = new FireballCommand(playerController); ICommand pauseCommand = new PauseCommand(playerController); ICommand fireCommand = new FireCommand(playerController); ICommand bigCommand = new BigCommand(playerController); ICommand smallCommand = new SmallCommand(playerController); ICommand takeDamageCommand = new TakeDamageCommand(playerController); ICommand boundingCommand = new BoundingCommand(playerController, ((Level1)level).entities); // Assign commands to buttons buttonsMap.Add(Buttons.Start, quitCommand); buttonsMap.Add(Buttons.Back, null); buttonsMap.Add(Buttons.DPadLeft, moveLeftCommand); buttonsMap.Add(Buttons.DPadRight, moveRightCommand); buttonsMap.Add(Buttons.DPadUp, jumpCommand); buttonsMap.Add(Buttons.A, jumpCommand); buttonsMap.Add(Buttons.DPadDown, crouchCommand); buttonsMap.Add(Buttons.B, fireballCommand); buttonsMap.Add(Buttons.X, null); buttonsMap.Add(Buttons.Y, null); //buttonsMap.Add(Buttons.Start, pauseCommand); // Assign commands to keys keysMap.Add(Keys.Q, quitCommand); keysMap.Add(Keys.Left, moveLeftCommand); keysMap.Add(Keys.A, moveLeftCommand); keysMap.Add(Keys.Right, moveRightCommand); keysMap.Add(Keys.D, moveRightCommand); keysMap.Add(Keys.Up, jumpCommand); keysMap.Add(Keys.W, jumpCommand); keysMap.Add(Keys.Down, crouchCommand); keysMap.Add(Keys.S, crouchCommand); keysMap.Add(Keys.Space, fireballCommand); keysMap.Add(Keys.Escape, pauseCommand); keysMap.Add(Keys.Y, smallCommand); keysMap.Add(Keys.U, bigCommand); keysMap.Add(Keys.I, fireCommand); keysMap.Add(Keys.O, takeDamageCommand); keysMap.Add(Keys.C, boundingCommand); base.Initialize(); }