コード例 #1
0
    public void Payment(System.Action <bool> paymentResult, params object[] payArgs)
    {
        #if (UNITY_ANDROID && !UNITY_EDITOR)
#if ANDROID_UC
        OnPaymentBackResult = paymentResult;
        var playerData = PlayerManager.Instance.FindHeroDataModel();
        UCGameSdk.pay(false, 1, UCConfig.serverid, playerData.ActorID.ToString(), playerData.Name
                      , playerData.PlayerValues.PLAYER_FIELD_GM_LEVEL.ToString(), "actorId=" + playerData.ActorID.ToString() + "&name=" + playerData.Name, "");
#endif
#endif
    }
コード例 #2
0
    public static void PayForCommodity(CommodityData data)
    {
        long   roleId   = Globals.Instance.MGameDataManager.MActorData.PlayerID;
        string roleName = Globals.Instance.MGameDataManager.MActorData.BasicData.Name;
        int    level    = Globals.Instance.MGameDataManager.MActorData.BasicData.Level;

        float exchangeRatio = RmbYuan2UCbi;

        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2UCbi;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2UCbi;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2UCbi;
        }
        float productPrice         = exchangeRatio * data.currPrice;
        float productOriginalPrice = exchangeRatio * data.originalPrice;
        int   productCnt           = data.BasicData.Count;

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;
        int ucbi = (int)Mathf.CeilToInt(productPrice);

        // Send to our pay server
        string customInfo = cpid + "," + data.orderId;

#if UNITY_ANDROID
        //调用支付接口
        UCGameSdk.pay(true, ucbi, serverid, roleId.ToString(), roleName, level.ToString(), customInfo);
#elif UNITY_IPHONE
#endif
    }