예제 #1
0
파일: HubMenu.cs 프로젝트: theKyuu/GLhf
        public override void load()
        {
            base.load();
            m_bakimg = Game.getInstance().Content.Load<Texture2D>("Images//Automagi//karta");
            m_objects = new LinkedList<GameObject>();
            //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//"))
            {
                System.IO.Directory.CreateDirectory("Content//levels//");
            }
            string[] t_fileList = Directory.GetFiles("Content//levels//");

            m_buttons = GuiListFactory.createListFromStringArray(t_fileList, t_ext, "pin");
            m_buttons.ElementAt(0).setPosition(new Vector2(Game.getInstance().getResolution().X/3, Game.getInstance().getResolution().Y/1.9f));
            m_buttons.ElementAt(1).setPosition(new Vector2(Game.getInstance().getResolution().X / 1.8f, Game.getInstance().getResolution().Y / 2));
            //GuiListFactory.setListPosition(m_buttons, new Vector2(55, 55));
            GuiListFactory.setTextOffset(m_buttons, new Vector2(10, -20));
            //GuiListFactory.setButtonDistance(m_buttons, new Vector2(200, 30));

            LinkedList<string> t_levelLocked = getLockedLevels();

            foreach (Button t_button in m_buttons)
            {

                if (t_levelLocked.Contains(t_button.getText()))
                {
                    //t_button.setState(Button.State.Toggled);
                    t_button.setVisible(false);
                }
                if (Game.getInstance().getProgress().hasClearedLevel(t_button.getText()))
                {
                    Environment t_cricle = new Environment(t_button.getPosition().getGlobalCartesian(), "Images//GUI//cirkle", 0.5f);
                    t_cricle.getPosition().plusXWith(-t_cricle.getBox().Width/3);
                    m_objects.AddLast(t_cricle);
                }
                else
                {
                    t_button.m_clickEvent += new Button.clickDelegate(startLevelClick);
                }
            }

            //m_buttons.AddLast(m_btnTFAccept = new Button("btn_textfield_accept", new Vector2(600, 100)));
            //m_btnTFAccept.m_clickEvent += new Button.clickDelegate(createNewLevel);
            /*Button t_saveProgressButton = new Button("btn_asset_list_normal", "btn_asset_list_hover", "btn_asset_list_pressed", "btn_asset_list_toggle", new Vector2(500, 400), "Save Game", "VerdanaBold", Color.White, new Vector2(10, 0));
            t_saveProgressButton.m_clickEvent += new Button.clickDelegate(saveProgressClick);
            m_buttons.AddLast(t_saveProgressButton);*/
        }