| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 | 
							- using FairyGUI;
 
- using UnityEngine;
 
- using ET;
 
- using static GFGGame.LauncherConfig;
 
- using TapTap.Bootstrap;
 
- namespace GFGGame
 
- {
 
-     public class GameController
 
-     {
 
-         public static void Start()
 
-         {
 
-             //界面
 
-             ViewManager.Init();
 
-             //日志
 
-             LogController.Instance.Init();
 
-             //全局
 
-             GameGlobal.Init();
 
-             //缓存
 
-             LocalCache.InitLocalData();
 
-             //sqlite
 
-             SqliteController.Instance.Init(false, ResPathUtil.SQLITE_FILE_PATH);
 
-             //全局点击效果
 
-             ViewGlobal.CreatClickEffect();
 
-             //获取游戏配置
 
-             GetGameCfg();
 
-         }
 
-         /// <summary>
 
-         /// 获取游戏配置
 
-         /// </summary>
 
-         public static void GetGameCfg()
 
-         {
 
-             var url = LauncherConfig.cfgUrl.Replace("{cfgName}", GameGlobal.cfgName);
 
-             url = url + "?t=" + TimeHelper.ClientNow();
 
-             HttpTool.Instance.Get(url, (string data) =>
 
-             {
 
-                 //初始化游戏配置
 
-                 GameConfig.InitData(data);
 
-                 //显示登录
 
-                 LoginController.ShowLogin();
 
-             });
 
-         }
 
-         public static bool CheckLoginCache(bool doLogin)
 
-         {
 
-             string account = PlayerPrefs.GetString(GameConst.ACCOUNT_LAST_LOGIN_KEY, null);
 
-             string password = PlayerPrefs.GetString(GameConst.PASSWORD_LAST_LOGIN_KEY, null);
 
-             bool lastLoginIsVisitor = LocalCache.GetBool(GameConst.LAST_LOGIN_IS_VISITOR_KEY, false);
 
-             if (lastLoginIsVisitor)
 
-             {
 
-                 long id = (long)PlayerPrefs.GetFloat(GameConst.VISITOR_ID_KEY, -1);
 
-                 if (id >= 0)
 
-                 {
 
-                     if (doLogin)
 
-                     {
 
-                         //LoginProxy.LoginAsVisitor();
 
-                     }
 
-                     return true;
 
-                 }
 
-             }
 
-             else if (!string.IsNullOrEmpty(account))
 
-             {
 
-                 if (!string.IsNullOrEmpty(password))
 
-                 {
 
-                     if (doLogin)
 
-                     {
 
-                         LoginController.Login(account, password, true).Coroutine();
 
-                     }
 
-                     return true;
 
-                 }
 
-                 else if (LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL && PlayerPrefs.HasKey(GameConst.PASSWORD_LAST_LOGIN_KEY))
 
-                 {
 
-                     if (doLogin)
 
-                     {
 
-                         LoginController.LoginTest(account).Coroutine();
 
-                     }
 
-                     return true;
 
-                 }
 
-             }
 
-             return false;
 
-         }
 
-         public static void CheckSpecialAccount(string account)
 
-         {
 
-             GameGlobal.antiAddiction = !(account.IndexOf("sygfg") == 0);
 
-         }
 
-         public static void ShowCreateRole()
 
-         {
 
-             ViewManager.Show(ViewName.CREATE_ROLE_VIEW);
 
-         }
 
-         public static async ETTask PreEnterGameAsync()
 
-         {
 
-             QDTapTapManager.Instance.OnEnterGame();
 
-             RoleDataHandler.StartUpdate();
 
-             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("CommonGame"));
 
-             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Main"));
 
-             await ItemProxy.GetItemInfos();
 
-             await InstanceZonesSProxy.GetInstanceZonesInfos();
 
-             await StorageSProxy.ReqGetClientValues();
 
-             await SuitFosterProxy.SendGetSuitInfos();
 
-             await ActivitySProxy.ReqDailyLoginInfos();
 
-             await RechargeSProxy.ReqRequestGiftBagInfo();
 
-             await StudioSProxy.ReqStudioInfos();
 
-             await RoleInfoSProxy.ReqPersonalInfo();
 
-             GameGlobal.lastLoginTime = StorageDataManager.Instance.GetStorageValue(ConstStorageId.LAST_LOGIN_TIME);
 
-             long lastTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
 
-             StorageSProxy.ReqSetClientValue(ConstStorageId.LAST_LOGIN_TIME, (int)lastTime).Coroutine();
 
-             int skipGuide = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_SKIP_GUIDE);
 
-             if (skipGuide <= 0 && LauncherConfig.netType == EnumNetType.LOCAL)
 
-             {
 
-                 AlertUI.Show("是否跳过引导?如果您是第一次体验,建议不要跳过引导!")
 
-                            .SetLeftButton(true, "不用", (obj) =>
 
-                            {
 
-                                EnterGame();
 
-                                StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_SKIP_GUIDE, 1).Coroutine();
 
-                            })
 
-                            .SetRightButton(true, "跳过", (obj) =>
 
-                            {
 
-                                GameGlobal.skipGuide = true;
 
-                                EnterGame();
 
-                                StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_SKIP_GUIDE, 2).Coroutine();
 
-                            });
 
