public void selectSwitchTrigger(Button a_button) { if (m_state == State.newSwitch || m_state == State.selectSwitch) { m_state = State.selectSwitch; if (m_switchTriggerType != null) { m_switchTriggerType.setState(0); } m_switchTriggerType = a_button; m_switchTriggerType.setState(3); } }
public void selectEffTri(Button a_button) { if (m_state == State.neutral) { if (m_selectedEffTri != null) { m_selectedEffTri.setState(0); } m_selectedEffTri = a_button; if (m_selectedEffTri != null) { m_selectedEffTri.setState(3); if (m_triggers.ContainsKey(m_selectedEffTri) && m_triggers[m_selectedEffTri] is PlayerIsWithinRectangle) { m_recLines = ((PlayerIsWithinRectangle)(m_triggers[m_selectedEffTri])).getRectangle(m_recLines); } } } }
public void selectEvent(Button a_button) { if (a_button != m_selectedEvent && m_state == State.neutral) { if (m_selectedEvent != null) { m_selectedEvent.setState(0); foreach (Button t_b in m_effects.Keys) { m_buttonList.Remove(t_b); } m_effects.Clear(); foreach (Button t_b in m_triggers.Keys) { m_buttonList.Remove(t_b); } m_triggers.Clear(); m_selectedEffTri = null; } m_selectedEvent = a_button; if (a_button != null) { a_button.setState(3); LinkedList<EventEffect> t_effects = m_events[m_selectedEvent].getEffects(); LinkedList<EventTrigger> t_triggers = m_events[m_selectedEvent].getTriggers(); foreach (EventEffect t_ee in t_effects) { Button t_buttonToAdd; t_buttonToAdd = new Button("btn_asset_list", new Vector2(900, 100 + ((m_effects.Count) * 30)), t_ee.ToString(), null, Color.Yellow, new Vector2(10, 2)); t_buttonToAdd.m_clickEvent += new Button.clickDelegate(selectEffTri); m_buttonsToAdd.Push(t_buttonToAdd); m_effects.Add(t_buttonToAdd, t_ee); } foreach (EventTrigger t_et in t_triggers) { Button t_buttonToAdd; t_buttonToAdd = new Button("btn_asset_list", new Vector2(700, 100 + ((m_triggers.Count) * 30)), t_et.ToString(), null, Color.Yellow, new Vector2(10, 2)); t_buttonToAdd.m_clickEvent += new Button.clickDelegate(selectEffTri); m_buttonsToAdd.Push(t_buttonToAdd); m_triggers.Add(t_buttonToAdd, t_et); } } } }
private void newEffect(Button a_button) { m_btnAddTrigger.setState(Button.State.Normal); a_button.setState(Button.State.Toggled); }
private void selectEffectTrigger(Button a_button) { if (m_selectedTriggerEffect != null) { m_selectedTriggerEffect.setState(0); } m_selectedTriggerEffect = a_button; m_selectedTriggerEffect.setState(3); }
public void newTrigger(Button a_button) { m_btnAddEffect.setState(Button.State.Normal); a_button.setState(Button.State.Toggled); }
public void selectEvent(Button a_button) { foreach (Button t_button in m_events.Keys) { t_button.setState(Button.State.Normal); } a_button.setState(3); m_triggerButtons = new LinkedList<Button>(); m_effectButtons = new LinkedList<Button>(); m_selectedEvent = a_button; m_selectedEvent.setPosition(Vector2.Zero); foreach (EventTrigger t_trigger in m_events[a_button].getTriggers()) { m_triggerButtons.AddLast(new Button("btn_asset_list", new Vector2(m_btnAddTrigger.getBox().X, 40 + (m_triggerButtons.Count * 25)), t_trigger.ToString(), "VerdanaBold", Color.Yellow, new Vector2(10, 2))); m_triggerButtons.Last().m_clickEvent += new Button.clickDelegate(selectEffectTrigger); if (t_trigger is PlayerIsWithinRectangle) { m_recLines = ((PlayerIsWithinRectangle)t_trigger).getRectangle(); } } foreach (EventEffect t_effect in m_events[a_button].getEffects()) { m_effectButtons.AddLast(new Button("btn_asset_list", new Vector2(m_btnAddTrigger.getBox().X + m_btnAddEffect.getBox().Width + 40, 40 + (m_effectButtons.Count * 25)), t_effect.ToString(), "VerdanaBold", Color.Yellow, new Vector2(10, 2))); m_effectButtons.Last().m_clickEvent += new Button.clickDelegate(selectEffectTrigger); } if (m_triggerButtons.Count() > 0) { m_btnAddTrigger.setPosition(new Vector2(m_triggerButtons.Last().getBox().X, m_triggerButtons.Last().getBox().Y + 25)); } else { m_btnAddTrigger.setPosition(new Vector2(0, 40)); } if (m_effectButtons.Count() > 0) { m_btnAddEffect.setPosition(new Vector2(m_effectButtons.Last().getBox().X, m_effectButtons.Last().getBox().Y + 25)); } else { m_btnAddEffect.setPosition(new Vector2(m_btnAddTrigger.getBox().Width + 25, 40)); } }
private void setBuildingState(Button a_button, State a_state) { m_building = true; m_objectPreview = null; if (a_state != m_itemToCreate) { clearSelectedObject(); m_itemToCreate = a_state; } foreach (Button t_button in m_buttonDict.Keys) { t_button.setState(0); } a_button.setState(3); switch (m_itemToCreate) { case State.Platform: createAssetList("Content//Images//Tile//Floor//"); break; case State.Ladder: createAssetList("Content//Images//Tile//Ladder//"); break; case State.Background: createAssetList("Content//Images//Background//"); break; case State.Delete: createAssetList(null); m_building = false; break; case State.Player: createAssetList(null); break; case State.None: createAssetList(null); m_building = false; break; case State.SpotLight: createAssetList("Content//Images//LightCone//"); break; case State.Guard: createAssetList(null); break; case State.Wall: createAssetList("Content//Images//Tile//Wall//"); break; case State.DuckHidingObject: createAssetList("Content//Images//Prop//DuckHide//"); break; case State.StandHidingObject: createAssetList("Content//Images//Prop//StandHide//"); break; case State.GuardDog: createAssetList("Content//Images//Sprite//GuardDog//"); break; case State.LightSwitch: createAssetList("Content//Images//Prop//Button//"); break; case State.CrossVent: createAssetList("Content//Images//Tile//Ventilation//Cross//"); break; case State.CornerVent: createAssetList("Content//Images//Tile//Ventilation//Corner//"); break; case State.TVent: createAssetList("Content//Images//Tile//Ventilation//TVent//"); break; case State.StraVent: createAssetList("Content//Images//Tile//Ventilation//Straight//"); break; case State.Ventrance: createAssetList("Content//Images//Tile//Ventilation//Drum//"); break; case State.EndVent: createAssetList("Content//Images//Tile//Ventilation//EndVent//"); break; case State.Camera: createAssetList("Content//Images//Sprite//Camera//"); break; case State.Window: createAssetList("Content//Images//Tile//Window//"); break; case State.Foreground: createAssetList("Content//Images//Foregrounds//"); break; case State.Rope: createAssetList(null); break; case State.CornerHang: createAssetList(null); break; case State.Checkpoint: createAssetList(null); break; case State.Prop: createAssetList("Content//Images//Prop//Clutter//"); break; case State.Key: createAssetList(null); break; case State.Heart: createAssetList(null); break; case State.Objective: createAssetList("Content//Images//Prop//Consumables//Objective//"); break; case State.Shadow: createAssetList("Content//Images//Foregrounds//Shadow//"); break; case State.Parallax: createAssetList("Content//Images//Background//Parallax//"); break; case State.LockedDoor: createAssetList(null); break; case State.FlickeringSign: createAssetList("Content//Images//Tile//Sign//"); break; case State.Consumable: createAssetList("Content//Images//Prop//Consumables//"); break; } if (m_assetButtonList != null && m_assetButtonList.Count > 0) { selectAsset(m_assetButtonList.First()); } else { selectAsset(null); } }
private void setLayer(Button a_button) { foreach (Button t_button in m_layerButtonList) { t_button.setState(Button.State.Normal); } m_currentLayer = int.Parse(a_button.getText()) - 1; a_button.setState(Button.State.Toggled); }
private void selectAsset(Button a_button) { string t_newAsset = ""; Vector2 t_assetPosition = m_worldMouse + new Vector2(-36, -36); if (a_button != null) { t_newAsset = a_button.getText(); foreach (Button t_button in m_assetButtonList) { t_button.setState(0); } a_button.setState(3); } switch (m_itemToCreate) { case State.Platform: m_objectPreview = new Platform(t_assetPosition, "Images//Tile//Floor//" + t_newAsset, 0.000f); break; case State.Wall: m_objectPreview = new Wall(t_assetPosition, "Images//Tile//Wall//" + t_newAsset, 0.000f); break; case State.Delete: m_objectPreview = null; break; case State.Guard: m_objectPreview = new Guard(t_assetPosition, "Images//Sprite//Guard//guard_idle", m_worldMouse.X, true, 0.000f); break; case State.Ladder: m_objectPreview = new Ladder(t_assetPosition, "Images//Tile//Ladder//" + t_newAsset, 0.000f); break; case State.None: m_objectPreview = null; break; case State.Player: m_objectPreview = new Player(t_assetPosition, "Images//Sprite//Hero//hero_stand", 0.000f); break; case State.SpotLight: m_objectPreview = new SpotLight(t_assetPosition, "Images//LightCone//" + t_newAsset, 0.000f, 0.0f, false); break; case State.Background: m_objectPreview = new Environment(t_assetPosition, "Images//Background//" + t_newAsset, 0.000f); break; case State.DuckHidingObject: m_objectPreview = new DuckHideObject(t_assetPosition, "Images//Prop//DuckHide//" + t_newAsset, 0.000f); break; case State.StandHidingObject: m_objectPreview = new StandHideObject(t_assetPosition, "Images//Prop//StandHide//" + t_newAsset, 0.000f); break; case State.GuardDog: m_objectPreview = new GuardDog(t_assetPosition, "Images//Sprite//GuardDog//" + t_newAsset, m_worldMouse.X, m_worldMouse.X, 0.000f); break; case State.LightSwitch: m_objectPreview = new LampSwitch(t_assetPosition, "Images//Prop//Button//" + t_newAsset, 0.000f); break; case State.CrossVent: m_objectPreview = new CrossVentilation(t_assetPosition, "Images//Tile//Ventilation//Cross//" + t_newAsset, 0.000f); break; case State.CornerVent: m_objectPreview = new CornerVentilation(t_assetPosition, "Images//Tile//Ventilation//Corner//" + t_newAsset, 0.000f); break; case State.StraVent: m_objectPreview = new StraightVentilation(t_assetPosition, "Images//Tile//Ventilation//Straight//" + t_newAsset, 0.000f); break; case State.TVent: m_objectPreview = new TVentilation(t_assetPosition, "Images//Tile//Ventilation//TVent//" + t_newAsset, 0.000f); break; case State.Ventrance: m_objectPreview = new VentilationDrum(t_assetPosition, "Images//Tile//Ventilation//Drum//" + t_newAsset, 0.000f); break; case State.Window: m_objectPreview = new Window(t_assetPosition, "Images//Tile//Window//" + t_newAsset, 0.000f); break; case State.Foreground: m_objectPreview = new Foreground(t_assetPosition, "Images//Foregrounds//" + t_newAsset, 0.000f); break; case State.CornerHang: m_objectPreview = new CornerHang(t_assetPosition, "Images//Automagi//cornerthingy", 0.000f); break; case State.Checkpoint: m_objectPreview = new CheckPoint(t_assetPosition, "Images//Prop//Clutter//backdrop_door", 0.000f); break; case State.Camera: m_objectPreview = new GuardCamera(t_assetPosition, "Images//Sprite//Camera//camera", 0.200f, (float)(Math.PI * 0.5), (float)(Math.PI * 0.75), (float)(Math.PI * 0.25), false); break; case State.Prop: m_objectPreview = new Environment(t_assetPosition, "Images//Prop//Clutter//" + t_newAsset, 0.000f); break; case State.Rope: m_objectPreview = new Rope(t_assetPosition, "", 0.000f); break; case State.Heart: m_objectPreview = new ConsumableHeart(t_assetPosition, "Images//Prop//Consumables//shinyheart", 0.000f); break; case State.Key: m_objectPreview = new ConsumableKey(t_assetPosition, "Images//Automagi//derp_key", 0.000f); break; case State.Objective: m_objectPreview = new ConsumableGoal(t_assetPosition, "Images//Prop//Consumables//Objective//" + t_newAsset, 0.000f); break; case State.Shadow: m_objectPreview = new CoveringShadow(t_assetPosition, "Images//Foregrounds//Shadow//" + t_newAsset, 0.000f); break; case State.EndVent: m_objectPreview = new VentilationEnd(t_assetPosition, "Images//Tile//Ventilation//EndVent//" + t_newAsset, 0.000f); break; case State.Parallax: m_objectPreview = new ParallaxEnvironment(t_assetPosition, "Images//Background//Parallax//" + t_newAsset, 0.000f); break; case State.LockedDoor: m_objectPreview = new LockedDoor(t_assetPosition, "Images//Prop//SecurityDoor//door", 0.000f); break; case State.FlickeringSign: m_objectPreview = new FlickeringSign(t_assetPosition, "Images//Tile//Sign//" + t_newAsset, 0.000f); break; case State.Consumable: m_objectPreview = new Consumable(t_assetPosition, "Images//Prop//Consumables//" + t_newAsset, 0.000f); break; } }
private void toggleLevel(Button a_button) { foreach (Button t_button in m_buttons) { t_button.setState(Button.State.Normal); } a_button.setState(Button.State.Toggled); chosenLevel = a_button; }
private void toggleButton(Button a_button) { if (a_button.getState() == Button.State.Toggled) { a_button.setState(Button.State.Normal); } else { a_button.setState(Button.State.Toggled); } if (a_button == m_btnFullscreen) { m_settingsFile["Fullscreen"] = (m_btnFullscreen.getState() == Button.State.Toggled).ToString().ToLower(); } else if (a_button == m_btnAntialias) { m_settingsFile["Antialias"] = (m_btnAntialias.getState() == Button.State.Toggled).ToString().ToLower(); } else if (a_button == m_btnVSync) { m_settingsFile["VSync"] = (m_btnVSync.getState() == Button.State.Toggled).ToString().ToLower(); } }
private void lockButtons(Button a_button) { GuiListFactory.setSelection(m_keyList, Button.State.Pressed); if (a_button != null) { a_button.setState(Button.State.Toggled); } }
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); } }