Пример #1
0
        private string GenerateEnumDefinition(LDtkEnumFactoryTemplate template, bool hasNamespace)
        {
            string fileName     = Path.GetFileNameWithoutExtension(_writePath);
            string projectName  = fileName.Replace(' ', '_');
            string joinedValues = string.Join($",\n{GAP}", template.Values);

            string        templateTxt = LDtkInternalUtility.Load <TextAsset>(TEMPLATE_PATH).text;
            StringBuilder builder     = new StringBuilder(templateTxt);

            builder.Replace(TEMPLATE_PROJECT, projectName);
            builder.Replace(TEMPLATE_DEFINITION, template.Definition);
            builder.Replace(TEMPLATE_VALUES, joinedValues);
            builder.Replace("#t#", "GAP");

            string finalText = builder.ToString();

            return(hasNamespace ? AddIndentationToAllLines(finalText) : finalText);
        }
Пример #2
0
        private static Texture2D LoadIcon(string fileName, bool lightThemeSkinPossible = false)
        {
            /*if (CachedIcons.ContainsKey(fileName))
             * {
             *  return CachedIcons[fileName];
             * }*/

            string    directory = GetLoadPath(lightThemeSkinPossible);
            string    path      = $"{directory}{fileName}.png";
            Texture2D tex       = LDtkInternalUtility.Load <Texture2D>(path);

            /*if (tex != null)
             * {
             *  CachedIcons.Add(fileName, tex);
             * }*/

            return(tex);
        }
Пример #3
0
        private string ReplaceNamespaceContents()
        {
            string startText = LDtkInternalUtility.Load <TextAsset>(TEMPLATE_DEF_PATH).text;

            return(startText.Replace(TEMPLATE_NAMESPACE, _nameSpace));
        }