Exemplo n.º 1
0
        public override void OnInitialize()
        {
            mainPanel         = new UIDragablePanel(true, true, true);
            mainPanel.caption = caption;
            mainPanel.SetPadding(6);
            mainPanel.Left.Set(714f, 0f);
            mainPanel.Top.Set(400f, 0f);
            mainPanel.Width.Set(314f, 0f);
            mainPanel.MinWidth.Set(314f, 0f);
            mainPanel.MaxWidth.Set(1393f, 0f);
            mainPanel.Height.Set(116, 0f);
            mainPanel.MinHeight.Set(116, 0f);
            mainPanel.MaxHeight.Set(1000, 0f);
            Append(mainPanel);

            Texture2D texture = ChestBrowser.instance.GetTexture("UIElements/closeButton");

            closeButton          = new UIHoverImageButton(texture, "Close");
            closeButton.OnClick += CloseButtonClicked;
            closeButton.Left.Set(-20f, 1f);
            closeButton.Top.Set(3f, 0f);
            mainPanel.Append(closeButton);

            inlaidPanel = new UIPanel();
            inlaidPanel.SetPadding(6);
            inlaidPanel.Top.Pixels = 20;
            inlaidPanel.Width.Set(0, 1f);
            inlaidPanel.Height.Set(0 - 40, 1f);
            mainPanel.Append(inlaidPanel);

            chestGrid = new UIGrid();
            chestGrid.Width.Set(-20f, 1f);
            chestGrid.Height.Set(0, 1f);
            chestGrid.ListPadding = 2f;
            inlaidPanel.Append(chestGrid);

            var lootItemsScrollbar = new FixedUIScrollbar(userInterface);

            lootItemsScrollbar.SetView(100f, 1000f);
            lootItemsScrollbar.Height.Set(0, 1f);
            lootItemsScrollbar.Left.Set(-20, 1f);
            inlaidPanel.Append(lootItemsScrollbar);
            chestGrid.SetScrollbar(lootItemsScrollbar);
        }
