Example #1
0
        public void Edit(StringBuilder builder, ILoaderParameter parameter, int tab_num, string[] paths)
        {
            var    tab          = StringBuilderHelper.SetTab(tab_num);
            string type_name    = parameter.GetTypeName();
            string method_name  = parameter.GetName();
            string method_after = string.Empty;

            if (string.IsNullOrEmpty(type_name))
            {
                type_name    = "T";
                method_name += "<T>";
                method_after = " where T : Object";
            }

            builder.AppendLine(string.Format("{0}public static {1} Load{2}({3} {4}){5}",
                                             tab,
                                             type_name,
                                             method_name,
                                             ResourcesLoaderCreateUtility.GetEnumName(parameter),
                                             LoadEditor.argumentName,
                                             method_after));

            builder.AppendLine(tab + "{");
            tab = StringBuilderHelper.SetTab(tab_num + 1);
            {
                builder.AppendLine(string.Format("{0}return Resources.Load<{1}> ({2} ({3}));",
                                                 tab,
                                                 type_name,
                                                 ResourcesLoaderCreateUtility.GetPathMethodName(parameter),
                                                 LoadEditor.argumentName));
            }
            tab = StringBuilderHelper.SetTab(tab_num);
            builder.AppendLine(tab + "}");
        }
Example #2
0
 /// <summary>
 /// Enum名取得
 /// </summary>
 /// <param name="parameter"></param>
 /// <returns></returns>
 public static string GetEnumName(ILoaderParameter parameter)
 {
     return(string.Format(enumNameFormat, parameter.GetName()));
 }
Example #3
0
 /// <summary>
 /// パス配列名取得
 /// </summary>
 /// <param name="parameter"></param>
 /// <returns></returns>
 public static string GetPathArrayName(ILoaderParameter parameter)
 {
     return(string.Format(pathArrayFormat, parameter.GetName()));
 }
Example #4
0
 /// <summary>
 /// パス取得関数名取得
 /// </summary>
 /// <param name="parameter"></param>
 /// <returns></returns>
 public static string GetPathMethodName(ILoaderParameter parameter)
 {
     return(string.Format(getPathMethodFormat, parameter.GetName()));
 }