/* * * HELPERS * */ static string buildString(ComponentInfo componentInfo, string format) { format = createFormatString(format); var a0_type = componentInfo.fullTypeName; var a1_name = componentInfo.typeName.RemoveComponentSuffix(); var a2_lowercaseName = a1_name.LowercaseFirst(); var poolNames = componentInfo.pools; var a3_tag = poolNames.Length == 0 ? string.Empty : poolNames[0]; var lookupTags = componentInfo.ComponentLookupTags(); var a4_ids = lookupTags.Length == 0 ? string.Empty : lookupTags[0]; var fieldInfos = componentInfo.fieldInfos; var a5_fieldNamesWithType = fieldNamesWithType(fieldInfos); var a6_fieldAssigns = fieldAssignments(fieldInfos); var a7_fieldNames = fieldNames(fieldInfos); var prefix = componentInfo.singleComponentPrefix; var a8_prefix = prefix.UppercaseFirst(); var a9_lowercasePrefix = prefix.LowercaseFirst(); return(string.Format(format, a0_type, a1_name, a2_lowercaseName, a3_tag, a4_ids, a5_fieldNamesWithType, a6_fieldAssigns, a7_fieldNames, a8_prefix, a9_lowercasePrefix)); }
/* * * HELPERS * */ static string buildString(ComponentInfo componentInfo, string format, int contextIndex = 0) { format = createFormatString(format); var a0_type = componentInfo.fullTypeName; var a1_name = componentInfo.typeName.RemoveComponentSuffix(); var a2_lowercaseName = a1_name.LowercaseFirst(); var contextNames = componentInfo.contexts; var a3_tag = contextNames[contextIndex].ContextPrefix(); var lookupTags = componentInfo.ComponentLookupTags(); var a4_ids = lookupTags.Length == 0 ? string.Empty : lookupTags[contextIndex]; var memberInfos = componentInfo.memberInfos; var a5_memberNamesWithType = memberNamesWithType(memberInfos); var a6_memberAssigns = memberAssignments(memberInfos); var a7_memberNames = memberNames(memberInfos); var prefix = componentInfo.singleComponentPrefix; var a8_prefix = prefix.UppercaseFirst(); var a9_lowercasePrefix = prefix.LowercaseFirst(); return(string.Format(format, a0_type, a1_name, a2_lowercaseName, a3_tag, a4_ids, a5_memberNamesWithType, a6_memberAssigns, a7_memberNames, a8_prefix, a9_lowercasePrefix)); }
/* * * HELPERS * */ static string buildString(ComponentInfo componentInfo, string format, int poolIndex = 0) { format = createFormatString(format); var a0_type = componentInfo.fullTypeName; var a1_name = componentInfo.typeName.RemoveComponentSuffix(); var a2_lowercaseName = a1_name.LowercaseFirst(); var poolNames = componentInfo.pools; var a3_tag = poolNames.Length == 0 ? string.Empty : poolNames[poolIndex]; var lookupTags = componentInfo.ComponentLookupTags(); var a4_ids = lookupTags.Length == 0 ? string.Empty : lookupTags[poolIndex]; var memberInfos = componentInfo.memberInfos; var a5_memberNamesWithType = memberNamesWithType(memberInfos); var a6_memberAssigns = memberAssignments(memberInfos); var a7_memberNames = memberNames(memberInfos); var prefix = componentInfo.singleComponentPrefix; var a8_prefix = prefix.UppercaseFirst(); var a9_lowercasePrefix = prefix.LowercaseFirst(); return string.Format(format, a0_type, a1_name, a2_lowercaseName, a3_tag, a4_ids, a5_memberNamesWithType, a6_memberAssigns, a7_memberNames, a8_prefix, a9_lowercasePrefix); }
/// <summary> /// Returns the method for initializing a component from a dictionary. /// </summary> /// <param name="info">Data about the component to generate the code for.</param> /// <returns>Method for initializing a component from a dictionary.</returns> private static string AddBlueprintMethod(ComponentInfo info) { var name = info.typeName.RemoveComponentSuffix(); var lookupTags = info.ComponentLookupTags(); var ids = lookupTags.Length == 0 ? string.Empty : lookupTags[0]; var assignments = FieldAssignments(name, info.fieldInfos); return string.Format(@" public Entity Add{0}(System.Collections.Generic.IDictionary<string, object> properties) {{ var componentPool = this.GetComponentPool(ComponentIds.{0}); var component = ({1})(componentPool.Count > 0 ? componentPool.Pop() : new {1}()); {2} return this.AddComponent({3}.{0}, component); }} ", name, info.typeName, assignments, ids); }