require("Global.Global")
require("Common.LocalController")
local GlobalProtect = require("Global.GlobalProtect")
local GameQualitySettings = require("Util.GameQualitySettings")
if CS.SDKManager.IS_UNITY_EDITOR() then
end
GameMain = {}
local Start = function()
  PostEventLog.Track("IM_LAUNCH_PERMISSIONS_STATE", {
    auth_push = CS.GameEntry.Sdk:GetIsNotifyOpen()
  })
  Logger.Log("GameMain start.....")
  if CS.CommonUtils.IsDebug() and CS.UnityEngine.Application.isEditor then
    Logger.Log("Start lua debugger client")
  end
  LuaEntry:init()
  CommonUtil.ProtectCall(function()
    GameQualitySettings.Init()
  end)
  PBController.InitPBConfig()
  if CS.CommonUtils.IsDebug() then
    DataCenter.LWDevConsoleManager:Startup()
  end
  CommonUtil.ProtectCall(function()
    DataCenter.GMManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildEffectManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWSceneStateManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.SceneCameraManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.QueueDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildTimeManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildBubbleManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldBuildBubbleManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildUpgradeEffectManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildConnectEffectManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ResidentOrderDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ResourceItemDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CollectResourceManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.EarthOrderDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildCanUpgradeEffectManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    CityDomeProtectEffectManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildQueueManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildTrainEffectManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    BuildBloodManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    AllianceBuildBloodManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    RobotBuildTipManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldMarchTileUIManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    TroopHeadUIManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LoadEditorBuildManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    TroopNameLabelManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldTroopAttackBuildIconManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldTroopTransIconManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    CityMovingEffectManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    TileBubbleManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.NextGarbagePointManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideCityAnimManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CanUnlockFogManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.UINoInputManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldAllianceCityDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.DesertDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CollectRewardDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldArrowManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    BuildBoxFinishEffectManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    MonsterRewardBoxEffectManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldCanBuildEffectManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldNewsTipsManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldDesertEffectManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    CityGarbageBubbleManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldBuildHeadUIManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldDesertSelectEffectManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    BuildDestroyEffectManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    BuildFixEffectManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldBattleBuffManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    WorldBossBloodTipManager:GetInstance():Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.RecommendShowManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceCityTipManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.SurpriseBuildingTipManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceCityTemplateManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceNoticeManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.TerrainDecorationManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPointDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPointManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AirDropGarbageManager:Startup()
  end)
  EventManager:GetInstance():AddListener(EventId.LOAD_COMPLETE, GameMain.OnEnterGame)
  CommonUtil.ProtectCall(function()
    DataCenter.FlyController:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildZoneManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LoginGuideManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LoginPopManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideAllianceMemberEffectManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceCareerManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LandLockChooseBubbleManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LandLockBubbleManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPioneerYellowArrowManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.HeroEntrustManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.HeroEntrustBubbleManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideNeedLoadManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ShaderEffectManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.EnergyOrderManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.RoadBubbleManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.PveDropRewardInfoManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildUpgradeStockManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityZoneManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityDomeManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPioneerManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityZoneMgr:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldBuildTimeManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildHeroManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.PayManager:Warmup()
  end)
  CS.MoreMountains.NiceVibrations.MMVibrationManager.SetHapticsActive(CS.GameEntry.Setting:GetBool(SettingKeys.VIBRATE, true))
  CommonUtil.ProtectCall(function()
    PveUtil.CheckConfigChanged()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWMyStationDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWAllyStationDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWMyStationManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllyDrillDataManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWCityPerformNpcManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWPlotManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWGuideFlowManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWGateDefenceManager:Starup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWGateTruckGoodsManager:Starup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWOpeningStageManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWFiveStarManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.XiaoFanManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWCountStageManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWNewsCenterManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWPVPArenaManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWCustomerServiceManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWTrainManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWTranslationRatingManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.NetProxyTrackManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ChatCacheMsgManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWSeasonTrendsManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWTitaniumBlueStoreManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWStageFeatureChapterManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWEasyStageFeatureChapterManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWBeginnerDirectorManager:StartUp()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildHeroCountdownManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildHelpNpcManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.StageFeatureBuildingManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.TCCardWorldManager:Startup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.RadarZombieBusTrainCityManager:StartUp()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.FlowerTrainGroupManager:Startup()
  end)
  DataCenter.CommonRedPointManager:Startup()
  collectgarbage("setpause", 99)
  collectgarbage("setstepmul", 500)
