Ejemplo n.º 1
0
        private void SetupRightSettingsContainer(Panel container)
        {
            stnCheckUpdateMsg.Text      = "Check for Brick-Force updates";
            stnCheckUpdateMsg.Name      = "stnCheckUpdateMsg";
            stnCheckUpdateMsg.Font      = labelMsg.Font;
            stnCheckUpdateMsg.BackColor = Color.Transparent;
            stnCheckUpdateMsg.ForeColor = Color.White;
            stnCheckUpdateMsg.TextAlign = ContentAlignment.MiddleRight;
            stnCheckUpdateMsg.Size      = new Size(244, labelMsg.Font.Height);
            container.Add(stnCheckUpdateMsg);

            stnAutoUpdateMsg.Text      = "Automatically update Brick-Force";
            stnAutoUpdateMsg.Name      = "stnAutoUpdateMsg";
            stnAutoUpdateMsg.Font      = labelMsg.Font;
            stnAutoUpdateMsg.BackColor = Color.Transparent;
            stnAutoUpdateMsg.ForeColor = Color.White;
            stnAutoUpdateMsg.TextAlign = ContentAlignment.MiddleRight;
            stnAutoUpdateMsg.Size      = new Size(244, labelMsg.Font.Height);
            container.Add(stnAutoUpdateMsg);

            stnExperimentalMsg.Text      = "Use experimental branch";
            stnExperimentalMsg.Name      = "stnExperimentalMsg";
            stnExperimentalMsg.Font      = labelMsg.Font;
            stnExperimentalMsg.BackColor = Color.Transparent;
            stnExperimentalMsg.ForeColor = Color.White;
            stnExperimentalMsg.TextAlign = ContentAlignment.MiddleRight;
            stnExperimentalMsg.Size      = new Size(244, labelMsg.Font.Height);
            container.Add(stnExperimentalMsg);

            container.BackColor = Color.Transparent;
            container.Location  = new Point(270, 80);
            container.Size      = new Size(244, 360);
        }
Ejemplo n.º 2
0
        private Panel CreateExistingWorldInterface(String[] worldNames)
        {
            var panel = new Panel(ControlManager.Manager)
            {
                Width = 856, Height = 467, AutoScroll = true, Left = 300, Top = 50
            };

            panel.Init();
            ControlManager.Add(panel);

            if (!worldNames.Any())
            {
                var label = new Label(ControlManager.Manager)
                {
                    Height = 50,
                    Left   = 20,
                    Width  = 400,
                    Text   =
                        "There are no existing worlds to edit!\nSelect the Create New World tab to create one."
                };

                panel.Add(label);


                return(panel);
            }

            var existingWorldLabel = new Label(ControlManager.Manager)
            {
                Text = "Existing World :: ", Width = 200, Left = 16, Top = 16, Parent = panel
            };

            var worldNamesSelection = new ComboBox(ControlManager.Manager)
            {
                Width = 200, Parent = panel, Top = 16, Left = existingWorldLabel.Left + existingWorldLabel.Width + 20
            };

            worldNamesSelection.Items.AddRange(worldNames);
            worldNamesSelection.Init();
            worldNamesSelection.ItemIndex = 0;
            worldNamesSelection.Left      = existingWorldLabel.Left + existingWorldLabel.Width + 16;


            panel.Add(worldNamesSelection);

            var beginWorldEditor = new Button(ControlManager.Manager)
            {
                Text = "Load world", Top = 200, Left = 100, Width = 200
            };

            beginWorldEditor.Init();
            beginWorldEditor.Click += (sender, args) => LoadExistingWorld(worldNamesSelection.Text);
            panel.Add(beginWorldEditor);

            return(panel);
        }
Ejemplo n.º 3
0
        private void LoadSubmenu()
        {
            MainPanel = new Panel(GameConstants.Content.Load <Texture2D>("Panels/menu/MenuBG"), new Vector2(0, 0));
            // ptDiff, ptCol, ptCon, peCursor;

            ptSettings = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);
            ptSettings.AddText(GameConstants.lucidaConsole, "SETTINGS", Color.White, 1f);
            ptDiff = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);
            ptDiff.AddText(GameConstants.lucidaConsole, "Difficulty", Color.White, 2.2f);
            ptSound = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);
            ptSound.AddText(GameConstants.lucidaConsole, "Sound", Color.White, 2.2f);
            ptCon = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);
            ptCon.AddText(GameConstants.lucidaConsole, "Controls", Color.White, 2.2f);
            ptMBack = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);
            ptMBack.AddText(GameConstants.lucidaConsole, "Back", Color.White);
            ptDiff2 = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), false);
            ptDiff2.AddText(GameConstants.lucidaConsole, "Difficulty", Color.Red, 2.2f);
            ptSound2 = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), false);
            ptSound2.AddText(GameConstants.lucidaConsole, "Sound", Color.Red, 2.2f);
            ptCon2 = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), false);
            ptCon2.AddText(GameConstants.lucidaConsole, "Controls", Color.Red, 2.2f);
            peCursor = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/menu/cursor"), true);

            MainPanel.Add(ptSettings, new Vector2(0.05f, 0.05f));
            MainPanel.Add(ptDiff, new Vector2(0.1f, 0.3f));
            MainPanel.Add(ptSound, new Vector2(0.1f, 0.45f));
            MainPanel.Add(ptCon, new Vector2(0.1f, 0.6f));
            MainPanel.Add(ptDiff2, new Vector2(0.1f, 0.3f));
            MainPanel.Add(ptSound2, new Vector2(0.1f, 0.45f));
            MainPanel.Add(ptCon2, new Vector2(0.1f, 0.6f));
            MainPanel.Add(ptMBack, new Vector2(0.1f, 0.75f));
            // Can be 0.31 ; 0,46; 0,61; 0,76
            MainPanel.Add(peCursor, new Vector2(0.05f, 0.31f));
        }
Ejemplo n.º 4
0
        private void LoadPanel()
        {
            MainPanel = new Panel(GameConstants.Content.Load <Texture2D>("Panels/panel"),
                                  new Vector2(0.1f * GameConstants.WINDOWSIZE.X,
                                              0.1f * GameConstants.WINDOWSIZE.Y));

            peRdy        = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/Rdy"), true);
            pePressJump  = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/pressA"), true);
            pePressJump2 = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/pressB"), false);
            ptJump       = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);
            ptJump.AddText(GameConstants.lucidaConsole, "press space \n to Jump", Microsoft.Xna.Framework.Color.White);
            peJumpA = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/JumpA"), true);
            peJumpB = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/JumpB"), false);
            ptRun   = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);
            ptRun.AddText(GameConstants.lucidaConsole, "switch lane \n with arrow buttons", Microsoft.Xna.Framework.Color.White);
            peRunA = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/RunA"), false);
            peRunB = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/RunB"), true);


            //TODO: FIX THAT ptRUN and ptJump werent shown
            MainPanel.Add(peRdy, new Vector2(0.3f, 0.44f));
            MainPanel.Add(pePressJump, new Vector2(0.3f, 0.62f));
            MainPanel.Add(pePressJump2, new Vector2(0.3f, 0.62f));
            MainPanel.Add(peRunA, new Vector2(0.6f, 0.2f));
            MainPanel.Add(peRunB, new Vector2(0.6f, 0.2f));
            MainPanel.Add(ptRun, new Vector2(0.6f, 0.1f));
            MainPanel.Add(peJumpA, new Vector2(0.15f, 0.2f));
            MainPanel.Add(peJumpB, new Vector2(0.15f, 0.2f));
            MainPanel.Add(ptJump, new Vector2(0.15f, 0.1f));
        }
Ejemplo n.º 5
0
        private void AddNews(string author, string date, string title, string message, int num)
        {
            GroupPanel newsPnl = ScreenManager.MainWindow.ClientArea.Controls["InsaneRO News"] as GroupPanel;
            Panel      pnl     = new Panel(WindowManager);

            pnl.Init();
            pnl.Text        = "News_" + num;
            pnl.Tag         = num;
            pnl.Width       = newsPnl.ClientWidth - 20;
            pnl.Height      = 210;
            pnl.Left        = 10;
            pnl.Top         = (num * 10) + (num * 210) + 10;
            pnl.BevelBorder = EBevelBorder.All;
            pnl.BevelMargin = 1;
            pnl.BevelStyle  = EBevelStyle.Flat;
            pnl.Color       = Color.Transparent;
            pnl.Passive     = true;

            Label lblTitle = new Label(WindowManager);

            lblTitle.Init();
            lblTitle.Skin.Layers[0].Text.Font.Resource = WindowManager.Skin.Fonts[WindowManager.Skin.Controls["Dialog"].Layers["TopPanel"].Attributes["CaptFont"].Value].Resource;
            lblTitle.Text      = "'" + title + "' - Von " + author + " (" + date + ")";
            lblTitle.TextColor = new Color(81, 172, 232);
            lblTitle.Top       = 5;
            lblTitle.Left      = 5;
            lblTitle.Width     = pnl.ClientWidth - 15;
            lblTitle.Height    = 24;
            lblTitle.Alignment = EAlignment.TopLeft;
            pnl.Add(lblTitle);

            Label lblMessage = new Label(WindowManager);

            lblMessage.Init();
            lblMessage.Text = "";
            lblMessage.TextLines.AddRange(message.Split(new string[] { Environment.NewLine }, StringSplitOptions.None));
            lblMessage.Top       = 5 + 5 + 24;
            lblMessage.Left      = 10;
            lblMessage.Width     = pnl.ClientWidth - 20;
            lblMessage.Height    = pnl.ClientHeight - 15 - 24;
            lblMessage.Ellipsis  = false;
            lblMessage.Alignment = EAlignment.TopLeft;
            lblMessage.Autosize  = true;
            lblMessage.Draw     += new DrawEventHandler(lblMessage_Draw);
            pnl.Add(lblMessage);

            newsPnl.Add(pnl);
        }
Ejemplo n.º 6
0
        public void AddHudModButton(HUD hud)
        {
            _hud = hud;

            Panel buttonPanel = (Panel)HudPanelField.GetValue(hud);

            Button helpButton;

            if (!buttonPanel.FindControlRecursive(out helpButton, b => b.Text == "Help"))
            {
                return;
            }

            Button modsButton = new Button(buttonPanel.Manager);

            modsButton.Init();
            SkinLayer skinLayer = modsButton.Skin.Layers["Control"];

            modsButton.Text         = "Mods";
            modsButton.Width        = (int)skinLayer.Text.Font.Resource.MeasureString(modsButton.Text).X + skinLayer.ContentMargins.Horizontal + 1;
            modsButton.ToolTip.Text = "Show information about and settings for mods";
            modsButton.Margins      = new Margins(4, 4, 4, 4);
            modsButton.Click       += ModsButtonOnClick;
            modsButton.Left         = helpButton.Left;
            buttonPanel.Add(modsButton);

            helpButton.Left = modsButton.Left + modsButton.Width + modsButton.Margins.Right + helpButton.Margins.Left;

            buttonPanel.Width = helpButton.Left + helpButton.Width;
            buttonPanel.Left  = (hud.Width - buttonPanel.Width) / 2;
        }
