Example #1
0
        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);
        }
Example #2
0
        public LoadAndSaveMenu(bool a_willSave, States a_backState)
        {
            m_willSave = a_willSave;
            m_backState = a_backState;
            m_newSaveName = new TextField(new Vector2(400, 100), 200, 32, true, true, true, 20);
            m_newSaveName.setVisible(false);

            TextButton t_slot1 = new TextButton(new Vector2(450, 350), "Slot 1", "MotorwerkLarge", m_normal, m_hover, m_pressed, m_toggle);
            m_buttons.AddLast(t_slot1);
            TextButton t_slot2 = new TextButton(new Vector2(500, 410), "Slot 2", "MotorwerkLarge", m_normal, m_hover, m_pressed, m_toggle);
            m_buttons.AddLast(t_slot2);
            TextButton t_slot3 = new TextButton(new Vector2(550, 470), "Slot 3", "MotorwerkLarge", m_normal, m_hover, m_pressed, m_toggle);
            m_buttons.AddLast(t_slot3);

            updateSaveText();

            foreach (TextButton f_b in m_buttons)
            {
                if (m_willSave)
                {
                    f_b.m_clickEvent += new TextButton.clickDelegate(saveProgressClick);
                }
                else
                {
                    f_b.m_clickEvent += new TextButton.clickDelegate(loadProgressClick);
                }
            }

            m_backButton = new TextButton(new Vector2(20, Game.getInstance().getResolution().Y - 120), "Back", "MotorwerkLarge", m_normal, m_hover, m_pressed, m_toggle);
            m_buttons.AddLast(m_backButton);
            m_backButton.m_clickEvent += new TextButton.clickDelegate(backTo);
        }
Example #3
0
        public void addChaseTrigger(Button a_care)
        {
            if (m_state == State.newTrigger)
            {
                m_state = State.newChase;

                TextField t_textField = new TextField(new Vector2(300, 200), 200, 100, true, true, true, 0);

                t_textField.setWrite(true);
                t_textField.setText("write bool");

                m_guiList.AddFirst(t_textField);
            }
        }
Example #4
0
        public void addEquip(Button a_care)
        {
            if (m_selectedEvent != null && m_state == State.newEffect)
            {
                m_state = State.newEquip;

                TextField t_textField = new TextField(new Vector2(300, 200), 200, 100, true, true, true, 0);

                t_textField.setWrite(true);
                t_textField.setText("write name(string):equip(bool)");

                m_guiList.AddFirst(t_textField);
            }
        }
Example #5
0
        public void addCutscene(Button a_care)
        {
            if (m_selectedEvent != null && m_state == State.newEffect)
            {
                m_state = State.newCutscene;

                TextField t_textField = new TextField(new Vector2(300, 200), 200, 100, true, true, true, 0);

                t_textField.setWrite(true);
                t_textField.setText("write the filename of the cutscene");

                m_guiList.AddFirst(t_textField);
            }
        }
Example #6
0
 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;
         }
     }
 }
Example #7
0
 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;
     }
 }
Example #8
0
        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];
        }
Example #9
0
        public override void load()
        {
            base.load();
            Game.getInstance().m_camera.setPosition(Vector2.Zero);
            Vector2 t_textOffset = new Vector2(5, 2);
            m_triggerButtons = new LinkedList<Button>();
            m_effectButtons = new LinkedList<Button>();
            m_triggerMenu = new LinkedList<TextButton>();
            m_effectMenu = new LinkedList<TextButton>();
            m_recLines = new Line[4];
            m_textField = null;
            m_background = new Box(Vector2.Zero, 400, Game.getInstance().getResolution().Y, Color.Gray, false);

            m_btnAddEvent = new Button("btn_asset_list", new Vector2(0, (m_events.Keys.Count * 25)), "Add Event", "VerdanaBold", Color.Black, t_textOffset);
            m_btnAddEvent.m_clickEvent += new Button.clickDelegate(newEvent);

            m_btnAddTrigger = new Button("btn_asset_list", Vector2.Zero, "Add Trigger", "VerdanaBold", Color.Black, t_textOffset);
            m_btnAddTrigger.m_clickEvent += new Button.clickDelegate(newTrigger);

            m_btnAddEffect = new Button("btn_asset_list", Vector2.Zero, "Add Effect", "VerdanaBold", Color.Black, t_textOffset);
            m_btnAddEffect.m_clickEvent += new Button.clickDelegate(newEffect);

            m_triggerMenu.AddLast(new TextButton(new Vector2(400, 555), "Rectangle", "MotorwerkNormal"));
            m_triggerMenu.Last().m_clickEvent += new TextButton.clickDelegate(addRectangle);

            m_triggerMenu.AddLast(new TextButton(new Vector2(400, 580), "Circle (NYI)", "MotorwerkNormal"));
            m_triggerMenu.Last().m_clickEvent += new TextButton.clickDelegate(addCircle);

            m_triggerMenu.AddLast(new TextButton(new Vector2(400, 605), "Switch/Button", "MotorwerkNormal"));
            m_triggerMenu.Last().m_clickEvent += new TextButton.clickDelegate(addSwitch);

            m_triggerMenu.AddLast(new TextButton(new Vector2(400, 630), "Chase check", "MotorwerkNormal"));
            m_triggerMenu.Last().m_clickEvent += new TextButton.clickDelegate(addChase);

            m_triggerMenu.AddLast(new TextButton(new Vector2(400, 655), "IsDeadTrigger", "MotorwerkNormal"));
            m_triggerMenu.Last().m_clickEvent += new TextButton.clickDelegate(addIsDead);

            m_effectMenu.AddLast(new TextButton(new Vector2(400, 580), "Cutscene", "MotorwerkNormal"));
            m_effectMenu.Last().m_clickEvent += new TextButton.clickDelegate(addCutscene);

            m_effectMenu.AddLast(new TextButton(new Vector2(400, 605), "Equip", "MotorwerkNormal"));
            m_effectMenu.Last().m_clickEvent += new TextButton.clickDelegate(addEquip);

            m_effectMenu.AddLast(new TextButton(new Vector2(400, 630), "Door", "MotorwerkNormal"));
            m_effectMenu.Last().m_clickEvent += new TextButton.clickDelegate(addDoorEffect);

            m_deleteEvent = new Button("DevelopmentHotkeys//btn_delete_hotkey", new Vector2(250, 0));
            m_deleteEvent.m_clickEvent += new Button.clickDelegate(deleteEvent);

            m_exitEvent = new TextButton(new Vector2(20, Game.getInstance().getResolution().Y - 100), "Exit", "MotorwerkLarge");
            ((TextButton)m_exitEvent).m_clickEvent += new TextButton.clickDelegate(exitState);

            m_deleteTriggerEffect = new Button("btn_small_delete", Vector2.Zero);
            m_deleteTriggerEffect.m_clickEvent += new Button.clickDelegate(deleteTriggerEffect);
        }
Example #10
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();
        }
Example #11
0
        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++;
            }
        }
Example #12
0
        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);
            }
        }