2024-10-27 04:03:15 +08:00
|
|
|
using System;
|
2024-10-25 17:59:28 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using Sirenix.OdinInspector;
|
2024-10-27 04:03:15 +08:00
|
|
|
using TableConfig;
|
|
|
|
using UnityEditor;
|
|
|
|
using UnityEngine;
|
2024-10-25 17:59:28 +08:00
|
|
|
|
2024-10-25 17:38:57 +08:00
|
|
|
namespace Ether
|
|
|
|
{
|
2024-10-27 04:03:15 +08:00
|
|
|
public class PropItemTableWindow : OdinSubWindowBase
|
2024-10-25 17:59:28 +08:00
|
|
|
{
|
|
|
|
[LabelText("道具列表")]
|
2024-10-27 04:03:15 +08:00
|
|
|
[DisableContextMenu(true, true)]
|
2024-10-25 17:59:28 +08:00
|
|
|
[TableList(IsReadOnly = true, AlwaysExpanded = true), ShowInInspector]
|
2024-10-27 04:03:15 +08:00
|
|
|
private List<PropItemTableEditorPreview> propItemTableEditorPreviewList;
|
2024-10-25 17:59:28 +08:00
|
|
|
|
2024-10-27 04:03:15 +08:00
|
|
|
protected override void OnInit()
|
2024-10-25 17:59:28 +08:00
|
|
|
{
|
|
|
|
propItemTableEditorPreviewList = new List<PropItemTableEditorPreview>();
|
|
|
|
}
|
2024-10-27 04:03:15 +08:00
|
|
|
|
|
|
|
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.");
|
|
|
|
// 在这里添加你的保存逻辑
|
|
|
|
}
|
|
|
|
|
2024-10-25 17:59:28 +08:00
|
|
|
}
|
|
|
|
|
2024-10-27 04:03:15 +08:00
|
|
|
[DisableContextMenu(true, true)]
|
2024-10-25 17:59:28 +08:00
|
|
|
public class PropItemTableEditorPreview
|
2024-10-27 04:03:15 +08:00
|
|
|
{
|
|
|
|
[DisableContextMenu]
|
|
|
|
[TableColumnWidth(50, false)]
|
|
|
|
[HorizontalGroup("Id"), HideLabel]
|
|
|
|
[ShowInInspector]
|
|
|
|
[DisplayAsString]
|
|
|
|
[LabelWidth(20)]
|
|
|
|
[Center]
|
|
|
|
public int Id;
|
2024-10-25 17:38:57 +08:00
|
|
|
|
2024-10-27 04:03:15 +08:00
|
|
|
[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<Sprite>("Art/UI/Icon/" + propItemCfg.Icon).texture;
|
|
|
|
//Icon = AssetDatabase.LoadAssetAtPath<Texture>("Resources/" + );
|
|
|
|
}
|
|
|
|
|
|
|
|
Id = propItemCfg.Id;
|
|
|
|
Name = propItemCfg.Name;
|
|
|
|
Type = propItemCfg.Type;
|
|
|
|
Quality = propItemCfg.Quality;
|
|
|
|
Description = propItemCfg.Description;
|
|
|
|
}
|
2024-10-25 17:38:57 +08:00
|
|
|
}
|
|
|
|
}
|