internal RoomManager(uint thread_amount, uint room_amount) { thread_amount_ = thread_amount; room_amount_ = room_amount; roomthread_list_ = new RoomThread[thread_amount]; user_pool_size_ = thread_amount * room_amount * 3; user_pool_ = new UserPool(); thread_tick_interval_ = 50; }
internal RoomManager(uint thread_amount, uint room_amount, uint tick_interval, Connector conn) { thread_amount_ = thread_amount; room_amount_ = room_amount; roomthread_list_ = new RoomThread[thread_amount]; user_pool_size_ = thread_amount * room_amount * 3; user_pool_ = new UserPool(); dispatcher_ = new Dispatcher(); thread_tick_interval_ = tick_interval; connector_ = conn; }
internal bool Init(uint tick_interval, uint room_count, UserPool userpool, Connector conn) { tick_interval_ = tick_interval; max_room_count_ = room_count; room_pool_.Init(max_room_count_); user_pool_ = userpool; connector_ = conn; preactive_room_count_ = 0; LogSys.Log(LOG_TYPE.DEBUG, "thread {0} init ok.", cur_thread_id_); return(true); }
internal bool Init(int room_id, int scene_type, UserPool userpool, Connector conn) { LogSys.Log(LOG_TYPE.INFO, "[0] Room.Init {0} scene {1}", room_id, scene_type); cur_room_id_ = room_id; user_pool_ = userpool; connector_ = conn; can_close_time_ = 0; //todo:以后需要根据房间类型从配置文件读取场景列表,这里先构造一个用了 m_ActiveScene = 0; Scene scene = m_ScenePool.NewScene(); LogSys.Log(LOG_TYPE.INFO, "[1] Room.Init {0} scene {1}", room_id, scene_type); scene.SetRoom(this); //场景数据加载由加载线程执行(注:场景没有加载完成,场景状态仍然是sleep,Scene.Tick不会有实际的动作) SceneLoadThread.Instance.QueueAction(scene.LoadData, scene_type); m_Scenes.Add(scene); this.CurrentState = RoomState.Active; LogSys.Log(LOG_TYPE.DEBUG, "Room Initialize: {0} Scene: {1}", room_id, scene_type); return(true); }