-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from VMSolidus/Upstream-Merge-7/5/2024
Upstream Merge 7/5/2024
- Loading branch information
Showing
146 changed files
with
3,627 additions
and
661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
Content.Client/DeltaV/CartridgeLoader/Cartridges/SecWatchEntryControl.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<BoxContainer xmlns="https://spacestation14.io" | ||
xmlns:cartridges="clr-namespace:Content.Client.DeltaV.CartridgeLoader.Cartridges" | ||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
HorizontalExpand="True" | ||
VerticalExpand="True" | ||
Margin="5"> | ||
<!-- All labels populated in constructor --> | ||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left"> | ||
<BoxContainer Orientation="Vertical"> | ||
<Label Name="Status"/> | ||
<Label Text="{Loc 'criminal-records-console-reason'}"/> | ||
</BoxContainer> | ||
<customControls:VSeparator StyleClasses="LowDivider" Margin="8 0"/> | ||
<BoxContainer Orientation="Vertical"> | ||
<Label Name="Title"/> | ||
<Label Name="Reason"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> |
21 changes: 21 additions & 0 deletions
21
Content.Client/DeltaV/CartridgeLoader/Cartridges/SecWatchEntryControl.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Content.Shared.CartridgeLoader.Cartridges; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.DeltaV.CartridgeLoader.Cartridges; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class SecWatchEntryControl : BoxContainer | ||
{ | ||
public SecWatchEntryControl(SecWatchEntry entry) | ||
{ | ||
RobustXamlLoader.Load(this); | ||
|
||
Status.Text = Loc.GetString($"criminal-records-status-{entry.Status.ToString().ToLower()}"); | ||
Title.Text = Loc.GetString("sec-watch-entry", ("name", entry.Name), ("job", entry.Job)); | ||
|
||
Reason.Text = entry.Reason ?? Loc.GetString("sec-watch-no-reason"); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Content.Client/DeltaV/CartridgeLoader/Cartridges/SecWatchUi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Content.Client.UserInterface.Fragments; | ||
using Content.Shared.CartridgeLoader; | ||
using Content.Shared.CartridgeLoader.Cartridges; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client.DeltaV.CartridgeLoader.Cartridges; | ||
|
||
public sealed partial class SecWatchUi : UIFragment | ||
{ | ||
private SecWatchUiFragment? _fragment; | ||
|
||
public override Control GetUIFragmentRoot() | ||
{ | ||
return _fragment!; | ||
} | ||
|
||
public override void Setup(BoundUserInterface ui, EntityUid? owner) | ||
{ | ||
_fragment = new SecWatchUiFragment(); | ||
} | ||
|
||
public override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
if (state is SecWatchUiState cast) | ||
_fragment?.UpdateState(cast); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Content.Client/DeltaV/CartridgeLoader/Cartridges/SecWatchUiFragment.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<cartridges:SecWatchUiFragment xmlns="https://spacestation14.io" | ||
xmlns:cartridges="clr-namespace:Content.Client.DeltaV.CartridgeLoader.Cartridges" | ||
Margin="5" | ||
VerticalExpand="True"> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True"> | ||
<Label Text="{Loc 'sec-watch-title'}" HorizontalExpand="True" HorizontalAlignment="Center"/> | ||
<Label Name="NoEntries" Text="{Loc 'sec-watch-no-entries'}" HorizontalExpand="True" HorizontalAlignment="Center" Visible="False"/> | ||
<ScrollContainer HorizontalExpand="True" VerticalExpand="True"> | ||
<!-- Populated when state received --> | ||
<BoxContainer Name="Entries" Orientation="Vertical" VerticalAlignment="Top"/> | ||
</ScrollContainer> | ||
</BoxContainer> | ||
</cartridges:SecWatchUiFragment> |
25 changes: 25 additions & 0 deletions
25
Content.Client/DeltaV/CartridgeLoader/Cartridges/SecWatchUiFragment.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Content.Shared.CartridgeLoader.Cartridges; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.DeltaV.CartridgeLoader.Cartridges; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class SecWatchUiFragment : BoxContainer | ||
{ | ||
public SecWatchUiFragment() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
} | ||
|
||
public void UpdateState(SecWatchUiState state) | ||
{ | ||
NoEntries.Visible = state.Entries.Count == 0; | ||
Entries.RemoveAllChildren(); | ||
foreach (var entry in state.Entries) | ||
{ | ||
Entries.AddChild(new SecWatchEntryControl(entry)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System.Numerics; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.Input; | ||
using Robust.Client.UserInterface; | ||
using Robust.Shared.Enums; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client.OfferItem; | ||
|
||
public sealed class OfferItemIndicatorsOverlay : Overlay | ||
{ | ||
private readonly IInputManager _inputManager; | ||
private readonly IEntityManager _entMan; | ||
private readonly IEyeManager _eye; | ||
private readonly OfferItemSystem _offer; | ||
|
||
private readonly Texture _sight; | ||
|
||
public override OverlaySpace Space => OverlaySpace.ScreenSpace; | ||
|
||
private readonly Color _mainColor = Color.White.WithAlpha(0.3f); | ||
private readonly Color _strokeColor = Color.Black.WithAlpha(0.5f); | ||
private readonly float _scale = 0.6f; // 1 is a little big | ||
|
||
public OfferItemIndicatorsOverlay(IInputManager input, IEntityManager entMan, | ||
IEyeManager eye, OfferItemSystem offerSys) | ||
{ | ||
_inputManager = input; | ||
_entMan = entMan; | ||
_eye = eye; | ||
_offer = offerSys; | ||
|
||
var spriteSys = _entMan.EntitySysManager.GetEntitySystem<SpriteSystem>(); | ||
_sight = spriteSys.Frame0(new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/give_item.rsi"), | ||
"give_item")); | ||
} | ||
|
||
protected override bool BeforeDraw(in OverlayDrawArgs args) | ||
{ | ||
if (!_offer.IsInOfferMode()) | ||
return false; | ||
|
||
return base.BeforeDraw(in args); | ||
} | ||
|
||
protected override void Draw(in OverlayDrawArgs args) | ||
{ | ||
var mouseScreenPosition = _inputManager.MouseScreenPosition; | ||
var mousePosMap = _eye.PixelToMap(mouseScreenPosition); | ||
if (mousePosMap.MapId != args.MapId) | ||
return; | ||
|
||
|
||
var mousePos = mouseScreenPosition.Position; | ||
var uiScale = (args.ViewportControl as Control)?.UIScale ?? 1f; | ||
var limitedScale = uiScale > 1.25f ? 1.25f : uiScale; | ||
|
||
DrawSight(_sight, args.ScreenHandle, mousePos, limitedScale * _scale); | ||
} | ||
|
||
private void DrawSight(Texture sight, DrawingHandleScreen screen, Vector2 centerPos, float scale) | ||
{ | ||
var sightSize = sight.Size * scale; | ||
var expandedSize = sightSize + new Vector2(7f, 7f); | ||
|
||
screen.DrawTextureRect(sight, | ||
UIBox2.FromDimensions(centerPos - sightSize * 0.5f, sightSize), _strokeColor); | ||
screen.DrawTextureRect(sight, | ||
UIBox2.FromDimensions(centerPos - expandedSize * 0.5f, expandedSize), _mainColor); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Content.Shared.CCVar; | ||
using Content.Shared.OfferItem; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.Input; | ||
using Robust.Client.Player; | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Client.OfferItem; | ||
|
||
public sealed class OfferItemSystem : SharedOfferItemSystem | ||
{ | ||
[Dependency] private readonly IOverlayManager _overlayManager = default!; | ||
[Dependency] private readonly IPlayerManager _playerManager = default!; | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
[Dependency] private readonly IInputManager _inputManager = default!; | ||
[Dependency] private readonly IEyeManager _eye = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
Subs.CVar(_cfg, CCVars.OfferModeIndicatorsPointShow, OnShowOfferIndicatorsChanged, true); | ||
} | ||
public override void Shutdown() | ||
{ | ||
_overlayManager.RemoveOverlay<OfferItemIndicatorsOverlay>(); | ||
|
||
base.Shutdown(); | ||
} | ||
|
||
public bool IsInOfferMode() | ||
{ | ||
var entity = _playerManager.LocalEntity; | ||
|
||
if (entity == null) | ||
return false; | ||
|
||
return IsInOfferMode(entity.Value); | ||
} | ||
private void OnShowOfferIndicatorsChanged(bool isShow) | ||
{ | ||
if (isShow) | ||
{ | ||
_overlayManager.AddOverlay(new OfferItemIndicatorsOverlay( | ||
_inputManager, | ||
EntityManager, | ||
_eye, | ||
this)); | ||
} | ||
else | ||
_overlayManager.RemoveOverlay<OfferItemIndicatorsOverlay>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.