/// <summary> /// 打开管卡地图 /// </summary> private void OpenGameLevelMapView() { m_GameLevelMapView = UIViewUtil.Instance.OpenWindow(UIViewType.GameLevelMap).GetComponent <UIGameLevelMapView>(); m_GameLevelMapView.OnClickGameLevelItem = OnClickGameLevelMapViewViewDetailsItem; DataTransfer data = new DataTransfer(); ChapterEntity entity = ChapterDBModel.Instance.Get(1); data.SetData(ConstDefine.ChapterId, entity.Id); data.SetData(ConstDefine.ChapterName, entity.ChapterName); data.SetData(ConstDefine.ChapterBG, entity.BG_Pic); List <GameLevelEntity> entityList = GameLevelDBModel.Instance.GetNeedEntityById(entity.Id); if (entityList != null || entityList.Count > 0) { List <DataTransfer> dataArr = new List <DataTransfer>(); for (int i = 0; i < entityList.Count; i++) { DataTransfer dataChild = new DataTransfer(); dataArr.Add(dataChild); dataArr[i].SetData(ConstDefine.GameLevelId, entityList[i].Id); dataArr[i].SetData(ConstDefine.GameLevelIsBoss, entityList[i].isBoss); dataArr[i].SetData(ConstDefine.GameLevelName, entityList[i].Name); dataArr[i].SetData(ConstDefine.GameLevelPosInMap, entityList[i].GetPosInMap()); dataArr[i].SetData(ConstDefine.GameLevelIcon, entityList[i].Ico); } data.SetData(ConstDefine.GameLevelArr, dataArr); } m_GameLevelMapView.SetUI(data); }
public void OpenGameLevelMapView(Transform windowUiPanelContainerTrans) { //读取本地配置表 //默认读取第一章 ChapterEntity chapterEntity = ChapterDBModel.GetInstance.GetEntityById(1); TransferData data = null; if (chapterEntity != null) { data = new TransferData(); { data.SetValue <string>("ChapterName", chapterEntity.ChapterName); data.SetValue <int>("ChapterId", chapterEntity.Id); data.SetValue <string>("ChapterMapBg", chapterEntity.BG_Pic); } } //读取关卡 List <GameLevelEntity> gameLevelEntities = GameLevelDBModel.GetInstance.GetListByChapterId(chapterEntity.Id); if (gameLevelEntities != null || gameLevelEntities.Count > 0) { data.SetValue <List <GameLevelEntity> >("GameLevelList", gameLevelEntities); } m_uIGameLevelMapView = WindowUIMgr.Instance.OpenWindow(WindowUIType.GameLevelMap).GetComponent <UIGameLevelMapView>(); m_uIGameLevelMapView.transform.SetParent(windowUiPanelContainerTrans); m_uIGameLevelMapView.transform.localScale = Vector3.one * 0.8f; m_uIGameLevelMapView.transform.localPosition = Vector3.zero; m_uIGameLevelMapView.transform.localRotation = Quaternion.identity; m_uIGameLevelMapView.SetUI(data, OnClickGameLevelCallback, windowUiPanelContainerTrans); }