Ejemplo n.º 7
0
        public static Gui CreateMainMenuInterface(ref AnoleEngine.Engine_Base.Engine objEngineInstance, GalaxyViewState state)
        {
            float fltGameWindowWidth  = objEngineInstance.GameWindow.Size.X;
            float fltGameWindowHeight = objEngineInstance.GameWindow.Size.Y;

            Gui UI = new Gui(objEngineInstance.GameWindow);

            Panel objGalaxyMenuLayout = new Panel();

            objGalaxyMenuLayout.SetRenderer(UI_Renderers.UIGalaxyMenuLayoutRenderer.Data);
            objGalaxyMenuLayout.Size = new Vector2f(fltGameWindowWidth, fltGameWindowHeight / 7);
            objGalaxyMenuLayout.ShowWithEffect(ShowAnimationType.SlideFromBottom, Time.FromMilliseconds(800));
            objGalaxyMenuLayout.Position = new Vector2f((fltGameWindowWidth / 2) - (objGalaxyMenuLayout.Size.X / 2), fltGameWindowHeight - objGalaxyMenuLayout.Size.Y);


            Button closeButton = new Button("CLOSE");

            closeButton.Size     = new Vector2f(50f, 45);
            closeButton.Position = new Vector2f(objGalaxyMenuLayout.Size.X - 60, 5);
            closeButton.SetRenderer(UI_Renderers.UIGalaxyViewButtonRenderer.Data);
            closeButton.Clicked += new EventHandler <SignalArgsVector2f>(state.KillStateEvent);
            objGalaxyMenuLayout.Add(closeButton, "closeButton");

            UI.Add(objGalaxyMenuLayout, "GalaxyLayout");
            return(UI);
        }
Ejemplo n.º 8
0
        public static T Add <T>(this Panel panel, Action <T> action) where T : UIElement, new()
        {
            var element = panel.Add <T>();

            action(element);
            return(element);
        }
Ejemplo n.º 9
0
        public void LoadContent()
        {
            MainPanel = new Panel(GameConstants.Content.Load <Texture2D>("Panels/menu/MenuBG"), new Vector2(0, 0));

            peHeader = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/menu/creditscomplete"), true);
            //TODO: mit den einzelnen Elementen umsetzen, hier aus Faulheit ein großes .png für die Controls


            MainPanel.Add(peHeader, new Vector2(0.1f, 0.1f));
        }
Ejemplo n.º 10
0
        private Component deviceSelectMenu()
        {
            Panel p = new Panel();

            p.Layout = new LayoutVerticalCenter();
            p.AddHoverCondition(Default.ConditionHoverMouse);
            p.AddAction(Default.IsScrolled, Default.ScrollVertically);

            p.Add(Default.CreateButton(
                      "Resume",
                      c => {
                Core.ShowMenu = !Core.ShowMenu;
                return(true);
            },
                      _grabFocus));

            p.Add(createDynamicText(() => $"Current device: {Core.Midi.Device.Details.Name}"));

            p.Add(createTitle("Choose a midi device:"));

            foreach (var device in Midi.Devices)
            {
                p.Add(Default.CreateButton(
                          device.Name,
                          c => {
                    Core.Midi.Dispose();
                    Core.Midi = new Midi(device.Id);
                    return(true);
                },
                          _grabFocus));
            }

            p.Add(Default.CreateButton(
                      "Quit",
                      c => {
                Core.Game.Exit();
                return(true);
            },
                      _grabFocus));

            return(p);
        }
Ejemplo n.º 11
0
        private void LoadControlsPanel()
        {
            ControlsPanel = new Panel(GameConstants.Content.Load <Texture2D>("Panels/menu/panelMenu"),
                                      new Vector2(0.35f * GameConstants.WINDOWSIZE.X,
                                                  0.1f * GameConstants.WINDOWSIZE.Y));

            ptHeader3 = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/menu/controlscomplete"), true);
            //TODO: mit den einzelnen Elementen umsetzen, hier aus Faulheit ein großes .png für die Controls


            ControlsPanel.Add(ptHeader3, new Vector2(0.1f, 0.1f));
        }
Ejemplo n.º 12
0
        public static List <Panel> ToSAM_Panels(this RevitInstance3D revitInstance3D)
        {
            if (revitInstance3D == null)
            {
                return(null);
            }

            RevitType3D  revitType3D  = revitInstance3D.Type as RevitType3D;
            Construction construction = revitType3D.ToSAM_Construction();

            List <Face3D>         face3Ds        = new List <Face3D>();
            List <ISAMGeometry3D> sAMGeometry3Ds = revitInstance3D.Geometries;

            foreach (ISAMGeometry3D sAMGeometry3D in sAMGeometry3Ds)
            {
                if (sAMGeometry3D is Shell)
                {
                    List <Face3D> face3Ds_Temp = ((Shell)sAMGeometry3D).Face3Ds;
                    if (face3Ds_Temp != null && face3Ds_Temp.Count != 0)
                    {
                        face3Ds.AddRange(face3Ds_Temp);
                    }
                }
                else if (sAMGeometry3D is Face3D)
                {
                    face3Ds.Add((Face3D)sAMGeometry3D);
                }
            }

            List <Panel> result = new List <Panel>();

            foreach (Face3D face3D in face3Ds)
            {
                Panel panel = Analytical.Create.Panel(construction, PanelType.Shade, face3D);
                if (panel == null)
                {
                    continue;
                }

                List <Core.ParameterSet> parameterSets = revitType3D.GetParamaterSets();
                if (parameterSets != null)
                {
                    foreach (Core.ParameterSet parameterSet in parameterSets)
                    {
                        panel.Add(parameterSet);
                    }
                }

                result.Add(panel);
            }

            return(result);
        }
Ejemplo n.º 13
0
        public MapMarkSelect()
        {
            InitializeComponent();

            IMGEntry Marks = MapEditor.file.Directory.GetIMG("MapHelper.img").GetChild("mark");

            foreach (IMGEntry mark in Marks.childs.Values)
            {
                ImageViewer imageViewer = Panel.Add(mark.GetCanvas().GetBitmap(), mark.Name, false);
                imageViewer.MouseClick       += new MouseEventHandler(ImageViewer_MouseClick);
                imageViewer.MouseDoubleClick += new MouseEventHandler(ImageViewer_MouseDoubleClick);
            }
        }
        public void Run()
        {
            Application application = new Application();
            application.ShowDebug = true;
            Panel panel = new Panel(application) { Left = 0, Top = 0, Width = 480, Height = 272 };

            Label label = new Label(application) { Left = 10, Top = 30, Width = 200, Height = 32, Text = "Hello World" };
            panel.Add(label);

            Button button = new Button(application) { Left = 10, Top = 100, Width = 200, Height = 100, Text = "Touch" };
            button.TouchStart += (s, e) => { label.Text = "Touched"; };
            panel.Add(button);

            ListView listview = new ListView(application) { Left = 239, Top = 0, Width = 240, Height = 272, RowHeight = 30 };

            for (int i = 0; i < 1000; i++)
            {
                listview.Items.Add("ListView Item " + i.ToString());
            }

            panel.Add(listview);

            application.Run(panel);
        }
Ejemplo n.º 15
0
        private void SetupLeftSettingsContainer(Panel container)
        {
            stnCheckUpdate.ApplyStyle();
            stnCheckUpdate.Name       = "stnCheckUpdate";
            stnCheckUpdate.Enabled    = true;
            stnCheckUpdate.CheckImage = EmuResources.check;
            stnCheckUpdate.BackColor  = Color.FromArgb(1, 10, 18);
            stnCheckUpdate.ForeColor  = Color.FromArgb(7, 69, 127);
            stnCheckUpdate.Checked    = Storage.GetBoolOr("check-update", true);
            stnCheckUpdate.OnChecked += (state) => Storage.Update("check-update", state);
            container.Add(stnCheckUpdate);

            stnAutoUpdate.ApplyStyle();
            stnAutoUpdate.Name       = "stnAutoUpdate";
            stnAutoUpdate.Enabled    = true;
            stnAutoUpdate.CheckImage = EmuResources.check;
            stnAutoUpdate.BackColor  = Color.FromArgb(1, 10, 18);
            stnAutoUpdate.ForeColor  = Color.FromArgb(7, 69, 127);
            stnAutoUpdate.Checked    = Storage.GetBoolOr("auto-update", true);
            stnAutoUpdate.OnChecked += (state) => Storage.Update("auto-update", state);
            container.Add(stnAutoUpdate);

            stnExperimental.ApplyStyle();
            stnExperimental.Name       = "stnExperimental";
            stnExperimental.Enabled    = true;
            stnExperimental.CheckImage = EmuResources.check;
            stnExperimental.BackColor  = Color.FromArgb(1, 10, 18);
            stnExperimental.ForeColor  = Color.FromArgb(7, 69, 127);
            stnExperimental.Checked    = Storage.GetBoolOr("experimental", false);
            stnExperimental.OnChecked += (state) => Storage.Update("experimental", state);
            container.Add(stnExperimental);

            container.BackColor = Color.Transparent;
            container.Location  = new Point(26, 80);
            container.Size      = new Size(244, 360);
        }
Ejemplo n.º 16
0
        public static Panel ToSAM(this TAS3D.Element element)
        {
            if (element == null)
            {
                return(null);
            }

            ParameterSet parameterSet = Create.ParameterSet(ActiveSetting.Setting, element);

            PlanarBoundary3D planarBoundary3D = null;

            Panel panel = Analytical.Create.Panel(new Construction(element.name), Query.PanelType(element.BEType), planarBoundary3D);

            panel.Add(parameterSet);

            return(panel);
        }
Ejemplo n.º 17
0
        public static Panel ToSAM(this TAS3D.shade shade)
        {
            if (shade == null)
            {
                return(null);
            }

            ParameterSet parameterSet = Create.ParameterSet(ActiveSetting.Setting, shade);

            PlanarBoundary3D planarBoundary3D = null;

            Panel panel = Analytical.Create.Panel(new Construction(shade.name), PanelType.Shade, planarBoundary3D);

            panel.Add(parameterSet);

            return(panel);
        }
