コード例 #1
0
ファイル: WaitMgr.cs プロジェクト: isoundy000/shmj3d
    void Awake()
    {
        mInstance = this;

        lblCount = transform.Find("count").GetComponent <UILabel> ();

        hide();
    }
コード例 #2
0
    public void onBuyIAPFail(string code)
    {
        Debug.Log("onBuyIAPFail: " + code);

        buying = false;
        WaitMgr.Hide();

        GameAlert.Show("购买失败:" + code);
    }
コード例 #3
0
    public static void pay(GoodsInfo info)
    {
        if (buying)
        {
            Debug.Log("buying");
            return;
        }

        buying = true;

        WaitMgr.Show();

                #if UNITY_IPHONE
        buyIAP(info.product);
                #endif
    }
コード例 #4
0
    public void onBuyIAPResp(string receipt)
    {
        var file = Application.persistentDataPath + "/receipts/" + receipt;

        buying = false;

        if (!File.Exists(file))
        {
            Debug.Log("receipt not exist");
            return;
        }

        string content = File.ReadAllText(file);
        var    args    = new JsonObject();
        var    token   = NetMgr.GetInstance().getToken();

        args ["token"]  = token;
        args["receipt"] = content;

        var http = Http.GetInstance();

        http.Post("/pay_iap/query_order", args, data => {
            Debug.Log("ret from pay_iap");

            QueryOrderReply ret = JsonUtility.FromJson <QueryOrderReply> (data.ToString());

            if (ret.errcode == (int)QueryOrderErrcode.ORDER_SUCCESS)
            {
                GameAlert.Show("购买成功");

                GameMgr.GetInstance().get_coins();

                File.Delete(file);
            }
            else
            {
                GameAlert.Show("购买失败:" + ret.errcode);
            }

            WaitMgr.Hide();
        }, err => {
            WaitMgr.Hide();
            GameAlert.Show("购买通讯失败");
        });
    }