public void TestConfig() { var one = VersaCommsID.FromEnum(EVersaCommIDType.User, ulong.MinValue); var two = VersaCommsID.FromEnum(EVersaCommIDType.User, ulong.MaxValue); Assert.True(true); }
public IdentityPlayer() { VersaID = VersaCommsID.FromEnum(EVersaCommIDType.User, 0); Currencies = new Dictionary <int, int>(); OwnedCharacters = new List <VersaCommsID>(); PlayerInventory = new List <IItem>(); }
public static ModelBuilder SupportIPlayerIdentity <TIdentity, TKey>(this ModelBuilder b) where TIdentity : IdentityUser <TKey>, IPlayer where TKey : IEquatable <TKey> { b.HasSequence <long>("IDEnumerator", "versagen") .IncrementsBy(1) .StartsAt(Convert.ToInt64(VersaCommsID.FromEnum(EVersaCommIDType.User, ulong.MinValue))) .HasMax(Convert.ToInt64(VersaCommsID.FromEnum(EVersaCommIDType.User, ulong.MaxValue))) .IsCyclic(); b.ApplyConfiguration(new IdentityPlayerConfig <TIdentity, TKey>()); return(b); }
protected virtual VersaCommsID CreateNewUser(TExternalID externalUser) { //TODO: fire off other functions needed to create a new user, like creating tables for them in the database and such. var rand = new Random(); byte[] buf = new byte[8]; rand.NextBytes(buf); ulong resul = BitConverter.ToUInt64(buf, 0); return(VersaCommsID.FromEnum(EVersaCommIDType.User, resul)); }
public async void AsyncDisposeTest() { pipe = new EventPipe(); var endThing = new TaskCompletionSource <bool>(); var disposer = new RefCountDisposable(Disposable.Create(() => endThing.SetResult(true))); for (var i = 0; i < 100; i++) { pipe.ObserveFirst.Subscribe(new TestObserver(i, outp, "first", disposer.GetDisposable())); pipe.ObserveConcurrent.Subscribe(new TestObserver(i, outp, "reader", disposer.GetDisposable())); pipe.ObserveSynchronous.Subscribe(new TestObserver(i, outp, "writer", disposer.GetDisposable())); } disposer.Dispose(); //var testTask = new List<Task>(); var totalDisposer = new RefCountDisposable(Disposable.Create(() => pipe.Complete())); var rand = new Random(); Parallel.ForEach(Enumerable.Range(0, 99), async x => { using (totalDisposer.GetDisposable()) { using (var scp = testProv.CreateScope()) { var e = new MessageEvent { IgnoreThis = false, Services = scp.ServiceProvider.CreateScope().ServiceProvider, Scenario = VersaCommsID.FromEnum(EVersaCommIDType.Scenario, 0), Player = new UnionType <VersaCommsID, IPlayer>(0), Terminal = new UnionType <VersaCommsID, IVersaWriter>(0), FullMessage = x.ToString(), Entity = new UnionType <VersaCommsID, IEntity>(0), }; await Task.Yield(); await pipe.ProcessEvent(e); } } }); //totalDisposer.Dispose(); //scp.Dispose(); //await Task.WhenAll(testTask); await Task.Delay(200); totalDisposer.Dispose(); //await Task.Delay(200); await endThing.Task; //pipe.Dispose(); }
public IScenario BuildWorldScenario(IServiceProvider provider) { return(_Scenarios.GetOrAdd(VersaCommsID.FromEnum(EVersaCommIDType.Scenario, 0), new Scenario(VersaCommsID.FromEnum(EVersaCommIDType.Scenario, 0), provider))); }