示例#1
0
            public static IEnumerator Bind()
            {
                Code = null;

                //调用SDK
                try
                {
                    var oAuthParamConfig = ConfigManager.GetConfig(ConfigManager.ConfigType.OAuthParamConfig) as OAuthParamConfig;
                    if (oAuthParamConfig != null)
                    {
                        var oAuthParam = oAuthParamConfig.ParamList.Find(x => x.Type == TYPE);
                        if (oAuthParam != null)
                        {
                            WeiboAuth.Auth(oAuthParam.AppKey, oAuthParam.RedirectUrl, WeiboAuth.AuthType.SinaWeibo,
                                           WeiboAuth.AuthResponseType.Code);
                        }
                        else
                        {
                            Debug.LogError("没有微博的OAuth参数,无法绑定");
                        }
                    }
                    else
                    {
                        Debug.LogError("没有OAuthParamConfig,无法绑定社交账号");
                    }
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }

                if (Application.platform == RuntimePlatform.WindowsEditor ||
                    Application.platform == RuntimePlatform.OSXEditor)
                {
                    Application.OpenURL("https://api.weibo.com/oauth2/authorize?client_id=3007735796&redirect_uri=http://www.iguandan.com");
                }

                while (true)
                {
                    yield return(new WaitForEndOfFrame());

                    if (Code != null)
                    {
                        break;
                    }
                }

                Requester.Instance.Send(new BindOAuthInfo(TYPE, Code, MainController.DeviceUID)
                {
                    Uid = Uid
                });
            }
示例#2
0
 public void OnSinaWeiboClick()
 {
     WeiboAuth.AddWeiboAuthListener(this);
     StartCoroutine(SinaWeibo.Bind());
 }