public void PaySuccess(AlipayPlugin.Trade trade) { UserSelectedTrade selectTrade; if (AlipayPayStrategy.PayTrades.ContainsKey(trade.OutTradeNo)) { selectTrade = AlipayPayStrategy.PayTrades[trade.OutTradeNo]; AlipayPayStrategy.PayTrades.Remove(trade.OutTradeNo); } else { selectTrade = null; } if (selectTrade != null) { //TODO:查询充值目的,比如复活、充金币等 if (selectTrade.Name == "revive") //以复活为目的 { if (RevivePanel.Instance) { RevivePanel.Instance.OnRevivePayOk(); } } } else { //估计是上一次充值后程序挂了,那我也不知道玩家的目的,就只能折算成金币了。 } int paychannel; switch (Application.platform) { case RuntimePlatform.Android: paychannel = PayChannelHelper.CHANNEL_ANDROID_ALIPAY; break; case RuntimePlatform.IPhonePlayer: paychannel = PayChannelHelper.CHANNEL_IOS_ALIPAY; break; default: paychannel = PayChannelHelper.CHANNEL_WEB_ALIPAY; break; } float price; float.TryParse(trade.TotalFee, out price); UMengPlugin.Event("alipay_pay_success", new Dictionary <string, object> { //{"name", selectTrade != null ? selectTrade.Name : "(noname)"}, //{"paychannel", paychannel}, { "price", price }, }); UMengPlugin.Pay(price, "revive", 1, price, 2);//如果不是支付宝,记得修改 }