static void MainX(string[] args)
        {
            Channel channel = new Channel("localhost:57601", ChannelCredentials.Insecure);
            var     client  = new User.UserClient(channel);
            var     req     = new CreateUserRequest {
                Name = "Test"
            };
            var resp = client.Create(req);

            Console.WriteLine(resp.Id);
        }
    public void SendUser()
    {
        var client = new User.UserClient(channel);

        Debug.Log(userNameText.text);
        var name  = userNameText.text;
        var reply = client.Create(new CreateUserRequest {
            Name = name
        });

        Debug.Log("Your ID is" + reply.Id);
        PlayerPrefs.SetString("userId", reply.Id);
        channel.ShutdownAsync().Wait();
        SceneManager.LoadScene("Main");
    }
Beispiel #3
0
    public void SendUser()
    {
        try
        {
            PlayerPrefs.SetString("serverPort", server.text);
            Debug.Log("Server>" + server.text);
            var channel = new Channel(server.text, ChannelCredentials.Insecure);
            var client  = new User.UserClient(channel);
            var reply   = client.Create(new CreateUserRequest {
                Name = userName.text
            });

            Debug.Log("Your ID is" + reply.Id);
            PlayerPrefs.SetString("userId", reply.Id);

            channel.ShutdownAsync().Wait();

            SceneManager.LoadScene(nextScene);
        } catch (Exception e)
        {
            error.text  = server.text = "\n";
            error.text += e.ToString();
        }
    }