/// <summary> /// 点击事件 /// </summary> /// <param name="eventType"></param> /// <param name="data"></param> /// <param name="param"></param> private void OnMyTeamGridEventDlg(UIEventType eventType, object data, object param) { if (eventType == UIEventType.Click) { UIMyTeamGrid grid = data as UIMyTeamGrid; if (grid == null) { return; } uint btnIndex = (uint)param; //队员操作界面 if (btnIndex == 1) { Vector3 position = grid.transform.position; MyTeamGridData myTeamGridData = new MyTeamGridData { teamMemberInfo = grid.teamMemberInfo, pos = position }; DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.TeamMemberBtnPanel, data: myTeamGridData); } //打开添加队员界面 if (btnIndex == 2) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.TeamInvitePanel);//打开添加队员界面 } } }
/// <summary> /// 设置当前匹配状态 /// </summary> void SetMatchState() { if (TDManager.IsTeamMatch == true) { m_btn_btn_match.gameObject.SetActive(false); m_btn_btn_cancelMatch.gameObject.SetActive(true); } else if (TDManager.IsTeamMatch == false) { m_btn_btn_match.gameObject.SetActive(true); m_btn_btn_cancelMatch.gameObject.SetActive(false); } for (int i = 0; i < myTeamGoCount; i++) { UIMyTeamGrid grid = myTeamGrids[i].GetComponent <UIMyTeamGrid>(); if (grid == null) { continue; } grid.SetMatchState(TDManager.IsTeamMatch); } }
/// <summary> /// 我的队伍列表 /// </summary> void UpdateMyTeamList() { if (m_widget_myteamPanel.gameObject.activeSelf == false) { return; } List <TeamMemberInfo> list = TDManager.TeamMemberList; for (int i = 0; i < myTeamGoCount; i++) { myTeamGrids[i].transform.localPosition = Vector3.zero; myTeamGrids[i].transform.localScale = Vector3.one; myTeamGrids[i].transform.localRotation = Quaternion.identity; myTeamGrids[i].SetActive(true); myTeamGrids[i].name = i.ToString(); UIMyTeamGrid grid = myTeamGrids[i].GetComponent <UIMyTeamGrid>(); if (grid == null) { grid = myTeamGrids[i].AddComponent <UIMyTeamGrid>(); } //队员数据 if (list.Count > i) { grid.ShowMember(true); grid.SetGridData(list[i]);//有数据 grid.SetName(list[i].name); grid.SetLv(list[i].lv); grid.SetJob(list[i].job); grid.SetLeaderMark(list[i].id); grid.SetIcon(list[i].job); } //没数据 else { grid.ShowMember(false); grid.SetGridData(null); } //色沪指匹配状态 grid.SetMatchState(TDManager.IsTeamMatch); grid.RegisterUIEventDelegate(OnMyTeamGridEventDlg); } m_grid_grid.Reposition(); }