コード例 #1
0
ファイル: ListViewWidget.cs プロジェクト: lennyhans/OpenMB
        public void LoadColumns(List <string> columnNames)
        {
            if (columns != null && columns.Count > 0)
            {
                foreach (var column in columns)
                {
                    Control.nukeOverlayElement(column.ColumnEnity);
                }
                columns.Clear();
            }
            top  = 0.01f;
            left = 0.01f;
            for (int i = 0; i < columnNames.Count; i++)
            {
                var listViewCol = OverlayManager.Singleton.CreateOverlayElementFromTemplate("ListView/Column", "BorderPanel", "col" + i) as BorderPanelOverlayElement;
                var textArea    = listViewCol.GetChild(listViewCol.Name + "/ListViewColumnCaption") as TextAreaOverlayElement;
                textArea.Caption = columnNames[i];

                ListViewColumn lsc = new ListViewColumn();
                lsc.ColumnName  = columnNames[i];
                lsc.ColumnEnity = listViewCol;
                columns.Add(lsc);

                listViewCol.Top   = top;
                listViewCol.Left  = left;
                listViewCol.Width = width / columnNames.Count - 0.005f;
                listViewCol.Show();

                listview.AddChild(listViewCol);
                left = left + listViewCol.Width;

                if (i != columnNames.Count - 1)
                {
                    var verLine = OverlayManager.Singleton.CreateOverlayElementFromTemplate("AMGE/UI/VerticalLine", "Panel", "colline" + i) as PanelOverlayElement;
                    verLine.Left   = left;
                    verLine.Top    = top;
                    verLine.Height = height - 0.018f;
                    verLine.Show();
                    listview.AddChild(verLine);
                    verLine.Dispose();
                    allUsedElements.Add(verLine);
                }
            }
            var horline = OverlayManager.Singleton.CreateOverlayElementFromTemplate("AMGE/UI/HorizalLine", "Panel", "colhorline") as PanelOverlayElement;

            horline.Left  = 0.008f;
            horline.Top   = 0.05338f;
            horline.Width = width - 0.026f;
            horline.Show();
            allUsedElements.Add(horline);
            listview.AddChild(horline);
        }
コード例 #2
0
        // zmiana zwracanego typu z void na OverlayContainer by Adam
        public OverlayContainer createStaticText(Vector4 D, String T, ColourValue cTop, ColourValue cBottom)
        {
            OverlayContainer x = mGUI.createOverlay(mO.Name +
                                                    StringConverter.ToString(mGUI.tc++),
                                                    new Vector2(D.x, D.y), new Vector2(D.z, D.w), "", T, false);



            ChangeContainerColour(x, cTop, cBottom);

            mO.AddChild(x);
            x.Show();

            return(x);
        }
コード例 #3
0
ファイル: MogreForm.cs プロジェクト: andyhebear/mogrelibrarys
        // Create text area for SkyX parameters
        private void _createTextArea()
        {
            // Create a panel
            OverlayContainer panel = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "SkyXParametersPanel");

            panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            panel.SetPosition(10, 10);
            panel.SetDimensions(400, 400);

            // Create a text area
            _textArea             = OverlayManager.Singleton.CreateOverlayElement("TextArea", "SkyXParametersTextArea");
            _textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            _textArea.SetPosition(0, 0);
            _textArea.SetDimensions(100, 100);
            // _textArea.Text = "MogreLib SkyX plugin demo";
            _textArea._setHeight(16);
            //_textArea.FontName = "BlueHighway";
            // _textArea.ColorBottom = new ColorEx(0.3f, 0.5f, 0.3f);
            //_textArea.ColorTop = new ColorEx(0.5f, 0.7f, 0.5f);

            // Create an overlay, and add the panel
            Overlay overlay = OverlayManager.Singleton.Create("OverlayName");

            overlay.Add2D(panel);

            // Add the text area to the panel
            panel.AddChild(_textArea);

            // Show the overlay
            overlay.Show();
        }
