38 lines
857 B
C#
38 lines
857 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
#endif
|
|
using UnityEngine;
|
|
|
|
public class AssetData : ScriptableObject
|
|
{
|
|
#if UNITY_EDITOR
|
|
[MenuItem("工具/创建资源数据")]
|
|
static void CreateExampleAssetInstance()
|
|
{
|
|
var exampleAsset = CreateInstance<AssetData>();
|
|
AssetDatabase.CreateAsset(exampleAsset, "Assets/Resources/AssetData.asset");
|
|
AssetDatabase.Refresh();
|
|
}
|
|
|
|
#endif
|
|
public List<ImageAsset> buildData;
|
|
public Dictionary<string, Sprite> buildDic = new Dictionary<string, Sprite>();
|
|
|
|
public void InitData()
|
|
{
|
|
foreach (var dAsset in buildData)
|
|
{
|
|
buildDic.Add(dAsset.icon.name,dAsset.icon);
|
|
}
|
|
}
|
|
}
|
|
[Serializable]
|
|
public class ImageAsset
|
|
{
|
|
public string key;
|
|
public Sprite icon;
|
|
}
|