//--------------------------------------------------------------------- public override async Task OnSessionDestroy() { //Console.WriteLine("GatewaySessionListener.OnSessionDestroy()"); var task = await Task.Factory.StartNew<Task>(async () => { var grain_clientproxy = GrainClient.GrainFactory.GetGrain<IGrainClientProxy>(this.clientGuid); await grain_clientproxy.UnsubClient(this.clientWatcherWeak); this.clientWatcher = null; this.clientWatcherWeak = null; }); }
//--------------------------------------------------------------------- public override async Task OnSessionCreate() { //Console.WriteLine("GatewaySessionListener.OnSessionCreate()"); this.clientGuid = Guid.NewGuid(); var task = await Task.Factory.StartNew<Task>(async () => { var grain_clientproxy = GrainClient.GrainFactory.GetGrain<IGrainClientProxy>(this.clientGuid); this.clientWatcher = new GatewayClientObserver(this); this.clientWatcherWeak = await GrainClient.GrainFactory.CreateObjectReference<IGrainClientObserver>(this.clientWatcher); await grain_clientproxy.SubClient(this.clientWatcherWeak); }); }
//--------------------------------------------------------------------- Task IGrainClientProxy.SubClient(IGrainClientObserver sub) { Observer = sub; return TaskDone.Done; }
//--------------------------------------------------------------------- Task IGrainClientProxy.UnsubClient(IGrainClientObserver sub) { Observer = null; _playerLeaveWorld(); this.DeactivateOnIdle(); return TaskDone.Done; }