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) { default: QDDouYouManager.Instance.Init(); break; } } public static void Login() { ViewManager.Show("登录中..."); switch (LauncherConfig.ChannelId) { case (int)ChannelID.TapTap: break; case (int)ChannelID.Test: bool login = GameController.CheckLoginCache(true); if (!login) { ViewManager.Hide(); ViewManager.Show(); } break; case (int)ChannelID.DouYouTest: QDDouYouManager.Instance.Login(); break; default: //QDDouYouManager.Instance.Login(); break; } } public static void OnCreateRole() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.TapTap: break; case (int)ChannelID.Test: break; case (int)ChannelID.DouYouTest: QDDouYouManager.Instance.OnCreateRole(); break; default: //QDDouYouManager.Instance.OnCreateRole(); break; } } public static void OnEnterGame() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.TapTap: break; case (int)ChannelID.Test: break; case (int)ChannelID.DouYouTest: QDDouYouManager.Instance.OnEnterGame(); break; default: //QDDouYouManager.Instance.OnEnterGame(); break; } } //回到登录界面,不退出账号 public static void OnQuitToLoginView() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.TapTap: break; case (int)ChannelID.Test: break; case (int)ChannelID.DouYouTest: QDDouYouManager.Instance.OnQuitToLoginView(); break; default: //QDDouYouManager.Instance.OnQuitToLoginView(); break; } } public static void Pay(int buyID, int count, string orderID, long price) { switch (LauncherConfig.ChannelId) { case (int)ChannelID.TapTap: break; case (int)ChannelID.Test: break; case (int)ChannelID.DouYouTest: QDDouYouManager.Instance.Pay(buyID, count, orderID, price); break; default: //QDDouYouManager.Instance.Pay(buyID, count, orderID, price); break; } } public static void Logout(bool fromSdkLogoutCallback) { 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) { default: if (!fromSdkLogoutCallback) { QDDouYouManager.Instance.Logout(); } break; } } public static void Exit() { switch (LauncherConfig.ChannelId) { case (int)ChannelID.Test: GameController.ShowExitAlert(); break; case (int)ChannelID.DouYouTest: QDDouYouManager.Instance.Exit(); break; default: //QDDouYouManager.Instance.Exit(); break; } } //上报角色行为给sdk public static void PushRoleAction(DouYouRoleLogReportType reportType) { //改名上报给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); } public static bool IsTaptap { get { return LauncherConfig.ChannelId == (int)ChannelID.TapTap; } } } }