Пример #1
0
        public override void Run()
        {
            var modData     = ScreenManager.Instance.ModData;
            var findedMenus = modData.MenuInfos.Where(o => o.ID == menuID);

            if (findedMenus.Count() > 0)
            {
                menuData = findedMenus.First();
                if (world.GlobalVariableTable.ContainsKey("menuData"))
                {
                    world.GlobalVariableTable["menuData"] = menuData;
                }
                else
                {
                    world.GlobalVariableTable.Add("menuData", menuData);
                }

                script = new ScriptFile(menuData.Logic);
                loader.ExecuteFunction(script, "menuInit", world);
                menuData = world.GlobalVariableTable["menuData"] as ModMenuDfnXml;

                menuMainPanel = UIManager.Instance.CreatePanel("menuMainPanel");
                menuMainPanel.AddRow(UI.ValueType.Percent);
                menuMainPanel.AddCol(UI.ValueType.Percent);

                menuTitle            = UIManager.Instance.CreateStaticText("menuStaticText", menuData.Title);
                menuTitle.MetricMode = Mogre.GuiMetricsMode.GMM_RELATIVE;
                menuTitle.Top        = 0.05f;
                menuMainPanel.AddWidget(1, 1, menuTitle, AlignMode.Center);

                menuItemsPanel = UIManager.Instance.CreatePanel("menuItemsPanel", 0.5f, 0.5f, 0, 0);
                menuMainPanel.AddWidget(2, 1, menuItemsPanel, AlignMode.Left, AlignMode.Center, DockMode.Fill);

                foreach (var menu in menuData.Children)
                {
                    menuItemsPanel.AddRow(UI.ValueType.Abosulte, 0.05f);
                }

                int row = 2;
                foreach (var menu in menuData.Children)
                {
                    var button = UIManager.Instance.CreateButton(menu.id, menu.Text, 200);
                    button.MetricMode = Mogre.GuiMetricsMode.GMM_RELATIVE;
                    menuItemsPanel.AddWidget(row, 1, button, AlignMode.Center);
                    menuButtons.Add(button);
                    button.OnClick += Button_OnClick;
                    row++;
                }
            }
        }
Пример #2
0
        private void BtnFactions_OnClick(object sender)
        {
            ClearAllWidgets();

            PanelWidget panelFactionList = UIManager.Instance.CreatePanel("panelFactionList", 0.3f, 0.92f, 0.7f, 0);

            panelFactionList.ChangeRow(UI.ValueType.Abosulte, 0.05f);
            panelFactionList.AddRow(UI.ValueType.Percent);
            panelFactionList.Padding.PaddingLeft  = 0.01f;
            panelFactionList.Padding.PaddingRight = 0.01f;

            StaticText txtFactionsTitle = UIManager.Instance.CreateStaticText("txtFactionsTitle", GameString.FromString("ui_game_notes_factions_title", "Factions").ToString());

            txtFactionsTitle.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            panelFactionList.AddWidget(1, 1, txtFactionsTitle, AlignMode.Center);
            PanelScrollableWidget panelFactions = UIManager.Instance.CreateScrollablePanel("panelFactions", 1, 1, 0, 0, 1, 1, false);

            panelFactionList.AddWidget(2, 1, panelFactions, AlignMode.Center, AlignMode.Center, DockMode.Fill);

            panelFactions.ChangeRow(UI.ValueType.Abosulte, 0.03f);
            panelFactions.AddRows(world.ModData.SideInfos.Count - 1, UI.ValueType.Abosulte, 0.03f);
            int curRow = 1;

            widgets.Add(txtFactionsTitle);
            widgets.Add(panelFactionList);
            widgets.Add(panelFactions);

            foreach (var sideInfo in world.ModData.SideInfos)
            {
                if (!GameSlotManager.Instance.SlotEqual(sideInfo.ID, "slot_faction_state", "inactive") &&
                    !GameSlotManager.Instance.SlotEqual(sideInfo.ID, "slot_faction_visibility", "hidden"))
                {
                    if (curRow == 1)
                    {
                        BuildFactionDetails(sideInfo);
                    }
                    var btnFaction = new SimpleStaticTextButton("txtFaction_" + sideInfo.Name, GameString.FromString(sideInfo.ID, sideInfo.Name).ToString(),
                                                                (Color.FromArgb(36, 35, 191).ToColourValue()),
                                                                ColourValue.Black, true);
                    panelFactions.AddWidget(curRow, 1, btnFaction);
                    btnFaction.UserData = sideInfo;
                    btnFaction.OnClick += (evtObj) =>
                    {
                        BuildFactionDetails((evtObj as Widget).UserData as ModSideDfnXML);
                    };
                    curRow++;
                }
            }
        }
