public void InitializeUI() { RemoveAllChildren(); //メインパネル 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); //バナーパネル panelBanner = new UIPanel(); panelBanner.SetPadding(6); panelBanner.MinWidth.Set(100, 0); gridBanner = new UIGrid(); gridBanner.Width.Set(-20f, 1f); gridBanner.Height.Set(0, 1f); gridBanner.ListPadding = 2f; panelBanner.Append(gridBanner); var chestGridScrollbar = new FixedUIScrollbar(userInterface); chestGridScrollbar.SetView(100f, 1000f); chestGridScrollbar.Height.Set(0, 1f); chestGridScrollbar.Left.Set(-20, 1f); panelBanner.Append(chestGridScrollbar); gridBanner.SetScrollbar(chestGridScrollbar); //スプリッターパネル panelSplitter = new UISplitterPanel(panelFilterChestType, panelBanner); 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 = BannerChecklist.instance.GetTexture("UIElements/closeButton"); btnClose = new UIHoverImageButton(texture, "Close"); btnClose.OnClick += (a, b) => BannerChecklist.instance.bannerChecklistTool.visible = false; btnClose.Left.Set(-20f, 1f); btnClose.Top.Set(3f, 0f); panelMain.Append(btnClose); //ターゲット表示ボタン btnDisplayTarget = new UIImageListButton( new List <Texture2D>() { Main.inventoryTickOnTexture.Resize(menuIconSize), Main.inventoryTickOffTexture.Resize(menuIconSize) }, new List <object>() { true, false }, new List <string>() { "Display target npc", "Hide target npc" }); btnDisplayTarget.OnClick += (a, b) => { btnDisplayTarget.NextIamge(); BannerChecklist.instance.bannerChecklistTool.isDisplayTarget = btnDisplayTarget.GetValue <bool>(); }; btnDisplayTarget.Left.Set(btnClose.Left.Pixels - menuMargin - menuIconSize, 1f); btnDisplayTarget.Top.Set(3f, 0f); panelMain.Append(btnDisplayTarget); //アイコンサイズボタン 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(btnDisplayTarget.Left.Pixels - menuMargin - menuIconSize, 1f); btnIconSize.Top.Set(3f, 0f); panelMain.Append(btnIconSize); //フィルターボタン btnFilter = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AlphabetStatueF].Resize(menuIconSize), Main.itemTexture[ItemID.AlphabetStatueF].Resize(menuIconSize), Main.itemTexture[ItemID.AlphabetStatueF].Resize(menuIconSize), }, new List <object>() { FilterMode.All, FilterMode.Unacquired, FilterMode.Acquired }, new List <string>() { "Filter: All", "Filter: Unacquired", "Filter: Acquired" }); btnFilter.OnClick += (a, b) => { btnFilter.NextIamge(); updateNeeded = true; }; btnFilter.Left.Set(menuMargin, 0f); btnFilter.Top.Set(3f, 0f); panelMain.Append(btnFilter); //ソートボタン btnSort = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AlphabetStatueS].Resize(menuIconSize), Main.itemTexture[ItemID.AlphabetStatueS].Resize(menuIconSize), }, new List <object>() { SortMode.ItemID, SortMode.KillCount }, new List <string>() { "Sort: ItemID", "Sort: KillCount" }); btnSort.OnClick += (a, b) => { btnSort.NextIamge(); gridBanner.UpdateOrder(); }; btnSort.Left.Set(btnFilter.Left.Pixels + (menuIconSize + menuMargin) * 2, 0f); btnSort.Top.Set(3f, 0f); panelMain.Append(btnSort); //ソートリバースボタン btnSortReverse = new UIImageListButton( new List <Texture2D>() { BannerChecklist.instance.GetTexture("UIElements/reverseButton2").Resize(menuIconSize), BannerChecklist.instance.GetTexture("UIElements/reverseButton1").Resize(menuIconSize) }, new List <object>() { false, true }, new List <string>() { "Off sort reverse", "On sort reverse" }); btnSortReverse.OnClick += (a, b) => { btnSortReverse.NextIamge(); gridBanner.UpdateOrder(); }; btnSortReverse.Left.Set(btnSort.Left.Pixels + menuIconSize + menuMargin, 0f); btnSortReverse.Top.Set(3f, 0f); panelMain.Append(btnSortReverse); //Modフィルターボタン if (btnFilterMod != null) { btnFilterMod.Left.Set(btnSortReverse.Left.Pixels + (menuIconSize + menuMargin) * 2, 0f); btnFilterMod.Top.Set(3f, 0f); panelMain.Append(btnFilterMod); } }
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); }
public void InitializeUI() { RemoveAllChildren(); //メインパネル 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(116f, 0f); panelMain.MinHeight.Set(116f, 0f); panelMain.MaxHeight.Set(1000f, 0f); Append(panelMain); //左パネル panelLeft = new UIPanel(); panelLeft.SetPadding(6); panelLeft.MinWidth.Set(100, 0); gridLeft = new UIGrid(); gridLeft.Width.Set(-20f, 1f); gridLeft.Height.Set(0, 1f); gridLeft.ListPadding = 2f; panelLeft.Append(gridLeft); var gridLeftScrollbar = new FixedUIScrollbar(userInterface); gridLeftScrollbar.SetView(100f, 1000f); gridLeftScrollbar.Height.Set(0, 1f); gridLeftScrollbar.Left.Set(-20, 1f); panelLeft.Append(gridLeftScrollbar); gridLeft.SetScrollbar(gridLeftScrollbar); //右パネル panelRight = new UIPanel(); panelRight.SetPadding(6); panelRight.MinWidth.Set(100, 0); gridRight = new UIGrid(); gridRight.Width.Set(-20f, 1f); gridRight.Height.Set(0, 1f); gridRight.ListPadding = 2f; panelRight.Append(gridRight); var chestGridScrollbar = new FixedUIScrollbar(userInterface); chestGridScrollbar.SetView(100f, 1000f); chestGridScrollbar.Height.Set(0, 1f); chestGridScrollbar.Left.Set(-20, 1f); panelRight.Append(chestGridScrollbar); gridRight.SetScrollbar(chestGridScrollbar); //スプリッターパネル panelSplitter = new UISplitterPanel(panelLeft, panelRight); 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 = ProtectTools.instance.GetTexture("UIElements/closeButton"); btnClose = new UIHoverImageButton(texture, "Close"); btnClose.OnClick += (a, b) => ProtectTools.instance.tileWallTool.visible = false; btnClose.Left.Set(-20f, 1f); btnClose.Top.Set(3f, 0f); panelMain.Append(btnClose); UIItemSlot.defaultBackgroundTexture = UIItemSlot.defaultBackgroundTexture.Resize(32, 32); UIItemSlot.selectedBackgroundTexture = UIItemSlot.selectedBackgroundTexture.Resize(32, 32); //アイコンサイズボタン 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(btnClose.Left.Pixels - menuMargin - menuIconSize, 1f); btnIconSize.Top.Set(3f, 0f); panelMain.Append(btnIconSize); //フィルターボタン int leftPos = menuMargin; btnFilterNear = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AlphabetStatueF].Resize(menuIconSize), Main.itemTexture[ItemID.AlphabetStatueF].Resize(menuIconSize) }, new List <object>() { true, false }, new List <string>() { "Filter near", "Filter none" }); btnFilterNear.OnClick += (a, b) => { btnFilterNear.NextIamge(); updateNeeded = true; }; btnFilterNear.Left.Set(leftPos, 0f); btnFilterNear.Top.Set(3f, 0f); panelMain.Append(btnFilterNear); //タイル表示/非表示ボタン leftPos += menuIconSize + menuMargin; btnShowTile = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.DirtBlock].Resize(menuIconSize), Main.itemTexture[ItemID.DirtBlock].Resize(menuIconSize) }, new List <object>() { true, false }, new List <string>() { "Display Tiles", "Hide Tiles" }); btnShowTile.OnClick += (a, b) => { btnShowTile.NextIamge(); showTiles = btnShowTile.GetValue <bool>(); updateNeeded = true; }; btnShowTile.Left.Set(leftPos, 0f); btnShowTile.Top.Set(3f, 0f); panelMain.Append(btnShowTile); //壁紙表示/非表示ボタン leftPos += menuIconSize + menuMargin; btnShowWall = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.WoodWall].Resize(menuIconSize), Main.itemTexture[ItemID.WoodWall].Resize(menuIconSize) }, new List <object>() { true, false }, new List <string>() { "Display Walls", "Hide Walls" }); btnShowWall.OnClick += (a, b) => { btnShowWall.NextIamge(); showWalls = btnShowWall.GetValue <bool>(); updateNeeded = true; }; btnShowWall.Left.Set(leftPos, 0f); btnShowWall.Top.Set(3f, 0f); panelMain.Append(btnShowWall); //スロープボタン leftPos += menuIconSize + menuMargin; texture = ProtectTools.instance.GetTexture("UIElements/blocks"); btnSlope = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AlphabetStatueA].Resize(menuIconSize), texture.Offset(0, 0, 16, 16).Resize(menuIconSize), texture.Offset(16, 0, 16, 16).Resize(menuIconSize), texture.Offset(32, 0, 16, 16).Resize(menuIconSize), texture.Offset(48, 0, 16, 16).Resize(menuIconSize), texture.Offset(64, 0, 16, 16).Resize(menuIconSize), texture.Offset(80, 0, 16, 16).Resize(menuIconSize) }, new List <object>() { -1, 0, 5, 1, 2, 3, 4 }, new List <string>() { "Slope: Auto", "Slope: Block", "Slope: Half", "Slope: TopRight", "Slope: TopLeft", "Slope: BottomRight", "Slope: BottomLeft" }); btnSlope.OnClick += (a, b) => { btnSlope.NextIamge(); }; btnSlope.OnRightClick += (a, b) => { btnSlope.PrevIamge(); }; btnSlope.Left.Set(leftPos, 0f); btnSlope.Top.Set(3f, 0f); panelMain.Append(btnSlope); //リバースボタン leftPos += menuIconSize + menuMargin; btnReverse = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AlphabetStatueR].Resize(menuIconSize) }, new List <object>() { 0 }, new List <string>() { "Selection reverse" }); btnReverse.OnClick += (a, b) => { gridRight._items.ForEach(x => x.RightClick(new UIMouseEvent(x, Main.MouseScreen))); }; btnReverse.Left.Set(leftPos, 0f); btnReverse.Top.Set(3f, 0f); panelMain.Append(btnReverse); //リロードボタン leftPos += (menuIconSize + menuMargin) * 2; btnReload = new UIImageListButton( new List <Texture2D>() { ProtectTools.instance.GetTexture("UIElements/reload").Resize(menuIconSize) }, new List <object>() { 0 }, new List <string>() { "Reload" }); btnReload.OnClick += (a, b) => { updateNeeded = true; }; btnReload.Left.Set(leftPos, 0f); btnReload.Top.Set(3f, 0f); panelMain.Append(btnReload); }