GQ_Communicate/GQ_URP/GQ/Assets/ScriptabLeObject/BaseConf.cs

195 lines
4.0 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;
}
[System.Serializable]
public enum ModuleType
{
,
,
,
}
[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,
}
}