public void BeginListening() { if (netDiscover.running) { EndBroadcast(); } netDiscover.StartAsClient(); }
private void OnGUI() { if (GUI.Button(new Rect(0, 0, 250, 20), "ホストとして起動")) { StartHost(); m_NetworkDiscovery.Initialize(); m_NetworkDiscovery.StartAsServer(); } if (GUI.Button(new Rect(0, 30, 250, 20), "クライアントとして接続")) { m_NetworkDiscovery.Initialize(); m_NetworkDiscovery.StartAsClient(); } }
/// <summary> /// Start as client and if discovery not running, start broadcast receive mode. /// </summary> public void SetupClient() { Debug.Log("SetupClient()"); ConnectionConfig config = new ConnectionConfig(); config.AddChannel(QosType.ReliableSequenced); config.AddChannel(QosType.Unreliable); myClient.Configure(config, 1000); discovery.Initialize(); discovery.StartAsClient(); // Register message event handler myClient.RegisterHandler(MsgType.Connect, OnConnected); myClient.RegisterHandler(MsgType.Disconnect, OnDisconnected); myClient.RegisterHandler(MyMsgType.Custom, OnCustomMessage); }
private void Awake() { Team = Team.None; if (Instance != null) { Debug.Log(Util.C($"Multiple NetworkControllers!!!", Color.red)); throw new Exception(); } Instance = this; discovery.Register(this); discovery.Initialize(); Debug.Log("Discovery as client in awake"); discovery.StartAsClient(); manager.Register(this); inputListeners = new HashSet <InputListener>(); broadcastTable = new Dictionary <string, Team>(); InitHostHandlers(); InitAndRegisterSpawnable(); DontDestroyOnLoad(this); gameState = GameState.Lobby; }
public void UnirseUnaPartida() { StopDiscovery(); myNetworkDiscovery.StartAsClient(); }
public void SearchGame() { //start search for servers over network _discovery.StartAsClient(); }
public void StartReceiveLocalBroadcast() { localNetworkDiscovery = GetComponent <MyNetworkDiscovery>(); localNetworkDiscovery.Initialize(); localNetworkDiscovery.StartAsClient(); }