getBox() public method

public getBox ( ) : Rectangle
return Microsoft.Xna.Framework.Rectangle
コード例 #1
0
ファイル: DevelopmentState.cs プロジェクト: theKyuu/GLhf
        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();
        }