Esempio n. 1
0
    /**
     * On the share screen go back to welcome screen if user presses the ABORT button
     * Share on Facebook or display the QRcode
     * And disconnect the user from Facebook when living
     **/
    private void ManageShareScreen()
    {
        if (IsButtonDown(InterfaceButtons.SHARE_FB))
        {
            mTimeout.Reset();

            // For logs
            Logger.Instance.WriteShareFacebook();

            mFB.StartConnection(mFullResolutionImage, TriggerFBShareTerminated);
        }
        else if (IsButtonDown(InterfaceButtons.ABORT))
        {
            mTimeout.Reset();
            StopCoroutine(mTimeoutCoroutine);

            // For logs
            Logger.Instance.WriteShareAbandon();

            mSkyboxMng.ResetSkybox();
            mCurrentState = ScreensStates.WELCOME;
            UpdateScreen();
        }
        else if (IsButtonDown(InterfaceButtons.SHARE_CODE))
        {
            mTimeout.Reset();

            // For logs
            Logger.Instance.WriteShareCode();

            Destroy(mQRcode.sprite);
            string token_img = mSharingServer.GetTokenImg();
            if (token_img == null)
            {
                mCurrentState = ScreensStates.SHARE_PHOTO;
            }
            else
            {
                Texture2D tex = GenerateQRcode("https://server.instant-sphere.com/" + token_img);
                mQRcode.sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f));
                code.text      = token_img;

                mCurrentState = ScreensStates.PHOTO_CODE;
            }
            UpdateScreen();
        }
    }