Пример #1
0
 public override void ConnectFailed(UdpEndPoint endpoint, IProtocolToken token)
 {
     if (this.gui)
     {
         this.gui.SetErrorText("Could not connect to server (attempt " + this._connectionAttempts + "/3)");
     }
     else
     {
         UnityEngine.Debug.LogError("could not connect to dedicated server: " + this.dedicatedHostEndPoint);
     }
 }
Пример #2
0
 public override void ConnectAttempt(UdpEndPoint endpoint, IProtocolToken token)
 {
     Debug.Log(string.Concat(new object[]
     {
         "ConnectAttempt: ",
         endpoint.Address,
         ":",
         endpoint.Port
     }));
     base.CancelInvoke("OnDisconnected");
     base.Invoke("OnDisconnected", (float)(6 * this._connectionAttempts));
 }
Пример #3
0
    public override void ConnectFailed(UdpEndPoint endpoint, IProtocolToken token)
    {
        if (_connectState == ConnectState.DirectPending)
        {
            ChangeState(ConnectState.DirectFailed);
        }

        if (_connectState == ConnectState.RelayPending)
        {
            ChangeState(ConnectState.RelayFailed);
        }
    }
Пример #4
0
    public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
    {
        if (BoltNetwork.IsServer)
        {
            RoomProtocolToken myToken = new RoomProtocolToken()
            {
                ArbitraryData = staticData.myAdditiveWorld,
                password      = "******"
            };

            BoltNetwork.Accept(endpoint, myToken);
        }
    }
Пример #5
0
    /// <summary>
    /// When a new client connects after the game was already started, this makes sure that it will
    /// load all already loaded additive scenes.
    /// </summary>
    public override void SceneLoadRemoteDone(BoltConnection connection, IProtocolToken token)
    {
        if (BoltNetwork.IsServer)
        {
            BoltLog.Warn("Remote Connection {0} has Loaded Scene", connection);

            foreach (var item in loadedScenes)
            {
                var evt = LoadSceneRequest.Create(connection, ReliabilityModes.ReliableOrdered);
                evt.SceneName = item;
                evt.Load      = true;
                evt.Send();
            }
        }
    }
Пример #6
0
        public override void SceneLoadLocalDone(string map, IProtocolToken token)
        {
            if (BoltNetwork.IsServer)
            {
                InitializeSpawns();

                RoomInfoToken = (RoomProtocolToken)token;
                _playersCount = RoomInfoToken.PlayersCount;

                // Instantiate server kart
                var serverTeam = _teamAssigner.PickAvailableTeam();
                AssignSpawn(SWMatchmaking.GetMyBoltId(), serverTeam);
                _teamAssigner.AddPlayer(serverTeam, SWMatchmaking.GetMyBoltId());
            }
        }
Пример #7
0
 public override void ConnectFailed(UdpEndPoint endpoint, IProtocolToken token)
 {
     if (this.gui)
     {
         this.gui.SetErrorText("Could not connect to server (attempt " + this._connectionAttempts + "/3)");
     }
     else
     {
         Debug.LogError("could not connect to dedicated server: " + SteamClientDSConfig.serverAddress);
     }
     this._connectionAttempts                      = 3;
     CoopClientCallbacks.OnDisconnected            = null;
     CoopPlayerCallbacks.WasDisconnectedFromServer = true;
     BoltLauncher.Shutdown();
     SteamClientConfig.KickMessage = ((!SteamClientDSConfig.isDedicatedClient) ? "Server timeout. Could not connect to this server." : "Server does not seem to be set up correctly");
     UnityEngine.Object.Destroy(base.gameObject);
     SceneManager.LoadScene("TitleScene", LoadSceneMode.Single);
 }
Пример #8
0
    public override void SceneLoadLocalDone(string scene, IProtocolToken token)
    {
        var spawnPos = new Vector3(Random.Range(-5, 5), 0, 0);

        if (myEntityPos != Vector3.zero)
        {
            spawnPos = myEntityPos;
        }

        myEntity = BoltNetwork.Instantiate(SpawnPrefab, spawnPos,
                                           Quaternion.EulerAngles(myEntityRot));
        myEntity.TakeControl();

        if (BoltNetwork.IsServer)
        {
            myEntity.GetState <IFPSPlayerState>().isServer = true;
        }
    }
Пример #9
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);
    }
    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);
    }
Пример #11
0
    public PartSpawnData(IProtocolToken _token, Vector3 _position, Quaternion _rotation, int _owner)
    {
        posX = _position.x;
        posY = _position.y;
        posZ = _position.z;

        rotX = _rotation.x;
        rotY = _rotation.y;
        rotZ = _rotation.z;
        rotW = _rotation.w;

        owner = _owner;


        if (_token.GetType() == typeof(PartToken))
        {
            PartToken token = (PartToken)_token;

            templateID = token.TemplateID;
            id         = token.ID;
            disabled   = token.Disabled;
            parent     = -1;
            parentCon  = -1;
            con        = -1;
        }
        else
        {
            PartTokenParent token = (PartTokenParent)_token;

            templateID = token.TemplateID;
            id         = token.ID;
            parent     = token.Parent;
            parentCon  = token.ParentCon;
            con        = token.Con;
            disabled   = token.Disabled;
        }
    }
Пример #12
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);
        }
