Created
April 7, 2020 06:26
-
-
Save TakaakiIchijo/ac38a8152ac1de4d21e268ed1a5933dc to your computer and use it in GitHub Desktop.
ADX2のACBファイルからキューシート名とキュー名のConstクラスを生成するスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using System.Text; | |
using UnityEngine; | |
using UnityEditor; | |
public class CriWareAcbConverter : Editor | |
{ | |
private static CriAtomWindowInfo projInfo = new CriAtomWindowInfo(); | |
private static string exportPath = Application.dataPath + "/CueDataConstants.cs"; | |
private static string br = "\n"; | |
private static string tab = "\t"; | |
[MenuItem("Tools/CRIWARE/AcbToConstants")] | |
static void Convert() | |
{ | |
var searchPath = Application.streamingAssetsPath; | |
List<CriAtomWindowInfo.AcbInfo> acbInfoList = projInfo.GetAcbInfoList(true, searchPath); | |
var code = CreateCueListEnumCode(acbInfoList); | |
File.WriteAllText(exportPath, code, Encoding.UTF8); | |
AssetDatabase.Refresh(ImportAssetOptions.ImportRecursive); | |
Debug.Log("Convert Success"); | |
} | |
static string CreateCueListEnumCode(List<CriAtomWindowInfo.AcbInfo> acbInfoList) | |
{ | |
var code = ""; | |
code += "public class CueData"+br; | |
code += "{"+br; | |
foreach (var acbInfo in acbInfoList) | |
{ | |
var cueInfoList = acbInfo.cueInfoList; | |
code += CreateCueSheetClass(acbInfo.name, cueInfoList); | |
} | |
code += "}"+br; | |
code += "public class CueSheetName"+br; | |
code += "{"+br; | |
foreach (var acbInfo in acbInfoList) | |
{ | |
code += tab + "public const string " + acbInfo.name +" = \""+acbInfo.name+"\";"+br; | |
} | |
code += "}"+br; | |
return code; | |
} | |
static string CreateCueSheetClass(string cueSheetName, List<CriAtomWindowInfo.CueInfo> cueInfoList) | |
{ | |
var code = ""; | |
code += tab + "public class "+cueSheetName+br; | |
code += tab + "{"+ br; | |
foreach (var cueInfo in cueInfoList) | |
{ | |
code += tab + tab + "public const string " + cueInfo.name +" = \""+cueInfo.name+"\";"+br; | |
} | |
code += tab + "}"+br; | |
return code; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment