GameFramework.Room.Init C# (CSharp) Method

Init() private method

private Init ( int room_id, int scene_type, UserPool userpool, Connector conn ) : bool
room_id int
scene_type int
userpool UserPool
conn Connector
return bool
        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;
            m_ActiveScene = m_ScenePool.NewScene();
            LogSys.Log(LOG_TYPE.INFO, "[1] Room.Init {0} scene {1}", room_id, scene_type);
            m_ActiveScene.SetRoom(this);
            //场景数据加载由加载线程执行(注:场景没有加载完成,场景状态仍然是sleep,Scene.Tick不会有实际的动作)
            SceneLoadThread.Instance.QueueAction(m_ActiveScene.LoadData, scene_type);
            m_ActiveTime = TimeUtility.GetLocalMicroseconds();
            CurrentState = RoomState.Active;
            m_CanFinish = false;
            LogSys.Log(LOG_TYPE.DEBUG, "Room Initialize: {0}  Scene: {1}", room_id, scene_type);
            return true;
        }

Usage Example

Exemplo n.º 1
0
        internal void ActiveFieldRoom(int roomid, int sceneId)
        {
            LogSys.Log(LOG_TYPE.INFO, "[0] active field room {0} scene {1} thread {2}", roomid, sceneId, cur_thread_id_);
            Room rm = room_pool_.NewRoom();

            if (null == rm)
            {
                Interlocked.Decrement(ref preactive_room_count_);

                LogSys.Log(LOG_TYPE.ERROR, "Failed active field room {0} in thread {1}, preactive room count {2}",
                           roomid, cur_thread_id_, preactive_room_count_);
                return;
            }
            LogSys.Log(LOG_TYPE.INFO, "[1] active field room {0} scene {1} thread {2}", roomid, sceneId, cur_thread_id_);
            rm.ScenePool = scene_pool_;
            rm.Init(roomid, sceneId, user_pool_, connector_);
            LogSys.Log(LOG_TYPE.INFO, "[2] active field room {0} scene {1} thread {2}", roomid, sceneId, cur_thread_id_);

            rm.IsFieldRoom = true;

            LogSys.Log(LOG_TYPE.INFO, "[3] active field room {0} scene {1} thread {2}", roomid, sceneId, cur_thread_id_);

            //工作全部完成后再加到激活房间列表,开始tick
            active_room_.Add(rm);
            Interlocked.Decrement(ref preactive_room_count_);

            LogSys.Log(LOG_TYPE.DEBUG, "active field room {0} in thread {1}, preactive room count {2}",
                       roomid, cur_thread_id_, preactive_room_count_);
        }
All Usage Examples Of GameFramework.Room::Init