コード例 #4
0
ファイル: TextRenderer.cs プロジェクト: andyhebear/ymfas
        public static void AddTextBox(String id, String text, float x, float y, float width, float height, ColourValue colorTop, ColourValue colorBot)
        {
            try {
                OverlayManager   overlayMgr = OverlayManager.Singleton;
                OverlayContainer panel      = (OverlayContainer)overlayMgr.CreateOverlayElement("Panel", "_panel_" + id);
                panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
                panel.SetPosition(x, y);
                panel.SetDimensions(width, height);

                TextAreaOverlayElement textArea = (TextAreaOverlayElement)overlayMgr.CreateOverlayElement("TextArea", "_area_" + id);
                textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
                textArea.SetPosition(0, 0);
                textArea.SetDimensions(width, height);
                textArea.Caption      = text;
                textArea.CharHeight   = 16;
                textArea.FontName     = "Verdana";
                textArea.ColourTop    = colorTop;
                textArea.ColourBottom = colorBot;
                Overlay overlay = overlayMgr.Create("_overlay_" + id);
                overlay.Add2D(panel);
                panel.AddChild(textArea);
                overlay.Show();
            }
            catch (Exception e) {
                Util.Log("Unable to create text area.");
            }
        }
コード例 #5
0
        public Button(Vector4 D, String M, String T, Callback C, Window P, Window window)
        {
            this.window = window;
            text        = T;

            x   = D.x;
            y   = D.y;
            w   = D.z;
            h   = D.w;
            mmn = M;
            mma = M;

            ResourcePtr ma = MaterialManager.Singleton.GetByName(mmn + ".active");

            if (ma != null)
            {
                mma += ".active";
            }
            ma = null;

            mO = P.mGUI.createOverlay(P.mO.Name + "b" +
                                      StringConverter.ToString(P.mGUI.bc++),
                                      new Vector2(x, y), new Vector2(w, h), M, "", false);

            mCP = P.mGUI.createOverlay(mO.Name + "c",
                                       new Vector2(GUI.OVERLAY_TITLE_MARGIN, (h - P.mGUI.mFontSize) / 2),
                                       new Vector2(w, h), "", T, false);

            P.mO.AddChild(mO);
            mO.Show();
            mO.AddChild(mCP);
            mCP.Show();
            callback = C;
        }
コード例 #6
0
        public List(string name, Vector3 dimensions, Label itemTemplate, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, OverlayContainer overlayContainer, Widget ParentWidget) : base(name, new Vector4(dimensions.x, dimensions.y, dimensions.z, 0), positionMode, sizeMode, material, overlayContainer, ParentWidget)
        {
            mAutoNameListItemCount       = 0;
            mAutoNameListCount           = 0;
            mListItemHorizontalAlignment = GuiHorizontalAlignment.GHA_CENTER;
            mListItemVerticalAlignment   = GuiVerticalAlignment.GVA_CENTER;

            mWidgetType = Widget.WidgetType.QGUI_TYPE_LIST;

            mDefaultListItemHeight = itemTemplate.getDimensions(QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE).w;

            mHighlightMaterial = getSheet().getDefaultSkin() + ".list.highlight";

            // create highlight container for the list
            mHighlightContainer = createOverlayContainer(mInstanceName + ".HighlightContainer", "");
            mChildrenContainer.AddChildImpl(mHighlightContainer);

            mHighlightPanel = createPanelOverlayElement(mInstanceName + ".HighlightPanel", mPixelDimensions, mHighlightMaterial);
            mHighlightContainer.AddChild(mHighlightPanel);
            mHighlightPanel.Show();

            mItems        = new List <ListItem>();
            mChildLists   = new List <List>();
            OnDeactivate += new DeactivateEventHandler(List_OnDeactivate);


            setCharacterHeight(itemTemplate.getCharacterHeight());
            setFont(itemTemplate.getFont());
            setTextColor(itemTemplate.getTextColorTop());
        }
