예제 #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");
                }
            }
        }
예제 #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);
            }
        }
예제 #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);
                }
            }
        }
예제 #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();
            }
        }
예제 #6
0
 private void JoinEventHandler(UdpSession session)
 {
     if (BoltNetwork.IsClient)
     {
         BoltMatchmaking.JoinSession(session);
     }
 }
예제 #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;
            }
        }
예제 #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());
 }
예제 #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());
            }
        }
예제 #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...");
        }
예제 #11
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         BoltMatchmaking.CreateSession(sessionID: matchName.text, sceneToLoad: "Zoom");
     }
 }
예제 #12
0
 public override void BoltStartDone()
 {
     BoltMatchmaking.CreateSession(
         sessionID: Guid.NewGuid().ToString(),
         sceneToLoad: "Main"
         );
 }
예제 #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();
            }
        }
예제 #14
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsClient)
     {
         BoltMatchmaking.JoinRandomSession();
     }
 }
예제 #15
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         PlayerPrefs.SetString("currentSession", SessionInput.text);
         BoltMatchmaking.CreateSession(sessionID: SessionInput.text, sceneToLoad: "FPSGame");
     }
 }
예제 #16
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         BoltMatchmaking.CreateSession(serverName);
         BoltNetwork.LoadScene("DisCo-Scene");
     }
 }
예제 #17
0
    //
    // public override void BoltStartBegin()
    // {
    //   BoltNetwork.RegisterTokenClass<PhotonRoomProperties>();
    // }

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

        // BoltNetwork.EnableLanBroadcast();
    }
예제 #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");
     }
 }
예제 #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"
        );
    }
예제 #21
0
    public override void BoltStartDone()
    {
        if (BoltNetwork.IsServer)
        {
            string matchName = Guid.NewGuid().ToString();

            BoltMatchmaking.CreateSession(sessionID: matchName, sceneToLoad: "Multiplayer");
        }
    }
예제 #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);
     }
 }
예제 #23
0
    public override void BoltStartDone()
    {
        if (BoltNetwork.IsServer)
        {
            string matchName = lobbyname.GetComponent <UnityEngine.UI.Text>().text;

            BoltMatchmaking.CreateSession(matchName);
            BoltNetwork.LoadScene("Main");
        }
    }
예제 #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");
    }
예제 #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");
        }
    }
예제 #27
0
파일: Menu.cs 프로젝트: manhiem/Scribble
 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);
         }
     }
 }
예제 #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]);
     }
 }
예제 #29
0
 public override void BoltStartDone()
 {
     if (BoltNetwork.IsServer)
     {
         currentSession = PlayerPrefs.GetString("currentSession");
         BoltMatchmaking.CreateSession(sessionID: currentSession, sceneToLoad: "FPSGame");
     }
     else
     {
         BoltMatchmaking.JoinSession(currentSession);
     }
 }
예제 #30
0
    public override void BoltStartDone()
    {
        if (BoltNetwork.IsServer)
        {
            //BoltMatchmaking.CreateSession(Guid.NewGuid().ToString(), null, "SampleScene");

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