Пример #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
        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);
        }
Пример #3
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++;
                }
            }
        }