2026-05-10 11:47:55 -04:00
|
|
|
|
using System;
|
2026-03-20 12:07:44 -04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using NUnit.Framework;
|
2026-01-03 18:19:39 -05:00
|
|
|
|
using Sirenix.OdinInspector;
|
2025-12-17 04:19:38 -05:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
2026-05-23 08:27:50 -04:00
|
|
|
|
namespace Cielonos.MainGame.Inventory
|
2025-12-17 04:19:38 -05:00
|
|
|
|
{
|
2026-01-03 18:19:39 -05:00
|
|
|
|
public enum ItemType
|
2025-12-17 04:19:38 -05:00
|
|
|
|
{
|
2026-01-03 18:19:39 -05:00
|
|
|
|
MainWeapon,
|
|
|
|
|
|
Support,
|
|
|
|
|
|
Passive,
|
|
|
|
|
|
Consumable
|
|
|
|
|
|
}
|
2025-12-17 04:19:38 -05:00
|
|
|
|
|
2026-01-03 18:19:39 -05:00
|
|
|
|
public enum ItemRarity
|
|
|
|
|
|
{
|
2026-05-10 11:47:55 -04:00
|
|
|
|
None,
|
2026-01-03 18:19:39 -05:00
|
|
|
|
Tera,
|
|
|
|
|
|
Moser,
|
|
|
|
|
|
Graham,
|
|
|
|
|
|
Epsilon,
|
|
|
|
|
|
Aleph
|
2025-12-17 04:19:38 -05:00
|
|
|
|
}
|
2026-01-03 18:19:39 -05:00
|
|
|
|
|
|
|
|
|
|
[CreateAssetMenu(fileName = "ContentData", menuName = "Cielonos/Items/ContentData")]
|
|
|
|
|
|
public partial class ContentData : SerializedScriptableObject
|
2025-12-17 04:19:38 -05:00
|
|
|
|
{
|
2026-05-10 11:47:55 -04:00
|
|
|
|
[InlineButton("CreateID", "Create")]
|
|
|
|
|
|
[ValueDropdown("GetAllItemTypes", IsUniqueList = true, DropdownHeight = 400)]
|
|
|
|
|
|
public Type itemClass;
|
|
|
|
|
|
public ItemType itemType;
|
|
|
|
|
|
public ItemRarity itemRarity;
|
|
|
|
|
|
[ValueDropdown("GetAllTags", IsUniqueList = true, DropdownHeight = 400)]
|
|
|
|
|
|
public List<string> tags;
|
2026-05-23 08:27:50 -04:00
|
|
|
|
[ValueDropdown("GetAllInstitutions", IsUniqueList = true, DropdownHeight = 400)]
|
|
|
|
|
|
public List<string> institutions;
|
2025-12-17 04:19:38 -05:00
|
|
|
|
|
2026-01-03 18:19:39 -05:00
|
|
|
|
[ReadOnly]
|
|
|
|
|
|
public string displayNameKey;
|
|
|
|
|
|
[ReadOnly]
|
|
|
|
|
|
public string descriptionKey;
|
|
|
|
|
|
|
|
|
|
|
|
[ShowIf("isMainWeapon")]
|
|
|
|
|
|
public Sprite rectIcon;
|
|
|
|
|
|
[HideIf("isMainWeapon")]
|
|
|
|
|
|
public Sprite squareIcon;
|
2026-05-10 11:47:55 -04:00
|
|
|
|
|
|
|
|
|
|
[TitleGroup("Drop Settings")]
|
|
|
|
|
|
[Tooltip("掉落权重,越大越容易被随机选中。设为 0 则不会出现在随机池中。")]
|
|
|
|
|
|
public float dropWeight = 1f;
|
|
|
|
|
|
|
|
|
|
|
|
[Tooltip("额外的掉落设置,可以在 Roll 时传入 filter 进行更复杂的筛选逻辑。")]
|
|
|
|
|
|
public Dictionary<string, float> dropSettings = new Dictionary<string, float>();
|
2026-01-03 18:19:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class ContentData
|
|
|
|
|
|
{
|
|
|
|
|
|
private bool isMainWeapon => itemType == ItemType.MainWeapon;
|
|
|
|
|
|
|
|
|
|
|
|
private void CreateID()
|
|
|
|
|
|
{
|
2026-05-10 11:47:55 -04:00
|
|
|
|
if(string.IsNullOrEmpty(itemClass?.Name))
|
2026-01-03 18:19:39 -05:00
|
|
|
|
{
|
|
|
|
|
|
Debug.LogWarning("Class Name is empty. Cannot create Item ID.");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string itemType = this.itemType.ToString();
|
2026-05-10 11:47:55 -04:00
|
|
|
|
string className = this.itemClass.Name;
|
2026-01-03 18:19:39 -05:00
|
|
|
|
|
|
|
|
|
|
displayNameKey = $"{itemType}_{className}_Name";
|
|
|
|
|
|
descriptionKey = $"{itemType}_{className}_Desc";
|
|
|
|
|
|
}
|
2025-12-17 04:19:38 -05:00
|
|
|
|
}
|
2026-03-20 12:07:44 -04:00
|
|
|
|
|
|
|
|
|
|
public partial class ContentData
|
|
|
|
|
|
{
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
|
private List<string> GetAllTags()
|
|
|
|
|
|
{
|
|
|
|
|
|
return new List<string>
|
|
|
|
|
|
{
|
2026-05-23 08:27:50 -04:00
|
|
|
|
"Melee", "Ranged",
|
|
|
|
|
|
"Burn", "Freeze", "Fusion", "Decay",
|
|
|
|
|
|
"Shield", "Heal", "Crit", "Overload", "DoT"
|
2026-03-20 12:07:44 -04:00
|
|
|
|
};
|
|
|
|
|
|
}
|
2026-05-10 11:47:55 -04:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取项目中所有继承自ItemBase的类的名称列表,用于编辑器下拉选择。可以根据需要添加命名空间过滤等逻辑。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private List<Type> GetAllItemTypes()
|
|
|
|
|
|
{
|
|
|
|
|
|
List<Type> itemTypes = new List<Type>();
|
|
|
|
|
|
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var type in assembly.GetTypes())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (type.IsClass && !type.IsAbstract && typeof(ItemBase).IsAssignableFrom(type))
|
|
|
|
|
|
{
|
|
|
|
|
|
itemTypes.Add(type);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return itemTypes;
|
|
|
|
|
|
}
|
2026-05-23 08:27:50 -04:00
|
|
|
|
|
|
|
|
|
|
private List<string> GetAllInstitutions()
|
|
|
|
|
|
{
|
|
|
|
|
|
return new List<string>
|
|
|
|
|
|
{
|
|
|
|
|
|
"MilitaryIndustrialComplex", //Gun san fuku gō tai 軍産複合体 - 通用
|
|
|
|
|
|
"ShinshuManufacturing", //Shin shu sei zō 新州制造 - 机械扈从
|
|
|
|
|
|
"SkodaDynamics", //斯柯达 - 动能,爆炸
|
|
|
|
|
|
"WardenclyffeResonanceHub", //沃登克里夫 - 能量
|
|
|
|
|
|
"EuropeanOrganizationForNuclearResearch", //欧洲核子研究组织 - 核能
|
|
|
|
|
|
"DopplerLumierePhotonics", //多普勒-卢米埃尔 - 光子
|
|
|
|
|
|
"VitalisBiomass", //维塔利斯 - 生物
|
|
|
|
|
|
"Area6", //大陆技术领 第六区 - 尖端科技
|
|
|
|
|
|
"AcademyOfMagicalSciences", //魔法科学院 - 魔法
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2026-05-10 11:47:55 -04:00
|
|
|
|
|
2026-03-20 12:07:44 -04:00
|
|
|
|
#endif
|
|
|
|
|
|
}
|
2026-01-03 18:19:39 -05:00
|
|
|
|
}
|