202 lines
4.7 KiB
C#
202 lines
4.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using System.IO;
|
|
using UnityEditor;
|
|
|
|
|
|
/// <summary>
|
|
/// 管理类(配置文件)
|
|
/// </summary>
|
|
public class BaseConf : ScriptableObject
|
|
{
|
|
[Header("摄像机的")]
|
|
public Conf1 conf1 = new Conf1();
|
|
|
|
[Header("可插拔组件的")]
|
|
public Conf2 conf2 = new Conf2();
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Assets界面右键添加配置文件
|
|
/// </summary>
|
|
#if UNITY_EDITOR
|
|
[MenuItem("Assets/Create/Baseconf", false, 0)]
|
|
private static void Show()
|
|
{
|
|
Object o = Selection.activeObject;
|
|
if (o)
|
|
{
|
|
string path = AssetDatabase.GetAssetPath(o); //获取路径
|
|
if (!Directory.Exists(path))//判断是否有 AssetDatabase路径
|
|
{
|
|
Directory.CreateDirectory(path);//没有就 创建AssetDatabase路径
|
|
}
|
|
ScriptableObject a = CreateInstance<BaseConf>();//创建一个自身类型的对象
|
|
if (a)//判断创建的对象是否存在
|
|
{
|
|
string str = Unitil.TryGetName<BaseConf>(path);//类名打点调用获取文件名,并传参路径
|
|
AssetDatabase.CreateAsset(a, str);//根据对象(自身类) 及 路径创建
|
|
AssetDatabase.SaveAssets();//保存
|
|
}
|
|
else//否则创建失败
|
|
{
|
|
Debug.LogError(typeof(BaseConf) + " is null");//输出错误语句
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class Conf1
|
|
{
|
|
public bool isUse;
|
|
public bool isPicture;
|
|
public string base64;
|
|
public string LensID;
|
|
public string LensName;
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class Conf2
|
|
{
|
|
public bool isUse;
|
|
//模型类型
|
|
public ModuleType module_type;
|
|
//板卡类型
|
|
public Type_Card type_card;
|
|
//是否使用UPostItem
|
|
public bool isUseUPostItem = true;
|
|
}
|
|
|
|
[System.Serializable]
|
|
public enum ModuleType
|
|
{
|
|
None = 0,
|
|
设备,
|
|
板卡,
|
|
风扇,
|
|
开关,
|
|
电池,
|
|
防尘网
|
|
}
|
|
|
|
[System.Serializable]
|
|
public enum Type_Card
|
|
{
|
|
类型编号1,
|
|
类型编号2,
|
|
类型编号3,
|
|
类型编号4,
|
|
类型编号5,
|
|
类型编号6,
|
|
类型编号7,
|
|
类型编号8,
|
|
类型编号9,
|
|
类型编号10,
|
|
类型编号11,
|
|
类型编号12,
|
|
类型编号13,
|
|
类型编号14,
|
|
类型编号15,
|
|
类型编号16,
|
|
类型编号17,
|
|
类型编号18,
|
|
类型编号19,
|
|
类型编号20,
|
|
类型编号21,
|
|
类型编号22,
|
|
类型编号23,
|
|
类型编号24,
|
|
类型编号25,
|
|
类型编号26,
|
|
类型编号27,
|
|
类型编号28,
|
|
类型编号29,
|
|
类型编号30,
|
|
类型编号31,
|
|
类型编号32,
|
|
类型编号33,
|
|
类型编号34,
|
|
类型编号35,
|
|
类型编号36,
|
|
类型编号37,
|
|
类型编号38,
|
|
类型编号39,
|
|
类型编号40,
|
|
类型编号41,
|
|
类型编号42,
|
|
类型编号43,
|
|
类型编号44,
|
|
类型编号45,
|
|
类型编号46,
|
|
类型编号47,
|
|
类型编号48,
|
|
类型编号49,
|
|
类型编号50,
|
|
类型编号51,
|
|
类型编号52,
|
|
类型编号53,
|
|
类型编号54,
|
|
类型编号55,
|
|
类型编号56,
|
|
类型编号57,
|
|
类型编号58,
|
|
类型编号59,
|
|
类型编号60,
|
|
类型编号61,
|
|
类型编号62,
|
|
类型编号63,
|
|
类型编号64,
|
|
类型编号65,
|
|
类型编号66,
|
|
类型编号67,
|
|
类型编号68,
|
|
类型编号69,
|
|
类型编号70,
|
|
类型编号71,
|
|
类型编号72,
|
|
类型编号73,
|
|
类型编号74,
|
|
类型编号75,
|
|
类型编号76,
|
|
类型编号77,
|
|
类型编号78,
|
|
类型编号79,
|
|
类型编号80,
|
|
类型编号81,
|
|
类型编号82,
|
|
类型编号83,
|
|
类型编号84,
|
|
类型编号85,
|
|
类型编号86,
|
|
类型编号87,
|
|
类型编号88,
|
|
类型编号89,
|
|
类型编号90,
|
|
类型编号91,
|
|
类型编号92,
|
|
类型编号93,
|
|
类型编号94,
|
|
类型编号95,
|
|
类型编号96,
|
|
类型编号97,
|
|
类型编号98,
|
|
类型编号99,
|
|
类型编号100,
|
|
类型编号10_1,
|
|
}
|
|
}
|