public static void DrawChain(TemplateSettingStatus status) { EditorGUILayout.BeginVertical(EditorGUIHelper.GetScopeStyle()); { status.ChainReorderableList.DoLayoutList(); var selectIndex = status.ChainReorderableList.index; if (selectIndex >= 0) { var select = status.ChainReorderableList.serializedProperty.GetArrayElementAtIndex(selectIndex); var chain = TemplateUtility.ConvertProcessChianInstanceFromObject(select.objectReferenceValue); if (chain != null) { var builder = new StringBuilder(); builder.AppendLine("[Used Variables]"); foreach (var word in chain.GetReplaceWords()) { builder.AppendLine(ReplaceProcessor.GetReplaceText(word)); } // TODO : Cache var style = new GUIStyle(GUI.skin.label) { wordWrap = true, }; var label = builder.ToString(); var content = new GUIContent(label); var rect = GUILayoutUtility.GetRect(content, style); EditorGUI.SelectableLabel(rect, label, style); EditorGUILayout.LabelField("[Description]\n" + chain.GetDescription(), style); } } else { EditorGUILayout.HelpBox("When you select item, description will be displayed", MessageType.Info, true); } } EditorGUILayout.EndVertical(); }
public static void DrawReplace(List <ReplaceInfo> replaces, string savePrefix) { EditorGUILayout.BeginVertical(EditorGUIHelper.GetScopeStyle()); if (replaces.Count == 0) { EditorGUILayout.HelpBox("{<Foo>} in 'Create Path' and 'Script Name' and 'Code' will be replace\nNote: Variables used in 'Pre Process' are not listed here.", MessageType.Info); } else { foreach (var replace in replaces) { var str = EditorGUILayout.TextField(ReplaceProcessor.GetReplaceText(replace.Key), replace.ReplaceWord); if (str == replace.ReplaceWord) { continue; } // 置き換え文字をUnityへキャッシュ replace.ReplaceWord = str; TemplateUtility.SetConfigValue(savePrefix + replace.Key, replace.ReplaceWord); } } EditorGUILayout.EndVertical(); }