Ejemplo n.º 1
0
 /// <summary>
 /// Create a new ConnectionID for a user.
 /// </summary>
 /// <param name="ipEndPoint"></param>
 public ConnectionID(IPEndPoint ipEndPoint)
 {
     networkStateMachine = new NetworkStateMachine(NetworkStateMachine.NetworkState.CONNECTIONCONNECTED);
     InitStateMachine();
     MissedSyncs = 0;
     ID = currentID++;
     IPEndPoint = ipEndPoint;
     return;
 }
Ejemplo n.º 2
0
        protected NetworkWorker networkWorker; // The worker thread used to send and receive data

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new NetworkBase.
        /// </summary>
        /// <param name="startingState">The state to start the network state machine in.</param>
        protected NetworkBase(NetworkStateMachine.NetworkState startingState)
        {
            networkStateMachine = new NetworkStateMachine(startingState);
            RegisterStateMachineTransitions();
            continueRunning = true;
            gameDataUpdater = null; // Set this to null initially
            networkThread = new Thread(NetworkMain);
            networkThread.IsBackground = true;
            return;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Change the state of this connection ID through the internal network state machine.
 /// </summary>
 /// <param name="transitionEvent">The transition event to run to apply to the internal network state machine.</param>
 public void ChangeState(NetworkStateMachine.TransitionEvent transitionEvent)
 {
     lock (this)
     {
         networkStateMachine.DoTransition(transitionEvent, null);
     }
     return;
 }