save pos when closing by button (#2644)
This commit is contained in:
parent
3e4d6999d1
commit
e4a24a1bb5
4 changed files with 21 additions and 1 deletions
|
|
@ -131,6 +131,13 @@ public sealed partial class InteractionsUIWindow : DefaultWindow
|
|||
base.Close();
|
||||
}
|
||||
|
||||
public void SavePos()
|
||||
{
|
||||
_cfg.SetCVar(InteractionsCVars.WindowPosX, (int)Position.X);
|
||||
_cfg.SetCVar(InteractionsCVars.WindowPosY, (int)Position.Y);
|
||||
_cfg.SaveToFile();
|
||||
}
|
||||
|
||||
private bool IsInteractionOnCooldown(string interactionId)
|
||||
{
|
||||
var userEntity = _owner?.Owner ?? default;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ public sealed class InteractionsWindowBoundUserInterface : BoundUserInterface
|
|||
|
||||
}
|
||||
|
||||
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
|
||||
{
|
||||
if (message is RequestSavePosAndCloseMessage save)
|
||||
{
|
||||
_slave?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public partial class InteractionsPanel
|
|||
|
||||
if (_ui.IsUiOpen(player, InteractionWindowUiKey.Key))
|
||||
{
|
||||
_ui.CloseUi(player, InteractionWindowUiKey.Key);
|
||||
_ui.ServerSendUiMessage(player, InteractionWindowUiKey.Key, new RequestSavePosAndCloseMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ public sealed class InteractionMessage : BoundUserInterfaceMessage
|
|||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class RequestSavePosAndCloseMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class CustomInteractionData
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue