using CaoCao.Runtime; using CaoCao.XAsset; using UnityEngine; namespace Game.HotFix { public static class HotfixEntry { public static ResourcesComponent Resources { get; private set; } //public static MouseComponent Mouse //{ // get; // private set; //} public static MainPlayerComponent MainPlayer { get; private set; } //public static MapComponent Map //{ // get; // private set; //} //public static UserMgrComponent UserMgr //{ // get; // private set; //} public static LubanComponent Luban { get; set; } //public static RobotMgrComponent RobotMgr //{ // get; // set; //} //public static NPCMgrComponent NpcMgr //{ // get; // set; //} //public static InputComponent Input //{ // get; // set; //} //public static NetworkComponent Network //{ // get; // set; //} //public static DropMgrComponent DropMgr //{ // get; // set; //} //public static ItemMgrComponent ItemMgr //{ // get; // set; //} //public static EffectMgrComponent EffectMgr //{ // get; // set; //} //public static EquipMgrComponent EquipMgr //{ // get; // set; //} public static UIMgr UI { get; private set; } //public static UICrossPlatform UICP { get; set; } public static Tips Tips { get; private set; } //public static ChatComponent Chat //{ // get; // private set; //} //public static TaskComponent Task //{ // get; // private set; //} //public static StandingComponent Standing //{ // get; // private set; //} //public static NoviceComponent Novice //{ // get; // private set; //} //public static FindWayComponent FindWay //{ // get; // set; //} //public static AutoGameComponent AutoGame //{ // get; // set; //} //public static ClanMgr mClan //{ // get; // set; //} //public static AudioComponent Audio //{ // get; // private set; //} //public static TimeManager TimeMgr //{ // get { return TimeManager.Instance; } //} //public static SocialMgr mSocialMgr //{ // get; // set; //} //public static TeamMgr mTeamMgr //{ // get;set; //} //private static GuajiMgr mGuaji; //public static GuajiMgr Guaji //{ // get // { // if (mGuaji == null) // mGuaji = new GuajiMgr(); // return mGuaji; // } //} //public static SkillComponent Skill { get; set; } //public static SubpackageMgrComponent SubpackageMgr; //public static BadWordFilter mBadWords { get; set; } ////public static ActivityMgr mActivity; //public static ActivityMgr Activity //{ // get; // private set; //} //public static NotifyComponent Notify //{ // get; // private set; //} //public static GameSetting mGameSetting { get; set; } //public static RankComponent mRankComponent { get; set; } //public static ShopComponent mShopComponent { get; set; } //public static RedbagComponent RedBag { get; set; } //public static PokemonMgrComponent PokemonMgr { get; set; } //public static QQGameMgrComponent QQGameMgr { get; set; } //public static PetMgr mPetMgr { get; set; } //public static LocalStorage LocalStorage { get; set; } //public static bool IsPC = false; // Start is called before the first frame update public static void Init() { // //PC 阻止关闭 //#if UNITY_STANDALONE_WIN && !UNITY_EDITOR_WIN // Application.wantsToQuit += ChangeByPassClose; //#endif //#if UNITY_STANDALONE_WIN && !UNITY_EDITOR // IsPC = true; // GameObject.Find("Debugger")?.SetActive(false); //#endif //编辑器测试,开关注释代码,强制给pc版标识 //#if UNITY_EDITOR // IsPC = UICrossPlatform.bMustPCTest; //#endif ////绿色版风格 //if ( // AppEntry.GetPackageID() == 20010001//PC版 // ) //{ // ConstClass.gameStyleVersion = GameStyleVersion.Green; //} //else //{ // //非绿色版 // ConstClass.gameStyleVersion = GameStyleVersion.Common; //} //#if UNITY_EDITOR // ConstClass.gameStyleVersion = GameStyleVersion.Green; //#endif //mGameSetting = new GameSetting(); //随便取一个CaoCao/Customs下的节点 Transform parent = AppEntry.BuiltinData.transform.parent; Resources = parent.Find("Resources").gameObject.AddComponent(); // Mouse = parent.Find("Logic").gameObject.AddComponent(); // Input = parent.Find("Input").gameObject.AddComponent(); // Map = parent.Find("Map").gameObject.AddComponent(); // MainPlayer = parent.Find("MainPlayer").gameObject.AddComponent(); Luban = parent.Find("Luban").gameObject.AddComponent(); // UserMgr = parent.Find("UserMgr").gameObject.AddComponent(); // RobotMgr = parent.Find("RobotMgr").gameObject.AddComponent(); // NpcMgr = parent.Find("NPCMgr").gameObject.AddComponent(); // Network = parent.Find("Network").gameObject.AddComponent(); // DropMgr = parent.Find("DropMgr").gameObject.AddComponent(); // EffectMgr = parent.Find("EffectMgr").gameObject.AddComponent(); Tips = parent.Find("Tips").gameObject.AddComponent(); // Chat = parent.Find("Logic").gameObject.AddComponent(); // Task = parent.Find("Logic").gameObject.AddComponent(); // Standing = parent.Find("Logic").gameObject.AddComponent(); // Novice = parent.Find("Logic").gameObject.AddComponent(); // FindWay = parent.Find("Logic").gameObject.AddComponent(); // AutoGame = parent.Find("Logic").gameObject.AddComponent(); // mClan = parent.Find("Logic").gameObject.AddComponent(); // EquipMgr = parent.Find("Logic").gameObject.AddComponent(); // Audio = parent.Find("Audio").gameObject.AddComponent(); // mSocialMgr = parent.Find("Logic").gameObject.AddComponent(); // mTeamMgr = parent.Find("Logic").gameObject.AddComponent(); // SubpackageMgr = parent.Find("SubpackageMgr").gameObject.AddComponent(); // Skill = parent.Find("Logic").gameObject.AddComponent(); // Activity = parent.Find("Logic").gameObject.AddComponent(); // Notify = parent.Find("Logic").gameObject.AddComponent(); // mPetMgr = parent.Find("Logic").gameObject.AddComponent(); // mRankComponent = parent.Find("Logic").gameObject.AddComponent(); // mShopComponent = parent.Find("Logic").gameObject.AddComponent(); // RedBag = parent.Find("Logic").gameObject.AddComponent(); // if (AppEntry.GetPackageID() == 10071001)//仅QQ大厅 挂在本脚本 // { // QQGameMgr = parent.Find("Logic").gameObject.AddComponent(); // } // GameObject pokemonNode = new GameObject(); // pokemonNode.name = "Pokemon"; //pokemonNode.transform.parent = parent; // pokemonNode.transform.localPosition = Vector3.zero; //PokemonMgr = pokemonNode.gameObject.AddComponent(); // LocalStorage = LocalStorage.Instance; // mBadWords = BadWordFilter.GetInstance(); //加载配置表 Luban.Init(); GameObject go = Resources.Clone("Assets/GameAssets/Prefabs/UI/UIControl/UIMgr.prefab", parent); if (go == null) return; go.GetComponent().localScale = Vector3.one; UI = go.GetComponent(); //UICP = go.AddComponent(); } #region // static public void SetGameScreen() // { //#if UNITY_EDITOR // return; //#endif // if (HotfixEntry.IsPC && UICrossPlatform.IsNewPlan) // { // Common.GetPC_ScreenSetting(out Vector2 size, out bool bFull); // Screen.SetResolution((int)size.x, (int)size.y, bFull); // HotfixEntry.Input.ReSetTerrainCanvas(); // } // } //static public void SetGameInputMode() //{ // int Mode = HotfixEntry.mGameSetting._pcSkillSetting.Mode; // if (!HotfixEntry.IsPC) // return; // if (Mode == 0) // { // HotfixEntry.Tips.ShowHint("切换为:经典操作"); // if (HotfixEntry.UI.IsOpen()) // HotfixEntry.UI.CloseUI(); // } // else // { // HotfixEntry.Tips.ShowHint("切换为:新版操作"); // if (!HotfixEntry.UI.IsOpen()) // HotfixEntry.UI.OpenUI(eUINodeType.NodeScreen); // } // AppEntry.Event.FireNow(null, InputMouseToMoveEventArgs.Create()); //} #endregion static bool ChangeByPassClose() { HotfixEntry.Tips.ShowChoice($"是否关闭游戏?", () => { Application.wantsToQuit -= ChangeByPassClose; Application.Quit(); }); return false; } } }