OdinMenuEditorWindow
命名空間: Sirenix.OdinInspector.Editor
public abstract class OdinMenuEditorWindow : OdinEditorWindow, ISerializationCallbackReceiver
繪制帶有菜單樹的編輯器窗口晨另。
例子:
protected override OdinMenuTree BuildMenuTree()
{
OdinMenuTree tree = new OdinMenuTree();
tree.Config.DrawSearchToolbar = true;
tree.Add("整包構(gòu)建", new PackageBuilderEditor());
tree.Add("熱更構(gòu)建", new PatchBuilderEditor());
return tree;
}
表示有2個頁簽锭环,整包構(gòu)建/熱更構(gòu)建,分別是PackageBuilderEditor
,PatchBuilderEditor
實(shí)現(xiàn)各自界面的渲染處理邏輯
OdinEditorWindow
命名空間:Sirenix.OdinInspector.Editor
[ShowOdinSerializedPropertiesInInspector]
public class OdinEditorWindow : EditorWindow, ISerializationCallbackReceiver
使用 Odin 創(chuàng)建編輯器窗口的基類。
例子:
public class SomeWindow : OdinEditorWindow
{
[MenuItem("My Game/Some Window")]
private static void OpenWindow()
{
GetWindow<SomeWindow>().Show();
}
}
表示一個窗口力惯,但是里面上面都沒有
特性
InfoBox
[InfoBox("參數(shù)請認(rèn)真選擇,不要選錯!", InfoMessageType.Info)]
類似[Header("xxx")]
,解釋文本
LabelText
[LabelText("平臺")]
讓原本序列號的變量兜辞,用中文描述
EnableIf
[EnableIf("buildPlatform", EBuildPlatform.Windows)]
如果滿足params1==params2的條件,則enable狀態(tài)夸溶,否則disabled逸吵。DisableIf
同理
PropertySpace
[PropertySpace(20)]
和Space
具有相同的功能
ReadOnly
[ReadOnly]
只讀
ShowIf
[ShowIf("tmpPatchArray")]
當(dāng)滿足條件時,顯示
OnValueChanged
[OnValueChanged("OnCurPageIndexChanged")]
當(dāng)數(shù)值發(fā)生變化時調(diào)用params1方法*如果是代碼賦值修改則不生效!
Button
[Button("開始構(gòu)建 (并保存配置)", ButtonSizes.Large, ButtonStyle.Box)]
public void Build() {
...
}
會生成一個按鈕缝裁,點(diǎn)擊后運(yùn)行某方法
ButtonGroup
[ButtonGroup]
讓多個Button
一排展示
FilePath
[FilePath(ParentFolder = "Assets", Extensions = "txt")]
public string localPatchFile;
這個string類型的變量是由手動選擇Assets目錄下的txt文件的路徑賦值