123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- /// <summary>
- /// 更新和平台sdk需要用到的一些静态值(更新为主)
- /// </summary>
- public static class UpdateAndSDK
- {
- /// <summary>
- /// 是否处于注销状态
- /// </summary>
- /// <returns>如果返回真,就是注销状态</returns>
- public static bool IsReLog()
- {
- if (GameObject.Find("MonoSingleton/TopStructManager") != null)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 删除那些标记好的,又没有绑定脚本的物体----注销的时候返回登录场景会有两套重复的预制物体,删除没有绑定脚本的那一套.
- /// </summary>
- public static void DeleteObjectByTag()
- {
- GameObject[] gameobj = GameObject.FindGameObjectsWithTag("DBBG");
- for (int i = 0; i < gameobj.Length; i++)
- {
- if (null != gameobj[i].GetComponent<DragonBonesBGControler>())
- {
- Object.DestroyImmediate(gameobj[i]);
- }
- }
- GameObject[] gameobjby = GameObject.FindGameObjectsWithTag("DyBackGround");
- for (int i = 0; i < gameobjby.Length; i++)
- {
- if (null != gameobjby[i].GetComponent<DynamicBackgroundControler>())
- {
- Object.DestroyImmediate(gameobjby[i]);
- }
- }
- //GameObject[] gameforeverUI = GameObject.FindGameObjectsWithTag("ForeverUI");
- //for (int i = 0; i < gameforeverUI.Length; i++)
- //{
- // if (null != gameforeverUI[i].GetComponent<FontManager>())
- // {
- // Object.DestroyImmediate(gameforeverUI[i]);
- // }
- //}
- GameObject GuideObj = GameObject.Find("MonoSingleton/GuideDataManager");
- if (GuideObj != null)
- {
- Object.Destroy(GuideObj);
- }
- GameObject GuideserverObj = GameObject.Find("MonoSingleton/PlayerGuideServer");
- if (GuideserverObj != null)
- {
- Object.Destroy(GuideserverObj);
- }
- }
- /// <summary>
- /// 给物体添加脚本
- /// </summary>
- /// <param name="go"></param>
- /// <param name="strScript"></param>
- private static void BindScript(string strGameObject,string strScript)
- {
- GameObject go= GameObject.Find(strGameObject);
- if (null == go)
- {
- return;
- }
- if (null == go.GetComponent(strScript))
- {
- AssemblyHelper.Instance.BindScript(strScript, go);
- }
- }
- /// <summary>
- /// splash场景里,绑定脚本
- /// </summary>
- public static void InitSplashBindScript()
- {
- LogHelper.Log("splash场景里,绑定脚本 已去除!");
- //BindScript("ForeverUI", "FontManager");
- //BindScript("ForeverUI", "LevelManager");
- //BindScript("ForeverUI/UI_LoadingWindow", "UI_LoadingWindow");
- //BindScript("ForeverUI/UI_CueDialog", "UI_CueDialog");
- //BindScript("ForeverUI/UI_DBControlWindow", "UI_DBControlWindow");
- }
- /// <summary>
- /// splash场景里,绑定上需要的预制物体
- /// </summary>
- public static void InitPrefab()
- {
- //ResourceHelper.Instance.LoadAssetBundle("DragonBonesBG", ab =>
- // {
- // if (ab != null)
- // {
- // GameObject model = (GameObject)Object.Instantiate(ab.LoadAsset("DragonBonesBG"));
- // BindScript("DragonBonesBG(Clone)", "DragonBonesBGControler");
- // }
- // });
- }
- }
|