end
local Exit = function()
  CommonUtil.ProtectCall(function()
    RaceEntranceUtil.CleanTemplate()
  end)
  CommonUtil.ProtectCall(function()
    LuaDBInterface.Uninit()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.RadarZombieBusTrainCityManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWBeginnerDirectorManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildHeroManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWMyStationDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWTrainDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWMyStationManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWTrainManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWBattleManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ZombieBattleManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldBattleManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldFakeBattleManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldTroopLineManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ResourceManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPioneerManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityDomeManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    BattleFieldUtil.Reset()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityZoneManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityZoneTemplateManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.PveDropRewardInfoManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildUpgradeStockManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.RoadBubbleManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ShaderEffectManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideNeedLoadManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.HeroEntrustBubbleManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.HeroEntrustManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPioneerYellowArrowManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceCareerManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideAllianceMemberEffectManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildZoneManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AirDropGarbageManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.RecommendShowManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.UINoInputManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CanUnlockFogManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideCityAnimManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.NextGarbagePointManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideCityManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildZeroUpgradeEffectManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ArrowManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MonsterManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildTrainEffectManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ActDispatchTreasureManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ItemData:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildQueueManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildCanUpgradeEffectManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    CityDomeProtectEffectManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.EarthOrderDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.QueueDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildTimeManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildBubbleManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldBuildBubbleManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.PushNoticeManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.PushSettingsManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AccountManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildUpgradeEffectManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildConnectEffectManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ResidentOrderDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ResourceItemDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ResLackManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CollectResourceManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldAllianceCityDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.DesertDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CollectRewardDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceCityTipManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.SurpriseBuildingTipManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceCityTemplateManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceNoticeManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldDesertRefreshTemplateManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BaseExpansionTemplateManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.TerrainDecorationManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPointDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPointManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BattleLevel:Destroy()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.FlyController:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityTriggerPointDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityNpcManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPrologueBuildManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldBuildTimeManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.EquipDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityArmyYardManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWPlotManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWGuideFlowManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWGateDefenceManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWGateTruckGoodsManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWOpeningStageManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWCountStageManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWNewsCenterManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWPVPArenaManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    WastelandFarmManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WastelandModelMgr:GetInstance():Destroy()
  end)
  CommonUtil.ProtectCall(function()
    AllianceBuildBloodManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.TCCardWorldManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    BuildBloodManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    RobotBuildTipManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldMarchTileUIManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    TroopHeadUIManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LoadEditorBuildManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldTroopTransIconManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldTroopAttackBuildIconManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    TroopNameLabelManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    CityMovingEffectManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    TileBubbleManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldArrowManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    MonsterRewardBoxEffectManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    BuildBoxFinishEffectManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldCanBuildEffectManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldBossBloodTipManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    CityGarbageBubbleManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldNewsTipsManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldDesertEffectManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldDesertSelectEffectManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldBuildHeadUIManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    BuildDestroyEffectManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    BuildFixEffectManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    WorldBattleBuffManager:GetInstance():Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWWelcomeBackManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWTrainPrepareSceneManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    UIManager:GetInstance():DestroyAllWindow(true)
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ScreenEffectManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MailDataManager:Cleanup()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWGuideManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityVisitorManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.DispatchingManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWCityPerformNpcManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MonopolyManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.XiaoFanManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    ChatManager2:GetInstance():Uninit()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildEffectManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityZoneMgr:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWSceneStateManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWWorldTrendDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWCustomerServiceManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWTranslationRatingManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.NetProxyTrackManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MultipleParkourManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MultipleParkourDoorTemplateManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MultipleParkourMapTemplateManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MultipleParkourActivityManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ActFrontBreakSundayDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.RedPacketManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWDispatchTaskCarManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWSaveGirlManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWGuideVFXManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWLeadingQuestV2Manager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ChatCacheMsgManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.SkinSimulationClickManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWAccountBindTipManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    LittleRedUtils.ClearAll()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MonopolyCheerleaderManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWStageFeatureChapterManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWEasyStageFeatureChapterManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWBattleSoundManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWSticker3DManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWHummerSceneManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildHeroCountdownManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildHelpNpcManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceStarManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BulletViewUtilManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WorldPointProtectionManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ExplorerTreasureManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BattlefieldDsbDuelManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.StageFeatureBuildingManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.TreasureChestDataManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.IOSVersionUpdateTipManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.BackGestureManager:Delete()
  end)
  DataCenter.CommonRedPointManager:Delete()
  if table.containsKey(DataCenter, "RunningBossDataManager") then
    CommonUtil.ProtectCall(function()
      DataCenter.RunningBossDataManager:Delete()
    end)
  end
  CommonUtil.ProtectCall(function()
    GameQualitySettings.Uninit()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GMManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.FlowerTrainGroupManager:Delete()
  end)
  CommonUtil.ProtectCall(function()
    PvePhysicsUtil.UnInit()
  end)
  EventManager:GetInstance():RemoveListener(EventId.LOAD_COMPLETE, GameMain.OnEnterGame)
  LuaEntry:Uninit()
  TimerManager:GetInstance():Dispose()
  UpdateManager:GetInstance():Dispose()
  DOTween.KillAll()
  DOTween.ClearCachedTweens()
  return
