private Init ( uint tick_interval, uint room_count, |
||
tick_interval | uint | |
room_count | uint | |
userpool | ||
conn | ||
return | bool |
public bool Init(string roomServerName) { m_Lock = new object(); m_ActiveRooms = new Dictionary <int, int>(); m_UserPool.Init(m_UserPoolSize); // 初始化场景房间 int startId = 1; 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.Story) { foreach (string roomSvrName in cfg.RoomServer) { for (int ix = 0; ix < cfg.ThreadCountPerScene; ++ix) { if (0 == roomServerName.CompareTo(roomSvrName)) { RoomThread fieldThread = new RoomThread(this); fieldThread.Init(m_ThreadTickInterval, (uint)cfg.RoomCountPerThread, m_UserPool, m_Connector); for (int rix = 0; rix < cfg.RoomCountPerThread; ++rix) { fieldThread.ActiveFieldRoom(startId, cfg.id); AddActiveRoom(startId, m_FieldRoomthreadList.Count, true); AddFieldSceneRoomId(cfg.id, startId); ++startId; } m_FieldRoomthreadList.Add(fieldThread); } else { for (int rix = 0; rix < cfg.RoomCountPerThread; ++rix) { ++startId; } } } } } } // 初始化房间线程 for (int i = 0; i < m_ThreadAmount; ++i) { m_RoomThreadList[i] = new RoomThread(this); m_RoomThreadList[i].Init(m_ThreadTickInterval, m_RoomAmount, m_UserPool, m_Connector); } m_NextRoomId = startId; return(true); }
internal bool Init(string roomServerName) { lock_obj_ = new object(); active_rooms_ = new Dictionary <int, int>(); user_pool_.Init(user_pool_size_); // 初始化场景房间 int startId = 1; 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) { foreach (string roomSvrName in cfg.RoomServer) { for (int ix = 0; ix < cfg.ThreadCountPerScene; ++ix) { if (0 == roomServerName.CompareTo(roomSvrName)) { RoomThread fieldThread = new RoomThread(this); fieldThread.Init(thread_tick_interval_, (uint)cfg.RoomCountPerThread, user_pool_, connector_); for (int rix = 0; rix < cfg.RoomCountPerThread; ++rix) { fieldThread.ActiveFieldRoom(startId, cfg.id); AddActiveRoom(startId, field_roomthread_list_.Count, true); AddFieldSceneRoomId(cfg.id, startId); ++startId; } field_roomthread_list_.Add(fieldThread); } else { for (int rix = 0; rix < cfg.RoomCountPerThread; ++rix) { ++startId; } } } } } } // 初始化房间线程 for (int i = 0; i < thread_amount_; ++i) { roomthread_list_[i] = new RoomThread(this); roomthread_list_[i].Init(thread_tick_interval_, room_amount_, user_pool_, connector_); } next_room_id_ = startId; return(true); }
internal bool Init(string roomServerName) { lock_obj_ = new object(); active_rooms_ = new Dictionary<int, int>(); user_pool_.Init(user_pool_size_); // ��ʼ���������� int startId = 1; 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) { foreach (string roomSvrName in cfg.RoomServer) { for (int ix = 0; ix < cfg.ThreadCountPerScene; ++ix) { if (0 == roomServerName.CompareTo(roomSvrName)) { RoomThread fieldThread = new RoomThread(this); fieldThread.Init(thread_tick_interval_, (uint)cfg.RoomCountPerThread, user_pool_, connector_); for (int rix = 0; rix < cfg.RoomCountPerThread; ++rix) { fieldThread.ActiveFieldRoom(startId, cfg.id); AddActiveRoom(startId, field_roomthread_list_.Count, true); AddFieldSceneRoomId(cfg.id, startId); ++startId; } field_roomthread_list_.Add(fieldThread); } else { for (int rix = 0; rix < cfg.RoomCountPerThread; ++rix) { ++startId; } } } } } } // ��ʼ�������߳� for (int i = 0; i < thread_amount_; ++i) { roomthread_list_[i] = new RoomThread(this); roomthread_list_[i].Init(thread_tick_interval_, room_amount_, user_pool_, connector_); } next_room_id_ = startId; return true; }