コード例 #7
0
        // Create text area for SkyX parameters
        private void CreateTextArea()
        {
            // Create a panel
            OverlayContainer panel = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "SkyXParametersPanel");

            panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            panel.SetPosition(10, 10);
            panel.SetDimensions(400, 400);

            // Create a text area
            textArea             = (TextAreaOverlayElement)OverlayManager.Singleton.CreateOverlayElement("TextArea", "SkyXParametersTextArea");
            textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            textArea.SetPosition(0, 0);
            textArea.SetDimensions(100, 100);
            textArea.Caption      = "SkyX plugin demo";
            textArea.CharHeight   = 16;
            textArea.FontName     = "BlueHighway";
            textArea.ColourBottom = new ColourValue(0.3f, 0.5f, 0.3f);
            textArea.ColourTop    = new ColourValue(0.5f, 0.7f, 0.7f);


            // Create an overlay, and add the panel
            Overlay overlay = OverlayManager.Singleton.Create("OverlayName");

            overlay.Add2D(panel);

            // Add the text area to the panel
            panel.AddChild(textArea);

            // Show the overlay
            overlay.Show();
        }
コード例 #8
0
        public void Insert(int index, Widget item)
        {
            OverlayContainer container = (OverlayContainer)owner.getOverlayElement();

            container.AddChild(item.getOverlayElement());
            widgets.Insert(index, item);
        }
コード例 #9
0
        public OverlayContainer createOverlay(String N, Vector2 P, Vector2 D,
                                              String M, String C, bool A, Overlay target)
        {
            String t = "Panel";

            if (C != "")
            {
                t = "TextArea";
            }
            OverlayElement e = OverlayManager.Singleton.CreateOverlayElement(t, N + this.name + DateTime.Now.Ticks);

            e.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            e.SetDimensions(D.x, D.y);
            e.SetPosition(0, 0);


            //if (M != "")
            //    e.MaterialName = M;

            if (C != "")
            {
                if (A)
                {
                    e.Top  = OVERLAY_TITLE_MARGIN;
                    e.Left = OVERLAY_TITLE_MARGIN;
                }

                e.Caption = C;
                e.SetParameter("font_name", mFont);
                e.SetParameter("char_height", StringConverter.ToString(mFontSize));
            }


            OverlayContainer c =
                (OverlayContainer)
                OverlayManager.Singleton.CreateOverlayElement("Panel", name + "ContainerHack" + (oc++).ToString());

            c.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            c.SetDimensions(D.x, D.y);
            c.SetPosition(P.x, P.y);

            if (M != "")
            {
                c.MaterialName = M;
            }
            c.AddChild(e);
            if (A)
            {
                target.Add2D(c);
                c.Show();
            }
            return(c);
        }
コード例 #10
0
        private void ConfigureContainer(OverlayContainer container, OverlayElement element, int width, int height,
                                        int posX, int posY)
        {
            container.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            container.SetDimensions(minimapViewport.ActualWidth, minimapViewport.ActualHeight);
            container.SetPosition(posX,
                                  posY);

            container.AddChild(element);
            hudOverlay.Add2D(container);
            container.Show();
        }
コード例 #11
0
        private void CreateMessageContainer()
        {
            // BetaGUI.GUI gui = new GUI();
            // Window w = gui.createWindow();
            // w.createStaticImage()

            backgroundElement.Hide();
            iconOverlay             = OverlayManager.Singleton.GetByName("Wof/MessageBar");
            iconElement             = OverlayManager.Singleton.GetOverlayElement("Wof/MessageBarIcon");
            iconElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            iconElement.SetDimensions(radioIconWidth, radioIconWidth);
            iconElement.Show();
            iconOverlay.Hide();     // zewnetrzny kontener ukryje wszystko


            iconDefaultDimesions.x = Mogre.StringConverter.ParseReal(iconElement.GetParameter("width"));
            iconDefaultDimesions.y = Mogre.StringConverter.ParseReal(iconElement.GetParameter("height"));

            messageElement = OverlayManager.Singleton.CreateOverlayElement(
                "TextArea", "messageElement " + DateTime.Now.Ticks);
            messageContainer = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement(
                "Panel", "messageContainer " + DateTime.Now.Ticks);

            messageElement.SetDimensions(mainViewport.ActualWidth, mainViewport.ActualHeight);
            messageElement.MetricsMode = GuiMetricsMode.GMM_PIXELS;

            messageElement.SetParameter("font_name", FontManager.CurrentFont);

            messageElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            messageElement.SetParameter("char_height", StringConverter.ToString(EngineConfig.CurrentFontSize));
            messageElement.SetParameter("colour_top", "0.1 0.1 0.1");
            messageElement.SetParameter("colour_bottom", "0.5 0.1 0.1");
            messageElement.Caption = "";


            messageContainer.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            messageContainer.SetDimensions(1.0f, 0.05f);
            // messageContainer.SetPosition(0.055f, 0.015f);

            messageContainer.AddChild(messageElement);
            messageOverlay.Add2D(messageContainer);
            messageContainer.Show();
        }
