예제 #1
0
    public void SerialState(string msg)
    {
        scrollManager.Log(msg + "\n");
        serialState.text = "Callback State : \n " + msg;

        if (msg == "connected")
        {
            connectButton.interactable = false;
            sendButton.interactable    = true;
        }
    }
예제 #2
0
 public void OnClickButton()
 {
     if (label.text == "SignIn")
     {
         // SignIn実行
         ManageScroll.Log(DateTime.Now.ToString("tthh時mm分ss秒fffミリ秒") + ": SignIn");
         GoogleSignInPlugIn.SignIn();
         label.text = "SignOut";
     }
     else
     {
         // SignOut実行
         ManageScroll.Log(DateTime.Now.ToString("tthh時mm分ss秒fffミリ秒") + ": SignOut");
         GoogleSignInPlugIn.SignOut();
         label.text = "SignIn";
     }
 }
    private async void OnEndOfFetch(string token, string err)
    {
        string t = token ?? "";
        string e = err ?? "";

        ManageScroll.Log(DateTime.Now.ToString("tthh時mm分ss秒fffミリ秒") + ": OnEndOfGetIDToken");

        if (t != "" && e == "")
        {
            // SingIn済み
            ManageScroll.Log("token: " + t);

            // Fetch実行 TODO: エラーキャッチ
            var session = new DefaultSession(Manager.HostName, token);

            LoginRequest req = new LoginRequest();

            var awaitableCoroutine = Awaitable.Create <LoginResponse>(tcs => session.Login(req, tcs));
            var result             = await awaitableCoroutine;

            ManageScroll.Log("result: " + result);

            if (result.Token != "")
            {
                var accessToken = result.Token;
                ManageScroll.Log("accessToken: " + accessToken);

                // Fetch実行 TODO: エラーキャッチ
                var haberdasher = new DefaultHaberdasher(Manager.HostName, accessToken);

                Size req2 = new Size();
                req2.Inches = UnityEngine.Random.Range(1, 1001);

                var awaitableCoroutine2 = Awaitable.Create <Hat>(tcs => haberdasher.MakeHat(req2, tcs));
                var result2             = await awaitableCoroutine2;

                ManageScroll.Log("result: " + result2);
            }
        }

        if (e != "")
        {
            ManageScroll.Log("err: " + e);
        }
    }
    private void OnEndOfGetIDToken(string token, string err)
    {
        string t = token ?? "";
        string e = err ?? "";

        ManageScroll.Log(DateTime.Now.ToString("tthh時mm分ss秒fffミリ秒") + ": OnEndOfGetIDToken");

        if (t != "" && e == "")
        {
            // SingIn済み
            ManageScroll.Log("token: " + t);
        }

        if (e != "")
        {
            ManageScroll.Log("err: " + e);
        }
    }
//    private async void OnEndOfFetch(string token, string err) {
//        string t = token ?? "";
//        string e = err ?? "";
//        ManageScroll.Log(DateTime.Now.ToString("tthh時mm分ss秒fffミリ秒") + ": OnEndOfGetIDToken");
//
//        if (t != "" && e == "") {
//            // SingIn済み
//            ManageScroll.Log("token: " + t);
//
//            // Fetch実行 TODO: エラーキャッチ
//            var helloWorld = new DefaultHelloWorld(Manager.HostName, token);
//
//            string user = "******";
//            HelloReq req = new HelloReq();
//            req.Subject = user;
//
//            var awaitableCoroutine = Awaitable.Create<HelloResp>(tcs => helloWorld.Hello(req, tcs));
//            var result = await awaitableCoroutine;
//
//            ManageScroll.Log("result: " + result);
//        }
//
//        if (e != "") {
//            ManageScroll.Log("err: " + e);
//        }
//    }

    public async void OnClickButton()
    {
        ManageScroll.Log(DateTime.Now.ToString("tthh時mm分ss秒fffミリ秒") + ": Fetch");
        // 認証必要なし
        // FirebaseAuthPlugIn.CallPlugin(OnEndOfFetch);

        // Fetch実行 TODO: エラーキャッチ
        var helloWorld = new DefaultHelloWorld(Manager.HostName, "");

        HelloReq req = new HelloReq();

        req.Subject = "dummy user";

        var awaitableCoroutine = Awaitable.Create <HelloResp>(tcs => helloWorld.Hello(req, tcs));
        var result             = await awaitableCoroutine;

        ManageScroll.Log("result: " + result);
    }
 public void OnClickButton()
 {
     ManageScroll.Log(DateTime.Now.ToString("tthh時mm分ss秒fffミリ秒") + ": Fetch");
     FirebaseAuthPlugIn.CallPlugin(OnEndOfFetch);
 }