public override void load() { base.load(); m_levelText = new Text(new Vector2(405, 80), "New Level:", "VerdanaBold", Color.White, false); m_newLevelName = new TextField(new Vector2(400, 100), 200, 32, true, true, true, 20); string[] t_ext = { ".lvl" }; if (!Directory.Exists("Content//levels//CustomLevels//")) { System.IO.Directory.CreateDirectory("Content//levels//CustomLevels//"); } string[] t_fileList = Directory.GetFiles("Content//levels//CustomLevels//"); m_buttons = GuiListFactory.createListFromStringArray(t_fileList, t_ext, "btn_test_empty"); GuiListFactory.setListPosition(m_buttons, new Vector2(25, 25)); GuiListFactory.setTextOffset(m_buttons, new Vector2(10, 10)); GuiListFactory.setButtonDistance(m_buttons, new Vector2(0, 60)); foreach (Button t_button in m_buttons) { t_button.m_clickEvent += new Button.clickDelegate(toggleLevel); } m_buttons.AddLast(m_btnTFAccept = new Button("btn_textfield_accept", new Vector2(600, 100))); m_btnTFAccept.m_clickEvent += new Button.clickDelegate(createNewLevel); m_btnPlay = new TextButton(new Vector2(500, 200), "Start Level", "MotorwerkLarge", m_normal, m_hover, m_pressed, Color.Red); m_btnDevelop = new TextButton(new Vector2(500, 260), "Edit Level", "MotorwerkLarge", m_normal, m_hover, m_pressed, Color.Red); m_btnExit = new TextButton(new Vector2(20, Game.getInstance().getResolution().Y - 120), "Exit", "MotorwerkLarge"); m_btnPlay.m_clickEvent += new TextButton.clickDelegate(startLevelClick); m_btnDevelop.m_clickEvent += new TextButton.clickDelegate(editLevelClick); m_btnExit.m_clickEvent += new TextButton.clickDelegate(exitClick); }
public TextButton(Vector2 a_position, string a_text, string a_font, Color a_normal, Color a_hover, Color a_pressed, Color a_toggle) : base(a_position) { m_text = new Text(a_position, a_text, a_font, a_normal, false); m_normalColor = a_normal; m_hoverColor = a_hover; m_pressedColor = a_pressed; m_toggleColor = a_toggle; m_isVisible = true; m_bounds = m_text.getBox(); setPosition(a_position); }
public TextButton(Vector2 a_position, string a_text, string a_font) : base(a_position) { m_normalColor = new Color(187, 194, 195); m_hoverColor = new Color(255, 255, 255); m_pressedColor = new Color(132, 137, 138); m_toggleColor = new Color(0, 0, 255); m_text = new Text(a_position, a_text, a_font, m_normalColor, false); m_isVisible = true; m_bounds = m_text.getBox(); setPosition(a_position); }
public TextField(Vector2 a_position, int a_width, int a_height, bool a_acceptLetters, bool a_acceptNumbers, bool a_acceptSpecials, int a_maxLength) : base(a_position, "") { m_textToShow = new Text(a_position, new Vector2(4, 2), "", "VerdanaBold", Color.Black, false); m_box = new Box(a_position, a_width, a_height, Color.White, Color.Black, 2, false); m_caret = new Line(m_box.getPosition(), m_box.getPosition(), new Vector2(5, 3), new Vector2(5, a_height - 3), Color.Black, 1, true); m_writing = false; m_acceptLetters = a_acceptLetters; m_acceptNumbers = a_acceptNumbers; m_acceptSpecials = a_acceptSpecials; m_maxLength = a_maxLength; m_currentLocale = "euSv"; m_posV2 = a_position; }
public Button(string a_buttonTexture, Vector2 a_position, string a_buttonText, string a_font, Color a_color, Vector2 a_offset) { if (a_font == null) { a_font = "Courier New"; } m_text = new Text(a_position, a_offset, a_buttonText, a_font, a_color, false); m_position = new CartesianCoordinate(a_position, Game.getInstance().m_camera.getPosition()); setPosition(a_position); m_bounds = new Rectangle((int)a_position.X, (int)a_position.Y, 0, 0); m_layer = 0.002f; m_upSound = null; m_downSound = null; m_buttonTexture = a_buttonTexture; loadContent(); }
public Button(string a_normal, string a_hover, string a_pressed, string a_toggle, Vector2 a_position, string a_buttonText, string a_font, Color a_color, Vector2 a_offset) { setNormalTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_normal)); setHoverTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_hover)); setPressedTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_pressed)); setToggleTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_toggle)); if (a_font == null) { a_font = "Courier New"; } m_text = new Text(a_position, a_offset, a_buttonText, a_font, a_color, false); m_position = new CartesianCoordinate(a_position); m_position.setParentPosition(Game.getInstance().m_camera.getPosition()); setPosition(a_position); m_bounds = new Rectangle((int)a_position.X, (int)a_position.Y, (int)m_size.X, (int)m_size.Y); m_layer = 0.002f; m_upSound = null; m_downSound = null; }
public override void load() { base.load(); string[] t_loadedFile = File.ReadAllLines("Content//wtf//settings.ini"); foreach (string t_currentLine in t_loadedFile) { if (t_currentLine.Length > 2 && t_currentLine.First() == '[' && t_currentLine.Last() == ']') { if (t_currentLine.Equals("[Graphics]")) { m_currentParse = ParseState.Settings; } } switch (m_currentParse) { case ParseState.Settings: string[] t_setting = t_currentLine.Split('='); if (t_setting[0].Equals("ScreenWidth")) { Game.getInstance().m_graphics.PreferredBackBufferWidth = int.Parse(t_setting[1]); } else if (t_setting[0].Equals("ScreenHeight")) { Game.getInstance().m_graphics.PreferredBackBufferHeight = int.Parse(t_setting[1]); Game.getInstance().m_camera.setZoom(Game.getInstance().getResolution().Y / 720); } else if (t_setting[0].Equals("Fullscreen")) { Game.getInstance().m_graphics.IsFullScreen = bool.Parse(t_setting[1]); } break; } Game.getInstance().m_graphics.ApplyChanges(); } m_levelText = new Text(new Vector2(405, 80), "New Level:", "VerdanaBold", Color.White, false); m_newLevelName = new TextField(new Vector2(400, 100), 200, 32, true, true, true, 20); m_buttons.Add(m_btnTFAccept = new Button("btn_textfield_accept", new Vector2(600, 100))); m_btnTFAccept.m_clickEvent += new Button.clickDelegate(createNewLevel); try { m_levelList = Directory.GetFiles("Content//levels//"); } catch (DirectoryNotFoundException) { System.IO.Directory.CreateDirectory("Content//levels//"); return; } int t_count = 0; foreach (string t_level in m_levelList) { string[] t_splitPath = Regex.Split(t_level, "/"); Button t_levelButton = new Button("btn_test_empty", "btn_test_empty", "btn_test_empty", "btn_test_empty", new Vector2(20, 60 * t_count + 20), t_splitPath[t_splitPath.Length - 1], "VerdanaBold", Color.Black, new Vector2(10, 10)); t_levelButton.m_clickEvent += new Button.clickDelegate(startLevelClick); m_buttons.Add(t_levelButton); t_count++; } }
private void testGraphics(Button a_button) { applyGraphics(); if (m_countDown == null) { createDialog("Apply Settings?"); m_countDown = new Text(Game.getInstance().getResolution() / 2, "", "MotorwerkLarge", m_normal, false); m_countDown.move(new Vector2(-(m_countDown.getBox().Width / 2) - 30, -75)); m_timeOut = Game.getInstance().getTotalGameTime() + new TimeSpan(0, 0, 10); } createButtons(); }
private void toggleTextField(string a_titleText) { if (m_textField == null) { m_textField = new TextField(new Vector2(Game.getInstance().getResolution().X / 2 - 100, 200), 200, 25, true, true, true, 0); m_textFieldInfo = new Text(new Vector2(Game.getInstance().getResolution().X / 2 - m_textField.getSize().X / 2, 175), a_titleText, "VerdanaBold", Color.White, false); } else { m_textField = null; m_textFieldInfo = null; } }
private void createDialog(string a_text) { Vector2 t_halfRes = Game.getInstance().getResolution() / 2; m_inputFeedback = new Text(t_halfRes, a_text, "VerdanaBold", m_normal, false); m_inputFeedback.move(new Vector2(-(m_inputFeedback.getBox().Width / 2), -100)); m_buttons.AddLast(m_btnYes = new TextButton(new Vector2(t_halfRes.X - 175, t_halfRes.Y), "YES", "MotorwerkLarge", m_normal, m_hover, m_pressed, Color.Red)); m_buttons.AddLast(m_btnNo = new TextButton(new Vector2(t_halfRes.X + 65, t_halfRes.Y), "NO", "MotorwerkLarge", m_normal, m_hover, m_pressed, Color.Red)); m_btnYes.m_clickEvent += new TextButton.clickDelegate(buttonYes); m_btnNo.m_clickEvent += new TextButton.clickDelegate(buttonNo); m_dialogBackground = new Box(new Vector2(t_halfRes.X - 200, t_halfRes.Y - 125), 400, 220, Color.Gray, true); }
private void createButtons() { int i = 0; m_guiList = new LinkedList<GuiObject>(); m_keyList = new LinkedList<Button>(); Vector2 t_textOffset = new Vector2(40, 10); string[] t_currentBindings = Loader.getInstance().getSettingsBlock("Input", m_settingsPath); foreach (string t_string in t_currentBindings) { string[] t_settingString = t_string.Split('='); m_guiList.AddLast(new Text(new Vector2(400, 300 + (40 * i)), t_settingString[0], "VerdanaBold", Color.White, false)); m_keyList.AddLast(new Button(null, new Vector2(450, 300 + (40 * i++)), t_settingString[1], "VerdanaBold", Color.White, t_textOffset)); } foreach (Button t_button in m_keyList) { t_button.m_clickEvent += new Button.clickDelegate(awaitInput); } m_guiList.AddLast(m_soundLabel = new Text(new Vector2(500, 150), "Sound", "VerdanaBold", m_normal, false)); m_guiList.AddLast(m_musicLabel = new Text(new Vector2(500, 200), "Music", "VerdanaBold", m_normal, false)); m_guiList.AddLast(m_soundTF = new TextField(new Vector2(600, 150), 100, 20, false, true, false, 3)); m_guiList.AddLast(m_musicTF = new TextField(new Vector2(600, 200), 100, 20, false, true, false, 3)); m_soundTF.setText(m_settingsFile["Sound"].ToString()); m_musicTF.setText(m_settingsFile["Music"].ToString()); m_guiList.AddLast(m_resolutionText = new Text(new Vector2(155, 160), m_resolutions[m_resolutionIndex], "VerdanaBold", Color.White, false)); m_resolutionText.setLayer(0.112f); m_keyList.AddLast(m_btnNextResolution = new Button(null, new Vector2(250, 150))); m_keyList.AddLast(m_btnPrevResolution = new Button(null, new Vector2(100, 150))); m_keyList.AddLast(m_btnFullscreen = new Button(null, new Vector2(100, 200), "Full Screen", "VerdanaBold", Color.White, new Vector2(50, 5))); m_keyList.AddLast(m_btnAntialias = new Button(null, new Vector2(100, 250), "Anti-Alias", "VerdanaBold", Color.White, new Vector2(50, 5))); m_keyList.AddLast(m_btnVSync = new Button(null, new Vector2(100, 300), "Vertical Sync", "VerdanaBold", Color.White, new Vector2(50, 5))); m_keyList.AddLast(m_btnApply = new Button("btn_asset_list", new Vector2(100, 350), "Apply", "VerdanaBold", Color.White, new Vector2(5, 3))); m_btnSave = new TextButton(Vector2.Zero, "Accept", "MotorwerkLarge", m_normal, m_hover, m_pressed, Color.Red); m_btnExit = new TextButton(Vector2.Zero, "Cancel", "MotorwerkLarge", m_normal, m_hover, m_pressed, Color.Red); m_btnSave.setPosition(new Vector2(15, Game.getInstance().getResolution().Y - 150)); m_btnExit.setPosition(new Vector2(15, Game.getInstance().getResolution().Y - 90)); m_btnNextResolution.m_clickEvent += new Button.clickDelegate(nextResolution); m_btnPrevResolution.m_clickEvent += new Button.clickDelegate(prevResolution); m_btnFullscreen.m_clickEvent += new Button.clickDelegate(toggleButton); m_btnAntialias.m_clickEvent += new Button.clickDelegate(toggleButton); m_btnVSync.m_clickEvent += new Button.clickDelegate(toggleButton); m_btnApply.m_clickEvent += new Button.clickDelegate(testGraphics); m_btnSave.m_clickEvent += new TextButton.clickDelegate(saveSettings); m_btnExit.m_clickEvent += new TextButton.clickDelegate(exitSettings); if (Game.getInstance().m_graphics.IsFullScreen) { m_btnFullscreen.setState(Button.State.Toggled); } if (Game.getInstance().m_graphics.PreferMultiSampling) { m_btnAntialias.setState(Button.State.Toggled); } if (Game.getInstance().m_graphics.SynchronizeWithVerticalRetrace) { m_btnVSync.setState(Button.State.Toggled); } foreach (Button t_button in m_keyList) { t_button.setLayer(0.112f); } }
private void buttonYes(Button a_button) { if (m_countDown != null) { m_countDown = null; removeDialog(); } else { exitSettings(m_btnExit); } }
private void awaitInput(Button a_button) { m_inputFeedback = new Text(new Vector2(Game.getInstance().getResolution().X / 2, 300), "Select input for: " + a_button.getText(), "VerdanaBold", Color.White, false); lockButtons(a_button); }
public override void update(GameTime a_gameTime) { base.update(a_gameTime); if (KeyboardHandler.keyClicked(Keys.Escape) && m_inputFeedback == null) { exitSettings(m_btnExit); } if (KeyboardHandler.keyClicked(Keys.Enter)) { if (m_soundTF.isWriting()) { m_settingsFile["Sound"] = m_soundTF.getText(); m_soundTF.setWrite(false); } else if (m_musicTF.isWriting()) { m_settingsFile["Music"] = m_musicTF.getText(); m_musicTF.setWrite(false); } } foreach (Button t_button in m_keyList) { t_button.update(); } m_btnSave.update(); m_btnExit.update(); if (m_dialogBackground != null) { m_dialogBackground.update(a_gameTime); } if (m_countDown != null) { if (Game.getInstance().getTotalGameTime() > m_timeOut) { resetGraphics(); removeDialog(); m_countDown = null; } else { string[] t_showString = (m_timeOut - Game.getInstance().getTotalGameTime()).ToString().Split(':'); m_countDown.setText(t_showString[2].Split('.')[0]); } } if (m_inputFeedback != null) { m_inputFeedback.update(a_gameTime); if (KeyboardHandler.getPressedKeys().Count() > 0) { setKeybinding(KeyboardHandler.getPressedKeys()[0]); } } }
public override void load() { if (File.Exists("Content\\levels\\" + m_levelToLoad)) { Level t_loadedLevel = Loader.getInstance().loadLevel(m_levelToLoad); m_gameObjectList = t_loadedLevel.getGameObjects(); m_events = t_loadedLevel.getEvents(); } else { m_events = new LinkedList<Event>(); for (int i = 0; i < m_gameObjectList.Length; ++i) { m_gameObjectList[i] = new LinkedList<GameObject>(); } } foreach (LinkedList<GameObject> t_ll in m_gameObjectList) { for (int i = 0; i < t_ll.Count(); i++) { t_ll.ElementAt(i).loadContent(); if (t_ll.ElementAt(i) is Player) { m_player = t_ll.ElementAt(i); Game.getInstance().m_camera.setPosition(m_player.getPosition().getGlobalCartesian()); } } } foreach (Event t_e in m_events) { t_e.loadContent(); } m_buttonDict = new Dictionary<Button, State>(); m_assetButtonList = new LinkedList<Button>(); m_lineList = new LinkedList<Line>(); m_objectPreview = null; m_guiList.AddLast(m_layerLabel = new Text(new Vector2(350, 3) , "", "VerdanaBold", Color.Black, false)); m_guiList.AddLast(m_parallaxLabel = new Text(new Vector2(460, 3) , "Parallax Value:", "VerdanaBold", Color.Black, false)); m_guiList.AddLast(m_textObjectInfo = new Text(new Vector2(10, 3) , "", "VerdanaBold", Color.Black, false)); m_guiList.AddLast(m_textGuardInfo = new Text(new Vector2(480, 3) , "", "VerdanaBold", Color.Black, false)); m_layerTextField = new TextField(new Vector2(400, 0), 50, 25, false, true, false, 3); m_parallaxScrollTF = new TextField(new Vector2(580, 0), 70, 25, false, true, false, 3); m_statusBar = new Box(new Vector2(0, 0), (int)Game.getInstance().getResolution().X, 25, Color.LightGray, false); m_statusBar.setLayer(0.111f); Vector2 t_btnTextOffset = new Vector2(21, 17); Vector2 t_modV2 = new Vector2(15, 0); Button t_button; //----------------------------------- #region Buttons that are always shown m_buttonDict.Add(m_btnSelect = new Button("DevelopmentHotkeys//btn_select_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "S", "VerdanaBold", Color.Black, t_btnTextOffset), State.None); m_btnSelect.setHotkey(new Keys[] { Keys.S }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_delete_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "D", "VerdanaBold", Color.Black, t_btnTextOffset), State.Delete); t_button.setHotkey(new Keys[] { Keys.D }, guiButtonClick); #endregion //----------------------------------- //----------------------------------- #region Building mode buttons m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_ladder_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "L", "VerdanaBold", Color.Black, t_btnTextOffset), State.Ladder); t_button.setHotkey(new Keys[] { Keys.L }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_platform_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "P", "VerdanaBold", Color.Black, t_btnTextOffset), State.Platform); t_button.setHotkey(new Keys[] { Keys.P }, guiButtonClick); m_buttonDict.Add(m_btnBackground = new Button("DevelopmentHotkeys//btn_background_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "B", "VerdanaBold", Color.Black, t_btnTextOffset), State.Background); m_btnBackground.setHotkey(new Keys[] { Keys.B }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_hero_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "H", "VerdanaBold", Color.Black, t_btnTextOffset), State.Player); t_button.setHotkey(new Keys[] { Keys.H }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_spotlight_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "T", "VerdanaBold", Color.Black, t_btnTextOffset), State.SpotLight); t_button.setHotkey(new Keys[] { Keys.T }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_wall_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "W", "VerdanaBold", Color.Black, t_btnTextOffset), State.Wall); t_button.setHotkey(new Keys[] { Keys.W }, guiButtonClick); m_buttonDict.Add(t_button= new Button("DevelopmentHotkeys//btn_lightswitch_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "s+T", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.LightSwitch); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.T }, guiButtonClick); m_buttonDict.Add(m_btnVent = new Button("DevelopmentHotkeys//btn_ventilation_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "V", "VerdanaBold", Color.Black, t_btnTextOffset), State.Ventrance); m_btnVent.setHotkey(new Keys[] { Keys.V }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_window_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "N", "VerdanaBold", Color.Black, t_btnTextOffset), State.Window); t_button.setHotkey(new Keys[] { Keys.N }, guiButtonClick); m_buttonDict.Add(m_btnGuard = new Button("DevelopmentHotkeys//btn_guard_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "G", "VerdanaBold", Color.Black, t_btnTextOffset), State.Guard); m_btnGuard.setHotkey(new Keys[] { Keys.G }, guiButtonClick); m_buttonDict.Add(m_btnDuckHide = new Button("DevelopmentHotkeys//btn_duckhide_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "A", "VerdanaBold", Color.Black, t_btnTextOffset), State.DuckHidingObject); m_btnDuckHide.setHotkey(new Keys[] { Keys.A }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_foreground_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "F", "VerdanaBold", Color.Black, t_btnTextOffset), State.Foreground); t_button.setHotkey(new Keys[] { Keys.F }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_rope_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "O", "VerdanaBold", Color.Black, t_btnTextOffset), State.Rope); t_button.setHotkey(new Keys[] { Keys.O }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_doorhang_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "s+W", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.CornerHang); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.W }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_checkpoint_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "K", "VerdanaBold", Color.Black, t_btnTextOffset), State.Checkpoint); t_button.setHotkey(new Keys[] { Keys.K }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_clutter_hotkey", new Vector2(0, 32 * m_buttonDict.Count() + 25), "C", "VerdanaBold", Color.Black, t_btnTextOffset), State.Prop); t_button.setHotkey(new Keys[] { Keys.C }, guiButtonClick); m_buttonDict.Add(m_btnConsKey = new Button(null, new Vector2(0, 32 * m_buttonDict.Count() + 25), "c+A", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.Consumable); m_btnConsKey.setHotkey(new Keys[] { Keys.LeftControl, Keys.A }, guiButtonClick); m_buttonDict.Add(t_button = new Button(null, new Vector2(0, 32 * m_buttonDict.Count() + 25), "s+D", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.LockedDoor); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.D }, guiButtonClick); m_buttonDict.Add(t_button = new Button(null, new Vector2(0, 32 * m_buttonDict.Count() + 25), "c+F", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.FlickeringSign); t_button.setHotkey(new Keys[] { Keys.LeftControl, Keys.F }, guiButtonClick); #endregion //----------------------------------- //----------------------------------- #region Ventilation buttons Vector2 t_ventMenu = new Vector2(m_btnVent.getBox().X + 32, m_btnVent.getBox().Y); int t_buttonNumber = 0; m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_tvent_hotkey", t_ventMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+V", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.TVent); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.V }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_svent_hotkey", t_ventMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+A", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.StraVent); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.A }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_cvent_hotkey", t_ventMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+C", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.CrossVent); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.C }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_ovent_hotkey", t_ventMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+R", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.CornerVent); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.R }, guiButtonClick); m_buttonDict.Add(t_button = new Button(null, t_ventMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+E", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.EndVent); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.E }, guiButtonClick); #endregion //----------------------------------- //----------------------------------- #region Hiding object buttons t_buttonNumber = 0; Vector2 t_hideMenu = new Vector2(m_btnDuckHide.getBox().X + 32, m_btnDuckHide.getBox().Y); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_standhide_hotkey", t_hideMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+F", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.StandHidingObject); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.F }, guiButtonClick); #endregion //----------------------------------- //----------------------------------- #region Guard object buttons t_buttonNumber = 0; Vector2 t_guardMenu = new Vector2(m_btnGuard.getBox().X + 32, m_btnGuard.getBox().Y); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_dog_hotkey", t_guardMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+G", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.GuardDog); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.G }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_camera_hotkey", t_guardMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+Q", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.Camera); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.Q }, guiButtonClick); #endregion //----------------------------------- //----------------------------------- #region Consumable Buttons t_buttonNumber = 0; Vector2 t_consMenu = new Vector2(m_btnConsKey.getBox().X + 32, m_btnConsKey.getBox().Y); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_key_hotkey", t_consMenu + new Vector2(t_buttonNumber++ * 32, 0), "Z", "VerdanaBold", Color.Black, t_btnTextOffset), State.Key); t_button.setHotkey(new Keys[] { Keys.Z }, guiButtonClick); m_buttonDict.Add(t_button = new Button("DevelopmentHotkeys//btn_heart_hotkey", t_consMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+H", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.Heart); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.H }, guiButtonClick); m_buttonDict.Add(t_button = new Button(null, t_consMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+B", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.Objective); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.B }, guiButtonClick); #endregion //----------------------------------- //----------------------------------- #region Background Buttons t_buttonNumber = 0; Vector2 t_bgMenu = new Vector2(m_btnBackground.getBox().X + 32, m_btnBackground.getBox().Y); m_buttonDict.Add(t_button = new Button(null, t_bgMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+X", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.Shadow); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.X }, guiButtonClick); m_buttonDict.Add(t_button = new Button(null, t_bgMenu + new Vector2(t_buttonNumber++ * 32, 0), "s+Z", "VerdanaBold", Color.Black, t_btnTextOffset - t_modV2), State.Parallax); t_button.setHotkey(new Keys[] { Keys.LeftShift, Keys.Z }, guiButtonClick); #endregion //----------------------------------- //----------------------------------- #region Layer buttons m_buttonList.AddLast(m_layerButtonList = GuiListFactory.createNumeratedList(5, "DevelopmentHotkeys//btn_layer_chooser")); GuiListFactory.setListPosition(m_layerButtonList, new Vector2(40, Game.getInstance().getResolution().Y - (m_layerButtonList.First().getBox().Height))); GuiListFactory.setButtonDistance(m_layerButtonList, new Vector2(73, 0)); GuiListFactory.setTextOffset(m_layerButtonList, new Vector2(34, 8)); int k = 1; foreach (Button t_feButton in m_layerButtonList) { t_feButton.setHotkey(new Keys[] { (Keys)Enum.Parse(typeof(Keys), "D" + k++) }, setLayer); } #endregion //----------------------------------- setBuildingState(m_btnSelect, State.None); base.load(); }
private void deselectEvent() { m_selectedEvent = null; if (m_events.Keys.Count > 0) { m_btnAddEvent.setPosition(new Vector2(m_events.Keys.Last().getBox().X, m_events.Keys.Last().getBox().Y) + new Vector2(0, 25)); } else { m_btnAddEvent.setPosition(Vector2.Zero); } m_textField = null; m_textFieldInfo = null; m_selectedTriggerEffect = null; m_btnAddEffect.setState(0); m_btnAddTrigger.setState(0); m_recLines = new Line[4]; }
private void removeDialog() { m_inputFeedback = null; m_buttons.Remove(m_btnYes); m_buttons.Remove(m_btnNo); m_btnYes = null; m_btnNo = null; m_dialogBackground = null; m_countDown = null; }
private void updateKeyboard() { if (KeyboardHandler.keyClicked(Keys.Enter)) { if (m_textField != null && m_textField.isWriting()) { switch (m_state) { case State.newEquip: m_events[m_selectedEvent].add(new EquipEffect(m_textField.getText(), true)); break; case State.newCutscene: if (File.Exists(Game.CUTSCENE_FOLDER + m_textField.getText() + ".csn")) { m_events[m_selectedEvent].add(new CutsceneEffect(m_textField.getText() + ".csn")); } else { m_textFieldInfo.setText("File doesn't exist!"); m_textFieldInfo.setColor(Color.Red); return; } break; case State.newDoorEffect: m_events[m_selectedEvent].add(new DoorOpenEffect(null, 1.0f, 1.0f)); break; } m_btnAddEffect.setState(0); selectEvent(m_selectedEvent); m_textField = null; m_textFieldInfo = null; m_state = State.neutral; } } }
private void setKeybinding(Keys k) { if (k == Keys.Escape) { m_inputFeedback = null; unlockButtons(); return; } for (int i = 0; i < m_keyList.Count(); i++) { if (m_keyList.ElementAt(i).getState() == Button.State.Toggled) { m_settingsFile[((Text)m_guiList.ElementAt(i)).getText()] = k.ToString(); m_inputFeedback = null; m_keyList.ElementAt(i).setText(k.ToString()); unlockButtons(); changedSettings(); break; } } }