diff --git a/SlayTheSpire2.LAN.Multiplayer/Components/CopiedLabel.cs b/SlayTheSpire2.LAN.Multiplayer/Components/CopiedLabel.cs index a172f91..107837a 100644 --- a/SlayTheSpire2.LAN.Multiplayer/Components/CopiedLabel.cs +++ b/SlayTheSpire2.LAN.Multiplayer/Components/CopiedLabel.cs @@ -32,7 +32,7 @@ namespace SlayTheSpire2.LAN.Multiplayer.Components base._Ready(); } - public void ShowWithPosition(Vector2 position) + public void ShowWithGlobalPosition(Vector2 position) { _tween?.Kill(); diff --git a/SlayTheSpire2.LAN.Multiplayer/Components/IPAddressInfoPanel.cs b/SlayTheSpire2.LAN.Multiplayer/Components/IPAddressInfoPanel.cs index a9da405..19b2140 100644 --- a/SlayTheSpire2.LAN.Multiplayer/Components/IPAddressInfoPanel.cs +++ b/SlayTheSpire2.LAN.Multiplayer/Components/IPAddressInfoPanel.cs @@ -193,7 +193,7 @@ namespace SlayTheSpire2.LAN.Multiplayer.Components !string.IsNullOrEmpty(_ipAddressLabel.Text)) { DisplayServer.ClipboardSet(_ipAddressLabel.Text); - _copiedLabel.ShowWithPosition(inputEventMouseButton.GlobalPosition); + _copiedLabel.ShowWithGlobalPosition(inputEventMouseButton.GlobalPosition); } }; @@ -210,7 +210,7 @@ namespace SlayTheSpire2.LAN.Multiplayer.Components !string.IsNullOrEmpty(_ipv6AddressLabel.Text)) { DisplayServer.ClipboardSet(_ipv6AddressLabel.Text); - _copiedLabel.ShowWithPosition(inputEventMouseButton.GlobalPosition); + _copiedLabel.ShowWithGlobalPosition(inputEventMouseButton.GlobalPosition); } }; @@ -304,6 +304,8 @@ namespace SlayTheSpire2.LAN.Multiplayer.Components ipAddressLabel.SetTextAutoSize($"{localIPAddress}:{port}"); + _localIPAddressContainer.AddChildSafely(ipAddressLabel); + ipAddressLabel.GuiInput += inputEvent => { if (inputEvent is InputEventMouseButton @@ -313,12 +315,10 @@ namespace SlayTheSpire2.LAN.Multiplayer.Components !string.IsNullOrEmpty(ipAddressLabel.Text)) { DisplayServer.ClipboardSet(ipAddressLabel.Text); - _copiedLabel?.ShowWithPosition(inputEventMouseButton.GlobalPosition); + _copiedLabel?.ShowWithGlobalPosition(inputEventMouseButton.GlobalPosition); } }; - _localIPAddressContainer.AddChildSafely(ipAddressLabel); - hasLocalIPAddress = true; } }