Enable nullability in Content.Client (#3257)
* Enable nullability in Content.Client * Remove #nullable enable * Merge fixes * Remove Debug.Assert * Merge fixes * Fix build * Fix build
This commit is contained in:
@@ -7,8 +7,6 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Client.Administration
|
||||
{
|
||||
public class ClientAdminManager : IClientAdminManager, IClientConGroupImplementation, IPostInjectInit
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using Content.Shared.Administration;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Client.Administration
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
using System;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Animations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Animations
|
||||
{
|
||||
public static class ReusableAnimations
|
||||
{
|
||||
|
||||
public static void AnimateEntityPickup(IEntity entity, EntityCoordinates initialPosition, Vector2 finalPosition)
|
||||
{
|
||||
var animatableClone = entity.EntityManager.SpawnEntity("clientsideclone", initialPosition);
|
||||
animatableClone.Name = entity.Name;
|
||||
|
||||
if(!entity.TryGetComponent(out SpriteComponent sprite0))
|
||||
if (!entity.TryGetComponent(out SpriteComponent? sprite0))
|
||||
{
|
||||
Logger.Error($"Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", entity.Name, nameof(SpriteComponent));
|
||||
Logger.Error("Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", entity.Name, nameof(SpriteComponent));
|
||||
return;
|
||||
}
|
||||
var sprite = animatableClone.GetComponent<SpriteComponent>();
|
||||
sprite.CopyFrom(sprite0);
|
||||
|
||||
var animations = animatableClone.GetComponent<AnimationPlayerComponent>();
|
||||
animations.AnimationCompleted += (s) => {
|
||||
animations.AnimationCompleted += (_) => {
|
||||
animatableClone.Delete();
|
||||
};
|
||||
|
||||
@@ -42,13 +41,12 @@ namespace Content.Client.Animations
|
||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackComponentProperty.KeyFrame(initialPosition.Position, 0),
|
||||
new AnimationTrackComponentProperty.KeyFrame(finalPosition, 0.125f)
|
||||
new AnimationTrackProperty.KeyFrame(initialPosition.Position, 0),
|
||||
new AnimationTrackProperty.KeyFrame(finalPosition, 0.125f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "fancy_pickup_anim");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Content.Client.GameObjects.Components.Arcade;
|
||||
@@ -29,27 +29,27 @@ namespace Content.Client.Arcade
|
||||
private readonly PanelContainer _mainPanel;
|
||||
|
||||
private VBoxContainer _gameRootContainer;
|
||||
private GridContainer _gameGrid;
|
||||
private GridContainer _nextBlockGrid;
|
||||
private GridContainer _holdBlockGrid;
|
||||
private Label _pointsLabel;
|
||||
private Label _levelLabel;
|
||||
private Button _pauseButton;
|
||||
private GridContainer _gameGrid = default!;
|
||||
private GridContainer _nextBlockGrid = default!;
|
||||
private GridContainer _holdBlockGrid = default!;
|
||||
private readonly Label _pointsLabel;
|
||||
private readonly Label _levelLabel;
|
||||
private readonly Button _pauseButton;
|
||||
|
||||
private PanelContainer _menuRootContainer;
|
||||
private Button _unpauseButton;
|
||||
private Control _unpauseButtonMargin;
|
||||
private Button _newGameButton;
|
||||
private Button _scoreBoardButton;
|
||||
private readonly PanelContainer _menuRootContainer;
|
||||
private readonly Button _unpauseButton;
|
||||
private readonly Control _unpauseButtonMargin;
|
||||
private readonly Button _newGameButton;
|
||||
private readonly Button _scoreBoardButton;
|
||||
|
||||
private PanelContainer _gameOverRootContainer;
|
||||
private Label _finalScoreLabel;
|
||||
private Button _finalNewGameButton;
|
||||
private readonly PanelContainer _gameOverRootContainer;
|
||||
private readonly Label _finalScoreLabel;
|
||||
private readonly Button _finalNewGameButton;
|
||||
|
||||
private PanelContainer _highscoresRootContainer;
|
||||
private Label _localHighscoresLabel;
|
||||
private Label _globalHighscoresLabel;
|
||||
private Button _highscoreBackButton;
|
||||
private readonly PanelContainer _highscoresRootContainer;
|
||||
private readonly Label _localHighscoresLabel;
|
||||
private readonly Label _globalHighscoresLabel;
|
||||
private readonly Button _highscoreBackButton;
|
||||
|
||||
private bool _isPlayer = false;
|
||||
private bool _gameOver = false;
|
||||
@@ -64,23 +64,193 @@ namespace Content.Client.Arcade
|
||||
|
||||
_mainPanel = new PanelContainer();
|
||||
|
||||
SetupGameMenu(backgroundTexture);
|
||||
#region Game Menu
|
||||
// building the game container
|
||||
_gameRootContainer = new VBoxContainer();
|
||||
|
||||
_levelLabel = new Label
|
||||
{
|
||||
Align = Label.AlignMode.Center,
|
||||
HorizontalExpand = true
|
||||
};
|
||||
_gameRootContainer.AddChild(_levelLabel);
|
||||
_gameRootContainer.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(1,5)
|
||||
});
|
||||
|
||||
_pointsLabel = new Label
|
||||
{
|
||||
Align = Label.AlignMode.Center,
|
||||
HorizontalExpand = true
|
||||
};
|
||||
_gameRootContainer.AddChild(_pointsLabel);
|
||||
_gameRootContainer.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(1,10)
|
||||
});
|
||||
|
||||
var gameBox = new HBoxContainer();
|
||||
gameBox.AddChild(SetupHoldBox(backgroundTexture));
|
||||
gameBox.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(10,1)
|
||||
});
|
||||
gameBox.AddChild(SetupGameGrid(backgroundTexture));
|
||||
gameBox.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(10,1)
|
||||
});
|
||||
gameBox.AddChild(SetupNextBox(backgroundTexture));
|
||||
|
||||
_gameRootContainer.AddChild(gameBox);
|
||||
|
||||
_gameRootContainer.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(1,10)
|
||||
});
|
||||
|
||||
_pauseButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("Pause"),
|
||||
TextAlign = Label.AlignMode.Center
|
||||
};
|
||||
_pauseButton.OnPressed += (e) => TryPause();
|
||||
_gameRootContainer.AddChild(_pauseButton);
|
||||
#endregion
|
||||
|
||||
_mainPanel.AddChild(_gameRootContainer);
|
||||
|
||||
SetupPauseMenu(backgroundTexture);
|
||||
|
||||
SetupGameoverScreen(backgroundTexture);
|
||||
|
||||
SetupHighScoreScreen(backgroundTexture);
|
||||
|
||||
Contents.AddChild(_mainPanel);
|
||||
|
||||
CanKeyboardFocus = true;
|
||||
}
|
||||
|
||||
|
||||
private void SetupHighScoreScreen(Texture backgroundTexture)
|
||||
#region Pause Menu
|
||||
var pauseRootBack = new StyleBoxTexture
|
||||
{
|
||||
Texture = backgroundTexture,
|
||||
Modulate = OverlayShadowColor
|
||||
};
|
||||
pauseRootBack.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
_menuRootContainer = new PanelContainer
|
||||
{
|
||||
PanelOverride = pauseRootBack,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalAlignment = HAlignment.Center
|
||||
};
|
||||
|
||||
var pauseInnerBack = new StyleBoxTexture
|
||||
{
|
||||
Texture = backgroundTexture,
|
||||
Modulate = OverlayBackgroundColor
|
||||
};
|
||||
pauseInnerBack.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
var pauseMenuInnerPanel = new PanelContainer
|
||||
{
|
||||
PanelOverride = pauseInnerBack,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalAlignment = HAlignment.Center
|
||||
};
|
||||
|
||||
_menuRootContainer.AddChild(pauseMenuInnerPanel);
|
||||
|
||||
var pauseMenuContainer = new VBoxContainer
|
||||
{
|
||||
HorizontalAlignment = HAlignment.Center,
|
||||
VerticalAlignment = VAlignment.Center
|
||||
};
|
||||
|
||||
_newGameButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("New Game"),
|
||||
TextAlign = Label.AlignMode.Center
|
||||
};
|
||||
_newGameButton.OnPressed += (e) =>
|
||||
{
|
||||
_owner.SendAction(BlockGamePlayerAction.NewGame);
|
||||
};
|
||||
pauseMenuContainer.AddChild(_newGameButton);
|
||||
pauseMenuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
|
||||
|
||||
_scoreBoardButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("Scoreboard"),
|
||||
TextAlign = Label.AlignMode.Center
|
||||
};
|
||||
_scoreBoardButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.ShowHighscores);
|
||||
pauseMenuContainer.AddChild(_scoreBoardButton);
|
||||
_unpauseButtonMargin = new Control {MinSize = new Vector2(1, 10), Visible = false};
|
||||
pauseMenuContainer.AddChild(_unpauseButtonMargin);
|
||||
|
||||
_unpauseButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("Unpause"),
|
||||
TextAlign = Label.AlignMode.Center,
|
||||
Visible = false
|
||||
};
|
||||
_unpauseButton.OnPressed += (e) =>
|
||||
{
|
||||
_owner.SendAction(BlockGamePlayerAction.Unpause);
|
||||
};
|
||||
pauseMenuContainer.AddChild(_unpauseButton);
|
||||
|
||||
pauseMenuInnerPanel.AddChild(pauseMenuContainer);
|
||||
#endregion
|
||||
|
||||
#region Gameover Screen
|
||||
var gameOverRootBack = new StyleBoxTexture
|
||||
{
|
||||
Texture = backgroundTexture,
|
||||
Modulate = OverlayShadowColor
|
||||
};
|
||||
gameOverRootBack.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
_gameOverRootContainer = new PanelContainer
|
||||
{
|
||||
PanelOverride = gameOverRootBack,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalAlignment = HAlignment.Center
|
||||
};
|
||||
|
||||
var gameOverInnerBack = new StyleBoxTexture
|
||||
{
|
||||
Texture = backgroundTexture,
|
||||
Modulate = OverlayBackgroundColor
|
||||
};
|
||||
gameOverInnerBack.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
var gameOverMenuInnerPanel = new PanelContainer
|
||||
{
|
||||
PanelOverride = gameOverInnerBack,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalAlignment = HAlignment.Center
|
||||
};
|
||||
|
||||
_gameOverRootContainer.AddChild(gameOverMenuInnerPanel);
|
||||
|
||||
var gameOverMenuContainer = new VBoxContainer
|
||||
{
|
||||
HorizontalAlignment = HAlignment.Center,
|
||||
VerticalAlignment = VAlignment.Center
|
||||
};
|
||||
|
||||
gameOverMenuContainer.AddChild(new Label{Text = Loc.GetString("Gameover!"),Align = Label.AlignMode.Center});
|
||||
gameOverMenuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
|
||||
|
||||
|
||||
_finalScoreLabel = new Label{Align = Label.AlignMode.Center};
|
||||
gameOverMenuContainer.AddChild(_finalScoreLabel);
|
||||
gameOverMenuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
|
||||
|
||||
_finalNewGameButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("New Game"),
|
||||
TextAlign = Label.AlignMode.Center
|
||||
};
|
||||
_finalNewGameButton.OnPressed += (e) =>
|
||||
{
|
||||
_owner.SendAction(BlockGamePlayerAction.NewGame);
|
||||
};
|
||||
gameOverMenuContainer.AddChild(_finalNewGameButton);
|
||||
|
||||
gameOverMenuInnerPanel.AddChild(gameOverMenuContainer);
|
||||
#endregion
|
||||
|
||||
#region High Score Screen
|
||||
var rootBack = new StyleBoxTexture
|
||||
{
|
||||
Texture = backgroundTexture,
|
||||
@@ -143,138 +313,11 @@ namespace Content.Client.Arcade
|
||||
menuContainer.AddChild(_highscoreBackButton);
|
||||
|
||||
menuInnerPanel.AddChild(menuContainer);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void SetupGameoverScreen(Texture backgroundTexture)
|
||||
{
|
||||
var rootBack = new StyleBoxTexture
|
||||
{
|
||||
Texture = backgroundTexture,
|
||||
Modulate = OverlayShadowColor
|
||||
};
|
||||
rootBack.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
_gameOverRootContainer = new PanelContainer
|
||||
{
|
||||
PanelOverride = rootBack,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalAlignment = HAlignment.Center
|
||||
};
|
||||
Contents.AddChild(_mainPanel);
|
||||
|
||||
var innerBack = new StyleBoxTexture
|
||||
{
|
||||
Texture = backgroundTexture,
|
||||
Modulate = OverlayBackgroundColor
|
||||
};
|
||||
innerBack.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
var menuInnerPanel = new PanelContainer
|
||||
{
|
||||
PanelOverride = innerBack,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalAlignment = HAlignment.Center
|
||||
};
|
||||
|
||||
_gameOverRootContainer.AddChild(menuInnerPanel);
|
||||
|
||||
var menuContainer = new VBoxContainer
|
||||
{
|
||||
HorizontalAlignment = HAlignment.Center,
|
||||
VerticalAlignment = VAlignment.Center
|
||||
};
|
||||
|
||||
menuContainer.AddChild(new Label{Text = Loc.GetString("Gameover!"),Align = Label.AlignMode.Center});
|
||||
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
|
||||
|
||||
|
||||
_finalScoreLabel = new Label{Align = Label.AlignMode.Center};
|
||||
menuContainer.AddChild(_finalScoreLabel);
|
||||
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
|
||||
|
||||
_finalNewGameButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("New Game"),
|
||||
TextAlign = Label.AlignMode.Center
|
||||
};
|
||||
_finalNewGameButton.OnPressed += (e) =>
|
||||
{
|
||||
_owner.SendAction(BlockGamePlayerAction.NewGame);
|
||||
};
|
||||
menuContainer.AddChild(_finalNewGameButton);
|
||||
|
||||
menuInnerPanel.AddChild(menuContainer);
|
||||
}
|
||||
|
||||
private void SetupPauseMenu(Texture backgroundTexture)
|
||||
{
|
||||
var rootBack = new StyleBoxTexture
|
||||
{
|
||||
Texture = backgroundTexture,
|
||||
Modulate = OverlayShadowColor
|
||||
};
|
||||
rootBack.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
_menuRootContainer = new PanelContainer
|
||||
{
|
||||
PanelOverride = rootBack,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalAlignment = HAlignment.Center
|
||||
};
|
||||
|
||||
var innerBack = new StyleBoxTexture
|
||||
{
|
||||
Texture = backgroundTexture,
|
||||
Modulate = OverlayBackgroundColor
|
||||
};
|
||||
innerBack.SetPatchMargin(StyleBox.Margin.All, 10);
|
||||
var menuInnerPanel = new PanelContainer
|
||||
{
|
||||
PanelOverride = innerBack,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalAlignment = HAlignment.Center
|
||||
};
|
||||
|
||||
_menuRootContainer.AddChild(menuInnerPanel);
|
||||
|
||||
|
||||
var menuContainer = new VBoxContainer
|
||||
{
|
||||
HorizontalAlignment = HAlignment.Center,
|
||||
VerticalAlignment = VAlignment.Center
|
||||
};
|
||||
|
||||
_newGameButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("New Game"),
|
||||
TextAlign = Label.AlignMode.Center
|
||||
};
|
||||
_newGameButton.OnPressed += (e) =>
|
||||
{
|
||||
_owner.SendAction(BlockGamePlayerAction.NewGame);
|
||||
};
|
||||
menuContainer.AddChild(_newGameButton);
|
||||
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
|
||||
|
||||
_scoreBoardButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("Scoreboard"),
|
||||
TextAlign = Label.AlignMode.Center
|
||||
};
|
||||
_scoreBoardButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.ShowHighscores);
|
||||
menuContainer.AddChild(_scoreBoardButton);
|
||||
_unpauseButtonMargin = new Control {MinSize = new Vector2(1, 10), Visible = false};
|
||||
menuContainer.AddChild(_unpauseButtonMargin);
|
||||
|
||||
_unpauseButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("Unpause"),
|
||||
TextAlign = Label.AlignMode.Center,
|
||||
Visible = false
|
||||
};
|
||||
_unpauseButton.OnPressed += (e) =>
|
||||
{
|
||||
_owner.SendAction(BlockGamePlayerAction.Unpause);
|
||||
};
|
||||
menuContainer.AddChild(_unpauseButton);
|
||||
|
||||
menuInnerPanel.AddChild(menuContainer);
|
||||
CanKeyboardFocus = true;
|
||||
}
|
||||
|
||||
public void SetUsability(bool isPlayer)
|
||||
@@ -293,62 +336,6 @@ namespace Content.Client.Arcade
|
||||
_highscoreBackButton.Disabled = !_isPlayer;
|
||||
}
|
||||
|
||||
private void SetupGameMenu(Texture backgroundTexture)
|
||||
{
|
||||
// building the game container
|
||||
_gameRootContainer = new VBoxContainer();
|
||||
|
||||
_levelLabel = new Label
|
||||
{
|
||||
Align = Label.AlignMode.Center,
|
||||
HorizontalExpand = true
|
||||
};
|
||||
_gameRootContainer.AddChild(_levelLabel);
|
||||
_gameRootContainer.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(1,5)
|
||||
});
|
||||
|
||||
_pointsLabel = new Label
|
||||
{
|
||||
Align = Label.AlignMode.Center,
|
||||
HorizontalExpand = true
|
||||
};
|
||||
_gameRootContainer.AddChild(_pointsLabel);
|
||||
_gameRootContainer.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(1,10)
|
||||
});
|
||||
|
||||
var gameBox = new HBoxContainer();
|
||||
gameBox.AddChild(SetupHoldBox(backgroundTexture));
|
||||
gameBox.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(10,1)
|
||||
});
|
||||
gameBox.AddChild(SetupGameGrid(backgroundTexture));
|
||||
gameBox.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(10,1)
|
||||
});
|
||||
gameBox.AddChild(SetupNextBox(backgroundTexture));
|
||||
|
||||
_gameRootContainer.AddChild(gameBox);
|
||||
|
||||
_gameRootContainer.AddChild(new Control
|
||||
{
|
||||
MinSize = new Vector2(1,10)
|
||||
});
|
||||
|
||||
_pauseButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("Pause"),
|
||||
TextAlign = Label.AlignMode.Center
|
||||
};
|
||||
_pauseButton.OnPressed += (e) => TryPause();
|
||||
_gameRootContainer.AddChild(_pauseButton);
|
||||
}
|
||||
|
||||
private Control SetupGameGrid(Texture panelTex)
|
||||
{
|
||||
_gameGrid = new GridContainer
|
||||
@@ -541,17 +528,16 @@ namespace Content.Client.Arcade
|
||||
{
|
||||
var localHighscoreText = new StringBuilder(Loc.GetString("Station\n"));
|
||||
var globalHighscoreText = new StringBuilder(Loc.GetString("Nanotrasen:\n"));
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (localHighscores.Count > i)
|
||||
localHighscoreText.AppendLine(Loc.GetString("#{0}: {1} - {2}", i + 1, localHighscores[i].Name, localHighscores[i].Score));
|
||||
else
|
||||
localHighscoreText.AppendLine(Loc.GetString("#{0}: ??? - 0", i + 1));
|
||||
|
||||
if (globalHighscores.Count > i)
|
||||
globalHighscoreText.AppendLine(Loc.GetString("#{0}: {1} - {2}", i + 1, globalHighscores[i].Name, globalHighscores[i].Score));
|
||||
else
|
||||
globalHighscoreText.AppendLine(Loc.GetString("#{0}: ??? - 0", i + 1));
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
localHighscoreText.AppendLine(localHighscores.Count > i
|
||||
? Loc.GetString("#{0}: {1} - {2}", i + 1, localHighscores[i].Name, localHighscores[i].Score)
|
||||
: Loc.GetString("#{0}: ??? - 0", i + 1));
|
||||
|
||||
globalHighscoreText.AppendLine(globalHighscores.Count > i
|
||||
? Loc.GetString("#{0}: {1} - {2}", i + 1, globalHighscores[i].Name, globalHighscores[i].Score)
|
||||
: Loc.GetString("#{0}: ??? - 0", i + 1));
|
||||
}
|
||||
|
||||
_localHighscoresLabel.Text = localHighscoreText.ToString();
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Client.Chat
|
||||
/// <summary>
|
||||
/// Default formatting string for the ClientChatConsole.
|
||||
/// </summary>
|
||||
public string DefaultChatFormat { get; set; }
|
||||
public string DefaultChatFormat { get; set; } = string.Empty;
|
||||
|
||||
public bool ReleaseFocusOnEnter { get; set; } = true;
|
||||
|
||||
@@ -136,9 +136,9 @@ namespace Content.Client.Chat
|
||||
}
|
||||
}
|
||||
|
||||
public event TextSubmitHandler TextSubmitted;
|
||||
public event TextSubmitHandler? TextSubmitted;
|
||||
|
||||
public event FilterToggledHandler FilterToggled;
|
||||
public event FilterToggledHandler? FilterToggled;
|
||||
|
||||
public void AddLine(string message, ChatChannel channel, Color color)
|
||||
{
|
||||
|
||||
@@ -18,8 +18,6 @@ using Robust.Shared.Network;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Client.Chat
|
||||
{
|
||||
internal sealed class ChatManager : IChatManager, IPostInjectInit
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -5,6 +5,6 @@ namespace Content.Client
|
||||
{
|
||||
public sealed class ClientModuleTestingCallbacks : SharedModuleTestingCallbacks
|
||||
{
|
||||
public Action ClientBeforeIoC { get; set; }
|
||||
public Action? ClientBeforeIoC { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.Interfaces;
|
||||
|
||||
@@ -19,9 +19,10 @@ namespace Content.Client
|
||||
{
|
||||
[Dependency] private readonly IClientNetManager _netManager = default!;
|
||||
|
||||
public event Action OnServerDataLoaded;
|
||||
public GameSettings Settings { get; private set; }
|
||||
public PlayerPreferences Preferences { get; private set; }
|
||||
public event Action? OnServerDataLoaded;
|
||||
|
||||
public GameSettings Settings { get; private set; } = default!;
|
||||
public PlayerPreferences Preferences { get; private set; } = default!;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Content.Client.Commands
|
||||
|
||||
foreach (var component in components)
|
||||
{
|
||||
if (component.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
sprite.DrawDepth = (int) DrawDepth.Overlays;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Client.Commands
|
||||
|
||||
foreach (var mechanism in mechanisms)
|
||||
{
|
||||
if (!mechanism.Owner.TryGetComponent(out SpriteComponent sprite))
|
||||
if (!mechanism.Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Client.Commands
|
||||
|
||||
foreach (var mechanism in mechanisms)
|
||||
{
|
||||
if (mechanism.Owner.TryGetComponent(out SpriteComponent sprite))
|
||||
if (mechanism.Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||
{
|
||||
sprite.ContainerOccluded = false;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.GameObjects.Components.Construction;
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Shared.Construction;
|
||||
@@ -41,7 +40,7 @@ namespace Content.Client.Construction
|
||||
{
|
||||
if (entity.TryGetComponent(out ConstructionGhostComponent? ghost))
|
||||
{
|
||||
_constructionSystem.ClearGhost(ghost.GhostID);
|
||||
_constructionSystem.ClearGhost(ghost.GhostId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<OutputPath>..\bin\Content.Client\</OutputPath>
|
||||
<OutputType Condition="'$(FullRelease)' != 'True'">Exe</OutputType>
|
||||
<WarningsAsErrors>nullable</WarningsAsErrors>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Client.Administration;
|
||||
using Content.Client.Changelog;
|
||||
using Content.Client.Eui;
|
||||
using Content.Client.GameObjects.Components.Actor;
|
||||
using Content.Client.Graphics.Overlays;
|
||||
using Content.Client.Input;
|
||||
using Content.Client.Interfaces;
|
||||
using Content.Client.Interfaces.Chat;
|
||||
@@ -14,9 +15,9 @@ using Content.Client.StationEvents;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Client.UserInterface.AdminMenu;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Client.Graphics.Overlays;
|
||||
using Content.Client.Voting;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.Components.Cargo;
|
||||
using Content.Shared.GameObjects.Components.Chemistry.ChemMaster;
|
||||
@@ -27,7 +28,6 @@ using Content.Shared.GameObjects.Components.Power.AME;
|
||||
using Content.Shared.GameObjects.Components.Research;
|
||||
using Content.Shared.GameObjects.Components.VendingMachines;
|
||||
using Content.Shared.Kitchen;
|
||||
using Content.Shared.Alert;
|
||||
using Robust.Client;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
@@ -105,7 +105,7 @@ namespace Content.Client
|
||||
|
||||
_escapeMenuOwner.Initialize();
|
||||
|
||||
_baseClient.PlayerJoinedServer += (sender, args) =>
|
||||
_baseClient.PlayerJoinedServer += (_, _) =>
|
||||
{
|
||||
IoCManager.Resolve<IMapManager>().CreateNewMapEntity(MapId.Nullspace);
|
||||
};
|
||||
@@ -116,11 +116,14 @@ namespace Content.Client
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="args"></param>
|
||||
public void SubscribePlayerAttachmentEvents(object sender, EventArgs args)
|
||||
public void SubscribePlayerAttachmentEvents(object? sender, EventArgs args)
|
||||
{
|
||||
if (_playerManager.LocalPlayer != null)
|
||||
{
|
||||
_playerManager.LocalPlayer.EntityAttached += AttachPlayerToEntity;
|
||||
_playerManager.LocalPlayer.EntityDetached += DetachPlayerFromEntity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add the character interface master which combines all character interfaces into one window
|
||||
@@ -171,7 +174,7 @@ namespace Content.Client
|
||||
IoCManager.Resolve<ActionManager>().Initialize();
|
||||
IoCManager.Resolve<IVoteManager>().Initialize();
|
||||
|
||||
_baseClient.RunLevelChanged += (sender, args) =>
|
||||
_baseClient.RunLevelChanged += (_, args) =>
|
||||
{
|
||||
if (args.NewLevel == ClientRunLevel.Initialize)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Client
|
||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||
[Dependency] private readonly IGameHud _gameHud = default!;
|
||||
|
||||
private EscapeMenu _escapeMenu;
|
||||
private EscapeMenu? _escapeMenu;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
@@ -35,12 +35,12 @@ namespace Content.Client
|
||||
_escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false;
|
||||
|
||||
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu,
|
||||
InputCmdHandler.FromDelegate(s => Enabled()));
|
||||
InputCmdHandler.FromDelegate(_ => Enabled()));
|
||||
}
|
||||
else if (obj.OldState is GameScreenBase)
|
||||
{
|
||||
// Switched FROM GameScreen.
|
||||
_escapeMenu.Dispose();
|
||||
_escapeMenu?.Dispose();
|
||||
_escapeMenu = null;
|
||||
|
||||
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
|
||||
@@ -49,7 +49,7 @@ namespace Content.Client
|
||||
|
||||
private void Enabled()
|
||||
{
|
||||
if (_escapeMenu.IsOpen)
|
||||
if (_escapeMenu != null && _escapeMenu.IsOpen)
|
||||
{
|
||||
if (_escapeMenu.IsAtFront())
|
||||
{
|
||||
@@ -71,12 +71,12 @@ namespace Content.Client
|
||||
if (value)
|
||||
{
|
||||
_gameHud.EscapeButtonDown = true;
|
||||
_escapeMenu.OpenCentered();
|
||||
_escapeMenu?.OpenCentered();
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameHud.EscapeButtonDown = false;
|
||||
_escapeMenu.Close();
|
||||
_escapeMenu?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ using Content.Shared.Network.NetMessages;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Client.Eui
|
||||
{
|
||||
public abstract class BaseEui
|
||||
|
||||
@@ -5,8 +5,6 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Reflection;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Client.Eui
|
||||
{
|
||||
public sealed class EuiManager
|
||||
|
||||
@@ -15,14 +15,13 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
{
|
||||
}
|
||||
|
||||
private IdCardConsoleWindow _window;
|
||||
private IdCardConsoleWindow? _window;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new IdCardConsoleWindow(this, _prototypeManager);
|
||||
_window.Title = Owner.Owner.Name;
|
||||
_window = new IdCardConsoleWindow(this, _prototypeManager) {Title = Owner.Owner.Name};
|
||||
_window.OnClose += Close;
|
||||
_window.OpenCentered();
|
||||
}
|
||||
@@ -31,7 +30,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
{
|
||||
base.UpdateState(state);
|
||||
var castState = (IdCardConsoleBoundUserInterfaceState) state;
|
||||
_window.UpdateState(castState);
|
||||
_window?.UpdateState(castState);
|
||||
}
|
||||
|
||||
public void ButtonPressed(UiButton button)
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
|
||||
private readonly Dictionary<string, Button> _accessButtons = new();
|
||||
|
||||
private string _lastFullName;
|
||||
private string _lastJobTitle;
|
||||
private string? _lastFullName;
|
||||
private string? _lastJobTitle;
|
||||
|
||||
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager)
|
||||
{
|
||||
@@ -165,7 +165,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
_fullNameLineEdit.Editable = interfaceEnabled;
|
||||
if (!fullNameDirty)
|
||||
{
|
||||
_fullNameLineEdit.Text = state.TargetIdFullName;
|
||||
_fullNameLineEdit.Text = state.TargetIdFullName ?? "";
|
||||
}
|
||||
|
||||
_fullNameSaveButton.Disabled = !interfaceEnabled || !fullNameDirty;
|
||||
@@ -174,7 +174,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
_jobTitleLineEdit.Editable = interfaceEnabled;
|
||||
if (!jobTitleDirty)
|
||||
{
|
||||
_jobTitleLineEdit.Text = state.TargetIdJobTitle;
|
||||
_jobTitleLineEdit.Text = state.TargetIdJobTitle ?? "";
|
||||
}
|
||||
|
||||
_jobTitleSaveButton.Disabled = !interfaceEnabled || !jobTitleDirty;
|
||||
@@ -184,7 +184,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
button.Disabled = !interfaceEnabled;
|
||||
if (interfaceEnabled)
|
||||
{
|
||||
button.Pressed = state.TargetIdAccessList.Contains(accessName);
|
||||
button.Pressed = state.TargetIdAccessList?.Contains(accessName) ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.ActionBlocking;
|
||||
using Content.Shared.GameObjects.Components.ActionBlocking;
|
||||
using Content.Shared.Preferences.Appearance;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.ActionBlocking;
|
||||
using Content.Shared.GameObjects.Components.ActionBlocking;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using Content.Client.GameObjects.Components.Mobs;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
@@ -91,7 +90,7 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
}
|
||||
});
|
||||
|
||||
AddChild(new Placeholder(resourceCache)
|
||||
AddChild(new Placeholder()
|
||||
{
|
||||
PlaceholderText = Loc.GetString("Health & status effects")
|
||||
});
|
||||
@@ -104,7 +103,7 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
ObjectivesContainer = new VBoxContainer();
|
||||
AddChild(ObjectivesContainer);
|
||||
|
||||
AddChild(new Placeholder(resourceCache)
|
||||
AddChild(new Placeholder()
|
||||
{
|
||||
PlaceholderText = Loc.GetString("Antagonist Roles")
|
||||
});
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
/// <remarks>
|
||||
/// Null if it would otherwise be empty.
|
||||
/// </remarks>
|
||||
public SS14Window Window { get; private set; }
|
||||
public CharacterWindow? Window { get; private set; }
|
||||
|
||||
private List<ICharacterUI> _uiComponents;
|
||||
private List<ICharacterUI>? _uiComponents;
|
||||
|
||||
/// <summary>
|
||||
/// Create the window with all character UIs and bind it to a keypress
|
||||
@@ -58,11 +58,14 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
{
|
||||
base.OnRemove();
|
||||
|
||||
if (_uiComponents != null)
|
||||
{
|
||||
foreach (var component in _uiComponents)
|
||||
{
|
||||
// Make sure these don't get deleted when the window is disposed.
|
||||
component.Scene.Orphan();
|
||||
}
|
||||
}
|
||||
|
||||
_uiComponents = null;
|
||||
|
||||
@@ -73,7 +76,7 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
inputMgr.SetInputCommand(ContentKeyFunctions.OpenCharacterMenu, null);
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent component)
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Client.Arcade;
|
||||
using Content.Shared.Arcade;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -8,9 +7,9 @@ namespace Content.Client.GameObjects.Components.Arcade
|
||||
{
|
||||
public class BlockGameBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private BlockGameMenu _menu;
|
||||
private BlockGameMenu? _menu;
|
||||
|
||||
public BlockGameBoundUserInterface([NotNull] ClientUserInterfaceComponent owner, [NotNull] object uiKey) : base(owner, uiKey)
|
||||
public BlockGameBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
using Content.Client.Arcade;
|
||||
using Content.Shared.GameObjects.Components.Arcade;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Content.Shared.GameObjects.Components.Arcade.SharedSpaceVillainArcadeComponent;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Arcade
|
||||
{
|
||||
public class SpaceVillainArcadeBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables] private SpaceVillainArcadeMenu _menu;
|
||||
[ViewVariables] private SpaceVillainArcadeMenu? _menu;
|
||||
|
||||
//public SharedSpaceVillainArcadeComponent SpaceVillainArcade;
|
||||
|
||||
public SpaceVillainArcadeBoundUserInterface([NotNull] ClientUserInterfaceComponent owner, [NotNull] object uiKey) : base(owner, uiKey)
|
||||
public SpaceVillainArcadeBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
SendAction(SharedSpaceVillainArcadeComponent.PlayerAction.RequestData);
|
||||
SendAction(PlayerAction.RequestData);
|
||||
}
|
||||
|
||||
public void SendAction(SharedSpaceVillainArcadeComponent.PlayerAction action)
|
||||
public void SendAction(PlayerAction action)
|
||||
{
|
||||
SendMessage(new SharedSpaceVillainArcadeComponent.SpaceVillainArcadePlayerActionMessage(action));
|
||||
SendMessage(new SpaceVillainArcadePlayerActionMessage(action));
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
@@ -42,16 +41,14 @@ namespace Content.Client.GameObjects.Components.Arcade
|
||||
|
||||
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
|
||||
{
|
||||
if(message is SharedSpaceVillainArcadeComponent.SpaceVillainArcadeDataUpdateMessage msg) _menu.UpdateInfo(msg);
|
||||
if (message is SpaceVillainArcadeDataUpdateMessage msg) _menu?.UpdateInfo(msg);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (!disposing)
|
||||
return;
|
||||
|
||||
_menu?.Dispose();
|
||||
if (disposing) _menu?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -13,12 +11,15 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
[DataField("fireStackAlternateState")]
|
||||
private int _fireStackAlternateState = 3;
|
||||
|
||||
[DataField("normalState")]
|
||||
private string _normalState;
|
||||
private string? _normalState;
|
||||
|
||||
[DataField("alternateState")]
|
||||
private string _alternateState;
|
||||
private string? _alternateState;
|
||||
|
||||
[DataField("sprite")]
|
||||
private string _sprite;
|
||||
private string? _sprite;
|
||||
|
||||
public override void InitializeEntity(IEntity entity)
|
||||
{
|
||||
@@ -49,7 +50,11 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||
|
||||
if (_sprite != null)
|
||||
{
|
||||
sprite.LayerSetRSI(FireVisualLayers.Fire, _sprite);
|
||||
}
|
||||
|
||||
sprite.LayerSetVisible(FireVisualLayers.Fire, onFire);
|
||||
|
||||
if(fireStacks > _fireStackAlternateState && !string.IsNullOrEmpty(_alternateState))
|
||||
|
||||
@@ -10,13 +10,13 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
}
|
||||
|
||||
private GasAnalyzerWindow _menu;
|
||||
private GasAnalyzerWindow? _menu;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
_menu = new GasAnalyzerWindow(this);
|
||||
|
||||
_menu = new GasAnalyzerWindow(this);
|
||||
_menu.OnClose += Close;
|
||||
_menu.OpenCentered();
|
||||
}
|
||||
@@ -24,7 +24,8 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
_menu.Populate((GasAnalyzerBoundUserInterfaceState) state);
|
||||
|
||||
_menu?.Populate((GasAnalyzerBoundUserInterfaceState) state);
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
@@ -35,10 +36,8 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (!disposing)
|
||||
return;
|
||||
|
||||
_menu?.Dispose();
|
||||
if (disposing) _menu?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Client.Utility;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Client.UserInterface;
|
||||
@@ -22,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
return new StatusControl(this);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if (curState is not GasAnalyzerComponentState state)
|
||||
return;
|
||||
@@ -55,15 +54,17 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
}
|
||||
|
||||
_parent._uiUpdateNeeded = false;
|
||||
|
||||
var color = _parent.Danger switch
|
||||
{
|
||||
GasAnalyzerDanger.Warning => "orange",
|
||||
GasAnalyzerDanger.Hazard => "red",
|
||||
_ => "green",
|
||||
};
|
||||
|
||||
_label.SetMarkup(Loc.GetString("Pressure: [color={0}]{1}[/color]",
|
||||
color,
|
||||
Enum.GetName(typeof(GasAnalyzerDanger), _parent.Danger)));
|
||||
_parent.Danger));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -11,9 +9,9 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
public class GasAnalyzerVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state_off")]
|
||||
private string _stateOff;
|
||||
private string? _stateOff;
|
||||
[DataField("state_working")]
|
||||
private string _stateWorking;
|
||||
private string? _stateWorking;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
@@ -24,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
return;
|
||||
}
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -39,8 +37,6 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
case GasAnalyzerVisualState.Working:
|
||||
sprite.LayerSetState(0, _stateWorking);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
public class GasCanisterVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("stateConnected")]
|
||||
private string _stateConnected;
|
||||
private string? _stateConnected;
|
||||
|
||||
[DataField("pressureStates")]
|
||||
private string[] _statePressure = new string[] {"", "", "", ""};
|
||||
|
||||
@@ -20,12 +19,15 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
|
||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
||||
|
||||
if (_stateConnected != null)
|
||||
{
|
||||
sprite.LayerMapSet(Layers.ConnectedToPort, sprite.AddLayerState(_stateConnected));
|
||||
sprite.LayerSetVisible(Layers.ConnectedToPort, false);
|
||||
|
||||
sprite.LayerMapSet(Layers.PressureLight, sprite.AddLayerState(_stateConnected));
|
||||
sprite.LayerSetShader(Layers.PressureLight, "unshaded");
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
@@ -36,7 +38,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
return;
|
||||
}
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -49,7 +49,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
Children =
|
||||
{
|
||||
new Label(){ Text = Loc.GetString("Label: ") },
|
||||
(LabelInput = new LineEdit() { Text = Name, Editable = false,
|
||||
(LabelInput = new LineEdit() { Text = Name ?? "", Editable = false,
|
||||
MinSize = new Vector2(200, 30)}),
|
||||
(EditLabelBtn = new Button()),
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
if (!entity.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!entity.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
|
||||
sprite.LayerMapReserveBlank(Layer.PumpEnabled);
|
||||
var pumpEnabledLayer = sprite.LayerMapGet(Layer.PumpEnabled);
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
if (!component.TryGetData(PumpVisuals.VisualState, out PumpVisualState pumpVisualState)) return;
|
||||
|
||||
var pumpEnabledLayer = sprite.LayerMapGet(Layer.PumpEnabled);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
if (!entity.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!entity.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
|
||||
sprite.LayerMapReserveBlank(Layer.SiphonEnabled);
|
||||
var layer = sprite.LayerMapGet(Layer.SiphonEnabled);
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
if (!component.TryGetData(SiphonVisuals.VisualState, out SiphonVisualState siphonVisualState)) return;
|
||||
|
||||
var layer = sprite.LayerMapGet(Layer.SiphonEnabled);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
if (!entity.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!entity.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
|
||||
sprite.LayerMapReserveBlank(Layer.VentEnabled);
|
||||
var layer = sprite.LayerMapGet(Layer.VentEnabled);
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite)) return;
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
||||
if (!component.TryGetData(VentVisuals.VisualState, out VentVisualState ventVisualState)) return;
|
||||
|
||||
var layer = sprite.LayerMapGet(Layer.VentEnabled);
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
||||
[DataField("animation_state")]
|
||||
private string _state = "chempuff";
|
||||
|
||||
private Animation VaporFlick;
|
||||
private Animation VaporFlick = default!;
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Body.Mechanism
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Body.Part
|
||||
|
||||
@@ -11,10 +11,10 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
|
||||
public class BodyScannerBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private BodyScannerDisplay _display;
|
||||
private BodyScannerDisplay? _display;
|
||||
|
||||
[ViewVariables]
|
||||
private IEntity _entity;
|
||||
private IEntity? _entity;
|
||||
|
||||
public BodyScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { }
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
|
||||
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner.Uid} at {Owner.Owner.Transform.MapPosition}");
|
||||
}
|
||||
|
||||
_display.UpdateDisplay(_entity);
|
||||
_display?.UpdateDisplay(_entity);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body.Surgery;
|
||||
using Content.Shared.GameObjects.Components.Body.Surgery;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
|
||||
public delegate void OptionSelectedCallback(int selectedOptionData);
|
||||
|
||||
private readonly VBoxContainer _optionsBox;
|
||||
private OptionSelectedCallback _optionSelectedCallback;
|
||||
private OptionSelectedCallback? _optionSelectedCallback;
|
||||
|
||||
public SurgeryWindow()
|
||||
{
|
||||
@@ -65,7 +65,7 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
|
||||
{
|
||||
if (args.Button.Parent is SurgeryButton surgery)
|
||||
{
|
||||
_optionSelectedCallback(surgery.CallbackData);
|
||||
_optionSelectedCallback?.Invoke(surgery.CallbackData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Client.GameObjects.Components.Buckle
|
||||
{
|
||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||
|
||||
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent animation))
|
||||
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
||||
{
|
||||
sprite.Rotation = rotation;
|
||||
return;
|
||||
|
||||
@@ -2,35 +2,43 @@
|
||||
using Content.Shared.GameObjects.Components.Cargo;
|
||||
using Content.Shared.Prototypes.Cargo;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Content.Shared.GameObjects.Components.Cargo.SharedCargoConsoleComponent;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Cargo
|
||||
{
|
||||
public class CargoConsoleBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private CargoConsoleMenu _menu;
|
||||
[ViewVariables]
|
||||
private CargoConsoleOrderMenu _orderMenu;
|
||||
private CargoConsoleMenu? _menu;
|
||||
|
||||
[ViewVariables]
|
||||
public GalacticMarketComponent Market { get; private set; }
|
||||
private CargoConsoleOrderMenu? _orderMenu;
|
||||
|
||||
[ViewVariables]
|
||||
public CargoOrderDatabaseComponent Orders { get; private set; }
|
||||
public GalacticMarketComponent? Market { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public CargoOrderDatabaseComponent? Orders { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public bool RequestOnly { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public int BankId { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public string BankName { get; private set; }
|
||||
public string? BankName { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public int BankBalance { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public (int CurrentCapacity, int MaxCapacity) ShuttleCapacity { get; private set; }
|
||||
|
||||
private CargoProductPrototype _product;
|
||||
private CargoProductPrototype? _product;
|
||||
|
||||
public CargoConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
@@ -40,8 +48,8 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
{
|
||||
base.Open();
|
||||
|
||||
if (!Owner.Owner.TryGetComponent(out GalacticMarketComponent market)
|
||||
|| !Owner.Owner.TryGetComponent(out CargoOrderDatabaseComponent orders)) return;
|
||||
if (!Owner.Owner.TryGetComponent(out GalacticMarketComponent? market) ||
|
||||
!Owner.Owner.TryGetComponent(out CargoOrderDatabaseComponent? orders)) return;
|
||||
|
||||
Market = market;
|
||||
Orders = orders;
|
||||
@@ -57,23 +65,23 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
Market.OnDatabaseUpdated += _menu.PopulateCategories;
|
||||
Orders.OnDatabaseUpdated += _menu.PopulateOrders;
|
||||
|
||||
_menu.CallShuttleButton.OnPressed += (args) =>
|
||||
_menu.CallShuttleButton.OnPressed += (_) =>
|
||||
{
|
||||
SendMessage(new SharedCargoConsoleComponent.CargoConsoleShuttleMessage());
|
||||
SendMessage(new CargoConsoleShuttleMessage());
|
||||
};
|
||||
_menu.OnItemSelected += (args) =>
|
||||
{
|
||||
if (args.Button.Parent is not CargoProductRow row)
|
||||
return;
|
||||
_product = row.Product;
|
||||
_orderMenu.Requester.Text = null;
|
||||
_orderMenu.Reason.Text = null;
|
||||
_orderMenu.Requester.Text = "";
|
||||
_orderMenu.Reason.Text = "";
|
||||
_orderMenu.Amount.Value = 1;
|
||||
_orderMenu.OpenCentered();
|
||||
};
|
||||
_menu.OnOrderApproved += ApproveOrder;
|
||||
_menu.OnOrderCanceled += RemoveOrder;
|
||||
_orderMenu.SubmitButton.OnPressed += (args) =>
|
||||
_orderMenu.SubmitButton.OnPressed += (_) =>
|
||||
{
|
||||
AddOrder();
|
||||
_orderMenu.Close();
|
||||
@@ -92,47 +100,63 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
if (RequestOnly != cState.RequestOnly)
|
||||
{
|
||||
RequestOnly = cState.RequestOnly;
|
||||
_menu.UpdateRequestOnly();
|
||||
_menu?.UpdateRequestOnly();
|
||||
}
|
||||
BankId = cState.BankId;
|
||||
BankName = cState.BankName;
|
||||
BankBalance = cState.BankBalance;
|
||||
ShuttleCapacity = cState.ShuttleCapacity;
|
||||
_menu.UpdateCargoCapacity();
|
||||
_menu.UpdateBankData();
|
||||
_menu?.UpdateCargoCapacity();
|
||||
_menu?.UpdateBankData();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (!disposing) return;
|
||||
|
||||
if (Market != null && _menu != null)
|
||||
{
|
||||
Market.OnDatabaseUpdated -= _menu.PopulateProducts;
|
||||
Market.OnDatabaseUpdated -= _menu.PopulateCategories;
|
||||
}
|
||||
|
||||
if (Orders != null && _menu != null)
|
||||
{
|
||||
Orders.OnDatabaseUpdated -= _menu.PopulateOrders;
|
||||
}
|
||||
|
||||
_menu?.Dispose();
|
||||
_orderMenu?.Dispose();
|
||||
}
|
||||
|
||||
internal void AddOrder()
|
||||
private void AddOrder()
|
||||
{
|
||||
SendMessage(new SharedCargoConsoleComponent.CargoConsoleAddOrderMessage(_orderMenu.Requester.Text,
|
||||
_orderMenu.Reason.Text, _product.ID, _orderMenu.Amount.Value));
|
||||
SendMessage(new CargoConsoleAddOrderMessage(
|
||||
_orderMenu?.Requester.Text ?? "",
|
||||
_orderMenu?.Reason.Text ?? "",
|
||||
_product?.ID ?? "",
|
||||
_orderMenu?.Amount.Value ?? 0));
|
||||
}
|
||||
|
||||
internal void RemoveOrder(BaseButton.ButtonEventArgs args)
|
||||
private void RemoveOrder(ButtonEventArgs args)
|
||||
{
|
||||
if (args.Button.Parent.Parent is not CargoOrderRow row)
|
||||
if (args.Button.Parent?.Parent is not CargoOrderRow row || row.Order == null)
|
||||
return;
|
||||
SendMessage(new SharedCargoConsoleComponent.CargoConsoleRemoveOrderMessage(row.Order.OrderNumber));
|
||||
|
||||
SendMessage(new CargoConsoleRemoveOrderMessage(row.Order.OrderNumber));
|
||||
}
|
||||
|
||||
internal void ApproveOrder(BaseButton.ButtonEventArgs args)
|
||||
private void ApproveOrder(ButtonEventArgs args)
|
||||
{
|
||||
if (args.Button.Parent.Parent is not CargoOrderRow row)
|
||||
if (args.Button.Parent?.Parent is not CargoOrderRow row || row.Order == null)
|
||||
return;
|
||||
|
||||
if (ShuttleCapacity.CurrentCapacity == ShuttleCapacity.MaxCapacity)
|
||||
return;
|
||||
SendMessage(new SharedCargoConsoleComponent.CargoConsoleApproveOrderMessage(row.Order.OrderNumber));
|
||||
|
||||
SendMessage(new CargoConsoleApproveOrderMessage(row.Order.OrderNumber));
|
||||
_menu?.UpdateCargoCapacity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
/// <summary>
|
||||
/// Event called when the database is updated.
|
||||
/// </summary>
|
||||
public event Action OnDatabaseUpdated;
|
||||
public event Action? OnDatabaseUpdated;
|
||||
|
||||
// TODO add account selector menu
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
_orders.Add(order);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
if (curState is not CargoOrderDatabaseState state)
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
/// <summary>
|
||||
/// Event called when the database is updated.
|
||||
/// </summary>
|
||||
public event Action OnDatabaseUpdated;
|
||||
public event Action? OnDatabaseUpdated;
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
if (curState is not GalacticMarketState state)
|
||||
@@ -25,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
_productIds.Clear();
|
||||
foreach (var productId in state.Products)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(productId, out CargoProductPrototype product))
|
||||
if (!_prototypeManager.TryIndex(productId, out CargoProductPrototype? product))
|
||||
continue;
|
||||
_products.Add(product);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
@@ -13,6 +13,7 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Content.Shared.GameObjects.Components.Chemistry.ChemMaster.SharedChemMasterComponent;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
|
||||
{
|
||||
@@ -38,7 +39,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
|
||||
|
||||
public bool BufferModeTransfer = true;
|
||||
|
||||
public event Action<BaseButton.ButtonEventArgs, ChemButton> OnChemButtonPressed;
|
||||
public event Action<ButtonEventArgs, ChemButton>? OnChemButtonPressed;
|
||||
|
||||
public HBoxContainer PillInfo { get; set; }
|
||||
public HBoxContainer BottleInfo { get; set; }
|
||||
@@ -331,7 +332,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
|
||||
{
|
||||
var name = Loc.GetString("Unknown reagent");
|
||||
//Try to the prototype for the given reagent. This gives us it's name.
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype? proto))
|
||||
{
|
||||
name = proto.Name;
|
||||
}
|
||||
@@ -386,7 +387,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
|
||||
{
|
||||
var name = Loc.GetString("Unknown reagent");
|
||||
//Try to the prototype for the given reagent. This gives us it's name.
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype? proto))
|
||||
{
|
||||
name = proto.Name;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Animations;
|
||||
|
||||
@@ -9,8 +9,6 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Chemistry
|
||||
{
|
||||
[RegisterComponent]
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Chemistry
|
||||
void IItemStatus.DestroyControl(Control control) { }
|
||||
|
||||
//Handle net updates
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if (curState is not InjectorComponentState state)
|
||||
{
|
||||
|
||||
@@ -16,12 +16,11 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
[UsedImplicitly]
|
||||
public class ReagentDispenserBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private ReagentDispenserWindow _window;
|
||||
private ReagentDispenserBoundUserInterfaceState _lastState;
|
||||
private ReagentDispenserWindow? _window;
|
||||
private ReagentDispenserBoundUserInterfaceState? _lastState;
|
||||
|
||||
public ReagentDispenserBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -80,8 +79,14 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
/// <param name="inventory">A list of the reagents which can be dispensed.</param>
|
||||
private void UpdateReagentsList(List<ReagentDispenserInventoryEntry> inventory)
|
||||
{
|
||||
if (_window == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_window.UpdateReagentsList(inventory);
|
||||
for (int i = 0; i < _window.ChemicalList.Children.Count(); i++)
|
||||
|
||||
for (var i = 0; i < _window.ChemicalList.Children.Count(); i++)
|
||||
{
|
||||
var button = (Button)_window.ChemicalList.Children.ElementAt(i);
|
||||
var i1 = i;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
|
||||
foreach (var entry in inventory)
|
||||
{
|
||||
if (_prototypeManager.TryIndex(entry.ID, out ReagentPrototype proto))
|
||||
if (_prototypeManager.TryIndex(entry.ID, out ReagentPrototype? proto))
|
||||
{
|
||||
ChemicalList.AddChild(new Button {Text = proto.Name});
|
||||
}
|
||||
@@ -253,8 +253,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
/// </summary>
|
||||
/// <param name="state">State data for the dispenser.</param>
|
||||
/// <param name="highlightedReagentId">Prototype id of the reagent whose dispense button is currently being mouse hovered.</param>
|
||||
public void UpdateContainerInfo(ReagentDispenserBoundUserInterfaceState state,
|
||||
string highlightedReagentId = null)
|
||||
public void UpdateContainerInfo(ReagentDispenserBoundUserInterfaceState state, string highlightedReagentId = "")
|
||||
{
|
||||
ContainerInfo.Children.Clear();
|
||||
|
||||
@@ -286,7 +285,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
{
|
||||
var name = Loc.GetString("Unknown reagent");
|
||||
//Try to the prototype for the given reagent. This gives us it's name.
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype? proto))
|
||||
{
|
||||
name = proto.Name;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
|
||||
{
|
||||
}
|
||||
|
||||
private CloningPodWindow _window;
|
||||
private CloningPodWindow? _window;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
@@ -39,7 +39,8 @@ namespace Content.Client.GameObjects.Components.CloningPod
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
_window.Populate((CloningPodBoundUserInterfaceState) state);
|
||||
|
||||
_window?.Populate((CloningPodBoundUserInterfaceState) state);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Client.GameObjects.Components.HUD.Inventory;
|
||||
using Content.Client.GameObjects.Components.HUD.Inventory;
|
||||
using Content.Client.GameObjects.Components.Items;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
@@ -70,6 +69,12 @@ namespace Content.Client.GameObjects.Components.Clothing
|
||||
}
|
||||
|
||||
var rsi = GetRSI();
|
||||
|
||||
if (rsi == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var prefix = ClothingEquippedPrefix ?? EquippedPrefix;
|
||||
var stateId = prefix != null ? $"{prefix}-equipped-{slot}" : $"equipped-{slot}";
|
||||
if (rsi.TryGetState(stateId, out _))
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System;
|
||||
using Content.Client.Command;
|
||||
using Content.Shared.GameObjects.Components.Command;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
@@ -4,17 +4,17 @@ using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using static Content.Shared.GameObjects.Components.SharedConfigurationComponent;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Wires
|
||||
namespace Content.Client.GameObjects.Components.Configuration
|
||||
{
|
||||
public class ConfigurationBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
public Regex Validation { get; internal set; }
|
||||
public Regex? Validation { get; internal set; }
|
||||
|
||||
public ConfigurationBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
private ConfigurationMenu _menu;
|
||||
private ConfigurationMenu? _menu;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
@@ -28,12 +28,19 @@ namespace Content.Client.GameObjects.Components.Wires
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
_menu.Populate(state as ConfigurationBoundUserInterfaceState);
|
||||
|
||||
if (state is not ConfigurationBoundUserInterfaceState configurationState)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_menu?.Populate(configurationState);
|
||||
}
|
||||
|
||||
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
|
||||
{
|
||||
base.ReceiveMessage(message);
|
||||
|
||||
if (message is ValidationUpdateMessage msg)
|
||||
{
|
||||
Validation = new Regex(msg.ValidationString, RegexOptions.Compiled);
|
||||
@@ -49,8 +56,11 @@ namespace Content.Client.GameObjects.Components.Wires
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (disposing && _menu != null)
|
||||
{
|
||||
_menu.OnClose -= Close;
|
||||
_menu.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using Robust.Shared.Maths;
|
||||
using static Content.Shared.GameObjects.Components.SharedConfigurationComponent;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Wires
|
||||
namespace Content.Client.GameObjects.Components.Configuration
|
||||
{
|
||||
public class ConfigurationMenu : SS14Window
|
||||
{
|
||||
|
||||
@@ -16,14 +16,16 @@ namespace Content.Client.GameObjects.Components.Construction
|
||||
|
||||
public override string Name => "ConstructionGhost";
|
||||
|
||||
[ViewVariables] public ConstructionPrototype Prototype { get; set; }
|
||||
[ViewVariables] public int GhostID { get; set; }
|
||||
[ViewVariables] public ConstructionPrototype? Prototype { get; set; }
|
||||
[ViewVariables] public int GhostId { get; set; }
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (Prototype == null) return;
|
||||
|
||||
message.AddMarkup(Loc.GetString("Building: [color=cyan]{0}[/color]\n", Prototype.Name));
|
||||
|
||||
if (!_prototypeManager.TryIndex(Prototype.Graph, out ConstructionGraphPrototype graph)) return;
|
||||
if (!_prototypeManager.TryIndex(Prototype.Graph, out ConstructionGraphPrototype? graph)) return;
|
||||
var startNode = graph.Nodes[Prototype.StartNode];
|
||||
var path = graph.Path(Prototype.StartNode, Prototype.TargetNode);
|
||||
var edge = startNode.GetEdge(path[0].Name);
|
||||
|
||||
@@ -4,8 +4,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Conveyor
|
||||
{
|
||||
@@ -13,15 +11,17 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
||||
public class ConveyorVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state_running")]
|
||||
private string _stateRunning;
|
||||
private string? _stateRunning;
|
||||
|
||||
[DataField("state_stopped")]
|
||||
private string _stateStopped;
|
||||
private string? _stateStopped;
|
||||
|
||||
[DataField("state_reversed")]
|
||||
private string _stateReversed;
|
||||
private string? _stateReversed;
|
||||
|
||||
private void ChangeState(AppearanceComponent appearance)
|
||||
{
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Conveyor
|
||||
{
|
||||
@@ -12,15 +10,17 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
||||
public class TwoWayLeverVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state_forward")]
|
||||
private string _stateForward;
|
||||
private string? _stateForward;
|
||||
|
||||
[DataField("state_off")]
|
||||
private string _stateOff;
|
||||
private string? _stateOff;
|
||||
|
||||
[DataField("state_reversed")]
|
||||
private string _stateReversed;
|
||||
private string? _stateReversed;
|
||||
|
||||
private void ChangeState(AppearanceComponent appearance)
|
||||
{
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Crayon
|
||||
{
|
||||
@@ -13,7 +13,7 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
{
|
||||
}
|
||||
|
||||
private CrayonWindow _menu;
|
||||
private CrayonWindow? _menu;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
@@ -31,7 +31,8 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
_menu.UpdateState((CrayonBoundUserInterfaceState) state);
|
||||
|
||||
_menu?.UpdateState((CrayonBoundUserInterfaceState) state);
|
||||
}
|
||||
|
||||
public void Select(string state)
|
||||
@@ -43,7 +44,10 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
_menu.Close();
|
||||
if (disposing)
|
||||
{
|
||||
_menu?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
return new StatusControl(this);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if (curState is not CrayonComponentState state)
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
@@ -7,7 +8,7 @@ using Robust.Client.Utility;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Collections.Generic;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Crayon
|
||||
{
|
||||
@@ -16,8 +17,8 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
public CrayonBoundUserInterface Owner { get; }
|
||||
private readonly LineEdit _search;
|
||||
private readonly GridContainer _grid;
|
||||
private Dictionary<string, Texture> _decals;
|
||||
private string _selected;
|
||||
private Dictionary<string, Texture>? _decals;
|
||||
private string? _selected;
|
||||
private Color _color;
|
||||
|
||||
public CrayonWindow(CrayonBoundUserInterface owner)
|
||||
@@ -30,7 +31,7 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
Contents.AddChild(vbox);
|
||||
|
||||
_search = new LineEdit();
|
||||
_search.OnTextChanged += (e) => RefreshList();
|
||||
_search.OnTextChanged += (_) => RefreshList();
|
||||
vbox.AddChild(_search);
|
||||
|
||||
_grid = new GridContainer()
|
||||
@@ -68,7 +69,7 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
ToolTip = decal,
|
||||
Modulate = _color
|
||||
};
|
||||
button.OnPressed += Button_OnPressed;
|
||||
button.OnPressed += ButtonOnPressed;
|
||||
if (_selected == decal)
|
||||
{
|
||||
var panelContainer = new PanelContainer()
|
||||
@@ -91,12 +92,15 @@ namespace Content.Client.GameObjects.Components.Crayon
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_OnPressed(BaseButton.ButtonEventArgs obj)
|
||||
private void ButtonOnPressed(ButtonEventArgs obj)
|
||||
{
|
||||
if (obj.Button.Name != null)
|
||||
{
|
||||
Owner.Select(obj.Button.Name);
|
||||
_selected = obj.Button.Name;
|
||||
RefreshList();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateState(CrayonBoundUserInterfaceState state)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalRouterComponent;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalTaggerComponent;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalUnitComponent;
|
||||
|
||||
@@ -15,36 +15,36 @@ namespace Content.Client.GameObjects.Components.Disposal
|
||||
private const string AnimationKey = "disposal_unit_animation";
|
||||
|
||||
[DataField("state_anchored", required: true)]
|
||||
private string _stateAnchored;
|
||||
private string? _stateAnchored;
|
||||
|
||||
[DataField("state_unanchored", required: true)]
|
||||
private string _stateUnAnchored;
|
||||
private string? _stateUnAnchored;
|
||||
|
||||
[DataField("state_charging", required: true)]
|
||||
private string _stateCharging;
|
||||
private string? _stateCharging;
|
||||
|
||||
[DataField("overlay_charging", required: true)]
|
||||
private string _overlayCharging;
|
||||
private string? _overlayCharging;
|
||||
|
||||
[DataField("overlay_ready", required: true)]
|
||||
private string _overlayReady;
|
||||
private string? _overlayReady;
|
||||
|
||||
[DataField("overlay_full", required: true)]
|
||||
private string _overlayFull;
|
||||
private string? _overlayFull;
|
||||
|
||||
[DataField("overlay_engaged", required: true)]
|
||||
private string _overlayEngaged;
|
||||
private string? _overlayEngaged;
|
||||
|
||||
[DataField("state_flush", required: true)]
|
||||
private string _stateFlush;
|
||||
private string? _stateFlush;
|
||||
|
||||
[DataField("flush_sound", required: true)]
|
||||
private string _flushSound;
|
||||
private string? _flushSound;
|
||||
|
||||
[DataField("flush_time", required: true)]
|
||||
private float _flushTime;
|
||||
|
||||
private Animation _flushAnimation;
|
||||
private Animation _flushAnimation = default!;
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
@@ -57,8 +57,12 @@ namespace Content.Client.GameObjects.Components.Disposal
|
||||
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
_flushAnimation.AnimationTracks.Add(sound);
|
||||
|
||||
if (_flushSound != null)
|
||||
{
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_flushSound, 0));
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeState(AppearanceComponent appearance)
|
||||
{
|
||||
@@ -67,7 +71,7 @@ namespace Content.Client.GameObjects.Components.Disposal
|
||||
return;
|
||||
}
|
||||
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Disposal
|
||||
{
|
||||
@@ -13,15 +11,17 @@ namespace Content.Client.GameObjects.Components.Disposal
|
||||
public class DisposalVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state_free")]
|
||||
private string _stateFree;
|
||||
private string? _stateFree;
|
||||
|
||||
[DataField("state_anchored")]
|
||||
private string _stateAnchored;
|
||||
private string? _stateAnchored;
|
||||
|
||||
[DataField("state_broken")]
|
||||
private string _stateBroken;
|
||||
private string? _stateBroken;
|
||||
|
||||
private void ChangeState(AppearanceComponent appearance)
|
||||
{
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.GameObjects.EntitySystems.DoAfter;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Client.GameObjects.Components.Wires;
|
||||
using Content.Shared.Audio;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Doors;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Doors
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@ using Content.Shared.GameObjects.Components.Explosion;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Explosion
|
||||
{
|
||||
@@ -12,7 +10,7 @@ namespace Content.Client.GameObjects.Components.Explosion
|
||||
public class ClusterFlashVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("state")]
|
||||
private string _state;
|
||||
private string? _state;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
|
||||
@@ -53,9 +53,8 @@ namespace Content.Client.GameObjects.Components
|
||||
}
|
||||
};
|
||||
|
||||
private Action<string> _radiatingCallback;
|
||||
private Action<string> _blinkingCallback;
|
||||
|
||||
private Action<string>? _radiatingCallback;
|
||||
private Action<string>? _blinkingCallback;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Fluids
|
||||
{
|
||||
@@ -11,9 +9,9 @@ namespace Content.Client.GameObjects.Components.Fluids
|
||||
public class SprayVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("safety_on_state")]
|
||||
private string _safetyOnState;
|
||||
private string? _safetyOnState;
|
||||
[DataField("safety_off_state")]
|
||||
private string _safetyOffState;
|
||||
private string? _safetyOffState;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components.Gravity;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
@@ -9,9 +10,10 @@ using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Gravity
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class GravityGeneratorBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private GravityGeneratorWindow _window;
|
||||
private GravityGeneratorWindow? _window;
|
||||
|
||||
public bool IsOn;
|
||||
|
||||
@@ -28,7 +30,7 @@ namespace Content.Client.GameObjects.Components.Gravity
|
||||
|
||||
_window = new GravityGeneratorWindow(this);
|
||||
|
||||
_window.Switch.OnPressed += (args) =>
|
||||
_window.Switch.OnPressed += (_) =>
|
||||
{
|
||||
SendMessage(new SharedGravityGeneratorComponent.SwitchGeneratorMessage(!IsOn));
|
||||
SendMessage(new SharedGravityGeneratorComponent.GeneratorStatusRequestMessage());
|
||||
@@ -43,7 +45,7 @@ namespace Content.Client.GameObjects.Components.Gravity
|
||||
|
||||
var castState = (SharedGravityGeneratorComponent.GeneratorState) state;
|
||||
IsOn = castState.On;
|
||||
_window.UpdateButton();
|
||||
_window?.UpdateButton();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
@@ -63,11 +65,11 @@ namespace Content.Client.GameObjects.Components.Gravity
|
||||
|
||||
public GravityGeneratorBoundUserInterface Owner;
|
||||
|
||||
public GravityGeneratorWindow(GravityGeneratorBoundUserInterface gravityGeneratorInterface = null)
|
||||
public GravityGeneratorWindow(GravityGeneratorBoundUserInterface ui)
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
Owner = gravityGeneratorInterface;
|
||||
Owner = ui;
|
||||
|
||||
Title = Loc.GetString("Gravity Generator Control");
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.Components.Clothing;
|
||||
@@ -268,7 +267,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetSlot(Slots slot, out IEntity? item)
|
||||
public bool TryGetSlot(Slots slot, [NotNullWhen(true)] out IEntity? item)
|
||||
{
|
||||
return _slots.TryGetValue(slot, out item);
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
private readonly Dictionary<Slots, List<ItemSlotButton>> _inventoryButtons
|
||||
= new();
|
||||
|
||||
private ItemSlotButton _hudButtonPocket1;
|
||||
private ItemSlotButton _hudButtonPocket2;
|
||||
private ItemSlotButton _hudButtonBelt;
|
||||
private ItemSlotButton _hudButtonBack;
|
||||
private ItemSlotButton _hudButtonId;
|
||||
private Control _rightQuickButtonsContainer;
|
||||
private Control _leftQuickButtonsContainer;
|
||||
private ItemSlotButton _hudButtonPocket1 = default!;
|
||||
private ItemSlotButton _hudButtonPocket2 = default!;
|
||||
private ItemSlotButton _hudButtonBelt = default!;
|
||||
private ItemSlotButton _hudButtonBack = default!;
|
||||
private ItemSlotButton _hudButtonId = default!;
|
||||
private Control _rightQuickButtonsContainer = default!;
|
||||
private Control _leftQuickButtonsContainer = default!;
|
||||
|
||||
public HumanInventoryInterfaceController(ClientInventoryComponent owner) : base(owner)
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
{
|
||||
button.OnPressed = (e) => AddToInventory(e, slot);
|
||||
button.OnStoragePressed = (e) => OpenStorage(e, slot);
|
||||
button.OnHover = (e) => RequestItemHover(slot);
|
||||
button.OnHover = (_) => RequestItemHover(slot);
|
||||
_inventoryButtons.Add(slot, new List<ItemSlotButton> {button});
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
{
|
||||
OnPressed = (e) => AddToInventory(e, slot),
|
||||
OnStoragePressed = (e) => OpenStorage(e, slot),
|
||||
OnHover = (e) => RequestItemHover(slot)
|
||||
OnHover = (_) => RequestItemHover(slot)
|
||||
};
|
||||
_inventoryButtons[slot].Add(variable);
|
||||
}
|
||||
@@ -93,8 +93,8 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
};
|
||||
}
|
||||
|
||||
public override SS14Window Window => _window;
|
||||
private HumanInventoryWindow _window;
|
||||
public override SS14Window? Window => _window;
|
||||
private HumanInventoryWindow? _window;
|
||||
|
||||
public override IEnumerable<ItemSlotButton> GetItemSlotButtons(Slots slot)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
|
||||
protected override void HandleInventoryKeybind(GUIBoundKeyEventArgs args, Slots slot)
|
||||
{
|
||||
if (!_inventoryButtons.TryGetValue(slot, out var buttons))
|
||||
if (!_inventoryButtons.ContainsKey(slot))
|
||||
return;
|
||||
if (!Owner.TryGetSlot(slot, out var item))
|
||||
return;
|
||||
|
||||
@@ -22,10 +22,9 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
|
||||
public virtual void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract SS14Window Window { get; }
|
||||
public abstract SS14Window? Window { get; }
|
||||
protected ClientInventoryComponent Owner { get; }
|
||||
|
||||
public virtual void PlayerAttached()
|
||||
@@ -35,11 +34,11 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
Window.Open();
|
||||
Window?.Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
Window.Close();
|
||||
Window?.Close();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -47,7 +46,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
public virtual void PlayerDetached()
|
||||
{
|
||||
GameHud.InventoryButtonVisible = false;
|
||||
Window.Close();
|
||||
Window?.Close();
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
[UsedImplicitly]
|
||||
public class StrippableBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
public Dictionary<Slots, string> Inventory { get; private set; }
|
||||
public Dictionary<string, string> Hands { get; private set; }
|
||||
public Dictionary<EntityUid, string> Handcuffs { get; private set; }
|
||||
public Dictionary<Slots, string>? Inventory { get; private set; }
|
||||
public Dictionary<string, string>? Hands { get; private set; }
|
||||
public Dictionary<EntityUid, string>? Handcuffs { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
private StrippingMenu _strippingMenu;
|
||||
private StrippingMenu? _strippingMenu;
|
||||
|
||||
public StrippableBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
if (!disposing)
|
||||
return;
|
||||
|
||||
_strippingMenu.Dispose();
|
||||
_strippingMenu?.Dispose();
|
||||
}
|
||||
|
||||
private void UpdateMenu()
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components
|
||||
return new StatusControl(this);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
@@ -40,12 +40,12 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
private float _timer;
|
||||
|
||||
private static readonly StyleBoxFlat _styleBoxLit = new()
|
||||
private static readonly StyleBoxFlat StyleBoxLit = new()
|
||||
{
|
||||
BackgroundColor = Color.Green
|
||||
};
|
||||
|
||||
private static readonly StyleBoxFlat _styleBoxUnlit = new()
|
||||
private static readonly StyleBoxFlat StyleBoxUnlit = new()
|
||||
{
|
||||
BackgroundColor = Color.Black
|
||||
};
|
||||
@@ -88,22 +88,22 @@ namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
if (level == 0)
|
||||
{
|
||||
_sections[0].PanelOverride = _styleBoxUnlit;
|
||||
_sections[0].PanelOverride = StyleBoxUnlit;
|
||||
}
|
||||
else if (level == 1)
|
||||
{
|
||||
// Flash the last light.
|
||||
_sections[0].PanelOverride = _timer > TimerCycle / 2 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[0].PanelOverride = _timer > TimerCycle / 2 ? StyleBoxLit : StyleBoxUnlit;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sections[0].PanelOverride = _styleBoxLit;
|
||||
_sections[0].PanelOverride = StyleBoxLit;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
_sections[i].PanelOverride = level >= i + 2 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[i].PanelOverride = level >= i + 2 ? StyleBoxLit : StyleBoxUnlit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using static Robust.Client.GameObjects.SpriteComponent;
|
||||
|
||||
@@ -27,28 +25,28 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
[RegisterComponent]
|
||||
public class IconSmoothComponent : Component
|
||||
{
|
||||
[DataField("key")]
|
||||
private string _smoothKey = default;
|
||||
[DataField("base")]
|
||||
private string _stateBase = "";
|
||||
[DataField("mode")]
|
||||
private IconSmoothingMode _mode = IconSmoothingMode.Corners;
|
||||
|
||||
public override string Name => "IconSmooth";
|
||||
|
||||
internal ISpriteComponent Sprite { get; private set; }
|
||||
internal SnapGridComponent SnapGrid { get; private set; }
|
||||
internal ISpriteComponent? Sprite { get; private set; }
|
||||
|
||||
internal SnapGridComponent? SnapGrid { get; private set; }
|
||||
|
||||
private (GridId, Vector2i) _lastPosition;
|
||||
|
||||
/// <summary>
|
||||
/// We will smooth with other objects with the same key.
|
||||
/// </summary>
|
||||
public string SmoothKey => _smoothKey;
|
||||
[field: DataField("key")]
|
||||
public string? SmoothKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Prepended to the RSI state.
|
||||
/// </summary>
|
||||
public string StateBase => _stateBase;
|
||||
[field: DataField("base")]
|
||||
public string StateBase { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Mode that controls how the icon should be selected.
|
||||
@@ -73,12 +71,18 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
if (SnapGrid != null)
|
||||
{
|
||||
SnapGrid.OnPositionChanged += SnapGridOnPositionChanged;
|
||||
|
||||
// ensures lastposition initial value is populated on spawn. Just calling
|
||||
// the hook here would cause a dirty event to fire needlessly
|
||||
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
|
||||
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner,null, SnapGrid.Offset, Mode));
|
||||
if (Mode == IconSmoothingMode.Corners)
|
||||
}
|
||||
|
||||
if (Sprite != null && Mode == IconSmoothingMode.Corners)
|
||||
{
|
||||
var state0 = $"{StateBase}0";
|
||||
Sprite.LayerMapSet(CornerLayers.SE, Sprite.AddLayerState(state0));
|
||||
@@ -111,6 +115,11 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
|
||||
private void CalculateNewSpriteCardinal()
|
||||
{
|
||||
if (SnapGrid == null || Sprite == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var dirs = CardinalConnectDirs.None;
|
||||
|
||||
if (MatchingEntity(SnapGrid.GetInDir(Direction.North)))
|
||||
@@ -127,6 +136,11 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
|
||||
private void CalculateNewSpriteCorners()
|
||||
{
|
||||
if (Sprite == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var (cornerNE, cornerNW, cornerSW, cornerSE) = CalculateCornerFill();
|
||||
|
||||
Sprite.LayerSetState(CornerLayers.NE, $"{StateBase}{(int) cornerNE}");
|
||||
@@ -137,6 +151,11 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
|
||||
protected (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill()
|
||||
{
|
||||
if (SnapGrid == null)
|
||||
{
|
||||
return (CornerFill.None, CornerFill.None, CornerFill.None, CornerFill.None);
|
||||
}
|
||||
|
||||
var n = MatchingEntity(SnapGrid.GetInDir(Direction.North));
|
||||
var ne = MatchingEntity(SnapGrid.GetInDir(Direction.NorthEast));
|
||||
var e = MatchingEntity(SnapGrid.GetInDir(Direction.East));
|
||||
@@ -215,22 +234,28 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
if (SnapGrid != null)
|
||||
{
|
||||
SnapGrid.OnPositionChanged -= SnapGridOnPositionChanged;
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode));
|
||||
}
|
||||
}
|
||||
|
||||
private void SnapGridOnPositionChanged()
|
||||
{
|
||||
if (SnapGrid != null)
|
||||
{
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode));
|
||||
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.Contracts.Pure]
|
||||
protected bool MatchingEntity(IEnumerable<IEntity> candidates)
|
||||
{
|
||||
foreach (var entity in candidates)
|
||||
{
|
||||
if (!entity.TryGetComponent(out IconSmoothComponent other))
|
||||
if (!entity.TryGetComponent(out IconSmoothComponent? other))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace Content.Client.GameObjects.Components.Instruments
|
||||
public class InstrumentBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private InstrumentMenu _instrumentMenu;
|
||||
private InstrumentMenu? _instrumentMenu;
|
||||
|
||||
public InstrumentComponent Instrument { get; set; }
|
||||
public InstrumentComponent? Instrument { get; set; }
|
||||
|
||||
public InstrumentBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -5,8 +5,6 @@ using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -27,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Interactable
|
||||
public override string Name => "MultiTool";
|
||||
public override uint? NetID => ContentNetIDs.MULTITOOLS;
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -26,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Interactable
|
||||
[ViewVariables] public bool Activated { get; private set; }
|
||||
[ViewVariables] public override ToolQuality Qualities => _behavior;
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public override string Name => "InteractionOutline";
|
||||
|
||||
private ShaderInstance _selectionShaderInstance;
|
||||
private ShaderInstance _selectionShaderInRangeInstance;
|
||||
private ShaderInstance? _selectionShaderInstance;
|
||||
private ShaderInstance? _selectionShaderInRangeInstance;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
@@ -30,7 +30,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public void OnMouseEnter(bool inInteractionRange)
|
||||
{
|
||||
if (Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
sprite.PostShader = inInteractionRange ? _selectionShaderInRangeInstance : _selectionShaderInstance;
|
||||
sprite.RenderOrder = Owner.EntityManager.CurrentTick.Value;
|
||||
@@ -39,7 +39,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public void OnMouseLeave()
|
||||
{
|
||||
if (Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
sprite.PostShader = null;
|
||||
sprite.RenderOrder = 0;
|
||||
@@ -48,7 +48,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
public void UpdateInRange(bool inInteractionRange)
|
||||
{
|
||||
if (Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
if (Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
{
|
||||
sprite.PostShader = inInteractionRange ? _selectionShaderInRangeInstance : _selectionShaderInstance;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
|
||||
@@ -8,8 +8,6 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -27,38 +25,43 @@ namespace Content.Client.GameObjects.Components.Items
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("sprite")]
|
||||
protected ResourcePath RsiPath;
|
||||
protected ResourcePath? RsiPath;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("color")]
|
||||
protected Color Color = Color.White;
|
||||
|
||||
[DataField("HeldPrefix")]
|
||||
private string _equippedPrefix;
|
||||
private string? _equippedPrefix;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string EquippedPrefix
|
||||
public string? EquippedPrefix
|
||||
{
|
||||
get => _equippedPrefix;
|
||||
set
|
||||
{
|
||||
_equippedPrefix = value;
|
||||
if (!Owner.TryGetContainer(out IContainer container)) return;
|
||||
if(container.Owner.TryGetComponent(out HandsComponent hands))
|
||||
|
||||
if (!Owner.TryGetContainer(out var container))
|
||||
return;
|
||||
|
||||
if (container.Owner.TryGetComponent(out HandsComponent? hands))
|
||||
hands.RefreshInHands();
|
||||
}
|
||||
}
|
||||
|
||||
public (RSI rsi, RSI.StateId stateId, Color color)? GetInHandStateInfo(HandLocation hand)
|
||||
{
|
||||
if (RsiPath == null)
|
||||
var rsi = GetRSI();
|
||||
|
||||
if (rsi == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var handName = hand.ToString().ToLowerInvariant();
|
||||
var rsi = GetRSI();
|
||||
var stateId = EquippedPrefix != null ? $"{EquippedPrefix}-inhand-{handName}" : $"inhand-{handName}";
|
||||
|
||||
if (rsi.TryGetState(stateId, out _))
|
||||
{
|
||||
return (rsi, stateId, Color);
|
||||
@@ -67,18 +70,22 @@ namespace Content.Client.GameObjects.Components.Items
|
||||
return null;
|
||||
}
|
||||
|
||||
protected RSI GetRSI()
|
||||
protected RSI? GetRSI()
|
||||
{
|
||||
if (RsiPath == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _resourceCache.GetResource<RSIResource>(SharedSpriteComponent.TextureRoot / RsiPath).RSI;
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if(curState == null)
|
||||
if (curState is not ItemComponentState state)
|
||||
return;
|
||||
|
||||
var itemComponentState = (ItemComponentState)curState;
|
||||
EquippedPrefix = itemComponentState.EquippedPrefix;
|
||||
EquippedPrefix = state.EquippedPrefix;
|
||||
}
|
||||
|
||||
bool IDraggable.CanDrop(CanDropEventArgs args)
|
||||
|
||||
@@ -13,6 +13,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
@@ -22,7 +23,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
private MicrowaveMenu _menu;
|
||||
private MicrowaveMenu? _menu;
|
||||
|
||||
private readonly Dictionary<int, EntityUid> _solids = new();
|
||||
private readonly Dictionary<int, Solution.ReagentQuantity> _reagents =new();
|
||||
@@ -38,8 +39,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
_menu = new MicrowaveMenu(this);
|
||||
_menu.OpenCentered();
|
||||
_menu.OnClose += Close;
|
||||
_menu.StartButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveStartCookMessage());
|
||||
_menu.EjectButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveEjectMessage());
|
||||
_menu.StartButton.OnPressed += _ => SendMessage(new SharedMicrowaveComponent.MicrowaveStartCookMessage());
|
||||
_menu.EjectButton.OnPressed += _ => SendMessage(new SharedMicrowaveComponent.MicrowaveEjectMessage());
|
||||
_menu.IngredientsList.OnItemSelected += args =>
|
||||
{
|
||||
SendMessage(new SharedMicrowaveComponent.MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex]));
|
||||
@@ -55,20 +56,20 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
_menu.OnCookTimeSelected += (args,buttonIndex) =>
|
||||
{
|
||||
var actualButton = (MicrowaveMenu.MicrowaveCookTimeButton) args.Button ;
|
||||
var newTime = actualButton.CookTime;
|
||||
SendMessage(new SharedMicrowaveComponent.MicrowaveSelectCookTimeMessage(buttonIndex,actualButton.CookTime));
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (!disposing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_solids?.Clear();
|
||||
|
||||
_solids.Clear();
|
||||
_menu?.Dispose();
|
||||
}
|
||||
|
||||
@@ -80,25 +81,35 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
return;
|
||||
}
|
||||
_menu.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy);
|
||||
|
||||
_menu?.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy);
|
||||
RefreshContentsDisplay(cState.ReagentQuantities, cState.ContainedSolids);
|
||||
|
||||
if (_menu != null)
|
||||
{
|
||||
var currentlySelectedTimeButton = (Button) _menu.CookTimeButtonVbox.GetChild(cState.ActiveButtonIndex);
|
||||
currentlySelectedTimeButton.Pressed = true;
|
||||
var label = cState.ActiveButtonIndex <= 0 ? Loc.GetString("INSTANT") : cState.CurrentCookTime.ToString();
|
||||
_menu._cookTimeInfoLabel.Text = $"{Loc.GetString("COOK TIME")}: {label}";
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshContentsDisplay(Solution.ReagentQuantity[] reagents, EntityUid[] containedSolids)
|
||||
{
|
||||
_reagents.Clear();
|
||||
|
||||
if (_menu == null) return;
|
||||
|
||||
_menu.IngredientsListReagents.Clear();
|
||||
for (var i = 0; i < reagents.Length; i++)
|
||||
{
|
||||
_prototypeManager.TryIndex(reagents[i].ReagentId, out ReagentPrototype proto);
|
||||
if (_prototypeManager.TryIndex(reagents[i].ReagentId, out ReagentPrototype? proto))
|
||||
{
|
||||
var reagentAdded = _menu.IngredientsListReagents.AddItem($"{reagents[i].Quantity} {proto.Name}");
|
||||
var reagentIndex = _menu.IngredientsListReagents.IndexOf(reagentAdded);
|
||||
_reagents.Add(reagentIndex, reagents[i]);
|
||||
}
|
||||
}
|
||||
|
||||
_solids.Clear();
|
||||
_menu.IngredientsList.Clear();
|
||||
@@ -108,31 +119,34 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity.Deleted)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Texture texture;
|
||||
if (entity.TryGetComponent(out IconComponent iconComponent))
|
||||
Texture? texture;
|
||||
if (entity.TryGetComponent(out IconComponent? iconComponent))
|
||||
{
|
||||
texture = iconComponent.Icon?.Default;
|
||||
}else if (entity.TryGetComponent(out SpriteComponent spriteComponent))
|
||||
}
|
||||
else if (entity.TryGetComponent(out SpriteComponent? spriteComponent))
|
||||
{
|
||||
texture = spriteComponent.Icon?.Default;
|
||||
}else{continue;}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var solidItem = _menu.IngredientsList.AddItem(entity.Name, texture);
|
||||
var solidIndex = _menu.IngredientsList.IndexOf(solidItem);
|
||||
_solids.Add(solidIndex, containedSolids[j]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class MicrowaveMenu : SS14Window
|
||||
{
|
||||
|
||||
public class MicrowaveCookTimeButton : Button
|
||||
{
|
||||
public uint CookTime;
|
||||
@@ -141,7 +155,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
private MicrowaveBoundUserInterface Owner { get; set; }
|
||||
|
||||
public event Action<BaseButton.ButtonEventArgs, int> OnCookTimeSelected;
|
||||
public event Action<ButtonEventArgs, int>? OnCookTimeSelected;
|
||||
|
||||
public Button StartButton { get; }
|
||||
public Button EjectButton { get; }
|
||||
@@ -149,19 +163,19 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
public PanelContainer TimerFacePlate { get; }
|
||||
|
||||
public ButtonGroup CookTimeButtonGroup { get; }
|
||||
|
||||
public VBoxContainer CookTimeButtonVbox { get; }
|
||||
|
||||
private VBoxContainer ButtonGridContainer { get; }
|
||||
|
||||
private PanelContainer DisableCookingPanelOverlay { get; }
|
||||
|
||||
|
||||
public ItemList IngredientsList { get; }
|
||||
|
||||
public ItemList IngredientsListReagents { get; }
|
||||
public Label _cookTimeInfoLabel { get; }
|
||||
|
||||
public MicrowaveMenu(MicrowaveBoundUserInterface owner = null)
|
||||
public MicrowaveMenu(MicrowaveBoundUserInterface owner)
|
||||
{
|
||||
SetSize = MinSize = (512, 256);
|
||||
|
||||
@@ -246,7 +260,6 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
Align = BoxContainer.AlignMode.Center,
|
||||
};
|
||||
|
||||
|
||||
var index = 0;
|
||||
for (var i = 0; i <= 6; i++)
|
||||
{
|
||||
@@ -270,7 +283,6 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
var cookTimeOneSecondButton = (Button) CookTimeButtonVbox.GetChild(0);
|
||||
cookTimeOneSecondButton.Pressed = true;
|
||||
|
||||
|
||||
_cookTimeInfoLabel = new Label
|
||||
{
|
||||
Text = Loc.GetString("COOK TIME: 1"),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user