forked from DeltaV-Station/Delta-v
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add mapping editor (DeltaV-Station#757) * Remove mapping actions, never again * Cleanup actions system * Jarvis, remove all references to CM14 * Fix InventoryUIController crashing when an InventoryGui is not found * Rename mapping1 to mapping * Clean up context calls * Add doc comments * Add delegate for hiding decals in the mapping screen * Jarvis mission failed * a * Add test * Fix not flushing save stream in mapping manager * change * Fix verbs * fixes * localise --------- Co-authored-by: DrSmugleaf <[email protected]> Co-authored-by: metalgearsloth <[email protected]> Co-authored-by: metalgearsloth <[email protected]> Co-authored-by: Pieter-Jan Briers <[email protected]>
- Loading branch information
Showing
36 changed files
with
2,023 additions
and
45 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<mapping:MappingActionsButton | ||
xmlns="https://spacestation14.io" | ||
xmlns:mapping="clr-namespace:Content.Client.Mapping" | ||
StyleClasses="ButtonSquare" ToggleMode="True" SetSize="32 32" Margin="0 0 5 0" | ||
TooltipDelay="0"> | ||
<TextureRect Name="Texture" Access="Public" Stretch="Scale" SetSize="16 16" | ||
HorizontalAlignment="Center" VerticalAlignment="Center" /> | ||
</mapping:MappingActionsButton> |
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,15 @@ | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.Mapping; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class MappingActionsButton : Button | ||
{ | ||
public MappingActionsButton() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
} | ||
} | ||
|
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,4 @@ | ||
<mapping:MappingDoNotMeasure | ||
xmlns="https://spacestation14.io" | ||
xmlns:mapping="clr-namespace:Content.Client.Mapping"> | ||
</mapping:MappingDoNotMeasure> |
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 System.Numerics; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.Mapping; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class MappingDoNotMeasure : Control | ||
{ | ||
public MappingDoNotMeasure() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
} | ||
|
||
protected override Vector2 MeasureOverride(Vector2 availableSize) | ||
{ | ||
return Vector2.Zero; | ||
} | ||
} | ||
|
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,69 @@ | ||
using System.IO; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Content.Shared.Mapping; | ||
using Robust.Client.UserInterface; | ||
using Robust.Shared.Network; | ||
|
||
namespace Content.Client.Mapping; | ||
|
||
public sealed class MappingManager : IPostInjectInit | ||
{ | ||
[Dependency] private readonly IFileDialogManager _file = default!; | ||
[Dependency] private readonly IClientNetManager _net = default!; | ||
|
||
private Stream? _saveStream; | ||
private MappingMapDataMessage? _mapData; | ||
|
||
public void PostInject() | ||
{ | ||
_net.RegisterNetMessage<MappingSaveMapMessage>(); | ||
_net.RegisterNetMessage<MappingSaveMapErrorMessage>(OnSaveError); | ||
_net.RegisterNetMessage<MappingMapDataMessage>(OnMapData); | ||
} | ||
|
||
private void OnSaveError(MappingSaveMapErrorMessage message) | ||
{ | ||
_saveStream?.DisposeAsync(); | ||
_saveStream = null; | ||
} | ||
|
||
private async void OnMapData(MappingMapDataMessage message) | ||
{ | ||
if (_saveStream == null) | ||
{ | ||
_mapData = message; | ||
return; | ||
} | ||
|
||
await _saveStream.WriteAsync(Encoding.ASCII.GetBytes(message.Yml)); | ||
await _saveStream.DisposeAsync(); | ||
|
||
_saveStream = null; | ||
_mapData = null; | ||
} | ||
|
||
public async Task SaveMap() | ||
{ | ||
if (_saveStream != null) | ||
await _saveStream.DisposeAsync(); | ||
|
||
var request = new MappingSaveMapMessage(); | ||
_net.ClientSendMessage(request); | ||
|
||
var path = await _file.SaveFile(); | ||
if (path is not { fileStream: var stream }) | ||
return; | ||
|
||
if (_mapData != null) | ||
{ | ||
await stream.WriteAsync(Encoding.ASCII.GetBytes(_mapData.Yml)); | ||
_mapData = null; | ||
await stream.FlushAsync(); | ||
await stream.DisposeAsync(); | ||
return; | ||
} | ||
|
||
_saveStream = stream; | ||
} | ||
} |
Oops, something went wrong.