WarUI war; //战争UI #endregion #region MonoBehaviour CallBacks //回调函数区域 // Use this for initialization void Start() { selectedId = int.Parse(this.gameObject.name); /*agent = this.GetComponent<NavMeshAgent>();//获取寻路组件,如果为空则添加之 !!用iTween代替寻路 * if (agent == null) * { * agent=gameObject.AddComponent<NavMeshAgent>(); * agent.radius = 0.3f; * } * agent.enabled = true;*/ //创建棋子UI if (this.ChessmamUiPrefab != null) { GameObject _uiGo = Instantiate(this.ChessmamUiPrefab, Vector3.zero, Quaternion.identity, transform) as GameObject; _uiGo.transform.localPosition = new Vector3(0, 1f, 0); } else { Debug.LogWarning("<Color=Red><b>Missing</b></Color> PlayerUiPrefab reference on player Prefab.", this); } //创建战斗UI if (this.warUiPrefab != null) { GameObject _uiGo = Instantiate(this.warUiPrefab, Vector3.zero, Quaternion.identity, transform) as GameObject; _uiGo.transform.localPosition = new Vector3(0, 2.5f, 0); war = _uiGo.GetComponent <WarUI> (); } else { Debug.LogWarning("<Color=Red><b>Missing</b></Color> PlayerUiPrefab reference on player Prefab.", this); } }
private async CTask ShowWarUI(ProcedureOwner procedureOwner) { warUi = Mgr.UI.Show <WarUI>(); warUi.procedure = this; await warUi.Await(); LoadingUI.Hide(); }
WarUI war; //战争UI #endregion #region MonoBehaviour CallBacks //回调函数区域 // Use this for initialization void Start() { selectedId = int.Parse(this.gameObject.name); agent = this.GetComponent <NavMeshAgent>(); //获取寻路组件,如果为空则添加之 if (agent == null) { agent = gameObject.AddComponent <NavMeshAgent>(); agent.radius = 0.3f; } agent.enabled = true; //创建棋子UI if (this.ChessmamUiPrefab != null) { GameObject _uiGo = Instantiate(this.ChessmamUiPrefab, Vector3.zero, Quaternion.identity, transform) as GameObject; _uiGo.transform.localPosition = new Vector3(0, 1f, 0); //_uiGo.transform.SetParent (transform,false); _uiGo.SendMessage("SetTarget", this, SendMessageOptions.RequireReceiver); } else { Debug.LogWarning("<Color=Red><b>Missing</b></Color> PlayerUiPrefab reference on player Prefab.", this); } //创建战斗UI if (this.warUiPrefab != null) { GameObject _uiGo = Instantiate(this.warUiPrefab, Vector3.zero, Quaternion.identity, transform) as GameObject; _uiGo.transform.localPosition = new Vector3(0, 2f, 0); //_uiGo.transform.SetParent (transform,false); _uiGo.SendMessage("SetTarget", this, SendMessageOptions.RequireReceiver); war = _uiGo.GetComponent <WarUI> (); } else { Debug.LogWarning("<Color=Red><b>Missing</b></Color> PlayerUiPrefab reference on player Prefab.", this); } }