コード例 #12
0
        } // mCP here if ...

        public TextInput(Vector4 D, String M, String V, uint L, Window P)
        {
            x      = D.x;
            y      = D.y;
            w      = D.z;
            h      = D.w;
            value  = V;
            mmn    = M;
            mme    = M;
            mma    = M;
            length = L;

            ResourcePtr ma = MaterialManager.Singleton.GetByName(mmn + ".active");

            if (ma != null)
            {
                mma += ".active";
            }
            ma = null;

            ma = MaterialManager.Singleton.GetByName(mmn + ".active.error");
            if (ma != null)
            {
                mme += ".active.error";
            }
            ma = null;

            mO = P.mGUI.createOverlay(P.mO.Name + "t" +
                                      StringConverter.ToString(P.mGUI.tc++),
                                      new Vector2(x, y), new Vector2(w, h), M, "", false);
            mCP = P.mGUI.createOverlay(mO.Name + "c",
                                       new Vector2(0, (h - P.mGUI.mFontSize) / 2),
                                       new Vector2(w, h), "", V, false);
            P.mO.AddChild(mO);
            mO.Show();
            mO.AddChild(mCP);
            mCP.Show();
        }
コード例 #13
0
ファイル: OutputManager.cs プロジェクト: wuhuolong/OpenMB
 public void DisplayMessage(string message, string color = "0xffffff")
 {
     if (!OverlayManager.Singleton.HasOverlayElement("msgText" + textElements.Count))
     {
         TextAreaOverlayElement textArea = OverlayManager.Singleton.CreateOverlayElement("TextArea", "msgText" + textElements.Count) as TextAreaOverlayElement;
         textArea.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
         textArea.Left        = 0.01f;
         textArea.Top         = 0.9f;
         textArea.Width       = 0.2f;
         textArea.Height      = 0.1f;
         textArea.SetParameter("font_name", "EngineFont");
         textArea.SetParameter("char_height", "0.03");
         textArea.HorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT;
         container.AddChild(textArea);
         textArea.Colour  = Utilities.Helper.HexToRgb(color.ToString());
         textArea.Caption = message;
         buffer.Add(message);
         textElements.Add(textArea);
         for (int i = 0; i < textElements.IndexOf(textArea); i++)
         {
             textElements[i].Top -= 0.03f;
         }
     }
 }
