示例#1
0
        public static XUIRoot CreateInstance(string path)
        {
            var go = GameObject.Find("XUIRoot");

            if (go != null)
            {
                instance = go.GetComponent <XUIRoot>();
                return(null);
            }
            if (string.IsNullOrEmpty(path))
            {
                Debug.LogError("场景中没有XUIManagerRoot!!! ");
                return(null);
            }
            var pfb = Resources.Load(path);

            if (pfb == null)
            {
                Debug.LogErrorFormat("资源不存在!!! {0}", path);
                return(null);
            }
            go = Instantiate(pfb, Vector3.zero, Quaternion.identity) as GameObject;
            DontDestroyOnLoad(go);
            instance = go.GetComponent <XUIRoot>();
            return(instance);
        }
示例#2
0
 //闪屏
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Debug.LogWarningFormat("{0} 只允许存在一个", ToString());
         Destroy(gameObject);
         return;
     }
     DontDestroyOnLoad(gameObject);
     instance = this;
 }
示例#3
0
 public XUIManager()
 {
     uiRoot = XUIRoot.CreateInstance("XUIRoot");
     TextureManager.Init(AssetLoader, LocalizationLoader);
 }