Ejemplo n.º 18
0
        private void LoadQuestionPanel()
        {
            Panel = new Panel(GameConstants.Content.Load <Texture2D>("Panels/panel"),
                              new Vector2(0.1f * GameConstants.WINDOWSIZE.X,
                                          0.1f * GameConstants.WINDOWSIZE.Y));

            yes = new PanelElement("yes", GameConstants.lucidaConsole, Color.Red, true);
            no  = new PanelElement("no", GameConstants.lucidaConsole, Color.Red, false);

            Panel.Add(new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/newGame")), new Vector2(0.08f, 0.18f));
            Panel.Add(new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/button")), new Vector2(0.2f, 0.75f));
            Panel.Add(new PanelElement("yes", GameConstants.lucidaConsole, Color.White), new Vector2(0.25f, 0.75f));
            Panel.Add(yes, new Vector2(0.25f, 0.75f));
            Panel.Add(new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/button")), new Vector2(0.60f, 0.75f));
            Panel.Add(new PanelElement("no", GameConstants.lucidaConsole, Color.White), new Vector2(0.67f, 0.75f));
            Panel.Add(no, new Vector2(0.67f, 0.75f));
        }
    public void AddPlayerToPanel(Player player)
    {
        Vector3 viewportPos = Camera.main.WorldToViewportPoint(player.transform.position);
        int     index       = (int)(Mathf.Clamp(m_panels.Length * viewportPos.x, 0, m_panels.Length - 1f));

        Panel panel = m_panels[index];

        if (!panel.ContainsPlayer(player))
        {
            panel.Add(player);
            for (int i = 0, count = m_panels.Length; i < count; ++i)
            {
                if (i != index)
                {
                    m_panels[i].Remove(player);
                }
            }
        }

        AddPlayerToPanel(index, player);
    }
Ejemplo n.º 20
0
        public void AddMainMenuModButton(MainMenuWindow mainMenu, Manager manager)
        {
            Panel buttonPanel = (Panel)MainMenuWindowPanelField.GetValue(mainMenu);

            Button exitButton;

            if (!buttonPanel.FindControlRecursive(out exitButton, b => b.Text == "Exit"))
            {
                return;
            }

            Button modsButton = new Button(manager);

            modsButton.Init();
            modsButton.Width    = 200;
            modsButton.Top      = exitButton.Top;
            modsButton.Left     = (buttonPanel.Width - modsButton.Width) / 2;
            modsButton.Margins  = new Margins(0, 2, 0, 2);
            modsButton.Text     = "Mods";
            buttonPanel.Height += modsButton.Height + 4;
            modsButton.Click   += MainMenuModsButtonClick;
            buttonPanel.Add(modsButton);

            exitButton.Top = modsButton.Top + modsButton.Height + modsButton.Margins.Bottom + exitButton.Margins.Top;

            if (!mainMenu.FindControlRecursive(out _gnomoriaVersionLabel, l => l.Text.StartsWith("v")))
            {
                return;
            }

            _gnomoriaVersionLabel.Text = "Gnomoria " + _gnomoriaVersionLabel.Text;

            _gnomodiaVersionLabel = new Label(manager);
            _gnomodiaVersionLabel.Init();
            _gnomodiaVersionLabel.Alignment = Alignment.MiddleRight;
            _gnomodiaVersionLabel.Text      = "Gnomodia v" + typeof(ModDialog).Assembly.GetInformationalVersion();
            mainMenu.Add(_gnomodiaVersionLabel);

            Reset(mainMenu, null, null);
        }
Ejemplo n.º 21
0
        protected override void OnInitialize(InitializeDirectXEventArgs e)
        {
            IDirect2DProvider direct2D         = e.DirectX.Direct2D;
            BitmapProperties1 bitmapProperties = new BitmapProperties1()
            {
                DpiX          = e.Settings.Dpi,
                DpiY          = e.Settings.Dpi,
                PixelFormat   = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.B8G8R8A8_UNorm, SharpDX.Direct2D1.AlphaMode.Premultiplied),
                BitmapOptions = BitmapOptions.Target,
            };

            uiSurface = ToDispose(new Bitmap1(direct2D.Context,
                                              new Size2(e.Settings.ScreenWidth, e.Settings.ScreenHeight), bitmapProperties));

            Overlay = ToDispose(Overlay.FromDescription(
                                    new OverlayDescription(width: e.Settings.ScreenWidth,
                                                           height: e.Settings.ScreenHeight)));
            Overlay.BeginDesign();

            Panel panel = new Panel()
            {
                Position = new SharpDX.Vector2(512, 192), Width = 320, Height = 92
            };
            Label label = new Label()
            {
                Position = new SharpDX.Vector2(8, 8), Text = "stereo"
            };

            panel.Add(label);
            Overlay.Add(panel);

            Overlay.EndDesign(e.DirectX);

            effectGraph = CreateEffectGraph(direct2D);
            direct2D.Context.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Grayscale;
        }
Ejemplo n.º 22
0
        public void LoadContent()
        {
            MainPanel = new Panel(GameConstants.Content.Load <Texture2D>("Panels/menu/MenuBG"), new Vector2(0, 0));
            switch (iLevel)
            {
            case 0:
                peHeader = new PanelElement(GameConstants.Content.Load <Texture2D>("Story/story0"), true);
                break;

            case 2:
                peHeader = new PanelElement(GameConstants.Content.Load <Texture2D>("Story/story1"), true);
                break;

            case 4:
                peHeader = new PanelElement(GameConstants.Content.Load <Texture2D>("Story/story2"), true);
                break;

            default:
                peHeader = new PanelElement(GameConstants.Content.Load <Texture2D>("Story/storyTest"), true);
                break;
            }

            MainPanel.Add(peHeader, new Vector2(0f, 0f));
        }
Ejemplo n.º 23
0
        public static Panel ToSAM(this SurfaceData surfaceData, IEnumerable <PanelDataType> panelDataTypes = null)
        {
            if (surfaceData == null)
            {
                return(null);
            }

            ParameterSet parameterSet = Create.ParameterSet(ActiveSetting.Setting, surfaceData);

            if (panelDataTypes != null)
            {
                foreach (PanelDataType panelDataType in panelDataTypes)
                {
                    List <double> values = surfaceData.AnnualSurfaceResult <double>(panelDataType);
                    if (values == null)
                    {
                        continue;
                    }

                    JArray jArray = new JArray();
                    values.ForEach(x => jArray.Add(x));

                    parameterSet.Add(panelDataType.Text(), jArray);
                }
            }

            PanelType panelType = Query.PanelType(surfaceData.BEType);

            PlanarBoundary3D planarBoundary3D = null;

            Panel panel = Analytical.Create.Panel(new Construction(surfaceData.BEName), panelType, planarBoundary3D);

            panel.Add(parameterSet);

            return(panel);
        }
Ejemplo n.º 24
0
        public override void RenderView(System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer)
        {
            writer.Write("<!DOCTYPE html>");
            writer.Write("<head>");
            writer.Write("<title>后台管理中心 - " + AppConfig.WebTitle + "</title>");
            writer.Write("</head><body></body>");
            var x = Html.X();

            writer.Write(x.ResourceManager().ToHtmlString());
            #region 总体布局
            var viewPort = new Viewport();
            viewPort.Layout = "border";
            var _copyright = new Panel();
            _copyright.Title       = AppConfig.WebName + " 版权所有";
            _copyright.TitleAlign  = TitleAlign.Center;
            _copyright.Collapsible = false;
            _copyright.Region      = Region.South;
            _copyright.Split       = true;
            var _menu = new Panel();
            _menu.Title       = "导航菜单";
            _menu.Collapsible = true;
            _menu.Region      = Region.West;
            _menu.Split       = true;
            _menu.Width       = 200;
            var _workArea = new Ext.Net.TabPanel();
            _workArea.Title  = "欢迎使用";
            _workArea.Region = Region.Center;
            _workArea.ID     = "tabWork";
            var _title = new Panel();
            _title.Title       = AppConfig.WebTitle;
            _title.Collapsible = false;
            _title.Region      = Region.North;
            _title.Split       = true;
            viewPort.Items.Add(_title);
            viewPort.Items.Add(_workArea);
            viewPort.Items.Add(_copyright);
            viewPort.Items.Add(_menu);
            #endregion

            #region 个人区
            var _personPanel = new Ext.Net.Panel();
            _personPanel.Collapsed   = true;
            _personPanel.Collapsible = true;
            _personPanel.Title       = "欢迎使用";
            _personPanel.Height      = 110;
            _personPanel.BodyPadding = 10;
            _personPanel.Layout      = "table";
            _personPanel.LayoutConfig.Add(new TableLayoutConfig()
            {
                Columns = 2
            });
            Image avatarImg = new Image();
            avatarImg.RowSpan = 2;
            avatarImg.Width   = avatarImg.Height = 70;
            //avatarImg.ImageUrl = BaseResource.avatar;
            _personPanel.Add(avatarImg);
            _personPanel.Add(new Label(UserInfo.Username));

            ButtonGroup buttonGroup = new ButtonGroup();
            buttonGroup.Width  = 80;
            buttonGroup.Layout = "vbox";
            buttonGroup.Add(new Button()
            {
                Icon          = Ext.Net.Icon.Key,
                Text          = "修改密码",
                ID            = "btnChangePassword",
                OnClientClick = "App.winChangePassword.show();App.winChangePassword.getLoader().load();"
            });

            var btnExit = new Button()
            {
                Text = "安全退出",
                ID   = "btnExit",
                Icon = Icon.KeyDelete
            };

            buttonGroup.Add(btnExit);
            _personPanel.Add(buttonGroup);
            _menu.Add(_personPanel);
            var winChangePassword = new Window()
            {
                Icon        = Icon.Key,
                BodyPadding = 10,
                Width       = 300,
                Height      = 210,
                Modal       = true,
                Hidden      = true,
                AutoShow    = false,
                ID          = "winChangePassword",
                Title       = "修改密码",
                Loader      = new ComponentLoader()
                {
                    Url  = Url.Action("changePassword", "account"),
                    Mode = LoadMode.Frame
                }
            };
            #endregion

            var _menuPanel = new TreePanel()
            {
                Title       = "功能菜单",
                Height      = 500,
                RootVisible = false,
                ID          = "mainMenu"
            };

            var _menuStore = new TreeStore()
            {
                NodeParam = "parentId"
            };
            _menuStore.Proxy.Add(x.AjaxProxy().Url(Url.Action("GetMenus")).ActionMethods(y => y.Read = HttpMethod.POST));
            //_menuStore.ReadData += _menuStore_ReadData;
            _menuPanel.Store.Add(_menuStore);
            _menuPanel.Root.Add(new Node()
            {
                NodeID   = "0",
                Text     = "Root",
                Expanded = true
            });
            _menu.Add(_menuPanel);
            var itemClick = _menuPanel.DirectEvents.ItemClick;
            itemClick.Before = "var tree=arguments[0],eventType=arguments[1],eventName=arguments[2],extraParams=arguments[3];var tab = App.tabWork.getComponent('menu' + extraParams.menuid);if (tab) {App.tabWork.setActiveTab(tab);return false;}return tree.getStore().getNodeById(extraParams.menuid).isLeaf();";
            itemClick.Url    = Url.Action("OpenPage");
            itemClick.ExtraParams.Add(new Parameter("menuid", "record.data.id", ParameterMode.Raw));
            writer.Write(viewPort.ToBuilder().ToHtmlString());
        }
Ejemplo n.º 25
0
		public static void Execute(Atom parent)
		{
			var code = new Div ();

			new Div (d=>{
				d.ClassName="bs-docs-example";

				UI.CreateContainer( d, ct=>{

					UI.CreateRowFluid(ct, r=>{

						new Div(r, sp=>{
							sp.ClassName="span5";

							var p1 =CreatePanel("Apps");

							new Div(pi=>{
								pi.ClassName="c-icons";
								pi.Append("<style>img {height: 40px;}  .c-icon {height: 95px;}</style>");

								foreach( var app in GetApps()){
									new ImgPicture(pi, img=>{
										img.Img.Src=app.Icon;
										img.Text=app.Title;
										img.Clicked+= (e) =>{e.PreventDefault(); app.Title.LogInfo();};
									});
								}
								p1.Add(pi);
							});

							var p2 =CreatePanel("Demo");

							var color = new TextField();
							var bb = new Button("Change background");
							bb.Clicked+= (e) => p2.Body.Style.BackgroundColor= color.Value;
							var bc = new Button("collapse");
							bc.Clicked+= (e) =>  p2.Collapse();

							p2.Add(color);
							p2.Add(bb);
							p2.Add(bc);

							sp.JQuery.Append(p1).Append(p2);


						});

						new Div(r, sp=>{
							sp.ClassName="span5";

							var p1 =CreatePanel("El Coyote");

							new Div( cy=>{  
								cy.ClassName="span2";  
								new Image(cy,i=>{  
									i.Src="img/coyote.jpg";  
									i.Style.Height="100px";  
								});  
								p1.Add(cy);
							});  

							new Div( cy=>{  
								cy.ClassName="span10";  
								cy.Append(@"<i><b>El <a href='https://es.wikipedia.org/wiki/Coyote' title='Coyote' target='_blank'>Coyote</a> y el <a href='https://es.wikipedia.org/wiki/Geococcyx_californianus' title='Geococcyx californianus' target='_blank'>Correcaminos</a></b></i> (<i><b>Wile E. Coyote</b> and the <b>Road Runner</b></i>) son los personajes de una serie <a href='https://es.wikipedia.org/wiki/Estados_Unidos' title='Estados Unidos' target='_blank'>estadounidense</a> de <a href='https://es.wikipedia.org/wiki/Dibujos_animados' title='Dibujos animados' target='_blank'>dibujos animados</a> creada en el año de <a href='https://es.wikipedia.org/wiki/1949' title='1949' target='_blank'>1949</a> por el animador <a href='https://es.wikipedia.org/wiki/Chuck_Jones' title='Chuck Jones' target='_blank'>Chuck Jones</a> para <a href='https://es.wikipedia.org/wiki/Warner_Brothers' title='Warner Brothers' target='_blank'>Warner Brothers</a>. Chuck Jones se inspiró para crear a estos personajes en un libro de <a href='https://es.wikipedia.org/wiki/Mark_Twain' title='Mark Twain' target='_blank'>Mark Twain</a>, titulado <i>Roughin It</i>, en el que Twain denotaba que los coyotes hambrientos podrían cazar un correcaminos.  
<a href='https://es.wikipedia.org/wiki/El_Coyote_y_el_Correcaminos' title='Coyote' target='_blank'>El Coyote (wikipedia)</a> ");  
								p1.Add(cy);
							});  


							var p2 =CreatePanel("Table");
							var tb = new Table<App>("title");
							tb.Load(GetApps());
							p2.Add(tb);
							sp.JQuery.Append(p1).Append(p2);


						});

					});

				});


				var wn=1;  

				new Button(d, bt=>{
					bt.Text="Window I";  
					bt.Clicked+=evt=>{  
						new Panel( new PanelOptions{Overlay=true}){
							Caption="Window " +(wn++).ToString(),
							Left=(wn*5).ToString()+"px",  
							Top=(wn*15).ToString()+"px",  
							Width="300px",  
							Height="100px",

						}.Show();  
					};
				});


				new Button(d, bt=>{
					bt.Text="Window II";  
					bt.Clicked+=evt=>{  
						var panel= new Panel( new PanelOptions{
							Overlay=true,
							Caption="Custom Close Icon and Handler",
							Left="200px",  
							Top="300px",  
							Width="auto",  
							CloseIconClass="icon-th-large",
							CloseIconHandler=p=>{
								p.Caption="Close icon changed !!!";
								p.CloseIcon.ClassName= "icon-remove-circle";
								p.CloseIconHandler= pn=> {pn.Close(); "Panel was closed".LogError(5000); };
								p.Height="400px";
							}

						});

						panel.Add( new Button(b=>{
							b.Text="click me !";
							b.Style.Width="100%";
							b.Style.Height="100%";
							b.Clicked+= (e) => "button clicked".LogSuccess();

						}));

						panel.Show();


					};
				});


				new Button(d, bt=>{
					bt.Text="Window III";  
					bt.Clicked+=evt=>{  
						var panel= new Panel( new PanelOptions{
							Overlay=true,
							Caption="no closable, no collapsible",
							Left="200px",  
							Top="300px",  
							Width="auto",  
							Collapsible=false,
							Closable=false,
						});

						panel.Add( new Button(b=>{
							b.Text="click me !";
							b.Style.Width="100%";
							b.Style.Height="100%";
							b.Clicked+= (e) => {
								panel.Caption ="now closable and  collapsible";
								panel.Closable=true;
								panel.Collapsible=true;
								b.Disabled=true;
							};

						}));

						panel.Show();


					};
				});


				d.JQuery.Append("C# code".Header(4)).Append(code);
				parent.Append(d);
			});

			  

			var rq =jQuery.GetData<string> ("code/demopanels.html");
			rq.Done (s=> code.InnerHTML=s);

		}
Ejemplo n.º 26
0
		private void AddNews(string author, string date, string title, string message, int num) {
			GroupPanel newsPnl = ScreenManager.MainWindow.ClientArea.Controls["InsaneRO News"] as GroupPanel;
			Panel pnl = new Panel(WindowManager);
			pnl.Init();
			pnl.Text = "News_" + num;
			pnl.Tag = num;
			pnl.Width = newsPnl.ClientWidth - 20;
			pnl.Height = 210;
			pnl.Left = 10;
			pnl.Top = (num * 10) + (num * 210) + 10;
			pnl.BevelBorder = EBevelBorder.All;
			pnl.BevelMargin = 1;
			pnl.BevelStyle = EBevelStyle.Flat;
			pnl.Color = Color.Transparent;
			pnl.Passive = true;

			Label lblTitle = new Label(WindowManager);
			lblTitle.Init();
			lblTitle.Skin.Layers[0].Text.Font.Resource = WindowManager.Skin.Fonts[WindowManager.Skin.Controls["Dialog"].Layers["TopPanel"].Attributes["CaptFont"].Value].Resource;
			lblTitle.Text = "'" + title + "' - Von " + author + " (" + date + ")";
			lblTitle.TextColor = new Color(81, 172, 232);
			lblTitle.Top = 5;
			lblTitle.Left = 5;
			lblTitle.Width = pnl.ClientWidth - 15;
			lblTitle.Height = 24;
			lblTitle.Alignment = EAlignment.TopLeft;
			pnl.Add(lblTitle);

			Label lblMessage = new Label(WindowManager);
			lblMessage.Init();
			lblMessage.Text = "";
			lblMessage.TextLines.AddRange(message.Split(new string[] { Environment.NewLine }, StringSplitOptions.None));
			lblMessage.Top = 5 + 5 + 24;
			lblMessage.Left = 10;
			lblMessage.Width = pnl.ClientWidth - 20;
			lblMessage.Height = pnl.ClientHeight - 15 - 24;
			lblMessage.Ellipsis = false;
			lblMessage.Alignment = EAlignment.TopLeft;
			lblMessage.Autosize = true;
			lblMessage.Draw += new DrawEventHandler(lblMessage_Draw);
			pnl.Add(lblMessage);

			newsPnl.Add(pnl);
		}
Ejemplo n.º 27
0
        static void Main(string[] args)
        {
            var mainPanel = new Panel();
            mainPanel.Name = "mainPanle";
            mainPanel.Width = Application.STANDARD_ROOT_BOUNDARY.Width - 12;
            mainPanel.Height = Application.STANDARD_ROOT_BOUNDARY.Height - 6;
            mainPanel.Top = 3;
            mainPanel.Left = 6;

            #region Left Side
            var leftBox = new Groupbox();
            leftBox.Name = "leftBox";
            leftBox.Header = "Left Box";
            leftBox.Top = leftBox.Left = 0;
            leftBox.Width = mainPanel.Width / 2;
            leftBox.Height = mainPanel.Height;

            var lblLeftStatus = new Label("Status:");
            lblLeftStatus.Name = "lblLeftStatus";

            lblLeftStatusText = new Label();
            lblLeftStatusText.Name = "lblLeftStatusText";
            lblLeftStatusText.Left = lblLeftStatus.Text.Length;
            lblLeftStatusText.Width = leftBox.Width - lblLeftStatus.Width;
            lblLeftStatusText.Align = ContentAlign.Right;

            var btnLeftIncrement = new Button("Increment");
            btnLeftIncrement.Top = 1;
            btnLeftIncrement.Name = "btnLeftIncrement";
            btnLeftIncrement.Pressed += BtnLeftIncrementOnPressed;

            var btnLeftClear = new Button("Clear");
            btnLeftClear.Top = 2;
            btnLeftClear.Name = "btnLeftClear";
            btnLeftClear.Pressed += (sender, eventArgs) => lblLeftStatusText.Text = "";

            var txtLeftText = new Textbox();
            txtLeftText.Text = "asd123";
            txtLeftText.Top = 3;
            txtLeftText.Left = 21;
            txtLeftText.Width = 10;
            txtLeftText.BackColor = ConsoleColor.Gray;
            txtLeftText.ForeColor = ConsoleColor.Black;
            txtLeftText.Name = "txtLeftText";
            txtLeftText.EnterPressed += (sender, eventArgs) => lblLeftStatusText.Text = txtLeftText.Text;

            var btnLeftSetText = new Button("Set this text =>");
            btnLeftSetText.Top = 3;
            btnLeftSetText.Name = "btnLeftSetText";
            btnLeftSetText.Pressed += (sender, eventArgs) => lblLeftStatusText.Text = txtLeftText.Text;

            var chkLeftMoveDir = new Checkbox("Move button up");
            chkLeftMoveDir.Top = 5;
            chkLeftMoveDir.Left = 12;
            chkLeftMoveDir.Name = "chkLeftMoveDir";
            chkLeftMoveDir.Checked = CheckState.Unchecked;

            var prgLeftMoveButton = new Progressbar();
            prgLeftMoveButton.Top = 6;
            prgLeftMoveButton.Left = 12;
            prgLeftMoveButton.Name = "prgLeftMoveButton";
            prgLeftMoveButton.Width = chkLeftMoveDir.Text.Length + 4;
            prgLeftMoveButton.Value = 10;

            var lblLeftPrgDesc = new Label(@"^ Progressbar ^");
            lblLeftPrgDesc.Top = 7;
            lblLeftPrgDesc.Left = 14;
            lblLeftPrgDesc.Name = "lblLeftPrgDesc";

            var myPlayground = new Playground(7, 14);
            myPlayground.Name = "playground";
            myPlayground.Top = 9;
            myPlayground.Left = 14;
            myPlayground.BackColor = ConsoleColor.Blue;
            myPlayground.ForeColor = ConsoleColor.Red;
            myPlayground[0, 0] = 'x';
            myPlayground[2, 2] = 'x';
            myPlayground[4, 4] = 'x';
            myPlayground[6, 6] = 'o';
            myPlayground[4, 8] = 'x';
            myPlayground[2, 10] = 'x';
            myPlayground[0, 12] = 'x';

            var btnLeftMove = new Button("Move");
            btnLeftMove.Top = 4;
            btnLeftMove.Name = "btnLeftMove";
            btnLeftMove.Pressed += (sender, eventArgs) =>
                {
                    var mv = chkLeftMoveDir.Checked == CheckState.Checked ? -1 : 1;
                    if(btnLeftMove.Top + mv < btnLeftMove.Container.Height - 3 &&
                       btnLeftMove.Top + mv > 3)
                        btnLeftMove.Top += mv;
                    prgLeftMoveButton.Value = (int)(((btnLeftMove.Top - 2) / (float)(btnLeftMove.Container.Height - 6)) * 100);
                };

            leftBox.Add(lblLeftStatus);
            leftBox.Add(lblLeftStatusText);
            leftBox.Add(btnLeftIncrement);
            leftBox.Add(btnLeftClear);
            leftBox.Add(btnLeftSetText);
            leftBox.Add(txtLeftText);
            leftBox.Add(btnLeftMove);
            leftBox.Add(chkLeftMoveDir);
            leftBox.Add(prgLeftMoveButton);
            leftBox.Add(lblLeftPrgDesc);
            leftBox.Add(myPlayground);
            #endregion

            #region Right Side
            var rightBox = new Groupbox();
            rightBox.Name = "rightBox";
            rightBox.Header = "Right Box";
            rightBox.Top = 0;
            rightBox.Left = mainPanel.Width / 2;
            rightBox.Width = mainPanel.Width / 2;
            rightBox.Height = mainPanel.Height;

            var rightRightBox = new Groupbox();
            rightRightBox.Name = "rightRightBox";
            rightRightBox.Header = "Checkbox!";
            rightRightBox.Top = 1;
            rightRightBox.Width = rightBox.Width / 2 - 2;
            rightRightBox.Height = 8;
            for (int i = 0; i < 4; i++)
                rightRightBox.Add(new Checkbox("Foo" + i) { Name = "foo" + i, Top = i });

            var rightLeftBox = new Groupbox();
            rightLeftBox.Name = "rightLeftBox";
            rightLeftBox.Header = "Radiobutton!";
            rightLeftBox.Top = 1;
            rightLeftBox.Left = rightBox.Width / 2 - 2;
            rightLeftBox.Width = rightBox.Width / 2 + 2;
            rightLeftBox.Height = 8;
            for (int i = 0; i < 4; i++)
                rightLeftBox.Add(new RadioButton("Bar" + i) { Name = "bar" + i, Top = i });

            var lblRightRadioDesc = new Label("Radiobuttons can have groups:");
            lblRightRadioDesc.Top = rightLeftBox.Height + 2;
            lblRightRadioDesc.Name = "lblDesc";
            for (int i = 0; i < 6; i++)
                rightBox.Add(new RadioButton("asd" + i) { Text = "Group" + (i / 3),
                                                          Name = "chk" + i.ToString(),
                                                          Top = (i % 3) + rightRightBox.Height + 3,
                                                          Left = (i / 3) * 15 + 2,
                                                          ComboboxGroup = "grp" + (i / 3) });

            rightBox.Add(rightRightBox);
            rightBox.Add(rightLeftBox);
            rightBox.Add(lblRightRadioDesc);
            #endregion

            mainPanel.Add(leftBox);
            mainPanel.Add(rightBox);

            var app = new Application(mainPanel);
            app.FocusManager = new FocusManager(mainPanel, btnLeftIncrement);
            app.Name = "FoggyConsole";
            app.Run();
        }
Ejemplo n.º 28
0
        public void LoadContent()
        {
            background = GameConstants.Content.Load <Texture2D>("Panels/BGScore");

            MainPanel = new Panel(GameConstants.Content.Load <Texture2D>("Panels/panel"),
                                  new Vector2(0.1f * GameConstants.WINDOWSIZE.X,
                                              0.1f * GameConstants.WINDOWSIZE.Y));

            string score    = " Score: " + (ilevelscore - iTimeBonus); //TODO: Replaxe Spaces with \#  code
            string tbon     = "Time Bonus:  " + iTimeBonus;
            string retry    = "   Retry   ";
            string sumscore = " Result: " + ilevelscore;

            peCoin = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/coin"), true);      // Icon of Coin
            ptCoin = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);      // Text: number of Coins
            ptCoin.AddText(GameConstants.lucidaConsole, "   " + ilevelCoins, Color.White);
            ptScore = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);     // Text: actual Score
            ptScore.AddText(GameConstants.lucidaConsole, score, Color.White);
            ptTimebonus = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true); //Text: actual TimeBonus
            ptTimebonus.AddText(GameConstants.lucidaConsole, tbon, Color.White);
            ptScoreSum = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);  // Text: Result:
            ptScoreSum.AddText(GameConstants.lucidaConsole, sumscore, Color.White);

            pbtRetry = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/button"), true); // Button: retry
            ptRetry  = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);
            ptRetry.AddText(GameConstants.lucidaConsole, retry, Color.White);
            ptRetryS = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true); // Button: retry selected
            ptRetryS.AddText(GameConstants.lucidaConsole, retry, Color.OrangeRed);

            //LOADNG THE ELEMENTS
            if (!mustRetry)
            {
                string pay = "Pay $" + (ilevelCoins * 1 / 2);
                ptText     = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/ConfirmText"), true);    // Text: Main-Info Text
                pePictuer  = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/door_0-0_short"), true); // Sprite of Warden or Door
                pbtConfirm = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/button"), true);         // Button: pay fee and go on
                ptConfirm  = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true);
                ptConfirm.AddText(GameConstants.lucidaConsole, pay, Color.White);
                ptConfirmS = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/void"), true); // Button Confirm Selected
                ptConfirmS.AddText(GameConstants.lucidaConsole, pay, Color.OrangeRed);
            }
            else
            {
                ptText    = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/RetryText"), true);         // Text: Main-Info Text
                pePictuer = new PanelElement(GameConstants.Content.Load <Texture2D>("Panels/door_riegel_short"), true); // Sprite of Warden or Door
                pePictuer.AddTexture(GameConstants.Content.Load <Texture2D>("Panels/door_0-0_short"));
            }

            // FILLING THE PANEL
            MainPanel.Add(peCoin, new Vector2(0.07f, 0.1f));
            MainPanel.Add(ptCoin, new Vector2(0.15f, 0.1f));
            MainPanel.Add(ptScore, new Vector2(0.6f, 0.1f));
            MainPanel.Add(ptTimebonus, new Vector2(0.6f, 0.18f));
            MainPanel.Add(ptScoreSum, new Vector2(0.6f, 0.26f));
            MainPanel.Add(ptText, new Vector2(0.45f, 0.3f));
            MainPanel.Add(pePictuer, new Vector2(0.07f, 0.3f));
            MainPanel.Add(pbtRetry, new Vector2(0.6f, 0.75f));
            MainPanel.Add(ptRetry, new Vector2(0.65f, 0.76f));
            MainPanel.Add(ptRetryS, new Vector2(0.65f, 0.76f));
            if (!mustRetry)
            {
                MainPanel.Add(pbtConfirm, new Vector2(0.2f, 0.75f));
                MainPanel.Add(ptConfirm, new Vector2(0.25f, 0.76f));
                MainPanel.Add(ptConfirmS, new Vector2(0.25f, 0.76f));
            }
        }