end
local ClearIfTrackingDisabled = function()
  if CS.SDKManager.IS_IPhonePlayer() then
    pcall(function()
      local lastAllow = CS.GameEntry.Setting:GetBool(SettingKeys.LAST_ALLOW_TRACKING, false)
      local allow = CS.GameEntry.Sdk:IsTrackingEnabled()
      if allow then
        CS.GameEntry.Setting:SetBool(SettingKeys.ALLOW_TRACKING_CLICK, true)
      elseif lastAllow and not allow then
        CS.GameEntry.Setting:SetBool(SettingKeys.ALLOW_TRACKING_CLICK, false)
      end
      CS.GameEntry.Setting:SetBool(SettingKeys.LAST_ALLOW_TRACKING, allow)
    end)
  end
end
local RequestOtherLoginMsgAfterEnterGame = function()
end
local OnEnterGame = function()
  GlobalProtect.Init()
  GlobalProtect.LockGlobal(GlobalProtect.const_lock_log_only)
  UITimeManager:GetInstance():UpdateClientSwitch()
  CommonUtil.ProtectCall(function()
    GameQualitySettings.Init()
  end)
  UIManager:GetInstance():OpenWindow(UIWindowNames.TouchScreenEffect)
  UIManager:GetInstance():OpenWindow(UIWindowNames.UINpcTalkLayer)
  CommonUtil.ProtectCall(function()
    DataCenter.BuildTemplateManager:InitBuildListIds()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWWorldTrendDataManager:InitData()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ItemTemplateManager:InitAllTemplate()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MonsterTemplateManager:InitAllTemplate()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GatherResourceTemplateManager:InitAllTemplate()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AccountManager:AddSelfAccount()
  end)
  EventManager:GetInstance():Broadcast(EventId.LUA_BUILD_INIT_END)
  CommonUtil.ProtectCall(function()
    DataCenter.CityPioneerManager:DoPrologueInit()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.GuideNeedLoadManager:InitLoadScene()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityZoneManager:InitZonePoint()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityDomeManager:InitRange()
  end)
  CommonUtil.ProtectCall(function()
    BattleFieldUtil.OnEnter()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ScienceTemplateManager:DelayInitAllTemplate()
  end)
  ClearIfTrackingDisabled()
  CommonUtil.ProtectCall(function()
    DataCenter.LWGuideFlowManager:InitTriggers()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWOpeningStageManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWCountStageManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.PushNoticeManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.WarFlagDataManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ActivityTipsManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.CityVisitorManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ActBossDataManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceNoticeManager:GetNoticeList()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.SeasonDataManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.RedPacketManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWDispatchTaskCarManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWSaveGirlManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWGuideVFXManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MonopolyManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.SkinSimulationClickManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.MonopolyCheerleaderManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ScreenEffectManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWStageFeatureChapterManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWEasyStageFeatureChapterManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWBattleSoundManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ActMigrationManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWAllyStationDataManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.ExplorerTreasureManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.AllianceWarEventDataManager:OnEnterGame()
  end)
  CommonUtil.ProtectCall(function()
    DataCenter.LWSoundManager:OnEnterGame()
  end)
  EventManager:GetInstance():Broadcast(EventId.GF_enter_game)
  if CS.SceneManager:IsInCity() then
    CommonUtil.ProtectCall(function()
      DataCenter.SeasonDataManager:SetViewServerSkinMeta(nil)
    end)
    EventManager:GetInstance():Broadcast(EventId.GF_enter_city)
  end
