コード例 #1
0
ファイル: ContextMenu.cs プロジェクト: XZelnar/MicroWorld
 public void Add(String text)
 {
     if (text != null)
     {
         EncyclopediaBrowserButton b = new EncyclopediaBrowserButton(0, 0, 0, 0, text);
         (b as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Elements/ComboBoxBg");
         b.IdleOpacity = 0.8f;
         b.foreground  = Color.White;
         b.Initialize();
         b.onClicked += new Button.ClickedEventHandler(ElementClicked);
         elements.Add(b);
     }
     else
     {
         EncyclopediaBrowserButton b = new EncyclopediaBrowserButton(0, 0, 0, 0, "---");
         (b as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Elements/ComboBoxBg");
         b.IdleOpacity = 0.8f;
         b.foreground  = Color.White;
         b.Initialize();
         b.isEnabled     = false;
         b.disabledColor = b.background;
         elements.Add(b);
     }
     updateSize();
     updatePosition();
 }
コード例 #2
0
 public void AddButton(String name, bool file)
 {
     float h = (Main.WindowHeight - folderup.position.Y - 48 - 38) / ELEMENTS_PER_PAGE;
     String txt = name.Substring(name.LastIndexOf("\\") + 1);
     if (file)
         txt = txt.Substring(0, txt.LastIndexOf("."));
     int x = curFolder == "Content\\Encyclopedia\\" ? 20 : 40;
     Button b = new EncyclopediaBrowserButton(x, (int)(buttons.Count * h + folderup.position.Y + 38),
         Main.WindowWidth / 2 - x, (int)(h - 10), "     " + txt);
     b.onClicked += new Button.ClickedEventHandler(b_onClicked);
     b.tag = new object[] { name, file };
     b.Initialize();
     b.textAlignment = Renderer.TextAlignment.Left;
     b.background = Color.Transparent;
     b.foreground = Color.White;
     buttons.Add(b);
     arefiles.Add(file);
     controls.Add(b);
 }
コード例 #3
0
        public override void Initialize()
        {
            Layer = 100000;

            article = new Encyclopedia.Article();
            article.position = new Vector2(10, 10);
            article.Size = new Vector2(Main.WindowWidth - 20, Main.WindowHeight - 50);

            goToLink = new EncyclopediaBrowserButton(Main.WindowWidth - 215, Main.WindowHeight - 25, 100, 20, "Go to link");
            (goToLink as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            goToLink.foreground = Color.White;
            goToLink.onClicked += new Button.ClickedEventHandler(goToLink_onClicked);
            controls.Add(goToLink);

            back = new EncyclopediaBrowserButton(Main.WindowWidth - 105, Main.WindowHeight - 25, 100, 20, "Back");
            (back as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            back.foreground = Color.White;
            back.onClicked += new Button.ClickedEventHandler(back_onClicked);
            controls.Add(back);

            base.Initialize();

            background = GUIEngine.s_mainMenu.background;
        }
コード例 #4
0
        public override void Initialize()
        {
            #region NececarryStuff
            article = new Encyclopedia.Article();
            article.position = new Vector2(10, 10);
            article.Size = new Vector2(Main.WindowWidth - 20, Main.WindowHeight - 110);

            loadhtml = new EncyclopediaBrowserButton(Main.WindowWidth - 325, Main.WindowHeight - 25, 100, 20, "View page");
            (loadhtml as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            loadhtml.foreground = Color.White;
            loadhtml.onClicked += new Button.ClickedEventHandler(loadhtml_onClicked);
            controls.Add(loadhtml);

            goToLink = new EncyclopediaBrowserButton(Main.WindowWidth - 215, Main.WindowHeight - 25, 100, 20, "Go to link");
            (goToLink as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            goToLink.foreground = Color.White;
            goToLink.onClicked += new Button.ClickedEventHandler(goToLink_onClicked);
            controls.Add(goToLink);

            exit = new EncyclopediaBrowserButton(Main.WindowWidth - 105, Main.WindowHeight - 25, 100, 20, "Exit");
            (exit as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            exit.foreground = Color.White;
            exit.onClicked += new Button.ClickedEventHandler(exit_onClicked);
            controls.Add(exit);

            Label l1 = new Label(11, Main.WindowHeight - 80, "File:");
            l1.foreground = Color.White;
            controls.Add(l1);

            tbFile = new TextBox(60, Main.WindowHeight - 80,
                Main.WindowWidth - 20 - 50, 18);
            tbFile.BackgroundColor = new Color(32, 32, 32, 192);
            tbFile.ForegroundColor = Color.White;
            tbFile.CursorColor = new Color(200, 200, 200);
            tbFile.Multiline = false;
            controls.Add(tbFile);

            Label l = new Label(11, Main.WindowHeight - 50, "Link:");
            l.foreground = Color.White;
            controls.Add(l);

            tbLink = new TextBox(60, Main.WindowHeight - 50,
                Main.WindowWidth - 20 - 50, 20);
            tbLink.BackgroundColor = new Color(32, 32, 32, 192);
            tbLink.ForegroundColor = Color.White;
            tbLink.CursorColor = new Color(200, 200, 200);
            tbLink.Multiline = false;
            tbLink.onTextChanged += new TextBox.TextChangedEventHandler(tbLink_onTextChanged);
            controls.Add(tbLink);
            #endregion

            #region FileManagement
            save = new EncyclopediaBrowserButton(5, Main.WindowHeight - 25, 100, 20, "Save");
            (save as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            save.foreground = Color.White;
            save.onClicked += new Button.ClickedEventHandler(save_onClicked);
            controls.Add(save);

            saveas = new EncyclopediaBrowserButton(115, Main.WindowHeight - 25, 100, 20, "Save As");
            (saveas as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            saveas.foreground = Color.White;
            saveas.onClicked += new Button.ClickedEventHandler(saveas_onClicked);
            controls.Add(saveas);

            load = new EncyclopediaBrowserButton(225, Main.WindowHeight - 25, 100, 20, "Load");
            (load as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            load.foreground = Color.White;
            load.onClicked += new Button.ClickedEventHandler(load_onClicked);
            controls.Add(load);

            clear = new EncyclopediaBrowserButton(335, Main.WindowHeight - 25, 100, 20, "Clear");
            (clear as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            clear.foreground = Color.White;
            clear.onClicked += new Button.ClickedEventHandler(clear_onClicked);
            controls.Add(clear);
            #endregion

            base.Initialize();

            background = GUIEngine.s_mainMenu.background;
        }
コード例 #5
0
        public override void Initialize()
        {
            buttons = new List<Button>();
            arefiles = new List<bool>();

            lcurFolder = new Label(10, 10, curFolder);
            lcurFolder.size.X = Main.WindowWidth - 20;
            lcurFolder.foreground = Color.White;
            lcurFolder.TextAlignment = Renderer.TextAlignment.Center;
            controls.Add(lcurFolder);

            folderup = new EncyclopediaBrowserButton(20, (int)(lcurFolder.position.Y + lcurFolder.size.Y + 5), 400, 28, "    ..");
            folderup.onClicked += new Button.ClickedEventHandler(folderup_onClicked);
            folderup.background = Color.Transparent;
            folderup.foreground = Color.White;
            folderup.textAlignment = Renderer.TextAlignment.Left;
            controls.Add(folderup);

            bnext = new EncyclopediaBrowserButton(Main.WindowWidth - 85, Main.WindowHeight - 38, 80, 28, ">>");
            (bnext as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bnext.foreground = Color.White;
            //bnext.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bnext.onClicked += new Button.ClickedEventHandler(bnext_onClicked);
            controls.Add(bnext);

            bprev = new EncyclopediaBrowserButton(5, Main.WindowHeight - 38, 80, 28, "<<");
            (bprev as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bprev.foreground = Color.White;
            //bprev.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bprev.onClicked += new Button.ClickedEventHandler(bprev_onClicked);
            controls.Add(bprev);

            back = new EncyclopediaBrowserButton((Main.WindowWidth - 80) / 2, Main.WindowHeight - 38, 80, 28, "Back");
            (back as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            back.foreground = Color.White;
            //back.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            back.onClicked += new Button.ClickedEventHandler(back_onClicked);
            controls.Add(back);

            base.Initialize();

            background = GUIEngine.s_mainMenu.background;
            ResetState();
        }
コード例 #6
0
ファイル: Credits.cs プロジェクト: XZelnar/MicroWorld
        public override void Initialize()
        {
            Label l = new Label(10, 10, "Game creators:\r\n -Gleb Boytsun\r\n -Stanislav Efremov\r\n\r\n" +
            "Music and sound effects from:\r\n  www.beatsuite.com");
            l.foreground = Color.White;
            controls.Add(l);

            back = new EncyclopediaBrowserButton(Main.WindowWidth - 130, Main.WindowHeight - 40, 120, 30, "Back");
            (back as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            back.foreground = Color.White;
            back.onClicked += new Button.ClickedEventHandler(back_onClicked);
            controls.Add(back);

            base.Initialize();

            background = GUIEngine.s_mainMenu.background;
        }
コード例 #7
0
ファイル: ContextMenu.cs プロジェクト: XZelnar/MicroWorld
 public void Add(String text)
 {
     if (text != null)
     {
         EncyclopediaBrowserButton b = new EncyclopediaBrowserButton(0, 0, 0, 0, text);
         (b as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Elements/ComboBoxBg");
         b.IdleOpacity = 0.8f;
         b.foreground = Color.White;
         b.Initialize();
         b.onClicked += new Button.ClickedEventHandler(ElementClicked);
         elements.Add(b);
     }
     else
     {
         EncyclopediaBrowserButton b = new EncyclopediaBrowserButton(0, 0, 0, 0, "---");
         (b as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Elements/ComboBoxBg");
         b.IdleOpacity = 0.8f;
         b.foreground = Color.White;
         b.Initialize();
         b.isEnabled = false;
         b.disabledColor = b.background;
         elements.Add(b);
     }
     updateSize();
     updatePosition();
 }