Esempio n. 1
0
    void OnClick(GameObject btnObj)
    {
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            GameObject.Find("MassageInfo").GetComponent <Text>().text = "{" +
                                                                        "\"ret_code\":\"5000\",\n" +
                                                                        "\"ret_msg\":\"NETWORK_ERROR\"" + "}";
            return;
        }
        switch (btnObj.name)
        {
        case "Login":
            StartLoading();
            PicoPaymentSDK.Login();
            break;

        case "PayOne":
            CommonDic.getInstance().setParameters("subject", "game");
            CommonDic.getInstance().setParameters("body", "gamePay");
            CommonDic.getInstance().setParameters("order_id", getRamdomTestOrderID());
            CommonDic.getInstance().setParameters("total", "1");
            CommonDic.getInstance().setParameters("goods_tag", "game");
            CommonDic.getInstance().setParameters("notify_url", "www.picovr.com");
            CommonDic.getInstance().setParameters("pay_code", "");

            StartLoading();
            PicoPaymentSDK.Pay(CommonDic.getInstance().PayOrderString());

            break;

        case "PayCode":
            InputPanel.SetActive(true);
            break;

        case "QueryOrder":
            StartLoading();
            PicoPaymentSDK.QueryOrder(currentOrderID);
            break;

        case "GetUserAPI":
            StartLoading();
            PicoPaymentSDK.GetUserAPI();
            break;
        }
    }
Esempio n. 2
0
 public static void GetUserAPI()
 {
     PicoPaymentSDK.GetUserAPI();
 }
    //ButtonClickedEvent
    void OnClick(GameObject btnObj)
    {
        //判断网络
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            GameObject.Find("MassageInfo").GetComponent <Text>().text = "{" +
                                                                        "\"ret_code\":\"5000\",\n" +
                                                                        "\"ret_msg\":\"NETWORK_ERROR\"" + "}";
            return;
        }
        switch (btnObj.name)
        {
        case "Login":     //登陆
            StartLoading();
            PicoPaymentSDK.Login();
            break;

        case "PayOne":     //支付1P币
            CommonDic.getInstance().setParameters("subject", "game");
            CommonDic.getInstance().setParameters("body", "gamePay");
            CommonDic.getInstance().setParameters("order_id", getRamdomTestOrderID());
            CommonDic.getInstance().setParameters("total", "1");
            CommonDic.getInstance().setParameters("goods_tag", "game");
            CommonDic.getInstance().setParameters("notify_url", "www.picovr.com");
            CommonDic.getInstance().setParameters("pay_code", "");

            StartLoading();
            //if (!VerifyLocalToken()) {
            //    return;
            //}
            PicoPaymentSDK.Pay(CommonDic.getInstance().PayOrderString());

            break;

        case "PayCode":     //使用商品码支付1P币
            //if (!VerifyLocalToken()) {
            //    return;
            //}

            /*
             * if (CommonDic.getInstance().access_token.Equals(""))
             * {
             *  GameObject.Find("MassageInfo").GetComponent<Text>().text = "请先登录";
             *  currentOrderID = "";
             *  StopLoading();
             *  return;
             * }
             * */
            InputPanel.SetActive(true);

            break;

        case "QueryOrder":     //查询订单
            StartLoading();
            //if (currentOrderID.Equals(""))
            //{
            //    GameObject.Find("MassageInfo").GetComponent<Text>().text = "{code:exception,msg:请先支付}";

            //    StopLoading();
            //    return;
            //}
            PicoPaymentSDK.QueryOrder(currentOrderID);
            break;

        case "GetUserAPI":     //查看用户信息
            StartLoading();
            PicoPaymentSDK.GetUserAPI();

            break;
        }
    }