private void AddMapDOTPageList() { m_dragableCameraMapList.DestroyDOTPageList(); m_iMapPageNum = 0; if (MapOpenPage <= 1) { return; } for (int i = 0; i < MapOpenPage; i++) { // 创建页数点 ++m_iMapPageNum; int num = m_iMapPageNum; AssetCacheMgr.GetUIInstance("ChooseServerPage.prefab", (prefabPage, idPage, goPage) => { GameObject objPage = (GameObject)goPage; objPage.transform.parent = m_tranInstanceMissionChooseUIPageDOT; objPage.transform.localPosition = new Vector3((num - 1) * 40, 0, 0); objPage.transform.localScale = Vector3.one; objPage.name = "MapPageNum" + num; m_dragableCameraMapList.ListPageDown.Add(objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject); m_tranInstanceMissionChooseUIPageDOT.localPosition = new Vector3(-20 * (num - 1), m_tranInstanceMissionChooseUIPageDOT.localPosition.y, 0); // 选择当前页 if (num - 1 == m_dragableCameraMapList.GetCurrentPage()) { objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(true); } else { objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(false); } m_dragableCameraMapList.GODOTPageList = m_tranInstanceMissionChooseUIPageDOT.gameObject; m_dragableCameraMapList.SetCurrentPage(m_dragableCameraMapList.GetCurrentPage()); }); } }
/// <summary> /// 创建Grid /// </summary> /// <param name="gridData"></param> /// <param name="theID"></param> public void AddActivityGrid(LimitActivityGridData gridData, int theID) { INSTANCE_COUNT++; MogoGlobleUIManager.Instance.ShowWaitingTip(true); AssetCacheMgr.GetUIInstance("TimeLimitActivityGrid.prefab", (prefab, id, go) => { for (int i = 0; i < m_listActivityGird.Count; ++i) { if (m_listActivityGird[i].Id == theID) { AssetCacheMgr.ReleaseInstance((GameObject)go); return; } } GameObject obj = (GameObject)go; TimeLimitActivityGrid gridUI = obj.AddComponent <TimeLimitActivityGrid>(); obj.name = "TimeLimitActivityGrid" + m_listActivityGird.Count; gridUI.LoadResourceInsteadOfAwake(); gridUI.Id = theID; gridUI.Index = m_listActivityGird.Count; gridUI.CDText = gridData.CDText; gridUI.TitleText = gridData.TitleText; gridUI.GridFGName = gridData.FGImgName; gridUI.SetActivityStatus(gridData.Status); obj.transform.parent = m_goActivityGridList.transform; obj.transform.localPosition = new Vector3(m_listActivityGirdObject.Count * ACTIVITYGRIDWIDTH, 0, -1); obj.transform.localScale = new Vector3(1, 1, 1); m_listActivityGirdObject.Add(obj); m_listActivityGird.Add(gridUI); obj.GetComponentsInChildren <MyDragCamera>(true)[0].RelatedCamera = m_camActivityGridList.transform.GetComponentsInChildren <Camera>(true)[0]; INSTANCE_COUNT--; if (INSTANCE_COUNT <= 0) { MogoGlobleUIManager.Instance.ShowWaitingTip(false); } if (m_listActivityGirdObject.Count - ActivityGridCountOnePage >= 0) { m_dragableCameraActivityGridList.MAXX = 380 + ACTIVITYGRIDWIDTH * (m_listActivityGirdObject.Count - 3); } else { m_dragableCameraActivityGridList.MAXX = 380; } EventDispatcher.TriggerEvent <int>("LoadTimeLimitActivityGridDone", gridUI.Id); if (obj.name == MogoUIManager.Instance.WaitingWidgetName) { EventDispatcher.TriggerEvent("WaitingWidgetFinished"); } // 创建翻页位置 int index = m_listActivityGirdObject.Count - 1; if (index % ActivityGridCountOnePage == 0) { GameObject trans = new GameObject(); trans.transform.parent = m_camActivityGridList.transform; trans.transform.localPosition = new Vector3(index / ActivityGridCountOnePage * 1140 + 380, 0, 0); trans.transform.localEulerAngles = Vector3.zero; trans.transform.localScale = new Vector3(1, 1, 1); trans.name = "ActivityGridPagePosHorizon" + index / ActivityGridCountOnePage; m_dragableCameraActivityGridList.transformList.Add(trans.transform); m_dragableCameraActivityGridList.SetCurrentPage(0); // 创建页数点 ++m_iActivityGridPageNum; int num = m_iActivityGridPageNum; AssetCacheMgr.GetUIInstance("ChooseServerPage.prefab", (prefabPage, idPage, goPage) => { GameObject objPage = (GameObject)goPage; objPage.transform.parent = m_goGOTimeLimitActivityUIActivityListPage.transform; objPage.transform.localPosition = new Vector3((num - 1) * 40, 0, 0); objPage.transform.localScale = Vector3.one; objPage.name = "ActivityGridPage" + num; m_camActivityGridList.GetComponentsInChildren <MyDragableCamera>(true)[0].ListPageDown.Add(objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject); m_goGOTimeLimitActivityUIActivityListPage.transform.localPosition = new Vector3(-20 * (num - 1), m_goGOTimeLimitActivityUIActivityListPage.transform.localPosition.y, 0); // 选择当前页 if (num - 1 == m_dragableCameraActivityGridList.GetCurrentPage()) { objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(true); } else { objPage.GetComponentsInChildren <UISprite>(true)[1].gameObject.SetActive(false); } m_dragableCameraActivityGridList.GODOTPageList = m_goGOTimeLimitActivityUIActivityListPage; m_dragableCameraActivityGridList.SetCurrentPage(m_dragableCameraActivityGridList.GetCurrentPage()); }); } }); }
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> /// 添加Boss宝箱奖励 /// </summary> /// <param name="num"></param> /// <param name="act"></param> void AddBossTreasureGridList(int num, Action act = null) { ClearBossTreasureGridList(); ResetGridListCameraPos(); // 删除翻页位置 if (m_gridListMyDragableCamera.transformList != null) { for (int i = 0; i < m_gridListMyDragableCamera.transformList.Count; ++i) { Destroy(m_gridListMyDragableCamera.transformList[i].gameObject); } m_gridListMyDragableCamera.transformList.Clear(); } for (int i = 0; i < num; ++i) { int index = i; INSTANCE_COUNT++; MogoGlobleUIManager.Instance.ShowWaitingTip(true); AssetCacheMgr.GetUIInstance("InstanceBossTreasureUIGrid.prefab", (prefab, guid, go) => { GameObject obj = (GameObject)go; obj.transform.parent = m_tranInstanceBossTreasureUIGridlList; obj.transform.localPosition = new Vector3(ITEMSPACEHORIZON * index, 0, 0); obj.transform.localScale = new Vector3(0.8f, 0.8f, 1); obj.GetComponentsInChildren <MyDragCamera>(true)[0].RelatedCamera = m_gridListCamera; InstanceBossTreasureUIGrid gridUI = obj.AddComponent <InstanceBossTreasureUIGrid>(); m_mapBossTreasure[index] = gridUI; if (m_mapBossTreasure.Count >= BOSSTREASURE_COUNT_ONE_PAGE) { m_gridListMyDragableCamera.MAXX = (m_mapBossTreasure.Count - BOSSTREASURE_COUNT_ONE_PAGE) * ITEMSPACEHORIZON; } // 创建翻页位置 if (index % BOSSTREASURE_COUNT_ONE_PAGE == 0) { GameObject trans = new GameObject(); trans.transform.parent = m_gridListCamera.transform; trans.transform.localPosition = new Vector3(index / BOSSTREASURE_COUNT_ONE_PAGE * ITEMSPACEHORIZON * BOSSTREASURE_COUNT_ONE_PAGE, 0, 0); trans.transform.localEulerAngles = Vector3.zero; trans.transform.localScale = new Vector3(1, 1, 1); trans.name = "GridListPosHorizon" + index / BOSSTREASURE_COUNT_ONE_PAGE; m_gridListMyDragableCamera.transformList.Add(trans.transform); m_gridListMyDragableCamera.SetCurrentPage(m_gridListMyDragableCamera.GetCurrentPage()); } INSTANCE_COUNT--; if (INSTANCE_COUNT <= 0) { MogoGlobleUIManager.Instance.ShowWaitingTip(false); } if (index == num - 1) { if (act != null) { act(); } } }); } }
public void SetCurrentPage(int page) { m_dragableCameraLoginRewardGridList.SetCurrentPage(page); ShowLoginRewardGrid(); }