-             }
 
-             else
 
-             {
 
-                 if (skipGuide == 2) GameGlobal.skipGuide = true;
 
-                 EnterGame();
 
-             }
 
-         }
 
-         public static void QuitToLoginView(bool logout)
 
-         {
 
-             GameGlobal.DataInited = false;
 
-             QDManager.OnQuitToLoginView();
 
-             GameGlobal.isVisitor = false;
 
-             GameGlobal.antiAddiction = true;
 
-             GameGlobal.userId = 0;
 
-             GameGlobal.userAge = 0;
 
-             GameGlobal.skipGuide = false;
 
-             GuideDataManager.currentGuideId = 0;
 
-             MainDataManager.Instance.ViewType = 0;
 
-             RoleDataHandler.StopUpdate();
 
-             CardDataManager.Clear();
 
-             DecomposeDataManager.Instance.Clear();
 
-             PhotographDataManager.Instance.Clear();
 
-             SkillDataManager.Instance.Clear();
 
-             SuitFosterDataManager.Instance.Clear();
 
-             StudioDataManager.Instance.Clear();
 
-             StorageDataManager.Instance.Clear();
 
-             RechargeDataManager.Instance.Clear();
 
-             DressUpMenuItemDataManager.Clear();
 
-             GuideDataManager.Clear();
 
-             GetSuitItemController.Clear();
 
-             FriendDataManager.Instance.Clear();
 
-             RedDotController.Instance.Clear();
 
-             BagDataManager.Instance.Clear();
 
-             PoemPhotoDataManager.Instance.Clear();
 
-             PoemGalleryDataManager.Instance.Clear();
 
-             RoleInfoManager.Instance.Clear();
 
-             DailyTaskDataManager.Instance.Clear();
 
-             TravelDataManager.Instance.Clear();
 
-             GameGlobal.zoneScene.GetComponent<SessionComponent>()?.Disconnect();
 
-             GameGlobal.zoneScene.GetComponent<ServerInfosComponent>()?.ServerInfoList?.Clear();
 
-             GameGlobal.zoneScene.GetComponent<AccountInfoComponent>()?.Clear();
 
-             if (logout)
 
-             {
 
-                 Logout();
 
-             }
 
-             LoginController.OnLogout();
 
-             ViewManager.Hide<GuideView>();
 
-             ViewManager.Show<LoginView>(null, null, true);
 
-         }
 
-         //注销
 
-         public static void Logout()
 
-         {
 
-             QDManager.Logout();
 
-             PlayerPrefs.DeleteKey(GameConst.PASSWORD_LAST_LOGIN_KEY);
 
-         }
 
-         public static void GoBackToMainView()
 
