Esempio n. 1
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");
                }
            }
        }
Esempio n. 2
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         BoltMatchmaking.CreateSession(sessionID: Guid.NewGuid().ToString());
     }
 }
        public override void BoltStartDone()
        {
            if (BoltNetwork.IsServer)
            {
                // Create some room custom properties
                PhotonRoomProperties roomProperties = new PhotonRoomProperties();

                roomProperties.AddRoomProperty("t", GameType); // ex: game type
                roomProperties.AddRoomProperty("m", Map);      // ex: map id

                roomProperties.IsOpen    = true;
                roomProperties.IsVisible = true;

                // If RoomID was not set, create a random one
                if (RoomID.Length == 0)
                {
                    RoomID = Guid.NewGuid().ToString();
                }

                // Create the Photon Room
                BoltMatchmaking.CreateSession(
                    sessionID: RoomID,
                    token: roomProperties,
                    sceneToLoad: Map
                    );

                // BoltNetwork.SetServerInfo(RoomID, roomProperties);
                // BoltNetwork.LoadScene(Map);
            }
        }
Esempio n. 4
0
        public override void SessionListUpdated(Map <Guid, UdpSession> sessionList)
        {
            if (_timerRoutine != null)
            {
                StopCoroutine(_timerRoutine);
                _timerRoutine = null;
            }

            Debug.LogFormat("Session list updated: {0} total sessions", sessionList.Count);

            foreach (var session in sessionList)
            {
                PhotonSession photonSession = session.Value as PhotonSession;

                if (photonSession != null && photonSession.Source == UdpSessionSource.Photon)
                {
                    object value;
                    if (photonSession.Properties.TryGetValue("type", out value))
                    {
                        BoltLog.Info("Room with type: {0}", value);
                    }

                    if (photonSession.Properties.TryGetValue("map", out value))
                    {
                        BoltLog.Info("Room with map: {0}", value);
                    }

                    BoltMatchmaking.JoinSession(photonSession);
                }
            }
        }
Esempio n. 5
0
        private IEnumerator StartServerRoutine(ServerRoomToken serverToken, Action onStartSuccess, Action onStartFail)
        {
            if (BoltNetwork.IsRunning && !BoltNetwork.IsServer)
            {
                BoltLauncher.Shutdown();

                yield return(new WaitUntil(NetworkIsInactive));
            }

            state = State.Starting;

            BoltLauncher.StartServer(config);
            yield return(new WaitUntil(NetworkIsIdle));

            for (int i = 0; i < 3; i++)
            {
                yield return(new WaitForEndOfFrame());
            }

            if (BoltNetwork.IsServer)
            {
                onStartSuccess?.Invoke();

                BoltMatchmaking.CreateSession(Guid.NewGuid().ToString(), serverToken, serverToken.Map);
            }
            else
            {
                onStartFail?.Invoke();
            }
        }
Esempio n. 6
0
 private void JoinEventHandler(UdpSession session)
 {
     if (BoltNetwork.IsClient)
     {
         BoltMatchmaking.JoinSession(session);
     }
 }
Esempio n. 7
0
        public override void BoltStartDone()
        {
            if (BoltNetwork.IsServer)
            {
                var token = new RoomProtocolToken()
                {
                    ArbitraryData = "My DATA",
                };

                BoltLog.Info("Starting Server");

                // Start Photon Room
                BoltMatchmaking.CreateSession(
                    sessionID: matchName,
                    token: token
                    );
            }
            else if (BoltNetwork.IsClient)
            {
                if (randomJoin)
                {
                    BoltMatchmaking.JoinRandomSession();
                }
                else
                {
                    ClientStaredUIHandler();
                }

                randomJoin = false;
            }
        }
Esempio n. 8
0
 public override void SessionListUpdated(Map <Guid, UdpSession> sessionList)
 {
     FeedbackUser("Searching ...");
     //On rejoin le seul server qui existe pour le moment
     //Vu que le server est dans PlayScene on va essayer de load ca
     BoltMatchmaking.JoinSession(HeadlessServerManager1.RoomID());
 }
Esempio n. 9
0
        public override void BoltStartDone()
        {
            if (BoltNetwork.IsServer)
            {
                string matchName = Guid.NewGuid().ToString();

                var props = new PhotonRoomProperties();

                props.IsOpen    = true;
                props.IsVisible = true;

                props["type"] = "game01";
                props["map"]  = "Tutorial1";

                BoltMatchmaking.CreateSession(
                    sessionID: matchName,
                    sceneToLoad: "Tutorial1",
                    token: props
                    );
            }

            if (BoltNetwork.IsClient)
            {
                // This will start a server after 10secs of wait
                // if no server was found
                _timerRoutine = StartCoroutine(ShutdownAndStartServer());
            }
        }
Esempio n. 10
0
        public override void CreateSession(string sessionName, OperationResultDelegate onComplete)
        {
            if (State != NetworkState.Running)
            {
                Log.Info(LogChannel, "[PhotonNetworkInterface] Cannot create session if not in running state");
                return;
            }

            if (!BoltNetwork.IsServer)
            {
                Log.Info(LogChannel, "[PhotonNetworkInterface] Cannot create session if not of type server");
                return;
            }

            _operationCallbackSessionCreated = onComplete;

            // Create some room custom properties
            PhotonRoomProperties roomProperties = new PhotonRoomProperties();

            roomProperties.IsOpen    = true;
            roomProperties.IsVisible = true;

            // Create the Photon Room
            BoltMatchmaking.CreateSession(sessionName, roomProperties);

            Log.Info(LogChannel, "[PhotonNetworkInterface] Session creation begun...");
        }
Esempio n. 11
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         BoltMatchmaking.CreateSession(sessionID: matchName.text, sceneToLoad: "Zoom");
     }
 }
Esempio n. 12
0
 public override void BoltStartDone()
 {
     BoltMatchmaking.CreateSession(
         sessionID: Guid.NewGuid().ToString(),
         sceneToLoad: "Main"
         );
 }
Esempio n. 13
0
        void State_SelectRoom()
        {
            GUI.Label(labelRoom, "Looking for rooms:", labelRoomStyle);

            if (BoltNetwork.SessionList.Count > 0)
            {
                GUILayout.BeginVertical();
                GUILayout.Space(30);

                foreach (var session in BoltNetwork.SessionList)
                {
                    var photonSession = session.Value as PhotonSession;

                    if (photonSession.Source == UdpSessionSource.Photon)
                    {
                        var matchName = photonSession.HostName;
                        var label     = string.Format("Join: {0} | {1}/{2}", matchName, photonSession.ConnectionsCurrent, photonSession.ConnectionsMax);

                        if (ExpandButton(label))
                        {
                            BoltMatchmaking.JoinSession(photonSession);
                            state = State.Started;
                        }
                    }
                }

                GUILayout.EndVertical();
            }
        }
Esempio n. 14
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsClient)
     {
         BoltMatchmaking.JoinRandomSession();
     }
 }
Esempio n. 15
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         PlayerPrefs.SetString("currentSession", SessionInput.text);
         BoltMatchmaking.CreateSession(sessionID: SessionInput.text, sceneToLoad: "FPSGame");
     }
 }
Esempio n. 16
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         BoltMatchmaking.CreateSession(serverName);
         BoltNetwork.LoadScene("DisCo-Scene");
     }
 }
Esempio n. 17
0
    //
    // public override void BoltStartBegin()
    // {
    //   BoltNetwork.RegisterTokenClass<PhotonRoomProperties>();
    // }

    public override void BoltStartDone()
    {
        if (BoltNetwork.IsServer)
        {
            BoltMatchmaking.CreateSession(sessionID: "test", sceneToLoad: sceneToLoad);
        }

        // BoltNetwork.EnableLanBroadcast();
    }
Esempio n. 18
0
 /// <summary>
 /// Wheneever either client or server network starts
 /// </summary>
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         string roomName = "Test Match";
         BoltMatchmaking.CreateSession(roomName);
         //BoltNetwork.LoadScene("Game");
     }
 }
