122 lines
4.1 KiB
C#
122 lines
4.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Cielonos.Core;
|
|
using Cielonos.MainGame.Characters.Inventory;
|
|
using DamageNumbersPro;
|
|
using Sirenix.OdinInspector;
|
|
using SLSUtilities.General;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame
|
|
{
|
|
[CreateAssetMenu(fileName = "BasePrefabsCollection", menuName = "Cielonos/BaseCollections/MainGameBaseCollection")]
|
|
public partial class MainGameBaseCollection : BaseCollection<MainGameBaseCollection>
|
|
{
|
|
|
|
}
|
|
|
|
public partial class MainGameBaseCollection
|
|
{
|
|
public Dictionary<BreakthroughType, Color> outlineColorCollection = new Dictionary<BreakthroughType, Color>();
|
|
public Dictionary<ItemRarity, Color> itemRarityColorCollection = new Dictionary<ItemRarity, Color>();
|
|
}
|
|
|
|
public partial class MainGameBaseCollection
|
|
{
|
|
public Dictionary<string, MeshEffect> meshEffectCollection = new Dictionary<string, MeshEffect>();
|
|
}
|
|
|
|
public partial class MainGameBaseCollection
|
|
{
|
|
public Dictionary<string, DamageNumber> hudTextCollection = new Dictionary<string, DamageNumber>();
|
|
public DamageNumber DamageNumber(Attack.AttackType attackType, bool isCritical)
|
|
{
|
|
if (attackType == Attack.AttackType.Blank)
|
|
{
|
|
return hudTextCollection["DN_Blank"];
|
|
}
|
|
|
|
string prefix = "DN";
|
|
string typeStr = attackType.ToString();
|
|
string criticalStr = isCritical ? "Critical" : "Normal";
|
|
string dnKey = $"{prefix}_{typeStr}_{criticalStr}";
|
|
if (hudTextCollection.TryGetValue(dnKey, out var hudTextPrefab))
|
|
{
|
|
return hudTextPrefab;
|
|
}
|
|
|
|
throw new KeyNotFoundException($"HUD Text Prefab with key '{dnKey}' not found in BasePrefabsCollection.");
|
|
}
|
|
|
|
public DamageNumber InfoText()
|
|
{
|
|
return hudTextCollection.GetValueOrDefault("Info_Normal");
|
|
}
|
|
}
|
|
|
|
public partial class MainGameBaseCollection
|
|
{
|
|
public SerializedDictionary<string, VFXData, BuffVFXPair> buffVFXCollection = new SerializedDictionary<string, VFXData, BuffVFXPair>();
|
|
|
|
/// <summary>
|
|
/// 通过 Buff 类型获取对应的 VFXData。
|
|
/// </summary>
|
|
public VFXData BuffVFX(Type buffType)
|
|
{
|
|
return buffVFXCollection.GetValueOrDefault(buffType.Name);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 通过 Buff 类名字符串获取对应的 VFXData。
|
|
/// </summary>
|
|
public VFXData BuffVFX(string key)
|
|
{
|
|
return buffVFXCollection.GetValueOrDefault(key);
|
|
}
|
|
|
|
[Serializable]
|
|
public struct BuffVFXPair : ISerializedPair<string, VFXData>
|
|
{
|
|
[SerializeField, HideInInspector] private string buffKey;
|
|
[SerializeField, HideInInspector] private bool useManualInput;
|
|
|
|
[ShowInInspector]
|
|
[PropertyOrder(0)]
|
|
[HideIf("useManualInput")]
|
|
[HorizontalGroup("H")]
|
|
[HideLabel]
|
|
[ValueDropdown("@EditorBaseCollection.GetCharacterBuffDropdown($property)", IsUniqueList = true, DropdownHeight = 400)]
|
|
[InlineButton("ToggleMode", Icon = SdfIconType.ListUl, Label = "")]
|
|
public string DropdownKey
|
|
{
|
|
get => buffKey;
|
|
set => buffKey = value;
|
|
}
|
|
|
|
[ShowInInspector]
|
|
[PropertyOrder(0)]
|
|
[ShowIf("useManualInput")]
|
|
[HorizontalGroup("H")]
|
|
[HideLabel]
|
|
[InlineButton("ToggleMode", Icon = SdfIconType.PencilSquare, Label = "")]
|
|
public string ManualKey
|
|
{
|
|
get => buffKey;
|
|
set => buffKey = value;
|
|
}
|
|
|
|
[PropertyOrder(10)]
|
|
[HorizontalGroup("H", MarginLeft = 10, Width = 150)]
|
|
[HideLabel]
|
|
public VFXData vfxData;
|
|
|
|
public string Key => buffKey;
|
|
public VFXData Value => vfxData;
|
|
|
|
private void ToggleMode()
|
|
{
|
|
useManualInput = !useManualInput;
|
|
}
|
|
}
|
|
}
|
|
} |