/// <summary> /// 设置比赛记录数据 /// </summary> public void SetGridListData(List <DragonMatchRecordGridData> listRecordGridData) { for (int index = 0; index < listRecordGridData.Count; index++) { if (index < m_listGrid.Count) { DragonMatchRecordUIGrid gridUI = m_listGrid[index]; DragonMatchRecordGridData gridData = listRecordGridData[index]; gridUI.LoadResourceInsteadOfAwake(); gridUI.Index = index; gridUI.HasRevenged = gridData.hasRevenged; gridUI.CanRevenge = gridData.canRevenge; gridUI.NeedTip = gridData.needTip; gridUI.InfoString = gridData.info; } } }
/// <summary> /// 添加记录Grid /// </summary> /// <param name="num"></param> /// <param name="act"></param> void AddUIGridList(int num, Action act = null) { ClearUIGridList(); ResetGridListCameraPos(); ShowUIArrow(num); // 删除翻页位置 m_gridListMyDragableCamera.DestroyMovePagePosList(); m_gridListMyDragableCamera.FPageHeight = ITEMSPACEVERTICAL * GRID_COUNT_ONE_PAGE; if (num == 0) { if (act != null) { act(); } return; } for (int i = 0; i < num; ++i) { INSTANCE_COUNT++; MogoGlobleUIManager.Instance.ShowWaitingTip(true); int index = i; AssetCacheMgr.GetUIInstance("DragonMatchRecordUIGrid.prefab", (prefab, guid, go) => { GameObject obj = (GameObject)go; obj.transform.parent = m_tranUIGridlList; obj.transform.localPosition = new Vector3(0, ITEMSPACEVERTICAL * index, 0); obj.transform.localScale = new Vector3(1f, 1f, 1f); obj.GetComponentsInChildren <MyDragCamera>(true)[0].RelatedCamera = m_gridListCamera; DragonMatchRecordUIGrid grid = obj.AddComponent <DragonMatchRecordUIGrid>(); m_listGrid.Add(grid); m_gridListMyDragableCamera.MAXY = OFFSET_Y; if (m_listGrid.Count > GRID_COUNT_ONE_PAGE) { m_gridListMyDragableCamera.MINY = (m_listGrid.Count - GRID_COUNT_ONE_PAGE) * ITEMSPACEVERTICAL + OFFSET_Y; } else { m_gridListMyDragableCamera.MINY = m_gridListMyDragableCamera.MAXY; } INSTANCE_COUNT--; if (INSTANCE_COUNT <= 0) { MogoGlobleUIManager.Instance.ShowWaitingTip(false); } // 创建翻页位置 if (index % GRID_COUNT_ONE_PAGE == 0) { GameObject trans = new GameObject(); trans.transform.parent = m_gridListCamera.transform; trans.transform.localPosition = new Vector3(0, index / GRID_COUNT_ONE_PAGE * ITEMSPACEVERTICAL * GRID_COUNT_ONE_PAGE + OFFSET_Y, 0); trans.transform.localEulerAngles = Vector3.zero; trans.transform.localScale = new Vector3(1, 1, 1); trans.name = "GridListPosHorizon" + index / GRID_COUNT_ONE_PAGE; m_gridListMyDragableCamera.transformList.Add(trans.transform); } if (index == num - 1) { if (act != null) { act(); } } }); } }