/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); manager.Initialize(); // Add Login window pageLogin = new GUILogin(manager, network, this); manager.Add(pageLogin); // Add Character selector window pageCharacterSelector = new GUICharacterSelector(manager, network, this); manager.Add(pageCharacterSelector); pageCharacterSelector.Visible = false; // Add Character creator window pageCharacterCreator = new GUICharacterCreator(manager, network, this, classConfigs); manager.Add(pageCharacterCreator); pageCharacterCreator.Visible = false; // Add Message dialog messageDialog = new GUIMessageDialog(manager, "", ""); manager.Add(messageDialog); messageDialog.Visible = false; // game gui guiGameAttribute = new GUIGameAttribute(manager, network); manager.Add(guiGameAttribute); guiGameAttribute.Visible = false; guiGameInventory = new GUIGameInventory(manager, network, Content, graphics, config.getItemList()); manager.Add(guiGameInventory); guiGameInventory.Visible = false; guiGameEquipment = new GUIGameEquipment(manager, network, Content, graphics, config.getItemList()); manager.Add(guiGameEquipment); guiGameEquipment.Visible = false; guiGameChat = new GUIGameChat(manager, network); manager.Add(guiGameChat); guiGameChat.Visible = false; guiGameMenu = new GUIGameMenu(manager, network, gameHandler, this); manager.Add(guiGameMenu); guiGameMenu.Visible = false; guiGameNPC = new GUIGameNPC(manager, network, Content, config.getDialogList()); manager.Add(guiGameNPC); guiGameNPC.Visible = false; guiGameEnvironment = new GUIGameEnvironment(manager, guiGameAttribute, null, guiGameEquipment, guiGameInventory, guiGameMenu); manager.Add(guiGameEnvironment); guiGameEnvironment.Visible = false; // Init Inventory & Equipment System guiGameInventory.init(guiGameEquipment); guiGameEquipment.init(guiGameInventory); // Shadow map //shadow.Initialize(); // SFX audioSystem.Initialize(); // BGM cue = audioSystem.getSoundBank().GetCue("01"); cue.Play(); //Debug.WriteLine("Initialized"); }
public void Update(GameTime gameTime, Matrix rootTransform) { try { // Update all entity foreach (UnitEntity ent in monstersEntity.Values) { ent.Update(gameTime, rootTransform); } foreach (UnitEntity ent in npcsEntity.Values) { ent.Update(gameTime, rootTransform); } foreach (UnitEntity ent in playersEntity.Values) { ent.Update(gameTime, rootTransform); } if (playerEntity != null) { playerEntity.Update(gameTime, rootTransform); } sendMsg(); GUIGameMenu guiGameMenu = game.getGuiGameMenu(); if (playerEntity.currentState() == GameState.anim_die) { guiGameMenu.enableRebornButton(true); if (!guiGameMenu.showRebornOnce) { guiGameMenu.Visible = true; guiGameMenu.showRebornOnce = true; } } else { guiGameMenu.enableRebornButton(false); if (guiGameMenu.showRebornOnce) { guiGameMenu.showRebornOnce = false; } } audioSystem.setListenerPosition(this.getPlayerPosition()); } catch (Exception e) { Debug.WriteLine(e.StackTrace); } }
public GUIGameEnvironment(Manager manager, GUIGameAttribute guiGameAttribute = null, GUIGameSkill guiGameSkill = null, GUIGameEquipment guiGameEquipment = null, GUIGameInventory guiGameInventory = null, GUIGameMenu guiGameMenu = null) : base(manager) { this.manager = manager; this.guiGameAttribute = guiGameAttribute; this.guiGameSkill = guiGameSkill; this.guiGameEquipment = guiGameEquipment; this.guiGameInventory = guiGameInventory; this.guiGameMenu = guiGameMenu; Init(); Width = 395; Height = 80; Top = -15; Left = (manager.ScreenWidth - Width) / 2; Alpha = 220; CaptionVisible = false; CloseButtonVisible = false; Resizable = false; Movable = false; attributeButton = new Button(manager); attributeButton.Init(); attributeButton.Text = "Attributes"; attributeButton.Enabled = true; attributeButton.Parent = this; attributeButton.Width = 70; attributeButton.Top = 10; attributeButton.Left = 5; attributeButton.Click += new TomShane.Neoforce.Controls.EventHandler(attributeButton_Click); Add(attributeButton); skillButton = new Button(manager); skillButton.Init(); skillButton.Text = "Skills"; skillButton.Enabled = true; skillButton.Parent = this; skillButton.Width = 70; skillButton.Top = 10; skillButton.Left = 80; skillButton.Click += new TomShane.Neoforce.Controls.EventHandler(skillButton_Click); Add(skillButton); equipmentButton = new Button(manager); equipmentButton.Init(); equipmentButton.Text = "Equipment"; equipmentButton.Enabled = true; equipmentButton.Parent = this; equipmentButton.Width = 70; equipmentButton.Top = 10; equipmentButton.Left = 155; equipmentButton.Click += new TomShane.Neoforce.Controls.EventHandler(equipmentButton_Click); Add(equipmentButton); inventoryButton = new Button(manager); inventoryButton.Init(); inventoryButton.Text = "Inventory"; inventoryButton.Enabled = true; inventoryButton.Parent = this; inventoryButton.Width = 70; inventoryButton.Top = 10; inventoryButton.Left = 230; inventoryButton.Click += new TomShane.Neoforce.Controls.EventHandler(inventoryButton_Click); Add(inventoryButton); systemButton = new Button(manager); systemButton.Init(); systemButton.Text = "System"; systemButton.Enabled = true; systemButton.Parent = this; systemButton.Width = 70; systemButton.Top = 10; systemButton.Left = 305; systemButton.Click += new TomShane.Neoforce.Controls.EventHandler(systemButton_Click); Add(systemButton); hpBar = new TrackBar(manager); hpBar.Init(); hpBar.Value = 75; hpBar.Range = 100; hpBar.Enabled = false; hpBar.Parent = this; hpBar.Width = 183; hpBar.Height = 20; hpBar.Top = 35; hpBar.Left = 5; hpBar.Color = Color.Red; hpBar.SliderButtonVisible = false; Add(hpBar); spBar = new TrackBar(manager); spBar.Init(); spBar.Value = 75; spBar.Range = 100; spBar.Enabled = false; spBar.Parent = this; spBar.Width = 183; spBar.Height = 20; spBar.Top = 35; spBar.Left = 192; spBar.Color = Color.Blue; spBar.SliderButtonVisible = false; Add(spBar); expBar = new TrackBar(manager); expBar.Init(); expBar.Value = 75; expBar.Range = 100; expBar.Enabled = false; expBar.Parent = this; expBar.Width = 370; expBar.Height = 10; expBar.Top = 53; expBar.Left = 5; expBar.Color = Color.Yellow; expBar.SliderButtonVisible = false; Add(expBar); }