Ejemplo n.º 29
0
        public void InsTitles()
        {
            wintitles = new Panel(manager);
            wintitles.Init();
            wintitles.Text      = "Titles Editor";
            wintitles.Visible   = false;
            wintitles.Resizable = false;
            wintitles.Movable   = true;
            wintitles.Top       = 3;
            wintitles.Left      = 2;
            wintitles.Width     = 350;
            wintitles.Height    = 387;
            wintitles.Alpha     = 200;
            manager.Add(wintitles);

            ListTextureMap = new ListBox(manager);
            ListTextureMap.Init();
            ListTextureMap.Top               = 240;
            ListTextureMap.Left              = 171;
            ListTextureMap.Width             = 173;
            ListTextureMap.Height            = 108;
            ListTextureMap.ItemIndexChanged += new EventHandler(ListTextureMap_ItemIndexChanged);

            ListTextureHave = new ListBox(manager);
            ListTextureHave.Init();
            ListTextureHave.Top               = 32;
            ListTextureHave.Left              = 5;
            ListTextureHave.Width             = 160;
            ListTextureHave.Height            = 316;
            ListTextureHave.ItemIndexChanged += new EventHandler(ListTextureHave_ItemIndexChanged);
            ListTextureHave.MousePress       += new MouseEventHandler(ListTextureHave_MousePress);

            ImgDisplayTexture = new ImageBox(manager);
            ImgDisplayTexture.Init();
            ImgDisplayTexture.Top      = 32;
            ImgDisplayTexture.Width    = 173;
            ImgDisplayTexture.Height   = 173;
            ImgDisplayTexture.Left     = 171;
            ImgDisplayTexture.SizeMode = SizeMode.Stretched;

            btnSave = new Button(manager);
            btnSave.Init();
            btnSave.Text   = "Save";
            btnSave.Top    = 357;
            btnSave.Left   = 269;
            btnSave.Width  = 75;
            btnSave.Height = 23;
            btnSave.Click += new EventHandler(btnSave_Click);

            cbListType = new ComboBox(manager);
            cbListType.Init();
            cbListType.Top               = 8;
            cbListType.Left              = 5;
            cbListType.Width             = 60;
            cbListType.Height            = 21;
            cbListType.ItemIndexChanged += new EventHandler(cbListType_ItemIndexChanged);

            cbListMap = new ComboBox(manager);
            cbListMap.Init();
            cbListMap.Top    = 8;
            cbListMap.Left   = 171;
            cbListMap.Width  = 173;
            cbListMap.Height = 21;

            cbListObj = new ComboBox(manager);
            cbListObj.Init();
            cbListObj.Top               = 8;
            cbListObj.Left              = 71;
            cbListObj.Width             = 94;
            cbListObj.Height            = 21;
            cbListObj.ItemIndexChanged += new EventHandler(cbListObj_ItemIndexChanged);

            cbLayer = new ComboBox(manager);
            cbLayer.Init();
            cbLayer.Top               = 211;
            cbLayer.Left              = 171;
            cbLayer.Width             = 173;
            cbLayer.Height            = 21;
            cbLayer.ItemIndexChanged += new EventHandler(cbLayer_ItemIndexChanged);

            wintitles.Add(ListTextureMap);
            wintitles.Add(ListTextureHave);
            wintitles.Add(ImgDisplayTexture);
            wintitles.Add(btnSave);
            wintitles.Add(cbListType);
            wintitles.Add(cbListMap);
            wintitles.Add(cbListObj);
            wintitles.Add(cbLayer);
            GetData();
        }
