public override void OnInitialize() { Width = (408, 0); Height = (40 + Container.Handler.Slots / 9 * 44, 0); this.Center(); textLabel = new UIText(Container.DisplayName.GetTranslation()) { HAlign = 0.5f }; Append(textLabel); UIButton buttonLootAll = new UIButton(PortableStorage.textureLootAll) { Size = new Vector2(20) }; buttonLootAll.OnClick += (evt, element) => ItemUtility.LootAll(Container.Handler, Main.LocalPlayer); buttonLootAll.GetHoverText += () => Language.GetText("LegacyInterface.29").ToString(); Append(buttonLootAll); UIButton buttonDepositAll = new UIButton(PortableStorage.textureDepositAll) { Size = new Vector2(20), Left = (28, 0) }; buttonDepositAll.OnClick += (evt, element) => ItemUtility.DepositAll(Container.Handler, Main.LocalPlayer); buttonDepositAll.GetHoverText += () => Language.GetText("LegacyInterface.30").ToString(); Append(buttonDepositAll); buttonClose = new UITextButton("X") { Size = new Vector2(20), Left = (-20, 1), RenderPanel = false }; buttonClose.OnClick += (evt, element) => BaseLibrary.BaseLibrary.PanelGUI.UI.CloseUI(Container); Append(buttonClose); gridItems = new UIGrid <UIContainerSlot>(9) { Width = (0, 1), Height = (-28, 1), Top = (28, 0), OverflowHidden = true, ListPadding = 4f }; Append(gridItems); for (int i = 0; i < Container.Handler.Slots; i++) { UIContainerSlot slot = new UIContainerSlot(() => Container.Handler, i); gridItems.Add(slot); } } } }
public BaseBagPanel(BaseBag bag) : base((T)bag) { UIText textLabel = new UIText(Container.DisplayName.GetTranslation()) { X = { Percent = 50 }, HorizontalAlignment = HorizontalAlignment.Center }; Add(textLabel); UIButton buttonLootAll = new UIButton(PortableStorage.textureLootAll) { Size = new Vector2(20), HoverText = Language.GetText("LegacyInterface.29") }; buttonLootAll.OnClick += args => ItemUtility.LootAll(Container.Handler, Main.LocalPlayer); Add(buttonLootAll); UIButton buttonDepositAll = new UIButton(PortableStorage.textureDepositAll) { Size = new Vector2(20), X = { Pixels = 28 }, HoverText = Language.GetText("LegacyInterface.30") }; buttonDepositAll.OnClick += args => ItemUtility.DepositAll(Container.Handler, Main.LocalPlayer); Add(buttonDepositAll); buttonQuickStack = new UIButton(PortableStorage.textureQuickStack) { Size = new Vector2(20), X = { Pixels = 56 }, HoverText = Language.GetText("LegacyInterface.31") }; buttonQuickStack.OnClick += args => ItemUtility.QuickStack(Container.Handler, Main.LocalPlayer); Add(buttonQuickStack); UITextButton buttonClose = new UITextButton("X") { Size = new Vector2(20), X = { Percent = 100 }, Padding = Padding.Zero, RenderPanel = false }; buttonClose.OnClick += args => PanelUI.Instance.CloseUI(Container); Add(buttonClose); }
public TestChestUI(TestChestTE chest) : base(chest) { Width.Pixels = 408; Height.Pixels = 172; UITextButton buttonClose = new UITextButton("X") { Size = new Vector2(20), X = { Percent = 100 }, Padding = Padding.Zero, RenderPanel = false }; buttonClose.OnClick += args => PanelUI.Instance.CloseUI(Container); Add(buttonClose); UIText textLabel = new UIText("Test Chest") { Width = { Percent = 100 }, Height = { Pixels = 20 }, HorizontalAlignment = HorizontalAlignment.Center }; Add(textLabel); UIButton buttonLootAll = new UIButton(Routed.textureLootAll) { Size = new Vector2(20), HoverText = Language.GetText("LegacyInterface.29") }; buttonLootAll.OnClick += args => ItemUtility.LootAll(Container.Handler, Main.LocalPlayer); Add(buttonLootAll); UIButton buttonDepositAll = new UIButton(Routed.textureDepositAll) { Size = new Vector2(20), X = { Pixels = 28 }, HoverText = Language.GetText("LegacyInterface.30") }; buttonDepositAll.OnClick += args => ItemUtility.DepositAll(Container.Handler, Main.LocalPlayer); Add(buttonDepositAll); UIButton buttonQuickStack = new UIButton(Routed.textureQuickStack) { Size = new Vector2(20), X = { Pixels = 56 }, HoverText = Language.GetText("LegacyInterface.31") }; buttonQuickStack.OnClick += args => ItemUtility.QuickStack(Container.Handler, Main.LocalPlayer); Add(buttonQuickStack); UIGrid <UIContainerSlot> gridItems = new UIGrid <UIContainerSlot>(9) { Width = { Percent = 100 }, Height = { Pixels = -28, Percent = 100 }, Y = { Pixels = 28 }, ItemMargin = 4 }; Add(gridItems); for (int i = 0; i < Container.Handler.Slots; i++) { UIContainerSlot slot = new UIContainerSlot(() => Container.Handler, i); gridItems.Add(slot); } }
public QEBagPanel(QEBag bag) : base(bag) { Width.Pixels = 16 + (SlotSize + SlotMargin) * 9 - SlotMargin; Height.Pixels = 44 + (SlotSize + SlotMargin) * 3 - SlotMargin; UIText textLabel = new UIText(Container.DisplayName.GetTranslation()) { X = { Percent = 50 }, HorizontalAlignment = HorizontalAlignment.Center }; Add(textLabel); UITextButton buttonReset = new UITextButton("R") { Size = new Vector2(20), RenderPanel = false, Padding = BaseLibrary.UI.Padding.Zero, HoverText = Language.GetText("Mods.QuantumStorage.UI.Reset") }; buttonReset.OnClick += args => { if (!Container.frequency.IsSet) { for (int i = 0; i < 3; i++) { Main.LocalPlayer.PutItemInInventory(Utility.ColorToItem(Container.frequency[i])); } Container.frequency = new Frequency(); if (Main.netMode == NetmodeID.MultiplayerClient) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, Container.item.whoAmI, 1f); } } else { for (int i = 0; i < 3; i++) { Main.LocalPlayer.PutItemInInventory(Utility.ColorToItem(Container.frequency[i])); } Container.frequency = new Frequency(); if (Main.netMode == NetmodeID.MultiplayerClient) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, Container.item.whoAmI, 1f); } Remove(GridItems); InitializeFrequencySelection(); for (int i = 0; i < 3; i++) { Add(buttonsFrequency[i]); } Add(buttonInitialize); } }; Add(buttonReset); UIButton buttonLootAll = new UIButton(QuantumStorage.textureLootAll) { X = { Pixels = 28 }, Size = new Vector2(20), HoverText = Language.GetText("LegacyInterface.29") }; buttonLootAll.OnClick += args => ItemUtility.LootAll(Container.Handler, Main.LocalPlayer); Add(buttonLootAll); UIButton buttonDepositAll = new UIButton(QuantumStorage.textureDepositAll) { Size = new Vector2(20), X = { Pixels = 56 }, HoverText = Language.GetText("LegacyInterface.30") }; buttonDepositAll.OnClick += args => ItemUtility.DepositAll(Container.Handler, Main.LocalPlayer); Add(buttonDepositAll); UIButton buttonQuickStack = new UIButton(QuantumStorage.textureQuickStack) { Size = new Vector2(20), X = { Pixels = 84 }, HoverText = Language.GetText("LegacyInterface.31") }; buttonQuickStack.OnClick += args => ItemUtility.QuickStack(Container.Handler, Main.LocalPlayer); Add(buttonQuickStack); UITextButton buttonClose = new UITextButton("X") { Size = new Vector2(20), X = { Percent = 100 }, RenderPanel = false, Padding = BaseLibrary.UI.Padding.Zero, HoverText = Language.GetText("Mods.BaseLibrary.UI.Close") }; buttonClose.OnClick += args => PanelUI.Instance.CloseUI(Container); Add(buttonClose); if (!Container.frequency.IsSet) { InitializeFrequencySelection(); for (int i = 0; i < 3; i++) { Add(buttonsFrequency[i]); } Add(buttonInitialize); } else { Add(GridItems); } }
public WalletPanel(Wallet wallet) : base(wallet) { Width.Pixels = 12 + (SlotSize + SlotMargin) * 4; Height.Pixels = 44 + SlotSize; Clear(); UIText textLabel = new UIText(Container.DisplayName.GetDefault()) { X = { Percent = 50 }, HorizontalAlignment = HorizontalAlignment.Center }; Add(textLabel); UIButton buttonLootAll = new UIButton(PortableStorage.textureLootAll) { Size = new Vector2(20), HoverText = Language.GetText("LegacyInterface.29") }; buttonLootAll.OnClick += args => ItemUtility.LootAll(Container.Handler, Main.LocalPlayer); Add(buttonLootAll); UIButton buttonDepositAll = new UIButton(PortableStorage.textureDepositAll) { Size = new Vector2(20), X = { Pixels = 28 }, HoverText = Language.GetText("LegacyInterface.30") }; buttonDepositAll.OnClick += args => ItemUtility.DepositAll(Container.Handler, Main.LocalPlayer); Add(buttonDepositAll); UITextButton buttonClose = new UITextButton("X") { Size = new Vector2(20), X = { Percent = 100 }, Padding = Padding.Zero, RenderPanel = false }; buttonClose.OnClick += args => PanelUI.Instance.CloseUI(Container); Add(buttonClose); UIGrid <UIContainerSlot> gridItems = new UIGrid <UIContainerSlot>(4) { Width = { Percent = 100 }, Height = { Pixels = -28, Percent = 100 }, Y = { Pixels = 28 }, ItemMargin = SlotMargin }; Add(gridItems); for (int i = 0; i < Container.Handler.Slots; i++) { UIContainerSlot slot = new UIContainerSlot(() => Container.Handler, i) { ShortStackSize = true, Width = { Pixels = SlotSize }, Height = { Pixels = SlotSize } }; gridItems.Add(slot); } }