/// <summary> /// For development purposes only /// Items will/must be loaded from a save file/initial items file /// </summary> private void LoadItems() { InventoryHUDWindow inventory = hudManager.GetWindow(Window.INVENTORY) as InventoryHUDWindow; ContentManager content = gameRef.Content; helmet = ItemFactory.CreateItem("night_vision_goggles"); inventory.EquipItem(helmet); mainHand = ItemFactory.CreateItem("desert_eagle"); inventory.EquipItem(mainHand); armor = ItemFactory.CreateItem("kevlar_vest"); inventory.EquipItem(armor); offHand = ItemFactory.CreateItem("barrel_bottom"); inventory.EquipItem(offHand); leggings = ItemFactory.CreateItem("jeans"); inventory.EquipItem(leggings); boots = ItemFactory.CreateItem("farmers_boots"); inventory.EquipItem(boots); }
private void LoadWindows() { Rectangle screenRectangle = gameRef.ScreenRectangle; ContentManager content = Game.Content; SpriteFont font = content.Load <SpriteFont>(@"Fonts\ItemDataFont"); notifications = NotificationPopup.GetInstance(); notifications.Font = font; notifications.Size = new Vector2(300, 0); notifications.Position = new Vector2((screenRectangle.Width - notifications.Size.X) / 2, screenRectangle.Height * (3f / 4f)); Texture2D tooltipBackground = content.Load <Texture2D>(@"GUI\Inventory\Tooltip\background-v2"); Texture2D tooltipBorder = content.Load <Texture2D>(@"GUI\Inventory\Tooltip\border-v6"); SimpleHUDWindow pauseWindow = new SimpleHUDWindow(font); PauseGameComponent pauseMenu = new PauseGameComponent(font, gameRef.Content); pauseMenu.RegisterExitButtonEvent(new EventHandler(CloseWindow)); pauseMenu.RegisterResumeButtonEvent(new EventHandler(ClosePauseMenuWindow)); pauseMenu.RegisterCommand(Keys.Escape, ClosePauseMenuWindow, ClickState.RELEASED); //pauseMenu.BackgroundTexture = tooltipBackground; //TODO: hardcoded offset pauseMenu.ButtonOffset = new Vector2(100, 50); pauseWindow.BorderTexture = tooltipBorder; //TODO: hardcoded size pauseWindow.Size = new Vector2(400, 400); Vector2 position = new Vector2((screenRectangle.Width - pauseWindow.Size.X) / 2, (screenRectangle.Height - pauseWindow.Size.Y) / 2); pauseWindow.Position = position; pauseWindow.Component = pauseMenu; hudManager.Put(Window.PAUSE, pauseWindow); InventoryHUDWindow inventoryEquipmentWindow = new InventoryHUDWindow(this, font, gameRef.Content, tooltipBorder, screenRectangle); ItemPickedUp += inventoryEquipmentWindow.OnItemPickup; hudManager.Put(Window.INVENTORY, inventoryEquipmentWindow); commandManager.RegisterCommand(Keys.I, inventoryEquipmentWindow.ShowEquipment); commandManager.RegisterCommand(Keys.U, inventoryEquipmentWindow.ShowInventory); inventoryEquipmentWindow.RegisterCommand(Keys.I, inventoryEquipmentWindow.ToggleEquipment); inventoryEquipmentWindow.RegisterCommand(Keys.U, inventoryEquipmentWindow.ToggleInventory); inventoryEquipmentWindow.RegisterCommand(Keys.Escape, inventoryEquipmentWindow.Close); inventoryEquipmentWindow.RegisterStatChangeEvent(ChangePlayerStats); SimpleHUDWindow missionLogWindow = new SimpleHUDWindow(font); MissionLogComponent missionLogComponent = new MissionLogComponent(font, gameRef.Content); //TODO: hardcoded position and size missionLogWindow.Size = new Vector2(800, 600); position = new Vector2((screenRectangle.Width - missionLogWindow.Size.X) / 2, (screenRectangle.Height - missionLogWindow.Size.Y) / 2); missionLogWindow.Position = position; missionLogWindow.Component = missionLogComponent; missionLogWindow.BorderTexture = tooltipBorder; //TODO: hardcoded title missionLogWindow.Title = "Mission Log"; missionLogComponent.RegisterCommand(Keys.L, CloseMissionLogWindow, ClickState.RELEASED); missionLogComponent.RegisterCommand(Keys.Escape, CloseMissionLogWindow, ClickState.RELEASED); hudManager.Put(Window.MISSION_LOG, missionLogWindow); SimpleHUDWindow playerInfoWindow = new SimpleHUDWindow(font); PlayerInfoComponent playerInfoComponent = new PlayerInfoComponent(font, content, player); //TODO: hardcoded size and test position playerInfoWindow.Size = new Vector2(400, 300); position = new Vector2((screenRectangle.Width - playerInfoWindow.Size.X) / 2, (screenRectangle.Height - playerInfoWindow.Size.Y) / 2); playerInfoWindow.Position = position; playerInfoWindow.Component = playerInfoComponent; playerInfoWindow.BorderTexture = tooltipBorder; //TODO: hardcoded title playerInfoWindow.Title = "Player Stats"; playerInfoComponent.RegisterCommand(Keys.C, ClosePlayerInfoWindow, ClickState.RELEASED); playerInfoComponent.RegisterCommand(Keys.Escape, ClosePlayerInfoWindow, ClickState.RELEASED); hudManager.Put(Window.PLAYER_INFO, playerInfoWindow); gameInterface = new GameInterface(player, font); //TODO: hardcoded position gameInterface.Position = new Vector2(screenRectangle.Width - 200, screenRectangle.Height - 60); }