Added map and fixed other bugs

This commit is contained in:
2026-07-03 14:36:04 +03:00
parent 94739757be
commit 3d423974eb
161 changed files with 35735 additions and 315 deletions
@@ -0,0 +1,50 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
/// <summary>
/// Показывает join-код текущей сессии в игровой сцене и позволяет скопировать
/// его в буфер обмена. Код берётся из SessionInfo (переживает загрузку сцены).
/// Если кода нет (например, запуск через Play Mode без сессии) — прячет себя.
/// </summary>
public class SessionCodeView : MonoBehaviour
{
[SerializeField] private TMP_Text codeText;
[SerializeField] private Button copyButton;
[SerializeField] private GameObject root; // что скрывать, если кода нет (по умолчанию — этот объект)
private void Awake()
{
if (root == null) root = gameObject;
if (copyButton != null)
copyButton.onClick.AddListener(CopyCode);
}
private void OnEnable()
{
Refresh();
}
private void OnDestroy()
{
if (copyButton != null)
copyButton.onClick.RemoveListener(CopyCode);
}
private void Refresh()
{
bool _hasCode = !string.IsNullOrEmpty(SessionInfo.JoinCode);
root.SetActive(_hasCode);
if (_hasCode && codeText != null)
codeText.text = SessionInfo.JoinCode;
}
private void CopyCode()
{
if (string.IsNullOrEmpty(SessionInfo.JoinCode)) return;
GUIUtility.systemCopyBuffer = SessionInfo.JoinCode;
}
}