public void Init(AbsEntity entity, string path, bool isAsync = true)
 {
     Entity       = entity;
     ResPath      = path;
     IsLoadFinish = false;
     proxy        = ResourceMgr.Instance.LoadAssetAsync(ResPath);
     proxy.AddLoadFinishCallBack(() =>
     {
         gameObject      = proxy.GetInstantiateObject <GameObject>();
         gameObject.name = entity.UID.ToString();
         IsLoadFinish    = true;
         Trans           = gameObject.transform;
         if (_loadFinishHandler != null)
         {
             _loadFinishHandler(this);
         }
     });
 }
Exemple #2
0
 protected override void OnInitialize()
 {
     base.OnInitialize();
     uiRootProxy = ResourceMgr.singleton.LoadAssetAsync(_uiRoot);
     uiRootProxy.AddLoadFinishCallBack(() =>
     {
         var go = uiRootProxy.GetInstantiateObject <GameObject>();
         go.transform.localPosition = Vector3.zero;
         MainUICamera = go.transform.Find("MainUICamera").GetComponent <Camera>();
         DontDestroyOnLoad(go);
         OnInitFinish();
     });
     mainCameraProxy = ResourceMgr.singleton.LoadAssetAsync(_mainCamera);
     mainCameraProxy.AddLoadFinishCallBack(() =>
     {
         var go = mainCameraProxy.GetInstantiateObject <GameObject>();
         go.transform.localPosition = Vector3.zero;
         MainCamera = go.transform.GetComponent <Camera>();
         DontDestroyOnLoad(go);
         OnInitFinish();
     });
 }