コード例 #14
0
ファイル: overlayGUI.cs プロジェクト: CharcoalStyles/3DRL
        public OverlayGUI()
        {
            //setup the colours
            top = new ColourValue(0.9f, 0.9f, 0.9f);
            bot = new ColourValue(0.8f, 0.8f, 0.8f);
            seltop = new ColourValue(0.9f, 0.7f, 0.7f);
            selbot = new ColourValue(0.8f, 0.6f, 0.6f);

            //Overlay
            overlayManager = OverlayManager.Singleton;
            // Create a panel
            panel = (OverlayContainer)overlayManager.CreateOverlayElement("Panel", "PanelName");
            panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            panel.SetPosition(0, 0);
            panel.SetDimensions(Program.Instance.rWindow.Width, Program.Instance.rWindow.Height);

            panel.MaterialName = "fsO/Blank";  // Optional background material

            // Create a text area
            messageArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TextArea");
            messageArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            messageArea.SetPosition(0, 0);
            messageArea.SetDimensions(Program.Instance.rWindow.Width, 100);
            messageArea.CharHeight = 24;
            messageArea.FontName = "damn";
            messageArea.ColourTop = top;
            messageArea.ColourBottom = bot;
            messageArea.Caption = "";

            // Status text area
            statArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "StatTextArea");
            statArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            statArea.SetPosition(0, Program.Instance.rWindow.Height - 50);
            statArea.SetDimensions(Program.Instance.rWindow.Width, 50);
            statArea.CharHeight = 24;
            statArea.FontName = "damn";
            statArea.ColourTop = top;
            statArea.ColourBottom = bot;
            statArea.Caption = "this is a test" + Environment.NewLine + "This is the test's second line";

            //Menus Text Areas
            titleArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TitleTextArea");
            titleArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            titleArea.SetPosition(64, 16);
            titleArea.SetDimensions(Program.Instance.rWindow.Width, 32);
            titleArea.CharHeight = 32;
            titleArea.FontName = "damn";
            titleArea.ColourTop = top;
            titleArea.ColourBottom = bot;
            titleArea.Caption = "Title";

            for (int i = 0; i < 10; i++)
            {
                optionAreas[i] = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", i+"TextArea");
                optionAreas[i].MetricsMode = GuiMetricsMode.GMM_PIXELS;
                optionAreas[i].SetPosition(32, 64 + (i*26));
                optionAreas[i].SetDimensions(Program.Instance.rWindow.Width, 24);
                optionAreas[i].CharHeight = 24;
                optionAreas[i].FontName = "damn";
                optionAreas[i].ColourTop = top;
                optionAreas[i].ColourBottom = bot;
                optionAreas[i].Caption = "Option " + i.ToString();
            }

            maxOptions = 10;

            // Create an overlay, and add the panel
            overlay = overlayManager.Create("OverlayName");

            overlay.Add2D(panel);
            // Add the text area to the panel
            panel.AddChild(messageArea);
            panel.AddChild(titleArea);
            panel.AddChild(statArea);
            for (int i = 0; i < 10; i++)
            {
                panel.AddChild(optionAreas[i]);
            }

            // Show the overlay
            overlay.Show();
        }
