| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 | 
							- using ET;
 
- using UnityEngine;
 
- using GFGGame.Launcher;
 
- namespace GFGGame
 
- {
 
-     public class QDDouYouManagerIos : SingletonBase<QDDouYouManagerIos>
 
-     {
 
-         public bool isLogining;
 
-         //ios sdk 返回的
 
-         public string uid;
 
-         public string account;
 
-         public string token;
 
-         public void Init()
 
-         {
 
-             Debug.Log("实例化DouYouSDKListenerIos");
 
-             QDDouYouManagerInitIos.Instance.douYouSDKListenerIos = new DouYouSDKListenerIos();
 
-         }
 
-         public void Login()
 
-         {
 
-             QDDouYouManagerInitIos.Instance.ShowLogin();
 
-         }
 
-         public void OnCreateRole()
 
-         {
 
-             QDManager.PushRoleAction(DouYouRoleLogReportType.CreateRole);
 
-         }
 
-         public void OnEnterGame()
 
-         {
 
-             QDManager.PushRoleAction(DouYouRoleLogReportType.EnterGame);
 
-         }
 
-         public void OnQuitToLoginView()
 
-         {
 
-             Debug.Log($"DouYou ios OnQuitToLoginView");
 
-         }
 
-         public void Logout()
 
-         {
 
-             Debug.Log($"Game.HotUpdate DouYou ios Logout");
 
-             QDDouYouManagerInitIos.Instance.Logout();
 
-         }
 
-         public void LoginOutBefore()
 
-         {
 
-             QDManager.PushRoleAction(DouYouRoleLogReportType.ExitGame);
 
-         }
 
-         // 辅助方法:处理空值
 
-         private static string HandleNullString(string value)
 
-         {
 
-             return string.IsNullOrEmpty(value) ? "" : value;
 
-         }
 
-         public void Pay(int buyID, int count, string orderID, long price)
 
-         {
 
-             ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(buyID);
 
-             if (shopCfg == null)
 
-             {
 
-                 Log.Error($"recharge {buyID} config not found!");
 
-                 return;
 
-             }
 
-             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
 
-             if (itemCfg == null)
 
-             {
 
-                 Log.Error($"recharge {buyID} itemCfgId:{shopCfg.itemId} config not found!");
 
-                 return;
 
-             }
 
-             string currencyName = string.Empty;
 
-             if (shopCfg.costType == CostType.FREE)
 
-             {
 
-                 //免费
 
-                 currencyName = "免费";
 
-             }
 
-             else if (shopCfg.costType == CostType.ITEM)
 
-             {
 
-                 //货币
 
-                 ItemCfg costItemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.costId);
 
-                 if (costItemCfg == null)
 
-                 {
 
-                     currencyName = $"货币{shopCfg.costId}";
 
-                 }
 
-                 else
 
-                 {
 
-                     currencyName = costItemCfg.name;
 
-                 }
 
-             }
 
-             else if (shopCfg.costType == CostType.RMB)
 
-             {
 
-                 //人民币
 
-                 currencyName = "人民币";
 
-             }
 
-             else
 
-             {
 
-                 //指定渠道商品id
 
-                 currencyName = $"指定商品id{shopCfg.costId}";
 
-             }
 
-             var zoneScene = GameGlobal.zoneScene;
 
-             if (zoneScene == null) return;
 
-             if (zoneScene.GetComponent<RoleInfosComponent>() == null ||
 
-                 zoneScene.GetComponent<RoleInfosComponent>().IsDisposed) return;
 
-             var roleInfo = zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRole();
 
-             if (roleInfo == null) return;
 
-             if (GameGlobal.myNumericComponent == null) return;
 
-             int lvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
 
-             int vipLvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.VipLevel);
 
-             if (zoneScene.GetComponent<ServerInfosComponent>() == null) return;
 
-             if (zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
 
-             var serverInfosComponent = zoneScene.GetComponent<ServerInfosComponent>();
 
-             //自定义参数
 
-             string cpOrderId = orderID;
 
-             string productPrice = price.ToString();
 
-             string productId = IAPManager.Instance.GetIosProductId(shopCfg.id);
 
-             string productName = shopCfg?.itemName ?? "";
 
-             string productDesc = shopCfg?.itemName ?? "";
 
-             string productCount = count.ToString();
 
-             string exchangeRate = 1.ToString();
 
-             string serverId = (serverInfosComponent?.CurrentServerId ?? 0).ToString();
 
-             string serverName = serverInfosComponent?.recentlyServerInfo?.ServerName ?? "";
 
-             string roleId = roleInfo.Id.ToString();
 
-             string roleName = roleInfo.Name;
 
-             string roleLevel = lvl.ToString();
 
-             string roleVip = vipLvl.ToString();
 
-             string partyName = LeagueDataManager.Instance.LeagueData?.Name ?? "";
 
-             string roleBalence = "0";
 
-             string other = orderID + "|gfg|" + roleInfo.Id;
 
-             Debug.Log(
 
-                 $"Ios ShowPay: cpOrderId:{cpOrderId} productPrice:{productPrice} productId:{productId} productName:{productName} productDesc:{productDesc} " +
 
-                 $"productCount:{productCount} exchangeRate:{exchangeRate} serverId:{serverId} serverName:{serverName} roleId:{roleId} roleName:{roleName} " +
 
-                 $"roleLevel:{roleLevel} roleVip:{roleVip} partyName:{partyName} roleBalence:{roleBalence} other:{other} currencyName:{currencyName}");
 
-             QDDouYouManagerInitIos.Instance.ShowPay(cpOrderId, productPrice, productId, productName, productDesc,
 
-                 productCount, exchangeRate, currencyName, serverId, serverName, roleId, roleName, roleLevel, roleVip,
 
-                 partyName, roleBalence, other);
 
-         }
 
-         public void Exit()
 
-         {
 
-             QDManager.PushRoleAction(DouYouRoleLogReportType.ExitGame);
 
-             QDDouYouManagerInitIos.Instance.Logout();
 
-         }
 
-     }
 