Esempio n. 19
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         string matchName = Guid.NewGuid().ToString() + serverName.text;
         BoltMatchmaking.CreateSession(matchName, null);
         BoltNetwork.LoadScene(levelsselect.captionText.text);
     }
 }
    private void CreateSession()
    {
        string matchName = startServerSessionIdInputField.text.Trim();

        BoltMatchmaking.CreateSession(
            sessionID: matchName,
            sceneToLoad: "Lobby"
        );
    }
Esempio n. 21
0
    public override void BoltStartDone()
    {
        if (BoltNetwork.IsServer)
        {
            string matchName = Guid.NewGuid().ToString();

            BoltMatchmaking.CreateSession(sessionID: matchName, sceneToLoad: "Multiplayer");
        }
    }
Esempio n. 22
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         BoltNetwork.RegisterTokenClass <PhotonRoomProperties>();
         PhotonRoomProperties token = new PhotonRoomProperties();
         token.AddRoomProperty("roomName", GameObject.FindWithTag("NewRoomNameInputField").GetComponent <TMP_InputField>().text);
         BoltMatchmaking.CreateSession(sessionID: Guid.NewGuid().ToString(), sceneToLoad: "Game", token: token);
     }
 }
Esempio n. 23
0
    public override void BoltStartDone()
    {
        if (BoltNetwork.IsServer)
        {
            string matchName = lobbyname.GetComponent <UnityEngine.UI.Text>().text;

            BoltMatchmaking.CreateSession(matchName);
            BoltNetwork.LoadScene("Main");
        }
    }
Esempio n. 24
0
        public override void ConnectToSession(INetworkInterfaceSession session, OperationResultDelegate onComplete)
        {
            _operationCallbackSessionConnected = onComplete;

            UdpSession udpSession = ((PhotonNetworkInterfaceSession)session).UdpSession;

            BoltMatchmaking.JoinSession(udpSession);

            _connectedSessionInfo = session;
        }
    public override void BoltStartDone()
    {
        if (!BoltNetwork.IsServer)
        {
            return;
        }

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

        BoltMatchmaking.CreateSession(matchName, null, "Game");
    }
Esempio n. 26
0
    public override void BoltStartDone()
    {
        if (BoltNetwork.IsServer)
        {
            string matchName = Guid.NewGuid().ToString();

            //BoltNetwork.SetServerInfo(matchName, null);
            BoltMatchmaking.CreateSession(matchName, null);
            BoltNetwork.LoadScene("Main");
        }
    }
Esempio n. 27
0
 public override void SessionListUpdated(Map <Guid, UdpSession> sessionList)
 {
     foreach (var session in sessionList)
     {
         UdpSession photonSession = session.Value as UdpSession;
         if (photonSession.Source == UdpSessionSource.Photon)
         {
             BoltMatchmaking.JoinSession(photonSession);
         }
     }
 }
Esempio n. 28
0
 public override void BoltStartDone()
 {
     // If we pressed join game, join a random session
     if (BoltNetwork.IsClient)
     {
         BoltMatchmaking.JoinRandomSession();
     }
     else if (offlineMode)
     {
         BoltNetwork.LoadScene(GameData.ScenesInBuild.scenes[1]);
     }
 }
Esempio n. 29
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         currentSession = PlayerPrefs.GetString("currentSession");
         BoltMatchmaking.CreateSession(sessionID: currentSession, sceneToLoad: "FPSGame");
     }
     else
     {
         BoltMatchmaking.JoinSession(currentSession);
     }
 }
Esempio n. 30
0
    public override void BoltStartDone()
    {
        if (BoltNetwork.IsServer)
        {
            //BoltMatchmaking.CreateSession(Guid.NewGuid().ToString(), null, "SampleScene");

            BoltMatchmaking.CreateSession(
                sessionID: "Jocasta",
                sceneToLoad: "SampleScene"
                );
        }
    }