示例#1
0
 public SendQueuedMessagesSystem(Contexts contexts)
 {
     networking = contexts.networking;
     entities   = networking.GetGroup(
         NetworkingMatcher.AllOf(NetworkingMatcher.OutgoingMessages, NetworkingMatcher.Connection)
         );
 }
    public ComposeInputStateUpdateMessageSystem(Contexts contexts)
    {
        networking = contexts.networking;
        servers    = networking.GetGroup(
            NetworkingMatcher.AllOf(NetworkingMatcher.Server, NetworkingMatcher.OutgoingMessages)
            );

        input = contexts.input;
    }
    public ComposeGameStateUpdateMessageSystem(Contexts contexts)
    {
        networking = contexts.networking;
        game       = contexts.game;

        entitiesToTrack = contexts.game.GetGroup(GameMatcher.ChangeFlags);
        clients         = networking.GetGroup(
            NetworkingMatcher.AllOf(NetworkingMatcher.Client, NetworkingMatcher.OutgoingMessages)
            );
    }
示例#4
0
    /// Creates an Entity to represent a connection with a client.
    public static NetworkingEntity CreateClientConnection(this NetworkingContext networking, int connectionId)
    {
        var e = networking.CreateEntity();

        e.AddConnection(connectionId);
        e.AddIncomingMessages(new Queue <INetworkMessage>());
        e.AddOutgoingMessages(new Queue <INetworkMessage>());
        e.isClient = true;

        return(e);
    }
示例#5
0
    public Contexts()
    {
        events     = new EventsContext();
        game       = new GameContext();
        gameState  = new GameStateContext();
        input      = new InputContext();
        networking = new NetworkingContext();

        var postConstructors = System.Linq.Enumerable.Where(
            GetType().GetMethods(),
            method => System.Attribute.IsDefined(method, typeof(Entitas.CodeGeneration.Attributes.PostConstructorAttribute))
            );

        foreach (var postConstructor in postConstructors)
        {
            postConstructor.Invoke(this, null);
        }
    }
示例#6
0
 public InitializeServerSystem(Contexts contexts)
 {
     networking = contexts.networking;
 }
 public HandleConnectingClientsSystem(Contexts contexts) : base(contexts.networking)
 {
     networking = contexts.networking;
     game       = contexts.game;
 }
 public InitializeClientSystem(Contexts contexts)
 {
     networking = contexts.networking;
 }
 public ClientReceiveSystem(Contexts contexts)
 {
     networking = contexts.networking;
 }
 public ServerReceiveSystem(Contexts contexts)
 {
     networking = contexts.networking;
 }
示例#11
0
 public static NetworkingEntity GetEntityWithPlayer(this NetworkingContext context, int id)
 {
     return(((Entitas.PrimaryEntityIndex <NetworkingEntity, int>)context.GetEntityIndex(Contexts.Player)).GetEntity(id));
 }
示例#12
0
 public static System.Collections.Generic.HashSet <NetworkingEntity> GetEntitiesWithOwner(this NetworkingContext context, int value)
 {
     return(((Entitas.EntityIndex <NetworkingEntity, int>)context.GetEntityIndex(Contexts.Owner)).GetEntities(value));
 }