Ejemplo n.º 1
0
 public void RemoveObserver(IGuideObserver ob)
 {
     if (m_GuideStepObservers.Contains(ob))
     {
         m_GuideStepObservers.Remove(ob);
     }
 }
Ejemplo n.º 2
0
        public async Task GuideJoinLobby(ILobbyObserver lobbyObserver, IGuideObserver guideObserver)
        {
            var lobbyId = _lobbiesWaitingForGuides.Any() ? _lobbiesWaitingForGuides.First() : Guid.NewGuid();
            var lobby   = GrainFactory.GetGrain <ILobbyGrain>(lobbyId);

            await lobby.GuideJoin(lobbyObserver, guideObserver);
        }
Ejemplo n.º 3
0
        public Task Unsubscribe(IGuideObserver guideObserver)
        {
            var scavengerGrain = GrainFactory.GetGrain <IScavengerGrain>(_scavengerId);

            scavengerGrain.UnsubscribeGuide(guideObserver);

            return(TaskDone.Done);
        }
Ejemplo n.º 4
0
        public void AddObserver(IGuideObserver ob)
        {
            if (!m_GuideStepObservers.Contains(ob))
            {
                //if (AppConfig.S.isGuideActive && GameDataMgr.S.GetWorldData().GetCurAreaMaxUnlockedBlockId() < 6)
                //    ob.InitObjectByGuideStep();

                m_GuideStepObservers.Add(ob);
            }
        }
Ejemplo n.º 5
0
        public async Task SetClient(GuideClient client)
        {
            _client        = client;
            _guideObserver = await GrainClient.GrainFactory.CreateObjectReference <IGuideObserver>(client);

            _lobbyObserver = await GrainClient.GrainFactory.CreateObjectReference <ILobbyObserver>(client);

            if (client.GuideId.HasValue)
            {
                var guideGrain = GrainClient.GrainFactory.GetGrain <IGuideGrain>(client.GuideId.Value);
                await guideGrain.Subscribe(_guideObserver);
            }
        }
Ejemplo n.º 6
0
        public Task GuideJoin(ILobbyObserver lobbyObserver, IGuideObserver guideObserver)
        {
            Subscribe(lobbyObserver);
            _guideObserver = guideObserver;

            var guideGrain = GrainFactory.GetGrain <IGuideGrain>(Guid.NewGuid());

            _lobby.AddGuide(guideGrain.GetPrimaryKey());

            Console.WriteLine($"Guide {_lobby.GuideId} joined Lobby { this.GetPrimaryKey()}");

            if (_lobby.IsWaitingForScavenger)
            {
                var lobbyManagerGrain = GrainFactory.GetGrain <ILobbyManagerGrain>(0);
                lobbyManagerGrain.AddLobbyWaitingForScavenger(this.GetPrimaryKey());
            }

            return(TaskDone.Done);
        }
Ejemplo n.º 7
0
 public Task UnsubscribeGuide(IGuideObserver observer)
 {
     this._guideObservers.Unsubscribe(observer);
     return(TaskDone.Done);
 }
Ejemplo n.º 8
0
 public Task SubscribeGuide(IGuideObserver observer)
 {
     this._guideObservers.Clear();
     this._guideObservers.Subscribe(observer);
     return(TaskDone.Done);
 }