/// <summary> /// 更新二级页签数据 /// </summary> /// <param name="gridBase"></param> /// <param name="id"></param> /// <param name="index"></param> private void OnUpdateMissionSecondGrid(UIGridBase gridBase, object id, int index) { UISecondTypeGrid grid = gridBase as UISecondTypeGrid; if (grid == null) { return; } MissionEnum missionType = (MissionEnum)id; List <QuestTraceInfo> taskList = GetQuestListByType(missionType); if (taskList == null) { return; } if (taskList.Count > index) { string name = QuestTraceInfo.GetTableTaskByID(taskList[index].taskId).strName; grid.SetData(taskList[index].taskId, name, false); grid.SetRedPoint(false); } }
/// <summary> /// 3 /// </summary> private void UpdateGrids() { return; m_dicfTypes.Clear(); m_dicsType.Clear(); m__missonRoot.gameObject.SetActive(false); //1级分类 UITypeGrid tGridTemp = null; //2级别分类 UISecondTypeGrid sGridTemp = null; List <QuestTraceInfo> taskList = null; for (int i = (int)MissionEnum.None + 1; i < (int)MissionEnum.Max; i++) { MissionEnum missionType = (MissionEnum)i; uint index = (uint)i; taskList = GetQuestListByType(missionType); if (taskList.Count <= 0) { continue; } tGridTemp = GetFirstTypeGrid(); if (null == tGridTemp) { break; } tGridTemp.gameObject.SetActive(true); tGridTemp.gameObject.name = missionType.ToString(); tGridTemp.transform.parent = m__missonRoot.transform; tGridTemp.transform.localPosition = new Vector3(0, -100, 0); tGridTemp.transform.localScale = Vector3.one; tGridTemp.transform.localRotation = Quaternion.identity; tGridTemp.SetGridData(index); tGridTemp.EnableRedPoint(false); tGridTemp.SetName(missionType.GetEnumDescription()); tGridTemp.EnableArrow(true); tGridTemp.SetHightLight(false); tGridTemp.RegisterUIEventDelegate(OnGridEventDlg); m_dicfTypes.Add(index, tGridTemp); for (int n = 0; n < taskList.Count; n++) { sGridTemp = GetSecondTypeGrid(); if (sGridTemp == null) { continue; } sGridTemp.gameObject.SetActive(true); sGridTemp.SetRedPoint(false); sGridTemp.gameObject.name = taskList[n].taskId.ToString(); uint sIndex = taskList[n].taskId; sGridTemp.SetData(sIndex, QuestTraceInfo.GetTableTaskByID(taskList[n].taskId).strName, false); sGridTemp.RegisterUIEventDelegate(OnGridEventDlg); //添加到上级页签 tGridTemp.Add(sGridTemp.CacheTransform); if (!m_dicsType.ContainsKey(sIndex)) { m_dicsType.Add(sIndex, sGridTemp); } } tGridTemp.UpdatePostion(); } m__missonRoot.Reposition(); m__missonRoot.transform.parent.GetComponent <UIScrollView>().ResetPosition(); }