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: // AliManagerr.Instance.Init(); // QDShareManager.Instance.Init(); break; case (int)ChannelID.DouYou: //QDDouYouManager.Instance.Init(); #if GFGZSB AliManagerr.Instance.Init(); //QDShareManager.Instance.Init(); #else if (LauncherConfig.platformId == 2) { #if !UNITY_EDITOR && UNITY_IOS QDDouYouManagerIos.Instance.Init(); #endif } else { QDDouYouManager.Instance.Init(); } #endif break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Init(); //QDShareManager.Instance.Init(); break; case (int)ChannelID.AppStore: #if !UNITY_EDITOR && UNITY_IOS QDAppStoreManager.Init(); #endif 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 GFGZSB bool loginDouYou = GameController.CheckLoginCache(true); if (!loginDouYou) { ViewManager.Hide(); ViewManager.Show(); } #else if (LauncherConfig.platformId == 2) { #if !UNITY_EDITOR && UNITY_IOS QDDouYouManagerIos.Instance.Login(); #endif } else { QDDouYouManager.Instance.Login(); } #endif break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Login(); break; case (int)ChannelID.AppStore: //TODO 接douyou ios的sdk登录 break; default: break; } } public static void OnCreateRole() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: #if !GFGZSB if (LauncherConfig.platformId == 1) { QDDouYouManager.Instance.OnCreateRole(); } #endif break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.OnCreateRole(); break; default: break; } } public static void OnEnterGame() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: #if !GFGZSB if (LauncherConfig.platformId == 2) { #if !UNITY_EDITOR && UNITY_IOS QDDouYouManagerIos.Instance.OnEnterGame(); #endif } else { QDDouYouManager.Instance.OnEnterGame(); } #endif break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.OnEnterGame(); break; case (int)ChannelID.AppStore: //TODO 接入douYou sdk break; default: break; } } //回到登录界面,不退出账号 public static void OnQuitToLoginView() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: #if !GFGZSB if (LauncherConfig.platformId == 2) { #if !UNITY_EDITOR && UNITY_IOS QDDouYouManagerIos.Instance.OnQuitToLoginView(); #endif } else { QDDouYouManager.Instance.OnQuitToLoginView(); } #endif break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.OnQuitToLoginView(); break; case (int)ChannelID.AppStore: //TODO 接入douYou sdk 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 GFGZSB //TODO gfg支付跳转 ViewManager.Show(new object[] { buyID, orderID, price }); #else if (LauncherConfig.platformId == 2) { #if !UNITY_EDITOR && UNITY_IOS QDDouYouManagerIos.Instance.Pay(buyID, count, orderID, price); #endif } else { QDDouYouManager.Instance.Pay(buyID, count, orderID, price); } #endif break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Pay(buyID, count, orderID, price); break; case (int)ChannelID.AppStore: //TODO 接入douYou sdk 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 !GFGZSB if (LauncherConfig.platformId == 2) { #if !UNITY_EDITOR && UNITY_IOS QDDouYouManagerIos.Instance.Logout(); #endif } else { QDDouYouManager.Instance.Logout(); } #endif break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Logout(); break; case (int)ChannelID.AppStore: //TODO 接入douYou sdk break; default: break; } } public static void Exit() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: GameController.ShowExitAlert(); break; case (int)ChannelID.DouYou: #if GFGZSB GameController.ShowExitAlert(); #else if (LauncherConfig.platformId == 2) { #if !UNITY_EDITOR && UNITY_IOS QDDouYouManagerIos.Instance.Exit(); #endif } else { QDDouYouManager.Instance.Exit(); } #endif break; case (int)ChannelID.DouYouDev: QDDouYouManager.Instance.Exit(); break; case (int)ChannelID.AppStore: //TODO 接入douYou sdk break; default: break; } } //上报角色行为给sdk public static void PushRoleAction(DouYouRoleLogReportType reportType) { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: break; case (int)ChannelID.DouYou: //改名上报给sdk // 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 lvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl); // // if (zoneScene.GetComponent() == null) return; // if (zoneScene.GetComponent().recentlyServerInfo == null) return; // // string serverName = zoneScene.GetComponent().recentlyServerInfo.ServerName; // QDDouYouManagerInit.Instance.ReportRole((int)reportType, // roleInfo.Id.ToString(), lvl.ToString(), roleInfo.Name, roleInfo.ServerId.ToString(), // serverName); break; case (int)ChannelID.DouYouDev: //改名上报给sdk var zoneSceneDev = GameGlobal.zoneScene; if (zoneSceneDev == null) return; if (zoneSceneDev.GetComponent() == null || zoneSceneDev.GetComponent().IsDisposed) return; var roleInfoDev = zoneSceneDev.GetComponent().GetCurrentRole(); if (roleInfoDev == null) return; if (GameGlobal.myNumericComponent == null) return; int lvlDev = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl); if (zoneSceneDev.GetComponent() == null) return; if (zoneSceneDev.GetComponent().recentlyServerInfo == null) return; string serverNameDev = zoneSceneDev.GetComponent().recentlyServerInfo.ServerName; QDDouYouManagerInit.Instance.ReportRole((int)reportType, roleInfoDev.Id.ToString(), lvlDev.ToString(), roleInfoDev.Name, roleInfoDev.ServerId.ToString(), serverNameDev); break; case (int)ChannelID.AppStore: //TODO 接入douYou sdk 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; } } } }