Пример #1
0
 void LoadUIRoot()
 {
     if (uiCamera != null)
     {
         isRootLoaded = true;
     }
     if (isRootLoaded)
     {
         return;
     }
     ResourceManager.LoadGameObject("UI/UI Root", (path, args, root) =>
     {
         if (uiCamera == null)
         {
             uiRoot         = root.transform;
             uiCamera       = uiRoot.Find("Camera");
             uiCameraHelper = uiRoot.GetComponent <UIModelCameraHelper>();
             if (uiCameraHelper == null)
             {
                 uiCameraHelper = root.AddComponent <UIModelCameraHelper>();
             }
             GameObject.DontDestroyOnLoad(root);
         }
         else if (root.transform != uiRoot)
         {
             GameObject.Destroy(root);
         }
         isRootLoaded = true;
     }, (path, args) => { Debug.LogError("没有找到uiRoot->" + path); });
 }
Пример #2
0
 public bool SetUICamera(UIModelCameraHelper uiCameraHelper)
 {
     if (this.uiCameraHelper == uiCameraHelper)
     {
         return(true);
     }
     if (uiCamera == null)
     {
         uiRoot              = uiCameraHelper.transform;
         uiCamera            = uiRoot.Find("Camera");
         this.uiCameraHelper = uiCameraHelper;
         return(true);
     }
     GameObject.Destroy(uiCameraHelper.gameObject);
     return(false);
 }