コード例 #1
0
    public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
    {
        if (BoltNetwork.IsServer)
        {
            if (full == false)
            {
                full = true;
                PhotonRoomProperties myToken = new PhotonRoomProperties
                {
                    IsOpen    = false,
                    IsVisible = false,
                };

                myToken.AddRoomProperty("t", 3);

                var matchName = staticData.lobbyName;

                BoltNetwork.SetServerInfo(matchName, myToken);

                BoltNetwork.Accept(endpoint);
            }
            else
            {
                BoltNetwork.Refuse(endpoint);
            }
        }
    }
コード例 #2
0
        public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
        {
            BoltLog.Warn("Connect Request");

            //token should be ServerConnectToken
            if (token != null)
            {
                BoltLog.Warn(token.GetType().ToString());

                ServerConnectToken t = token as ServerConnectToken;
                BoltLog.Warn("Server Token: null? " + (t == null));
                BoltLog.Warn("Data: " + t.data);
            }
            else
            {
                BoltLog.Warn("Received token is null");
            }

            ServerAcceptToken acceptToken = new ServerAcceptToken
            {
                data = "Accepted"
            };

            BoltNetwork.Accept(endpoint, acceptToken);
        }
コード例 #3
0
        public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
        {
            if (BoltNetwork.IsServer)
            {
                if (full == false)
                {
                    full = true;

                    PhotonRoomProperties roomProperties = new PhotonRoomProperties
                    {
                        IsOpen    = false,
                        IsVisible = true
                    };

                    var matchName = Guid.NewGuid().ToString();

                    BoltNetwork.SetServerInfo(matchName, roomProperties);
                    BoltNetwork.Accept(endpoint);

                    Debug.Log("Accept Client");
                }
                else
                {
                    BoltNetwork.Refuse(endpoint);

                    Debug.Log("Refuse Client");
                }
            }
        }
コード例 #4
0
        public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
        {
            if (BoltNetwork.IsServer)
            {
                if (full == false)
                {
                    full = true;

                    PhotonRoomProperties roomProperties = new PhotonRoomProperties
                    {
                        IsOpen    = false,
                        IsVisible = true
                    };

                    BoltMatchmaking.UpdateSession(roomProperties);

                    BoltNetwork.Accept(endpoint);

                    Debug.Log("Accept Client");
                }
                else
                {
                    BoltNetwork.Refuse(endpoint);

                    Debug.Log("Refuse Client");
                }
            }
        }
コード例 #5
0
        public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
        {
            var userToken   = (UserToken)token;
            var newEventLog = Instantiate(eventLogTextPrefab, eventLogContainer);

            newEventLog.text = userToken.Username + " has requested a connection to the session.";

            if (!BoltNetwork.IsServer)
            {
                return;
            }

            if (!(BoltMatchmaking.CurrentSession is PhotonSession))
            {
                return;
            }

            if (_usePlayerAmountSettings)
            {
                if (BoltMatchmaking.CurrentSession.ConnectionsCurrent <= _maxPlayers)
                {
                    if (_requirePassword)
                    {
                        if (userToken.Password != _password)
                        {
                            BoltNetwork.Refuse(endpoint, new BoltDisconnectToken("Wrong Password", UdpConnectionDisconnectReason.Authentication));
                            return;
                        }

                        BoltNetwork.Accept(endpoint);
                    }
                    else
                    {
                        BoltNetwork.Accept(endpoint);
                    }
                }
                else
                {
                    BoltNetwork.Refuse(endpoint, new BoltDisconnectToken("Session is Full", UdpConnectionDisconnectReason.MaxCCUReached));
                }
            }
            else
            {
                if (_requirePassword)
                {
                    if (userToken.Password != _password)
                    {
                        BoltNetwork.Refuse(endpoint, new BoltDisconnectToken("Wrong Password", UdpConnectionDisconnectReason.Authentication));
                        return;
                    }

                    BoltNetwork.Accept(endpoint);
                }
                else
                {
                    BoltNetwork.Accept(endpoint);
                }
            }
        }
コード例 #6
0
        public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
        {
            //base.ConnectRequest(endpoint, token);
            BoltConsole.Write("Connect request");
            ServerAcceptToken tok = new ServerAcceptToken();

            tok.playerIndex = BoltPhysicsCallbacks.numPlayers;
            BoltPhysicsCallbacks.numPlayers++;
            BoltNetwork.Accept(endpoint, tok);
        }
コード例 #7
0
        public override void ConnectRequest(UdpKit.UdpEndPoint endpoint, Bolt.IProtocolToken token)
        {
            BoltLog.Warn("ConnectRequest");

            if (token != null)
            {
                BoltLog.Info("Token Received");
            }

            BoltNetwork.Accept(endpoint);
        }
コード例 #8
0
        public override void ConnectRequest(UdpKit.UdpEndPoint endpoint, Bolt.IProtocolToken token)
        {
            BoltConsole.Write("ConnectRequest", Color.red);

            if (token != null)
            {
                BoltConsole.Write("Token Received", Color.red);
            }

            BoltNetwork.Accept(endpoint);
        }
