예제 #1
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        foreach (string asset in importedAssets)
        {
            if (!filePath.Equals(asset))
            {
                continue;
            }

            CharacterCC data = (CharacterCC)AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(CharacterCC));
            if (data == null)
            {
                data               = ScriptableObject.CreateInstance <CharacterCC> ();
                data.SheetName     = filePath;
                data.WorksheetName = sheetName;
                AssetDatabase.CreateAsset((ScriptableObject)data, assetFilePath);
                //data.hideFlags = HideFlags.NotEditable;
            }

            //data.dataArray = new ExcelQuery(filePath, sheetName).Deserialize<CharacterCCData>().ToArray();

            //ScriptableObject obj = AssetDatabase.LoadAssetAtPath (assetFilePath, typeof(ScriptableObject)) as ScriptableObject;
            //EditorUtility.SetDirty (obj);

            ExcelQuery query = new ExcelQuery(filePath, sheetName);
            if (query != null && query.IsValid())
            {
                data.dataArray = query.Deserialize <CharacterCCData>().ToArray();
                data.dataList  = query.Deserialize <CharacterCCData>();
                ScriptableObject obj = AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(ScriptableObject)) as ScriptableObject;
                EditorUtility.SetDirty(obj);
            }
        }
    }
예제 #2
0
 /// <summary>
 /// 初始化Pool
 /// </summary>
 public static void f_InitPool()
 {
     m_CharacterDT = Resources.Load <CharacterCC>("ExcelData/CharacterCC");
     Debug.Log(m_CharacterDT.dataList.Count);
 }