Merge branch 'master' into 2020-04-28-tool-component
This commit is contained in:
@@ -81,6 +81,9 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
base.Startup();
|
||||
|
||||
SnapGrid.OnPositionChanged += SnapGridOnPositionChanged;
|
||||
// ensures lastposition initial value is populated on spawn. Just calling
|
||||
// the hook here would cause a dirty event to fire needlessly
|
||||
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner,null, SnapGrid.Offset, Mode));
|
||||
if (Mode == IconSmoothingMode.Corners)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
public MicrowaveBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner,uiKey)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
@@ -39,9 +39,9 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
_menu.StartButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveStartCookMessage());
|
||||
_menu.EjectButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveEjectMessage());
|
||||
_menu.IngredientsList.OnItemSelected += args =>
|
||||
{
|
||||
{
|
||||
SendMessage(new SharedMicrowaveComponent.MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex]));
|
||||
|
||||
|
||||
};
|
||||
|
||||
_menu.IngredientsListReagents.OnItemSelected += args =>
|
||||
@@ -49,7 +49,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
SendMessage(
|
||||
new SharedMicrowaveComponent.MicrowaveVaporizeReagentIndexedMessage(_reagents[args.ItemIndex]));
|
||||
};
|
||||
|
||||
|
||||
_menu.OnCookTimeSelected += args =>
|
||||
{
|
||||
var actualButton = args.Button as Button;
|
||||
@@ -80,6 +80,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
return;
|
||||
}
|
||||
|
||||
_menu.ToggleBusyDisableOverlayPanel(cstate.IsMicrowaveBusy);
|
||||
RefreshContentsDisplay(cstate.ReagentsReagents, cstate.ContainedSolids);
|
||||
|
||||
}
|
||||
@@ -101,9 +102,12 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
_menu.IngredientsList.Clear();
|
||||
foreach (var entityID in solids)
|
||||
{
|
||||
var entity = _entityManager.GetEntity(entityID);
|
||||
if (!_entityManager.TryGetEntity(entityID, out var entity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity.TryGetComponent(out IconComponent icon))
|
||||
if (!entity.Deleted && entity.TryGetComponent(out IconComponent icon))
|
||||
{
|
||||
var solidItem = _menu.IngredientsList.AddItem(entity.Name, icon.Icon.Default);
|
||||
|
||||
|
||||
@@ -26,6 +26,11 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
public ButtonGroup CookTimeButtonGroup { get; }
|
||||
private VBoxContainer CookTimeButtonVbox { get; }
|
||||
|
||||
private VBoxContainer ButtonGridContainer { get; }
|
||||
|
||||
private PanelContainer DisableCookingPanelOverlay { get;}
|
||||
|
||||
|
||||
public ItemList IngredientsList { get;}
|
||||
|
||||
public ItemList IngredientsListReagents { get; }
|
||||
@@ -35,6 +40,16 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
Owner = owner;
|
||||
Title = Loc.GetString("Microwave");
|
||||
DisableCookingPanelOverlay = new PanelContainer
|
||||
{
|
||||
MouseFilter = MouseFilterMode.Stop,
|
||||
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.60f)},
|
||||
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||
SizeFlagsVertical = SizeFlags.Fill,
|
||||
|
||||
};
|
||||
|
||||
|
||||
var hSplit = new HBoxContainer
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||
@@ -58,14 +73,14 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
SizeFlagsStretchRatio = 2,
|
||||
CustomMinimumSize = (100,128)
|
||||
};
|
||||
|
||||
|
||||
hSplit.AddChild(IngredientsListReagents);
|
||||
//Padding between the lists.
|
||||
hSplit.AddChild(new Control
|
||||
{
|
||||
CustomMinimumSize = (0,5),
|
||||
});
|
||||
|
||||
|
||||
hSplit.AddChild(IngredientsList);
|
||||
|
||||
var vSplit = new VBoxContainer
|
||||
@@ -76,7 +91,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
hSplit.AddChild(vSplit);
|
||||
|
||||
var buttonGridContainer = new VBoxContainer
|
||||
ButtonGridContainer = new VBoxContainer
|
||||
{
|
||||
Align = BoxContainer.AlignMode.Center,
|
||||
SizeFlagsStretchRatio = 3
|
||||
@@ -96,10 +111,10 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
TextAlign = Label.AlignMode.Center,
|
||||
};
|
||||
|
||||
buttonGridContainer.AddChild(StartButton);
|
||||
buttonGridContainer.AddChild(EjectButton);
|
||||
vSplit.AddChild(buttonGridContainer);
|
||||
|
||||
ButtonGridContainer.AddChild(StartButton);
|
||||
ButtonGridContainer.AddChild(EjectButton);
|
||||
vSplit.AddChild(ButtonGridContainer);
|
||||
|
||||
//Padding
|
||||
vSplit.AddChild(new Control
|
||||
{
|
||||
@@ -114,6 +129,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
Align = BoxContainer.AlignMode.Center,
|
||||
};
|
||||
|
||||
|
||||
var index = 0;
|
||||
for (var i = 0; i <= 12; i++)
|
||||
{
|
||||
@@ -134,7 +150,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
var cookTimeOneSecondButton = (Button)CookTimeButtonVbox.GetChild(0);
|
||||
cookTimeOneSecondButton.Pressed = true;
|
||||
|
||||
|
||||
|
||||
_cookTimeInfoLabel = new Label
|
||||
{
|
||||
Text = Loc.GetString($"COOK TIME: {VisualCookTime}"),
|
||||
@@ -158,7 +175,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
Children =
|
||||
{
|
||||
|
||||
|
||||
new PanelContainer
|
||||
{
|
||||
PanelOverride = new StyleBoxFlat(){BackgroundColor = Color.Gray.WithAlpha(0.2f)},
|
||||
@@ -199,8 +216,15 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
vSplit.AddChild(TimerFacePlate);
|
||||
Contents.AddChild(hSplit);
|
||||
Contents.AddChild(DisableCookingPanelOverlay);
|
||||
|
||||
}
|
||||
|
||||
public void ToggleBusyDisableOverlayPanel(bool shouldDisable)
|
||||
{
|
||||
DisableCookingPanelOverlay.Visible = shouldDisable;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.GameObjects.Components.Storage;
|
||||
using Content.Client.Interfaces.GameObjects;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
@@ -103,9 +104,11 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
private Control VSplitContainer;
|
||||
private VBoxContainer EntityList;
|
||||
private Label Information;
|
||||
private Button AddItemButton;
|
||||
public ClientStorageComponent StorageEntity;
|
||||
|
||||
private StyleBoxFlat _HoveredBox = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.35f)};
|
||||
private StyleBoxFlat _unHoveredBox = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.0f)};
|
||||
|
||||
protected override Vector2? CustomSize => (180, 320);
|
||||
|
||||
public StorageWindow()
|
||||
@@ -113,7 +116,37 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
Title = "Storage Item";
|
||||
RectClipContent = true;
|
||||
|
||||
VSplitContainer = new VBoxContainer();
|
||||
var containerButton = new ContainerButton
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||
SizeFlagsVertical = SizeFlags.Fill,
|
||||
MouseFilter = MouseFilterMode.Pass,
|
||||
};
|
||||
|
||||
var innerContainerButton = new PanelContainer
|
||||
{
|
||||
PanelOverride = _unHoveredBox,
|
||||
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||
SizeFlagsVertical = SizeFlags.Fill,
|
||||
};
|
||||
|
||||
|
||||
containerButton.AddChild(innerContainerButton);
|
||||
containerButton.OnPressed += args =>
|
||||
{
|
||||
var controlledEntity = IoCManager.Resolve<IPlayerManager>().LocalPlayer.ControlledEntity;
|
||||
|
||||
if (controlledEntity.TryGetComponent(out IHandsComponent hands))
|
||||
{
|
||||
StorageEntity.SendNetworkMessage(new InsertEntityMessage());
|
||||
}
|
||||
};
|
||||
|
||||
VSplitContainer = new VBoxContainer()
|
||||
{
|
||||
MouseFilter = MouseFilterMode.Ignore,
|
||||
};
|
||||
containerButton.AddChild(VSplitContainer);
|
||||
Information = new Label
|
||||
{
|
||||
Text = "Items: 0 Volume: 0/0 Stuff",
|
||||
@@ -126,7 +159,7 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
HScrollEnabled = true,
|
||||
VScrollEnabled = true
|
||||
VScrollEnabled = true,
|
||||
};
|
||||
EntityList = new VBoxContainer
|
||||
{
|
||||
@@ -135,16 +168,17 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
listScrollContainer.AddChild(EntityList);
|
||||
VSplitContainer.AddChild(listScrollContainer);
|
||||
|
||||
AddItemButton = new Button
|
||||
{
|
||||
Text = "Add Item",
|
||||
ToggleMode = false,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
||||
};
|
||||
AddItemButton.OnPressed += OnAddItemButtonPressed;
|
||||
VSplitContainer.AddChild(AddItemButton);
|
||||
Contents.AddChild(containerButton);
|
||||
|
||||
Contents.AddChild(VSplitContainer);
|
||||
listScrollContainer.OnMouseEntered += args =>
|
||||
{
|
||||
innerContainerButton.PanelOverride = _HoveredBox;
|
||||
};
|
||||
|
||||
listScrollContainer.OnMouseExited += args =>
|
||||
{
|
||||
innerContainerButton.PanelOverride = _unHoveredBox;
|
||||
};
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
@@ -168,7 +202,8 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
|
||||
var button = new EntityButton()
|
||||
{
|
||||
EntityuID = entityuid.Key
|
||||
EntityuID = entityuid.Key,
|
||||
MouseFilter = MouseFilterMode.Stop,
|
||||
};
|
||||
button.ActualButton.OnToggled += OnItemButtonToggled;
|
||||
//Name and Size labels set
|
||||
|
||||
Reference in New Issue
Block a user