Ejemplo n.º 30
0
        public TaskCrafting(Manager manager)
            : base(manager)
        {
            //Set up the window
            TopPanel.Visible    = true;
            BottomPanel.Visible = false;
            Resizable           = false;
            Height = 512;
            Width  = 696;

            imageCaption = new ImageBox(manager);
            imageCaption.Init();
            imageCaption.Left   = 8;
            imageCaption.Width  = 48;
            imageCaption.Height = 48;
            imageCaption.Top    = -4;
            Add(imageCaption);
            Caption.Left    = Description.Left = imageCaption.Left + imageCaption.Width + 8;
            TopPanel.Height = imageCaption.Height + 8;

            grpPnlRecipie = new GroupPanel(manager);
            grpPnlRecipie.Init();
            grpPnlRecipie.Left   = 4;
            grpPnlRecipie.Top    = TopPanel.Height + 2;
            grpPnlRecipie.Width  = (ClientWidth / 2) - 4 - 2;
            grpPnlRecipie.Height = ClientHeight - grpPnlRecipie.Top - 6;
            grpPnlRecipie.Text   = "Recipies";
            grpPnlRecipie.Color  = Color.White;
            Add(grpPnlRecipie);

            grpPnlItem = new GroupPanel(manager);
            grpPnlItem.Init();
            grpPnlItem.Left   = (ClientWidth / 2) + 2;
            grpPnlItem.Top    = TopPanel.Height + 2;
            grpPnlItem.Width  = (ClientWidth / 2) - 6;
            grpPnlItem.Height = ClientHeight - grpPnlRecipie.Top - 6;
            grpPnlItem.Text   = "Item";
            grpPnlItem.Color  = Color.White;
            Add(grpPnlItem);

            pnlItem        = new Panel(manager);
            pnlItem.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
            pnlItem.Init();
            pnlItem.Width       = grpPnlItem.ClientWidth;
            pnlItem.Height      = 64;
            pnlItem.BevelBorder = BevelBorder.Bottom;
            grpPnlItem.Add(pnlItem);

            grpPnlReq = new GroupPanel(manager);
            grpPnlReq.Init();
            grpPnlReq.Left   = -1;
            grpPnlReq.Top    = 62;
            grpPnlReq.Width  = (ClientWidth / 2) - 6;
            grpPnlReq.Height = 84;
            grpPnlReq.Text   = "Requirements";
            grpPnlReq.Color  = Color.White;
            grpPnlItem.Add(grpPnlReq);


            imgItem = new ImageBox(manager);
            imgItem.Init();
            imgItem.Left   = 8;
            imgItem.Width  = 0;
            imgItem.Height = 0;
            imgItem.Top    = 8;
            pnlItem.Add(imgItem);

            lblName = new Label(manager);
            lblName.Init();
            lblName.Left  = imgItem.Width + imgItem.Left + 6;
            lblName.Top   = imgItem.Top;
            lblName.Width = pnlItem.Width - lblName.Left;
            lblName.Font  = FontSize.Default12;
            pnlItem.Add(lblName);

            lblDesc = new Label(manager);
            lblDesc.Init();
            lblDesc.Left      = imgItem.Width + imgItem.Left + 10;
            lblDesc.Top       = lblName.Top + lblName.Height;
            lblDesc.Width     = pnlItem.Width - lblName.Left;
            lblDesc.TextColor = Color.Gray;
            pnlItem.Add(lblDesc);

            lblIngredients = new Label(manager);
            lblIngredients.Init();
            lblIngredients.Left   = 8;
            lblIngredients.Top    = 4;
            lblIngredients.Height = Tile.Height;
            lblIngredients.Text   = "Ingredients:";
            lblIngredients.Width  = (int)manager.Skin.Fonts[0].Resource.MeasureRichString(lblIngredients.Text, manager).X;
            grpPnlReq.Add(lblIngredients);

            lblStation = new Label(manager);
            lblStation.Init();
            lblStation.Left  = 8;
            lblStation.Top   = lblIngredients.Top + lblIngredients.Height + 8;
            lblStation.Text  = "Station:";
            lblStation.Width = (int)manager.Skin.Fonts[0].Resource.MeasureRichString(lblStation.Text, manager).X;
            grpPnlReq.Add(lblStation);

            cmbTopCat = new ComboBox(manager);
            cmbTopCat.Init();
            cmbTopCat.Left  = 8;
            cmbTopCat.Top   = 8;
            cmbTopCat.Width = grpPnlRecipie.Width / 2 - 11;
            cmbTopCat.Items.AddRange(ItemCategory.ItemCategories.Where(x => x.TopLevel).Select(element => element.Name).ToList());
            grpPnlRecipie.Add(cmbTopCat);

            cmbSubCat = new ComboBox(manager);
            cmbSubCat.Init();
            cmbSubCat.Left     = cmbTopCat.Left + cmbTopCat.Width + 2;
            cmbSubCat.Top      = cmbTopCat.Top;
            cmbSubCat.Width    = grpPnlRecipie.Width / 2 - 8;
            cmbSubCat.MaxItems = 128;

            grpPnlRecipie.Add(cmbSubCat);
            cmbSubCat.Items.Add(ItemCategory.All.Name);


            chkHasMaterials = new CheckBox(manager);
            chkHasMaterials.Init();
            chkHasMaterials.Top             = cmbTopCat.Top + cmbTopCat.Height + 8;
            chkHasMaterials.Left            = cmbTopCat.Left;
            chkHasMaterials.Text            = "Have Materials";
            chkHasMaterials.Width           = 106;
            chkHasMaterials.ToolTip.Text    = "Only display items that you have materials for.";
            chkHasMaterials.CheckedChanged += chkHasMaterials_CheckedChanged;
            grpPnlRecipie.Add(chkHasMaterials);

            chkAtStation = new CheckBox(manager);
            chkAtStation.Init();
            chkAtStation.Top             = cmbTopCat.Top + cmbTopCat.Height + 8;
            chkAtStation.Left            = cmbTopCat.Left + chkHasMaterials.Width;
            chkAtStation.Text            = "At Station";
            chkAtStation.Width           = 80;
            chkAtStation.ToolTip.Text    = "Only display items who's crafting station is near.";
            chkAtStation.CheckedChanged += chkAtStation_CheckedChanged;
            grpPnlRecipie.Add(chkAtStation);

            txtSearch = new TextBox(manager);
            txtSearch.Init();
            txtSearch.Top          = cmbTopCat.Top + cmbTopCat.Height + 4;
            txtSearch.Left         = chkAtStation.Left + chkAtStation.Width;
            txtSearch.Text         = "Search...";
            txtSearch.Width        = 131;
            txtSearch.ToolTip.Text = "Only display items that contain or match the search text.";
            txtSearch.FocusGained += txtSearch_FocusGained;
            txtSearch.FocusLost   += txtSearch_FocusLost;
            txtSearch.TextChanged += txtSearch_TextChanged;
            grpPnlRecipie.Add(txtSearch);


            itemSelector = new ControlList <ItemListControl>(manager);
            itemSelector.Init();
            itemSelector.Width  = grpPnlRecipie.ClientWidth - 16;
            itemSelector.Height = grpPnlRecipie.ClientHeight - 16 - chkHasMaterials.Top - chkHasMaterials.Height;
            itemSelector.Left   = 8;
            itemSelector.Top    = chkHasMaterials.Top + chkHasMaterials.Height + 8;
            grpPnlRecipie.Add(itemSelector);

            pnlCraft        = new Panel(manager);
            pnlCraft.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right;
            pnlCraft.Init();
            pnlCraft.Width       = grpPnlItem.ClientWidth;
            pnlCraft.Height      = 56 + 8 + 8;
            pnlCraft.Top         = grpPnlItem.ClientHeight - pnlCraft.Height;
            pnlCraft.BevelBorder = BevelBorder.Top;
            grpPnlItem.Add(pnlCraft);

            grpPnlStats = new GroupPanel(manager);
            grpPnlStats.Init();
            grpPnlStats.Left   = -1;
            grpPnlStats.Top    = grpPnlReq.Top + grpPnlReq.Height;
            grpPnlStats.Width  = grpPnlReq.Width;
            grpPnlStats.Height = (int)Math.Abs(pnlCraft.Top - (grpPnlReq.Top + grpPnlReq.Height)) + 2;
            grpPnlStats.Text   = "Stats";
            grpPnlStats.Color  = Color.White;
            grpPnlItem.Add(grpPnlStats);


            btnCraft = new Button(manager);
            btnCraft.Init();
            btnCraft.Enabled = false;
            btnCraft.Text    = "Craft";
            btnCraft.Left    = (grpPnlItem.Width / 2) - btnCraft.Width - 4;
            btnCraft.Top     = grpPnlItem.ClientHeight - btnCraft.Height - 8;
            btnCraft.Click  += btnCraft_Click;
            grpPnlItem.Add(btnCraft);


            itemSlotOutput[0]   = new Slot(Item.Blank, 0);
            sltOutput           = new SlotContainer(manager, 1, 1);
            sltOutput.ItemSlots = itemSlotOutput;
            sltOutput.Init();
            sltOutput.Left       = (grpPnlItem.ClientWidth / 2) + 4;
            sltOutput.Top        = grpPnlItem.ClientHeight - sltOutput.Height;
            sltOutput.MoveItems += sltOutput_MoveItems;
            sltOutput.CanAdd     = false;

            spnCraft = new SpinBox(manager, SpinBoxMode.Range);
            spnCraft.Init();
            spnCraft.Width        = btnCraft.Width;
            spnCraft.Left         = (grpPnlItem.Width / 2) - spnCraft.Width - 4;
            spnCraft.Minimum      = 0;
            spnCraft.Maximum      = (int)StackSize.Max;
            spnCraft.ReadOnly     = false;
            spnCraft.Rounding     = 0;
            spnCraft.Top          = sltOutput.Top;
            spnCraft.TextChanged += spnCraft_TextChanged;
            grpPnlItem.Add(spnCraft);
            grpPnlItem.Add(sltOutput);

            itemSlotInput[0]   = new Slot(Item.Blank, 0);
            sltInput           = new SlotContainer(manager, 1, 1);
            sltInput.ItemSlots = itemSlotInput;
            sltInput.Init();
            sltInput.Left        = btnCraft.Left - sltInput.ClientWidth;
            sltInput.Top         = grpPnlItem.ClientHeight - sltOutput.Height + 4;
            sltInput.CheckItems += sltInput_CheckItems;
            sltInput.MoveItems  += sltInput_MoveItems;
            sltInput.CanAdd      = true;
            grpPnlItem.Add(sltOutput);
            grpPnlItem.Add(sltInput);

            prgFuel = new ProgressBar(manager);
            prgFuel.Init();
            prgFuel.Color        = Color.Orange;
            prgFuel.Text         = "Fuel";
            prgFuel.ToolTip.Text = "Fuel";
            prgFuel.Top          = pnlCraft.Top + 4;
            prgFuel.Left         = sltInput.Left;
            prgFuel.Width        = sltInput.ClientWidth - 8;
            prgFuel.Height       = 15;
            grpPnlItem.Add(prgFuel);

            prgOutput = new ProgressBar(manager);
            prgOutput.Init();
            prgOutput.Color        = Color.ForestGreen;
            prgOutput.Text         = "Output";
            prgOutput.ToolTip.Text = "Output";
            prgOutput.Top          = pnlCraft.Top + 4;
            prgOutput.Left         = sltOutput.Left;
            prgOutput.Width        = sltOutput.ClientWidth - 8;
            prgOutput.Height       = 15;
            grpPnlItem.Add(prgOutput);



            imgStationNeeded = new ImageBox(Manager);
            imgStationNeeded.Init();
            grpPnlReq.Add(imgStationNeeded);

            lblStationNeeded = new Label(Manager);
            lblStationNeeded.Init();
            grpPnlReq.Add(lblStationNeeded);

            ItemStatLabels = new Label[15];
            for (int j = 0; j < 15; j++)
            {
                ItemStatLabels[j] = new Label(Manager);
                ItemStatLabels[j].Init();
                ingredientsNeeded.Add(Tuple.Create(new ImageBox(Manager), new Label(Manager)));
                ingredientsNeeded[j].Item1.Init();
            }

            HideAll();

            SetupCraftingControls(manager);
            Center();
        }
