调整部分数据表配置,优化 SpriteCache 功能

This commit is contained in:
2026-09-13 20:36:21 +08:00
parent de53890de6
commit 7dc529a840
520 changed files with 24231 additions and 967 deletions
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SepCore.Definition;
using SepCore.Entity;
@@ -18,8 +19,8 @@ namespace SepCore.Editor
private int _selectedIndex;
private int _addCount = 1;
private Vector2 _scroll;
private PropConfig[] _allProps = Array.Empty<PropConfig>();
private PropConfig[] _filteredProps = Array.Empty<PropConfig>();
private IReadOnlyList<PropConfig> _allProps;
private IReadOnlyList<PropConfig> _filteredProps;
private string[] _displayNames = Array.Empty<string>();
private float _spawnRateScaleInput = 1f;
@@ -188,7 +189,7 @@ namespace SepCore.Editor
if (selectedProp == null) return;
_scroll = EditorGUILayout.BeginScrollView(_scroll, GUILayout.Height(120f));
EditorGUILayout.LabelField("Title", selectedProp.Title);
EditorGUILayout.LabelField("Title", selectedProp.Name);
EditorGUILayout.LabelField("Rarity", selectedProp.Rarity.ToString());
EditorGUILayout.LabelField("Description");
EditorGUILayout.HelpBox(ItemDescUtility.CreatePropDescription(selectedProp.Modifiers), MessageType.None);
@@ -215,7 +216,7 @@ namespace SepCore.Editor
player.AddProp(new PropItem(selectedProp));
}
ShowNotification(new GUIContent($"Added Buff: {selectedProp.Title} x{_addCount}"));
ShowNotification(new GUIContent($"Added Buff: {selectedProp.Name} x{_addCount}"));
}
private void RefreshPropList()
@@ -227,16 +228,15 @@ namespace SepCore.Editor
_displayNames = Array.Empty<string>();
return;
}
var table = GameEntry.Luban.GetTable<PropConfig>();
_allProps = table != null ? table.ToArray() : Array.Empty<PropConfig>();
_allProps = GameEntry.Luban.GetTable<PropConfig>();
_selectedIndex = 0;
ApplyFilter(_searchText);
}
private void ApplyFilter(string searchText)
{
if (_allProps == null || _allProps.Length == 0)
if (_allProps == null || _allProps.Count == 0)
{
_filteredProps = Array.Empty<PropConfig>();
_displayNames = Array.Empty<string>();
@@ -252,11 +252,11 @@ namespace SepCore.Editor
string keyword = searchText.Trim();
_filteredProps = _allProps.Where(p =>
p != null &&
(p.Title?.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) >= 0 ||
(p.Name?.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) >= 0 ||
p.Id.ToString().Contains(keyword))).ToArray();
}
_displayNames = _filteredProps.Select(p => $"[{p.Id}] {p.Title} ({p.Rarity})").ToArray();
_displayNames = _filteredProps.Select(p => $"[{p.Id}] {p.Name} ({p.Rarity})").ToArray();
if (_displayNames.Length == 0)
{
_selectedIndex = 0;
@@ -268,8 +268,8 @@ namespace SepCore.Editor
private PropConfig GetSelectedProp()
{
if (_filteredProps == null || _filteredProps.Length == 0) return null;
_selectedIndex = Mathf.Clamp(_selectedIndex, 0, _filteredProps.Length - 1);
if (_filteredProps == null || _filteredProps.Count == 0) return null;
_selectedIndex = Mathf.Clamp(_selectedIndex, 0, _filteredProps.Count - 1);
return _filteredProps[_selectedIndex];
}