zoukankan      html  css  js  c++  java
  • 1

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using UnityEngine;

    namespace Game.UI
    {
        public class UIItemWidget : MonoBehaviour
        {
            ResourceSet mResources;
            bool mHasDestroy = false;
            public bool hasDestroy { get { return mHasDestroy; } }

            public virtual ResourceSet resources
            {
                get
                {
                    if (mResources == null)
                    {
                        mResources = new ResourceSet();
                    }
                    return mResources;
                }
            }

            //public bool hasDestroy { get { return resources.hasDestroy; } }

            //protected virtual void Awake()
            //{
            //}
            protected virtual void OnDestroy()
            {
                if(mResources!=null)
                    mResources.Destroy();
                mHasDestroy = true;
                //Debug.Log(ToString() + ".OnDestroy()");
            }
            public virtual void Destroy()
            {
                if (mResources != null)
                    mResources.Destroy();
                mHasDestroy = true;
            }
            public void ClearInstanceAndResource()
            {
                if (mResources != null)
                    mResources.ClearAllInstanceAndResource();
            }

            //protected void _RegResource( string _path , BaseLoadInfo resObj)
            //{
            //    resources._RegResource(_path ,resObj);
            //}

            //protected void _RegInstance(UnityEngine.Object instObj)
            //{
            //    resources._RegInstance(instObj);
            //}

            public void DeleteResource(ResourceSet.ResourceInfo resObj)
            {
                resources.DeleteResource(resObj);
            }

            public bool DeleteInstance(UnityEngine.Object instObj, bool immedia = false)
            {
                return resources.DeleteInstance(instObj,immedia);
            }

            /// <summary>
            /// 添加一个界面图集
            /// </summary>
            /// <param name="atlas">图集名</param>
            /// <param name="img">图素名</param>
            /// <param name="obj">控件对象</param>

            public ResourceSet.ResourceInfo AddResourceEx(string res)
            {
                return resources.AddResourceEx(res);
            }
            public UnityEngine.Object AddResource(string res)
            {
                return resources.AddResource(res);
            }
            public void AddResourceAsync(string res, ResourceSet.OnLoadResEnd onLoadEnd)
            {
                resources.AddResourceAsync(res, onLoadEnd);
            }
            public UnityEngine.Object AddInstance(string widgetName)
            {
                return resources.AddInstance(widgetName);
            }
            public BaseLoadInfo AddInstanceAsync(string widgetName, ResourceSet.OnObjectLoadEnd onLoadEnd)
            {
                return resources.AddInstanceAsync(widgetName, onLoadEnd);
            }
            public GameObject CreateGameObject(string name, Transform parent)
            {
                return resources.AddGameInstanceAsSubObject(name, parent);
            }
            public GameObject AddGameInstance(string name, Transform parent)
            {
                return resources.AddGameInstanceAsSubObject(name, parent);
            }
            public BaseLoadInfo AddGameInstanceAsync(string name, Transform parent, ResourceSet.OnGameObjectLoadEnd onLoadEnd)
            {
                return resources.AddGameInstanceAsSubObjectAsync(name, parent, onLoadEnd);
            }

            public void DestroyTrans(Transform tran,bool immedia=false)
            {
                if (null == tran)
                {
                    return;
                }
                for (int i = tran.childCount - 1; i >= 0; i--)
                {
                    DeleteInstance(tran.GetChild(i).gameObject,immedia);
                }
            }
        }
    }

  • 相关阅读:
    批量修改文件
    mysql-5.5.32-linux2.6-x86_64.tar.gz 二进制源码定制安装MySQL服务器
    源码搭建nginx服务器
    Python--安装
    k8s-修改线程数
    容器卡在terminate状态无法删除
    扩/
    磁盘分区+挂载
    499
    清理磁盘
  • 原文地址:https://www.cnblogs.com/rexzhao/p/7278953.html
Copyright © 2011-2022 走看看