12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using UnityEditor;
- using UnityEngine;
- using System;
- using System.IO;
- namespace James.Editor {
- public class CustomizeAnim {
- public string name;
- public int start;
- public int end;
- public CustomizeAnim() { }
- }
- public class ModelInterpret {
- public CustomizeAnim[] anims;
- public string abName;
- public string abPath;
- public ModelInterpret() { }
- }
- //读取配置模型的配置
- public class ModelInterpretor {
- public static ModelInterpret read(string HowToClipCfgPath) {
- ModelInterpret mi = new ModelInterpret();
- if (!string.IsNullOrEmpty(HowToClipCfgPath)) {
- TextAsset textAsset = AssetDatabase.LoadAssetAtPath(HowToClipCfgPath, typeof(TextAsset)) as TextAsset;
- string line = textAsset.text;
- try {
- mi = UnityEngine.JsonUtility.FromJson<ModelInterpret>(line);
- //delete after read
- string jsonFile = Directory.GetCurrentDirectory() + "/" + HowToClipCfgPath;
- if (File.Exists(jsonFile))
- File.Delete(jsonFile);
- }
- catch (Exception ex)
- {
- Debug.Log(ex.ToString());
- }
- }
- return mi;
- }
- }
- }
|