using System.Collections.Generic; using FishNet.Managing; using FishNet.Transporting; using Managers; using Types; using UnityEngine; using UnityEngine.EventSystems; using Utils; namespace UI { public class NetworkUIController : MonoBehaviour { [SerializeField] private GameObject hostNewButton; [SerializeField] private GameObject hostSaveButton; [SerializeField] private GameObject connectButton; [SerializeField] private SpriteRenderer serverIndicator; [SerializeField] private SpriteRenderer clientIndicator; [SerializeField] private readonly Dictionary _playerList = new(); private LocalConnectionState _clientState = LocalConnectionState.Stopped; private EventSystem _eventSystem; private NetworkManager _networkManager; private LocalConnectionState _serverState = LocalConnectionState.Stopped; public static NetworkUIController Instance { get; private set; } private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } } private void Start() { _playerList.Clear(); _networkManager = FindObjectOfType(); if (_networkManager == null) { GameLogger.LogError("NetworkManager not found, HUD will not function."); } else { // UpdateColor(LocalConnectionState.Stopped, ref serverIndicator); // UpdateColor(LocalConnectionState.Stopped, ref clientIndicator); _networkManager.ServerManager.OnServerConnectionState += OnServerConnectionState; _networkManager.ClientManager.OnClientConnectionState += OnClientConnectionState; } // host.GetComponent