protected void OnEntryGateCheckInCDFinshedApply(Message msg) { var _msg = msg as EntryGateCheckInCDFinshedApply; 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 } bool retCode = entryGate.RemoveVisitorFromQueue(_msg.entityID); #if UNITY_EDITOR if (!retCode) { string e = string.Format("{0} cd结束, 入口{1}队伍中没有它", _msg.entityID, _msg.entryID); throw new System.Exception(e); } #endif EntryGateCheckInCDFinshedReply.Send(_msg.entityID); //通知队伍中除了自己之外已经有正式位置的往前移动一步 var sendMsg = BroadcastForwardOneStepInQueue.Send((int)(GameMessageDefine.BroadcastForwardOneStepInEntryGateQueue), _msg.entityID, _msg.entryID); DebugFile.GetInstance().WriteKeyFile(string.Format("entry_{0}", _msg.entryID), "{0} EntryGateModule {1}", _msg.entityID, sendMsg); AlterValue(_msg.entryID); }
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 InitEntryData() { List <GateData> entryGateList = playerData.GetEntryDateDataIDIndexOfDataIdx().entryGateList; entryNum = entryGateList.Count; for (int i = 0; i < entryGateList.Count; i++) { var entryGateData = playerData.GetEntryGateIDIndexOfDataIdx(entryGateList[i].entryID); var cell = Config.ticketConfig.getInstace().getCell(entryGateData.entryID); int checkInCDVal = GetCheckinCDValMs(entryGateData.entryID, entryGateData.level); var entryGate = new EntryGate(entryGateData.entryID, entryGateData.level, checkInCDVal, cell.touristwalkinto, cell.maxnumofperqueue, this.playerData.playerZoo.currSceneID); this.entryGates.Add(entryGateData.entryID, entryGate); } }
protected void OnGetEntryGateDataApply(Message msg) { var _msg = msg as GetEntryGateDataApply; 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 } GetEntryGateDataReply.Send(_msg.entityID, entryGate); }
protected void OnBroadcastEntryGatePureLevelOfPlayerData(Message msg) { var _msg = msg as SetDetailValueOfPlayerData; int entryID = _msg.detailVal; int deltaLevel = _msg.deltaVal; EntryGate entryGate = null; if (!entryGates.TryGetValue(entryID, out entryGate)) { string e = string.Format("入口升级异常{0}", entryID); throw new System.Exception(e); } entryGate.level += deltaLevel; var cell = Config.ticketConfig.getInstace().getCell(entryID); entryGate.checkInCDVal = GetCheckinCDValMs(entryID, entryGate.level); }
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); } } }
protected void OnBroadcastEntryGateNumOfPlayerData(Message msg) { //这里其实可以不需要消息内容,只需要和PlayerData中维护的入口数据同步即可 entryNum = playerData.playerZoo.numEntryGate; var entryGateLists = playerData.GetEntryDateDataIDIndexOfDataIdx().entryGateList; for (int i = 0; i < entryGateLists.Count; i++) { GateData entryGateData = entryGateLists[i]; EntryGate entryGate = null; if (!entryGates.TryGetValue(entryGateData.entryID, out entryGate)) { var cell = Config.ticketConfig.getInstace().getCell(entryGateData.entryID); int checkInCDVal = GetCheckinCDValMs(entryGateData.entryID, 1); entryGate = new EntryGate(entryGateData.entryID, 1, checkInCDVal, cell.touristwalkinto, cell.maxnumofperqueue, playerData.playerZoo.currSceneID); this.entryGates.Add(entryGateData.entryID, entryGate); } } // 需要 设置对应的售票口的显隐 var _msg = msg as SetValueOfPlayerData; int subscript = GetPresentSceneTicketCell(_msg.deltaVal); HideEntryGateForbidGameObject(subscript); }