예제 #1
0
        void Build(DOMCommand command)
        {
            Assert.IsFalse(string.IsNullOrEmpty(command.name), "name is required for <command />");

            var pptName = NameUtility.SlugifyConstName(command.name);

            var parametricArgs = string.Empty;

            if (command.args != null && command.args.Length > 0)
            {
                var builder = new StringBuilder();
                builder.Append("<");
                for (int i = 0; i < command.args.Length; i++)
                {
                    if (i > 0)
                    {
                        builder.Append(", ");
                    }
                    builder.Append(command.args[i].type);
                }
                builder.Append(">");
                parametricArgs = builder.ToString();
            }

            m_Class.AddField(
                new CSField(
                    Scope.Private,
                    pptName,
                    "IClassMethod" + parametricArgs,
                    "new DynamicClassMethod" + parametricArgs + "(\"" + command.name + "\")",
                    CSField.Modifier.Static | CSField.Modifier.Readonly));
        }
예제 #2
0
        void VisitIn(DOMCommand command)
        {
            Assert.IsFalse(string.IsNullOrEmpty(command.name), "name is required for <command />");

            m_Commands.Add(command);
        }