Feat - Add Loading menju
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using Ashwild.Player;
|
||||
using Ashwild.Settings;
|
||||
|
||||
namespace Ashwild.UI
|
||||
@@ -28,6 +30,12 @@ namespace Ashwild.UI
|
||||
[SerializeField] private Button inviteButton;
|
||||
[SerializeField] private Button quitButton;
|
||||
|
||||
[Header("Session")]
|
||||
[Tooltip("Displays the shareable room code (host SteamID-derived) of the current session.")]
|
||||
[SerializeField] private TMP_Text roomCodeLabel;
|
||||
[Tooltip("Shown in place of the code when no online session is active.")]
|
||||
[SerializeField] private string offlinePlaceholder = "—";
|
||||
|
||||
#endregion
|
||||
|
||||
#region State
|
||||
@@ -55,5 +63,35 @@ namespace Ashwild.UI
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Panel Visibility
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the room code each time the pause menu opens, so it always reflects the
|
||||
/// session that is live at that moment rather than a value cached at spawn.
|
||||
/// </summary>
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
RefreshRoomCode();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Helpers
|
||||
|
||||
/// <summary>
|
||||
/// Writes the current shareable session code into the label, falling back to the offline
|
||||
/// placeholder when no online session is active.
|
||||
/// </summary>
|
||||
private void RefreshRoomCode()
|
||||
{
|
||||
if (roomCodeLabel == null) return;
|
||||
|
||||
string code = PlayerEvents.SessionCode;
|
||||
roomCodeLabel.text = string.IsNullOrEmpty(code) ? offlinePlaceholder : code;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user