Exemplo n.º 1
0
        /// <summary>
        /// 根据索引 查找组件
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public object GetLuaComs(int index)
        {
            LuaCom com = m_LuaComs[index];

            switch (com.Type)
            {
            case LuaConType.GameObject:
                return(com.Trans.gameObject);

            case LuaConType.Transform:
                return(com.Trans);

            case LuaConType.Button:
                return(com.Trans.GetComponent <Button>());

            case LuaConType.Image:
                return(com.Trans.GetComponent <Image>());

            case LuaConType.TQImage:
                return(com.Trans.GetComponent <TQImage>());

            case LuaConType.Text:
                return(com.Trans.GetComponent <Text>());

            case LuaConType.TQText:
                return(com.Trans.GetComponent <TQText>());

            case LuaConType.RawImage:
                return(com.Trans.GetComponent <RawImage>());

            case LuaConType.InputField:
                return(com.Trans.GetComponent <InputField>());

            case LuaConType.Scrollbar:
                return(com.Trans.GetComponent <Scrollbar>());

            case LuaConType.ScrollRect:
                return(com.Trans.GetComponent <ScrollRect>());

            case LuaConType.MulityScroll:
                return(com.Trans.GetComponent <UIMultiScroller>());
            }

            return(com.Trans);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除
        /// </summary>
        protected override void OnBeforDestry()
        {
            base.OnBeforDestry();
            if (onBeforDestry != null)
            {
                onBeforDestry();
            }
            onInit        = null;
            onOnpe        = null;
            onClose       = null;
            onBeforDestry = null;

            //卸载图片资源
            int len = m_LuaComs.Length;

            for (int i = 0; i < len; i++)
            {
                LuaCom com = m_LuaComs[i];
                com.Trans = null;
                com       = null;
            }
        }