@@ -162,8 +162,7 @@ public sealed class ChatUIController : UIController
|
||||
_sawmill = Logger.GetSawmill("chat");
|
||||
_sawmill.Level = LogLevel.Info;
|
||||
_admin.AdminStatusUpdated += UpdateChannelPermissions;
|
||||
_player.LocalPlayerAttached += OnAttachedChanged;
|
||||
_player.LocalPlayerDetached += OnAttachedChanged;
|
||||
_player.LocalPlayerChanged += OnLocalPlayerChanged;
|
||||
_state.OnStateChanged += StateChanged;
|
||||
_net.RegisterNetMessage<MsgChatMessage>(OnChatMessage);
|
||||
_net.RegisterNetMessage<MsgDeleteChatMessagesBy>(OnDeleteChatMessagesBy);
|
||||
@@ -171,7 +170,7 @@ public sealed class ChatUIController : UIController
|
||||
|
||||
_speechBubbleRoot = new LayoutContainer();
|
||||
|
||||
UpdateChannelPermissions();
|
||||
OnLocalPlayerChanged(new LocalPlayerChangedEventArgs(null, _player.LocalPlayer));
|
||||
|
||||
_input.SetInputCommand(ContentKeyFunctions.FocusChat,
|
||||
InputCmdHandler.FromDelegate(_ => FocusChat()));
|
||||
@@ -364,7 +363,29 @@ public sealed class ChatUIController : UIController
|
||||
_speechBubbleRoot.SetPositionLast();
|
||||
}
|
||||
|
||||
private void OnAttachedChanged(EntityUid uid)
|
||||
private void OnLocalPlayerChanged(LocalPlayerChangedEventArgs obj)
|
||||
{
|
||||
if (obj.OldPlayer != null)
|
||||
{
|
||||
obj.OldPlayer.EntityAttached -= OnLocalPlayerEntityAttached;
|
||||
obj.OldPlayer.EntityDetached -= OnLocalPlayerEntityDetached;
|
||||
}
|
||||
|
||||
if (obj.NewPlayer != null)
|
||||
{
|
||||
obj.NewPlayer.EntityAttached += OnLocalPlayerEntityAttached;
|
||||
obj.NewPlayer.EntityDetached += OnLocalPlayerEntityDetached;
|
||||
}
|
||||
|
||||
UpdateChannelPermissions();
|
||||
}
|
||||
|
||||
private void OnLocalPlayerEntityAttached(EntityAttachedEventArgs obj)
|
||||
{
|
||||
UpdateChannelPermissions();
|
||||
}
|
||||
|
||||
private void OnLocalPlayerEntityDetached(EntityDetachedEventArgs obj)
|
||||
{
|
||||
UpdateChannelPermissions();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user