Exemple #1
0
        private static string GenEntityNamespace(EntityPrefab entity_prefab)
        {
            StringBuilder sb          = new StringBuilder();
            string        parent_name = entity_prefab.GetEntityParentFormat();
            string        self_name   = entity_prefab.GetEntitySelfFormat();

            if (string.IsNullOrEmpty(parent_name))
            {
                sb.Append("public class ").Append(self_name);
            }
            else
            {
                sb.Append("public class ").Append(self_name).Append(" : ").Append(parent_name);
            }
            sb.AppendLine();
            sb.Append(GenUtils.str_tab + "{");

            sb.AppendLine();
            sb.Append(GenUtils.str_tab2);

            if (string.IsNullOrEmpty(parent_name))
            {
                sb.Append("public const string TYPE = \"").Append(entity_prefab.type).Append("\";");
            }
            else
            {
                sb.Append("public new const string TYPE = \"").Append(entity_prefab.type).Append("\";");
            }

            sb.AppendLine();
            sb.Append(GenUtils.str_tab2);

            return(sb.ToString());
        }
Exemple #2
0
        private static string GenEntityNamespace(EntityPrefab entity_prefab)
        {
            StringBuilder sb        = new StringBuilder();
            string        self_name = entity_prefab.GetEntitySelfFormat();

            sb.Append($"export namespace {self_name}").AppendLine();
            sb.Append("{").AppendLine();

            sb.Append(GenUtils.str_tab).Append($"export const TYPE: string = \"{entity_prefab.type}\";").AppendLine();

            return(sb.ToString());
        }