Esempio n. 1
0
 private BaseLoadInfo AddInstanceAsync(string widgetName, Vector3 position, Quaternion rotation, OnObjectLoadEnd onLoadEnd)
 {
     if (hasDestroy)
     {
         return(null);
     }
     return(ResLoadMgr.singleton.ResourceLoadAsync(widgetName, (ResLoadMgr.OnLoadEnd)(loadInfo =>
     {
         if (loadInfo == null || !loadInfo.GetResObject())
         {
             Debug.LogWarning("not find instance Async[" + widgetName + "]");
             return;
         }
         if (this.hasDestroy)
         {
             ResLoadMgr.singleton.UnLoadResource(loadInfo);
             return;
         }
         UnityEngine.Object instObj = GameObject.Instantiate(loadInfo.GetResObject(), position, rotation);
         if (instObj == null)
         {
             return;
         }
         instanceList.Add(InstranceInfo.make(instObj, loadInfo));
         if (onLoadEnd != null)
         {
             onLoadEnd(instObj);
         }
     })));
 }
Esempio n. 2
0
        //////////////////////////////////////////////////

        protected void DeleteInstance(InstranceInfo info, bool immedia = false)
        {
            if (info.obj)
            {
                if (immedia)
                {
                    UnityEngine.Object.DestroyImmediate(info.obj);
                }
                else
                {
                    UnityEngine.Object.Destroy(info.obj);
                }
            }
            ResLoadMgr.singleton.UnLoadResource(info.resInfo);
        }
Esempio n. 3
0
        private UnityEngine.Object AddInstance(string path, Vector3 position, Quaternion rotation)//, bool _DontDestroyOnLoad = false)
        {
            if (hasDestroy)
            {
                return(null);
            }
            var info = ResLoadMgr.singleton.ResourceLoad(path);

            if (info == null || !info.GetResObject())
            {
                Debug.LogWarning("not find instance [" + path + "]");
                return(null);
            }
            var resourceObject = info.GetResObject();

            UnityEngine.Object instObj = GameObject.Instantiate(resourceObject, position, rotation);

            instanceList.Add(InstranceInfo.make(instObj, info));

            return(instObj);
        }