示例#1
0
        public Connection(SocketConnection sConn)
        {
            UserData = sConn.UserToken;

            controlling     = new List <Entity>();
            controllingList = new EntityList(controlling);

            sockConn           = sConn;
            sockConn.UserToken = this;

            channels = new Channel[] {
                sceneLoadChannel = new SceneLoadChannel(),
                commandChannel   = new CommandChannel(),
                eventChannel     = new EventChannel(),
                entityChannel    = new EntityChannel()
            };

            remoteFrameAdjust  = false;
            remoteSceneLoading = SceneLoadState.DefaultRemote();

            packetStatsOut          = new RingBuffer <PacketStats>(Core.Config.framesPerSecond);
            packetStatsOut.Autofree = true;

            packetStatsIn          = new RingBuffer <PacketStats>(Core.Config.framesPerSecond);
            packetStatsIn.Autofree = true;

            // set channels connection
            for (int i = 0; i < channels.Length; ++i)
            {
                channels[i].connection = this;
            }
        }
示例#2
0
        public static void Enqueue(SceneLoadState scene)
        {
            NetLog.Debug("Loading {0} ({1})", scene, AscensionNetworkInternal.GetSceneName(scene.Scene.Index));

            delay = 0;
            LoadOps.AddLast(new LoadOp {
                scene = scene
            });
        }
示例#3
0
        void Done()
        {
            try
            {
                GC.Collect();

                loaded = LoadOps.RemoveFirst().scene;
            }
            finally
            {
                if (LoadOps.Count == 0)
                {
                    delay = 60;
                }
            }
        }
示例#4
0
 public void Set(SceneLoadState state)
 {
     State = state.State;
     Scene = new Scene(state.Scene.Index, state.Scene.Sequence);
     Token = state.Token;
 }