예제 #1
0
        public override void BoltStartDone()
        {
            if (!BoltNetwork.isRunning)
            {
                return;
            }

            if (BoltNetwork.isServer)
            {
                RoomProtocolToken token = new RoomProtocolToken()
                {
                    ArbitraryData = "My DATA",
                };

                BoltLog.Info("Starting Server");
                // Start Photon Room
                BoltNetwork.SetServerInfo(_matchName, token);

                // Setup Host
                infoPanel.gameObject.SetActive(false);
                ChangeTo(lobbyPanel);

                backDelegate = Stop;
                SetServerInfo("Host", "");

                // Build Server Entity
                //BoltEntity entity = BoltNetwork.Instantiate(BoltPrefabs.PlayerInfo);
                //entity.TakeControl();
            }
            else if (BoltNetwork.isClient)
            {
                backDelegate = Stop;
                SetServerInfo("Client", "");
            }
        }
예제 #2
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;
            }
        }
예제 #3
0
    IEnumerator UpdateSessionInfo()
    {
        while (true)
        {
            IProtocolToken token = null;

            switch (Random.Range(1, 3))
            {
            case 1:
                token = new RoomProtocolToken()
                {
                    ArbitraryData = string.Format("My DATA :: {0}", Random.Range(1, 100)),
                    password      = "******"
                };

                break;

            case 2:
                token = new PhotonRoomProperties();

                ((PhotonRoomProperties)token).AddRoomProperty("t", Random.Range(1, 100));
                ((PhotonRoomProperties)token).AddRoomProperty("m", Random.Range(1, 100));

                break;
            }

            if (token != null)
            {
                BoltNetwork.SetServerInfo(null, token);
            }

            yield return(new WaitForSeconds(30));
        }
    }
예제 #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
 public void LaunchGame()
 {
     if (BoltNetwork.IsServer)
     {
         var roomToken = new RoomProtocolToken()
         {
             Gamemode = _lobbyData.ChosenGamemode
         };
         BoltNetwork.LoadScene(_lobbyData.ChosenMapName, roomToken);
     }
     else
     {
         Debug.LogWarning("Can't launch game if you are not the server.");
     }
 }
예제 #6
0
    public override void BoltStartDone()
    {
        if (BoltNetwork.isClient)
        {
            UdpEndPoint endPoint = new UdpEndPoint(UdpIPv4Address.Parse(serverAddress), (ushort)serverPort);

            RoomProtocolToken token = new RoomProtocolToken();
            token.ArbitraryData = "Room Token";

            BoltNetwork.Connect(endPoint, token);
        }
        else
        {
            BoltNetwork.LoadScene(map);
        }
    }
예제 #7
0
        public override void BoltStartDone()
        {
            BoltConsole.Write("BoltStartDone breh");
            if (!BoltNetwork.IsRunning)
            {
                return;
            }

            if (BoltNetwork.IsServer)
            {
                RoomProtocolToken token = new RoomProtocolToken()
                {
                    ArbitraryData = "My DATA",
                };

                BoltLog.Info("Starting Server");
                // Start Photon Room
                BoltNetwork.SetServerInfo(_matchName, token);
                //BoltNetwork.EnableLanBroadcast();
                // Setup Host
                infoPanel.gameObject.SetActive(false);
                //PanelHolder.instance.hideConnectingPanel();
                ChangeTo(lobbyPanel);

                backDelegate = Stop;
                SetServerInfo("Host", "");
                connection_spellcaster = new Dictionary <string, int>();
                //SoundManager.instance.musicSource.Play();

                // Build Server Entity

                characterSelection = BoltNetwork.Instantiate(BoltPrefabs.CharacterSelectionEntity);
                characterSelection.TakeControl();

                gameStateEntity = BoltNetwork.Instantiate(BoltPrefabs.GameState);
                gameStateEntity.TakeControl();
                gameStateEntity.GetComponent <NetworkGameState>().onCreateRoom(_matchName);

                numPlayersInfo.text = gameStateEntity.GetComponent <NetworkGameState>().onPlayerJoined() + "";
            }
            else if (BoltNetwork.IsClient)
            {
                backDelegate = Stop;
                SetServerInfo("Client", "");
            }
        }