using System.Collections.Generic;
using UnityEngine;

namespace Thousandto.Launcher.ExternalLibs
{
    /// <summary>
    /// 场景节点组件
    /// </summary>
    public class SceneNodeCommpent
    {
        private List<int> _saveSubTexIndexs = new List<int>();
        private Bounds _bounds;
        public Transform Trans = null;
        public Vector3 Min = Vector3.zero;
        public Vector3 Max = Vector3.zero;
        public NodeRootType RootType = NodeRootType.Default;
        public RendererType RenderType = RendererType.None;
        public Dictionary<int, List<int>> RefrenceDic = new Dictionary<int, List<int>>();
        public bool IsActive = false;
        public bool IsUseDefaultShader = false;
        //是否保存了Texture
        public bool IsSaveTexture = false;
        //是否设置了mesh合并数据
        public bool IsSetCombinData = false;
        //合并后的subMeshIndex
        public int SubMeshIndex = -1;
        //材质属性索引
        public List<int> MatProList = new List<int>();

        public List<int> GetRefrenceIds(CellType type)
        {
            if (RefrenceDic.ContainsKey((int)type))
            {
                return RefrenceDic[(int)type];
            }
            return null;
        }
        public bool IsDirty = false;

        public void SetBounds(Bounds bs)
        {
            _bounds = bs;
        }

        public Bounds GetBounds()
        {
            return _bounds;
        }

        public bool IsSaveSuMatTex(int index)
        {
            return _saveSubTexIndexs.Contains(index);
        }

        public void SetSaveSubMatTexIndex(int index)
        {
            if(!_saveSubTexIndexs.Contains(index))
                _saveSubTexIndexs.Add(index);
        }
    }

    public enum NodeRootType
    {
        Default = 0,
        FarRoot = 1,                   //远处可视节点
        NearRoot,                      //进出可视节点
        MidleRoot,                     //midel节点
        ParticFar,                     //特效远
        ParticMidle,                   //特效中
        ParticNear,                    //特效进节点
        ParticNearHide,                //特效near节点隐藏
        Other,                         //其他节点
    }
}