-         {
 
-             ViewManager.Show(ViewName.MAINUI_VIEW, null, null, true);
 
-         }
 
-         private static void EnterGame()
 
-         {
 
-             LoadingView.Instance.GetUI();
 
-             LoadingView.Instance.SetProgress(100, () =>
 
-             {
 
-                 ViewManager.Hide<LoadingView>();
 
-                 // LoadingView.Instance.Close();
 
-                 GameGlobal.isEnterGame = true;
 
-                 if (MainStoryDataManager.CheckOpenMainUI() || GameGlobal.skipGuide)
 
-                 {
 
-                     ViewManager.Show(ViewName.MAINUI_VIEW);
 
-                 }
 
-                 else
 
-                 {
 
-                     MainStoryDataManager.currentChapterCfgId = 10001;
 
-                     if (GameGlobal.isFirstEntry == true)
 
-                     {
 
-                         GameGlobal.isFirstEntry = false;
 
-                         // StoryController.ShowPriorStoryDialog();
 
-                         StoryController.ShowLevelView(100001001);
 
-                     }
 
-                     else
 
-                     {
 
-                         ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, MainStoryDataManager.currentChapterCfgId, new object[] { ViewName.STORY_CHAPTER_LIST_VIEW });
 
-                     }
 
-                 }
 
-                 Timers.inst.Add(1f, 1, AfterEnterGame);
 
-             });
 
-         }
 
-         private static async void AfterEnterGame(object param)
 
-         {
 
-             ItemHelper.GetItemAttributeInfos().Coroutine();
 
-             MainStorySProxy.GetStoryInfos().Coroutine();
 
-             CardSProxy.GetCardInfos().Coroutine();
 
-             RechargeSProxy.ReqRechargeInfo().Coroutine();
 
-             RechargeSProxy.ReqExchangeInfo().Coroutine();
 
-             DailyTaskSProxy.ReqDailyTaskInfos().Coroutine();
 
-             NoticeSProxy.ReqSystemNoticeList().Coroutine();
 
-             MailSProxy.ReqMailCount().Coroutine();
 
-             FriendSProxy.ReqAllFriendInfos().Coroutine();
 
-             PoemPhotoSProxy.ReqAllPhotoInfos().Coroutine();
 
-             TravelSProxy.ReqTravelInfo().Coroutine();
 
-             TravelSProxy.ReqTravelGuideInfo().Coroutine();
 
-             PoemGallerySProxy.ReqGalleryTheme().Coroutine();
 
-             int storageAutoPlay = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY);
 
-             FightDataManager.Instance.autoPlay = storageAutoPlay <= 0 ? false : true;
 
-             int fightSpeed = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_FIGHT_AUTO_PLAY_SPEED);
 
-             FightDataManager.Instance.fightSpeed = fightSpeed <= 0 ? 1 : fightSpeed;
 
-             int dialogSpeed = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_DIALOG_AUTO_PLAY_SPEED);
 
-             FightDataManager.Instance.dialogSpeed = dialogSpeed <= 0 ? 1 : dialogSpeed;
 
-             int filingChapterId = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STUDIO_FILING_CHAPTERID);
 
-             StudioDataManager.Instance.filingChapterId = filingChapterId <= 0 ? StudioDataManager.Instance.FilingDatas[0].id : filingChapterId;
 
-             GameGlobal.skipCheckOpen = StorageDataManager.Instance.GetStorageValue(ConstStorageId.SKIP_CHECK_OPEN) <= 0 ? false : true;
 
-             bool result = await FieldSProxy.ReqFieldInstanceInfos();
 
-             if (result && FieldDataManager.Instance.fieldInfos.hasBonus)
 
-             {
 
-                 bool result1 = await FieldSProxy.ReqFieldInstanceResult();
 
-                 if (result1)
 
-                 {
 
-                     ViewManager.Show<FieldFightEndView>();
 
-                 }
 
-             }
 
-             EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
 
-         }
 
-     }
 
- }
 
 
  |