Ejemplo n.º 1
0
    private void Awake()
    {
        instance = this;
        settings = new Settings(phoneURL, serverURL);
        onGameStart.AddListener(() =>
        {
            Debug.Log("Game start");
            gameStart = true;
        });
        onGamePaused.AddListener(() =>
        {
            Debug.Log("Game paused");
        });
        onGameStop.AddListener(() =>
        {
            Debug.Log("Game stop");
            Application.Quit();
        });
        onPlayerJoin.AddListener((() =>
        {
            Debug.Log("Player join");
            --needPlayers;
        }));
        onConnection.AddListener((url) => Debug.Log(url));
        needPlayers = 2;

        hubConnection = new HubConnectionBuilder()
                        .WithUrl(settings.serverURL)
                        .Build();
    }
Ejemplo n.º 2
0
 public void RegisterClientDisconnectHandler(UnityAction <NetworkConnection> handler)
 {
     onClientDisconnect.AddListener(handler);
 }