Beispiel #1
0
        public void OnPeerJoinedGameEvt(object sender, PeerJoinedGameArgs ga)
        {
            bool isLocal = ga.peer.PeerId == appl.LocalPeer.PeerId;

            if (isLocal && game == null)
            {
                logger.Info("practice game joined");
                // Create gameInstance and associated Apian
                game = new BeamAppCore(appl.frontend);
                game.PlayerJoinedEvt += OnMemberJoinedGroupEvt;
                game.NewBikeEvt      += OnNewBikeEvt;

                BeamApian apian = new BeamApianSinglePeer(appl.gameNet, game);
                appl.AddAppCore(game);
                // Dont need to check for groups in splash
                apian.CreateNewGroup(ApianGroupId, ApianGroupName);
                BeamPlayer mb = new BeamPlayer(appl.LocalPeer.PeerId, appl.LocalPeer.Name);
                apian.JoinGroup(ApianGroupId, mb.ApianSerialized());

                game.frontend?.OnStartMode(BeamModeFactory.kPractice, null);
                // waiting for OnGroupJoined()
            }
        }
Beispiel #2
0
        public void OnPeerJoinedGameEvt(object sender, PeerJoinedGameArgs ga)
        {
            bool isLocal = ga.peer.PeerId == appl.LocalPeer.PeerId;

            if (isLocal && _CurrentState == ModeState.JoiningGame)
            {
                logger.Info("Splash game joined");
                // Create gameInstance and associated Apian
                game = new BeamAppCore(appl.frontend);
                game.PlayerJoinedEvt += OnPlayerJoinedEvt;
                game.NewBikeEvt      += OnNewBikeEvt;
                BeamApian apian = new BeamApianSinglePeer(appl.gameNet, game); // This is the REAL one
                // BeamApian apian = new BeamApianCreatorServer(core.gameNet, game); // Just for quick tests of CreatorServer
                appl.AddAppCore(game);
                // Dont need to check for groups in splash
                apian.CreateNewGroup(ApianGroupId, ApianGroupName);
                BeamPlayer mb = new BeamPlayer(appl.LocalPeer.PeerId, appl.LocalPeer.Name);
                game.GroupJoinedEvt += OnGroupJoinedEvt;
                apian.JoinGroup(ApianGroupId, mb.ApianSerialized());
                _CurrentState = ModeState.JoiningGroup;
                // waiting for OnPlayerJoined(localplayer)
            }
        }