-     /// <summary>
 
-     /// SDK回调
 
-     /// </summary>
 
-     public class DouYouSDKListenerIos : IDouYouSDKListenerIos
 
-     {
 
-         /// <summary>
 
-         /// SDK实例化成功
 
-         /// </summary>
 
-         /// <param name="message">SDK 实例化成功</param>
 
-         public void InitSuccessAb(string message)
 
-         {
 
-             Debug.Log("Game.HotUpdate InitSuccessAb: " + message);
 
-         }
 
-         public void InitErrorAb(string message)
 
-         {
 
-             Debug.Log("Game.HotUpdate InitErrorAb: " + message);
 
-         }
 
-         /// <summary>
 
-         /// 登录成功 
 
-         /// </summary>
 
-         /// <param name="message">resUid + "|gfg|" + token</param>
 
-         public void LoginSuccessAb(string message)
 
-         {
 
-             Debug.Log("Game.HotUpdate ios LoginSuccessAb: " + message);
 
-             DouYouIosSdkLoginResModel douYouIosSdkLoginResModel =
 
-                 LitJson.JsonMapper.ToObject<DouYouIosSdkLoginResModel>(message);
 
-             if (douYouIosSdkLoginResModel == null)
 
-             {
 
-                 Log.Error($"注意,解析登录回调失败,回调的字符串为 {message} douYouIosSdkLoginResModel is null.");
 
-                 return;
 
-             }
 
-             QDDouYouManagerIos.Instance.isLogining = false;
 
-             QDDouYouManagerIos.Instance.uid = douYouIosSdkLoginResModel.uid;
 
-             QDDouYouManagerIos.Instance.token = douYouIosSdkLoginResModel.token;
 
-             //登录成功的回调
 
-             EventAgent.DispatchEvent(ConstMessage.ON_PLATFORM_SDK_LOGINED, douYouIosSdkLoginResModel.uid);
 
-         }
 
-         /// <summary>
 
-         /// 登录失败
 
-         /// </summary>
 
-         /// <param name="message"></param>
 
-         public void LoginErrorAb(string message)
 
-         {
 
-             Debug.Log("Game.HotUpdate LoginErrorAb: " + message);
 
-         }
 
-         /// <summary>
 
-         /// 切换账号回调---先当成退出登录处理
 
-         /// </summary>
 
-         public void SwitchAccountsAb(string message)
 
-         {
 
-             Debug.Log("Game.HotUpdate SwitchAccountsAb: " + message);
 
-             GameController.QuitToLoginView(false);
 
-             EventAgent.DispatchEvent(ConstMessage.OUT_LOGIN);
 
-         }
 
-         /// <summary>
 
-         /// 退出登录后
 
-         /// </summary>
 
-         /// <param name="message">退出登录成功!</param>
 
-         public void LogoutSuccessAb(string message)
 
-         {
 
-             Debug.Log("Game.HotUpdate LogoutSuccessAb: " + message);
 
-             GameController.QuitToLoginView(false);
 
-             EventAgent.DispatchEvent(ConstMessage.OUT_LOGIN);
 
-         }
 
-         /// <summary>
 
-         /// 退出登录失败
 
-         /// </summary>
 
-         /// <param name="message"></param>
 
-         public void LogoutErrorAb(string message)
 
-         {
 
-             Debug.Log("Game.HotUpdate LogoutErrorAb: " + message);
 
-         }
 
-         /// <summary>
 
-         /// 支付失败
 
-         /// </summary>
 
-         /// <param name="message">code + "|gfg|" + params.toString()</param>
 
-         public void PayErrorAb(string message)
 
-         {
 
-             Debug.Log("Game.HotUpdate PayErrorAb: " + message);
 
-             //改变临时订单状态为失败
 
-         }
 
-         /// <summary>
 
-         /// 支付成功
 
-         /// </summary>
 
-         /// <param name="message">code + "|gfg|" + params.toString()</param>
 
-         public void PaySuccessAb(string message)
 
-         {
 
-             Debug.Log("Game.HotUpdate PaySuccessAb" + message);
 
-             //改变临时订单状态为支付成功
 
-             QDManager.PushRoleAction(DouYouRoleLogReportType.Pay);
 
-         }
 
-         //角色升级上报成功回调
 
-         public void RoleInfoReportSuccessAb(string message)
 
-         {
 
-         }
 
-         //角色升级上报失败回调
 
-         public void RoleInfoReportErrorAb(string message)
 
-         {
 
-         }
 
-     }
 
- }
 
 
  |