public bool PlayersEnterScene(int roomId, LBPlayerEnterSceneInfo[] playerInfos)
        {
            for (int i = 0; i < playerInfos.Length; ++i)
            {
                if (null != GetSceneByPlayerId(playerInfos[i].playerId))
                {
                    return(false);
                }
            }

            LBScene curScene = GetSceneByRoomId(roomId);

            if (null == curScene)
            {
                curScene = mCachedSceneMgr.GetObject();
                curScene.SetRoomId(roomId);
                mSceneDic[curScene.SceneId] = curScene;
                mRoomIdSceneIdDic[roomId]   = curScene.SceneId;
            }
            if (!curScene.PlayerEnterScene(playerInfos))
            {
                LBLogger.Error(LogTag, "玩家进入场景");
                FreeScene(curScene.SceneId);
                return(false);
            }
            for (int i = 0; i < playerInfos.Length; ++i)
            {
                mPlayerIdSceneIdDic[playerInfos[i].playerId] = curScene.SceneId;
            }
            return(true);
        }
        LBScene GetSceneBySceneId(int sceneId)
        {
            LBScene ret = null;

            mSceneDic.TryGetValue(sceneId, out ret);
            return(ret);
        }
        public bool PlayerBattleInstruction(int playerId, BattleInstructionBase instruction)
        {
            LBScene scene = GetSceneByPlayerId(playerId);

            if (scene == null)
            {
                LBLogger.Error(LogTag, "收到玩家的战斗指令,但是没有找到对应的场景 " + playerId);
                return(false);
            }
            return(scene.PlayerBattleInstruction(playerId, instruction));
        }
        public bool PlayerLoadFinish(int playerId)
        {
            LBScene scene = GetSceneByPlayerId(playerId);

            if (scene == null)
            {
                LBLogger.Error(LogTag, "玩家通知加載成功,但是沒有找到對應的場景 " + playerId);
                return(false);
            }
            return(scene.LoadFinish(playerId));
        }
        void FreeScene(int sceneId)
        {
            LBScene curScene = GetSceneBySceneId(sceneId);

            if (null == curScene)
            {
                return;
            }
            mSceneDic.Remove(curScene.SceneId);
            mRoomIdSceneIdDic.Remove(curScene.RoomId);
            mCachedSceneMgr.ReturnObject(curScene);
        }
        public void PlayerLeaveScene(int playerId)
        {
            LBScene scene = GetSceneByPlayerId(playerId);

            if (scene == null)
            {
                return;
            }
            scene.PlayerLeaveScene(playerId);
            mPlayerIdSceneIdDic.Remove(playerId);
            if (scene.IsEmpty)
            {
                FreeScene(scene.SceneId);
            }
        }