コード例 #9
0
    public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
    {
        if (BoltNetwork.IsServer)
        {
            RoomProtocolToken myToken = new RoomProtocolToken()
            {
                ArbitraryData = staticData.myAdditiveWorld,
                password      = "******"
            };

            BoltNetwork.Accept(endpoint, myToken);
        }
    }
コード例 #10
0
ファイル: ServerCallbacks.cs プロジェクト: sdg9/HotPotato
    // Callback triggered when this instance receives an incoming client connection
    public override void ConnectRequest(UdpKit.UdpEndPoint endpoint)
    {
        print("S ConnectRequest 1");
        Vector3 connectedPlayerStarting = PlayerObjectRegistry.PlayerConnect();

        print("Connected starting: " + connectedPlayerStarting);

        if (PlayerObjectRegistry.connectedPlayerCount > 4)
        {
            BoltNetwork.Refuse(endpoint, null);
        }
        else
        {
            CameraSpawnPoint csp = new CameraSpawnPoint(connectedPlayerStarting);
            //print("Connect request, setting spawn point: " + csp.position);
            BoltNetwork.Accept(endpoint, null, csp, null);
        }
    }
コード例 #11
0
 void OnTicketResponse(SteamId steamid, SteamId owner, AuthResponse response)
 {
     if (pendingConnections.ContainsKey(steamid))
     {
         if (response == AuthResponse.OK)
         {
             BoltNetwork.Accept(pendingConnections[steamid], new SteamToken(steamid));
             pendingConnections.Remove(steamid);
             BoltLog.Info("Ticket valid, accepted connection.");
         }
         else
         {
             BoltNetwork.Refuse(pendingConnections[steamid]);
             pendingConnections.Remove(steamid);
             BoltLog.Info("Refused user for reason: " + response);
         }
     }
 }
コード例 #12
0
    public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
    {
        //check UserID and SessionID


        TestToken myToken = (TestToken)token;



        //ask GameLift to verify sessionID is valid, it will change player slot from "RESERVED" to "ACTIVE"
        Aws.GameLift.GenericOutcome outCome = GameLiftServerAPI.AcceptPlayerSession(myToken.ArbitraryData);
        if (outCome.Success)
        {
            BoltNetwork.Accept(endpoint);
        }
        else
        {
            BoltNetwork.Refuse(endpoint);
        }

        /*
         * This data type is used to specify which player session(s) to retrieve.
         * It can be used in several ways:
         * (1) provide a PlayerSessionId to request a specific player session;
         * (2) provide a GameSessionId to request all player sessions in the specified game session; or
         * (3) provide a PlayerId to request all player sessions for the specified player.
         * For large collections of player sessions,
         * use the pagination parameters to retrieve results as sequential pages.
         *
         */
        var aaa = new DescribePlayerSessionsRequest()
        {
            PlayerSessionId = myToken.ArbitraryData,
            // GameSessionId = myToken.ArbitraryData,
            // PlayerId =
        };



        Aws.GameLift.DescribePlayerSessionsOutcome DPSO = GameLiftServerAPI.DescribePlayerSessions(aaa);
        string TheirPlayerId = DPSO.Result.PlayerSessions[0].PlayerId;

        Debug.Log(TheirPlayerId);
    }
コード例 #13
0
    public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)         // reject the player if there are more than 10 players and if the game has started.
    {
        var connections = BoltNetwork.Connections.ToList();

        // https://doc.photonengine.com/en-us/bolt/current/connection-and-authentication/accept-refuse-connection
        if (connections.Count > MAX_PLAYERS | GameManager.instance.Game_Counter_Started)     // 10 players max; // reject if the game has started
        {
            BoltNetwork.Refuse(endpoint);

            /*
             * BoltMatchmaking.UpdateSession(new PhotonRoomProperties()
             * {
             *  IsOpen = false,
             *  IsVisible = false,
             * });*/
            return;
        }

        BoltNetwork.Accept(endpoint);
    }
コード例 #14
0
        public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
        {
            base.ConnectRequest(endpoint, token);

            if (!(token is ClientConnectionToken clientToken))
            {
                BoltNetwork.Refuse(endpoint, new ClientRefuseToken(ConnectRefusedReason.InvalidToken));
                return;
            }

            if (clientToken.UnityId == SystemInfo.unsupportedIdentifier)
            {
                BoltNetwork.Refuse(endpoint, new ClientRefuseToken(ConnectRefusedReason.UnsupportedDevice));
                return;
            }

            if (clientToken.Version != ServerToken.Version)
            {
                BoltNetwork.Refuse(endpoint, new ClientRefuseToken(ConnectRefusedReason.InvalidVersion));
                return;
            }

            BoltNetwork.Accept(endpoint);
        }
コード例 #15
0
 public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
 {
     BoltNetwork.Accept(endpoint);
     // BoltManager.Instance.Debug += "Connect Request" + endpoint.Address;
 }
コード例 #16
0
 public override void ConnectAttempt(UdpEndPoint endpoint, IProtocolToken token)
 {
     base.ConnectAttempt(endpoint, token);
     BoltNetwork.Accept(endpoint);
 }
コード例 #17
0
 public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
 {
     BoltNetwork.Accept(endpoint);
 }