示例#1
0
        public static SequenceLeafNode CreateChangeAnimationSpeed(EdNode cnf_node)
        {
            PlayAnimationLeafNode node = SequenceNodeActionFactory.Create <PlayAnimationLeafNode>();

            node.SetConfigInfo(cnf_node);
            return(node);
        }
示例#2
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);
     }
 }
示例#3
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);
        }
示例#4
0
 public void ParseText(string text)
 {
     _root_node        = new EdNode();
     _root_node._depth = -1;
     _root_node.Name   = ROOT;
     string[] lines = text.Split("\n\r".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
     _parse_text(lines);
 }
示例#5
0
        public static SequenceLeafNode CreateNode(string node_name, EdNode cnf_node)
        {
            Type             t    = _map[node_name];
            SequenceLeafNode node = Activator.CreateInstance(t) as SequenceLeafNode;

            if (node != null)
            {
                node.SetConfigInfo(cnf_node);
            }
            return(node);
        }
示例#6
0
        private BuffEffectConfig()
        {
            string text = ResManager.instance.LoadText("Config/BuffEffectConfig");

            ResMd md = new ResMd();

            md.ParseText(text);
            _rootNode = md._root_node.GetNode(ROOT);

            _changeModelConfig = new ChangeModelConfig();
            _changeModelConfig.Parse(_rootNode.GetNode(BUFF_TEMPLATE));
        }
示例#7
0
    public void SetParent(EdNode node)
    {
        if (_parent == null)
        {
            _parent = node;
            _depth  = _parent._depth + 1;
        }

        else
        {
            LogManager.Error("父节点已经存在");
        }
    }
示例#8
0
        public void Parse(EdNode node)
        {
            EdNode        group = node.GetNode(CHANGE_MODEL_GROUP);
            List <EdNode> list  = group.GetNodes(CHANGE_MODEL);

            int length = list.Count;

            for (int i = 0; i < length; i++)
            {
                ChangeModelValue value = new ChangeModelValue();
                value.Parse(list[i]);
                map.Add(value._key, value);
            }
        }
示例#9
0
    public EdNode AddNode(string name)
    {
        EdNode node = new EdNode {
            Name = name
        };

        node.SetParent(this);
        if (_nodes == null)
        {
            _nodes = new List <EdNode>();
        }
        _nodes.Add(node);
        return(node);
    }
示例#10
0
    public void _parse_text(string[] lines)
    {
        EdNode last_node = _root_node;

        for (int i = 0; i < lines.Length; i++)
        {
            string content = lines[i].Trim();
            //TODO
            if (content.Length == 0 || content.StartsWith("//"))
            {
                continue;
            }

            if (content.StartsWith("</") && content.EndsWith(">"))
            {
                string text = content.Substring(2, content.Length - 3);

                if (last_node != null && text == last_node.Name)
                {
                    last_node = last_node._parent;
                }
                else
                {
                    LogManager.Error("[EdNode] Error,</{0}>", text);
                }
            }
            else if (content.StartsWith("<") && content.EndsWith(">"))
            {
                string text = content.Substring(1, content.Length - 2);
                if (last_node != null)
                {
                    last_node = last_node.AddNode(text);
                }
            }
            else if (content.Contains("="))
            {
                string[] texts = content.Split('=');
                if (last_node != null)
                {
                    last_node.AddAttribute(texts[0], texts[1]);
                }
            }
            else
            {
                LogManager.Error("不符合规范的数据:{0}", content);
            }
        }
    }
示例#11
0
        public static SequenceLeafNode CreateLeftNode(EdNode node)
        {
            Type type = Type.GetType("Summer.Sequence." + node.Name);

            SkillLog.Assert(type != null, "SkillFactory CreateLeftNode 找不到对应的技能节点类型:[{0}]", node.Name);
            if (type == null)
            {
                return(null);
            }

            SequenceLeafNode leaf = Activator.CreateInstance(type) as SequenceLeafNode;

            SkillLog.Assert(leaf != null, "SkillFactory CreateLeftNode 实例化失败:[{0}]", node.Name);
            if (leaf != null)
            {
                leaf.SetConfigInfo(node);
            }
            return(leaf);
        }
示例#12
0
        public static SequenceLine Create(EdNode root)
        {
            SequenceLine sequenceLine = new SequenceLine();

            sequenceLine.Id = root.GetAttribute(Id).ToInt();
            List <EdNode> nodes  = root.GetNodes(Track);
            int           length = nodes.Count;

            for (int i = 0; i < length; i++)
            {
                EdNode node   = nodes[i];
                bool   result = AddLeafNodes(sequenceLine, node);
                if (!result)
                {
                    return(null);
                }
            }
            return(sequenceLine);
        }
示例#13
0
        private static bool AddLeafNodes(SequenceLine sequenceLine, EdNode trackNode)
        {
            int       startFarme  = trackNode.GetAttribute(StartFrame).ToInt();
            int       frameLength = trackNode.GetAttribute(FrameLength).ToInt();
            TrackLine trackLine   = CreateTrack(startFarme, frameLength);

            sequenceLine.AddTrack(trackLine);

            List <EdNode> nodes  = trackNode.Nodes;
            int           length = nodes.Count;

            for (int i = 0; i < length; i++)
            {
                EdNode           node     = nodes[i];
                SequenceLeafNode leafNode = CreateLeftNode(node);
                if (leafNode == null)
                {
                    return(false);
                }
                trackLine.AddNode(leafNode);
            }
            return(true);
        }
示例#14
0
 public override void SetConfigInfo(EdNode cnf)
 {
 }
示例#15
0
 public void Parse(EdNode node)
 {
     _key     = node.GetAttribute(KEY).Text.ToInt();
     _fresnel = node.GetAttribute(FRESNEL).Text.ToFloat();
     _color   = node.GetAttribute(COLOR).Text.ToV3();
 }
示例#16
0
 public abstract void SetConfigInfo(EdNode cnf);
示例#17
0
 public override void SetConfigInfo(EdNode node)
 {
     _animationName = node.GetAttribute(ANIMATION_NAME).ToStr();
 }
示例#18
0
 public override void SetConfigInfo(EdNode cnf)
 {
     _radius = cnf.GetAttribute(RADIUS).ToFloat();
     _degree = cnf.GetAttribute(DEGREE).ToFloat();
 }
示例#19
0
 public override void SetConfigInfo(EdNode cnf)
 {
     _effectName = cnf.GetAttribute(EFFECT_NAME).ToStr();
 }