using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
#if !UNITY_WEBGL
using System.Reflection;
#endif
using UnityEngine;
/********************************************************************************
*Create By CG
*Function 枚举控制
*********************************************************************************/
namespace ZXK.UTility
{
public class EnumCtrl
{
public enum LogoType {
//辽宁装备学校版本
LNZB,
//智学客版本
ZXK
}
public enum Type
{
///
/// 缺省值
///
[Description("默认状态")]
None,
///
/// 循环搬运机械手虚拟仿真系统
///
[Description("循环搬运机械手虚拟仿真系统")]
XHBY,
///
/// 气动冲压控制虚拟仿真系统
///
[Description("气动冲压控制虚拟仿真系统")]
QDCY,
///
/// 材料分拣虚拟仿真系统
///
[Description("材料分拣虚拟仿真系统")]
CLFJ,
///
/// 智能运动控制虚拟仿真系统
///
[Description("智能运动控制虚拟仿真系统")]
ZNYD,
///
/// 搬运输送控制虚拟仿真系统
///
[Description("搬运输送控制虚拟仿真系统")]
BYSS
}
public enum Model
{
///
/// 缺省值
///
[Description("默认状态")]
None,
///
/// 首页状态
///
[Description("首页状态")]
Home,
///
/// 二选一
///
[Description("二选一")]
Select2,
///
/// 设备认知
///
[Description("设备认知")]
Cognize,
///
/// 三选一
///
[Description("三选一")]
Select3,
///
/// 教学状态
///
[Description("教学状态")]
Teach,
///
/// 实训状态
///
[Description("实训状态")]
Train,
///
/// 考核状态
///
[Description("考核状态")]
Exam,
///
/// 接线状态
///
[Description("接线状态")]
Line,
///
/// 调试状态
///
[Description("调试状态")]
Debug,
///
/// 充气状态
///
[Description("充气状态")]
Gas,
///
/// 运行状态
///
[Description("运行状态")]
Running
}
public static string GetEnumDescription(System.Enum enumValue)
{
#if UNITY_WEBGL
switch (enumValue)
{
case Type.XHBY:
return "循环搬运机械手虚拟仿真系统";
case Type.QDCY:
return "气动冲压控制虚拟仿真系统";
case Type.CLFJ:
return "材料分拣虚拟仿真系统";
case Type.ZNYD:
return "智能运动控制虚拟仿真系统";
case Type.BYSS:
return "搬运输送控制虚拟仿真系统";
default:
return "";
}
#else
string value = enumValue.ToString();
FieldInfo field = enumValue.GetType().GetField(value);
object[] objs = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (objs == null || objs.Length == 0)
{
return value;
}
DescriptionAttribute descriptionAttribute = (DescriptionAttribute)objs[0];
return descriptionAttribute.Description;
#endif
}
}
}