Пример #3
0
        private void CreateModCard(Mod mod, int currentRow, int currentCol)
        {
            PanelWidget modPreviewWidget = new PanelWidget("mod_panel_" + mod.name_id, 0, 0.3f, 0, 0, 2, 1, false);

            modPreviewWidget.ChangeRow(UI.ValueType.Percent, 100);
            modPreviewWidget.ChangeRow(UI.ValueType.Abosulte, 0.3f, 2);
            modPreviewWidget.Material = "SdkTrays/MiniTray";

            browserMainPanel.ChangeRow(UI.ValueType.Abosulte, modPreviewWidget.Height, currentRow);
            browserMainPanel.AddWidget(currentRow, currentCol, modPreviewWidget, AlignMode.Center, AlignMode.Center, DockMode.Fill);

            PanelMaterialWidget pictureWidget = new PanelMaterialWidget("mod_pic_" + mod.name_id, "error.png");

            modPreviewWidget.AddWidget(1, 1, pictureWidget, AlignMode.Center, AlignMode.Center, DockMode.Fill);

            PanelWidget modInfoWidget = new PanelWidget("mod_info_panel_" + mod.name_id, 0, 0, 0, 0, 1, 2, false);

            modInfoWidget.ChangeCol(UI.ValueType.Percent, 80);
            modInfoWidget.ChangeCol(UI.ValueType.Percent, 20, 2);

            modPreviewWidget.AddWidget(2, 1, modInfoWidget, AlignMode.Center, AlignMode.Center, DockMode.Fill);

            SimpleStaticTextWidget modNameWidget = new SimpleStaticTextWidget("mod_text_" + mod.name_id, mod.name, 0.2f, false, new Mogre.ColourValue());

            modInfoWidget.AddWidget(1, 1, modNameWidget, AlignMode.Left, AlignMode.Center, DockMode.Fill, 1, 1, false);

            SimpleButtonWidget btnModSubscribeWidget = new SimpleButtonWidget("btnModSubscribeWidget_" + mod.name_id, "Subscribe", 0.8f, 0.7f);

            btnModSubscribeWidget.OnClick += (o) =>
            {
                OnScreenEventChanged?.Invoke(btnModSubscribeWidget.Name, null);
            };

            IBackendTask downloadModThumbTask = new DownloadBackendTask(mod.logo.original, "./Media/Engine/Download/" + mod.name_id + "_thumb.png");

            BackendTaskManager.Instance.EnqueueTask(downloadModThumbTask);
            BackendTaskManager.Instance.TaskEnded += (o) =>
            {
                pictureWidget.ChangeTexture(o.ToString());
            };

            modInfoWidget.AddWidget(1, 2, btnModSubscribeWidget, AlignMode.Center, AlignMode.Center);
        }
