Passion & UI

This commit is contained in:
SoulliesOfficial
2026-06-12 17:11:39 -04:00
parent 7bc1e1722c
commit 6d7ebc5825
3444 changed files with 865284 additions and 463132 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using NUnit.Framework;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.Serialization;
namespace Cielonos.MainGame.Inventory
{
@@ -23,6 +24,17 @@ namespace Cielonos.MainGame.Inventory
Epsilon,
Aleph
}
[HideReferenceObjectPicker]
public class ItemDescription
{
public string descriptionKey;
public ItemDescription(string descriptionKey)
{
this.descriptionKey = descriptionKey;
}
}
[CreateAssetMenu(fileName = "ContentData", menuName = "Cielonos/Items/ContentData")]
public partial class ContentData : SerializedScriptableObject
@@ -39,13 +51,11 @@ namespace Cielonos.MainGame.Inventory
[ReadOnly]
public string displayNameKey;
[ReadOnly]
public string descriptionKey;
[ShowIf("isMainWeapon")]
public Sprite rectIcon;
[HideIf("isMainWeapon")]
public Sprite squareIcon;
[ListDrawerSettings(CustomAddFunction = "AddDescription", ListElementLabelName = "descriptionKey")]
public List<ItemDescription> descriptions;
[FormerlySerializedAs("squareIcon")]
public Sprite itemIcon;
[TitleGroup("Drop Settings")]
[Tooltip("掉落权重,越大越容易被随机选中。设为 0 则不会出现在随机池中。")]
@@ -57,7 +67,7 @@ namespace Cielonos.MainGame.Inventory
public partial class ContentData
{
private bool isMainWeapon => itemType == ItemType.MainWeapon;
private bool IsMainWeapon => itemType == ItemType.MainWeapon;
private void CreateID()
{
@@ -67,17 +77,15 @@ namespace Cielonos.MainGame.Inventory
return;
}
string itemType = this.itemType.ToString();
string className = this.itemClass.Name;
displayNameKey = $"{itemType}_{className}_Name";
descriptionKey = $"{itemType}_{className}_Desc";
displayNameKey = $"{className}_Name";
descriptions ??= new List<ItemDescription>();
}
}
#if UNITY_EDITOR
public partial class ContentData
{
#if UNITY_EDITOR
private List<string> GetAllTags()
{
return new List<string>
@@ -89,9 +97,8 @@ namespace Cielonos.MainGame.Inventory
}
/// <summary>
/// 获取项目中所有继承自ItemBase的类的名称列表用于编辑器下拉选择。可以根据需要添加命名空间过滤等逻辑。
/// 获取项目中所有继承自ItemBase的类的名称列表用于编辑器下拉选择。
/// </summary>
/// <returns></returns>
private List<Type> GetAllItemTypes()
{
List<Type> itemTypes = new List<Type>();
@@ -121,10 +128,15 @@ namespace Cielonos.MainGame.Inventory
"VitalisBiomass", //维塔利斯 - 生物
"Area6", //大陆技术领 第六区 - 尖端科技
"AcademyOfMagicalSciences", //魔法科学院 - 魔法
};
}
#endif
private void AddDescription()
{
int index = descriptions.Count;
string descriptionKey = $"{itemClass.Name}_Desc{index}";
descriptions.Add(new ItemDescription(descriptionKey));
}
}
}
#endif
}