using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XRTool.Util;
using XRTool.WorldUI;
using System;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace XRTool.UI
{
[Serializable]
public class ItemData
{
///
/// 对应的图标?可能为空
///
public Texture2D icon;
///
/// 事件的主键值
///
public string actionKey;
///
/// 下载地址或者路径
///
public string url;
///
/// 事件类型
///
public int actionType;
}
///
/// 主要引用Icon3D为载体进行实例化出对应的图标
/// 或者其他载体做一些规则排列的图标
///
public class IteamConf : ScriptableObject
{
///
/// 图标引用的对象,可能为空,为空代表引用Scroll的资源
///
public XRButtonToggle iteamPrefab;
///
/// 模型数据
///
public ItemData itemData;
///
/// 缩放比例
///
public Vector3 scale = Vector3.one;
[HideInInspector]
public int index = -1;
public virtual void InitData(XRButtonToggle prefab)
{
prefab.SetImage(itemData.icon);
}
#if UNITY_EDITOR
[MenuItem("Assets/Create/DataConf/IteamConf", false, 0)]
static void CreateDynamicConf()
{
UnityEngine.Object obj = Selection.activeObject;
if (obj)
{
string path = AssetDatabase.GetAssetPath(obj);
IteamConf bullet = CreateInstance();
if (bullet)
{
string confName = UnityUtil.TryGetName(path);
AssetDatabase.CreateAsset(bullet, confName);
}
else
{
Debug.Log(typeof(IteamConf) + " is null");
}
}
}
#endif
}
}