Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Воувоувоу #284

Closed
wants to merge 13 commits into from
5 changes: 1 addition & 4 deletions Content.Client/Paper/UI/PaperWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,7 @@ public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state)
StampDisplay.RemoveStamps();
foreach(var stamper in state.StampedBy)
{
if (stamper.StampedBorderless)
StampDisplay.AddStamp(new StampWidget(true) { StampInfo = stamper });
else
StampDisplay.AddStamp(new StampWidget { StampInfo = stamper });
StampDisplay.AddStamp(new StampWidget { StampInfo = stamper });
}
}

Expand Down
20 changes: 2 additions & 18 deletions Content.Client/Paper/UI/StampWidget.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ public float Orientation

public StampDisplayInfo StampInfo {
set {
StampedByLabel.Text = Loc.GetString(value.StampedName);
StampedByLabel.Text = value.Type is StampType.Signature ? value.StampedName : Loc.GetString(value.StampedName);
StampedByLabel.FontColorOverride = value.StampedColor;
ModulateSelfOverride = value.StampedColor;
PanelOverride = value.Type is StampType.Signature ? null : _borderTexture;
}
}

Expand All @@ -45,23 +46,6 @@ public StampWidget()
_stampShader = prototypes.Index<ShaderPrototype>("PaperStamp").InstanceUnique();
}

public StampWidget(bool borderless)
{
RobustXamlLoader.Load(this);
var resCache = IoCManager.Resolve<IResourceCache>();
var borderImage = resCache.GetResource<TextureResource>(
"/Textures/Interface/Paper/paper_stamp_noborder.svg.96dpi.png");
_borderTexture = new StyleBoxTexture
{
Texture = borderImage,
};
_borderTexture.SetPatchMargin(StyleBoxTexture.Margin.All, 7.0f);
PanelOverride = _borderTexture;

var prototypes = IoCManager.Resolve<IPrototypeManager>();
_stampShader = prototypes.Index<ShaderPrototype>("PaperStamp").InstanceUnique();
}

protected override void Draw(DrawingHandleScreen handle)
{
_stampShader?.SetParameter("objCoord", GlobalPosition * UIScale * new Vector2(1, -1));
Expand Down
19 changes: 15 additions & 4 deletions Content.Client/Preferences/UI/LoadoutContainer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,28 @@ public LoadoutContainer(ProtoId<LoadoutPrototype> proto, bool disabled, Formatte

if (_protoManager.TryIndex(proto, out var loadProto))
{
var ent = _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);
// Frontier: overrideable prototype fields (description, name, icon [via entity])
Price.Text = "$" + loadProto.Price;
if (ent != null)

bool hasDescription = !string.IsNullOrEmpty(loadProto.Description);
bool hasEntity = !string.IsNullOrEmpty(loadProto.PreviewEntity?.Id);

EntProtoId? ent = null;
if (!hasEntity || !hasDescription) {
ent = _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);
}
var finalEnt = hasEntity ? loadProto.PreviewEntity : ent;
if (finalEnt != null)
{
_entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
_entity = _entManager.SpawnEntity(finalEnt, MapCoordinates.Nullspace);
Sprite.SetEntity(_entity);

var spriteTooltip = new Tooltip();
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));
var description = hasDescription ? loadProto.Description : _entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription;
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(description));
Sprite.TooltipSupplier = _ => spriteTooltip;
}
// End Frontier
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void RefreshLoadouts(RoleLoadout loadout, ICommonSession session, IDepend
var enabled = loadout.IsValid(session, loadoutProto, collection, out var reason);
var loadoutContainer = new LoadoutContainer(loadoutProto, !enabled, reason);
loadoutContainer.Select.Pressed = pressed;
loadoutContainer.Text = loadoutSystem.GetName(loadProto);
loadoutContainer.Text = string.IsNullOrEmpty(loadProto.Name) ? loadoutSystem.GetName(loadProto) : loadProto.Name; // Frontier: allow overriding loadout names

loadoutContainer.Select.OnPressed += args =>
{
Expand Down
Loading
Loading