`
using System;
using UnityEngine;
//顯示中文
[AttributeUsage(AttributeTargets.Field)]
public class InspectorShow : PropertyAttribute
{
public string label; //要顯示的字符
public string htmlColor; //顏色
public InspectorShow(string label,string htmlColor= "#FFFFFF")
{
this.label = label;
}
}
//顯示顏色
public class TitleAttribute : PropertyAttribute
{
/// <summary> 標題名稱 </summary>
public string title;
/// <summary> 標題顏色 </summary>
public string htmlColor;
/// <summary> 在屬性上方添加一個標題 </summary>
/// <param name="title">標題名稱</param>
/// <param name="htmlColor">標題顏色</param>
public TitleAttribute(string title, string htmlColor = "#EE3B3B")
{
this.title = title;
this.htmlColor = htmlColor;
}
}
//顯示枚舉名稱
[AttributeUsage(AttributeTargets.Field)]
public class EnumNameAttribute : PropertyAttribute
{
/// <summary> 枚舉名稱 </summary>
public string name;
/// <summary> 標題顏色 </summary>
public string htmlColor;
public new int[] order = new int[0];
public EnumNameAttribute(string name)
{
this.name = name;
this.htmlColor = "#EE3B3B";
}
public EnumNameAttribute(string label, params int[] order)
{
this.name = label;
this.order = order;
this.htmlColor = "#EE3B3B";
}
}
public GameObject XiufuTaiArrow = null;
[TitleAttribute("此位置是否是區域解鎖點")]
public bool DisplayCloudUi = false;
[TitleAttribute("此位置是否是修復臺")]
public bool XiufuTai = false;
[TitleAttribute("解鎖需要的治療值")]
public int Hp;
[TitleAttribute("解鎖時上升的順序")]
public int Shunxv = -1;
[TitleAttribute("選擇解鎖屬性")]
[EnumNameAttribute("解鎖屬性:",new int[5] { 1,2,3,4,5})]
public GrayType IsTeshu = GrayType.None;
效果圖: