コード例 #1
0
ファイル: MorphExtraction.cs プロジェクト: xysverma/mcs
        /// <summary>
        /// Take all extracted morphs and pack them into a mr file
        /// </summary>
        /// <param name="rootFolderPath"></param>
        /// <param name="searchPattern"></param>
        /// <returns>The path to the mr file</returns>
        public static string MergeFilesIntoMR(string rootFolderPath, string searchPattern, string outputFile = null, bool isInstallFile = false)
        {
            rootFolderPath = rootFolderPath.TrimEnd('/');

            if (outputFile == null)
            {
                outputFile = rootFolderPath + "/morphs.mr";
            }

            UnityEngine.Debug.Log("Root Folder :" + rootFolderPath + "  Output file: " + outputFile + "Search Pattern : " + searchPattern);

            MCSResource.MergeFiles(rootFolderPath, outputFile, searchPattern, true, true);
            return(outputFile);
        }
コード例 #2
0
ファイル: MorphExtraction.cs プロジェクト: xysverma/mcs
        /// <summary>
        /// Take all extracted morphs and pack them into a mr file
        /// </summary>
        /// <param name="rootFolderPath"></param>
        /// <returns>The path to the mr file</returns>
        public static string MergeMorphsIntoMR(string rootFolderPath, string outputFile = null)
        {
            rootFolderPath = rootFolderPath.TrimEnd('/');

            if (outputFile == null)
            {
                outputFile = rootFolderPath + "/morphs.mr";
            }

            UnityEngine.Debug.Log("Output file: " + outputFile);

            MCSResource.MergeFiles(rootFolderPath, outputFile, "*.morph");
            return(outputFile);
        }
コード例 #3
0
ファイル: MCSResourceEditor.cs プロジェクト: xysverma/mcs
    public override void OnInspectorGUI()
    {
        MCSResourceFileWrapper wrapper = (MCSResourceFileWrapper)target;

        GUILayout.Label(wrapper.fileName);

        try
        {
            MCSResource mr = new MCSResource();
            mr.Read(wrapper.fileName);
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("" + mr.header.Keys.Length + " entries");
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("File", GUILayout.Width(250));
            EditorGUILayout.LabelField("Size", GUILayout.Width(100));
            EditorGUILayout.EndHorizontal();
            for (int i = 0; i < mr.header.Keys.Length; i++)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.TextField(mr.header.Keys[i], GUILayout.Width(250));
                float kB = ((float)mr.header.Lengths[i]) / 1024f;
                EditorGUILayout.TextField(kB.ToString("F2") + "kB", GUILayout.Width(100));
                bool export = GUILayout.Button("Export", GUILayout.Width(100));
                if (export)
                {
                    mr.UnpackResource(mr.header.Keys[i]);
                    AssetDatabase.Refresh();
                }
                EditorGUILayout.EndHorizontal();
            }
        } catch
        {
            GUIStyle style = new GUIStyle();
            style.normal.textColor = Color.red;
            GUILayout.Label("Can't parse resource file, it appears corrupted.");
        }
    }