/// <summary> /// /// </summary> public override void Draw() { // Clears the background Display.ClearBuffers(); Batch.Begin(); // Background Batch.DrawTile(Tileset, 1, Point.Empty); // Draw buttons for (int id = 0; id < Buttons.Count; id++) { ScreenButton button = Buttons[id]; Point point = button.Rectangle.Location; // Text Batch.DrawString(GUI.MenuFont, point, id == MenuID ? GameColors.Red : Color.White, button.Text); } // Version info Batch.DrawString(GUI.MenuFont, new Point(512, 380), Color.White, "V0.4"); Batch.End(); }
public Menu() { InitializeComponent(); SettingsButton.Text("Settings"); HistoryButton.Text("History"); BookmarksButton.Text("Bookmarks"); DownloadsButton.Text("Downloads"); ExtensionsButton.Text("Extensions"); WindowButton.Text("New window"); FullscreenButton.Text("Fullscreen"); ScreenButton.Text("Take screenshot"); DevButton.Text("Developer tools"); IncognitoButton.Text("Incognito"); SettingsButton.ImageSource("settings.png"); HistoryButton.ImageSource("history.png"); BookmarksButton.ImageSource("bookmarks.png"); DownloadsButton.ImageSource("download.png"); ExtensionsButton.ImageSource("extension.png"); WindowButton.ImageSource(("window.png")); FullscreenButton.ImageSource("fullscreen.png"); ScreenButton.ImageSource("screen.png"); DevButton.ImageSource("dev.png"); IncognitoButton.ImageSource("privacy.png"); }
/// <summary> /// Drawing /// </summary> public override void Draw() { // Clears the background Display.ClearBuffers(); Batch.Begin(); // Background Batch.DrawTile(Tileset, 1, Point.Empty); // Draw buttons for (int id = 0; id < Buttons.Count; id++) { ScreenButton button = Buttons[id]; Batch.DrawString(Font, new Vector2(button.Rectangle.Location.X, button.Rectangle.Location.Y), id == MenuID ? Color.FromArgb(255, 85, 85) : Color.White, button.Text); } if (LoadGame != null) { LoadGame.Draw(Batch); } Batch.End(); }
/// <summary> /// Constructor /// </summary> /// <param name="camp">Camp window handle</param> public SaveGameWindow(CampDialog camp) : base(camp, "Save Game:") { GameSettings.SavedGames.Load(); ScreenButton button; for (int id = 0; id < GameSettings.MaxGameSaveSlot; id++) { SaveGameSlot slot = GameSettings.SavedGames.Slots[id]; button = new ScreenButton(slot != null ? slot.Name : "", new Rectangle(16, 40 + id * 34, 320, 28)); button.Selected += new EventHandler(slot_Selected); button.Tag = slot == null ? -1 : id; Buttons.Add(button); } button = new ScreenButton("Cancel", new Rectangle(230, 244, 106, 28)); button.Selected += new EventHandler(Cancel_Selected); Buttons.Add(button); SelectedSlot = -1; }
/// <summary> /// Constructor /// </summary> public MainWindow(CampDialog camp) : base(camp, "Camp :") { ScreenButton button; // Adds buttons button = new ScreenButton("Rest Party", new Rectangle(16, 40, 320, 28)); button.Selected += new EventHandler(RestParty_Selected); Buttons.Add(button); button = new ScreenButton("Memorize Spells", new Rectangle(16, 74, 320, 28)); button.Selected += new EventHandler(MemorizeSpells_Selected); Buttons.Add(button); button = new ScreenButton("Pray for Spells", new Rectangle(16, 108, 320, 28)); button.Selected += new EventHandler(PrayForSpells_Selected); Buttons.Add(button); button = new ScreenButton("Scribe Scrolls", new Rectangle(16, 142, 320, 28)); button.Selected += new EventHandler(ScribeScrolls_Selected); Buttons.Add(button); button = new ScreenButton("Preferences", new Rectangle(16, 176, 320, 28)); button.Selected += new EventHandler(Preferences_Selected); Buttons.Add(button); button = new ScreenButton("Game Options", new Rectangle(16, 210, 320, 28)); button.Selected += new EventHandler(GameOptions_Selected); Buttons.Add(button); button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28)); button.Selected += new EventHandler(Exit_Selected); Buttons.Add(button); }
/// <summary> /// Constructor /// </summary> public PreferencesWindow(CampDialog camp) : base(camp, "Preferences :") { ScreenButton button; button = new ScreenButton("", new Rectangle(16, 40, 320, 28)); button.Selected += new EventHandler(Tunes_Selected); if (AudioManager.PlayTunes) button.Text = "Tunes are ON"; else button.Text = "Tunes are OFF"; Buttons.Add(button); button = new ScreenButton("", new Rectangle(16, 74, 320, 28)); button.Selected += new EventHandler(Sounds_Selected); if (AudioManager.PlayTunes) button.Text = "Sounds are ON"; else button.Text = "Sounds are OFF"; Buttons.Add(button); button = new ScreenButton("", new Rectangle(16, 108, 320, 28)); button.Selected += new EventHandler(Bar_Selected); if (GameSettings.DrawHPAsBar) button.Text = "Bar Graphs are ON"; else button.Text = "Bar Graphs are OFF"; Buttons.Add(button); button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28)); button.Selected += new EventHandler(Exit_Selected); Buttons.Add(button); }
/// <summary> /// Change GUI elements when a new hero is selected /// </summary> void HeroSelected() { // Buttons already present if (Hero != null) { return; } Title = "Spells Available :"; ScreenButton button; button = new ScreenButton("Clear", new Rectangle(16, 244, 96, 28)); button.Selected += new EventHandler(Clear_Selected); Buttons.Add(button); for (int i = 0; i < 6; i++) { Levels[i].IsVisible = true; } Levels[0].TextColor = GameColors.Red; SpellLevel = 1; }
public override void Initialize(Game1 game) { base.Initialize(game); String buttonString = "Go to battle mode"; Vector2 buttonPos = new Vector2(1366 / 2, 768 / 2) - Game1.defaultFont.MeasureString(buttonString) / 2; goToBattleButton = new ScreenButton(default(Texture2D), Game1.defaultFont, buttonString, buttonPos); }
/// <summary> /// Adds a close button to the window. /// </summary> public void AddCloseButton(Engine engine) { ScreenButton _button = new ScreenButton(this, "Close", "X", engine.FontMain); _button.Position = new Vector2(this.Size.X - headerSize, 0); _button.Size = new Vector2(headerSize, headerSize); ElementList.Add(_button); }
/// <summary> /// Constructor /// </summary> public ScribeScrollsWindow(CampDialog camp) : base(camp, "Scribe Scrolls :") { ScreenButton button; button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28)); button.Selected += new EventHandler(Exit_Selected); Buttons.Add(button); }
protected virtual void OnMemberDragging(ScreenButton sender, Vector2 value) { if (Parent == null) { BasicPosition += value; } else { CallDragging(sender, value); } }
protected override void OnMemberDragging(ScreenButton button, Vector2 value) { if (DragWholeGroup) { base.OnMemberDragging(button, value); } else { button.BasicPosition += value; } }
/// <summary> /// Exit button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Level_Selected(object sender, EventArgs e) { for (int i = 0; i < 6; i++) { Levels[i].TextColor = Color.White; } ScreenButton button = sender as ScreenButton; button.TextColor = GameColors.Red; }
public BlockSettings(Engine engine, Block block) : base("Block Settings") { this.block = block; this.DemandPriority = true; CullingButton = new ScreenButton(this, "Toggle Culling", "Culling: False", engine.FontMain); AddElement(CullingButton); SolidButton = new ScreenButton(this, "Toggle Solid", "Solid: False", engine.FontMain); AddElement(SolidButton); AddCloseButton(engine); Center(engine); UpdateButtons(); }
private void SetUpScreen(Engine engine) { this.Size.X = 320; this.AddCloseButton(engine); this.DemandPriority = true; Vector2 _tl = new Vector2(Screen.boarderSize, Screen.boarderSize + Screen.headerSize); Vector2 _sz = new Vector2(32, 32); Vector2 _left = new Vector2(32, 0); Vector2 _down = new Vector2(0, 32); BBack = new ScreenPictureButton(this, "Set Back", engine.textureManager.Dic["backarrow"], _tl, _sz); BTop = new ScreenPictureButton(this, "Set Top", engine.textureManager.Dic["uparrow"], _tl + _left, _sz); BLeft = new ScreenPictureButton(this, "Set Left", engine.textureManager.Dic["leftarrow"], _tl + _down, _sz); BRight = new ScreenPictureButton(this, "Set Right", engine.textureManager.Dic["rightarrow"], _tl + _down + _left * 2, _sz); BFront = new ScreenPictureButton(this, "Set Front", engine.textureManager.Dic["frontarrow"], _tl + _down + _left, _sz); BBottom = new ScreenPictureButton(this, "Set Bottom", engine.textureManager.Dic["downarrow"], _tl + _down * 2 + _left, _sz); this.AddElement(BBack); this.AddElement(BTop); this.AddElement(BLeft); this.AddElement(BRight); this.AddElement(BFront); this.AddElement(BBottom); UpdateButtonColor(); TextureSelector = new ScreenTextureSelector(engine, this); AddElement(TextureSelector); float _butHeight = PrevBox.Y + PrevBoxSize + boarderSize; ScreenButton _but = new ScreenButton(this, "Name", engine.FontMain); _but.Position.X = Screen.boarderSize * 3 + 2 * 32; _but.Position.Y = _butHeight; _but.Size.X = 48; this.AddElement(_but); _but = new ScreenButton(this, "Settings", engine.FontMain); _but.Position.X = Screen.boarderSize * 4 + 2 * 32 + 48; _but.Position.Y = _butHeight; _but.Size.X = 64; this.AddElement(_but); _but = new ScreenButton(this, "Save", engine.FontMain); _but.Position.X = Screen.boarderSize * 5 + 2 * 32 + 48 + 64; _but.Position.Y = _butHeight; _but.Size.X = 48; this.AddElement(_but); UpdateHeader(); }
/// <summary> /// Will set whether or not a button is active or Inactive /// If Inactive the button will be grayed out. Otherwise it will glow when the FlashLight is set the the corresponding LightType /// </summary> /// <param name="button">button the button in question</param> /// <param name="active">If True, the button will be st to Active, if false, the button will be set to inactive</param> public void setButtonActivity(ScreenButton button, bool active) { if (button == ScreenButton.LASERBUTTON) { setLaserActivity(active); } else if (button == ScreenButton.MEDIUMBUTTON) { setRevealActivity(active); } else if (button == ScreenButton.WIDEBUTTON) { setWideActivity(active); } }
/// <summary> /// Bar button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Bar_Selected(object sender, EventArgs e) { ScreenButton button = sender as ScreenButton; if (GameSettings.DrawHPAsBar) { button.Text = "Bar Graphs are OFF"; GameSettings.DrawHPAsBar = false; } else { button.Text = "Bar Graphs are ON"; GameSettings.DrawHPAsBar = true; } }
/// <summary> /// Will highlight a given button. This will result in it appearing brighter than normal /// </summary> /// <param name="button">the target Button</param> public void highlightButton(ScreenButton button) { if (button == ScreenButton.LASERBUTTON) { base.setLaserHighLight(true); } else if (button == ScreenButton.MEDIUMBUTTON) { base.setMediumHighLight(true); } else if (button == ScreenButton.WIDEBUTTON) { base.setWideHighLight(true); } }
/// <summary> /// will Return whether or not a given button is Highlighted. if it is Highlighted will appear brighter than normal /// </summary> /// <param name="button">the button in question</param> /// <returns>If TRUE, the button is Highlighted. otherwise. If FALSE, the button is not</returns> public bool isButtonHighlighted(ScreenButton button) { if (button == ScreenButton.LASERBUTTON) { return(base.isLaserHighlighted()); } else if (button == ScreenButton.MEDIUMBUTTON) { return(base.isMediumHighlighted()); } else if (button == ScreenButton.WIDEBUTTON) { return(base.isWideHighlighted()); } return(false); }
/// <summary> /// Will return true if the given ScreenButton is currently being held Down /// </summary> /// <param name="button">button the button in question</param> /// <returns>true if the given ScreenButton is currently being held Down, otherwise false</returns> public bool isButtonDown(ScreenButton button) { if (button == ScreenButton.LASERBUTTON) { return(isLaserDown()); } else if (button == ScreenButton.MEDIUMBUTTON) { return(isMediumDown()); } else if (button == ScreenButton.WIDEBUTTON) { return(isWideDown()); } return(false); }
/// <summary> /// Will return whether or not a Button is Active or Inactive /// If Inactive the button will be grayed out. Otherwise it will glow when the FlashLight is set the the corresponding LightType /// </summary> /// <param name="button">the button in question</param> /// <returns>If TRUE, The button is Active. If FALSE, the button is Inactive</returns> public bool isButtonActive(ScreenButton button) { if (button == ScreenButton.LASERBUTTON) { return(getLaserActivity()); } else if (button == ScreenButton.MEDIUMBUTTON) { return(getRevealActivity()); } else if (button == ScreenButton.WIDEBUTTON) { return(getWideActivity()); } return(false); }
public BlockDesigner(Engine engine, Tileset tileset, BlockPlacer parentScreen, Block block) : base("Block Designer") { this.parentScreen = parentScreen; this.tileset = tileset; this.EditMode = true; this.CurrentBlock = block; SetUpScreen(engine); ScreenButton _but = new ScreenButton(this, "Delete", "Del", engine.FontMain); _but.Position.X = Screen.boarderSize * 6 + 2 * 32 + 48 + 64 + 48; _but.Position.Y = PrevBox.Y + PrevBoxSize + boarderSize;; _but.Size.X = 32; this.AddElement(_but); }
/// <summary> /// Sounds button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Sounds_Selected(object sender, EventArgs e) { ScreenButton button = sender as ScreenButton; if (AudioManager.PlaySounds) { button.Text = "Sounds are OFF"; AudioManager.PlaySounds = false; } else { button.Text = "Sounds are ON"; AudioManager.PlaySounds = true; } Settings.SetToken("Sounds", AudioManager.PlaySounds); }
/// <summary> /// Constructor /// </summary> public PreferencesWindow(CampDialog camp) : base(camp, "Preferences :") { ScreenButton button; button = new ScreenButton("", new Rectangle(16, 40, 320, 28)); button.Selected += new EventHandler(Tunes_Selected); if (AudioManager.PlayTunes) { button.Text = "Tunes are ON"; } else { button.Text = "Tunes are OFF"; } Buttons.Add(button); button = new ScreenButton("", new Rectangle(16, 74, 320, 28)); button.Selected += new EventHandler(Sounds_Selected); if (AudioManager.PlayTunes) { button.Text = "Sounds are ON"; } else { button.Text = "Sounds are OFF"; } Buttons.Add(button); button = new ScreenButton("", new Rectangle(16, 108, 320, 28)); button.Selected += new EventHandler(Bar_Selected); if (GameSettings.DrawHPAsBar) { button.Text = "Bar Graphs are ON"; } else { button.Text = "Bar Graphs are OFF"; } Buttons.Add(button); button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28)); button.Selected += new EventHandler(Exit_Selected); Buttons.Add(button); }
/// <summary> /// Constructor /// </summary> public RestPartyWindow(CampDialog camp) : base(camp, "Rest Party :") { ScreenButton button; button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28)); button.Selected += new EventHandler(Exit_Selected); Buttons.Add(button); MessageBox = new MessageBox("Will your healers<br />heals the party ?", MessageBoxButtons.YesNo); MessageBox.Selected += new EventHandler(HealAnswer); // TODO: // Someone is still // injured. Rest // until healed ? }
/// <summary> /// Constructor /// </summary> public DropNPCWindow(CampDialog camp) : base(camp, "Drop Character") { if (GameScreen.Team.HeroCount <= 4) { Closing = true; return; } Interface = ResourceManager.LockSharedAsset <TileSet>("Interface"); // Adds buttons ScreenButton button; button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28)); button.Selected += new EventHandler(Exit_Selected); Buttons.Add(button); RectangleColor = Color.White; Message = "Select a character<br />from your party<br />who would like to<br />drop."; }
/// <summary> /// Constructs a block selector window. /// </summary> public BlockPlacer(Engine engine, LevelEditor parentEditor) : base("Block Selector") { this.parentEditor = parentEditor; ScreenButton _but = new ScreenButton(this, "Back", "<", engine.FontMain); _but.Position.X = boarderSize; _but.Size.X = 32; ElementList.Add(_but); _but = new ScreenButton(this, "Forward", ">", engine.FontMain); _but.Position.X = boarderSize + 32 + boarderSize; _but.Size.X = 32; _but.Position.Y = headerSize + boarderSize; ElementList.Add(_but); _but = new ScreenButton(this, "New Block", "New", engine.FontMain); _but.Position.X = boarderSize + 32 + boarderSize + 32 + boarderSize; _but.Size.X = 48; _but.Position.Y = headerSize + boarderSize; ElementList.Add(_but); _but = new ScreenButton(this, "Edit Block", "Edit", engine.FontMain); _but.Position.X = boarderSize + 32 + boarderSize + 32 + boarderSize + 48 + boarderSize; _but.Size.X = 48; _but.Position.Y = headerSize + boarderSize; ElementList.Add(_but); _but = new ScreenButton(this, "Save/Load", "Sv/Ld", engine.FontMain); _but.Position.X = boarderSize + 32 + boarderSize + 32 + boarderSize + 48 + boarderSize + 48 + boarderSize; _but.Size.X = 48; _but.Position.Y = headerSize + boarderSize; ElementList.Add(_but); InputField = new ScreenInput(this, engine.FontMain); AddElement(InputField); PrevPosition = new Vector2((Size.X - PrevBoxWidth * PrevMaximumColumns) / 2, GetTotalElementHeight()); this.Size.Y = PrevPosition.Y + Screen.boarderSize + PrevMaximumRows * PrevBoxHeight; FilterBlocks(engine); this.Position = new Vector2(engine.windowSize.X - this.Size.X, 0); }
/// <summary> /// Exit button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Slot_Selected(object sender, EventArgs e) { ScreenButton button = sender as ScreenButton; // Empty slot if (string.IsNullOrEmpty(button.Text)) { return; } SelectedSlot = (int)(button.Tag); // If ingame, then load the savegame if (Camp != null) { Camp.Game.LoadGameSlot(SelectedSlot); Camp.Exit(); } }
/// <summary> /// Constructor /// </summary> /// <param name="camp">Camp window handle</param> public LoadGameWindow(CampDialog camp) : base(camp, "Load Game:") { GameSettings.SavedGames.Load(); ScreenButton button; for (int id = 0; id < GameSettings.MaxGameSaveSlot; id++) { SaveGameSlot slot = GameSettings.SavedGames.Slots[id]; button = new ScreenButton(slot != null ? slot.Name : "", new Rectangle(16, 40 + id * 34, 320, 28)); button.Selected += new EventHandler(Slot_Selected); button.Tag = slot == null ? -1 : id; Buttons.Add(button); } button = new ScreenButton("Cancel", new Rectangle(230, 244, 106, 28)); button.Selected += new EventHandler(Cancel_Selected); Buttons.Add(button); SelectedSlot = -1; }
/// <summary> /// Loads content /// </summary> public override void LoadContent() { Trace.WriteLine("[CharGen] LoadContent()"); Batch = new SpriteBatch(); Tileset = ResourceManager.CreateAsset <TileSet>("CharGen"); Heads = ResourceManager.CreateAsset <TileSet>("Heads"); Font = ResourceManager.CreateAsset <BitmapFont>("intro"); NameFont = ResourceManager.CreateAsset <BitmapFont>("name"); PlayButton = new ScreenButton(string.Empty, new Rectangle(48, 362, 166, 32)); PlayButton.Selected += new EventHandler(PlayButton_Selected); StringTable = ResourceManager.CreateAsset <StringTable>("Chargen"); StringTable.LanguageName = Game.LanguageName; Anims = ResourceManager.CreateAsset <Animation>("Animations"); Anims.Play(); CurrentState = CharGenStates.SelectHero; // Load name list using (Stream stream = ResourceManager.Load("names.xml")) { if (stream != null) { XmlReader xr = XmlReader.Create(stream); Names = XDocument.Load(xr); } } }
/// <summary> /// Constructor /// </summary> public GameOptionsWindow(CampDialog camp) : base(camp, "Game Options:") { ScreenButton button; button = new ScreenButton("Load Game", new Rectangle(16, 40, 320, 28)); button.Selected += new EventHandler(Load_Selected); Buttons.Add(button); button = new ScreenButton("Save Game", new Rectangle(16, 74, 320, 28)); button.Selected += new EventHandler(Save_Selected); Buttons.Add(button); button = new ScreenButton("Drop Character", new Rectangle(16, 108, 320, 28)); button.Selected += new EventHandler(DropHero_Selected); Buttons.Add(button); button = new ScreenButton("Quit Game", new Rectangle(16, 142, 320, 28)); button.Selected += new EventHandler(Quit_Selected); Buttons.Add(button); button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28)); button.Selected += new EventHandler(Exit_Selected); Buttons.Add(button); }
/// <summary> /// Constructor /// </summary> public SpellWindow(CampDialog camp) : base(camp, "") { Interface = ResourceManager.LockSharedAsset <TileSet>("Interface"); // Adds buttons ScreenButton button; button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28)); button.Selected += new EventHandler(Exit_Selected); Buttons.Add(button); Levels = new ScreenButton[6]; for (int i = 0; i < 6; i++) { Levels[i] = new ScreenButton((i + 1).ToString(), new Rectangle(22 + i * 54, 32, 40, 36)); Levels[i].Selected += new EventHandler(Level_Selected); Levels[i].ReactOnMouseOver = false; Levels[i].IsVisible = false; Buttons.Add(Levels[i]); } RectangleColor = Color.White; }