예제 #1
0
 // Update is called once per frame
 //void Update () {
 //}
 public void addEntry(string playerName, KDR kdr = new KDR())
 {
     if(kdrTable != null)
     {
         kdrTable.Add(playerName, kdr);
     }
     else
     {
         Debug.LogError("Could not add to KDR table, because table does not exist.");
     }
 }
예제 #2
0
파일: Program.cs 프로젝트: lotrzyk/KDR
        static async Task Main(string[] args)
        {
            var sc = new ServiceCollection();

            sc.AddLogging(c => c.AddConsole());

            KDR.CreateEventBus(sc);
            KDR.MapDestination <Event>("kolejka");
            KDR.UseDefaultDestinationAddressProvider(sc);
            sc.AddSingleton <IDataStorage, InMemoryDataStorage>();
            sc.AddSingleton <ITransportSenderClient, InMemorySenderClient>();
            sc.AddSingleton <IProcessorsManager, ProcessorsManager>();
            var sp = sc.BuildServiceProvider();

            var pm = sp.GetRequiredService <IProcessorsManager>();
            var eb = sp.GetRequiredService <IEventBus>();

            await pm.StartAsync();

            using (var ts = new TransactionScope())
            {
                await eb.PublishEventAsync(new Event());

                ts.Complete();
            }

            do
            {
                var key = Console.ReadLine();
                if (key == "p")
                {
                    await eb.PublishEventAsync(new Event());
                }
                else if (key == "d")
                {
                    await pm.DisposeAsync();
                }
            } while (true);
        }