public Disconnected ( GameClient gameClient, string reason ) : base(gameClient, ClientState.Disconnected) { Message = reason; // Notify client that game ended? gameClient.UnloadContent(); client.Shutdown( reason ); }
public Loading ( GameClient gameClient, string serverInfo ) : base(gameClient, ClientState.Loading) { Message = serverInfo; loader = gameClient.LoadContent( serverInfo ); if (loader==null) { throw new InvalidOperationException("Null GameLoader"); } }
public MPWorld( GameClient client, string serverInfo ) : base(client) { InitPhysSpace(16); InitializePrefabs(); var scene = Content.Load<Scene>(@"scenes\" + serverInfo ); ReadMapFromScene( Content, scene, IsClientSide ); }
public Connecting ( GameClient gameClient, IPEndPoint endPoint ) : base(gameClient, ClientState.Connecting) { client.Start(); Message = endPoint.ToString(); var hail = client.CreateMessage(); hail.Write( gameClient.Guid.ToByteArray() ); hail.Write( Encoding.UTF8.GetBytes(gameClient.UserInfo()) ); client.Connect( endPoint, hail ); }
/// <summary> /// Creates instance of Active client state. /// </summary> /// <param name="gameClient"></param> /// <param name="snapshotId"></param> /// <param name="initialSnapshot"></param> public Active ( GameClient gameClient, uint snapshotId, byte[] initialSnapshot, long svTicks ) : base(gameClient, ClientState.Active) { queue = new SnapshotQueue(32); queue.Push( new Snapshot( new TimeSpan(0), snapshotId, initialSnapshot) ); lastServerTicks = svTicks; lastSnapshotID = snapshotId; lastSnapshotFrame = snapshotId; Message = ""; #if USE_DEJITTER jitter = new JitterBuffer( gameClient.Game, svTicks ); #endif stopwatch = new Stopwatch(); stopwatch.Start(); clientTicks = stopwatch.Elapsed.Ticks; gameClient.FeedSnapshot( new GameTime(0,svTicks,0L), initialSnapshot, 0 ); }
void GameClient_ClientStateChanged( object sender, GameClient.ClientEventArgs e ) { Game.Console.Hide(); }
/// <summary> /// Ctor /// </summary> /// <param name="gameClient"></param> public State ( GameClient gameClient, ClientState clientState ) { this.ClientState = clientState; this.gameClient = gameClient; }
public Awaiting ( GameClient gameClient ) : base(gameClient, ClientState.Awaiting) { // send user command to draw server attention: // snapshotID and commandID are zero, because we dont have valid snapshot yet. gameClient.SendUserCommand( client, 0, 0, new byte[0] ); }
public StandBy ( GameClient gameClient ) : base(gameClient, ClientState.StandBy) { Message = ""; }