using System; using TMPro; using UnityEngine; using UnityEngine.UI; namespace HotUpdate.UI { /// /// 营地主界面:绑定 JSON Prefab 入口、网络状态和断线重连。 /// public sealed class MainHudView : MonoBehaviour { public const string PrefabName = "UI_MainHUD"; TextMeshProUGUI _status; TextMeshProUGUI _pid; GameObject _reconnectPanel; TextMeshProUGUI _reconnectText; Button _reconnectBtn; HomeCampPresenter _campPresenter; public event Action OnReconnectClicked; public event Action OnHomeActionClicked; public void TriggerHomeAction(string key) { OnHomeActionClicked?.Invoke(key); } public void Bind() { var campWorld = transform.Find("CampWorld"); if (campWorld != null) { _campPresenter = campWorld.GetComponent(); if (_campPresenter == null) _campPresenter = campWorld.gameObject.AddComponent(); _campPresenter.SetOwner(this); } _status = FindTmp("Txt_Status"); _pid = FindTmp("Txt_Pid"); var panel = transform.Find("Panel_Reconnect"); _reconnectPanel = panel != null ? panel.gameObject : null; _reconnectText = FindTmp("Txt_Reconnect"); var btnTf = transform.Find("Panel_Reconnect/Btn_Reconnect"); _reconnectBtn = btnTf != null ? btnTf.GetComponent