public static float LoadExtendGroup(int groupID) { var cellGroup = Config.groupConfig.getInstace().getCell(groupID); //加载Group //索引=额外加载的 var playerData = GlobalDataManager.GetInstance().playerData; var sortedGroupIDs = GlobalDataManager.GetInstance().logicTableGroup.GetSortedGroupIDs(playerData.playerZoo.currSceneID); float extendLen = 0; for (int i = 0; i < sortedGroupIDs.Count; i++) { if (sortedGroupIDs[i] == groupID) { break; } var cell = Config.groupConfig.getInstace().getCell(sortedGroupIDs[i]); if (cell.groundsize > 0 && cell.zoopartresID > 0) { extendLen += cell.groundsize; } } if (cellGroup.zoopartresID > 0) { if (!GlobalDataManager.GetInstance().zooGameSceneData.IsExtendGroupContains(groupID)) { var cellRes = Config.resourceConfig.getInstace().getCell(cellGroup.zoopartresID); var goPart = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath); goPart.transform.position += GlobalDataManager.GetInstance().SceneForward *extendLen; goPart.name = string.Format("ExtendPart_{0}", groupID); GlobalDataManager.GetInstance().zooGameSceneData.AddExtendLoadGroup(groupID, goPart); } extendLen += cellGroup.groundsize; } return(extendLen); //if (cellGroup.zoopartresID > 0) //{ // var cellRes = Config.resourceConfig.getInstace().getCell(cellGroup.zoopartresID); // var goPart = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath); // goPart.transform.position = new Vector3(goPart.transform.position.x - idx * offset, 0, 0); // goPart.name = string.Format("ExtendPart_{0}", groupID); // GlobalDataManager.GetInstance().zooGameSceneData.AddExtendLoadGroup(groupID, goPart); //} }
private void PlayEntrySimpleParticle(int index) { var sp = GlobalDataManager.GetInstance().zooGameSceneData.entryGateSenceData.entryCoinSpList[index]; if (!sp.isInit) { Vector3 visitPos = GlobalDataManager.GetInstance().zooGameSceneData.entryGateSenceData.entryGatesVector[index]; visitPos.y = Config.globalConfig.getInstace().TicketEffectOffsetY; //GameObject effectGo = ResourceManager.GetInstance().LoadGameObject(Config.globalConfig.getInstace().CoinEffectRes); var sceneCell = Config.sceneConfig.getInstace().getCell(playerData.playerZoo.currSceneID); var moneyCell = Config.moneyConfig.getInstace().getCell(sceneCell.moneyid); GameObject effectGo = ResourceManager.GetInstance().LoadGameObject(moneyCell.moneyeffect); effectGo.transform.position = visitPos; sp.Init(effectGo); } sp.Play(); }
/// <summary> /// 加载停车场场景 /// </summary> /// <param name="idx"></param> public static void LoadParkingScene(int idx) { GameObject parckingSencePos = GlobalDataManager.GetInstance().zooGameSceneData.ParckingSencePos; if (parckingSencePos != null) { for (int i = 0; i < parckingSencePos.transform.childCount; i++) { GameObject.Destroy(parckingSencePos.transform.GetChild(i).gameObject); } } else { string e = string.Format("报错:停车场挂点资源对象为 null"); throw new System.Exception(e); } //LogWarp.LogError(" 测试:当前停车场模型 cellBuild.openggroup[idx]=" + cellBuild.openggroup[idx]); int sceneID = GlobalDataManager.GetInstance().playerData.playerZoo.currSceneID; Config.parkingCell parkingCell = GlobalDataManager.GetInstance().logicTableParkingData.GetParkingCell(sceneID); var cellRes = Config.resourceConfig.getInstace().getCell(parkingCell.openggroup[idx]); var goLittleZoo = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath); //LogWarp.LogError(" 测试:当前停车场模型 name=" + goLittleZoo.name); goLittleZoo.transform.position = new UnityEngine.Vector3(0, 0, 0); goLittleZoo.transform.SetParent(parckingSencePos.transform, false); //添加停车场的升级特效 Transform trans = null; trans = ResourceManager.GetInstance().LoadGameObject(Config.globalConfig.getInstace().ParkingUpEffect).transform; trans.SetParent(GlobalDataManager.GetInstance().zooGameSceneData.ParckingSencePos.transform, false); UFrame.SimpleParticle particlePlayer = new UFrame.SimpleParticle(); particlePlayer.Init(GlobalDataManager.GetInstance().zooGameSceneData.ParckingSencePos); particlePlayer.Play(); }
/// <summary> /// 动物栏飘钱特效 /// </summary> protected void PlayLittleZooSimpleParticle() { #if NO_EFFECT return; #endif var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; var littleZooBuildinPos = LittleZooBuildinPosManager.GetInstance().GetLittleZooBuildinPos(entity.stayBuildingID); Dictionary <int, SimpleParticle> sps = null; var visitSeatSpDict = GlobalDataManager.GetInstance().zooGameSceneData.visitSeatSpDict; bool retCode = visitSeatSpDict.TryGetValue(entity.stayBuildingID, out sps); if (!retCode) { sps = new Dictionary <int, SimpleParticle>(); visitSeatSpDict.Add(entity.stayBuildingID, sps); } SimpleParticle sp = null; retCode = sps.TryGetValue(entity.indexInVisitQueue, out sp); if (!retCode) { sp = new SimpleParticle(); sps.Add(entity.indexInVisitQueue, sp); } if (!sp.isInit) { Vector3 visitPos = littleZooBuildinPos.visitPosList[entity.indexInVisitQueue]; visitPos.y = Config.globalConfig.getInstace().LittleZooCoinEffectOffsetY; //GameObject effectGo = ResourceManager.GetInstance().LoadGameObject(Config.globalConfig.getInstace().CoinEffectRes); var sceneCell = Config.sceneConfig.getInstace().getCell(playerData.playerZoo.currSceneID); var moneyCell = Config.moneyConfig.getInstace().getCell(sceneCell.moneyid); GameObject effectGo = ResourceManager.GetInstance().LoadGameObject(moneyCell.moneyeffect); effectGo.transform.position = visitPos; sp.Init(effectGo); } sp.Play(); }
//protected List<LittleZooModuleData> GetlittleZooModuleDatas(int sceneID) //{ // var result = new List<LittleZooModuleData>(); // var littleZooModuleDatas = this.playerData.playerZoo.littleZooModuleDatas; // for (int i = 0; i < littleZooModuleDatas.Count; i++) // { // var littleZooModuleData = littleZooModuleDatas[i]; // if (littleZooModuleData.sceneID == sceneID) // { // result.Add(littleZooModuleData); // } // } // return result; //} /// <summary> /// 加载停车场地块 /// </summary> protected void LoadParking() { GlobalDataManager.GetInstance().zooGameSceneData.ParckingSencePos = GameObject.Find("ParckingSencePos"); var allData = Config.parkingConfig.getInstace().AllData; Config.parkingCell parkingCell = GlobalDataManager.GetInstance().logicTableParkingData.GetParkingCell(sceneID); //var cellBuildUp = Config.parkingConfig.getInstace().getCell(sceneID); bool retCode = this.playerData.playerZoo.IsExistPackingModuleDatas(sceneID); if (!retCode) { this.playerData.playerZoo.SetDefaultParkingCenterData(sceneID); } var parkingSpaceLevel = this.playerData.GetParkingCenterDataIDIndexOfDataIdx(sceneID).parkingSpaceLevel; int currResIdx = ParkingCenter.FindLevelRangIndex(parkingCell.openlv, parkingSpaceLevel); var cellRes = Config.resourceConfig.getInstace().getCell(parkingCell.openggroup[currResIdx]); var parkingModel = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath); parkingModel.transform.position = new UnityEngine.Vector3(0, 0, 0); parkingModel.SetActive(true); parkingModel.transform.SetParent(GlobalDataManager.GetInstance().zooGameSceneData.ParckingSencePos.transform, false); }
/// <summary> /// 编辑器模式下分块加载 /// </summary> protected void LoadPartSceneForEditor() { LogWarp.LogFormat("LoadPartSceneForEditor"); int sceneID = LoadingMgr.Inst.editor_SceneID; //加载地块 var littleZooRoot = GameObject.Find("LittleZoo").transform; Config.resourceCell cellRes; int idx = 0; float offset = Config.globalConfig.getInstace().ZooPartResLen; float extendOffset = 0; Config.groupCell preCell = null; Config.groupCell lastCell = null; foreach (var kv in Config.groupConfig.getInstace().AllData) { if (kv.Value.scene != sceneID) { continue; } var cellGroup = kv.Value; //加载动物栏 for (int i = 0; i < cellGroup.startid.Length; i++) { //编辑器加载的都是0级的动物栏prefab LittleZooModule.LoadLittleZoo(sceneID, cellGroup.startid[i], 0, littleZooRoot); } //加载地块 if (cellGroup.zoopartresID > 0) { cellRes = Config.resourceConfig.getInstace().getCell(cellGroup.zoopartresID); var goPart = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath); //goPart.transform.position = new Vector3(goPart.transform.position.x - idx * offset, 0, 0); if (preCell != null) { extendOffset += preCell.groundsize; } //goPart.transform.position = new Vector3(goPart.transform.position.x - extendOffset, 0, 0); goPart.transform.position += GlobalDataManager.GetInstance().SceneForward *extendOffset; goPart.name = string.Format("Group_{0}", cellGroup.zoopartresID); ++idx; preCell = cellGroup; lastCell = cellGroup; if (LoadingMgr.Inst.ExtendLoadGroupNum != Const.Invalid_Int && LoadingMgr.Inst.ExtendLoadGroupNum == idx) { break; } } } if (lastCell != null) { extendOffset += lastCell.groundsize; } LittleZooModule.LoadExitGate(sceneID, idx, extendOffset); }
/// <summary> /// 加载动物栏 /// </summary> protected void LoadLittleZoo() { var loadGroup = GlobalDataManager.GetInstance().zooGameSceneData.loadGroup; GameObject camera = GameObject.Find("Camera"); GlobalDataManager.GetInstance().zooGameSceneData.camera = camera; var littleZooRoot = GameObject.Find("LittleZoo").transform; GlobalDataManager.GetInstance().zooGameSceneData.littleZooParentNode = littleZooRoot; int littleZooID = Const.Invalid_Int; int groupID = Const.Invalid_Int; bool retCode = this.playerData.playerZoo.IsExistlittleZooModuleDatas(sceneID); if (!retCode) { this.playerData.playerZoo.SetDefaultlittleZooData(sceneID); } //var littleZooModuleDatas = this.GetlittleZooModuleDatas(sceneID); var littleZooModuleDatas = this.playerData.playerZoo.littleZooModuleDatasMSS; //for (int i = 0; i < this.playerData.playerZoo.littleZooModuleDatas.Count; i++) for (int i = 0; i < littleZooModuleDatas.Count; i++) { var littleZooModuleData = this.playerData.playerZoo.littleZooModuleDatasMSS[i]; if (littleZooModuleData.sceneID != sceneID) { continue; } littleZooID = littleZooModuleData.littleZooID; groupID = GlobalDataManager.GetInstance().logicTableGroup.FindGroupID(littleZooID); if (!loadGroup.Contains(groupID)) { loadGroup.Add(groupID); LogWarp.LogFormat("loadGroup {0}", groupID); } //加载动物栏 int level = littleZooModuleData.littleZooTicketsLevel; var cellBuild = Config.buildupConfig.getInstace().getCell(littleZooID); int buildResIdx = LittleZooModule.FindLevelRangIndex(cellBuild.lvmodel, level); LittleZooModule.LoadLittleZoo(sceneID, littleZooID, buildResIdx, littleZooRoot, false); } loadGroup.Sort(); Config.resourceCell cellRes; int idx = 0; float offset = Config.globalConfig.getInstace().ZooPartResLen; float extendOffset = 0; Config.groupCell preCell = null; Config.groupCell lastCell = null; for (int i = 0; i < loadGroup.Count; i++) { var cellGroup = Config.groupConfig.getInstace().getCell(loadGroup[i]); //加载Group if (cellGroup.zoopartresID > 0 && i >= (Config.globalConfig.getInstace().DefaultOpenGroup)) { cellRes = Config.resourceConfig.getInstace().getCell(cellGroup.zoopartresID); var goPart = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath); if (preCell != null) { extendOffset += preCell.groundsize; } goPart.transform.position = new Vector3(goPart.transform.position.x - extendOffset, 0, 0); goPart.name = string.Format("Group_{0}", cellGroup.zoopartresID); ++idx; preCell = cellGroup; lastCell = cellGroup; GlobalDataManager.GetInstance().zooGameSceneData.AddExtendLoadGroup(loadGroup[i], goPart); } } if (lastCell != null) { extendOffset += lastCell.groundsize; } LittleZooModule.LoadExitGate(sceneID, idx, extendOffset); }