コード例 #1
0
        internal void InitSceneRooms()
        {
            // 初始化野外场景房间
            MyDictionary <int, object> scenes = TableConfig.LevelProvider.Instance.LevelMgr.GetData();

            foreach (KeyValuePair <int, object> pair in scenes)
            {
                TableConfig.Level cfg = pair.Value as TableConfig.Level;
                if (null != cfg && cfg.type == (int)SceneTypeEnum.Room)
                {
                    SceneRoomsInfo fieldInfo;
                    if (!m_SceneInfos.TryGetValue(cfg.id, out fieldInfo))
                    {
                        fieldInfo           = new SceneRoomsInfo();
                        fieldInfo.m_SceneId = cfg.id;
                        m_SceneInfos.Add(cfg.id, fieldInfo);
                    }
                    foreach (string roomServerName in cfg.RoomServer)
                    {
                        for (int ix = 0; ix < cfg.ThreadCountPerScene; ++ix)
                        {
                            for (int rix = 0; rix < cfg.RoomCountPerThread; ++rix)
                            {
                                RoomInfo room = NewRoomInfo();
                                room.RoomId         = ++m_CurRoomId;
                                room.IsField        = true;
                                room.SceneType      = cfg.id;
                                room.RoomServerName = roomServerName;
                                room.TotalCount     = cfg.MaxUserCount;

                                if (!m_Rooms.ContainsKey(room.RoomId))
                                {
                                    m_Rooms.Add(room.RoomId, room);
                                }
                                else
                                {
                                    m_Rooms[room.RoomId] = room;
                                }
                                if (!fieldInfo.m_RoomIds.Contains(room.RoomId))
                                {
                                    fieldInfo.m_RoomIds.Add(room.RoomId);
                                }
                                room.Creator = 0;
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        internal void InitSceneRooms()
        {
            // ��ʼ��Ұ�ⳡ������
            MyDictionary<int, object> scenes = TableConfig.LevelProvider.Instance.LevelMgr.GetData();
            foreach (KeyValuePair<int, object> pair in scenes) {
                TableConfig.Level cfg = pair.Value as TableConfig.Level;
                if (null != cfg && cfg.type == (int)SceneTypeEnum.Room) {
                    SceneRoomsInfo fieldInfo;
                    if (!m_SceneInfos.TryGetValue(cfg.id, out fieldInfo)) {
                        fieldInfo = new SceneRoomsInfo();
                        fieldInfo.m_SceneId = cfg.id;
                        m_SceneInfos.Add(cfg.id, fieldInfo);
                    }
                    foreach (string roomServerName in cfg.RoomServer) {
                        for (int ix = 0; ix < cfg.ThreadCountPerScene; ++ix) {
                            for (int rix = 0; rix < cfg.RoomCountPerThread; ++rix) {
                                RoomInfo room = NewRoomInfo();
                                room.RoomId = ++m_CurRoomId;
                                room.IsField = true;
                                room.SceneType = cfg.id;
                                room.RoomServerName = roomServerName;
                                room.TotalCount = cfg.MaxUserCount;

                                if (!m_Rooms.ContainsKey(room.RoomId)) {
                                    m_Rooms.Add(room.RoomId, room);
                                } else {
                                    m_Rooms[room.RoomId] = room;
                                }
                                if (!fieldInfo.m_RoomIds.Contains(room.RoomId)) {
                                    fieldInfo.m_RoomIds.Add(room.RoomId);
                                }
                                room.Creator = 0;
                            }
                        }
                    }
                }
            }
        }