* -Added Crayons + CrayonBox
-Can set any crayon state and color
-Added CrayonDecals

* Allows to cycle through decals (not the final thing)

* ItemStatus

* -UI (WIP)
-Selection thing works
-Changed some shitty state names

* -Icons
-Changed decal name

* Pure Texture Grid

* Charges

* -Reach check
-Toggle interface on use

* Can't draw on windows anymore

* UI now shows selected decal and color

* -UseSound
-Nullable

* Remove unused imports

* -Rotation
-Made decal abstract

* Remove some duplicate images

* Space Cleaner cleans

* Loc Title

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>

* Review adressed

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
Exp
2020-10-13 13:40:05 +02:00
committed by GitHub
parent cb29db60d1
commit 47ba7fc690
187 changed files with 2393 additions and 1 deletions

View File

@@ -0,0 +1,71 @@
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.GameObjects.Components;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects.Components.Crayon
{
[RegisterComponent]
public class CrayonComponent : SharedCrayonComponent, IItemStatus
{
[ViewVariables(VVAccess.ReadWrite)] private bool _uiUpdateNeeded;
[ViewVariables(VVAccess.ReadWrite)] private string Color => _color;
[ViewVariables] private int Charges { get; set; }
[ViewVariables] private int Capacity { get; set; }
Control IItemStatus.MakeControl()
{
return new StatusControl(this);
}
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{
if (!(curState is CrayonComponentState state))
return;
_color = state.Color;
SelectedState = state.State;
Charges = state.Charges;
Capacity = state.Capacity;
_uiUpdateNeeded = true;
}
private sealed class StatusControl : Control
{
private readonly CrayonComponent _parent;
private readonly RichTextLabel _label;
public StatusControl(CrayonComponent parent)
{
_parent = parent;
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
AddChild(_label);
parent._uiUpdateNeeded = true;
}
protected override void Update(FrameEventArgs args)
{
base.Update(args);
if (!_parent._uiUpdateNeeded)
{
return;
}
_parent._uiUpdateNeeded = false;
_label.SetMarkup(Loc.GetString("Drawing: [color={0}]{1}[/color] ({2}/{3})",
_parent.Color,
_parent.SelectedState,
_parent.Charges,
_parent.Capacity));
}
}
}
}