public override void OnInitialize() { Main.recBigList = false; Main.playerInventory = true; reforgePanel = new UIReforgePanel(() => reforgeSlot.item, () => reforgePrice); reforgePanel.SetPadding(4); reforgePanel.Top.Pixels = Main.instance.invBottom + 60; reforgePanel.Left.Pixels = 110; reforgePanel.MinHeight.Pixels = 260; reforgeSlot = new UIItemSlot(0.85f); reforgeSlot.Top.Pixels = reforgeSlot.Left.Pixels = 12; reforgeSlot.CanClick += () => Main.mouseItem.type == 0 || Main.mouseItem.Prefix(-3); reforgeSlot.OnMouseDown += (a, b) => { selectedPrefixes.Clear(); OnItemChanged(); }; reforgePanel.Append(reforgeSlot); reforgeButton = new UIFancyButton(Main.reforgeTexture[0], Main.reforgeTexture[1]); reforgeButton.Top.Pixels = 20; reforgeButton.Left.Pixels = 64; reforgeButton.CanClick += CanReforgeItem; reforgeButton.OnMouseDown += OnReforgeButtonClick; reforgeButton.HoverText = Language.GetTextValue("LegacyInterface.19"); reforgePanel.Append(reforgeButton); reforgeListPanel = new UIPanel(); reforgeListPanel.Top.Pixels = 70; reforgeListPanel.Left.Pixels = 12; reforgeListPanel.Width.Set(-24, 1); reforgeListPanel.Height.Set(-82, 1); reforgeListPanel.SetPadding(6); reforgeListPanel.BackgroundColor = Color.CadetBlue; reforgePanel.Append(reforgeListPanel); reforgeList = new UIList(); reforgeList.Width.Precent = reforgeList.Height.Precent = 1f; reforgeList.Width.Pixels = -24; reforgeList.ListPadding = 2; reforgeListPanel.Append(reforgeList); var reforgeListScrollbar = new FixedUIScrollbar(GadgetBox.Instance.reforgeMachineInterface); reforgeListScrollbar.SetView(100f, 1000f); reforgeListScrollbar.Top.Pixels = 4; reforgeListScrollbar.Height.Set(-8, 1f); reforgeListScrollbar.Left.Set(-20, 1f); reforgeListPanel.Append(reforgeListScrollbar); reforgeList.SetScrollbar(reforgeListScrollbar); Append(reforgePanel); }
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); }
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(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(); panelMain = new UINPCInfoMainPanel(true, true, true); panelMain.caption = caption; panelMain.SetPadding(6); panelMain.Left.Set(400f, 0f); panelMain.Top.Set(400f, 0f); panelMain.Width.Set(290f, 0f); panelMain.MinWidth.Set(290f, 0f); panelMain.MaxWidth.Set(Main.screenWidth, 0f); panelMain.Height.Set(298, 0f); panelMain.MinHeight.Set(124, 0f); panelMain.MaxHeight.Set(Main.screenHeight, 0f); Texture2D texture = ModLoader.GetMod("NPCInfo").GetTexture("UIElements/closeButton"); closeButton = new UIHoverImageButton(texture, "Close"); closeButton.OnClick += (a, b) => ShowNPCInfo = false; closeButton.Left.Set(-20f, 1f); closeButton.Top.Set(6f, 0f); panelMain.Append(closeButton); inlaidPanel = new UIPanel(); inlaidPanel.SetPadding(5); inlaidPanel.Top.Pixels = 32; inlaidPanel.Width.Set(0, 1f); inlaidPanel.Height.Set(-50, 1f); panelMain.Append(inlaidPanel); gridNPC = new UIGrid(); gridNPC.Width.Set(-20f, 1f); gridNPC.Height.Set(0, 1f); gridNPC.ListPadding = 2f; inlaidPanel.Append(gridNPC); var lootItemsScrollbar = new FixedUIScrollbar(userInterface); lootItemsScrollbar.SetView(100f, 1000f); lootItemsScrollbar.Height.Set(0, 1f); lootItemsScrollbar.Left.Set(-20, 1f); inlaidPanel.Append(lootItemsScrollbar); gridNPC.SetScrollbar(lootItemsScrollbar); int leftPos = menuMargin; btnViewMode = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AlphabetStatue1].Resize(menuIconSize), Main.itemTexture[ItemID.AlphabetStatue2].Resize(menuIconSize), Main.itemTexture[ItemID.AlphabetStatue3].Resize(menuIconSize) }, new List <object>() { ViewMode.CombatNPC, ViewMode.SpawnNPC, ViewMode.DropItem }, new List <string>() { "Combat NPC", "Spawn NPC", "Drop Item" }); btnViewMode.OnClick += (a, b) => { btnViewMode.NextIamge(); ChangeViewMode(); }; btnViewMode.OnRightClick += (a, b) => { btnViewMode.PrevIamge(); ChangeViewMode(); }; btnViewMode.Left.Set(leftPos, 0f); btnViewMode.Top.Set(0f, 0f); panelMain.Append(btnViewMode); btnSpawnNPCFilter = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AlphabetStatue1].Resize(menuIconSize), Main.itemTexture[ItemID.AlphabetStatue2].Resize(menuIconSize) }, new List <object>() { SpawnNPCFilter.All, SpawnNPCFilter.HideTownNPC }, new List <string>() { "Spawn NPC: All", "Spawn NPC: Hide twon NPC" }); btnSpawnNPCFilter.OnClick += (a, b) => { btnSpawnNPCFilter.NextIamge(); ChangeSpawnNPCFilter(); }; btnSpawnNPCFilter.OnRightClick += (a, b) => { btnSpawnNPCFilter.PrevIamge(); ChangeSpawnNPCFilter(); }; leftPos += menuIconSize + menuMargin; btnSpawnNPCFilter.Left.Set(leftPos, 0f); btnSpawnNPCFilter.Top.Set(0f, 0f); updateNeeded = true; }
public void InitializeUI() { RemoveAllChildren(); panelMain = new UIDragablePanel(true, true, true); panelMain.caption = caption; panelMain.drawCaptionPosition = 1; panelMain.SetPadding(6); panelMain.Left.Set(438f, 0f); panelMain.Top.Set(400f, 0f); panelMain.Width.Set(300f, 0f); panelMain.MinWidth.Set(300f, 0f); panelMain.MaxWidth.Set(Main.screenWidth, 0f); panelMain.Height.Set(210, 0f); panelMain.MinHeight.Set(210, 0f); panelMain.MaxHeight.Set(Main.screenHeight, 0f); Texture2D texture = ModLoader.GetMod("TeraCAD").GetTexture("UIElements/closeButton"); closeButton = new UIHoverImageButton(texture, "Close"); closeButton.OnClick += (a, b) => Show = false; closeButton.Left.Set(-20f, 1f); closeButton.Top.Set(6f, 0f); panelMain.Append(closeButton); float topPos = 0; float leftPos = menuMargin; //ボタン:ロード btnLoad = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AlphabetStatueL].Resize(menuIconSize) }, new List <object>() { 0 }, new List <string>() { "Load image" }, 0); var btn = btnLoad; btn.OnClick += (a, b) => LoadImage(); leftPos += menuMargin; btn.Left.Set(leftPos, 0f); btn.Top.Set(topPos, 0f); panelMain.Append(btn); //ボタン:配置モード btnPositionMode = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AlphabetStatueW].Resize(menuIconSize), Main.itemTexture[ItemID.AlphabetStatueS].Resize(menuIconSize) }, new List <object>() { ImagePositionMode.World, ImagePositionMode.Screen }, new List <string>() { "Image position: World", "Image position: Screen" }, 0); btn = btnPositionMode; btn.OnClick += (a, b) => btn.NextIamge(); leftPos += menuIconSize + menuMargin; btn.Left.Set(leftPos, 0f); btn.Top.Set(topPos, 0f); panelMain.Append(btn); //ツールボックス panelGrid = new UIPanel(); var panel = panelGrid; panel.SetPadding(6); panel.Top.Set(32, 0f); panel.Width.Set(0, 1f); panel.Height.Set(-40, 1f); panelMain.Append(panel); grid = new UIGrid(); grid.Width.Set(-20f, 1f); grid.Height.Set(0, 1f); grid.ListPadding = 2f; panel.Append(grid); var scrollbar = new FixedUIScrollbar(userInterface); scrollbar.SetView(100f, 1000f); scrollbar.Height.Set(0, 1f); scrollbar.Left.Set(-20, 1f); panel.Append(scrollbar); grid.SetScrollbar(scrollbar); slider = new UISlider(); slider.Value = 0.8f; leftPos += menuIconSize + menuMargin; slider.Left.Set(leftPos, 0f); slider.Top.Set(topPos, 0f); panelMain.Append(slider); updateNeeded = true; }
public void InitializeUI() { RemoveAllChildren(); panelMain = new UIDragablePanel(true, true, true); panelMain.caption = caption; panelMain.drawCaptionPosition = 0; panelMain.SetPadding(6); panelMain.Left.Set(240f, 0f); panelMain.Top.Set(400f, 0f); panelMain.Width.Set(196f, 0f); panelMain.MinWidth.Set(196f, 0f); panelMain.MaxWidth.Set(Main.screenWidth, 0f); panelMain.Height.Set(142, 0f); panelMain.MinHeight.Set(110, 0f); panelMain.MaxHeight.Set(Main.screenHeight, 0f); Texture2D texture = ModLoader.GetMod("TeraCAD").GetTexture("UIElements/closeButton"); closeButton = new UIHoverImageButton(texture, "Close"); closeButton.OnClick += (a, b) => Show = false; closeButton.Left.Set(-20f, 1f); //closeButton.Top.Set(6f, 0f); closeButton.Top.Set(0f, 0f); panelMain.Append(closeButton); //float topPos = menuMargin + Main.fontMouseText.MeasureString(caption).Y; float topPos = 0; float leftPos = 0; //ボタン:レンジ矩形 texture = ModLoader.GetMod("TeraCAD").GetTexture("UIElements/rangeRectangle"); btnRangeRect = new UIImageListButton( new List <Texture2D>() { texture, texture }, new List <object>() { true, false }, new List <string>() { "Display range rectangle: On", "Display range rectangle: Off" }, 1); btnRangeRect.OnClick += (a, b) => { btnRangeRect.NextIamge(); btnRangeRect.visibilityActive = btnRangeRect.visibilityInactive = btnRangeRect.GetValue <bool>() ? 1.0f : 0.4f; }; leftPos += menuMargin; btnRangeRect.Left.Set(leftPos, 0f); btnRangeRect.Top.Set(topPos, 0f); panelMain.Append(btnRangeRect); //ボタン:フライカメラ btnFlyCam = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.AngelWings].Resize(menuIconSize), Main.itemTexture[ItemID.AngelWings].Resize(menuIconSize), }, new List <object>() { true, false }, new List <string>() { "Fly cam: On", "Fly cam: Off" }, 1); btnFlyCam.OnClick += (a, b) => { btnFlyCam.NextIamge(); FlyCam.Enabled = btnFlyCam.GetValue <bool>(); btnFlyCam.visibilityActive = btnFlyCam.visibilityInactive = btnFlyCam.GetValue <bool>() ? 1.0f : 0.4f; }; leftPos += menuMargin + menuIconSize; btnFlyCam.Left.Set(leftPos, 0f); btnFlyCam.Top.Set(topPos, 0f); panelMain.Append(btnFlyCam); //ボタン:レンジ btnRange = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.Toolbelt].Resize(menuIconSize), Main.itemTexture[ItemID.Toolbelt].Resize(menuIconSize), }, new List <object>() { true, false }, new List <string>() { "Infinity range: On", "Infinity range: Off" }, 1); btnRange.OnClick += (a, b) => { btnRange.NextIamge(); btnRange.visibilityActive = btnRange.visibilityInactive = btnRange.GetValue <bool>() ? 1.0f : 0.4f; }; leftPos += menuMargin + menuIconSize; btnRange.Left.Set(leftPos, 0f); btnRange.Top.Set(topPos, 0f); panelMain.Append(btnRange); //ボタン:スナップ btnSnap = new UIImageListButton( (new ImageList(ModLoader.GetMod("TeraCAD").GetTexture("ToolUI/Snap"), 28, 28)).listTexture, new List <object>() { SnapType.TopLeft, SnapType.TopCenter, SnapType.TopRight, SnapType.LeftCenter, SnapType.Center, SnapType.RightCenter, SnapType.BottomLeft, SnapType.BottomCenter, SnapType.BottomRight, }, new List <string>() { "Snap: TopLeft", "Snap: TopCenter", "Snap: TopRight", "Snap: LeftCenter", "Snap: Center", "Snap: RightCenter", "Snap: BottomLeft", "Snap: BottomCenter", "Snap: BottomRight", }, 0); btnSnap.OnClick += (a, b) => { btnSnap.NextIamge(); ToolBox.snapType = btnSnap.GetValue <SnapType>(); }; btnSnap.OnRightClick += (a, b) => { btnSnap.PrevIamge(); ToolBox.snapType = btnSnap.GetValue <SnapType>(); }; leftPos += menuMargin + menuIconSize; btnSnap.Left.Set(leftPos, 0f); btnSnap.Top.Set(topPos, 0f); panelMain.Append(btnSnap); //ボタン:コンフィグ var btnConfig = new UIImageListButton( new List <Texture2D>() { Main.itemTexture[ItemID.Cog].Resize(menuIconSize), }, new List <object>() { 0 }, new List <string>() { "Show Line Property" }, 0); btnConfig.OnClick += (a, b) => LinePropertyUI.instance.Show = !LinePropertyUI.instance.Show; leftPos += menuMargin + menuIconSize; btnConfig.Left.Set(leftPos, 0f); btnConfig.Top.Set(topPos, 0f); panelMain.Append(btnConfig); topPos += menuIconSize + menuMargin; //ツールボックス panelTool = new UIPanel(); panelTool.SetPadding(6); panelTool.Top.Set(topPos, 0f); panelTool.Width.Set(0, 1f); panelTool.Height.Set(-52, 1f); panelMain.Append(panelTool); gridTool = new UIGrid(); gridTool.Width.Set(-20f, 1f); gridTool.Height.Set(0, 1f); gridTool.ListPadding = 2f; panelTool.Append(gridTool); var scrollbar = new FixedUIScrollbar(userInterface); scrollbar.SetView(100f, 1000f); scrollbar.Height.Set(0, 1f); scrollbar.Left.Set(-20, 1f); panelTool.Append(scrollbar); gridTool.SetScrollbar(scrollbar); //シェイプツール var imageList = new ImageList(ModLoader.GetMod("TeraCAD").GetTexture("ToolUI/ShapeTools"), 28, 28); //選択ツール var btnSelect = new UISlotTool(imageList[0], ToolType.Select, gridTool.Count, "Selecct"); btnSelect.OnClick += (a, b) => ToolBox.Select(btnSelect); gridTool.Add(btnSelect); //直線ツール var btnLine = new UISlotTool(imageList[1], ToolType.Line, gridTool.Count, "Line"); btnLine.OnClick += (a, b) => ToolBox.Select(btnLine); gridTool.Add(btnLine); //矩形ツール var btnRect = new UISlotTool(imageList[2], ToolType.Rect, gridTool.Count, "Recangle"); btnRect.OnClick += (a, b) => ToolBox.Select(btnRect); gridTool.Add(btnRect); //円ツール var btnCircle = new UISlotTool(imageList[3], ToolType.Circle, gridTool.Count, "Circle"); btnCircle.OnClick += (a, b) => ToolBox.Select(btnCircle); gridTool.Add(btnCircle); //楕円ツール //var btnEllipse = new UISlotTool(imageList[4], ToolType.Ellipse, gridTool.Count, "Ellipse"); //btnEllipse.OnClick += (a, b) => ToolBox.Select(btnEllipse); //gridTool.Add(btnEllipse); //イメージツール var btnImage = new UISlotTool(Main.itemTexture[ItemID.TheCursedMan], ToolType.Image, gridTool.Count, "Image"); btnImage.OnClick += (a, b) => { ToolBox.Select(btnImage); ImageUI.instance.Show = btnImage.isSelect; }; gridTool.Add(btnImage); //削除ツール var btnEraser = new UISlotTool(imageList[5], ToolType.Eraser, gridTool.Count, "Eraser"); btnEraser.OnClick += (a, b) => ToolBox.Select(btnEraser); gridTool.Add(btnEraser); //全削除ツール var btnAllClear = new UISlotTool(Main.trashTexture.Resize(menuIconSize), ToolType.AllClear, gridTool.Count, "All Clear"); btnAllClear.OnClick += (a, b) => ToolBox.Select(btnAllClear); gridTool.Add(btnAllClear); //平行コピー var btnParallelCopy = new UISlotTool(imageList[6], ToolType.ParallelCopy, gridTool.Count, "Parallel Copy"); btnParallelCopy.OnClick += (a, b) => ToolBox.Select(btnParallelCopy); gridTool.Add(btnParallelCopy); updateNeeded = true; }
public override void OnInitialize() { colorPalettePanel = new UIPanel() { HAlign = 1f, Top = new StyleDimension(85f, 0f), Left = new StyleDimension(-40f, 0f), Width = new StyleDimension(260f, 0f), Height = new StyleDimension(-125f, 1f), BackgroundColor = new Color(73, 94, 171) }; Append(colorPalettePanel); paletteTitle = new UITextPanel <string>("Color Palette") { Top = new StyleDimension(-30, 0f), Left = new StyleDimension(20, 0f), Width = new StyleDimension(-40, 1f), Height = new StyleDimension(40, 0f), BackgroundColor = new Color(73, 94, 171) }; colorPalettePanel.Append(paletteTitle); var scrollbar = new FixedUIScrollbar(ColorPalette.instance.userInterface) { Top = new StyleDimension(15f, 0f), Height = new StyleDimension(-75f, 1f), HAlign = 1f }; scrollbar.SetView(100f, 1000f); colorPalettePanel.Append(scrollbar); colorGrid = new LazyUpdatableGrid() { ListPadding = 2f, Top = new StyleDimension(15f, 0f), Width = new StyleDimension(-25f, 1f), Height = new StyleDimension(-60f, 1f) }; colorGrid.SetScrollbar(scrollbar); colorPalettePanel.Append(colorGrid); ColorPanel.parentUI = this; ColorPanel.parentGrid = colorGrid; deleteColorButton = new UITextPanel <string>("Delete") { HAlign = 1f, VAlign = 1f, Width = new StyleDimension(50f, 0f), Height = new StyleDimension(30f, 0f) }; deleteColorButton.OnMouseOver += (x, y) => deleteColorButton.BackgroundColor = new Color(73, 94, 171); deleteColorButton.OnMouseOut += (x, y) => deleteColorButton.BackgroundColor = new Color(63, 82, 151) * 0.7f; deleteColorButton.OnClick += DeleteColorButton_OnClick; colorPalettePanel.Append(deleteColorButton); tileInfoText = new UIText("No tile selected.") { VAlign = 1f, Height = new StyleDimension(60f, 0f) }; colorPalettePanel.Append(tileInfoText); createColorButton = new UIImageButton(ColorPalette.instance.GetTexture("CreateButton")); createColorButton.OnClick += CreateColorButton_OnClick; colorGrid.Add(createColorButton); }
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); }