Пример #1
0
        public override void Read(Packet packet)
        {
            var s = packet;

            connection.canReceiveEntities = s.ReadBool();

            SceneLoadState local  = Core.LocalSceneLoading;
            SceneLoadState remote = new SceneLoadState();

            remote.State = s.ReadInt(2);
            remote.Scene = new Scene(s.ReadInt(8), s.ReadInt(8));

            if (AscensionNetwork.IsClient)
            {
                if (s.ReadBool())
                {
                    remote.Token = s.ReadToken();
                }
            }

            if (connection.remoteSceneLoading.Scene == remote.Scene)
            {
                remote.State = System.Math.Max(connection.remoteSceneLoading.State, remote.State);
            }

            connection.remoteSceneLoading = remote;

            if (Core.IsClient)
            {
                // if the scene the remote is loading is not the same as ours... we should switch
                if (remote.Scene != Core.LocalSceneLoading.Scene)
                {
                    // set the loading state
                    remote.State = SceneLoadState.STATE_LOADING;

                    // and begin loading
                    Core.LoadSceneInternal(remote);
                }
            }
        }
Пример #2
0
 /// <summary>
 /// 设置状态
 /// </summary>
 void SetLoadStateFinish(SceneLoadState state)
 {
     _loadComplete = true;
 }
Пример #3
0
 public SceneLoadEventArgs(string _path, SceneLoadMode _mode, SceneLoadState _state)
 {
     Path  = _path;
     Mode  = _mode;
     State = _state;
 }