Пример #1
0
        public new void Initialize()
        {
            ShouldBeScaled = false;

            #region ControlButtons
            sb = new Elements.EncyclopediaBrowserButton(540, 440, 120, 30, "Back");
            (sb as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sb.foreground = Color.White;
            sb.onClicked += new Elements.Button.ClickedEventHandler(sbClick);
            //sb.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            controls.Add(sb);

            res = new Elements.EncyclopediaBrowserButton(670, 440, 120, 30, "Reset");
            (res as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            res.foreground = Color.White;
            res.onClicked += new Elements.Button.ClickedEventHandler(resClick);
            //res.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            controls.Add(res);
            #endregion

            for (int i = 0; i < l.Length; i++)
            {
                tl[i]            = new Elements.Label(10, 10 + i * 30, "");
                tl[i].font       = ResourceManager.Load <SpriteFont>("Fonts/LiberationSans_14");
                tl[i].foreground = Color.White;
                controls.Add(tl[i]);
            }
            tl[0].text = "Wires placed: ";
            tl[1].text = "Components placed: ";
            tl[2].text = "Times started: ";
            tl[3].text = "Components Removed: ";
            tl[4].text = "Wires burned: ";
            tl[5].text = "Buttons clicked: ";
            tl[6].text = "Text entered: ";
            tl[7].text = "Game start: ";

            int mw = 0;
            for (int i = 0; i < l.Length; i++)
            {
                if (tl[i].size.X > mw)
                {
                    mw = (int)tl[i].size.X;
                }
            }

            mw += 35;
            for (int i = 0; i < l.Length; i++)
            {
                l[i]            = new Elements.Label(mw, 10 + i * 30, "");
                l[i].font       = ResourceManager.Load <SpriteFont>("Fonts/LiberationSans_14");
                l[i].foreground = Color.White;
                controls.Add(l[i]);
            }

            base.Initialize();
            background = GUIEngine.s_mainMenu.background;
        }
Пример #2
0
        public new void Initialize()
        {
            ShouldBeScaled = false;
            background     = new Background.MainMenu();

            lvl = new Elements.MenuAnimatedButton(100, 50, 600, 45, "Levels");
            lvl.InitAnimation("GUI/Menus/MainMenu/Levels", "GUI/Menus/MainMenu/LevelsSelected", 100, 7, 160);
            lvl.onClicked += new Elements.Button.ClickedEventHandler(lvlClick);
            controls.Add(lvl);

            sb = new Elements.MenuAnimatedButton(100, 117, 600, 45, "Sandbox");
            sb.InitAnimation("GUI/Menus/MainMenu/Sandbox", "GUI/Menus/MainMenu/SandboxSelected", 100, 7, 0);
            sb.onClicked += new Elements.Button.ClickedEventHandler(sbClick);
            controls.Add(sb);

            hb = new Elements.MenuAnimatedButton(100, 184, 600, 45, "Handbook");
            hb.InitAnimation("GUI/Menus/MainMenu/Handbook", "GUI/Menus/MainMenu/HandbookSelected", 100, 7, 130);
            hb.onClicked += new Elements.Button.ClickedEventHandler(hbClick);
            controls.Add(hb);

            op = new Elements.MenuAnimatedButton(100, 251, 600, 45, "Options");
            op.InitAnimation("GUI/Menus/MainMenu/Options", "GUI/Menus/MainMenu/OptionsSelected", 100, 7, 70);
            op.onClicked += new Elements.Button.ClickedEventHandler(opClick);
            controls.Add(op);

            st = new Elements.MenuAnimatedButton(100, 318, 600, 45, "Statistics");
            st.InitAnimation("GUI/Menus/MainMenu/Statistics", "GUI/Menus/MainMenu/StatisticsSelected", 100, 7, 35);
            st.onClicked += new Elements.Button.ClickedEventHandler(stClick);
            controls.Add(st);

            ex = new Elements.MenuAnimatedButton(100, 385, 600, 45, "Exit");
            ex.InitAnimation("GUI/Menus/MainMenu/Exit", "GUI/Menus/MainMenu/ExitSelected", 100, 7, 105);
            ex.onClicked += new Elements.Button.ClickedEventHandler(exClick);
            controls.Add(ex);

            cr = new Elements.EncyclopediaBrowserButton(Main.WindowWidth - 150, Main.WindowHeight - 35, 150, 35, "Credits");
            cr.OverrideTexture("GUI/Menus/MainMenu/ButtonBackgroundMM");
            cr.Font        = ResourceManager.Load <SpriteFont>("Fonts/LiberationSans_15");
            cr.foreground  = Color.White;
            cr.onClicked  += new Elements.Button.ClickedEventHandler(cr_onClicked);
            cr.IdleOpacity = 0.8f;
            controls.Add(cr);

            intr = new Elements.EncyclopediaBrowserButton(0, Main.WindowHeight - 35, 150, 35, "Intro");
            intr.OverrideTexture("GUI/Menus/MainMenu/ButtonBackgroundMM");
            intr.Font        = ResourceManager.Load <SpriteFont>("Fonts/LiberationSans_15");
            intr.foreground  = Color.White;
            intr.onClicked  += new Elements.Button.ClickedEventHandler(intr_onClicked);
            intr.IdleOpacity = 0.8f;
            controls.Add(intr);

            Main.LoadingDetails = "Initializing scenes...";

            base.Initialize();
        }
Пример #3
0
        public override void Initialize()
        {
            ShouldBeScaled = false;
            Layer          = 990;

            bback = new Elements.EncyclopediaBrowserButton(20, 440, 80, 30, "Back");
            (bback as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bback.foreground = Color.White;
            //bback.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bback.onClicked += new Elements.Button.ClickedEventHandler(backClick);
            controls.Add(bback);

            bref = new Elements.EncyclopediaBrowserButton(500, 440, 80, 30, "Refresh");
            (bref as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bref.foreground = Color.White;
            //bref.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bref.onClicked += new Elements.Button.ClickedEventHandler(refClick);
            controls.Add(bref);

            bdelete = new Elements.EncyclopediaBrowserButton(600, 440, 80, 30, "Delete");
            (bdelete as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bdelete.foreground = Color.White;
            //bdelete.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bdelete.onClicked += new Elements.Button.ClickedEventHandler(deleteClick);
            controls.Add(bdelete);

            bsave = new Elements.EncyclopediaBrowserButton(700, 440, 80, 30, "Save");
            (bsave as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bsave.foreground = Color.White;
            //bsave.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bsave.onClicked += new Elements.Button.ClickedEventHandler(saveClick);
            controls.Add(bsave);

            saves = new Elements.ListBox(10, 20, 780, 370);
            saves.onDoubleClicked        += new Elements.ListBox.DoubleClickedEventHandler(saves_onDoubleClicked);
            saves.onSelectedIndexChanged += new Elements.ListBox.SelectedIndexChangedEventHandler(saves_onSelectedIndexChanged);
            controls.Add(saves);

            tb = new Elements.TextBox(10, 400, 780, 30, "");
            tb.onTextChanged  += new Elements.TextBox.TextChangedEventHandler(tb_onTextChanged);
            tb.BackgroundColor = Color.Black;
            tb.ForegroundColor = Color.White;
            tb.CursorColor     = Color.White;
            tb.Multiline       = false;
            controls.Add(tb);

            base.Initialize();

            background = GUIEngine.s_mainMenu.background;
        }
Пример #4
0
        public override void Initialize()
        {
            ShouldBeScaled = false;

            saves = new Elements.ListBox(10, 20, 780, 410);
            saves.onDoubleClicked += new Elements.ListBox.DoubleClickedEventHandler(saves_onDoubleClicked);
            controls.Add(saves);

            bback = new Elements.EncyclopediaBrowserButton(20, 440, 80, 30, "Back");
            (bback as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bback.foreground = Color.White;
            //bback.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bback.onClicked += new Elements.Button.ClickedEventHandler(backClick);
            controls.Add(bback);

            bref = new Elements.EncyclopediaBrowserButton(500, 440, 80, 30, "Refresh");
            (bref as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bref.foreground = Color.White;
            //bref.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bref.onClicked += new Elements.Button.ClickedEventHandler(refClick);
            controls.Add(bref);

            bdelete = new Elements.EncyclopediaBrowserButton(600, 440, 80, 30, "Delete");
            (bdelete as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bdelete.foreground = Color.White;
            //bdelete.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bdelete.onClicked += new Elements.Button.ClickedEventHandler(deleteClick);
            controls.Add(bdelete);

            bload = new Elements.EncyclopediaBrowserButton(700, 440, 80, 30, "Load");
            (bload as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bload.foreground = Color.White;
            //bload.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bload.onClicked += new Elements.Button.ClickedEventHandler(loadClick);
            controls.Add(bload);

            base.Initialize();

            background = GUIEngine.s_mainMenu.background;
        }
Пример #5
0
        public new void Initialize()
        {
            ShouldBeScaled = false;

            #region ControlButtons
            sb = new Elements.EncyclopediaBrowserButton(540, 440, 120, 30, "Back");
            (sb as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sb.foreground = Color.White;
            sb.onClicked += new Elements.Button.ClickedEventHandler(sbClick);
            //sb.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            controls.Add(sb);

            res = new Elements.EncyclopediaBrowserButton(670, 440, 120, 30, "Reset");
            (res as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            res.foreground = Color.White;
            res.onClicked += new Elements.Button.ClickedEventHandler(resClick);
            //res.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            controls.Add(res);
            #endregion

            for (int i = 0; i < l.Length; i++)
            {
                tl[i] = new Elements.Label(10, 10 + i * 30, "");
                tl[i].font = ResourceManager.Load<SpriteFont>("Fonts/LiberationSans_14");
                tl[i].foreground = Color.White;
                controls.Add(tl[i]);
            }
            tl[0].text = "Wires placed: ";
            tl[1].text = "Components placed: ";
            tl[2].text = "Times started: ";
            tl[3].text = "Components Removed: ";
            tl[4].text = "Wires burned: ";
            tl[5].text = "Buttons clicked: ";
            tl[6].text = "Text entered: ";
            tl[7].text = "Game start: ";

            int mw = 0;
            for (int i = 0; i < l.Length; i++)
            {
                if (tl[i].size.X > mw) mw = (int)tl[i].size.X;
            }

            mw += 35;
            for (int i = 0; i < l.Length; i++)
            {
                l[i] = new Elements.Label(mw, 10 + i * 30, "");
                l[i].font = ResourceManager.Load<SpriteFont>("Fonts/LiberationSans_14");
                l[i].foreground = Color.White;
                controls.Add(l[i]);
            }

            base.Initialize();
            background = GUIEngine.s_mainMenu.background;
        }
Пример #6
0
        public new void Initialize()
        {
            #region Basic
            Layer = 100000;
            ShouldBeScaled = false;

            var a = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.GetEnumerator();
            a.MoveNext();
            maxw = a.Current.Width;
            maxh = a.Current.Height;
            a.MoveNext();
            while (true)//DO NOT TOUCH THIS CYCLE OR ELSE MONO GETS SCARED!!!
            {
                try
                {
                    if (a.Current == null)
                        break;
                }
                catch { System.Threading.Thread.Sleep(1); }
                try
                {
                    if (a.Current == null)
                        break;
                }
                catch { break; }
                try
                {
                    if (a.Current.Width > maxw) maxw = a.Current.Width;
                    if (a.Current.Height > maxh) maxh = a.Current.Height;
                }
                catch { }
                a.MoveNext();
            }
            #endregion

            #region ControlButtons
            sb = new Elements.EncyclopediaBrowserButton(410, 440, 120, 30, "Back");
            (sb as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sb.foreground = Color.White;
            //sb.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            sb.onClicked +=new Elements.Button.ClickedEventHandler(sbClick);
            controls.Add(sb);

            sac = new Elements.EncyclopediaBrowserButton(540, 440, 120, 30, "Save");
            (sac as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sac.foreground = Color.White;
            //sac.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            sac.onClicked += new Elements.Button.ClickedEventHandler(sacClick);
            controls.Add(sac);

            ap = new Elements.EncyclopediaBrowserButton(670, 440, 120, 30, "Apply");
            (ap as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            ap.foreground = Color.White;
            //ap.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            ap.onClicked += new Elements.Button.ClickedEventHandler(apClick);
            controls.Add(ap);
            #endregion

            #region MasterVolume
            Elements.Label l1 = new Elements.Label(10, 20, "Master Volume");
            l1.foreground = Color.White;
            controls.Add(l1);

            mv = new Elements.ScrollBar(170, 24, 200, 20);
            mv.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(mv_onValueChanged);
            mv.MinValue = 0;
            mv.MaxValue = 100;
            mv.Value = (int)(Settings.MasterVolume * 100);
            controls.Add(mv);
            #endregion

            #region EffectVolume
            Elements.Label l11 = new Elements.Label(10, 50, "Effects Volume");
            l11.foreground = Color.White;
            controls.Add(l11);

            ev = new Elements.ScrollBar(170, 54, 200, 20);
            ev.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(ev_onValueChanged);
            ev.MinValue = 0;
            ev.MaxValue = 100;
            ev.Value = (int)(Settings.EffectsVolume * 100);
            controls.Add(ev);
            #endregion

            #region MusicVolume
            Elements.Label l111 = new Elements.Label(10, 80, "Music Volume");
            l111.foreground = Color.White;
            controls.Add(l111);

            mzv = new Elements.ScrollBar(170, 84, 200, 20);
            mzv.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(mzv_onValueChanged);
            mzv.MinValue = 0;
            mzv.MaxValue = 100;
            mzv.Value = (int)(Settings.MusicVolume * 100);
            controls.Add(mzv);
            #endregion

            #region Resoulutions
            lar = new Elements.Label(400, 20, "Aspect ratio:");
            lar.foreground = Color.White;
            controls.Add(lar);

            ar = new Elements.ComboBox(550, 22, 120, 24);
            ar.onElementSelected += new Elements.ComboBox.ElementSelectedHandler(ar_onElementSelected);
            controls.Add(ar);
            ar.ItemsAdd("4*3");
            ar.ItemsAdd("5*3");
            if (maxw >= 1280 && maxh >= 720) ar.ItemsAdd("16*9");
            if (maxw >= 1280 && maxh >= 800) ar.ItemsAdd("16*10");

            lres = new Elements.Label(400, 50, "Resolution:");
            lres.foreground = Color.White;
            controls.Add(lres);

            res = new Elements.ComboBox(550, 52, 120, 24);
            res.onElementSelected += new Elements.ComboBox.ElementSelectedHandler(res_onElementSelected);
            controls.Add(res);

            fs = new Elements.CheckBox(400, 90, 170, 20, "FullScreen", false);
            fs.foreground = Color.White;
            controls.Add(fs);
            #endregion

            #region Hotkeys
            hcSimStart = new Elements.HotkeyControl(5, 125, 250, "Simulation start", Settings.k_SimulationStart);
            controls.Add(hcSimStart);
            hcSimStop = new Elements.HotkeyControl(5, 150, 250,  "Simulation stop", Settings.k_SimulationStop);
            controls.Add(hcSimStop);
            hcSimPause = new Elements.HotkeyControl(5, 175, 250, "Simulation pause", Settings.k_SimulationPause);
            controls.Add(hcSimPause);
            hcUndo = new Elements.HotkeyControl(5,    200, 250, "Undo", Settings.k_Undo);
            controls.Add(hcUndo);
            hcCompRem = new Elements.HotkeyControl(5, 250, 250, "Remove single component", Settings.k_ComponentRemove);
            controls.Add(hcCompRem);
            hcEraser = new Elements.HotkeyControl(5, 275, 250, "Eraser", Settings.k_Eraser);
            controls.Add(hcEraser);
            hcZoomIn = new Elements.HotkeyControl(5, 300, 250, "Zoom In", Settings.k_ZoomIn);
            controls.Add(hcZoomIn);
            hcZoomOut = new Elements.HotkeyControl(5, 325, 250, "Zoom Out", Settings.k_ZoomOut);
            controls.Add(hcZoomOut);
            #endregion

            base.Initialize();
            background = GUIEngine.s_mainMenu.background;
        }
Пример #7
0
        public override void Initialize()
        {
            ShouldBeScaled = false;

            saves = new Elements.ListBox(10, 20, 780, 410);
            saves.onDoubleClicked += new Elements.ListBox.DoubleClickedEventHandler(saves_onDoubleClicked);
            controls.Add(saves);

            bback = new Elements.EncyclopediaBrowserButton(20, 440, 80, 30, "Back");
            (bback as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bback.foreground = Color.White;
            //bback.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bback.onClicked += new Elements.Button.ClickedEventHandler(backClick);
            controls.Add(bback);

            bref = new Elements.EncyclopediaBrowserButton(500, 440, 80, 30, "Refresh");
            (bref as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bref.foreground = Color.White;
            //bref.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bref.onClicked += new Elements.Button.ClickedEventHandler(refClick);
            controls.Add(bref);

            bdelete = new Elements.EncyclopediaBrowserButton(600, 440, 80, 30, "Delete");
            (bdelete as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bdelete.foreground = Color.White;
            //bdelete.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bdelete.onClicked += new Elements.Button.ClickedEventHandler(deleteClick);
            controls.Add(bdelete);

            bload = new Elements.EncyclopediaBrowserButton(700, 440, 80, 30, "Load");
            (bload as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bload.foreground = Color.White;
            //bload.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bload.onClicked += new Elements.Button.ClickedEventHandler(loadClick);
            controls.Add(bload);

            base.Initialize();

            background = GUIEngine.s_mainMenu.background;
        }
Пример #8
0
        public override void Initialize()
        {
            ShouldBeScaled = false;
            Layer = 990;

            bback = new Elements.EncyclopediaBrowserButton(20, 440, 80, 30, "Back");
            (bback as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bback.foreground = Color.White;
            //bback.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bback.onClicked += new Elements.Button.ClickedEventHandler(backClick);
            controls.Add(bback);

            bref = new Elements.EncyclopediaBrowserButton(500, 440, 80, 30, "Refresh");
            (bref as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bref.foreground = Color.White;
            //bref.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bref.onClicked += new Elements.Button.ClickedEventHandler(refClick);
            controls.Add(bref);

            bdelete = new Elements.EncyclopediaBrowserButton(600, 440, 80, 30, "Delete");
            (bdelete as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bdelete.foreground = Color.White;
            //bdelete.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bdelete.onClicked += new Elements.Button.ClickedEventHandler(deleteClick);
            controls.Add(bdelete);

            bsave = new Elements.EncyclopediaBrowserButton(700, 440, 80, 30, "Save");
            (bsave as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            bsave.foreground = Color.White;
            //bsave.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            bsave.onClicked += new Elements.Button.ClickedEventHandler(saveClick);
            controls.Add(bsave);

            saves = new Elements.ListBox(10, 20, 780, 370);
            saves.onDoubleClicked += new Elements.ListBox.DoubleClickedEventHandler(saves_onDoubleClicked);
            saves.onSelectedIndexChanged += new Elements.ListBox.SelectedIndexChangedEventHandler(saves_onSelectedIndexChanged);
            controls.Add(saves);

            tb = new Elements.TextBox(10, 400, 780, 30, "");
            tb.onTextChanged += new Elements.TextBox.TextChangedEventHandler(tb_onTextChanged);
            tb.BackgroundColor = Color.Black;
            tb.ForegroundColor = Color.White;
            tb.CursorColor = Color.White;
            tb.Multiline = false;
            controls.Add(tb);

            base.Initialize();

            background = GUIEngine.s_mainMenu.background;
        }
Пример #9
0
        public new void Initialize()
        {
            ShouldBeScaled = false;
            background = new Background.MainMenu();

            lvl = new Elements.MenuAnimatedButton(100, 50, 600, 45, "Levels");
            lvl.InitAnimation("GUI/Menus/MainMenu/Levels", "GUI/Menus/MainMenu/LevelsSelected", 100, 7, 160);
            lvl.onClicked += new Elements.Button.ClickedEventHandler(lvlClick);
            controls.Add(lvl);

            sb = new Elements.MenuAnimatedButton(100, 117, 600, 45, "Sandbox");
            sb.InitAnimation("GUI/Menus/MainMenu/Sandbox", "GUI/Menus/MainMenu/SandboxSelected", 100, 7, 0);
            sb.onClicked +=new Elements.Button.ClickedEventHandler(sbClick);
            controls.Add(sb);

            hb = new Elements.MenuAnimatedButton(100, 184, 600, 45, "Handbook");
            hb.InitAnimation("GUI/Menus/MainMenu/Handbook", "GUI/Menus/MainMenu/HandbookSelected", 100, 7, 130);
            hb.onClicked += new Elements.Button.ClickedEventHandler(hbClick);
            controls.Add(hb);

            op = new Elements.MenuAnimatedButton(100, 251, 600, 45, "Options");
            op.InitAnimation("GUI/Menus/MainMenu/Options", "GUI/Menus/MainMenu/OptionsSelected", 100, 7, 70);
            op.onClicked += new Elements.Button.ClickedEventHandler(opClick);
            controls.Add(op);

            st = new Elements.MenuAnimatedButton(100, 318, 600, 45, "Statistics");
            st.InitAnimation("GUI/Menus/MainMenu/Statistics", "GUI/Menus/MainMenu/StatisticsSelected", 100, 7, 35);
            st.onClicked += new Elements.Button.ClickedEventHandler(stClick);
            controls.Add(st);

            ex = new Elements.MenuAnimatedButton(100, 385, 600, 45, "Exit");
            ex.InitAnimation("GUI/Menus/MainMenu/Exit", "GUI/Menus/MainMenu/ExitSelected", 100, 7, 105);
            ex.onClicked += new Elements.Button.ClickedEventHandler(exClick);
            controls.Add(ex);

            cr = new Elements.EncyclopediaBrowserButton(Main.WindowWidth - 150, Main.WindowHeight - 35, 150, 35, "Credits");
            cr.OverrideTexture("GUI/Menus/MainMenu/ButtonBackgroundMM");
            cr.Font = ResourceManager.Load<SpriteFont>("Fonts/LiberationSans_15");
            cr.foreground = Color.White;
            cr.onClicked += new Elements.Button.ClickedEventHandler(cr_onClicked);
            cr.IdleOpacity = 0.8f;
            controls.Add(cr);

            intr = new Elements.EncyclopediaBrowserButton(0, Main.WindowHeight - 35, 150, 35, "Intro");
            intr.OverrideTexture("GUI/Menus/MainMenu/ButtonBackgroundMM");
            intr.Font = ResourceManager.Load<SpriteFont>("Fonts/LiberationSans_15");
            intr.foreground = Color.White;
            intr.onClicked += new Elements.Button.ClickedEventHandler(intr_onClicked);
            intr.IdleOpacity = 0.8f;
            controls.Add(intr);

            Main.LoadingDetails = "Initializing scenes...";

            base.Initialize();
        }
Пример #10
0
        public new void Initialize()
        {
            #region Basic
            Layer          = 100000;
            ShouldBeScaled = false;

            var a = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.GetEnumerator();
            a.MoveNext();
            maxw = a.Current.Width;
            maxh = a.Current.Height;
            a.MoveNext();
            while (true)//DO NOT TOUCH THIS CYCLE OR ELSE MONO GETS SCARED!!!
            {
                try
                {
                    if (a.Current == null)
                    {
                        break;
                    }
                }
                catch { System.Threading.Thread.Sleep(1); }
                try
                {
                    if (a.Current == null)
                    {
                        break;
                    }
                }
                catch { break; }
                try
                {
                    if (a.Current.Width > maxw)
                    {
                        maxw = a.Current.Width;
                    }
                    if (a.Current.Height > maxh)
                    {
                        maxh = a.Current.Height;
                    }
                }
                catch { }
                a.MoveNext();
            }
            #endregion

            #region ControlButtons
            sb = new Elements.EncyclopediaBrowserButton(410, 440, 120, 30, "Back");
            (sb as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sb.foreground = Color.White;
            //sb.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            sb.onClicked += new Elements.Button.ClickedEventHandler(sbClick);
            controls.Add(sb);

            sac = new Elements.EncyclopediaBrowserButton(540, 440, 120, 30, "Save");
            (sac as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sac.foreground = Color.White;
            //sac.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            sac.onClicked += new Elements.Button.ClickedEventHandler(sacClick);
            controls.Add(sac);

            ap = new Elements.EncyclopediaBrowserButton(670, 440, 120, 30, "Apply");
            (ap as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            ap.foreground = Color.White;
            //ap.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            ap.onClicked += new Elements.Button.ClickedEventHandler(apClick);
            controls.Add(ap);
            #endregion

            #region MasterVolume
            Elements.Label l1 = new Elements.Label(10, 20, "Master Volume");
            l1.foreground = Color.White;
            controls.Add(l1);

            mv = new Elements.ScrollBar(170, 24, 200, 20);
            mv.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(mv_onValueChanged);
            mv.MinValue        = 0;
            mv.MaxValue        = 100;
            mv.Value           = (int)(Settings.MasterVolume * 100);
            controls.Add(mv);
            #endregion

            #region EffectVolume
            Elements.Label l11 = new Elements.Label(10, 50, "Effects Volume");
            l11.foreground = Color.White;
            controls.Add(l11);

            ev = new Elements.ScrollBar(170, 54, 200, 20);
            ev.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(ev_onValueChanged);
            ev.MinValue        = 0;
            ev.MaxValue        = 100;
            ev.Value           = (int)(Settings.EffectsVolume * 100);
            controls.Add(ev);
            #endregion

            #region MusicVolume
            Elements.Label l111 = new Elements.Label(10, 80, "Music Volume");
            l111.foreground = Color.White;
            controls.Add(l111);

            mzv = new Elements.ScrollBar(170, 84, 200, 20);
            mzv.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(mzv_onValueChanged);
            mzv.MinValue        = 0;
            mzv.MaxValue        = 100;
            mzv.Value           = (int)(Settings.MusicVolume * 100);
            controls.Add(mzv);
            #endregion

            #region Resoulutions
            lar            = new Elements.Label(400, 20, "Aspect ratio:");
            lar.foreground = Color.White;
            controls.Add(lar);

            ar = new Elements.ComboBox(550, 22, 120, 24);
            ar.onElementSelected += new Elements.ComboBox.ElementSelectedHandler(ar_onElementSelected);
            controls.Add(ar);
            ar.ItemsAdd("4*3");
            ar.ItemsAdd("5*3");
            if (maxw >= 1280 && maxh >= 720)
            {
                ar.ItemsAdd("16*9");
            }
            if (maxw >= 1280 && maxh >= 800)
            {
                ar.ItemsAdd("16*10");
            }

            lres            = new Elements.Label(400, 50, "Resolution:");
            lres.foreground = Color.White;
            controls.Add(lres);

            res = new Elements.ComboBox(550, 52, 120, 24);
            res.onElementSelected += new Elements.ComboBox.ElementSelectedHandler(res_onElementSelected);
            controls.Add(res);

            fs            = new Elements.CheckBox(400, 90, 170, 20, "FullScreen", false);
            fs.foreground = Color.White;
            controls.Add(fs);
            #endregion

            #region Hotkeys
            hcSimStart = new Elements.HotkeyControl(5, 125, 250, "Simulation start", Settings.k_SimulationStart);
            controls.Add(hcSimStart);
            hcSimStop = new Elements.HotkeyControl(5, 150, 250, "Simulation stop", Settings.k_SimulationStop);
            controls.Add(hcSimStop);
            hcSimPause = new Elements.HotkeyControl(5, 175, 250, "Simulation pause", Settings.k_SimulationPause);
            controls.Add(hcSimPause);
            hcUndo = new Elements.HotkeyControl(5, 200, 250, "Undo", Settings.k_Undo);
            controls.Add(hcUndo);
            hcCompRem = new Elements.HotkeyControl(5, 250, 250, "Remove single component", Settings.k_ComponentRemove);
            controls.Add(hcCompRem);
            hcEraser = new Elements.HotkeyControl(5, 275, 250, "Eraser", Settings.k_Eraser);
            controls.Add(hcEraser);
            hcZoomIn = new Elements.HotkeyControl(5, 300, 250, "Zoom In", Settings.k_ZoomIn);
            controls.Add(hcZoomIn);
            hcZoomOut = new Elements.HotkeyControl(5, 325, 250, "Zoom Out", Settings.k_ZoomOut);
            controls.Add(hcZoomOut);
            #endregion

            base.Initialize();
            background = GUIEngine.s_mainMenu.background;
        }