using System; using System.Collections.Generic; using Sirenix.OdinInspector; using TableConfig; using UnityEditor; using UnityEngine; namespace Ether { public class PropItemTableWindow : OdinSubWindowBase { [LabelText("道具列表")] [DisableContextMenu(true, true)] [TableList(IsReadOnly = true, AlwaysExpanded = true), ShowInInspector] private List propItemTableEditorPreviewList; protected override void OnInit() { propItemTableEditorPreviewList = new List(); } public override void OnShow() { propItemTableEditorPreviewList.Clear(); foreach (var propItemCfg in TableProvider.Tables.TbPropItem.DataList) { propItemTableEditorPreviewList.Add(new PropItemTableEditorPreview(propItemCfg)); } } protected override void OnSave() { Debug.Log("Custom save action performed."); // 在这里添加你的保存逻辑 } } [DisableContextMenu(true, true)] public class PropItemTableEditorPreview { [DisableContextMenu] [TableColumnWidth(50, false)] [HorizontalGroup("Id"), HideLabel] [ShowInInspector] [DisplayAsString] [LabelWidth(20)] [Center] public int Id; [DisableContextMenu] [HorizontalGroup("图标"), HideLabel] [TableColumnWidth(50, false)] [ShowInInspector, PreviewField(45, ObjectFieldAlignment.Center)] [ReadOnly] public Texture Icon; [DisableContextMenu] [HorizontalGroup("名称"), HideLabel] [TableColumnWidth(150, false)] [DisplayAsString] [Center] public string Name; [DisableContextMenu] [HorizontalGroup("类型"), HideLabel] [TableColumnWidth(150, false)] [DisplayAsString] [Center] public PropItemType Type; [DisableContextMenu] [HorizontalGroup("品质"), HideLabel] [TableColumnWidth(50, false)] [DisplayAsString] [Center] public int Quality; [DisableContextMenu] [HorizontalGroup("描述"), HideLabel] [TableColumnWidth(0)] //[TextArea(2,100)] //[ReadOnly] [Center] public string Description = "这是个道具描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述 "; public PropItemTableEditorPreview(PropItemTable propItemCfg) { if (!string.IsNullOrEmpty(propItemCfg.Icon)) { Icon = LoaderTools.LoadAsset("Art/UI/Icon/" + propItemCfg.Icon).texture; //Icon = AssetDatabase.LoadAssetAtPath("Resources/" + ); } Id = propItemCfg.Id; Name = propItemCfg.Name; Type = propItemCfg.Type; Quality = propItemCfg.Quality; Description = propItemCfg.Description; } } }