コード例 #15
0
        public override void Run()
        {
            type      = EditType.EditAIMeshMode;
            state     = EditState.Free;
            operation = EditOperation.None;

            float top = MARGIN_TOP;

            editorPanel = OverlayManager.Singleton.CreateOverlayElementFromTemplate("EditorPanel", "BorderPanel", "editorArea") as OverlayContainer;

            lbGeneral            = UIManager.Instance.CurrentLayer.CreateStaticText(UIWidgetLocation.TL_NONE, "lbGeneral", "General", ColourValue.Black);
            lbGeneral.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            lbGeneral.Left       = 0.06f;
            lbGeneral.Top        = top;
            top = lbGeneral.Top + lbGeneral.Height;
            editorPanel.AddChild(lbGeneral.OverlayElement);

            btnSave            = UIManager.Instance.CurrentLayer.CreateButton(UIWidgetLocation.TL_NONE, "btnSave", "Save", 150);
            btnSave.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnSave.Left       = 0.06f;
            btnSave.Top        = 0.02f + top;
            btnSave.OnClick   += BtnSave_OnClick;
            top = btnSave.Top + btnSave.Height;
            editorPanel.AddChild(btnSave.OverlayElement);

            btnClose            = UIManager.Instance.CurrentLayer.CreateButton(UIWidgetLocation.TL_NONE, "btnClose", "Close", 150);
            btnClose.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnClose.Left       = 0.06f;
            btnClose.Top        = 0.02f + top;
            btnClose.OnClick   += BtnClose_OnClick;
            top = btnClose.Top + btnClose.Height;
            editorPanel.AddChild(btnClose.OverlayElement);

            horline             = OverlayManager.Singleton.CreateOverlayElementFromTemplate("AMGE/UI/HorizalLine", "Panel", "horline") as PanelOverlayElement;
            horline.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            horline.Left        = 0.01f;
            horline.Width       = 0.28f;
            horline.Top         = 0.02f + top;
            top = horline.Top + horline.Height;
            editorPanel.AddChild(horline);

            lbAIMesh            = UIManager.Instance.CurrentLayer.CreateStaticText(UIWidgetLocation.TL_NONE, "lbAIMesh", "AIMesh", ColourValue.Black);
            lbAIMesh.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            lbAIMesh.Left       = 0.06f;
            lbAIMesh.Top        = 0.02f + top;
            top = lbAIMesh.Top + lbAIMesh.Height;
            editorPanel.AddChild(lbAIMesh.OverlayElement);

            btnAIMeshCreateVertex            = UIManager.Instance.CurrentLayer.CreateButton(UIWidgetLocation.TL_NONE, "btnCreateVertex", "Create Vertex", 150);
            btnAIMeshCreateVertex.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnAIMeshCreateVertex.Left       = 0.06f;
            btnAIMeshCreateVertex.Top        = 0.02f + top;
            btnAIMeshCreateVertex.OnClick   += BtnAIMeshCreateVertex_OnClick;
            top = btnAIMeshCreateVertex.Top + btnAIMeshCreateVertex.Height;
            editorPanel.AddChild(btnAIMeshCreateVertex.OverlayElement);

            btnAIMeshCreateLine            = UIManager.Instance.CurrentLayer.CreateButton(UIWidgetLocation.TL_NONE, "btnCreateLine", "Create Line", 150);
            btnAIMeshCreateLine.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnAIMeshCreateLine.Left       = 0.06f;
            btnAIMeshCreateLine.Top        = 0.02f + top;
            btnAIMeshCreateLine.OnClick   += BtnAIMeshCreateLine_OnClick;
            top = btnAIMeshCreateLine.Top + btnAIMeshCreateLine.Height;
            editorPanel.AddChild(btnAIMeshCreateLine.OverlayElement);

            horline2             = OverlayManager.Singleton.CreateOverlayElementFromTemplate("AMGE/UI/HorizalLine", "Panel", "horline2") as PanelOverlayElement;
            horline2.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            horline2.Left        = 0.01f;
            horline2.Width       = 0.28f;
            horline2.Top         = 0.02f + top;
            top = horline2.Top + horline2.Height;
            editorPanel.AddChild(horline2);

            lbObjects            = UIManager.Instance.CurrentLayer.CreateStaticText(UIWidgetLocation.TL_NONE, "lbObjects", "Objects", ColourValue.Black);
            lbObjects.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            lbObjects.Left       = 0.06f;
            lbObjects.Top        = 0.02f + top;
            top = lbObjects.Top + lbObjects.Height;
            editorPanel.AddChild(lbObjects.OverlayElement);

            lsvObjects = UIManager.Instance.CurrentLayer.CreateListView(UIWidgetLocation.TL_NONE, "lsvObjects", 0.3f, 0.22f, new List <string>()
            {
                "ObjectName"
            });
            lsvObjects.Left   = 0.03f;
            lsvObjects.Width  = 0.24f;
            lsvObjects.Height = 0.3f;
            lsvObjects.Top    = 0.02f + top;
            top = lsvObjects.Top + lsvObjects.Height;
            editorPanel.AddChild(lsvObjects.OverlayElement);

            btnAddObject            = UIManager.Instance.CurrentLayer.CreateButton(UIWidgetLocation.TL_NONE, "btnAddObject", "Add Object", 100);
            btnAddObject.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnAddObject.Left       = 0.14f;
            btnAddObject.Top        = 0.02f + top;
            btnAddObject.OnClick   += BtnAddObject_OnClick;
            top = btnAddObject.Top + btnAddObject.Height;
            editorPanel.AddChild(btnAddObject.OverlayElement);

            UIManager.Instance.GetTraysLayer().Add2D(editorPanel);
        }
