Exemplo n.º 1
0
        /// <summary>
        /// 设置支付结果
        /// </summary>
        /// <param name="buf"></param>
        public void SetPaymentResult(string buf)
        {
            m_Log.Debug($"OnPaymentResult: {buf}.");

            PaymentResult result = JsonUtility.FromJson <PaymentResult>(buf);

            m_PaymentTcs.SetResult(result);
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public LTTask <PaymentResult> PaymentAsync(string payid)
        {
            m_PaymentTcs = LTTaskCompletionSource.New <PaymentResult>();

            if (m_BridgeClass == null)
            {
                //如果未接sdk,则模拟一个支付成功的结果
                PaymentResult result = new PaymentResult();
                result.code  = "100";
                result.payid = payid;
                result.text  = "订购成功.";

                m_PaymentTcs.SetResult(result);
            }
            else
            {
                m_BridgeClass.CallStatic("payment", payid, "");
            }

            return(m_PaymentTcs.Task);
        }