Ejemplo n.º 31
0
        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);

            #region 总体布局
            _viewPort = new Viewport();
            _viewPort.Layout = "border";
            _copyright = new Panel();
            _copyright.Title = "版权";
            _copyright.TitleAlign = TitleAlign.Center;
            _copyright.Collapsible = false;
            _copyright.Region = Region.South;
            _copyright.Split = true;
            _menu = new Panel();
            _menu.Title = "导航菜单";
            _menu.Collapsible = true;
            _menu.Region = Region.West;
            _menu.Split = true;
            _menu.Width = 200;
            _workArea = new Ext.Net.TabPanel();
            _workArea.Title = "欢迎使用";
            _workArea.Region = Region.Center;
            _workArea.ID = "tabWork";
            _title = new Panel();
            _title.Title = WebName;
            _title.Collapsible = false;
            _title.Region = Region.North;
            _title.Split = true;
            _viewPort.Items.Add(_title);
            _viewPort.Items.Add(_workArea);
            _viewPort.Items.Add(_copyright);
            _viewPort.Items.Add(_menu);
            #endregion

            #region 个人区
            _personPanel = new Ext.Net.Panel();
            _personPanel.Collapsed = true;
            _personPanel.Collapsible = true;
            _personPanel.Title = "欢迎使用";
            _personPanel.Height = 110;
            _personPanel.BodyPadding = 10;
            _personPanel.Layout = "table";
            _personPanel.LayoutConfig.Add(new TableLayoutConfig()
            {
                Columns = 2
            });
            Image avatarImg = new Image();
            avatarImg.RowSpan = 2;
            avatarImg.Width = avatarImg.Height = 70;
            avatarImg.ImageUrl = BaseResource.avatar;
            _personPanel.Add(avatarImg);
            _personPanel.Add(new Label(userInfo.Username));

            ButtonGroup buttonGroup = new ButtonGroup();
            buttonGroup.Width = 80;
            buttonGroup.Layout = "vbox";
            buttonGroup.Add(new KeyButton()
            {
                Text = "修改密码",
                ID = "btnChangePassword",
                OnClientClick = "App.winChangePassword.show();App.winChangePassword.getLoader().load();"
            });

            btnExit = new Button()
            {
                Text = "安全退出",
                ID = "btnExit",
                Icon = Icon.KeyDelete
            };
            var clickEvent = btnExit.DirectEvents.Click;
            clickEvent.Event += clickEvent_Event;
            clickEvent.EventMask.Set("正在退出");
            clickEvent.Confirmation.ConfirmRequest = true;
            clickEvent.Confirmation.Title = "提示";
            clickEvent.Confirmation.Message = "确定退出?";
            buttonGroup.Add(btnExit);
            _personPanel.Add(buttonGroup);
            _menu.Add(_personPanel);
            winChangePassword = new Window()
            {
                Icon = Icon.Key,
                BodyPadding = 10,
                Width = 300,
                Height = 210,
                Modal = true,
                Hidden = true,
                AutoShow = false,
                ID = "winChangePassword",
                Title = "修改密码",
                Loader = new ComponentLoader()
                {
                    Url = ResolveClientUrl("~/user/changepassword.aspx"),
                    Mode = LoadMode.Frame
                }
            };
            winChangePassword.Loader.LoadMask.Set("正在加载");
            Controls.Add(winChangePassword);
            #endregion

            _menuPanel = new TreePanel()
            {
                Title = "功能菜单",
                Height = 500,
                RootVisible = false,
                ID = "mainMenu"
            };

            _menuStore = new TreeStore()
            {
                NodeParam = "parentId"
            };
            _menuStore.ReadData += _menuStore_ReadData;
            _menuPanel.Store.Add(_menuStore);
            _menuPanel.Root.Add(new Node()
            {
                NodeID = "0",
                Text = "Root",
                Expanded = true
            });
            _menu.Add(_menuPanel);
            var itemClick = _menuPanel.DirectEvents.ItemClick;
            itemClick.Before = "var tree=arguments[0],eventType=arguments[1],eventName=arguments[2],extraParams=arguments[3];var tab = App.tabWork.getComponent('menu' + extraParams.id);if (tab) {App.tabWork.setActiveTab(tab);return false;}return tree.getStore().getNodeById(extraParams.id).isLeaf();";
            itemClick.EventMask.Set("正在加载");
            itemClick.Event += itemClick_Event;
            itemClick.ExtraParams.Add(new Parameter("id", "record.data.id", ParameterMode.Raw));

            #region 隐藏顶级窗口
            _winParentWindow = new Window();
            _winParentWindow.Hidden = true;
            _winParentWindow.Loader = new ComponentLoader();
            _winParentWindow.Loader.Mode = LoadMode.Frame;
            _winParentWindow.Width = 800;
            _winParentWindow.Modal = true;
            _winParentWindow.Height = 600;
            _winParentWindow.ID = "_topWin";
            Controls.Add(_winParentWindow);
            #endregion

            Controls.Add(_viewPort);
        }
