// Start is called before the first frame update void Start() { credentials = ChannelCredentials.Insecure; // HTTP channel = new Channel(Const.SERVER_ADDRESS, credentials); headers = new Metadata(); initClient = new K2.Init.InitClient(channel); log.text = ""; GrpcBegin(initClient.StateAsync(Const.K2NULL), (state) => { log.text = $"version = {state.Version}\nstatus = {state.ServiceStatus}\nannouncement = {state.Announcement}"; } ); }
public void OnConnectButtonClick() { if (id.text.Length < 1 || pw.text.Length < 1) { return; } connectButton.enabled = false; // 중복 명령 피하기 위해 log.text = "connecting..."; if (initClient == null) { initClient = new K2.Init.InitClient(channel); // 실행중 script 가 변경되어 reload 되면 null 이 되어버릴 수 있다. } GrpcBegin(initClient.LoginAsync(new K2.LoginRequest { Id = id.text, Pw = pw.text }), OnLogin, (error) => { log.text = $"LOGIN ERROR : {error.Message}"; connectButton.enabled = true; } ); }