Esempio n. 1
0
 public static AssetFormatRule CreateFormatRule(EdNode node)
 {
     try
     {
         AssetFormatRule rule = new AssetFormatRule();
         rule.FilterPath = node.GetAttribute("FilterPath").ToStr();
         EdAttribute filterPathattribute = node.GetAttribute("FilterRule");
         if (filterPathattribute != null)
         {
             rule.FilterRule = filterPathattribute.ToStr();
             Type filterType = Type.GetType("SummerEditor." + rule.FilterRule);
             Debug.AssertFormat(filterType != null, "找不到对应的规则文件:[{0}]", rule.FilterRule);
             rule._filter = Activator.CreateInstance(filterType) as I_AssetFilter;
         }
         rule.FormatRule = node.GetAttribute("FormatRule").ToStr();
         Type ruleType = Type.GetType("SummerEditor." + rule.FormatRule);
         Debug.AssertFormat(ruleType != null, "找不到对应的格式化文件:[{0}]", rule.FormatRule);
         rule._rule = Activator.CreateInstance(ruleType) as I_AssetRule;
         Debug.AssertFormat(rule._rule != null, "格式规则不存在:[{0}]", rule.FormatRule);
         return(rule);
     }
     catch (Exception e)
     {
         Debug.Log(e.Message);
         return(null);
     }
 }
Esempio n. 2
0
        public void OnloadRuleBtn(EButton button)
        {
            List <System.Object> rules = new List <System.Object>();
            //1. 导入并且初始化规则
            //2. 细分类型-->过滤文件-->设置规则
            TextAsset textAsset = AssetDatabase.LoadAssetAtPath <TextAsset>(AssetFormatConst.RULE_ASSET_PATH);
            ResMd     resMd     = new ResMd();

            resMd.ParseText(textAsset.text);

            EdNode        ruleNode = resMd._root_node.GetNode("Rule");
            List <EdNode> nodes    = ruleNode.Nodes;
            int           length   = nodes.Count;

            for (int i = 0; i < length; i++)
            {
                EdNode          node = nodes[i];
                AssetFormatRule rule = AssetFormatRule.CreateFormatRule(node);
                if (rule != null)
                {
                    rules.Add(rule);
                }
            }

            _texRuleTablePanel.RefreshData(rules);
            _shows.Clear();
            _texShowTable.RefreshData(_shows);
        }
Esempio n. 3
0
        // 选择某一条具体的规则
        private void OnRuleSelected(object select, int col)
        {
            AssetFormatRule rule = select as AssetFormatRule;

            if (rule == null)
            {
                return;
            }
            _shows.Clear();
            _formatRule = rule;

            List <string> pathList = EPathHelper.GetAssetsPath(rule.FilterPath, true, "*.png");
            int           length   = pathList.Count;

            for (int i = 0; i < length; i++)
            {
                if (!EPathHelper.IsTexture(pathList[i]))
                {
                    continue;
                }
                var tmp = TextureFormatInfo.Create(pathList[i]);
                _shows.Add(tmp);
            }
            _texShowTablePanel.RefreshData(_shows);
        }
Esempio n. 4
0
        public void OnSearchTextures(string searchPath)
        {
            _shows.Clear();
            List <string> pathList = EPathHelper.GetAssetsPath(searchPath, true, "*.*");
            int           length   = pathList.Count;

            for (int i = 0; i < length; i++)
            {
                if (!EPathHelper.IsTexture(pathList[i]))
                {
                    continue;
                }
                var tmp = TextureFormatInfo.Create(pathList[i]);
                _shows.Add(tmp);
            }
            _texShowTablePanel.RefreshData(_shows);
            _formatRule = null;
        }