public void ResetListCamera(int gridNum) { MyDragableCamera dragableCamera = m_tranDragableCamera.GetComponentsInChildren <MyDragableCamera>(true)[0]; dragableCamera.DestroyMovePagePosList(); // 删除翻页点 int temp = (gridNum - 1); if (temp < 0) { temp = 0; } int pageNum = (int)(temp / m_numPerPage) + 1; m_tranDragableCamera.GetComponent <TweenPosition>().to = m_dragCameraBeginPos; m_tranDragableCamera.localPosition = m_dragCameraBeginPos; dragableCamera.transformList = new List <Transform>(); for (int i = 0; i < pageNum; i++) { GameObject go = new GameObject(); go.name = string.Concat("CameraMovePagePos", i); Utils.MountToSomeObjWithoutPosChange(go.transform, m_listRoot); if (m_isHorizontal) { go.transform.localPosition = new Vector3(m_dragCameraBeginPos.x + m_gap * m_numPerPage * i, m_dragCameraBeginPos.y, m_dragCameraBeginPos.z); } else { go.transform.localPosition = new Vector3(m_dragCameraBeginPos.x, m_dragCameraBeginPos.y - m_gap * m_numPerPage * i, m_dragCameraBeginPos.z); } dragableCamera.transformList.Add(go.transform); dragableCamera.SetArrow(); } }
/// <summary> /// 清空页数信息 /// </summary> void EmptyActivityGridPageList() { m_dragableCameraActivityGridList.DestroyMovePagePosList(); // 删除翻页位置 m_dragableCameraActivityGridList.DestroyDOTPageList(); // 删除页点 m_iActivityGridPageNum = 0; }
public void SetGridLayout(Action callback) { if (m_listChallengeUIGrid.Count == GRIDNUM) { if (callback != null) { callback(); } EventDispatcher.TriggerEvent(DoorOfBurySystem.ON_CHALLENGE_SHOW); EventDispatcher.TriggerEvent(Events.CampaignEvent.GetCampaignLastTime, 1); EventDispatcher.TriggerEvent(Events.OccupyTowerEvent.GetOccupyTowerStatePoint); ChallengeUILogicManager.Instance.RefreshUI((int)ChallengeGridID.OgreMustDie); ChallengeUILogicManager.Instance.CollectChallengeUIGridMessage(); } else { m_gridListMyDragableCamera.DestroyMovePagePosList(); // 删除翻页位置 m_gridListMyDragableCamera.DestroyDOTPageList(); // 删除页点 for (int i = 0; i < GRIDNUM; i++) { int index = i; INSTANCE_COUNT++; MogoGlobleUIManager.Instance.ShowWaitingTip(true); AssetCacheMgr.GetUIInstance("ChallengeGrid.prefab", (prefab, guid, go) => { GameObject temp = (GameObject)go; temp.AddComponent <ChallengeUIGrid>(); temp.transform.parent = m_tranChallengeGridList; temp.transform.localPosition = new Vector3(index * ITEMSPACE + OFFSET_X, 0, 0); temp.transform.localScale = new Vector3(1, 1, 1); temp.name = string.Concat("ChallengeGrid", index); temp.GetComponentsInChildren <MyDragCamera>(true)[0].RelatedCamera = m_gridListCamera; ChallengeUIGrid gridUI = temp.GetComponentInChildren <ChallengeUIGrid>(); gridUI.id = index + 1; if (index < GRIDNUM) { gridUI.SetImg(gridImgName[index]); } m_listChallengeUIGrid.Add(gridUI); m_gridListMyDragableCamera.MINX = OFFSET_X; m_gridListMyDragableCamera.MAXX = (m_listChallengeUIGrid.Count - GRID_COUNT_ONE_PAGE) * ITEMSPACE; // 创建翻页位置 if (index % GRID_COUNT_ONE_PAGE == 0) { GameObject trans = new GameObject(); trans.transform.parent = m_gridListCamera.transform; trans.transform.localPosition = new Vector3(index / GRID_COUNT_ONE_PAGE * ITEMSPACE * GRID_COUNT_ONE_PAGE, 0, 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); m_gridListMyDragableCamera.SetCurrentPage(m_gridListMyDragableCamera.GetCurrentPage()); // 创建页数点 ++m_iDotPageNum; int num = m_iDotPageNum; AssetCacheMgr.GetUIInstance("ChooseServerPage.prefab", (prefabPage, idPage, goPage) => { GameObject objPage = (GameObject)goPage; objPage.transform.parent = m_goChallengeUIPageDOTList.transform; objPage.transform.localPosition = new Vector3((num - 1) * 40, 0, 0); objPage.transform.localScale = Vector3.one; objPage.name = "ActivityGridPage" + num; m_gridListMyDragableCamera.ListPageDown.Add(objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject); m_goChallengeUIPageDOTList.transform.localPosition = new Vector3(-20 * (num - 1), m_goChallengeUIPageDOTList.transform.localPosition.y, 0); // 选择当前页 if (num - 1 == m_gridListMyDragableCamera.GetCurrentPage()) { objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(true); } else { objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(false); } m_gridListMyDragableCamera.GODOTPageList = m_goChallengeUIPageDOTList; m_gridListMyDragableCamera.SetCurrentPage(m_gridListMyDragableCamera.GetCurrentPage()); }); } INSTANCE_COUNT--; if (INSTANCE_COUNT <= 0) { MogoGlobleUIManager.Instance.ShowWaitingTip(false); } if (m_listChallengeUIGrid.Count == GRIDNUM) { if (callback != null) { callback(); } EventDispatcher.TriggerEvent(DoorOfBurySystem.ON_CHALLENGE_SHOW); ChallengeUILogicManager.Instance.InitializeData(); EventDispatcher.TriggerEvent(Events.CampaignEvent.GetCampaignLastTime, 1); EventDispatcher.TriggerEvent(Events.OccupyTowerEvent.GetOccupyTowerStatePoint); ChallengeUILogicManager.Instance.RefreshUI((int)ChallengeGridID.OgreMustDie); ChallengeUILogicManager.Instance.CollectChallengeUIGridMessage(); } }); } } }
/// <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(); } } }); } }
/// <summary> /// ���ҳ����Ϣ /// </summary> void EmptyActivityGridPageList() { m_dragableCameraActivityGridList.DestroyMovePagePosList(); // ɾ����ҳλ�� m_dragableCameraActivityGridList.DestroyDOTPageList(); // ɾ��ҳ�� m_iActivityGridPageNum = 0; }