• 大小: 2.22MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-12
  • 语言: Java
  • 标签: unity  微信支付  android  

资源简介

unity安卓微信支付,附Android源代码,需要的可直接使用。

资源截图

代码片段和文件信息

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using System.Text;
using UnityEngine.UI;
public class Test : MonoBehaviour {
    AndroidJavaobject javaActive;
    public Text text;
    public InputField inputf;
    // Use this for initialization
    [System.Serializable]
    public class ModelTest
    {
        public string prepayid;
        public string noncestr;
        public string timestamp;
        public string sign;
    }

    private void Start()
    {
        AndroidJavaClass javaClass = new AndroidJavaClass(“com.unity3d.player.UnityPlayer“);
        javaActive = javaClass.GetStaticject>(“currentActivity“);
        Debug.Log(javaActive);
    }
    public void Button1() {       
        object[] objs = new object[] { inputf.text “商品描述“  “https://www.baidu.com“ “Main Camera“ “回调函数“ };
         javaActive.Call(“LocationPayReq“ objs);


        //object[] objs = new object[] { “aaaaa“ };

       // print(javaActive.Call(“aaa“ objs));

    }

    public void Button2()
    {
        StartCoroutine(test());
    }

     IEnumerator test()
    {

        UnityWebRequest www = UnityWebRequest.Get(“http://accounts.zyqpyx.com/api/login/pay“);
        yield return www.SendWebRequest();

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.LogError(www.error);
        }
        else
        {
            //Debug.Log(www.downloadHandler.text);

            ModelTest obj = JsonUtility.FromJson(www.downloadHandler.text);
            Debug.Log(“ss“+obj.sign);

            object[] objs = new object[] { obj.prepayid obj.noncestr obj.timestampobj.sign “Main Camera“ “回调函数“ };
            javaActive.Call(“WeiChatPayReq“ objs);
        }

    }

    public void 回调函数(string s)
    {
        print(s);
        if (s==“0“)
        {
            print(“支付成功“);
            text.text = “支付成功“;
        }
        else if(s == “-2“)
        {
            print(“支付取消“);
            text.text = “支付取消“;
        }
        else
        {
            print(“支付失败“);
            text.text = “支付失败“;
        }
        
    }

// Update is called once per frame
void Update () {

}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        118  2017-11-16 10:09  WXPay-master\.gitignore

     文件          1  2018-01-05 15:18  WXPay-master\.gradle\4.1\fileChanges\last-build.bin

     文件         17  2018-01-05 15:18  WXPay-master\.gradle\4.1\fileContent\fileContent.lock

     文件     485891  2018-01-05 15:18  WXPay-master\.gradle\4.1\fileHashes\fileHashes.bin

     文件         17  2018-01-05 15:18  WXPay-master\.gradle\4.1\fileHashes\fileHashes.lock

     文件      20129  2018-01-04 17:36  WXPay-master\.gradle\4.1\fileHashes\resourceHashesCache.bin

     文件     865454  2018-01-05 15:18  WXPay-master\.gradle\4.1\javaCompile\classAnalysis.bin

     文件     343404  2018-01-04 17:36  WXPay-master\.gradle\4.1\javaCompile\jarAnalysis.bin

     文件         17  2018-01-05 15:18  WXPay-master\.gradle\4.1\javaCompile\javaCompile.lock

     文件     506115  2018-01-05 15:18  WXPay-master\.gradle\4.1\javaCompile\taskHistory.bin

     文件      23467  2018-01-05 15:18  WXPay-master\.gradle\4.1\javaCompile\taskJars.bin

     文件    2673954  2018-01-05 15:18  WXPay-master\.gradle\4.1\taskHistory\fileSnapshots.bin

     文件     134819  2018-01-05 15:18  WXPay-master\.gradle\4.1\taskHistory\taskHistory.bin

     文件         17  2018-01-05 15:18  WXPay-master\.gradle\4.1\taskHistory\taskHistory.lock

     文件          0  2017-12-29 15:54  WXPay-master\.gradle\buildOutputCleanup\built.bin

     文件         51  2017-12-29 15:54  WXPay-master\.gradle\buildOutputCleanup\cache.properties

     文件          2  2018-01-05 15:18  WXPay-master\.gradle\buildOutputCleanup\cache.properties.lock

     文件        626  2017-11-16 10:09  WXPay-master\.idea\gradle.xml

     文件        280  2018-01-05 10:32  WXPay-master\.idea\libraries\org_apache_http_legacy_android_26.xml

     文件        277  2018-01-04 16:52  WXPay-master\.idea\libraries\__local_aars___F__WXPay_master_app_libs_classes_jar_unspecified_jar.xml

     文件        281  2017-12-29 15:54  WXPay-master\.idea\libraries\__local_aars___F__WXPay_master_app_libs_libammsdk_jar_unspecified_jar.xml

     文件       2044  2018-01-05 14:16  WXPay-master\.idea\misc.xml

     文件        361  2017-12-29 17:12  WXPay-master\.idea\modules.xml

     文件        564  2017-11-16 10:09  WXPay-master\.idea\runConfigurations.xml

     文件     186721  2018-01-05 15:36  WXPay-master\.idea\workspace.xml

     文件          7  2017-11-16 10:09  WXPay-master\app\.gitignore

     文件       8947  2018-01-05 14:16  WXPay-master\app\app.iml

     文件        475  2018-01-05 15:18  WXPay-master\app\build\generated\source\buildConfig\debug\com\tencent\tmgp\com\chaoda\zyqpyx\BuildConfig.java

     文件        264  2018-01-05 15:18  WXPay-master\app\build\generated\source\r\debug\com\tencent\tmgp\com\chaoda\zyqpyx\R.java

     文件      49474  2018-01-05 15:18  WXPay-master\app\build\intermediates\attr\R.txt

............此处省略227个文件信息

评论

共有 条评论