123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- 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<ModalStatusView>("登录中...");
- switch (LauncherConfig.ChannelId)
- {
- case (int)ChannelID.Test:
- bool login = GameController.CheckLoginCache(true);
- if (!login)
- {
- ViewManager.Hide<ModalStatusView>();
- ViewManager.Show<LoginInputView>();
- }
- break;
- case (int)ChannelID.DouYou:
- #if GFGZSB
- bool loginDouYou = GameController.CheckLoginCache(true);
- if (!loginDouYou)
- {
- ViewManager.Hide<ModalStatusView>();
- ViewManager.Show<LoginInputView>();
- }
- #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<StorePayPropView>(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<SessionComponent>()?.Disconnect();
- GameGlobal.zoneScene.GetComponent<ServerInfosComponent>()?.ServerInfoList?.Clear();
- GameGlobal.zoneScene.GetComponent<AccountInfoComponent>()?.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<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);
- //
- // if (zoneScene.GetComponent<ServerInfosComponent>() == null) return;
- // if (zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
- //
- // string serverName = zoneScene.GetComponent<ServerInfosComponent>().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<RoleInfosComponent>() == null ||
- zoneSceneDev.GetComponent<RoleInfosComponent>().IsDisposed) return;
- var roleInfoDev = zoneSceneDev.GetComponent<RoleInfosComponent>().GetCurrentRole();
- if (roleInfoDev == null) return;
- if (GameGlobal.myNumericComponent == null) return;
- int lvlDev = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
- if (zoneSceneDev.GetComponent<ServerInfosComponent>() == null) return;
- if (zoneSceneDev.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
- string serverNameDev =
- zoneSceneDev.GetComponent<ServerInfosComponent>().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; }
- }
- }
- }
|