public void FillNewInstanceUIChooseGridData() { if (SHOW_MISSION_BY_DRAG == false) { return; } m_maplistMapWithMissionGrid.Clear(); int num = MAX_MAP_NUM; for (int i = 0; i < num; ++i) { int index = i; AssetCacheMgr.GetUIInstance("InstanceMapWithMissionGrid.prefab", (prefab, guid, gameObject) => { GameObject go = (GameObject)gameObject; go.transform.parent = m_goInstanceMissionChooseUIMapListGrid.transform; go.transform.localPosition = new Vector3(index * 1280, 0, 0); go.transform.localScale = Vector3.one; go.name = string.Concat("InstanceMapWithMissionGrid", index); InstanceMapWithMissionGrid mapGrid = go.AddComponent <InstanceMapWithMissionGrid>(); mapGrid.gameObject.SetActive(true); mapGrid.ResetNewInstanceUIChooseLevelGridPos(index + 1); mapGrid.FillNewInstanceUIChooseLevelGridData(10, index); m_maplistMapWithMissionGrid[index] = mapGrid; MyDragCamera camera = go.AddComponent <MyDragCamera>(); camera.RelatedCamera = m_dragCamera; // 创建翻页位置 GameObject trans = new GameObject(); trans.transform.parent = m_dragCamera.transform; trans.transform.localPosition = new Vector3(index * 1.0f * 1280, 0, 0); trans.transform.localEulerAngles = Vector3.zero; trans.transform.localScale = new Vector3(1, 1, 1); trans.name = "InstanceMapWithMissionGridPos" + index; m_maplistInstanceMapWithMissionGridPos[index] = trans.transform; if (index == num - 1) { MogoUIManager.Instance.ShowInstanceMissionChooseUI(false); m_goGOInstanceMissionChooseUI.SetActive(true); } }); } m_dragableCameraMapList.MAXX = num * 1.0f * 1280 + 1280; m_dragableCameraMapList.MovePageDone += MovePageDone; }
public void AddRewardGrid(RankRewardGridData rd) { AssetCacheMgr.GetUIInstance("WeekRankDialogRewardItem.prefab", (prefab, id, go) => { GameObject obj = (GameObject)go; obj.transform.FindChild("WeekRankDialogRewardItemFG").GetComponentsInChildren <UISprite>(true)[0].spriteName = rd.imgName; obj.transform.FindChild("WeekRankDialogRewardItemText").GetComponentsInChildren <UILabel>(true)[0].text = rd.text; obj.transform.parent = m_transRewardGridList; obj.transform.localPosition = new Vector3(m_listRewardGrid.Count * 215, 0, 0); obj.transform.localScale = new Vector3(1, 1, 1); RewardGrid rg = obj.AddComponent <RewardGrid>(); rg.Id = m_listRewardGrid.Count; m_listRewardGrid.Add(obj); MyDragCamera mdc = obj.AddComponent <MyDragCamera>(); mdc.RelatedCamera = m_camRewardGrid; m_camRewardGrid.GetComponentsInChildren <MyDragableCamera>(true)[0].MAXX = 430 + 215 * (m_listRewardGrid.Count - 5); }); }
private void LoadUpgradePowerGridList(int num, Action act = null) { if (IsLoadUpgradePowerGridList) { return; } IsLoadUpgradePowerGridList = true; for (int i = 0; i < num; ++i) { INSTANCE_COUNT++; MogoGlobleUIManager.Instance.ShowWaitingTip(true); int index = i; AssetCacheMgr.GetUIInstance("UpgradePowerUISystemGrid.prefab", (prefab, guid, go) => { GameObject obj = (GameObject)go; obj.transform.parent = m_tranUpgradePowerUISystemList; if (index % GRID_COUNT_ONE_LINE == 0) { obj.transform.localPosition = new Vector3(0, GRIDSPACEVERTICAL * (index / GRID_COUNT_ONE_LINE) + OffsetX, 0); } else { obj.transform.localPosition = new Vector3(GRIDSPACEHORIZON, GRIDSPACEVERTICAL * (index / GRID_COUNT_ONE_LINE) + OffsetX, 0); } obj.transform.localScale = new Vector3(1f, 1f, 1f); UpgradePowerUISystemGrid grid = obj.AddComponent <UpgradePowerUISystemGrid>(); m_listUpgradePowerGridGO.Add(grid); INSTANCE_COUNT--; if (INSTANCE_COUNT <= 0) { MogoGlobleUIManager.Instance.ShowWaitingTip(false); } // 数量大于一页时,创建拖动效果 if (num > GRID_COUNT_ONE_PAGE) { MyDragCamera myDragCamera = obj.AddComponent <MyDragCamera>(); myDragCamera.RelatedCamera = m_camUpgradePowerUISystemListCamera; m_camUpgradePowerUISystemListCamera.GetComponentsInChildren <MyDragableCamera>(true)[0].MAXX = OffsetX + (m_listUpgradePowerGridGO.Count - GRID_COUNT_ONE_PAGE) / GRID_COUNT_ONE_LINE * GRIDSPACEVERTICAL; // 创建翻页位置 if (index % GRID_COUNT_ONE_PAGE == 0) { GameObject trans = new GameObject(); trans.transform.parent = m_camUpgradePowerUISystemListCamera.transform; trans.transform.localPosition = new Vector3(index / GRID_COUNT_ONE_LINE * GRIDSPACEVERTICAL, 0, 0); trans.transform.localEulerAngles = Vector3.zero; trans.transform.localScale = new Vector3(1, 1, 1); trans.name = "DragListPosHorizon" + index / GRID_COUNT_ONE_PAGE; m_camUpgradePowerUISystemListCamera.GetComponentsInChildren <MyDragableCamera>(true)[0].transformList.Add(trans.transform); } } if (index == num - 1) { if (act != null) { act(); } } }); } }