Пример #4
0
        public override void Run()
        {
            PanelWidget  panel            = UIManager.Instance.CreatePanel("OperationPanel", 1, 0.08f, 0, 0.92f, 1, 8);
            ButtonWidget btnGameLog       = UIManager.Instance.CreateButton("btnGameLog", "Game Log", 150);
            ButtonWidget btnRecentMessage = UIManager.Instance.CreateButton("btnRecentMessage", "Recent", 100);
            ButtonWidget btnNotes         = UIManager.Instance.CreateButton("btnNotes", "Notes", 100);
            ButtonWidget btnGameConcepts  = UIManager.Instance.CreateButton("btnGameConcepts", "Concepts", 100);
            ButtonWidget btnCharacters    = UIManager.Instance.CreateButton("btnCharacters", "Characters", 100);
            ButtonWidget btnLocations     = UIManager.Instance.CreateButton("btnLocations", "Locations", 100);
            ButtonWidget btnFactions      = UIManager.Instance.CreateButton("btnFactions", "Factions", 100);
            ButtonWidget btnReturn        = UIManager.Instance.CreateButton("btnReturn", "Return", 100);

            btnGameLog.MetricMode       = GuiMetricsMode.GMM_RELATIVE;
            btnRecentMessage.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnNotes.MetricMode         = GuiMetricsMode.GMM_RELATIVE;
            btnGameConcepts.MetricMode  = GuiMetricsMode.GMM_RELATIVE;
            btnCharacters.MetricMode    = GuiMetricsMode.GMM_RELATIVE;
            btnLocations.MetricMode     = GuiMetricsMode.GMM_RELATIVE;
            btnFactions.MetricMode      = GuiMetricsMode.GMM_RELATIVE;
            btnReturn.MetricMode        = GuiMetricsMode.GMM_RELATIVE;
            panel.AddWidget(1, 1, btnGameLog, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            panel.AddWidget(1, 2, btnRecentMessage, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            panel.AddWidget(1, 3, btnNotes, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            panel.AddWidget(1, 4, btnGameConcepts, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            panel.AddWidget(1, 5, btnCharacters, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            panel.AddWidget(1, 6, btnLocations, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            panel.AddWidget(1, 7, btnFactions, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            panel.AddWidget(1, 8, btnReturn, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            btnGameLog.OnClick       += BtnGameLog_OnClick;
            btnRecentMessage.OnClick += BtnRecentMessage_OnClick;
            btnNotes.OnClick         += BtnNotes_OnClick;
            btnGameConcepts.OnClick  += BtnGameConcepts_OnClick;
            btnCharacters.OnClick    += BtnCharacters_OnClick;
            btnLocations.OnClick     += BtnLocations_OnClick;
            btnFactions.OnClick      += BtnFactions_OnClick;
            btnReturn.OnClick        += BtnReturn_OnClick;

            BtnFactions_OnClick(btnFactions);
        }
Пример #5
0
        public override void Run()
        {
            gameMainPanel = UIManager.Instance.CreatePanel("gameMainPanel", 1.0f, 0.08f, 0.0f, 0.92f);
            gameMainPanel.AddCol(ValueType.Percent);
            gameMainPanel.AddCol(ValueType.Percent);
            gameMainPanel.AddCol(ValueType.Percent);
            gameMainPanel.AddCol(ValueType.Percent);
            gameMainPanel.AddCol(ValueType.Percent);
            gameMainPanel.AddCol(ValueType.Percent);
            gameMainPanel.AddCol(ValueType.Abosulte, 0.1f);
            gameMainPanel.AddCol(ValueType.Abosulte, 180);

            btnTerrain            = UIManager.Instance.CreateButton(UIWidgetLocation.TL_NONE, "btnTerrain", "Terrain", 150);
            btnTerrain.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnTerrain.Top        = 0.025f;
            btnTerrain.OnClick   += BtnTerrain_OnClick;
            gameMainPanel.AddWidget(1, 1, btnTerrain, AlignMode.Left, AlignMode.Center, DockMode.FillWidth);
            if (!GameManager.Instance.IS_ENABLE_EDIT_MODE)
            {
                btnTerrain.Hide();
            }

            btnCamp            = UIManager.Instance.CreateButton(UIWidgetLocation.TL_NONE, "btnCamp", "Camp", 150);
            btnCamp.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnCamp.Top        = 0.025f;
            btnCamp.OnClick   += BtnCamp_OnClick;
            gameMainPanel.AddWidget(1, 2, btnCamp);

            btnReports            = UIManager.Instance.CreateButton(UIWidgetLocation.TL_NONE, "btnReports", "Reports", 150);
            btnReports.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnReports.OnClick   += BtnReports_OnClick;
            btnReports.Top        = 0.025f;
            gameMainPanel.AddWidget(1, 3, btnReports, AlignMode.Left, AlignMode.Center, DockMode.FillWidth);

            btnNotes            = UIManager.Instance.CreateButton(UIWidgetLocation.TL_NONE, "btnNotes", "Notes", 150);
            btnNotes.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnNotes.Top        = 0.025f;
            btnNotes.OnClick   += BtnNotes_OnClick;
            gameMainPanel.AddWidget(1, 4, btnNotes);

            btnInventory            = UIManager.Instance.CreateButton(UIWidgetLocation.TL_NONE, "btnInventory", "Inventory", 150);
            btnInventory.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnInventory.Top        = 0.025f;
            btnInventory.OnClick   += BtnInventory_OnClick;
            gameMainPanel.AddWidget(1, 5, btnInventory, AlignMode.Left, AlignMode.Center, DockMode.FillWidth);

            btnCharacter            = UIManager.Instance.CreateButton(UIWidgetLocation.TL_NONE, "btnCharacter", "Characters", 150);
            btnCharacter.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnCharacter.Top        = 0.025f;
            btnCharacter.OnClick   += BtnCharacter_OnClick;
            gameMainPanel.AddWidget(1, 6, btnCharacter);

            btnParty            = UIManager.Instance.CreateButton(UIWidgetLocation.TL_NONE, "btnParty", "Party", 150);
            btnParty.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnParty.Top        = 0.025f;
            btnParty.OnClick   += BtnParty_OnClick;
            gameMainPanel.AddWidget(1, 7, btnParty, AlignMode.Left, AlignMode.Center, DockMode.FillWidth);

            txtCurrentDate            = UIManager.Instance.CreateStaticText("gameDate", TimerManager.Instance.GetDate());
            txtCurrentTime            = UIManager.Instance.CreateStaticText("gameTime", TimerManager.Instance.CurrentTime.ToString());
            txtCurrentDate.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            txtCurrentTime.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            txtCurrentDate.Top        = 0.015f;
            txtCurrentTime.Top        = 0.03f;
            gameMainPanel.AddWidget(1, 9, txtCurrentDate);
            gameMainPanel.AddWidget(1, 9, txtCurrentTime);
        }
Пример #6
0
        public override void Run()
        {
            var moddata = ScreenManager.Instance.ModData;

            chaData = moddata.CharacterInfos.Where(o => o.ID == chaID).FirstOrDefault();
            if (chaData == null)
            {
                throw new Exception("Character Data can't be null!");
            }

            var skinData = moddata.SkinInfos.Where(o => o.ID == chaData.Skin).FirstOrDefault();

            if (skinData == null)
            {
                throw new Exception("Character Skin Data can't be null!");
            }

            var idleSkinAnim = skinData[ChaAnimType.CAT_IDLE];

            if (idleSkinAnim == null)
            {
                throw new Exception("Idle Skin Anim Data can't be null!");
            }

            var idleAnim = moddata.AnimationInfos.Where(o => o.ID == idleSkinAnim.AnimID).FirstOrDefault();

            if (idleAnim == null)
            {
                throw new Exception("Idle Anim Data can't be null!");
            }

            discordPanel = UIManager.Instance.CreatePanel("discordPanel", 0.3f, 1);
            discordPanel.Padding.PaddingLeft  = 0.01f;
            discordPanel.Padding.PaddingRight = 0.01f;
            discordPanel.ChangeRow(UI.ValueType.Abosulte, 0.05f);
            discordPanel.AddRow(UI.ValueType.Percent);
            var txtDiscord = UIManager.Instance.CreateStaticText("txtDiscord", "Discord");

            txtDiscord.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            discordInventoryPanel = UIManager.Instance.CreatePanel("discordInventoryPanel", 0.3f, 1, 0, 0, 9, 3);
            discordPanel.AddWidget(1, 1, txtDiscord, AlignMode.Center);
            discordPanel.AddWidget(2, 1, discordInventoryPanel, AlignMode.Center, AlignMode.Center, DockMode.Fill);

            int currRow = 1;
            int currCol = 1;

            for (int i = 0; i < 9; i++)
            {
                var invSlot = new PanelTemplateWidget("DiscordInvSlot_" + (i + 1).ToString(), "InventorySlot");
                discordInventoryPanel.AddWidget(currRow, currCol, invSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                if ((i + 1) % 3 == 0)
                {
                    currRow++;
                    currCol = 1;
                }
                else
                {
                    currCol++;
                }
            }


            playerPanel = UIManager.Instance.CreatePanel("playerPanel", 0.4f, 1, 0.3f);
            playerPanel.ChangeRow(UI.ValueType.Abosulte, 0.6f);
            playerPanel.AddRow(UI.ValueType.Abosulte, 0.4f);

            playerEquipPanel = UIManager.Instance.CreatePanel("playerEquipPanel", 1, 1);
            playerEquipPanel.Padding.PaddingLeft  = 0.01f;
            playerEquipPanel.Padding.PaddingRight = 0.01f;
            playerPreviewPanel = UIManager.Instance.CreatePanel("playerPreviewPanel", 1, 1);
            playerPreviewPanel.Padding.PaddingLeft  = 0.01f;
            playerPreviewPanel.Padding.PaddingRight = 0.01f;
            playerPreviewPanel.ChangeCol(UI.ValueType.Abosulte, 0.6f);
            playerPreviewPanel.AddCol(UI.ValueType.Abosulte, 0.4f);
            playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.05f);
            playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.05f);
            playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.05f);
            playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.05f);
            playerPreviewPanel.AddRow(UI.ValueType.Abosulte, 0.1f);

            playerEquipPanel.ChangeRow(UI.ValueType.Abosulte, 0.05f);
            playerEquipPanel.AddRow(UI.ValueType.Percent);
            playerEquipPanel.AddRow(UI.ValueType.Percent);
            playerEquipPanel.AddRow(UI.ValueType.Percent);
            playerEquipPanel.AddRow(UI.ValueType.Percent);
            playerEquipPanel.AddCol(UI.ValueType.Percent);
            playerEquipPanel.AddCol(UI.ValueType.Percent);

            playerPanel.AddWidget(1, 1, playerEquipPanel, AlignMode.Left, AlignMode.Center, DockMode.Fill);
            playerPanel.AddWidget(2, 1, playerPreviewPanel, AlignMode.Left, AlignMode.Center, DockMode.Fill);

            var txtOutfit = UIManager.Instance.CreateStaticText("txtOutfit", "Outfit");
            var txtArms   = UIManager.Instance.CreateStaticText("txtArms", "Arms");

            txtOutfit.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            txtArms.MetricMode   = GuiMetricsMode.GMM_RELATIVE;
            playerEquipPanel.AddWidget(1, 2, txtOutfit, AlignMode.Center);
            playerEquipPanel.AddWidget(1, 3, txtArms, AlignMode.Center);
            for (int i = 0; i < 9; i++)
            {
                var equipSlot = new PanelTemplateWidget("EquipSlot_" + (i + 1).ToString(), "InventorySlot");
                switch (i)
                {
                case 0:
                    playerEquipPanel.AddWidget(2, 2, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                    break;

                case 1:
                    playerEquipPanel.AddWidget(3, 2, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                    break;

                case 2:
                    playerEquipPanel.AddWidget(4, 2, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                    break;

                case 3:
                    playerEquipPanel.AddWidget(5, 1, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                    break;

                case 4:
                    playerEquipPanel.AddWidget(2, 3, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                    break;

                case 5:
                    playerEquipPanel.AddWidget(3, 3, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                    break;

                case 6:
                    playerEquipPanel.AddWidget(4, 3, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                    break;

                case 7:
                    playerEquipPanel.AddWidget(3, 1, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                    break;

                case 8:
                    playerEquipPanel.AddWidget(5, 3, equipSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                    break;
                }
            }

            meshLayer        = OverlayManager.Singleton.Create("CharacterPreview");
            meshLayer.ZOrder = (ushort)(UIManager.Instance.GetCursorContainer().ZOrder - 1);
            gameObject       = new Character(world, chaData, skinData, new Mogre.Vector3(), true);
            float length = gameObject.Mesh.Entity.BoundingBox.Size.Length * 2;

            gameObject.Mesh.Entity.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_MAX;
            gameObject.Mesh.EntityNode.Translate(new Mogre.Vector3(-2f, -6.3f, -1.0f * length));
            gameObject.Mesh.EntityNode.Scale(0.7f, 0.8f, 0.8f);
            meshLayer.Add3D(gameObject.MeshNode);
            meshLayer.Show();

            var txtPreviewHeadArmourTotal = UIManager.Instance.CreateStaticText("txtPreviewHeadArmourTotal", "Head Armour Total: 0");
            var txtPreviewBodyArmourTotal = UIManager.Instance.CreateStaticText("txtPreviewBodyArmourTotal", "Body Armour Total: 0");
            var txtPreviewLegArmourTotal  = UIManager.Instance.CreateStaticText("txtPreviewLegArmourTotal", "Leg Armour Total: 0");
            var txtPreviewEncumbrance     = UIManager.Instance.CreateStaticText("txtPreviewEncumbrance", "Encumbrance: 0");

            txtPreviewHeadArmourTotal.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            txtPreviewBodyArmourTotal.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            txtPreviewLegArmourTotal.MetricMode  = GuiMetricsMode.GMM_RELATIVE;
            txtPreviewEncumbrance.MetricMode     = GuiMetricsMode.GMM_RELATIVE;
            var btnReturn = UIManager.Instance.CreateButton("btnInventoryReturn", "Return", 200);

            btnReturn.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            btnReturn.OnClick   += (sender) =>
            {
                ScreenManager.Instance.ChangeScreenReturn();
            };
            playerPreviewPanel.AddWidget(2, 2, txtPreviewHeadArmourTotal, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            playerPreviewPanel.AddWidget(3, 2, txtPreviewBodyArmourTotal, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            playerPreviewPanel.AddWidget(4, 2, txtPreviewLegArmourTotal, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            playerPreviewPanel.AddWidget(5, 2, txtPreviewEncumbrance, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);
            playerPreviewPanel.AddWidget(6, 2, btnReturn, AlignMode.Center, AlignMode.Center, DockMode.FillWidth);

            backpackPanel = UIManager.Instance.CreatePanel("backpackPanel", 0.3f, 1, 0.7f, 0);
            backpackPanel.Padding.PaddingRight = 0.01f;
            backpackPanel.Padding.PaddingLeft  = 0.01f;
            backpackPanel.ChangeRow(UI.ValueType.Abosulte, 0.05f);
            backpackPanel.AddRow(UI.ValueType.Percent);
            backpackPanel.AddRow(UI.ValueType.Abosulte, 0.03f);

            var txtInvTitle = UIManager.Instance.CreateStaticText("txtInvTitle", "Inventory");

            txtInvTitle.MetricMode = GuiMetricsMode.GMM_RELATIVE;
            backpackInventoryPanel = UIManager.Instance.CreateScrollablePanel("backpackInventoryPanel", 1, 1, 0, 0, 20, 3);
            backpackPanel.AddWidget(1, 1, txtInvTitle, AlignMode.Center, AlignMode.Center, DockMode.Fill);
            backpackPanel.AddWidget(2, 1, backpackInventoryPanel, AlignMode.Center, AlignMode.Center, DockMode.Fill);

            int curRow = 1;
            int curCol = 1;

            for (int i = 0; i < 60; i++)
            {
                var invSlot = new PanelTemplateWidget("InvSlot_" + (i + 1).ToString(), "InventorySlot");
                invSlot.Height = 0.1f;
                backpackInventoryPanel.ChangeRow(UI.ValueType.Abosulte, invSlot.Height, curRow);
                backpackInventoryPanel.AddWidget(curRow, curCol, invSlot, AlignMode.Center, AlignMode.Center, DockMode.Fill);
                if ((i + 1) % 3 == 0)
                {
                    curRow++;
                    curCol = 1;
                }
                else
                {
                    curCol++;
                }
            }
        }