Ejemplo n.º 32
0
        public AboutModsPanel(Panel containingPanel, IModManager modManager, int desiredHeight = 500, int desiredWidth = 750)
        {
            _modManager = modManager;

            ModListBox = new ListBox(containingPanel.Manager);
            ModListBox.Init();
            ModListBox.Top           = ModListBox.Margins.Top;
            ModListBox.Left          = ModListBox.Margins.Left;
            ModListBox.Width         = 250;
            ModListBox.Height        = desiredHeight - containingPanel.ClientMargins.Vertical - ModListBox.Top - ModListBox.Margins.Bottom;
            ModListBox.HideSelection = false;

            ModListBox.c81fb310624c15a101535d14adc9ec383.Add("Gnomodia");
            ModListBox.ItemIndexChanged += ModListBoxOnItemIndexChanged;

            foreach (var modMetadata in modManager.ModMetadata)
            {
                ModListBox.c81fb310624c15a101535d14adc9ec383.Add(modMetadata.Name);
            }

            containingPanel.Add(ModListBox);

            ModInfoPanel = new LoweredPanel(containingPanel.Manager);
            ModInfoPanel.Init();
            ModInfoPanel.Left       = ModListBox.Left + ModListBox.Width + ModListBox.Margins.Right + ModInfoPanel.Margins.Left;
            ModInfoPanel.Top        = ModInfoPanel.Margins.Top;
            ModInfoPanel.Width      = desiredWidth - ModInfoPanel.Left - ModInfoPanel.Margins.Right;
            ModInfoPanel.Height     = desiredHeight - containingPanel.ClientMargins.Vertical - ModInfoPanel.Top - ModInfoPanel.Margins.Bottom;
            ModInfoPanel.AutoScroll = true;
            ModInfoPanel.HorizontalScrollBarEnabled = false;
            ModInfoPanel.VerticalScrollBarShow      = true;
            containingPanel.Add(this.ModInfoPanel);

            _titleLabel = new Label(containingPanel.Manager);
            _titleLabel.Init();
            _titleLabel.Top    = _titleLabel.Margins.Top;
            _titleLabel.Left   = _titleLabel.Margins.Left;
            _titleLabel.Height = 14;
            _titleLabel.Width  = ModInfoPanel.ClientWidth - _titleLabel.Margins.Horizontal;
            _titleLabel.Text   = "";
            ModInfoPanel.Add(_titleLabel);

            _versionLabel = new Label(containingPanel.Manager);
            _versionLabel.Init();
            _versionLabel.Left   = _versionLabel.Margins.Left;
            _versionLabel.Height = 14;
            _versionLabel.Width  = ModInfoPanel.Width - _versionLabel.Margins.Horizontal;
            _versionLabel.Top    = _titleLabel.Top + _titleLabel.Height + _titleLabel.Margins.Bottom + _versionLabel.Margins.Top;
            _versionLabel.Text   = "";
            ModInfoPanel.Add(_versionLabel);

            _authorLabel = new Label(containingPanel.Manager);
            _authorLabel.Init();
            _authorLabel.Left   = _authorLabel.Margins.Left;
            _authorLabel.Height = 14;
            _authorLabel.Width  = ModInfoPanel.Width - _authorLabel.Margins.Horizontal;
            _authorLabel.Top    = _versionLabel.Top + _versionLabel.Height + _versionLabel.Margins.Bottom + _authorLabel.Margins.Top;
            _authorLabel.Text   = "";
            ModInfoPanel.Add(_authorLabel);

            _infoLabel           = new MultilineLabel(containingPanel.Manager);
            _infoLabel.Left      = _infoLabel.Margins.Left;
            _infoLabel.Height    = 0;
            _infoLabel.Top       = _authorLabel.Top + _authorLabel.Height + _authorLabel.Margins.Bottom + _infoLabel.Margins.Top;
            _infoLabel.Width     = ModInfoPanel.ClientWidth - _infoLabel.Margins.Horizontal;
            _infoLabel.Anchor    = Anchors.Top | Anchors.Left | Anchors.Right;
            _infoLabel.Alignment = Alignment.TopLeft;
            ModInfoPanel.Add(_infoLabel);

            ModListBox.ItemIndex = 0;
        }
Ejemplo n.º 33
0
        public WndInfos(BaseObject obj, Vector2f pos)
            : base(obj, 440, pos)
        {
            var header = new Label();

            if (obj is PhysicalObject)
            {
                header.Text += $@"{L["Area"]} :
{L["Mass"]} :
{L["Moment of inertia"]} :
{L["Position"]} :
{L["Velocity"]} :
{L["Momentum"]} :
";
            }

            header.Text      += $@"{L["Energy"]} :
- {L["Kinetic"]} :
  - {L["Linear"]} :
  - {L["Angular"]}
- {L["Potential"]} :
  - {L["Gravity"]} :
  - {L["Attraction"]} :
  - {L["Spring"]} :";
            header.SizeLayout = new Layout2d(130, header.Size.Y);
            var val = new Label
            {
                SizeLayout = new Layout2d(280, header.Size.Y), PositionLayout = new Layout2d(130, 0)
            };

            void UpdateInfos()
            {
                var text  = "";
                var epes  = 0f;
                var eela  = 0f;
                var ecinl = 0f;
                var ecina = 0f;
                var eatt  = 0f;

                switch (obj)
                {
                case PhysicalObject objPhy:
                    ecinl += objPhy.LinearKineticEnergy;
                    ecina += objPhy.AngularKineticEnergy;
                    epes  += objPhy.GravityEnergy;
                    eatt  += objPhy.AttractionEnergy;
                    text  +=
                        $@"{objPhy.Shape.Area(),7:F3} m²
{objPhy.Mass,8:F3} kg
{objPhy.MomentOfInertia,7:F3} kg.m²
{objPhy.Position.DisplayPoint()} m
{objPhy.Velocity.Display()} m/s
{objPhy.Momentum.DisplayPoint()} N.s
";
                    break;

                case Spring ress:
                    eela += ress.ElasticEnergy;
                    break;
                }

                var epot = epes + eela;
                var ecin = ecinl + ecina;
                var etot = epot + ecin;


                text    += $@"{etot,10:F3} J
{ecin,10:F3} J
{ecinl,10:F3} J
{ecina,10:F3} J
{epot,10:F3} J
{epes,10:F3} J
{eatt,10:F3} J
{eela,10:F3} J";
                val.Text = text;
            }

            Ui.Drawn += UpdateInfos;

            Closed += delegate { Ui.Drawn -= UpdateInfos; };

            UpdateInfos();

            var pnl = new Panel {
                SizeLayout = new Layout2d(Size.X, header.Size.Y)
            };

            pnl.Add(header);
            pnl.Add(val);
            Add(pnl);
            Show();
        }
