protected void OnSendExitGateCheckinCDFinish(Message msg) { var _msg = msg as SendExitGateCheckinCDFinish; var exitGate = exitGates[_msg.entryID]; int entityID = exitGate.RemoveVisitorFromQueue(); //int entityID = exitGate.visitorQueue.Dequeue(); LogWarp.LogFormat("{0} Parkingmodule recv {1}", _msg.entityID, _msg); DebugFile.GetInstance().WriteKeyFile(_msg.entityID, "{0} Parkingmodule recv {1}", _msg.entityID, _msg); #if UNITY_EDITOR if (entityID != _msg.entityID) { string e = string.Format("出口排队异常 entityID={0}, _msg.entityID={1}", entityID, _msg.entityID); throw new System.Exception(e); } #endif broadcastEntityIDs.Clear(); foreach (var val in exitGate.visitorQueue) { this.broadcastEntityIDs.Add(val); DebugFile.GetInstance().WriteKeyFile(val, "{0} BroadcastForwardOneStepInExitGateQueue by {1}", val, entityID); } BroadcastForwardOneStepInExitGateQueue.Send(broadcastEntityIDs); SendExitGateCheckinCDFinishReply.Send(_msg.entityID); AlterValue(_msg.entryID); }
public override void Enter(int preStateName) { base.Enter(preStateName); var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorGotoExitGateEntryQueue.Enter", entity.entityID); DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName); MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, this.OnArrived); MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastAfterExtendSceneAndModifiedPath, this.OnBroadcastAfterExtendSceneAndModifiedPath); MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastForwardOneStepInExitGateQueue, this.OnBroadcastForwardOneStepInExitGateQueue); MessageManager.GetInstance().Regist((int)GameMessageDefine.SendExitGateCheckinCDFinishReply, this.OnSendExitGateCheckinCDFinishReply); finishQueueStep = 0; GoToOrgPosOfQueue(entity); if (checkInCD == null) { checkInCD = new IntCD(0); } checkInCD.Stop(); LogWarp.LogFormat("{0} GoToOrgPosOfQueue step = {1}", entity.entityID, finishQueueStep); DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} GoToOrgPosOfQueue step = {1}", entity.entityID, finishQueueStep); }
/// <summary> /// 在这个状态收到这个消息,被通知走到观光位,说明在去等待位的途中就收到了, /// 直接设置标志位,在下一个状态处理 /// </summary> /// <param name="msg"></param> protected void OnWaitSeatToVisitSeat(Message msg) { var _msg = msg as WaitSeatToVisitSeat; var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; //不是自己的 if (_msg.entityID != entity.entityID) { return; } LogWarp.LogFormat("途中收到去观光位 排位{0}", _msg.indexInVisitQueue); DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0}在状态StateVisitorChoseLittleZoo 收到{1}, tickCount={2}", entity.entityID, msg, GameManager.GetInstance().tickCount); entity.isApproveVisitSeat = true; entity.indexInVisitQueue = _msg.indexInVisitQueue; DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0}在状态StateVisitorChoseLittleZoo, 收到{1}, entity.followPath.isArrivedEnd={2}, tickCount={3}", entity.entityID, msg, entity.followPath.isArrivedEnd, GameManager.GetInstance().tickCount); if (entity.followPath.isArrivedEnd) { DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0}在状态StateVisitorChoseLittleZoo, 并且处于到达状态 收到{1}", entity.entityID, msg); } }
protected void WhenCheckinCDFinished() { var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; var msg = SendExitGateCheckinCDFinish.Send(entity.entityID, entity.ExitGateEntryID); LogWarp.LogFormat("{0} send {1}", entity.entityID, msg); DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} send {1}", entity.entityID, msg); }
protected void OnAddVisitorToEntryQueuePlaceHolderApply(Message msg) { var _msg = msg as AddVisitorToEntryQueuePlaceHolderApply; LogWarp.LogFormat("{0} EntryGateModule recv {1}", _msg.entityID, _msg); DebugFile.GetInstance().WriteKeyFile(_msg.entityID, "{0} EntryGateModule recv {1}", _msg.entityID, _msg); bool result = false; int entryID = Const.Invalid_Int; int indexInQueue = Const.Invalid_Int; this.idleGates.Clear(); if (this.isOnlyOneEntry) { var exitGate = entryGates[1]; if (!exitGate.IsQueueFull()) { this.idleGates.Add(exitGate); } //保留最后一个遍历的 entryID = exitGate.entryID; } else { foreach (var kv in this.entryGates) { if (!kv.Value.IsQueueFull()) { this.idleGates.Add(kv.Value); } //保留最后一个遍历的 entryID = kv.Value.entryID; } } //LogWarp.LogFormat("还能排队的入口数{0}", idleEntrys.Count); EntryGate idleGate = null; string pathName = null; if (idleGates.Count > 0) { int rVal = 0; if (isRandomEntry) { rVal = Random.Range(0, idleGates.Count); } idleGate = idleGates[rVal]; result = true; entryID = idleGate.entryID; pathName = idleGate.pathName; idleGate.AddVisitorPlaceHolder(_msg.entityID); LogWarp.LogFormat("给出的排队位{0}", indexInQueue); } //AddVisitorToEntryQueuePlaceHolderReply.Send(result, _msg.entityID, pathName, indexInQueue, entryID); AddVisitorToEntryQueuePlaceHolderReply.Send(result, _msg.entityID, pathName, entryID); //AddVisitorToEntryQueuePlaceHolderReply.Send(false, _msg.entityID, pathName, entryID); AlterValue(entryID); }
protected void CalcMaxParkingNum() { #if DEBUG_VISIT numMaxParking = GetParkingNumber(2000); #else numMaxParking = GetParkingSpace(); #endif LogWarp.LogFormat("parking numMaxParking = {0}", numMaxParking); }
public static AddVisitorToLittleZooApply Send(int entityID, bool isFirstApply) { LogWarp.LogFormat("AddVisitorToLittleZooApply {0}, {1} ", entityID, isFirstApply); var msg = pool.New(); msg.Init(entityID, isFirstApply); MessageManager.GetInstance().Send(msg); return(msg); }
/// <summary> /// 增加当前金钱 /// </summary> /// <param name="obj"></param> private void OnClickTestAddCoinButton(string obj) { LogWarp.LogFormat("AAAAAAAAAAAAAAA"); //点一下,把当前的金币变成2倍 var pd = GlobalDataManager.GetInstance().playerData; var addCoin = pd.playerZoo.playerCoin.GetCoinByScene(pd.playerZoo.currSceneID).coinBigInt; SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, addCoin, 0); }
public void WriteKeyFile(int key, string format, params object[] args) { #if UNITY_EDITOR string content = string.Format(format, args); LogWarp.LogFormat(content); string keyFilePath = string.Format("{0}{1}.txt", debugFileDir, key); string lineContent = string.Format("{0}|{1}\r\n", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"), content); File.AppendAllText(keyFilePath, lineContent, Encoding.UTF8); #endif }
//public static bool IsApplyTooMuch(int groupID, Dictionary<int, int> applyRecord) //{ // List<int> sortedLittleZooID = null; // if (!GlobalDataManager.GetInstance().logicTableGroup.sortedLittleZooIDs.TryGetValue(groupID, out sortedLittleZooID)) // { // string e = string.Format("查不到 sortedLittleZooID {0}", groupID); // throw new System.Exception(e); // } // int applyTime = 0; // if (!applyRecord.TryGetValue(groupID, out applyTime)) // { // applyTime = 0; // } // return applyTime >= sortedLittleZooID.Count; //} ////所在组是否都浏览过 //public static bool IsVisitedAll(EntityVisitor entity, int GroupID, bool allowNoVisited = true) //{ // List<int> littleZooList = null; // if (!entity.visitedGroupMap.TryGetValue(entity.wouldGotoBuildingGroupID, out littleZooList)) // { // //都查不到组数据,肯定没浏览过 // if (allowNoVisited) // { // return false; // } // string e = string.Format("查不到浏览数据 {0}", entity.wouldGotoBuildingGroupID); // throw new System.Exception(e); // } // if (littleZooList.Count <= 0) // { // if (allowNoVisited) // { // return false; // } // string e = string.Format("查不到浏览数据 {0}", entity.wouldGotoBuildingGroupID); // throw new System.Exception(e); // } // List<int> sortedLittleZooID = null; // if (!GlobalDataManager.GetInstance().logicTableGroup.sortedLittleZooIDs.TryGetValue(entity.wouldGotoBuildingGroupID, out sortedLittleZooID)) // { // string e = string.Format("查不到 sortedLittleZooID {0}", entity.wouldGotoBuildingGroupID); // throw new System.Exception(e); // } // if (littleZooList.Count > sortedLittleZooID.Count) // { // string e = string.Format("浏览数据异常 {0}", entity.wouldGotoBuildingGroupID); // throw new System.Exception(e); // } // if (littleZooList.Count == sortedLittleZooID.Count) // { // return true; // } // return false; //} public static void GotoStartOfPath(EntityVisitor entity, string pathName) { var path = PathManager.GetInstance().GetPath(pathName); entity.pathList.Clear(); entity.pathList.Add(entity.position); entity.pathList.Add(path[0]); entity.followPath.Init(entity, entity.pathList, entity.pathList[0], 0, entity.moveSpeed, false); entity.followPath.Run(); LogWarp.LogFormat("GotoStartOfPath {0}", pathName); }
public static AddVisitorToLittleZooApplyReply Send(int entityID, bool result, int groupID, int littleZooID, int indexInQueue, Vector3 waitPos, bool isCrossGroup, List <int> crossLittleZooIDs) { LogWarp.LogFormat("AddVisitorToLittleZooApplyReply {0}, {1}, {2}, {3}, {4}, {5}", entityID, result, groupID, littleZooID, indexInQueue, waitPos); var msg = pool.New(); msg.Init(entityID, result, groupID, littleZooID, indexInQueue, waitPos, isCrossGroup, crossLittleZooIDs); MessageManager.GetInstance().Send(msg); return(msg); }
protected void OnBroadcastForwardOneStepInExitGateQueue(Message msg) { var _msg = msg as BroadcastForwardOneStepInExitGateQueue; var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; if (_msg.entityIDs.IndexOf(entity.entityID) < 0) { return; } entity.numOfExitGateQueueForwardOne++; LogWarp.LogFormat("{0} GotoStarOfExitEntry recv {1}, entity.numOfExitGateQueueForwardOne={2}", entity.entityID, _msg, entity.numOfExitGateQueueForwardOne); DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} GotoStarOfExitEntry recv {1}, entity.numOfExitGateQueueForwardOne={2}", entity.entityID, _msg, entity.numOfExitGateQueueForwardOne); }
public static void GodownPath(EntityVisitor entity, List <Vector3> path, bool isMoveToBegin = false) { if (path == null || path.Count <= 0) { string e = string.Format("路数据异常"); throw new System.Exception(e); } if (isMoveToBegin) { entity.position = path[0]; } entity.followPath.Init(entity, path, path[0], 0, entity.moveSpeed, false); entity.followPath.Run(); LogWarp.LogFormat("GodownPath "); }
public static void GodownPath(EntityVisitor entity, string pathName, bool isMoveToBegin = false) { var path = PathManager.GetInstance().GetPath(pathName); if (path == null || path.Count <= 0) { string e = string.Format("路 {0} 数据异常", pathName); throw new System.Exception(e); } if (isMoveToBegin) { entity.position = path[0]; } entity.followPath.Init(entity, path, path[0], 0, entity.moveSpeed, false); entity.followPath.Run(); LogWarp.LogFormat("GodownPath {0}", pathName); }
protected void WhenExtendScene(int groupID) { LogWarp.LogFormat("camera {0}", GetLoadGroup()); if (LoadingMgr.Inst.runTimeLoaderType == RunTimeLoaderType.Game) { var cell = Config.groupConfig.getInstace().getCell(groupID); //gameCamLeftUpPos.x -= Config.globalConfig.getInstace().ZooPartResLen; gameCamLeftUpPos.x -= cell.groundsize; //gameCamRightUpPos.x -= Config.globalConfig.getInstace().ZooPartResLen; gameCamRightUpPos.x -= cell.groundsize; } cameraArea.Clear(); cameraArea.Add(Math_F.Vector3_2D(editorCamLeftDownPos)); cameraArea.Add(Math_F.Vector3_2D(gameCamLeftUpPos)); cameraArea.Add(Math_F.Vector3_2D(gameCamRightUpPos)); cameraArea.Add(Math_F.Vector3_2D(editorCamRightDownPos)); }
/// <summary> /// 在这个状态收到这个消息,被通知走到观光位,直接走去观光位,走到后转下一个状态 /// </summary> /// <param name="msg"></param> protected void OnWaitSeatToVisitSeat(Message msg) { var _msg = msg as WaitSeatToVisitSeat; var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; //不是自己的 if (_msg.entityID != entity.entityID) { return; } entity.isApproveVisitSeat = true; //entity.stayBuildingID = _msg.littleZooID; entity.indexInVisitQueue = _msg.indexInVisitQueue; LogWarp.LogFormat("goto GotoVisitSeat {0}, {1}, {2}", entity.entityID, _msg.littleZooID, _msg.indexInVisitQueue); GotoVisitSeat(entity, _msg.littleZooID, _msg.indexInVisitQueue); }
protected void RunCheckInCD() { int cdVal = ExitGateModule.GetChinkinCDValMs(); var playerData = GlobalDataManager.GetInstance().playerData; if (playerData.playerZoo.buffExitEntryCDVal != UFrame.Const.Invalid_Float) { int buffExitEntryCDValMS = Math_F.FloatToInt1000(playerData.playerZoo.buffExitEntryCDVal); cdVal = Mathf.Min(cdVal, buffExitEntryCDValMS); } checkInCD.ResetOrg(cdVal); checkInCD.Run(); #if UNITY_EDITOR var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; LogWarp.LogFormat("{0} RunCheckInCD cdVal={1}", entity.entityID, cdVal); DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} RunCheckInCD cdVal={1}", entity.entityID, cdVal); #endif }
/// <summary> /// 使场景上某一点处于上半部屏幕中间 /// </summary> /// <param name="point"></param> public void PointAtScreenUpCenter(Vector3 point) { Vector2 screenCenter = Vector2.zero; screenCenter.x = Screen.width / 2; screenCenter.y = Screen.height * Config.globalConfig.getInstace().BuildingViewRatioY; Ray ray = cacheCam.ScreenPointToRay(screenCenter); //屏幕中心点,投影到地面的坐标 Vector3 groundPoint = UFrame.Math_F.GetIntersectWithLineAndGround(ray.origin, ray.direction); //地面的坐标的差异就是相机偏移 transform.position -= (groundPoint - point); //防止LateUpdate的拖动 dragMoveTo = transform.position; LogWarp.LogFormat("Camera Pos {0}", transform.position); }
public override void Enter(int preStateName) { base.Enter(preStateName); var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorLeaveFromZooEntry.Enter", entity.entityID); DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName); isArrivedStartOfPathTo1000 = false; isArrivedEndOfPathTo1000 = false; isToStateVisitorGotoGroundParking = false; var playdata = GlobalDataManager.GetInstance().playerData; entryBuildingID = GlobalDataManager.GetInstance().logicTableGroup.GetSingleBuildingID(playdata.playerZoo.currSceneID, BuildingType.EntryGate); entity.moveSpeed = Config.globalConfig.getInstace().ZooVisitorBackSpeed; MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, OnArrived); MessageManager.GetInstance().Regist((int)GameMessageDefine.VisitorWhereLeaveFromReply, this.OnVisitorWhereLeaveFromReply); pathOfLeaveZoo = Config.globalConfig.getInstace().NaturalVisitorOut_1; //选当前所在位置到1000的路,走过去。 if (entity.stayBuildingID == entryBuildingID) { LogWarp.LogFormat("{0} 刚入口排队结束进入动物后就返回!", entity.entityID); isArrivedStartOfPathTo1000 = true; EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().EntryGoBackPath); return; } pathOfTo1000 = EntityVisitor.GetPath(entity.stayBuildingID, entryBuildingID); if (string.IsNullOrEmpty(pathOfTo1000)) { string e = string.Format("StateVisitorLeaveNonLittleZoo 没找到{0}->{1}的路!!!!", entity.stayBuildingID, 1000); throw new Exception(e); } EntityVisitor.GotoStartOfPath(entity, pathOfTo1000); }
protected void OnLoadZooSceneFinished(Message msg) { cacheTrans = FingerCamera.GetInstance().cacheTrans; cacheCam = FingerCamera.GetInstance().cacheCam; crossPoint = FingerCamera.GetInstance().crossPoint; tryPoint = FingerCamera.GetInstance().tryPoint; moveToPoint = FingerCamera.GetInstance().moveToPoint; this.cacheTrans.position = editorInitPos; //FingerCamera.GetInstance().cacheTrans.position = editorInitPos; this.cacheCam.orthographicSize = this.maxOrthographicSize; //FingerCamera.GetInstance().cacheCam.orthographicSize = this.maxOrthographicSize; dragMoveTo = cacheTrans.position; LogWarp.LogFormat("camera {0}", GetLoadGroup()); if (LoadingMgr.Inst.runTimeLoaderType == RunTimeLoaderType.Game) { offset = (Config.globalConfig.getInstace().InitMaxGroupNum - GetLoadGroup()) * Config.globalConfig.getInstace().ZooPartResLen; gameCamLeftUpPos = editorCamLeftUpPos; gameCamLeftUpPos.x += offset; gameCamRightUpPos = editorCamRightUpPos; gameCamRightUpPos.x += offset; } cameraArea.Clear(); cameraArea.Add(Math_F.Vector3_2D(editorCamLeftDownPos)); cameraArea.Add(Math_F.Vector3_2D(gameCamLeftUpPos)); cameraArea.Add(Math_F.Vector3_2D(gameCamRightUpPos)); cameraArea.Add(Math_F.Vector3_2D(editorCamRightDownPos)); #if UNITY_EDITOR SetRange(); #else GameObject.Find("camer_range").SetActive(false); #endif }
protected void OnAddVisitorToEntryQueueApply(Message msg) { var _msg = msg as AddVisitorToEntryQueueApply; LogWarp.LogFormat("{0} EntryGateModule recv {1}", _msg.entityID, _msg); DebugFile.GetInstance().WriteKeyFile(_msg.entityID, "{0} EntryGateModule recv {1}", _msg.entityID, _msg); EntryGate entryGate = null; if (!this.entryGates.TryGetValue(_msg.entryID, out entryGate)) { #if UNITY_EDITOR string e = string.Format("{0} 找不到入口ID {1}", _msg.entityID, _msg.entryID); throw new System.Exception(e); #endif } int indexInQueue = entryGate.AddVisitorToQueue(_msg.entityID); #if UNITY_EDITOR if (indexInQueue == Const.Invalid_Int) { string e = string.Format("{0} AddVisitorToQueue {1} 失败", _msg.entityID, _msg.entryID); throw new System.Exception(e); } #endif AddVisitorToEntryQueueReply.Send(_msg.entityID, indexInQueue); if (_msg.entryID == 0 && GlobalDataManager.GetInstance().playerData.playerZoo.isGuide == true) { UIGuidePage uIGuidePage = PageMgr.GetPage <UIGuidePage>(); if (uIGuidePage != null && uIGuidePage.newBieGuild_step <= NewBieGuild.Step_10) { entryGate.checkInCDVal = (int)Config.globalConfig.getInstace().GuideTouristSpeed *1000; } else { entryGate.checkInCDVal = GetCheckinCDValMs(0, 1); } } }
/// <summary> /// 加载动物游戏 /// </summary> /// <param name="callback"></param> /// <param name="progress"></param> public void Load(System.Action firstCallback, System.Action lastCallback, System.Action <float> progress = null) { LogWarp.LogFormat("ZooGameLoader.Load"); switch (LoadingMgr.Inst.runTimeLoaderType) { case RunTimeLoaderType.Editor: callbacks += firstCallback; callbacks += LoadPartSceneForEditor; string sceneName = Config.sceneConfig.getInstace().getCell(LoadingMgr.Inst.editor_SceneID).resourceid; SceneMgr.Inst.LoadSceneAsync(sceneName, callbacks, progress); break; case RunTimeLoaderType.Game: GameSoundManager.GetInstance().PlayBGMusicAsync(Config.globalConfig.getInstace().ZooSceneBGM); GlobalDataManager.GetInstance().isLoadingScene = true; fsmLoad.Run(); break; default: string e = string.Format("runTimeLoaderType 类型错误{0}", LoadingMgr.Inst.runTimeLoaderType); throw new System.Exception(e); } }
public void AddVisitorPlaceHolder(int entityID) { LogWarp.LogFormat("{0} AddVisitorPlaceHolder {1}", entityID, entryID); //空位转占位 //int idx = visitorQueue.IndexOf(Const.Invalid_Int); //if (idx >=0) //{ // visitorQueue[idx] = GameConst.Place_Holder_ID; // return; //} for (int i = 0; i < visitorQueue.Count; i++) { if (visitorQueue[i] == Const.Invalid_Int) { visitorQueue[i] = GameConst.Place_Holder_ID; return; } } #if UNITY_EDITOR string e = string.Format("入口{0}, 没有空位, {1}不能去占位", this.entryID, entityID); throw new System.Exception(e); #endif }
protected void OnAddVisitorToExitGateQueueApply(Message msg) { var _msg = msg as AddVisitorToExitGateQueueApply; LogWarp.LogFormat("{0} ExitGateModule recv {1}", _msg.entityID, _msg); DebugFile.GetInstance().WriteKeyFile(_msg.entityID, "{0} ExitGateModule recv {1}", _msg.entityID, _msg); bool result = false; int entryID = Const.Invalid_Int; int indexInQueue = Const.Invalid_Int; this.idleExitGates.Clear(); if (this.isOnlyOneEntry) { var exitGate = exitGates[1]; if (!exitGate.IsQueueFull()) { this.idleExitGates.Add(exitGate); } //保留最后一个遍历的 entryID = exitGate.entryID; } else { foreach (var kv in this.exitGates) { if (!kv.Value.IsQueueFull()) { this.idleExitGates.Add(kv.Value); } //保留最后一个遍历的 entryID = kv.Value.entryID; } } //LogWarp.LogFormat("还能排队的入口数{0}", idleEntrys.Count); ExitGate idleEntry = null; string pathName = null; if (idleExitGates.Count > 0) { int rVal = 0; if (isRandomEntry) { rVal = Random.Range(0, idleExitGates.Count); } idleEntry = idleExitGates[rVal]; result = true; entryID = idleEntry.entryID; pathName = idleEntry.leftEntryPathName; idleEntry.AddVisitorToQueue(_msg.entityID); indexInQueue = idleEntry.GetLastIndexInQueue(); LogWarp.LogFormat("给出的排队位{0}", indexInQueue); } AddVisitorToExitGateQueueApplyReply.Send(result, _msg.entityID, pathName, indexInQueue, entryID); AlterValue(entryID); //模型到达出口 调用新手引导的内容 显示步骤13 //if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide == true) //{ // UIGuide[] pAllObjects = (UIGuide[])Resources.FindObjectsOfTypeAll(typeof(UIGuide)); // if (pAllObjects[0].procedure <12) // { // pAllObjects[0].VerdictAnimate(5f); // pAllObjects[0].VerdictPause(5f); // } //} }
/// <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); }
/// <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); }