end
local Protocal = function(cmd, t)
  if SFSNetwork.HandleMessage(cmd, t) == true then
    return
  end
  if ChatManager2:GetInstance():OnHandleMessage(cmd, t) == true then
    return
  end
  if CS.CommonUtils.IsDebug() then
    print("unknown msg")
  end
end
local DataCenterInit = function()
  ChatPrint("DataCenterInit!!")
  PostEventLog.InitTaData()
  local playerUid = LuaEntry.Player.uid
  LuaDBInterface.Init(function()
    ChatManager2:GetInstance():Init(playerUid)
    DataCenter.MailDataManager:Startup()
  end)
end
local UpdateUITimeStamp = function(timeStamp)
  UITimeManager:GetInstance():UpdateServerMsDeltaTime(timeStamp)
end
local GetHasLeftFlightToday = function()
  return DataCenter.TradeCenterDataManager.HasLeftFlightToday()
end
local ShowTips = function(msg)
  UIUtil.ShowTips(msg)
end
local ShowMessage = function(tipText, btnNum, text1, text2, action1, action2, closeAction, titleText, isChangeImg)
  UIUtil.ShowMessage(tipText, btnNum, text1, text2, action1, action2, closeAction, titleText, isChangeImg, nil, nil, nil, nil, nil, nil, DataCenter.LWSoundManager:GetSound(10001))
end
local ShowFoldUpBuild = function(posX, posY, posZ, bUuid)
  local pos = Vector3.New(tonumber(posX), tonumber(posY), tonumber(posZ))
  DataCenter.FlyResourceEffectManager:ShowFoldUpBuildEffect(pos, tonumber(bUuid))
end
local GetTemplateData = function(_type, itemId, name)
  if LuaEntry.Player ~= nil then
    _type = LuaEntry.Player:GetABTestTableName(_type)
  end
  return LocalController:instance():getStrValue(_type, itemId, name)
end
local PreloadAssets = function()
  local ResourceManager = CS.GameEntry.Resource
  local type = typeof(CS.UnityEngine.GameObject)
end
local GetArmyFormationStamina = function(uuid)
  return DataCenter.ArmyFormationDataManager:GetArmyInfoByStamina(uuid)
end
local SyncServerTime = function(serverTime)
  UITimeManager:GetInstance():UpdateServerTimeFromCS(serverTime)
end
GameMain.Start = Start
GameMain.Exit = Exit
GameMain.OnEnterGame = OnEnterGame
GameMain.Protocal = Protocal
GameMain.DataCenterInit = DataCenterInit
GameMain.UpdateUITimeStamp = UpdateUITimeStamp
GameMain.GetHasLeftFlightToday = GetHasLeftFlightToday
GameMain.ShowTips = ShowTips
GameMain.ShowMessage = ShowMessage
GameMain.ShowFoldUpBuild = ShowFoldUpBuild
GameMain.GetTemplateData = GetTemplateData
GameMain.PreloadAssets = PreloadAssets
GameMain.GetArmyFormationStamina = GetArmyFormationStamina
GameMain.RequestOtherLoginMsgAfterEnterGame = RequestOtherLoginMsgAfterEnterGame
GameMain.SyncServerTime = SyncServerTime
return GameMain
