using System; using ET; using GFGGame.Launcher; using UnityEngine; namespace GFGGame { public class QDManager { public bool isLogining; public string uid; public static void Init() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: //QDShareManager.Instance.Init(); break; case (int)ChannelID.DouYou: if (LauncherConfig.platformId == 2) { QDDouYouManagerIos.Instance.Init(); } else { QDDouYouManager.Instance.Init(); } //QDShareManager.Instance.Init(); break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Init(); //QDShareManager.Instance.Init(); break; case (int)ChannelID.GFG: if (LauncherConfig.platformId == 2) { QDAppStoreManager.Init(); } break; default: break; } } public static void Login() { ViewManager.Show("登录中..."); switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: bool login = GameController.CheckLoginCache(true); if (!login) { ViewManager.Hide(); ViewManager.Show(); } break; case (int)ChannelID.DouYou: if (LauncherConfig.platformId == 2) { QDDouYouManagerIos.Instance.Login(); } else { QDDouYouManager.Instance.Login(); } break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Login(); break; case (int)ChannelID.GFG: bool loginAppStore = GameController.CheckLoginCache(true); if (!loginAppStore) { ViewManager.Hide(); ViewManager.Show(); } break; default: break; } } public static void OnCreateRole() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: if (LauncherConfig.platformId == 1) { QDDouYouManager.Instance.OnCreateRole(); } break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.OnCreateRole(); break; case (int)ChannelID.GFG: if (LauncherConfig.platformId == 2) { QDAppStoreManager.OnCreateRole(); } break; default: break; } } public static void OnEnterGame() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: if (LauncherConfig.platformId == 2) { QDDouYouManagerIos.Instance.OnEnterGame(); } else { QDDouYouManager.Instance.OnEnterGame(); } break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.OnEnterGame(); break; case (int)ChannelID.GFG: if (LauncherConfig.platformId == 2) { QDAppStoreManager.OnEnterGame(); } break; default: break; } } //回到登录界面,不退出账号 public static void OnQuitToLoginView() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: if (LauncherConfig.platformId == 2) { QDDouYouManagerIos.Instance.OnQuitToLoginView(); } else { QDDouYouManager.Instance.OnQuitToLoginView(); } break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.OnQuitToLoginView(); break; case (int)ChannelID.GFG: break; default: break; } } public static void Pay(int buyID, int count, string orderID, long price) { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: if (LauncherConfig.platformId == 2) { QDDouYouManagerIos.Instance.Pay(buyID, count, orderID, price); } else { QDDouYouManager.Instance.Pay(buyID, count, orderID, price); } break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Pay(buyID, count, orderID, price); break; case (int)ChannelID.GFG: if (LauncherConfig.platformId == 2) { QDAppStoreManager.Pay(buyID, count, orderID, price); } break; default: break; } } public static void Logout() { GameGlobal.zoneScene.GetComponent()?.Disconnect(); GameGlobal.zoneScene.GetComponent()?.ServerInfoList?.Clear(); GameGlobal.zoneScene.GetComponent()?.Clear(); if (PlayerPrefs.HasKey(GameConst.PASSWORD_LAST_LOGIN_KEY)) { PlayerPrefs.DeleteKey(GameConst.PASSWORD_LAST_LOGIN_KEY); } switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: if (LauncherConfig.platformId == 2) { QDDouYouManagerIos.Instance.Logout(); } else { QDDouYouManager.Instance.Logout(); } break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Logout(); break; case (int)ChannelID.GFG: ViewManager.Show(); break; default: break; } } public static void Exit() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: GameController.ShowExitAlert(); break; case (int)ChannelID.DouYou: if (LauncherConfig.platformId == 2) { QDDouYouManagerIos.Instance.Exit(); } else { QDDouYouManager.Instance.Exit(); } break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Exit(); break; case (int)ChannelID.GFG: GameController.ShowExitAlert(); break; default: break; } } public static void TapTapShare(string url) { #if PT_IosLocal if (Convert.ToInt32(LauncherConfig.apkVersion) > 2.2) { QDDouYouManagerIos.Instance.Share(url); } #endif } //上报角色行为给sdk public static void PushRoleAction(DouYouRoleLogReportType reportType) { var zoneScene = GameGlobal.zoneScene; if (zoneScene == null) return; if (zoneScene.GetComponent() == null || zoneScene.GetComponent().IsDisposed) return; var roleInfo = zoneScene.GetComponent().GetCurrentRole(); if (roleInfo == null) return; if (GameGlobal.myNumericComponent == null) return; int roleLvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl); int vipLvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.VipLevel); if (zoneScene.GetComponent() == null) return; if (zoneScene.GetComponent().recentlyServerInfo == null) return; string serverName = zoneScene.GetComponent().recentlyServerInfo.ServerName; string partyName = LeagueDataManager.Instance.LeagueData?.Name ?? ""; string roleBalence = "0"; switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: if (LauncherConfig.platformId == 2) { QDDouYouManagerInitIos.Instance.ReportRoleInfo(((int)reportType).ToString(), roleInfo.ServerId.ToString(), serverName, roleInfo.Id.ToString(), roleInfo.Name, roleLvl.ToString(), vipLvl.ToString(), partyName, roleBalence); } else { QDDouYouManagerInit.Instance.ReportRole((int)reportType, roleInfo.Id.ToString(), roleLvl.ToString(), roleInfo.Name, roleInfo.ServerId.ToString(), serverName); } break; case (int)ChannelID.DouYouDev: QDDouYouManagerInit.Instance.ReportRole((int)reportType, roleInfo.Id.ToString(), roleLvl.ToString(), roleInfo.Name, roleInfo.ServerId.ToString(), serverName); break; case (int)ChannelID.GFG: break; default: break; } } public static bool IsTaptap { get { return LauncherConfig.ChannelId == (int)ChannelID.TapTap; } } public static bool IsHYKB { get { return LauncherConfig.ChannelId == (int)ChannelID.HYKB; } } public static bool IsBiliBili { get { return LauncherConfig.ChannelId == (int)ChannelID.BiliBili; } } public static bool IsHuaWei { get { return LauncherConfig.ChannelId == (int)ChannelID.HUAWEI; } } } }