コード例 #16
0
 //returns a texthandle
 public string AddText(Text text)
 {
     _OverlayPanel.AddChild(text._TextArea);
     return(text._TextArea.Name);
 }
コード例 #17
0
ファイル: InventoryScreen.cs プロジェクト: wuhuolong/OpenMB
        public override void Run()
        {
            meshLayer        = OverlayManager.Singleton.Create("CharacterPreview");
            meshLayer.ZOrder = 999;

            SceneManager scm = ScreenManager.Instance.Camera.SceneManager;

            ent       = scm.CreateEntity(Guid.NewGuid().ToString(), meshName);
            sceneNode = scm.CreateSceneNode();
            sceneNode.Translate(new Mogre.Vector3(0, 0, 0));
            sceneNode.Rotate(Quaternion.IDENTITY);
            float lenght = ent.BoundingBox.Size.Length * 2;

            sceneNode.Translate(new Mogre.Vector3(-7f, 5f, -1.0f * lenght));
            ent.RenderQueueGroup   = (byte)RenderQueueGroupID.RENDER_QUEUE_MAX;
            ent.Skeleton.BlendMode = SkeletonAnimationBlendMode.ANIMBLEND_CUMULATIVE;

            baseAnim         = ent.GetAnimationState(animNames[1]);
            topAnim          = ent.GetAnimationState(animNames[0]);
            baseAnim.Enabled = true;
            topAnim.Enabled  = true;
            baseAnim.Loop    = true;
            topAnim.Loop     = true;

            sceneNode.AttachObject(ent);
            meshLayer.Add3D(sceneNode);
            meshLayer.Show();

            equipmentPanel = OverlayManager.Singleton.CreateOverlayElementFromTemplate("CharacterEquipment", "BorderPanel", "inventoryPanelLeftArea") as OverlayContainer;
            previewPanel   = OverlayManager.Singleton.CreateOverlayElementFromTemplate("CharacterPreview", "BorderPanel", "inventoryPanelMiddleArea") as OverlayContainer;
            backpackPanel  = OverlayManager.Singleton.CreateOverlayElementFromTemplate("CharacterBackpack", "BorderPanel", "inventoryPanelRightArea") as OverlayContainer;
            row            = (int)System.Math.Round((backpackPanel.Height - 0.04) / INV_WIDTH);
            col            = (int)System.Math.Round((backpackPanel.Width - 0.04) / INV_WIDTH);

            int   row_counter = 1;
            int   col_counter = 1;
            float topValue    = 0.0f;
            float leftValue   = 0.0f;

            for (int i = 0; i < 35; i++)
            {
                if (i == 0)
                {
                    topValue  = 0.02f;
                    leftValue = 0.02f;
                }
                else if (col_counter <= col)
                {
                    leftValue += INV_WIDTH;
                }
                else
                {
                    topValue   += INV_WIDTH;
                    col_counter = 1;
                    row_counter++;
                    leftValue = 0.02f;
                }
                OverlayElement invSlotElement = OverlayManager.Singleton.CreateOverlayElementFromTemplate("InventorySlot", "BorderPanel", "INV_NO_" + i.ToString());
                invSlotElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
                invSlotElement.Left        = leftValue;
                invSlotElement.Top         = topValue;
                invSlotElement.Width       = INV_WIDTH;
                invSlotElement.Height      = INV_WIDTH;
                if (row_counter <= row)
                {
                    backpackPanel.AddChild(invSlotElement);
                }
                else
                {
                    invSlotElement.Hide();
                    backpackPanel.AddChild(invSlotElement);
                }
                elements.Add(invSlotElement);
                col_counter++;
            }
            GameManager.Instance.trayMgr.getTraysLayer().Add2D(equipmentPanel);
            GameManager.Instance.trayMgr.getTraysLayer().Add2D(previewPanel);
            GameManager.Instance.trayMgr.getTraysLayer().Add2D(backpackPanel);
        }