UpdateAndSDK.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. /// <summary>
  5. /// 更新和平台sdk需要用到的一些静态值(更新为主)
  6. /// </summary>
  7. public static class UpdateAndSDK
  8. {
  9. /// <summary>
  10. /// 是否处于注销状态
  11. /// </summary>
  12. /// <returns>如果返回真,就是注销状态</returns>
  13. public static bool IsReLog()
  14. {
  15. if (GameObject.Find("MonoSingleton/TopStructManager") != null)
  16. {
  17. return true;
  18. }
  19. else
  20. {
  21. return false;
  22. }
  23. }
  24. /// <summary>
  25. /// 删除那些标记好的,又没有绑定脚本的物体----注销的时候返回登录场景会有两套重复的预制物体,删除没有绑定脚本的那一套.
  26. /// </summary>
  27. public static void DeleteObjectByTag()
  28. {
  29. GameObject[] gameobj = GameObject.FindGameObjectsWithTag("DBBG");
  30. for (int i = 0; i < gameobj.Length; i++)
  31. {
  32. if (null != gameobj[i].GetComponent<DragonBonesBGControler>())
  33. {
  34. Object.DestroyImmediate(gameobj[i]);
  35. }
  36. }
  37. GameObject[] gameobjby = GameObject.FindGameObjectsWithTag("DyBackGround");
  38. for (int i = 0; i < gameobjby.Length; i++)
  39. {
  40. if (null != gameobjby[i].GetComponent<DynamicBackgroundControler>())
  41. {
  42. Object.DestroyImmediate(gameobjby[i]);
  43. }
  44. }
  45. //GameObject[] gameforeverUI = GameObject.FindGameObjectsWithTag("ForeverUI");
  46. //for (int i = 0; i < gameforeverUI.Length; i++)
  47. //{
  48. // if (null != gameforeverUI[i].GetComponent<FontManager>())
  49. // {
  50. // Object.DestroyImmediate(gameforeverUI[i]);
  51. // }
  52. //}
  53. GameObject GuideObj = GameObject.Find("MonoSingleton/GuideDataManager");
  54. if (GuideObj != null)
  55. {
  56. Object.Destroy(GuideObj);
  57. }
  58. GameObject GuideserverObj = GameObject.Find("MonoSingleton/PlayerGuideServer");
  59. if (GuideserverObj != null)
  60. {
  61. Object.Destroy(GuideserverObj);
  62. }
  63. }
  64. /// <summary>
  65. /// 给物体添加脚本
  66. /// </summary>
  67. /// <param name="go"></param>
  68. /// <param name="strScript"></param>
  69. private static void BindScript(string strGameObject,string strScript)
  70. {
  71. GameObject go= GameObject.Find(strGameObject);
  72. if (null == go)
  73. {
  74. return;
  75. }
  76. if (null == go.GetComponent(strScript))
  77. {
  78. AssemblyHelper.Instance.BindScript(strScript, go);
  79. }
  80. }
  81. /// <summary>
  82. /// splash场景里,绑定脚本
  83. /// </summary>
  84. public static void InitSplashBindScript()
  85. {
  86. LogHelper.Log("splash场景里,绑定脚本 已去除!");
  87. //BindScript("ForeverUI", "FontManager");
  88. //BindScript("ForeverUI", "LevelManager");
  89. //BindScript("ForeverUI/UI_LoadingWindow", "UI_LoadingWindow");
  90. //BindScript("ForeverUI/UI_CueDialog", "UI_CueDialog");
  91. //BindScript("ForeverUI/UI_DBControlWindow", "UI_DBControlWindow");
  92. }
  93. /// <summary>
  94. /// splash场景里,绑定上需要的预制物体
  95. /// </summary>
  96. public static void InitPrefab()
  97. {
  98. //ResourceHelper.Instance.LoadAssetBundle("DragonBonesBG", ab =>
  99. // {
  100. // if (ab != null)
  101. // {
  102. // GameObject model = (GameObject)Object.Instantiate(ab.LoadAsset("DragonBonesBG"));
  103. // BindScript("DragonBonesBG(Clone)", "DragonBonesBGControler");
  104. // }
  105. // });
  106. }
  107. }