Exemplo n.º 2
0
        public void InitializeUI()
        {
            RemoveAllChildren();
            chestTypeExist   = new bool[Chest.chestTypeToIcon.Length];
            chestTypeView    = Enumerable.Repeat <bool>(true, Chest.chestTypeToIcon.Length).ToArray();
            dresserTypeExist = new bool[Chest.dresserTypeToIcon.Length];
            dresserTypeView  = Enumerable.Repeat <bool>(true, Chest.dresserTypeToIcon.Length).ToArray();
            filterItemList   = new List <int>();

            //メインパネル
            panelMain         = new UIDragablePanel(true, true, true);
            panelMain.caption = caption;
            panelMain.SetPadding(6);
            panelMain.Left.Set(400f, 0f);
            panelMain.Top.Set(400f, 0f);
            panelMain.Width.Set(314f, 0f);
            panelMain.MinWidth.Set(314f, 0f);
            panelMain.MaxWidth.Set(1393f, 0f);
            panelMain.Height.Set(131f, 0f);
            panelMain.MinHeight.Set(131f, 0f);
            panelMain.MaxHeight.Set(1000f, 0f);
            Append(panelMain);

            //フィルターパネル
            panelFilterChestType = new UIPanel();
            panelFilterChestType.SetPadding(6);
            panelFilterChestType.MinWidth.Set(100, 0);
            gridFilterChestType = new UIGrid();
            gridFilterChestType.Width.Set(-20f, 1f);
            gridFilterChestType.Height.Set(0, 1f);
            gridFilterChestType.ListPadding = 2f;
            panelFilterChestType.Append(gridFilterChestType);
            var filterGridScrollbar = new FixedUIScrollbar(userInterface);

            filterGridScrollbar.SetView(100f, 1000f);
            filterGridScrollbar.Height.Set(0, 1f);
            filterGridScrollbar.Left.Set(-20, 1f);
            panelFilterChestType.Append(filterGridScrollbar);
            gridFilterChestType.SetScrollbar(filterGridScrollbar);
            //アイテムフィルターパネル
            panelFilterItem = new UIPanel();
            panelFilterItem.SetPadding(6);
            panelFilterItem.MinWidth.Set(100, 0);
            gridFilterItem = new UIGrid();
            gridFilterItem.Width.Set(-20f, 1f);
            gridFilterItem.Height.Set(0, 1f);
            gridFilterItem.ListPadding = 2f;
            panelFilterItem.Append(gridFilterItem);
            var itemFilterGridScrollbar = new FixedUIScrollbar(userInterface);

            itemFilterGridScrollbar.SetView(100f, 1000f);
            itemFilterGridScrollbar.Height.Set(0, 1f);
            itemFilterGridScrollbar.Left.Set(-20, 1f);
            panelFilterItem.Append(itemFilterGridScrollbar);
            gridFilterItem.SetScrollbar(itemFilterGridScrollbar);
            //チェストパネル
            panelChest = new UIPanel();
            panelChest.SetPadding(6);
            panelChest.MinWidth.Set(100, 0);
            gridChest = new UIGrid();
            gridChest.Width.Set(-20f, 1f);
            gridChest.Height.Set(0, 1f);
            gridChest.ListPadding = 2f;
            panelChest.Append(gridChest);
            var chestGridScrollbar = new FixedUIScrollbar(userInterface);

            chestGridScrollbar.SetView(100f, 1000f);
            chestGridScrollbar.Height.Set(0, 1f);
            chestGridScrollbar.Left.Set(-20, 1f);
            panelChest.Append(chestGridScrollbar);
            gridChest.SetScrollbar(chestGridScrollbar);
            //スプリッターパネル
            panelSplitter = new UISplitterPanel(panelFilterChestType, panelChest);
            panelSplitter.SetPadding(0);
            panelSplitter.Top.Pixels = menuIconSize + menuMargin * 2;
            panelSplitter.Width.Set(0, 1f);
            panelSplitter.Height.Set(-26 - menuIconSize, 1f);
            panelSplitter.Panel1Visible = false;
            panelMain.Append(panelSplitter);

            //閉じるボタン
            Texture2D texture = ChestBrowser.instance.GetTexture("UIElements/closeButton");

            btnClose          = new UIHoverImageButton(texture, "Close");
            btnClose.OnClick += (a, b) => ChestBrowser.instance.chestBrowserTool.visible = false;
            btnClose.Left.Set(-20f, 1f);
            btnClose.Top.Set(3f, 0f);
            panelMain.Append(btnClose);

            //線表示ボタン
            btnLine = new UIImageListButton(
                new List <Texture2D>()
            {
                Main.inventoryTickOnTexture.Resize(menuIconSize), Main.inventoryTickOffTexture.Resize(menuIconSize)
            },
                new List <object>()
            {
                true, false
            },
                new List <string>()
            {
                "Display line", "Hide line"
            });
            btnLine.OnClick += (a, b) => btnLine.NextIamge();
            btnLine.Left.Set(btnClose.Left.Pixels - menuMargin - menuIconSize, 1f);
            btnLine.Top.Set(3f, 0f);
            panelMain.Append(btnLine);

            //アイコンサイズボタン
            btnIconSize = new UIImageListButton(
                new List <Texture2D>()
            {
                Main.itemTexture[ItemID.Chest].Resize(menuIconSize),
                Main.itemTexture[ItemID.Chest].Resize((int)(menuIconSize * 0.8f)),
                Main.itemTexture[ItemID.Chest].Resize((int)(menuIconSize * 0.6f))
            },
                new List <object>()
            {
                1.0f, 0.8f, 0.6f
            },
                new List <string>()
            {
                "Icon size large", "Icon size medium", "Icon size small"
            });
            btnIconSize.OnClick += (a, b) =>
            {
                btnIconSize.NextIamge();
                UIItemSlot.scale = btnIconSize.GetValue <float>();
            };
            btnIconSize.Left.Set(btnLine.Left.Pixels - menuMargin - menuIconSize, 1f);
            btnIconSize.Top.Set(3f, 0f);
            panelMain.Append(btnIconSize);

            //フィルターボタン
            btnFilterChestType = new UIImageListButton(
                new List <Texture2D>()
            {
                Main.itemTexture[ItemID.Chest].Resize(menuIconSize), Main.itemTexture[ItemID.GoldChest].Resize(menuIconSize)
            },
                new List <object>()
            {
                false, true
            },
                new List <string>()
            {
                "Hide filter", "Display filter"
            });
            btnFilterChestType.OnClick += (a, b) =>
            {
                btnFilterChestType.NextIamge();
                if (btnFilterChestType.GetValue <bool>())
                {
                    btnFilterItem.Index = 0;
                }
                ChangeSpliterPanel();
            };
            btnFilterChestType.Left.Set(menuMargin, 0f);
            btnFilterChestType.Top.Set(3f, 0f);
            panelMain.Append(btnFilterChestType);

            //リバースボタン
            btnFilterChestTypeReverse = new UIImageListButton(
                new List <Texture2D>()
            {
                ChestBrowser.instance.GetTexture("UIElements/reverseButton2").Resize(menuIconSize),
                ChestBrowser.instance.GetTexture("UIElements/reverseButton1").Resize(menuIconSize)
            },
                new List <object>()
            {
                false, true
            },
                new List <string>()
            {
                "Not filter reverse", "Filter reverse"
            });
            btnFilterChestTypeReverse.OnClick += (a, b) =>
            {
                btnFilterChestTypeReverse.NextIamge();
                updateNeeded = true;
            };
            btnFilterChestTypeReverse.Left.Set(btnFilterChestType.Left.Pixels + menuIconSize + menuMargin, 0f);
            btnFilterChestTypeReverse.Top.Set(3f, 0f);
            panelMain.Append(btnFilterChestTypeReverse);

            //アイテムフィルターボタン
            btnFilterItem = new UIImageListButton(
                new List <Texture2D>()
            {
                Main.itemTexture[ItemID.Chest].Resize(menuIconSize), Main.itemTexture[ItemID.GoldChest].Resize(menuIconSize)
            },
                new List <object>()
            {
                false, true
            },
                new List <string>()
            {
                "Hide item filter", "Display item filter"
            });
            btnFilterItem.OnClick += (a, b) =>
            {
                btnFilterItem.NextIamge();
                if (btnFilterItem.GetValue <bool>())
                {
                    btnFilterChestType.Index = 0;
                }
                ChangeSpliterPanel();
            };
            btnFilterItem.Left.Set(btnFilterChestTypeReverse.Left.Pixels + (menuIconSize + menuMargin) * 2, 0f);
            btnFilterItem.Top.Set(3f, 0f);
            panelMain.Append(btnFilterItem);

            //名前フィルターボタン
            btnFilterChestName = new UIImageListButton(
                new List <Texture2D>()
            {
                Main.itemTexture[ItemID.AlphabetStatueA].Resize(menuIconSize),
                Main.itemTexture[ItemID.AlphabetStatueN].Resize(menuIconSize),
                Main.itemTexture[ItemID.AlphabetStatueU].Resize(menuIconSize)
            },
                new List <object>()
            {
                0, 1, 2
            },
                new List <string>()
            {
                "Named chest filter: All", "Named chest filter: Named", "Named chest filter: No names"
            });
            btnFilterChestName.OnClick += (a, b) =>
            {
                btnFilterChestName.NextIamge();
                updateNeeded = true;
            };
            btnFilterChestName.Left.Set(btnFilterItem.Left.Pixels + (menuIconSize + menuMargin) * 2, 0f);
            btnFilterChestName.Top.Set(3f, 0f);
            panelMain.Append(btnFilterChestName);
        }