// 一键登录拉起授权页
    public void requestToken()
    {
        /**
         * 授权页主题样式
         * 0:浮窗式
         * 1:弹窗式
         * 2:沉浸式
         * 3:横屏
         */
        int themeStyle = 2;
        // 授权页主题配置
        OneLoginBean oneLoginBean = getThemeConfig(themeStyle);
        string       configStr    = JsonUtility.ToJson(oneLoginBean, true);

        // 授权页自定义控件配置
        // 自定义控件的点击事件回调参考 OneLoginPluginCallback.onCustomViewClick 方法
        Widget[] widgets = getWidgets();
        int      len     = widgets.Length;

        string[] widgetStrs = new string[len];
        for (int i = 0; i < len; i++)
        {
            widgetStrs[i] = JsonUtility.ToJson(widgets[i], true);
        }
        // SDK 插件仅支持 json 格式授权页配置参数,调用前将 json 转换为 string 格式
        olManager.Call("requestToken", configStr, widgetStrs, new OneLoginPluginCallback(this));
    }
    // 一键登录拉起弹框形式授权页
    public void popupOneLogin()
    {
        OneLoginBean oneLoginBean = getThemeConfig(0);
        string       configStr    = JsonUtility.ToJson(oneLoginBean, true);

        // 自定义控件参数可选配
        olManager.Call("requestToken", configStr, new OneLoginPluginCallback(this));
    }
    // 获取一键登录授权页样式配置
    private OneLoginBean getThemeConfig(int themeStyle)
    {
        ScreenInfo   screenInfo = getScreenInfo();
        float        density    = screenInfo.density;
        int          width      = (int)(screenInfo.screenWidth / density);
        int          height     = (int)(screenInfo.screenHeight / density);
        int          popWidth   = (int)(width * 4 / 5);
        int          popHeight  = (int)(height * 3 / 5);
        OneLoginBean olb        = new OneLoginBean();

        switch (themeStyle)
        {
        case 0:    //浮窗式
            olb.isDialogTheme      = true; olb.dialogWidth = width; olb.dialogHeight = 500; olb.dialogX = 0; olb.dialogY = 0; olb.isDialogBottom = true; olb.isWebViewDialogTheme = true;
            olb.authBGImgPath      = "gt_one_login_bg";
            olb.statusBarColor     = 0; olb.navigationBarColor = 0; olb.isLightColor = false;
            olb.navColor           = 0xFF3973FF; olb.authNavHeight = 49; olb.authNavTransparent = true; olb.authNavGone = false;
            olb.navText            = "一键登录"; olb.navTextColor = 0xFFFFFFFF; olb.navTextSize = 17; olb.navWebTextNormal = true; olb.navWebText = "自定义服务条款标题"; olb.navWebTextColor = 0xFF000000; olb.navWebTextSize = 17;
            olb.returnImgPath      = "gt_one_login_ic_chevron_left_black"; olb.returnImgWidth = 40; olb.returnImgHeight = 40; olb.returnImgHidden = false; olb.returnImgOffsetX = 8;
            olb.logoImgPath        = "gt_one_login_logo"; olb.logoWidth = 71; olb.logoHeight = 71; olb.logoHidden = false; olb.logoOffsetY = 100; olb.logoOffsetY_B = 0; olb.logoOffsetX = 0;
            olb.sloganColor        = 0xFFA8A8A8; olb.sloganSize = 10; olb.sloganOffsetY = 330; olb.sloganOffsetY_B = 0; olb.sloganOffsetX = 0;
            olb.numberColor        = 0xFF3D424C; olb.numberSize = 24; olb.numberOffsetY = 160; olb.numberOffsetY_B = 0; olb.numberOffsetX = 0;
            olb.switchText         = "切换账号"; olb.switchColor = 0xFF3973FF; olb.switchSize = 14; olb.switchHidden = false; olb.switchOffsetY = 230; olb.switchOffsetY_B = 0; olb.switchOffsetX = 0;
            olb.logBtnImgPath      = "gt_one_login_btn"; olb.logBtnWidth = 290; olb.logBtnHeight = 45; olb.logBtnOffsetY = 270; olb.logBtnOffsetY_B = 0; olb.logBtnOffsetX = 0;
            olb.logBtnText         = "一键登录"; olb.logBtnColor = 0xFFFFFFFF; olb.logBtnTextSize = 18;
            olb.loadingView        = "umcsdk_load_dot_white"; olb.loadingViewWidth = 20; olb.loadingViewHeight = 20; olb.loadingViewOffsetRight = 12;
            olb.unCheckedImgPath   = "gt_one_login_unchecked"; olb.checkedImgPath = "gt_one_login_checked"; olb.privacyState = false; olb.privacyCheckBoxWidth = 12; olb.privacyCheckBoxHeight = 12;
            olb.privacyLayoutWidth = 256; olb.privacyOffsetY = 0; olb.privacyOffsetY_B = 18; olb.privacyOffsetX = 0; olb.isUseNormalWebActivity = true;
            olb.baseClauseColor    = 0xFFA8A8A8; olb.clauseColor = 0xFF3973FF; olb.privacyClauseTextSize = 10;
            olb.privacyTextViewTv1 = "登录即同意"; olb.privacyTextViewTv2 = "和"; olb.privacyTextViewTv3 = "、"; olb.privacyTextViewTv4 = "并使用本机号码登录";
            olb.clauseNameOne      = "自定义服务条款1"; olb.clauseUrlOne = "https://docs.geetest.com/onelogin/deploy/android";
            olb.clauseNameTwo      = "自定义服务条款2"; olb.clauseUrlTwo = "https://docs.geetest.com/onelogin/changelog/android";
            break;

        case 1:    //弹窗式
            olb.isDialogTheme      = true; olb.dialogWidth = popWidth; olb.dialogHeight = popHeight; olb.dialogX = 0; olb.dialogY = 0; olb.isDialogBottom = false; olb.isWebViewDialogTheme = true;
            olb.returnImgPath      = "gt_one_login_ic_chevron_left_black"; olb.returnImgWidth = 40; olb.returnImgHeight = 40; olb.returnImgHidden = false; olb.returnImgOffsetX = 8;
            olb.logoImgPath        = "gt_one_login_logo"; olb.logoWidth = 71; olb.logoHeight = 71; olb.logoHidden = false; olb.logoOffsetY = 60; olb.logoOffsetY_B = 0; olb.logoOffsetX = 0;
            olb.sloganColor        = 0xFFA8A8A8; olb.sloganSize = 10; olb.sloganOffsetY = 270; olb.sloganOffsetY_B = 0; olb.sloganOffsetX = 0;
            olb.numberColor        = 0xFF3D424C; olb.numberSize = 24; olb.numberOffsetY = 125; olb.numberOffsetY_B = 0; olb.numberOffsetX = 0;
            olb.switchText         = "切换账号"; olb.switchColor = 0xFF3973FF; olb.switchSize = 14; olb.switchHidden = false; olb.switchOffsetY = 165; olb.switchOffsetY_B = 0; olb.switchOffsetX = 0;
            olb.logBtnImgPath      = "gt_one_login_btn"; olb.logBtnWidth = 268; olb.logBtnHeight = 45; olb.logBtnOffsetY = 220; olb.logBtnOffsetY_B = 0; olb.logBtnOffsetX = 0;
            olb.logBtnText         = "一键登录"; olb.logBtnColor = 0xFFFFFFFF; olb.logBtnTextSize = 18;
            olb.loadingView        = "umcsdk_load_dot_white"; olb.loadingViewWidth = 20; olb.loadingViewHeight = 20; olb.loadingViewOffsetRight = 12;
            olb.unCheckedImgPath   = "gt_one_login_unchecked"; olb.checkedImgPath = "gt_one_login_checked"; olb.privacyState = false; olb.privacyCheckBoxWidth = 12; olb.privacyCheckBoxHeight = 12;
            olb.privacyLayoutWidth = -2; olb.privacyOffsetY = 0; olb.privacyOffsetY_B = 5; olb.privacyOffsetX = 0; olb.isUseNormalWebActivity = true; olb.privacyLayoutGravity = 16;
            break;

        case 2:    //沉浸式
            olb.statusBarColor           = 0xFFFFFFFF; olb.navigationBarColor = 0xFFFFFFFF; olb.isLightColor = true;
            olb.returnImgPath            = "gt_one_login_ic_chevron_left_black"; olb.returnImgWidth = 40; olb.returnImgHeight = 40; olb.returnImgHidden = false; olb.returnImgOffsetX = 0;
            olb.logBtnImgPath            = "gt_one_login_btn"; olb.logBtnWidth = 290; olb.logBtnHeight = 45; olb.logBtnOffsetY = 310; olb.logBtnOffsetY_B = 0; olb.logBtnOffsetX = 0;
            olb.logBtnText               = "一键登录"; olb.logBtnColor = 0xFFFFFFFF; olb.logBtnTextSize = 18;
            olb.loadingView              = "umcsdk_load_dot_white"; olb.loadingViewWidth = 20; olb.loadingViewHeight = 20; olb.loadingViewOffsetRight = 12;
            olb.privacyClauseTextStrings = new string[] {
                "登录即同意", "应用自定义服务条款一", "https://docs.geetest.com/onelogin/deploy/android", "",
                "和", "应用自定义服务条款二", "https://docs.geetest.com/onelogin/changelog/android", "",
                "和", "应用自定义服务条款三", "https://docs.geetest.com/onelogin/help/tech", "",
                "", "", "", ""
            };
            olb.protocolShakeStyle        = 1;
            olb.privacyUnCheckedToastText = "亲,还没有同意服务条款哦";
            olb.privacyAddFrenchQuotes    = true;
            break;

        case 3:    //横屏
            olb.authBGImgPath      = "gt_one_login_bg";
            olb.isDialogTheme      = false; olb.dialogWidth = 300; olb.dialogHeight = 500; olb.dialogX = 0; olb.dialogY = 0; olb.isDialogBottom = false; olb.isWebViewDialogTheme = false;
            olb.statusBarColor     = 0xffffffff; olb.navigationBarColor = 0xffffffff; olb.isLightColor = true;
            olb.navColor           = 0xFF3973FF; olb.authNavHeight = 49; olb.authNavTransparent = true; olb.authNavGone = false;
            olb.navText            = "一键登录"; olb.navTextColor = 0xFFFFFFFF; olb.navTextSize = 17; olb.navWebTextNormal = false; olb.navWebText = "服务条款"; olb.navWebTextColor = 0xFF000000; olb.navWebTextSize = 17;
            olb.returnImgPath      = "gt_one_login_ic_chevron_left_black"; olb.returnImgWidth = 45; olb.returnImgHeight = 45; olb.returnImgHidden = false; olb.returnImgOffsetX = 8;
            olb.logoImgPath        = "gt_one_login_logo"; olb.logoWidth = 71; olb.logoHeight = 71; olb.logoHidden = false; olb.logoOffsetY = 55; olb.logoOffsetY_B = 0; olb.logoOffsetX = 0;
            olb.sloganColor        = 0xFFA8A8A8; olb.sloganSize = 10; olb.sloganOffsetY = 226; olb.sloganOffsetY_B = 0; olb.sloganOffsetX = 0;
            olb.numberColor        = 0xFF3D424C; olb.numberSize = 24; olb.numberOffsetY = 84; olb.numberOffsetY_B = 0; olb.numberOffsetX = 0;
            olb.switchText         = "切换账号"; olb.switchColor = 0xFF3973FF; olb.switchSize = 14; olb.switchHidden = false; olb.switchOffsetY = 128; olb.switchOffsetY_B = 0; olb.switchOffsetX = 0;
            olb.logBtnImgPath      = "gt_one_login_btn"; olb.logBtnWidth = 268; olb.logBtnHeight = 36; olb.logBtnOffsetY = 169; olb.logBtnOffsetY_B = 0; olb.logBtnOffsetX = 0;
            olb.logBtnText         = "一键登录"; olb.logBtnColor = 0xFFFFFFFF; olb.logBtnTextSize = 15;
            olb.loadingView        = "umcsdk_load_dot_white"; olb.loadingViewWidth = 20; olb.loadingViewHeight = 20; olb.loadingViewOffsetRight = 12;
            olb.unCheckedImgPath   = "gt_one_login_unchecked"; olb.checkedImgPath = "gt_one_login_checked"; olb.privacyState = false; olb.privacyCheckBoxWidth = 9; olb.privacyCheckBoxHeight = 9;
            olb.privacyLayoutWidth = 512; olb.privacyOffsetY = 0; olb.privacyOffsetY_B = 5; olb.privacyOffsetX = 0; olb.isUseNormalWebActivity = true;
            olb.baseClauseColor    = 0xFFA8A8A8; olb.clauseColor = 0xFF3973FF; olb.privacyClauseTextSize = 10;
            olb.privacyTextViewTv1 = "登录即同意"; olb.privacyLayoutWidth = -2; olb.privacyLayoutGravity = 16;
            break;
        }
        return(olb);
    }