Пример #1
0
 internal Scene NewScene()
 {
     Scene scene = null;
       if (m_UnusedScenes.Count > 0) {
     scene = m_UnusedScenes.Dequeue();
       } else {
     scene = new Scene();
       }
       return scene;
 }
 internal static void SyncBuffListToObservers(EntityInfo obj, Scene scene)
 {
     List<ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact();
     foreach (ImpactInfo info in impacts) {
     }
 }
 internal void Init(Scene scene)
 {
     StaticInit();
     m_Scene = scene;
 }
Пример #4
0
 public void RecycleScene(Scene scene)
 {
     m_UnusedScenes.Enqueue(scene);
 }
Пример #5
0
 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;
 }
Пример #6
0
        internal void Destroy()
        {
            LogSys.Log(LOG_TYPE.INFO, "room {0}({1}) destroy.", RoomID, LocalID);
            m_ActiveScene.Reset();
            m_ScenePool.RecycleScene(m_ActiveScene);
            m_ActiveScene = null;

            this.CurrentState = RoomState.Unuse;
            int userCt = room_users_.Count;
            for (int i = userCt - 1; i >= 0; --i) {
                User user = room_users_[i];
                if (null != user) {
                    LogSys.Log(LOG_TYPE.INFO, "FreeUser {0} for {1} {2}, [Room.Destroy]", user.LocalID, user.Guid, user.GetKey());
                    user.Reset();
                    user_pool_.FreeUser(user.LocalID);
                    room_users_.RemoveAt(i);
                }
            }
            for (int i = 0; i < room_observers_.Length; ++i) {
                room_observers_[i].Reset();
            }
        }
Пример #7
0
        internal void ChangeScene(int scene_type)
        {
            m_ActiveScene.Reset();
            m_ScenePool.RecycleScene(m_ActiveScene);
            m_ActiveScene = null;

            foreach (User us in room_users_) {
                us.IsEntered = false;
            }

            can_close_time_ = 0;
            m_ActiveScene = m_ScenePool.NewScene();
            m_ActiveScene.SetRoom(this);
            //场景数据加载由加载线程执行(注:场景没有加载完成,场景状态仍然是sleep,Scene.Tick不会有实际的动作)
            SceneLoadThread.Instance.QueueAction(m_ActiveScene.LoadData, scene_type);

            Msg_RC_ChangeScene msg = new Msg_RC_ChangeScene();
            msg.target_scene_id = scene_type;
            foreach (User us in room_users_) {
                us.SendMessage(RoomMessageDefine.Msg_RC_ChangeScene, msg);
            }

            LogSys.Log(LOG_TYPE.INFO, "Room.ChangeScene {0} scene {1}", cur_room_id_, scene_type);
        }
 private void PreloadActorAndSkills(Scene scene, int resId)
 {
     TableConfig.Actor cfg = TableConfig.ActorProvider.Instance.GetActor(resId);
     if (null != cfg) {
         int[] skillIds = new int[] { cfg.skill0, cfg.skill1, cfg.skill2, cfg.skill3, cfg.skill4, cfg.skill5, cfg.skill6, cfg.skill7, cfg.skill8, cfg.bornskill, cfg.deadskill };
         for (int ix = 0; ix < skillIds.Length; ++ix) {
             int skillId = skillIds[ix];
             if (skillId > 0) {
                 scene.SkillSystem.PreloadSkillInstance(skillId);
             }
         }
     }
 }
Пример #9
0
 internal void RecycleScene(Scene scene)
 {
     m_UnusedScenes.Enqueue(scene);
 }