Exemplo n.º 1
0
    void Start()
    {
        DeBug.Log(JsonUtility.ToJson(new AlertDialogJson()));

        //MobilePlatform.OnInit();
        //AllButtonEvent();
    }
Exemplo n.º 2
0
    /// <summary> 设置微信AppIP AppSecret </summary>
    public static void SetIWXAPI()
    {
        try
        {
            if (!HelperBasic.IsNullOrEmpty(WeChat.AppID, WeChat.AppSecret))
            {
                if (IsAndroid)
                {
                    AndroidJavaClass wecht = new AndroidJavaClass("TencentPlayer.WeChat");

                    bool isGG = wecht.CallStatic <bool>("setIWXAPI",
                                                        WeChat.AppID,
                                                        WeChat.AppSecret);

                    DeBug.Log($"设置微信AppIP AppSecret 是否成功:{isGG}");
                }
            }
        }
        catch (Exception e)
        {
            Debug.LogError(e);
        }
    }
Exemplo n.º 3
0
 private void PhoneDebug(string r_log)
 {
     DeBug.Log("您的手机返回Log:" + r_log);
 }
Exemplo n.º 4
0
    /// <summary>
    /// 这几个步骤应该由后端来做
    /// </summary>
    /// <param name="r_type"></param>
    /// <param name="r_Url"></param>
    /// <returns></returns>
    private IEnumerator CallWXHttps(WXUrl r_type, string r_Url)
    {
        DeBug.Log($" 开始CALL ...... {r_type}=> {r_Url}");
        WWW wWW = new WWW(r_Url);

        yield return(wWW);

        if (wWW.isDone)
        {
            if (string.IsNullOrEmpty(wWW.error))
            {
                string data    = wWW.text;
                bool   isWrong = false;
                switch (r_type)
                {
                case WXUrl.Access_Token:
                case WXUrl.Refresh_token:
                    isWrong = weChat.IsError(data);
                    if (!isWrong)
                    {
                        WeChat.Token = JsonUtility.FromJson <AccessToken>(data);
                        StartCoroutine(CallWXHttps(WXUrl.Check_Token, weChat.FullCheckToken()));
                    }
                    break;

                case WXUrl.Check_Token:
                {
                    WeChatError error     = JsonUtility.FromJson <WeChatError>(data);
                    WXError     errorType = weChat.ErrCode(error.errcode);
                    isWrong = errorType != WXError.成功;
                    if (!isWrong)
                    {
                        StartCoroutine(CallWXHttps(WXUrl.GetUnionID, weChat.FullUnionID()));
                    }
                }
                break;

                case WXUrl.GetUnionID:
                {
                    isWrong = weChat.IsError(data);
                    if (!isWrong)
                    {
                        WeChat.UnionID = JsonUtility.FromJson <WXUnionID>(data);
                    }
                }
                break;
                }


                if (isWrong)
                {
                    Debug.LogError($"微信 {r_type} 返回出错:{data}");
                }
                else
                {
                    DeBug.Log($" 微信 {r_type} 返回正确:{data}");
                }
            }
            else
            {
                Debug.LogError("访问微信Https返回结果出错");
            }
        }
    }