Fixes a bunch of funny issues i didn't catch (#5752)

This commit is contained in:
Moony
2021-12-11 23:07:45 -06:00
committed by GitHub
parent 7c7d4ca902
commit 9c53c29fba
2 changed files with 20 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
@@ -20,8 +21,10 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
private EntitySpawnWindow? _entitySpawnWindow; private EntitySpawnWindow? _entitySpawnWindow;
private TileSpawnWindow? _tileSpawnWindow; private TileSpawnWindow? _tileSpawnWindow;
protected override void EnteredTree() public AdminbusTab()
{ {
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
// For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually // For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually
// TODO: This will probably need some command check at some point // TODO: This will probably need some command check at some point
SpawnEntitiesButton.OnPressed += SpawnEntitiesButtonOnOnPressed; SpawnEntitiesButton.OnPressed += SpawnEntitiesButtonOnOnPressed;
@@ -47,17 +50,27 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
private void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj) private void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{ {
_entitySpawnWindow ??= new EntitySpawnWindow(IoCManager.Resolve<IPlacementManager>(), //FIXME: WE SHOULDN'T NEED TO CHECK FOR DISPOSED
IoCManager.Resolve<IPrototypeManager>(), if (_entitySpawnWindow == null || _entitySpawnWindow.Disposed)
IoCManager.Resolve<IResourceCache>()); {
_entitySpawnWindow = new EntitySpawnWindow(IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IPrototypeManager>(),
IoCManager.Resolve<IResourceCache>());
}
EntitySystem.Get<AdminSystem>().OpenCommand(_entitySpawnWindow); EntitySystem.Get<AdminSystem>().OpenCommand(_entitySpawnWindow);
} }
private void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj) private void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{ {
_tileSpawnWindow ??= new TileSpawnWindow(IoCManager.Resolve<ITileDefinitionManager>(), //FIXME: WE SHOULDN'T NEED TO CHECK FOR DISPOSED
IoCManager.Resolve<IPlacementManager>(), if (_tileSpawnWindow == null || _tileSpawnWindow.Disposed)
IoCManager.Resolve<IResourceCache>()); {
_tileSpawnWindow = new TileSpawnWindow(IoCManager.Resolve<ITileDefinitionManager>(),
IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IResourceCache>());
}
EntitySystem.Get<AdminSystem>().OpenCommand(_tileSpawnWindow); EntitySystem.Get<AdminSystem>().OpenCommand(_tileSpawnWindow);
} }
} }

View File

@@ -1,12 +1,8 @@
using System;
using Lidgren.Network; using Lidgren.Network;
using Robust.Shared.Network; using Robust.Shared.Network;
using Robust.Shared.Serialization;
namespace Content.Shared.Administration; namespace Content.Shared.Administration;
[NetSerializable]
[Serializable]
public class GamePrototypeLoadMessage : NetMessage public class GamePrototypeLoadMessage : NetMessage
{ {
public override MsgGroups MsgGroup => MsgGroups.String; public override MsgGroups MsgGroup => MsgGroups.String;