public static SequenceLeafNode CreateChangeAnimationSpeed(EdNode cnf_node) { PlayAnimationLeafNode node = SequenceNodeActionFactory.Create <PlayAnimationLeafNode>(); node.SetConfigInfo(cnf_node); return(node); }
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); } }
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); }
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); }
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); }
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)); }
public void SetParent(EdNode node) { if (_parent == null) { _parent = node; _depth = _parent._depth + 1; } else { LogManager.Error("父节点已经存在"); } }
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); } }
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); }
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); } } }
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); }
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); }
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); }
public override void SetConfigInfo(EdNode cnf) { }
public void Parse(EdNode node) { _key = node.GetAttribute(KEY).Text.ToInt(); _fresnel = node.GetAttribute(FRESNEL).Text.ToFloat(); _color = node.GetAttribute(COLOR).Text.ToV3(); }
public abstract void SetConfigInfo(EdNode cnf);
public override void SetConfigInfo(EdNode node) { _animationName = node.GetAttribute(ANIMATION_NAME).ToStr(); }
public override void SetConfigInfo(EdNode cnf) { _radius = cnf.GetAttribute(RADIUS).ToFloat(); _degree = cnf.GetAttribute(DEGREE).ToFloat(); }
public override void SetConfigInfo(EdNode cnf) { _effectName = cnf.GetAttribute(EFFECT_NAME).ToStr(); }