Add placing items into storage when Storage UI is clicked with item in hand
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
base.OnAdd();
|
base.OnAdd();
|
||||||
|
|
||||||
Window = new StorageWindow()
|
Window = new StorageWindow()
|
||||||
{StorageEntity = this};
|
{StorageEntity = this};1
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRemove()
|
public override void OnRemove()
|
||||||
@@ -103,7 +103,6 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
private Control VSplitContainer;
|
private Control VSplitContainer;
|
||||||
private VBoxContainer EntityList;
|
private VBoxContainer EntityList;
|
||||||
private Label Information;
|
private Label Information;
|
||||||
private Button AddItemButton;
|
|
||||||
public ClientStorageComponent StorageEntity;
|
public ClientStorageComponent StorageEntity;
|
||||||
|
|
||||||
protected override Vector2? CustomSize => (180, 320);
|
protected override Vector2? CustomSize => (180, 320);
|
||||||
@@ -113,7 +112,23 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
Title = "Storage Item";
|
Title = "Storage Item";
|
||||||
RectClipContent = true;
|
RectClipContent = true;
|
||||||
|
|
||||||
|
var containerButton = new ContainerButton
|
||||||
|
{
|
||||||
|
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||||
|
SizeFlagsVertical = SizeFlags.Fill
|
||||||
|
};
|
||||||
|
containerButton.OnPressed += args =>
|
||||||
|
{
|
||||||
|
var controlledEntity = IoCManager.Resolve<IPlayerManager>().LocalPlayer.ControlledEntity;
|
||||||
|
|
||||||
|
if (controlledEntity.TryGetComponent(out IHandsComponent hands))
|
||||||
|
{
|
||||||
|
StorageEntity.SendNetworkMessage(new InsertEntityMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
VSplitContainer = new VBoxContainer();
|
VSplitContainer = new VBoxContainer();
|
||||||
|
containerButton.AddChild(VSplitContainer);
|
||||||
Information = new Label
|
Information = new Label
|
||||||
{
|
{
|
||||||
Text = "Items: 0 Volume: 0/0 Stuff",
|
Text = "Items: 0 Volume: 0/0 Stuff",
|
||||||
@@ -135,16 +150,8 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
listScrollContainer.AddChild(EntityList);
|
listScrollContainer.AddChild(EntityList);
|
||||||
VSplitContainer.AddChild(listScrollContainer);
|
VSplitContainer.AddChild(listScrollContainer);
|
||||||
|
|
||||||
AddItemButton = new Button
|
Contents.AddChild(containerButton);
|
||||||
{
|
|
||||||
Text = "Add Item",
|
|
||||||
ToggleMode = false,
|
|
||||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
|
||||||
};
|
|
||||||
AddItemButton.OnPressed += OnAddItemButtonPressed;
|
|
||||||
VSplitContainer.AddChild(AddItemButton);
|
|
||||||
|
|
||||||
Contents.AddChild(VSplitContainer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Close()
|
public override void Close()
|
||||||
@@ -168,7 +175,8 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
|
|
||||||
var button = new EntityButton()
|
var button = new EntityButton()
|
||||||
{
|
{
|
||||||
EntityuID = entityuid.Key
|
EntityuID = entityuid.Key,
|
||||||
|
MouseFilter = MouseFilterMode.Stop,
|
||||||
};
|
};
|
||||||
button.ActualButton.OnToggled += OnItemButtonToggled;
|
button.ActualButton.OnToggled += OnItemButtonToggled;
|
||||||
//Name and Size labels set
|
//Name and Size labels set
|
||||||
|
|||||||
Reference in New Issue
Block a user