示例#1
0
        internal void ProcessRoom(object pCallback)
        {
            isCycling = true;
            try
            {
                if (isCrashed || mDisposed)
                {
                    return;
                }
                try
                {
                    int idle = 0;
                    groups.OnCycle();
                    GetRoomItemHandler().OnCycle();
                    GetRoomUserManager().OnCycle(ref idle);

                    if (musicController != null)
                    {
                        musicController.Update(this);
                    }

                    if (idle > 0)
                    {
                        IdleTime++;
                    }
                    else
                    {
                        IdleTime = 0;
                    }

                    if (!mCycleEnded)
                    {
                        if (this.IdleTime >= 10)
                        {
                            ButterflyEnvironment.GetGame().GetRoomManager().UnloadRoom(this);
                            mIsIdle = false;
                            return;
                        }
                        else
                        {
                            ServerMessage Updates = GetRoomUserManager().SerializeStatusUpdates(false);

                            if (Updates != null)
                            {
                                SendMessage(Updates);
                            }
                        }
                    }

                    if (gameItemHandler != null)
                    {
                        gameItemHandler.OnCycle();
                    }
                    if (game != null)
                    {
                        game.OnCycle();
                    }
                    if (GotBanzai())
                    {
                        banzai.OnCycle();
                    }
                    if (GotSoccer())
                    {
                        soccer.OnCycle();
                    }
                    if (wiredHandler != null)
                    {
                        wiredHandler.OnCycle();
                    }

                    roomUserManager.UserList.OnCycle();
                    WorkRoomAlertQueue();
                    WorkRoomBadgeQueue();
                    WorkRoomKickQueue();
                    WorkChatQueue();

                    WorkRoomServerMessageThread();
                }
                catch (Exception e)
                {
                    OnRoomCrash(e);
                }
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Sub crash in room cycle: " + e.ToString());
            }
            isCycling = false;
        }