Пример #1
0
        protected void OnBroadcastExitGateLevelOfPlayerData(Message msg)
        {
            //检查入口数量是否增加
            int entryNum        = GetEntryNum();
            int checkInCDVal    = GetChinkinCDValMs();
            var sortExitGateIDs = GlobalDataManager.GetInstance().logicTableExitGate.sortExitGateIDs;
            int exitGateID      = Const.Invalid_Int;

            int currEntryNum = exitGates.Count;

            if (entryNum > currEntryNum)
            {
                for (int i = currEntryNum; i < entryNum; i++)
                {
                    exitGateID = sortExitGateIDs[i];
                    var cell     = Config.exitgateConfig.getInstace().getCell(exitGateID);
                    var exitGate = new ExitGate(exitGateID, checkInCDVal, cell.positiveexitgate, cell.positiveexitgate, cell.maxnumofperqueue);
                    exitGates.Add(exitGateID, exitGate);
                    HideExitGateForbidGameObject(exitGateID);
                }
            }

            //全部重置checkInCDVal
            foreach (var val in exitGates.Values)
            {
                val.checkInCDVal = checkInCDVal;
            }
        }
Пример #2
0
        protected void InitExitGateData()
        {
#if DEBUG_VISIT
            int entryNum     = GetEntryNum(2000);
            int checkInCDVal = GetChinkinCDValMs(2000);
#else
            int entryNum     = GetEntryNum();
            int checkInCDVal = GetChinkinCDValMs();
#endif

            var sortExitGateIDs = GlobalDataManager.GetInstance().logicTableExitGate.sortExitGateIDs;
            int exitGateID      = Const.Invalid_Int;

            for (int i = 0; i < entryNum; i++)
            {
                exitGateID = sortExitGateIDs[i];
                var cell     = Config.exitgateConfig.getInstace().getCell(exitGateID);
                var exitGate = new ExitGate(exitGateID, checkInCDVal, cell.positiveexitgate, cell.positiveexitgate, cell.maxnumofperqueue);

                exitGates.Add(exitGateID, exitGate);
            }

            shuttleVisitorQueue.Clear();
            //maxShuttleVisitorQueue = ExitGateModule.GetMaxShuttleVisitor();
            maxShuttleInterval      = Math_F.FloatToInt1000(Config.globalConfig.getInstace().MaxShuttleInterval);
            shuttleaccumulativeTime = 0;
            shuttleVisitorList.Clear();
        }
Пример #3
0
        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);
            //    }
            //}
        }