diff options
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XRechargeDocument.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/XRechargeDocument.cs | 908 |
1 files changed, 908 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/XRechargeDocument.cs b/Client/Assets/Scripts/XMainClient/XRechargeDocument.cs new file mode 100644 index 00000000..4969891a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XRechargeDocument.cs @@ -0,0 +1,908 @@ +using System;
+using System.Collections.Generic;
+using KKSG;
+using MiniJSON;
+using UILib;
+using UnityEngine;
+using XMainClient.UI;
+using XMainClient.UI.UICommon;
+using XUpdater;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XRechargeDocument : XDocComponent
+ {
+ public override uint ID
+ {
+ get
+ {
+ return XRechargeDocument.uuID;
+ }
+ }
+
+ public VIPTable VIPReader
+ {
+ get
+ {
+ return XRechargeDocument._VipReader;
+ }
+ }
+
+ public PayCardTable PayCardReader
+ {
+ get
+ {
+ return XRechargeDocument._PayCardReader;
+ }
+ }
+
+ public static PayListTable PayTable
+ {
+ get
+ {
+ return XRechargeDocument._PayReader;
+ }
+ }
+
+ public List<PayBaseInfo> PayInfo
+ {
+ get
+ {
+ return this._payInfo;
+ }
+ }
+
+ public List<VIPGiftState> IsGiftGet
+ {
+ get
+ {
+ return this._isGiftGet;
+ }
+ }
+
+ public List<PayCard> PayCard
+ {
+ get
+ {
+ return this._payCard;
+ }
+ }
+
+ public uint VipLevel
+ {
+ get
+ {
+ return this._vipLevel;
+ }
+ }
+
+ public float TotalPay
+ {
+ get
+ {
+ return this._totalPay;
+ }
+ }
+
+ public Dictionary<int, PayMarketingInfo> FirstPayMarketingInfo
+ {
+ get
+ {
+ return this.m_FirstPayMarketingInfo;
+ }
+ }
+
+ public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("XRechargeDocument");
+
+ public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
+
+ private static PayListTable _PayReader = new PayListTable();
+
+ private static VIPTable _VipReader = new VIPTable();
+
+ private static PayCardTable _PayCardReader = new PayCardTable();
+
+ public GamePayDiaMallHander RechargeView;
+
+ private static SeqList<int> _vipColor;
+
+ private static readonly uint NEXTVIPLEVELSHOW = 5u;
+
+ public uint MaxVIPLevel = 0u;
+
+ public bool isVIPShow = false;
+
+ private uint _lastVipLevel = 0u;
+
+ private List<PayBaseInfo> _payInfo;
+
+ private List<VIPGiftState> _isGiftGet = new List<VIPGiftState>();
+
+ private List<PayCard> _payCard;
+
+ private uint _vipLevel;
+
+ private float _totalPay;
+
+ private Dictionary<int, PayMarketingInfo> m_FirstPayMarketingInfo = new Dictionary<int, PayMarketingInfo>();
+
+ private string m_paramID;
+
+ private int m_Price;
+
+ private PayParamType m_paramType;
+
+ private XRechargeDocument.RechargeType m_CurrRechargeType = XRechargeDocument.RechargeType.None;
+
+ private List<RpcC2M_PayNotify> m_listPaySucNotify = new List<RpcC2M_PayNotify>();
+
+ private float m_NotifyTime = 0f;
+
+ private float m_NotifyInterval = 0f;
+
+ private int m_NotifyCount = 0;
+
+ private string m_goodsParamID = "";
+
+ private uint m_goodsPrice;
+
+ private string m_goodsUrl;
+
+ public enum RechargeType
+ {
+ None,
+ DiamondRecharge,
+ Subscribe,
+ BuyGoods,
+ PandoraBuyGoods
+ }
+
+ public static void Execute(OnLoadedCallback callback = null)
+ {
+ XRechargeDocument.AsyncLoader.AddTask("Table/PayList", XRechargeDocument._PayReader, false);
+ XRechargeDocument.AsyncLoader.AddTask("Table/Vip", XRechargeDocument._VipReader, false);
+ XRechargeDocument.AsyncLoader.AddTask("Table/PayCard", XRechargeDocument._PayCardReader, false);
+ XRechargeDocument.AsyncLoader.Execute(callback);
+ }
+
+ public override void OnAttachToHost(XObject host)
+ {
+ base.OnAttachToHost(host);
+ this.MaxVIPLevel = (uint)(XRechargeDocument._VipReader.Table.Length - 1);
+ bool flag = XRechargeDocument._vipColor == null;
+ if (flag)
+ {
+ XRechargeDocument._vipColor = XSingleton<XGlobalConfig>.singleton.GetSequenceList("VIPIntervalColor", false);
+ }
+ this.m_listPaySucNotify.Clear();
+ this.m_NotifyInterval = (float)XSingleton<XGlobalConfig>.singleton.GetInt("RechargeSucNotifyRepeatInterval");
+ this.m_NotifyCount = XSingleton<XGlobalConfig>.singleton.GetInt("RechargeSucNotifyRepeatCount");
+ }
+
+ public VIPTable.RowData GetVipPermissions(uint vip)
+ {
+ vip = Math.Max(vip, 0u);
+ vip = Math.Min(vip, this.MaxVIPLevel);
+ return XRechargeDocument._VipReader.GetByVIP((int)vip);
+ }
+
+ public VIPTable.RowData GetCurrentVipPermissions()
+ {
+ return this.GetVipPermissions(this._vipLevel);
+ }
+
+ public void ReqPayAllInfo()
+ {
+ RpcC2G_GetPayAllInfo rpc = new RpcC2G_GetPayAllInfo();
+ XSingleton<XClientNetwork>.singleton.Send(rpc);
+ }
+
+ public void OnGetPayAllInfo(GetPayAllInfoArg oArg, GetPayAllInfoRes oRes)
+ {
+ bool flag = oRes.errcode == ErrorCode.ERR_SUCCESS;
+ if (flag)
+ {
+ this.SetAllData(oRes.info);
+ }
+ }
+
+ private void SetAllData(PayAllInfo info)
+ {
+ this.SetAllPayInfoData(info);
+ bool flag = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
+ if (flag)
+ {
+ DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.SetVip();
+ }
+ this.SetVIPGiftState(info.VipLevelGift);
+ bool flag2 = this.RechargeView != null && this.RechargeView.IsVisible();
+ if (flag2)
+ {
+ this.RechargeView.SetVipProgressInfo(this.VipLevel);
+ this.RechargeView.RefreshData();
+ this.RechargeView.RefreshVIP();
+ }
+ }
+
+ private void SetAllPayInfoData(PayAllInfo info)
+ {
+ this._payInfo = info.pay;
+ this._payCard = info.card;
+ this._vipLevel = info.vipLevel;
+ this._lastVipLevel = this._vipLevel;
+ this._totalPay = info.totalPay / 100f;
+ }
+
+ public void PayAllInfoNtf(PayAllInfo info)
+ {
+ this.SetAllData(info);
+ }
+
+ public List<PayCardTable.RowData> GetPayCardList()
+ {
+ List<PayCardTable.RowData> list = new List<PayCardTable.RowData>();
+ for (int i = 0; i < XRechargeDocument._PayCardReader.Table.Length; i++)
+ {
+ bool flag = false;
+ bool flag2 = this._payCard != null;
+ if (flag2)
+ {
+ for (int j = 0; j < this._payCard.Count; j++)
+ {
+ bool flag3 = (long)XRechargeDocument._PayCardReader.Table[i].Type == (long)((ulong)this._payCard[j].type);
+ if (flag3)
+ {
+ flag = true;
+ break;
+ }
+ }
+ }
+ bool flag4 = !flag;
+ if (flag4)
+ {
+ list.Add(XRechargeDocument._PayCardReader.Table[i]);
+ }
+ }
+ return list;
+ }
+
+ public uint GetVipRMB(uint vipLevel)
+ {
+ for (int i = 0; i < XRechargeDocument._VipReader.Table.Length; i++)
+ {
+ bool flag = (long)XRechargeDocument._VipReader.Table[i].VIP == (long)((ulong)vipLevel);
+ if (flag)
+ {
+ return XRechargeDocument._VipReader.Table[i].RMB;
+ }
+ }
+ return 0u;
+ }
+
+ public float LackMoneyToNextVipLevel(uint currVipLevel)
+ {
+ bool flag = this.IsMaxVip(currVipLevel);
+ float result;
+ if (flag)
+ {
+ result = 0f;
+ }
+ else
+ {
+ uint vipRMB = this.GetVipRMB(currVipLevel + 1u);
+ bool flag2 = vipRMB > this.TotalPay;
+ if (flag2)
+ {
+ result = vipRMB - this.TotalPay;
+ }
+ else
+ {
+ result = 0f;
+ }
+ }
+ return result;
+ }
+
+ public bool IsMaxVip(uint vipLevel)
+ {
+ for (int i = 0; i < XRechargeDocument._VipReader.Table.Length; i++)
+ {
+ bool flag = (long)XRechargeDocument._VipReader.Table[i].VIP > (long)((ulong)vipLevel);
+ if (flag)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void GetPayMarketingInfo()
+ {
+ XSingleton<XDebug>.singleton.AddLog("GetPayMarketingInfo", null, null, null, null, null, XDebugColor.XDebug_None);
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendGameExData("get_reward_info", "");
+ }
+
+ public void OnGetPayMarketingInfo(List<PayMarketingInfo> listInfo)
+ {
+ this.m_FirstPayMarketingInfo.Clear();
+ for (int i = 0; i < listInfo.Count; i++)
+ {
+ bool flag = listInfo[i].sendExt != "";
+ if (flag)
+ {
+ this.m_FirstPayMarketingInfo[listInfo[i].diamondCount] = listInfo[i];
+ }
+ }
+ bool flag2 = DlgBase<GameMallDlg, TabDlgBehaviour>.singleton.IsVisible() && DlgBase<GameMallDlg, TabDlgBehaviour>.singleton.currSys == XSysDefine.XSys_GameMall_Pay;
+ if (flag2)
+ {
+ DlgBase<GameMallDlg, TabDlgBehaviour>.singleton.RefreshDiamondPay();
+ }
+ }
+
+ public void PayParameterNtf()
+ {
+ string openkey;
+ string pf;
+ string pfKey;
+ string sessionType;
+ string sessionId;
+ string appid;
+ this.GetPayBillInfo(out openkey, out pf, out pfKey, out sessionType, out sessionId, out appid);
+ PtcC2M_PayParameterInfoNtf ptcC2M_PayParameterInfoNtf = new PtcC2M_PayParameterInfoNtf();
+ ptcC2M_PayParameterInfoNtf.Data.openkey = openkey;
+ ptcC2M_PayParameterInfoNtf.Data.sessionType = sessionType;
+ ptcC2M_PayParameterInfoNtf.Data.sessionId = sessionId;
+ ptcC2M_PayParameterInfoNtf.Data.pf = pf;
+ ptcC2M_PayParameterInfoNtf.Data.pfKey = pfKey;
+ ptcC2M_PayParameterInfoNtf.Data.appid = appid;
+ XSingleton<XClientNetwork>.singleton.Send(ptcC2M_PayParameterInfoNtf);
+ }
+
+ public void GetPayBillInfo(out string openKey, out string pf, out string pfKey, out string sesstionType, out string sesstionID, out string offerid)
+ {
+ openKey = "";
+ pf = "";
+ pfKey = "";
+ sesstionType = "";
+ sesstionID = "";
+ offerid = "";
+ string payBill = XSingleton<XUpdater.XUpdater>.singleton.XPlatform.GetPayBill();
+ bool flag = payBill == "";
+ if (flag)
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [GetPayBill] error ", null, null, null, null, null, XDebugColor.XDebug_None);
+ }
+ else
+ {
+ Dictionary<string, object> dictionary = Json.Deserialize(payBill) as Dictionary<string, object>;
+ bool flag2 = dictionary != null;
+ if (flag2)
+ {
+ object obj;
+ bool flag3 = dictionary.TryGetValue("pay_token", out obj);
+ if (flag3)
+ {
+ openKey = obj.ToString();
+ }
+ object obj2;
+ bool flag4 = dictionary.TryGetValue("pf", out obj2);
+ if (flag4)
+ {
+ pf = obj2.ToString();
+ }
+ object obj3;
+ bool flag5 = dictionary.TryGetValue("pfkey", out obj3);
+ if (flag5)
+ {
+ pfKey = obj3.ToString();
+ }
+ object obj4;
+ bool flag6 = dictionary.TryGetValue("sessiontype", out obj4);
+ if (flag6)
+ {
+ sesstionType = obj4.ToString();
+ }
+ object obj5;
+ bool flag7 = dictionary.TryGetValue("sessionid", out obj5);
+ if (flag7)
+ {
+ sesstionID = obj5.ToString();
+ }
+ object obj6;
+ bool flag8 = dictionary.TryGetValue("offerid", out obj6);
+ if (flag8)
+ {
+ offerid = obj6.ToString();
+ }
+ }
+ }
+ }
+
+ public void SDKRecharge(int price, string paramID, PayParamType paramType)
+ {
+ bool flag = XSingleton<UiUtility>.singleton.IsWeakNetwork();
+ if (flag)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("PAY_WEAK_NETWORK_TIP"), "fece00");
+ }
+ this.m_paramID = paramID;
+ this.m_paramType = paramType;
+ this.m_Price = price;
+ this.m_CurrRechargeType = XRechargeDocument.RechargeType.DiamondRecharge;
+ XSingleton<XDebug>.singleton.AddLog(string.Concat(new object[]
+ {
+ "[SDKRecharge] price = ",
+ price,
+ ", paramID",
+ paramID
+ }), null, null, null, null, null, XDebugColor.XDebug_None);
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.Pay(price, "", paramID, XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID, XSingleton<XClientNetwork>.singleton.ServerID);
+ }
+
+ public void SDKSubscribe(int price, int buyNum, string serviceCode, string serviceName, string paramID, PayParamType paramType)
+ {
+ bool flag = XSingleton<UiUtility>.singleton.IsWeakNetwork();
+ if (flag)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("PAY_WEAK_NETWORK_TIP"), "fece00");
+ }
+ this.m_paramID = serviceCode;
+ this.m_paramType = paramType;
+ this.m_Price = price;
+ this.m_CurrRechargeType = XRechargeDocument.RechargeType.Subscribe;
+ Dictionary<string, object> dictionary = new Dictionary<string, object>();
+ dictionary["buyNum"] = buyNum;
+ dictionary["serviceCode"] = serviceCode;
+ dictionary["serviceName"] = serviceName;
+ dictionary["productId"] = paramID;
+ dictionary["remark"] = string.Format("aid={0}", XSingleton<XGlobalConfig>.singleton.GetValue("AID"));
+ dictionary["zoneId"] = string.Format("{0}_{1}", XSingleton<XClientNetwork>.singleton.ServerID, XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID);
+ string text = Json.Serialize(dictionary);
+ XSingleton<XDebug>.singleton.AddLog("[SDKSubscribe] param = " + text, null, null, null, null, null, XDebugColor.XDebug_None);
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendGameExData("pay_for_subscribe", text);
+ }
+
+ public override void Update(float fDeltaT)
+ {
+ this.m_NotifyTime += fDeltaT;
+ bool flag = this.m_NotifyTime > this.m_NotifyInterval;
+ if (flag)
+ {
+ int i = 0;
+ while (i < this.m_listPaySucNotify.Count)
+ {
+ RpcC2M_PayNotify rpcC2M_PayNotify = this.m_listPaySucNotify[i];
+ rpcC2M_PayNotify.oArg.count = rpcC2M_PayNotify.oArg.count + 1;
+ bool flag2 = rpcC2M_PayNotify.oArg.count > this.m_NotifyCount;
+ if (flag2)
+ {
+ this.m_listPaySucNotify.RemoveAt(i);
+ XSingleton<XDebug>.singleton.AddGreenLog(string.Concat(new object[]
+ {
+ "m_listPaySucNotify.Remove paramid = ",
+ rpcC2M_PayNotify.oArg.paramid,
+ ", count = ",
+ rpcC2M_PayNotify.oArg.count
+ }), null, null, null, null, null);
+ }
+ else
+ {
+ XSingleton<XClientNetwork>.singleton.Send(rpcC2M_PayNotify);
+ XSingleton<XDebug>.singleton.AddGreenLog(string.Concat(new object[]
+ {
+ "m_listPaySucNotify.Resend paramid = ",
+ rpcC2M_PayNotify.oArg.paramid,
+ ", count = ",
+ rpcC2M_PayNotify.oArg.count
+ }), null, null, null, null, null);
+ i++;
+ }
+ }
+ this.m_NotifyTime = 0f;
+ }
+ }
+
+ private void RemoveNotify(PayNotifyArg oArg)
+ {
+ for (int i = 0; i < this.m_listPaySucNotify.Count; i++)
+ {
+ RpcC2M_PayNotify rpcC2M_PayNotify = this.m_listPaySucNotify[i];
+ bool flag = rpcC2M_PayNotify.oArg.paramid == oArg.paramid && oArg.count == 1;
+ if (flag)
+ {
+ this.m_listPaySucNotify.RemoveAt(i);
+ XSingleton<XDebug>.singleton.AddGreenLog(string.Concat(new object[]
+ {
+ "RemoveNotify paramid = ",
+ rpcC2M_PayNotify.oArg.paramid,
+ ", remove count = ",
+ rpcC2M_PayNotify.oArg.count,
+ ", find count = ",
+ oArg.count
+ }), null, null, null, null, null);
+ break;
+ }
+ }
+ }
+
+ public void PaySuccessNtf()
+ {
+ string openkey;
+ string pf;
+ string pfKey;
+ string sessionType;
+ string sessionId;
+ string appid;
+ this.GetPayBillInfo(out openkey, out pf, out pfKey, out sessionType, out sessionId, out appid);
+ RpcC2M_PayNotify rpcC2M_PayNotify = new RpcC2M_PayNotify();
+ rpcC2M_PayNotify.oArg.type = this.m_paramType;
+ rpcC2M_PayNotify.oArg.paramid = this.m_paramID;
+ rpcC2M_PayNotify.oArg.amount = this.m_Price;
+ rpcC2M_PayNotify.oArg.count = 1;
+ PayParameterInfo payParameterInfo = new PayParameterInfo();
+ payParameterInfo.openkey = openkey;
+ payParameterInfo.sessionType = sessionType;
+ payParameterInfo.sessionId = sessionId;
+ payParameterInfo.pf = pf;
+ payParameterInfo.pfKey = pfKey;
+ payParameterInfo.appid = appid;
+ rpcC2M_PayNotify.oArg.data = payParameterInfo;
+ XSingleton<XClientNetwork>.singleton.Send(rpcC2M_PayNotify);
+ this.m_NotifyTime = 0f;
+ bool flag = XSingleton<XGlobalConfig>.singleton.GetInt("RechargeSucNotifyRepeat") == 1;
+ if (flag)
+ {
+ this.m_listPaySucNotify.Add(rpcC2M_PayNotify);
+ }
+ DlgBase<XBlockInputView, XBlockInputBehaviour>.singleton.SetVisible(false, true);
+ }
+
+ public void OnPayNotify(PayNotifyArg oArg, PayNotifyRes oRes)
+ {
+ bool flag = oRes.errcode > ErrorCode.ERR_SUCCESS;
+ if (flag)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(oRes.errcode, "fece00");
+ }
+ else
+ {
+ this.RemoveNotify(oArg);
+ }
+ }
+
+ public void OnPayCallback(string msg)
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [OnPayCallback] msg:" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
+ bool flag = this.m_CurrRechargeType == XRechargeDocument.RechargeType.DiamondRecharge || this.m_CurrRechargeType == XRechargeDocument.RechargeType.Subscribe;
+ if (flag)
+ {
+ this.OnRechargeAndSubscribeCallback(msg);
+ }
+ else
+ {
+ bool flag2 = this.m_CurrRechargeType == XRechargeDocument.RechargeType.BuyGoods;
+ if (flag2)
+ {
+ this.OnBuyGoodsPayCallback(msg);
+ }
+ else
+ {
+ bool flag3 = this.m_CurrRechargeType == XRechargeDocument.RechargeType.PandoraBuyGoods;
+ if (flag3)
+ {
+ this.OnPandoraBuyGoodsCallback(msg);
+ }
+ }
+ }
+ ILuaEngine xluaEngine = XSingleton<XUpdater.XUpdater>.singleton.XLuaEngine;
+ xluaEngine.hotfixMgr.OnPayCallback(msg, this.m_goodsParamID);
+ }
+
+ private void OnRechargeAndSubscribeCallback(string msg)
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [OnRechargeAndSubscribeCallback] msg:" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
+ bool flag = msg == "true" || msg == "Success";
+ if (flag)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("PAY_SUCCESS"), "fece00");
+ this.CheckGiftBag();
+ this.ResetGiftBagBtnCD();
+ this.PaySuccessNtf();
+ this.GetPayMarketingInfo();
+ }
+ else
+ {
+ DlgBase<XBlockInputView, XBlockInputBehaviour>.singleton.SetVisible(false, true);
+ }
+ }
+
+ private void OnBuyGoodsPayCallback(string msg)
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [OnBuyGoodsPayCallback] msg:" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
+ bool flag = msg == "true" || msg == "Success";
+ if (flag)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("PAY_SUCCESS_GOODS"), "fece00");
+ DlgBase<XBlockInputView, XBlockInputBehaviour>.singleton.SetVisible(false, true);
+ }
+ else
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("PAY_FAIL_GOODS"), "fece00");
+ this.NoticeBusyGoodsFail();
+ }
+ }
+
+ private void OnPandoraBuyGoodsCallback(string msg)
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [OnPandoraBuyGoodsCallback] msg:" + msg, null, null, null, null, null, XDebugColor.XDebug_None);
+ bool flag = msg == "true" || msg == "Success";
+ if (flag)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("PAY_SUCCESS_PANDORA"), "fece00");
+ XSingleton<XPandoraSDKDocument>.singleton.NoticePandoraBuyGoodsResult("success");
+ }
+ else
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("PAY_FAIL_PANDORA"), "fece00");
+ XSingleton<XPandoraSDKDocument>.singleton.NoticePandoraBuyGoodsResult("fail");
+ }
+ }
+
+ private void ResetGiftBagBtnCD()
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [ResetGiftBagBtnCD]", null, null, null, null, null, XDebugColor.XDebug_None);
+ bool flag = this.m_paramType != PayParamType.PAY_PARAM_AILEEN;
+ if (!flag)
+ {
+ int @int = XSingleton<XGlobalConfig>.singleton.GetInt("GiftBagBtnClickInterval");
+ bool flag2 = @int == 0;
+ if (flag2)
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [ResetGiftBagBtnCD] GiftBagBtnClickInterval = 0", null, null, null, null, null, XDebugColor.XDebug_None);
+ }
+ else
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [ResetGiftBagBtnCD] interval = " + @int.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
+ XWelfareDocument specificDocument = XDocuments.GetSpecificDocument<XWelfareDocument>(XWelfareDocument.uuID);
+ specificDocument.ResetGiftBagBtnCD(@int);
+ }
+ }
+ }
+
+ private void CheckGiftBag()
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [CheckGiftBag]", null, null, null, null, null, XDebugColor.XDebug_None);
+ bool flag = XSingleton<XGlobalConfig>.singleton.GetInt("HideGiftBagBtnAtOnce") == 0;
+ if (flag)
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [CheckGiftBag] HideGiftBagBtnAtOnce = 0", null, null, null, null, null, XDebugColor.XDebug_None);
+ }
+ else
+ {
+ XSingleton<XDebug>.singleton.AddLog("Pay [CheckGiftBag] m_paramType = " + this.m_paramType.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
+ bool flag2 = this.m_paramType != PayParamType.PAY_PARAM_AILEEN;
+ if (!flag2)
+ {
+ XWelfareDocument specificDocument = XDocuments.GetSpecificDocument<XWelfareDocument>(XWelfareDocument.uuID);
+ specificDocument.HideGiftBagBtn(this.m_paramID);
+ }
+ }
+ }
+
+ public void SDKBuyGoods(uint id, uint goodsCount, ulong toRoleID, string text, string paramID, uint price)
+ {
+ XSingleton<XDebug>.singleton.AddLog(string.Concat(new object[]
+ {
+ "[SDKBuyGoods] id = ",
+ id,
+ ", goodsCount = ",
+ goodsCount,
+ ", toRoleID = ",
+ toRoleID,
+ ",text = ",
+ text,
+ ", paramID = ",
+ paramID,
+ ", price = ",
+ price
+ }), null, null, null, null, null, XDebugColor.XDebug_None);
+ bool flag = XSingleton<XUpdater.XUpdater>.singleton.XPlatform.Platfrom() != XPlatformType.Standalone && !Application.isEditor;
+ if (flag)
+ {
+ DlgBase<XBlockInputView, XBlockInputBehaviour>.singleton.SetVisible(true, true);
+ }
+ bool flag2 = XSingleton<UiUtility>.singleton.IsWeakNetwork();
+ if (flag2)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("PAY_WEAK_NETWORK_TIP"), "fece00");
+ }
+ string openkey;
+ string pf;
+ string pfKey;
+ string sessionType;
+ string sessionId;
+ string appid;
+ this.GetPayBillInfo(out openkey, out pf, out pfKey, out sessionType, out sessionId, out appid);
+ PayParameterInfo payParameterInfo = new PayParameterInfo();
+ payParameterInfo.openkey = openkey;
+ payParameterInfo.sessionType = sessionType;
+ payParameterInfo.sessionId = sessionId;
+ payParameterInfo.pf = pf;
+ payParameterInfo.pfKey = pfKey;
+ payParameterInfo.appid = appid;
+ RpcC2G_PayFriendItem rpcC2G_PayFriendItem = new RpcC2G_PayFriendItem();
+ rpcC2G_PayFriendItem.oArg.payparam = payParameterInfo;
+ rpcC2G_PayFriendItem.oArg.goodsid = id;
+ rpcC2G_PayFriendItem.oArg.count = goodsCount;
+ rpcC2G_PayFriendItem.oArg.toroleid = toRoleID;
+ rpcC2G_PayFriendItem.oArg.text = text;
+ XSingleton<XClientNetwork>.singleton.Send(rpcC2G_PayFriendItem);
+ }
+
+ public void OnGetBuyGoodsOrder(PayFriendItemArg oArg, PayFriendItemRes oRes)
+ {
+ bool flag = oRes.ret > ErrorCode.ERR_SUCCESS;
+ if (flag)
+ {
+ DlgBase<XBlockInputView, XBlockInputBehaviour>.singleton.SetVisible(false, true);
+ XSingleton<UiUtility>.singleton.ShowSystemTip(oRes.ret, "fece00");
+ }
+ else
+ {
+ bool flag2 = XSingleton<UiUtility>.singleton.IsWeakNetwork();
+ if (flag2)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("PAY_WEAK_NETWORK_TIP"), "fece00");
+ }
+ this.m_goodsUrl = oRes.billno;
+ this.m_goodsParamID = oRes.paramid;
+ this.m_goodsPrice = oRes.price;
+ this.m_CurrRechargeType = XRechargeDocument.RechargeType.BuyGoods;
+ Dictionary<string, object> dictionary = new Dictionary<string, object>();
+ dictionary["zoneId"] = XSingleton<XClientNetwork>.singleton.ServerID.ToString();
+ dictionary["productId"] = oRes.paramid;
+ dictionary["buyNum"] = oArg.count;
+ dictionary["price"] = oRes.price;
+ dictionary["tokenUrl"] = oRes.url_param;
+ dictionary["extInfo"] = oRes.billno;
+ string text = Json.Serialize(dictionary);
+ XSingleton<XDebug>.singleton.AddLog("[OnGetBuyGoodsOrder] param = " + text, null, null, null, null, null, XDebugColor.XDebug_None);
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendGameExData("pay_for_props", text);
+ DlgBase<XBlockInputView, XBlockInputBehaviour>.singleton.SetVisible(false, true);
+ }
+ }
+
+ private void NoticeBusyGoodsFail()
+ {
+ PtcC2M_PayBuyGoodsFailNtf ptcC2M_PayBuyGoodsFailNtf = new PtcC2M_PayBuyGoodsFailNtf();
+ ptcC2M_PayBuyGoodsFailNtf.Data.token = this.m_goodsUrl;
+ XSingleton<XClientNetwork>.singleton.Send(ptcC2M_PayBuyGoodsFailNtf);
+ DlgBase<XBlockInputView, XBlockInputBehaviour>.singleton.SetVisible(false, true);
+ }
+
+ public void SDKPandoraBuyGoods(string json)
+ {
+ this.m_CurrRechargeType = XRechargeDocument.RechargeType.PandoraBuyGoods;
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendGameExData("pay_for_pandora", json);
+ }
+
+ public void SendGetVIPGiftQuery(int level)
+ {
+ RpcC2G_BuyVipLevelGift rpcC2G_BuyVipLevelGift = new RpcC2G_BuyVipLevelGift();
+ rpcC2G_BuyVipLevelGift.oArg.vipLevel = level;
+ XSingleton<XClientNetwork>.singleton.Send(rpcC2G_BuyVipLevelGift);
+ }
+
+ public void OnGetVIPGift(int level)
+ {
+ this.IsGiftGet[level] = VIPGiftState.GET;
+ this.CalVipRedPoint();
+ bool flag = this.RechargeView != null && this.RechargeView.IsVisible() && this.isVIPShow;
+ if (flag)
+ {
+ this.RechargeView.RefreshGiftState(level);
+ }
+ }
+
+ public bool CalVipRedPoint()
+ {
+ for (int i = 0; i < this.IsGiftGet.Count; i++)
+ {
+ bool flag = this.IsGiftGet[i] == VIPGiftState.UNGET;
+ if (flag)
+ {
+ return true;
+ }
+ }
+ XSingleton<XGameSysMgr>.singleton.SetSysRedPointState(XSysDefine.XSys_GameMall_Pay, false);
+ XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_GameMall, true);
+ return false;
+ }
+
+ public void SetVIPGiftState(List<int> getGiftList)
+ {
+ this.IsGiftGet.Clear();
+ uint num = (this.MaxVIPLevel < this._vipLevel + XRechargeDocument.NEXTVIPLEVELSHOW) ? this.MaxVIPLevel : (this._vipLevel + XRechargeDocument.NEXTVIPLEVELSHOW);
+ int num2 = 0;
+ while ((long)num2 <= (long)((ulong)num))
+ {
+ bool flag = (ulong)this._vipLevel >= (ulong)((long)num2);
+ if (flag)
+ {
+ this.IsGiftGet.Add(VIPGiftState.UNGET);
+ }
+ else
+ {
+ this.IsGiftGet.Add(VIPGiftState.UNABLE);
+ }
+ num2++;
+ }
+ for (int i = 0; i < getGiftList.Count; i++)
+ {
+ int num3 = getGiftList[i];
+ bool flag2 = (long)num3 > (long)((ulong)this._vipLevel);
+ if (flag2)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("Error. viplevel = ", this._vipLevel.ToString(), " but gift is get by level = ", num3.ToString(), null, null);
+ }
+ this.IsGiftGet[num3] = VIPGiftState.GET;
+ }
+ }
+
+ public void ShowVipLevelUp()
+ {
+ string label = XSingleton<UiUtility>.singleton.ReplaceReturn(string.Format(XStringDefineProxy.GetString("VIPLevelUpTips"), "{n}", "{n}", this._vipLevel));
+ string @string = XStringDefineProxy.GetString("VIPLevelUpBtnLabel");
+ XSingleton<UiUtility>.singleton.ShowModalDialog(label, @string, new ButtonClickEventHandler(this.ShowCurrentVip), 50);
+ }
+
+ private bool ShowCurrentVip(IXUIButton btn)
+ {
+ DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
+ this.isVIPShow = true;
+ bool flag = DlgBase<GameMallDlg, TabDlgBehaviour>.singleton._gamePayDiaMallHander != null && DlgBase<GameMallDlg, TabDlgBehaviour>.singleton._gamePayDiaMallHander.IsVisible();
+ if (flag)
+ {
+ this.ReqPayAllInfo();
+ DlgBase<GameMallDlg, TabDlgBehaviour>.singleton._gamePayDiaMallHander.SetSwitchState();
+ }
+ else
+ {
+ DlgBase<GameMallDlg, TabDlgBehaviour>.singleton.ShowPurchase(ItemEnum.DIAMOND);
+ }
+ return true;
+ }
+
+ public static string GetVIPIconString(uint level)
+ {
+ return "";
+ }
+
+ public static string GetVIPIconNameString(uint level)
+ {
+ int num = 0;
+ for (int i = 0; i < (int)XRechargeDocument._vipColor.Count; i++)
+ {
+ bool flag = (ulong)level >= (ulong)((long)XRechargeDocument._vipColor[i, 0]) && (ulong)level <= (ulong)((long)XRechargeDocument._vipColor[i, 1]);
+ if (flag)
+ {
+ num = i + 1;
+ break;
+ }
+ }
+ bool flag2 = num == 0;
+ if (flag2)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog(string.Format("Can't find vip{0} 's icon color.", level), null, null, null, null, null);
+ }
+ return XSingleton<XCommon>.singleton.StringCombine("rechar_vip0", num.ToString());
+ }
+
+ protected override void OnReconnected(XReconnectedEventArgs arg)
+ {
+ DlgBase<XBlockInputView, XBlockInputBehaviour>.singleton.SetVisible(false, true);
+ }
+ }
+}
|