Example #1
0
 protected ReactiveSystemApp(Contexts contexts) : base(contexts)
 {
     GameScope       = contexts.Get <GameScope>();
     InputScope      = contexts.Get <InputScope>();
     GameStateScope  = contexts.Get <GameStateScope>();
     GameConfigScope = contexts.Get <GameConfigScope>();
 }
Example #2
0
 public EasyAConsumer(TaskCompletionSource <ConsumeContext <EasyA> > received, ScopedContext scopedContext,
                      TaskCompletionSource <ScopedContext> scopedContextCompletionSource)
 {
     _received      = received;
     _scopedContext = scopedContext;
     _scopedContextCompletionSource = scopedContextCompletionSource;
 }
Example #3
0
    internal static async Task Reset()
    {
        await Context.Reset();

        Context        = new ScopedContext(scopeFactory);
        CommitmentsApi = Substitute.For <ICommitmentsApiClient>();
        RoatpApi       = Substitute.For <IRoatpService>();
        AccountsApi    = Substitute.For <IAccountApiClient>();
        TimeProvider   = Substitute.For <ITimeProvider>();
    }
Example #4
0
    public static void RunBeforeAnyTests()
    {
        var services = CreateServices();

        scopeFactory = services
                       .BuildServiceProvider()
                       .GetService <IServiceScopeFactory>();

        Context = new ScopedContext(scopeFactory);
    }
Example #5
0
    public static int GetNextEmptyRow(ScopedContext <GameScope> gameScope, Vector2Int position)
    {
        position.y -= 1;
        while (position.y >= 0 && gameScope.GetPieceWithPosition(position) == null)
        {
            position.y -= 1;
        }

        return(position.y + 1);
    }
Example #6
0
        public async Task Should_use_the_same_scope_for_consume_and_send()
        {
            await InputQueueSendEndpoint.Send <EasyA>(new { InVar.CorrelationId });

            await EasyASource.Task;
            await EasyBSource.Task;

            ScopedContext context = await ScopedContextSource.Task.OrCanceled(InactivityToken);

            await context.ConsumeContext.Task.OrCanceled(InactivityToken);

            await context.ConsumeContextEasyA.Task.OrCanceled(InactivityToken);

            await context.SendContext.Task.OrCanceled(InactivityToken);

            Assert.ThrowsAsync <TimeoutException>(async() => await context.ConsumeContextEasyB.Task.OrTimeout(s: 2));
        }
Example #7
0
 public ScopedSendFilter(ScopedContext scopedContext)
 {
     _scopedContext = scopedContext;
 }
Example #8
0
 public ScopedConsumeFilter(ScopedContext scopedContext)
 {
     _scopedContext = scopedContext;
 }
Example #9
0
 public EasyBConsumer(TaskCompletionSource <ConsumeContext <EasyB> > received, ScopedContext scopedContext)
 {
     _received      = received;
     _scopedContext = scopedContext;
 }
Example #10
0
 protected ReactiveSystemG(Contexts contexts) : base(contexts.Get <TS>())
 {
     _contexts = contexts;
     Scope     = contexts.Get <TS>();
 }
Example #11
0
 public static Entity <TScope> GetEntityById <TScope, TComp>(this ScopedContext <TScope> context, Int32 id)
     where TScope : IScope
     where TComp : Scope <TScope>
 {
     return(context.GetEntity(nameof(Id), id));
 }
Example #12
0
 public static void                                    AddEntityIndex <TScope, TComp>(ScopedContext <TScope> context)
     where TScope : IScope
     where TComp : IComponent, Scope <TScope>
 {
     context.AddEntityIndex(
         nameof(Id)
         , context.GetGroup(Matcher <TScope, TComp> .I)
         , (e, c) => ((StructComponent <Id>)c).Data.Value);
 }
Example #13
0
        public static void                                    Init_Manually <TScope, TIdComp>  (ScopedContext <TScope> context)
            where TScope : IScope
            where TIdComp : struct, IComponent, Scope <TScope>
        {
            if (Lookup <TScope, Id> .Id < 0)
            {
                //Debug.Log( "No " + typeof(Id) +" component in " + typeof( TScope ) );
                return;
            }

            context.OnEntityCreated += (context1, entity) =>
            {
                // TODO: comment why Replace and not Add
                var componentLookupId = Lookup <TScope, Id> .Id;
                var component         = entity.CreateComponent <StructComponent <Id> >(componentLookupId);
                component.Data = new Id(entity.creationIndex, context1);
                entity.ReplaceComponent(componentLookupId, component);
            };

            AddEntityIndex <TScope, TIdComp>(context);
        }
Example #14
0
 internal MsSqlBulkCopy(ScopedContext context, DbDataReader reader, string destinationTable, SqlBulkOptions bulkOptions, params string[] fields)
     : base(context, reader, destinationTable, bulkOptions, fields)
 {
 }
Example #15
0
 protected override BulkCopy GetBulkCopy(ScopedContext context, DbDataReader reader, string destinationTable, BulkOptions bulkOptions, params string[] fields)
 {
     return(new MsSqlBulkCopy(context, reader, destinationTable, (SqlBulkOptions)bulkOptions, fields));
 }
 public InputSystem(Contexts contexts)
 {
     _context = contexts.Scope <InputScope>();
 }