/// <summary> /// grid的点击事件 /// </summary> /// <param name="eventType"></param> /// <param name="data"></param> /// <param name="param"></param> private void OnGridUIEvent(UIEventType eventType, object data, object param) { if (eventType == UIEventType.Click) { if (data is UITeamMainTargetGrid) { UITeamMainTargetGrid grid = data as UITeamMainTargetGrid; if (grid == null) { return; } SetSelectMainGrid(grid.MainId); } else if (data is UITeamIndexTargetGrid) { UITeamIndexTargetGrid grid = data as UITeamIndexTargetGrid; if (grid == null) { return; } SetSelectIndexGrid(grid.Id); } } }
/// <summary> /// grid 跟新数据 /// </summary> /// <param name="data"></param> /// <param name="index"></param> private void OnGridDataUpdate(UIGridBase data, int index) { if (data is UITeamMainTargetGrid) { if (m_lstMainTargetId != null && index < m_lstMainTargetId.Count) { UITeamMainTargetGrid grid = data as UITeamMainTargetGrid; if (grid == null) { return; } uint mainId = m_lstMainTargetId[index]; grid.SetGridData(mainId); List <uint> activityIdList = m_dicActivity[mainId]; if (mainId == TeamDataManager.wuId) { grid.SetName("全部目标"); } else { TeamActivityDatabase db = GameTableManager.Instance.GetTableItem <TeamActivityDatabase>(activityIdList.Count > 0 ? activityIdList[0] : 0); if (db != null) { grid.SetName(db.mainName); } } } } else if (data is UITeamIndexTargetGrid) { if (m_lstIndexTargetId != null && index < m_lstIndexTargetId.Count) { UITeamIndexTargetGrid grid = data as UITeamIndexTargetGrid; if (grid == null) { return; } grid.SetGridData(m_lstIndexTargetId[index]); if (m_lstIndexTargetId[index] == TeamDataManager.wuId) { grid.SetName("全部目标"); } else { TeamActivityDatabase db = GameTableManager.Instance.GetTableItem <TeamActivityDatabase>(m_lstIndexTargetId[index]); if (db != null) { grid.SetName(db.indexName); } } } } }
/// <summary> /// 选中右侧grid /// </summary> /// <param name="targetId"></param> void SetSelectIndexGrid(uint targetId) { UITeamIndexTargetGrid grid = null; if (this.m_selectTargetId != 0) { grid = m_TeamIndexTargetCreator.GetGrid <UITeamIndexTargetGrid>(m_lstIndexTargetId.IndexOf(this.m_selectTargetId)); if (grid != null) { grid.SetSelect(false); } } grid = m_TeamIndexTargetCreator.GetGrid <UITeamIndexTargetGrid>(m_lstIndexTargetId.IndexOf(targetId)); if (grid != null) { grid.SetSelect(true); } this.m_selectTargetId = targetId; }