Пример #13
0
        public override void SceneLoadLocalDone(string scene, IProtocolToken token)
        {
            Camera.main.backgroundColor = Color.green;

            Debug.LogFormat("Scene Load Done at {0}", scene);
        }
 public override void ConnectFailed(UdpEndPoint endpoint, IProtocolToken token)
 {
     BoltConsole.Write("ConnectFailed", Color.red);
     base.ConnectFailed(endpoint, token);
 }
Пример #15
0
 public override void SceneLoadLocalDone(string scene, IProtocolToken token)
 {
     Destroy(gameObject);
 }
    public override void SceneLoadLocalDone(string scene, IProtocolToken token)
    {
        BoltEntity player = BoltNetwork.Instantiate(BoltPrefabs.EthanServerAuth, new Vector3(0, -1f, 0), Quaternion.identity);

        player.TakeControl();
    }
    public override void SceneLoadRemoteDone(BoltConnection connection, IProtocolToken token)
    {
        BoltEntity player = BoltNetwork.Instantiate(BoltPrefabs.EthanServerAuth, new Vector3(0, -1f, 0), Quaternion.identity);

        player.AssignControl(connection);
    }
Пример #18
0
 public override void ConnectAttempt(UdpEndPoint endpoint, IProtocolToken token)
 {
     UnityEngine.Debug.Log("ConnectAttempt");
     base.CancelInvoke("OnDisconnected");
     base.Invoke("OnDisconnected", (float)(6 * this._connectionAttempts));
 }
Пример #19
0
 public override void ConnectAttempt(UdpEndPoint endpoint, IProtocolToken token)
 {
     base.ConnectAttempt(endpoint, token);
     Debug.Log("ConnectAttempt");
 }
Пример #20
0
 public void Event_SessionConnected(UdpSession session, IProtocolToken token)
 {
     // nothing to do at the moment
 }
Пример #21
0
 public void Event_ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
 {
     Log.Info(LogChannel, "[PhotonNetworkInterface] ConnectRequest: " + endpoint.Address + "  port: " + endpoint.Port);
 }
Пример #22
0
 public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token)
 {
     BoltNetwork.Accept(endpoint);
 }
Пример #23
0
        public void Event_ConnectRefused(UdpEndPoint endpoint, IProtocolToken token)
        {
            Log.Info(LogChannel, "[PhotonNetworkInterface] ConnectRefused: " + endpoint.Address + "  port: " + endpoint.Port);

            ConcludeOperationCallback(ref _operationCallbackSessionConnected, false, "Connection refused");
        }
Пример #24
0
 public override void ConnectRequest(UdpEndPoint endpoint, IProtocolToken token) => PhotonNetworkInterface.Event_ConnectRequest(endpoint, token);
Пример #25
0
        public void Event_SessionConnectFailed(UdpSession session, IProtocolToken token, UdpSessionError errorReason)
        {
            Log.Info(LogChannel, $"[PhotonNetworkInterface] SessionConnectFailed: session:{session.Id} name:{session.HostName} reason:{errorReason}");

            ConcludeOperationCallback(ref _operationCallbackSessionConnected, false, errorReason.ToString());
        }
Пример #26
0
 public override void SessionConnectFailed(UdpSession session, IProtocolToken token, UdpSessionError errorReason) => PhotonNetworkInterface.Event_SessionConnectFailed(session, token, errorReason);
Пример #27
0
 public override void SceneLoadRemoteDone(BoltConnection connection, IProtocolToken token)
 {
 }
Пример #28
0
 public override void SessionConnected(UdpSession session, IProtocolToken token) => PhotonNetworkInterface.Event_SessionConnected(session, token);
Пример #29
0
 public override void ConnectRefused(UdpEndPoint endpoint, IProtocolToken token)
 {
     BoltLog.Warn("Connect Refused");
     base.ConnectRefused(endpoint, token);
 }
 public override void ConnectAttempt(UdpEndPoint endpoint, IProtocolToken token)
 {
     BoltLog.Warn("Connect Attempt");
     base.ConnectAttempt(endpoint, token);
 }
        private void OnServerSpellLaunch(Unit caster, Vector3 source, SpellInfo spellInfo, IProtocolToken processingToken)
        {
            UnitSpellLaunchEvent unitCastEvent = UnitSpellLaunchEvent.Create(caster.BoltEntity, EntityTargets.Everyone);

            unitCastEvent.SpellId           = spellInfo.Id;
            unitCastEvent.ProcessingEntries = processingToken;
            unitCastEvent.Source            = source;
            unitCastEvent.Send();

            SpellCastRequestAnswerEvent spellCastAnswer = caster.IsController
                ? SpellCastRequestAnswerEvent.Create(GlobalTargets.OnlyServer, ReliabilityModes.ReliableOrdered)
                : SpellCastRequestAnswerEvent.Create(caster.BoltEntity.Controller, ReliabilityModes.ReliableOrdered);

            spellCastAnswer.SpellId           = spellInfo.Id;
            spellCastAnswer.Result            = (int)SpellCastResult.Success;
            spellCastAnswer.ProcessingEntries = processingToken;
            spellCastAnswer.Source            = source;
            spellCastAnswer.Send();
        }
 public override void ConnectRefused(UdpEndPoint endpoint, IProtocolToken token)
 {
     BoltLog.Info("ConnectRefused", Color.red);
     base.ConnectRefused(endpoint, token);
 }