Пример #1
0
        protected override void Generater(Serializer book)
        {
            var avail = book.AvailKeys.Select(k => book.Elements[k]).
                       OrderBy(e => (int)e.Attribute("idx")).ToList();
            var missing = book.MissingKeys.Select(k => book.Elements[k]).
                OrderBy(e => (int)e.Attribute("idx")).ToList();

            // 有効分
            using (var o = new StreamWriter(CS, false, Encoding.UTF8)) {
                o.Write(@"using System;
            using System.Diagnostics;

            namespace ThunderEgg.Genarate {{
            public partial class {0} {{
            ", ClassName);
                avail.ForEach(e => Generater(o, e));
                o.Write(@"}
            }
            ");
                /**/
                o.Write(@"
            #if UNITY_EDITOR
            namespace ThunderEgg.Genarate {{
            public partial class {0} {{
            ", ClassName);
                missing.ForEach(e => {
                    o.WriteLine(@"[Obsolete(""Missing"")]");
                    Generater(o, e);
                });
                o.Write(@"}
            }
            #endif
            ");
            }
        }
Пример #2
0
 public override void Update()
 {
     // xml 豎コ螳�
     var book = new Serializer(XML);
     book.Load();
     book.Update(Collect());
     book.Save();
 }
Пример #3
0
 public override void Update()
 {
     // xml 決定
     var book = new Serializer(XML);
     book.Load();
     book.Update(Collect());
     book.Save();
     Generater(book);
 }
Пример #4
0
        protected override void Generater(Serializer book)
        {
            //
            var avail = new Node<string, XElement>();
            book.AvailKeys.Select(k => book.Elements[k]).ToList().ForEach(e => {
                var sym = e.Attribute("sym").Value;
                var crumbs = sym.Split('/').ToList();
                avail.Update(crumbs, book.Elements[sym]);
            });
            //
            var missing = new Node<string, XElement>();
            book.MissingKeys.Select(k => book.Elements[k]).ToList().ForEach(e => {
                var sym = e.Attribute("sym").Value;
                var crumbs = e.Attribute("sym").Value.Split('/').ToList();
                missing.Update(crumbs, book.Elements[sym]);
            });
            using (var o = new StreamWriter(CS, false, Encoding.UTF8)) {
                o.Write(@"using System;
            using System.Diagnostics;

            namespace ThunderEgg.Generate {{
            public partial class {0} {{
            ", ClassName);
                avail.Traverse(
                  (k, v) => {
                      o.WriteLine("public partial class {0} {{", k);
                  },
                  (k, v) => {
                      var val = v.Attribute("val").Value;
                      var dup = (int)v.Attribute("dup");
                      if (dup != 0) {
                          o.WriteLine(@"[Obsolete(""Duplicate"")]");
                      }
                      o.WriteLine("public const string {0} = \"{1}\";", k, val);
                  },
                  (k, v) => {
                      o.WriteLine("}");
                  }
                );
                o.WriteLine(@"}
            }");
                // 辟。蜉ケ蛻�
                o.Write(@"
            #if UNITY_EDITOR
            namespace ThunderEgg.Generate {{
            public partial class {0} {{
            ", ClassName);
                missing.Traverse(
                  (k, v) => {
                      o.WriteLine("public partial class {0} {{", k);
                  },
                  (k, v) => {
                      var val = v.Attribute("val").Value;
                      o.Write(
              @"[Obsolete(""Missing"")]
            public const string {0} = ""{1}"";
            ", k, val);
                  },
                  (k, v) => {
                      o.WriteLine("}");
                  }
                );
                o.Write(@"}
            }
            #endif
            ");
            }
        }
Пример #5
0
 protected abstract void Generater(Serializer book);