Skip to content

Commit

Permalink
Sign
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 committed Sep 23, 2023
1 parent e69e810 commit 77ab904
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 27 deletions.
5 changes: 4 additions & 1 deletion Content.Client/Paper/UI/PaperWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state)
StampDisplay.RemoveStamps();
foreach(var stamper in state.StampedBy)
{
StampDisplay.AddStamp(new StampWidget(stamper.StampedBorderless) { StampInfo = stamper });
if (stamper.StampedBorderless)
StampDisplay.AddStamp(new StampWidget(true) { StampInfo = stamper });
else
StampDisplay.AddStamp(new StampWidget { StampInfo = stamper });
}
}

Expand Down
23 changes: 1 addition & 22 deletions Content.Client/Paper/UI/StampWidget.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public StampWidget()
var prototypes = IoCManager.Resolve<IPrototypeManager>();
_stampShader = prototypes.Index<ShaderPrototype>("PaperStamp").InstanceUnique();
}

public StampWidget(bool borderless)
{
RobustXamlLoader.Load(this);
Expand All @@ -61,28 +62,6 @@ public StampWidget(bool borderless)
_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_border.svg.96dpi.png");

// if (borderless)
// {
// borderImage = resCache.GetResource<TextureResource>(
// "/Textures/Interface/Paper/paper_stamp_noborder.svg.96dpi.png");
// }

// _borderTexture = new StyleBoxTexture
// {
// Texture = borderImage,
// };

// 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
10 changes: 8 additions & 2 deletions Content.Server/Paper/PaperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ private void OnInteractUsing(EntityUid uid, PaperComponent paperComp, InteractUs
// If a stamp, attempt to stamp paper
if (TryComp<StampComponent>(args.Used, out var stampComp) && TryStamp(uid, GetStampInfo(stampComp), stampComp.StampState, paperComp))
{
var actionOther = "stamps";
var actionSelf = "stamp";

if (stampComp.StampedPersonal)
{
stampComp.StampedIdUser = args.User;
Expand All @@ -149,15 +152,18 @@ private void OnInteractUsing(EntityUid uid, PaperComponent paperComp, InteractUs
//string stampedName = userJob + " - " + userName;
string stampedName = userName;
stampComp.StampedName = stampedName;

actionOther = "signs";
actionSelf = "sign";
}

// successfully stamped, play popup
var stampPaperOtherMessage = Loc.GetString("paper-component-action-stamp-paper-other",
("user", args.User), ("target", args.Target), ("stamp", args.Used));
("action", actionOther), ("user", args.User), ("target", args.Target), ("stamp", args.Used));

_popupSystem.PopupEntity(stampPaperOtherMessage, args.User, Filter.PvsExcept(args.User, entityManager: EntityManager), true);
var stampPaperSelfMessage = Loc.GetString("paper-component-action-stamp-paper-self",
("target", args.Target), ("stamp", args.Used));
("action", actionSelf), ("target", args.Target), ("stamp", args.Used));
_popupSystem.PopupEntity(stampPaperSelfMessage, args.User, args.User);

_audio.PlayPvs(stampComp.Sound, uid);
Expand Down
4 changes: 2 additions & 2 deletions Resources/Locale/en-US/paper/paper-component.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ paper-component-examine-detail-has-words = {CAPITALIZE(THE($paper))} has somethi
# Shown when paper with stamps examined
paper-component-examine-detail-stamped-by = {CAPITALIZE(THE($paper))} {CONJUGATE-HAVE($paper)} been stamped by: {$stamps}.
paper-component-action-stamp-paper-other = {CAPITALIZE(THE($user))} stamps {THE($target)} with {THE($stamp)}.
paper-component-action-stamp-paper-self = You stamp {THE($target)} with {THE($stamp)}.
paper-component-action-stamp-paper-other = {CAPITALIZE(THE($user))} {$action} {THE($target)} with {THE($stamp)}.
paper-component-action-stamp-paper-self = You {$action} {THE($target)} with {THE($stamp)}.

0 comments on commit 77ab904

Please sign in to comment.