Ejemplo n.º 34
0
        public new void Main()
        {
            if (Settings.UseDebugVideoMode)
            {
                Settings.DisplayVRam = (uint *)Heap.alloc((uint)(Settings.DisplayWidth * Settings.DisplayHeight) * 4);
            }
            else
            {
                Settings.EnterVideoMode();
            }

            Bitmap display = new Bitmap(Settings.DisplayWidth, Settings.DisplayHeight, Settings.DisplayBuffer);

            bool Dragging = false;
            int  xOffset  = 0;
            int  yOffset  = 0;

            byte lastSecond = 0;
            int  fps        = 0;
            int  lFPS       = 0;

            MenuBar = new Panel();
            MenuBar.SetSize(display.Width, 30);
            MenuBar.SetPosition(0, display.Height - MenuBar.Bounds.Height);
            MenuBar.PrimaryColour   = Theme.DesktopBar;
            MenuBar.SecondaryColour = Theme.DesktopBar;
            Button btnMenu = new Button();

            btnMenu.SetPosition(25, 0);
            btnMenu.SetSize(100, MenuBar.Bounds.Height);
            btnMenu.Content = "App Menu";
            btnMenu.OnClick = ToggleMenuButton;
            MenuBar.Add(btnMenu);
            MenuArea         = new Panel();
            MenuArea.Visable = false;
            MenuArea.SetSize(300, (int)(display.Height / 1.25f));
            MenuArea.SetPosition(0, MenuBar.Bounds.Y - MenuArea.Bounds.Height);
            MenuBar.Add(MenuArea);

            Form aWindow = new Login();

            bool toggle = false;

            while (true)
            {
                #region Calculate FPS
                fps++;
                if (lastSecond != RTC.Second)
                {
                    lastSecond = RTC.Second;
                    Console.Write("FPS is ");
                    Console.WriteLine(fps);
                    lFPS = fps;
                    fps  = 0;
                    Console.Write("Allocations ");
                    Console.WriteLine(Heap.totalAllocations);
                }
                #endregion

                Input.Update();

                #region Draw Background
                if (toggle)
                {
                    int  r     = 0;
                    int  g     = 255;
                    int  b     = 50;
                    int  steps = 1;
                    bool skip  = false;
                    for (int i = 1; i <= 768 / steps; i++)
                    {
                        uint colour = (uint)((r << 16) | (g << 8) | b);
                        display.DrawRectangle(0, display.Height - (i * steps), display.Width, steps, colour);
                        if (!skip)
                        {
                            g--;
                        }
                        skip = !skip;
                        if (g < 10)
                        {
                            g = 10;
                        }
                    }
                }
                else
                {
                    display.Clear(Theme.DesktopBackground);
                }
                #endregion

                #region Draw Forms
                CurrentForm    = null;
                CurrentControl = null;
                for (int i = Forms.Count - 1; i >= 0; i--)
                {
                    Forms[i].Draw(display);
                }
                #endregion

                #region Drag Forms
                if (!Dragging)
                {
                    if (CurrentForm != null)
                    {
                        ActiveForm = CurrentForm;
                    }
                    if (CurrentControl != null)
                    {
                        ActiveControl = CurrentControl;
                    }
                }
                if (ActiveForm != null)
                {
                    if (!Dragging)
                    {
                        if (Input.GetMouseButton(0) && ActiveForm.Banner.Contains(Input.MousePosition))
                        {
                            Dragging = true;
                            xOffset  = Input.MousePosition.X - ActiveForm.Bounds.X;
                            yOffset  = Input.MousePosition.Y - ActiveForm.Bounds.Y;
                        }
                    }
                    else
                    {
                        if (!Input.GetMouseButton(0))
                        {
                            Dragging = false;
                        }
                        else
                        {
                            ActiveForm.Bounds.X = Input.MousePosition.X - xOffset;
                            ActiveForm.Bounds.Y = Input.MousePosition.Y - yOffset;
                        }
                    }
                    if (ActiveForm.Bounds.X < 0)
                    {
                        ActiveForm.Bounds.X = 0;
                    }
                    if (ActiveForm.Bounds.Y <= ActiveForm.Banner.Height)
                    {
                        ActiveForm.Bounds.Y = ActiveForm.Banner.Height;
                    }
                    if (ActiveForm.Bounds.X > Settings.DisplayWidth - ActiveForm.Bounds.Width)
                    {
                        ActiveForm.Bounds.X = Settings.DisplayWidth - ActiveForm.Bounds.Width;
                    }
                    if (ActiveForm.Bounds.Y > Settings.DisplayHeight - ActiveForm.Bounds.Height)
                    {
                        ActiveForm.Bounds.Y = Settings.DisplayHeight - ActiveForm.Bounds.Height;
                    }
                }
                #endregion

                #region Draw Taskbar
                bool draw = true;
                if (ActiveForm != null)
                {
                    if (ActiveForm.WindowState == Form.FormWindowState.FullScreen)
                    {
                        draw = false;
                    }
                }
                if (draw)
                {
                    MenuBar.Draw(display);

                    int pos = 150;
                    for (int i = 0; i < Forms.Count; i++)
                    {
                        int btnSize = (Forms[i].Content.Length * GL.fontSize) + 6;
                        display.DrawRectangle(pos, MenuBar.Bounds.Y, btnSize, MenuBar.Bounds.Height, Theme.DesktopBar + 0x202020);
                        display.DrawString(pos + 3, MenuBar.Bounds.Y + (MenuBar.Bounds.Height / 2) - (GL.fontSize / 2), Forms[i].Content, 0);
                        pos += btnSize;
                    }
                }
                #endregion

                #region Handle Clicks
                if (Input.GetMouseButton(0))
                {
                    if (ActiveControl != null)
                    {
                        if (ActiveControl is Button)
                        {
                            ((Button)ActiveControl).OnClick?.Invoke();
                        }
                    }
                }
                #endregion

                #region Draw Time
                if (draw)
                {
                    byte time = RTC.Hour;
                    if (time < 10)
                    {
                        display.DrawNumber(display.Width - 90, display.Height - 25, 0, 0);
                        display.DrawNumber(display.Width - 80, display.Height - 25, time, 0);
                    }
                    else
                    {
                        display.DrawNumber(display.Width - 90, display.Height - 25, time, 0);
                    }
                    display.DrawCharacter(display.Width - 70, display.Height - 25, ':', 0);
                    time = RTC.Minute;
                    if (time < 10)
                    {
                        display.DrawNumber(display.Width - 60, display.Height - 25, 0, 0);
                        display.DrawNumber(display.Width - 50, display.Height - 25, time, 0);
                    }
                    else
                    {
                        display.DrawNumber(display.Width - 60, display.Height - 25, time, 0);
                    }
                    display.DrawCharacter(display.Width - 40, display.Height - 25, ':', 0);
                    time = RTC.Second;
                    if (time < 10)
                    {
                        display.DrawNumber(display.Width - 30, display.Height - 25, 0, 0);
                        display.DrawNumber(display.Width - 20, display.Height - 25, time, 0);
                    }
                    else
                    {
                        display.DrawNumber(display.Width - 30, display.Height - 25, time, 0);
                    }
                }
                #endregion

                // draw fps
                display.DrawNumber(0, 0, lFPS, 0xFF0000);

                #region Draw Cursor
                display.DrawLine(Input.MousePosition.X, Input.MousePosition.Y, Input.MousePosition.X, Input.MousePosition.Y + 10, 0);
                display.DrawLine(Input.MousePosition.X, Input.MousePosition.Y, Input.MousePosition.X + 4, Input.MousePosition.Y + 8, 0);
                display.DrawLine(Input.MousePosition.X, Input.MousePosition.Y + 10, Input.MousePosition.X + 4, Input.MousePosition.Y + 8, 0);
                #endregion

                #region Reorganise Window Layer
                if (ActiveForm != null)
                {
                    if (Forms[0] != ActiveForm)
                    {
                        for (int i = 0; i < Forms.Count; i++)
                        {
                            if (Forms[i] == ActiveForm)
                            {
                                var f = Forms[i];
                                Forms.RemoveAt(i);
                                Forms.Insert(0, f);
                                break;
                            }
                        }
                    }
                }
                #endregion

                GL.Update();

                #region Remove Old Forms
                for (int i = 0; i < Forms.Count; i++)
                {
                    if (Forms[i].WindowState == Form.FormWindowState.Closed)
                    {
                        //if (ActiveControl != null)
                        //{
                        //    if (ActiveForm != null)
                        //    {
                        //        IControl root = ActiveControl.Parent;
                        //        while (root.Parent != null)
                        //        {
                        //            root = root.Parent;
                        //        }
                        //        if (root == Forms[i])
                        //        {
                        //            ActiveControl = null;
                        //        }
                        //    }
                        //}
                        //Forms[i].Dispose();
                        //Forms.RemoveAt(i);
                        ActiveForm     = null;
                        ActiveControl  = null;
                        CurrentForm    = null;
                        CurrentControl = null;
                        break;
                    }
                }
                #endregion

                Thread.Sleep(1000 / 30);
            }
        }
Ejemplo n.º 35
0
        public AboutModsPanel(Panel containingPanel, IModManager modManager, int desiredHeight = 500, int desiredWidth = 750)
        {
            _modManager = modManager;

            ModListBox = new ListBox(containingPanel.Manager);
            ModListBox.Init();
            ModListBox.Top = ModListBox.Margins.Top;
            ModListBox.Left = ModListBox.Margins.Left;
            ModListBox.Width = 250;
            ModListBox.Height = desiredHeight - containingPanel.ClientMargins.Vertical - ModListBox.Top - ModListBox.Margins.Bottom;
            ModListBox.HideSelection = false;

            ModListBox.c81fb310624c15a101535d14adc9ec383.Add("Gnomodia");
            ModListBox.ItemIndexChanged += ModListBoxOnItemIndexChanged;

            foreach (var modMetadata in modManager.ModMetadata)
            {
                ModListBox.c81fb310624c15a101535d14adc9ec383.Add(modMetadata.Name);
            }

            containingPanel.Add(ModListBox);

            ModInfoPanel = new LoweredPanel(containingPanel.Manager);
            ModInfoPanel.Init();
            ModInfoPanel.Left = ModListBox.Left + ModListBox.Width + ModListBox.Margins.Right + ModInfoPanel.Margins.Left;
            ModInfoPanel.Top = ModInfoPanel.Margins.Top;
            ModInfoPanel.Width = desiredWidth - ModInfoPanel.Left - ModInfoPanel.Margins.Right;
            ModInfoPanel.Height = desiredHeight - containingPanel.ClientMargins.Vertical - ModInfoPanel.Top - ModInfoPanel.Margins.Bottom;
            ModInfoPanel.AutoScroll = true;
            ModInfoPanel.HorizontalScrollBarEnabled = false;
            ModInfoPanel.VerticalScrollBarShow = true;
            containingPanel.Add(this.ModInfoPanel);

            _titleLabel = new Label(containingPanel.Manager);
            _titleLabel.Init();
            _titleLabel.Top = _titleLabel.Margins.Top;
            _titleLabel.Left = _titleLabel.Margins.Left;
            _titleLabel.Height = 14;
            _titleLabel.Width = ModInfoPanel.ClientWidth - _titleLabel.Margins.Horizontal;
            _titleLabel.Text = "";
            ModInfoPanel.Add(_titleLabel);

            _versionLabel = new Label(containingPanel.Manager);
            _versionLabel.Init();
            _versionLabel.Left = _versionLabel.Margins.Left;
            _versionLabel.Height = 14;
            _versionLabel.Width = ModInfoPanel.Width - _versionLabel.Margins.Horizontal;
            _versionLabel.Top = _titleLabel.Top + _titleLabel.Height + _titleLabel.Margins.Bottom + _versionLabel.Margins.Top;
            _versionLabel.Text = "";
            ModInfoPanel.Add(_versionLabel);

            _authorLabel = new Label(containingPanel.Manager);
            _authorLabel.Init();
            _authorLabel.Left = _authorLabel.Margins.Left;
            _authorLabel.Height = 14;
            _authorLabel.Width = ModInfoPanel.Width - _authorLabel.Margins.Horizontal;
            _authorLabel.Top = _versionLabel.Top + _versionLabel.Height + _versionLabel.Margins.Bottom + _authorLabel.Margins.Top;
            _authorLabel.Text = "";
            ModInfoPanel.Add(_authorLabel);

            _infoLabel = new MultilineLabel(containingPanel.Manager);
            _infoLabel.Left = _infoLabel.Margins.Left;
            _infoLabel.Height = 0;
            _infoLabel.Top = _authorLabel.Top + _authorLabel.Height + _authorLabel.Margins.Bottom + _infoLabel.Margins.Top;
            _infoLabel.Width = ModInfoPanel.ClientWidth - _infoLabel.Margins.Horizontal;
            _infoLabel.Anchor = Anchors.Top | Anchors.Left | Anchors.Right;
            _infoLabel.Alignment = Alignment.TopLeft;
            ModInfoPanel.Add(_infoLabel);

            ModListBox.ItemIndex = 0;
        }