Exemple #1
0
        // 可変のファイル名
        public static string Filepath_GenerateFullpathConstCs(AnimatorController ac)
        {
            string fullpath = System.IO.Path.GetFullPath(AssetDatabase.GetAssetPath(ac.GetInstanceID()));

            // ファイル名はネーム・スペースに合わせたいので同じ処理をします。
            string filename = FullpathConstantGenerator.String_to36_pascalCase(Path.GetFileNameWithoutExtension(fullpath), "_", "_");

            return(Path.Combine(
                       Directory.GetParent(fullpath).FullName,
                       filename + "_Abstract.cs"
                       ));
        }
Exemple #2
0
        public string Dump()
        {
            StringBuilder sb = new StringBuilder();

            foreach (string path in this.FullpathSet)
            {
                sb.Append(path);
                sb.Append(" To26= ");
                sb.AppendLine(FullpathConstantGenerator.String_split_toUppercaseAlphabetFigureOnly_join(path, ".", "_"));
            }
            return(sb.ToString());
        }
Exemple #3
0
        public static void WriteCshapScript(AnimatorController ac, StringBuilder info_message)
        {
            AconStateNameScanner aconScanner = new AconStateNameScanner();

            aconScanner.ScanAnimatorController(ac, info_message);

            StringBuilder contents = new StringBuilder();

            // 変換例:

            // 「Main_Char3」は「Main_Char3」(同じ)

            // 「BattleFloor_char@arm@finger」は「Battolefloor_Chararmfinger」
            string className = FullpathConstantGenerator.String_to36_pascalCase(ac.name, "_", "_");

            string abstractClassName = className + "_AbstractAControl";

            contents.AppendLine("using System.Collections.Generic;");
            contents.AppendLine();
            contents.Append("namespace DojinCircleGrayscale.StellaQL.Acons."); contents.AppendLine(className);
            contents.AppendLine("{");
            contents.AppendLine("    /// <summary>");
            contents.AppendLine("    /// This file was automatically generated.");
            contents.Append("    /// It was created by ["); contents.Append(StateMachineQueryStellaQL.BUTTON_LABEL_GENERATE_FULLPATH); contents.AppendLine("] button.");
            contents.AppendLine("    /// </summary>");
            contents.Append("    public abstract class "); contents.Append(abstractClassName);
            contents.AppendLine(" : AbstractAControl");
            contents.AppendLine("    {");
            List <string> fullpaths = new List <string>(aconScanner.FullpathSet);

            fullpaths.Sort();
            if (0 < fullpaths.Count)
            {
                contents.Append("        public const string");
                foreach (string fullpath in fullpaths)
                {
                    // 先に改行を持ってくる。最後のセミコロンを付ける処理を簡単にする。
                    contents.AppendLine();

                    contents.Append("            ");
                    contents.Append(FullpathConstantGenerator.String_split_toUppercaseAlphabetFigureOnly_join(fullpath, ".", "_"));
                    contents.Append(@" = """);
                    contents.Append(fullpath);

                    // 改行は最後ではなく、最初に付けておく。
                    contents.Append(@""",");
                }

                // 最後のコンマを削る。
                contents.Length--;

                // 代わりにセミコロンを追加する。
                contents.AppendLine(@"; // semi colon");

                contents.AppendLine();
            }

            contents.Append("        public "); contents.Append(abstractClassName); contents.AppendLine("()");
            contents.AppendLine("        {");
            contents.AppendLine("            Code.Register(StateHash_to_record, new List<AcStateRecordable>()");
            contents.AppendLine("            {");

            foreach (string fullpath in fullpaths)
            {
                contents.Append("                new DefaultAcState( ");
                contents.Append(FullpathConstantGenerator.String_split_toUppercaseAlphabetFigureOnly_join(fullpath, ".", "_"));
                contents.AppendLine("),");
            }

            contents.AppendLine("            });");
            contents.AppendLine("        }");
            contents.AppendLine("    }");
            contents.AppendLine("}");

            FileUtility_Editor.Write(FileUtility_Editor.Filepath_GenerateFullpathConstCs(ac), contents, info_message);
        }