Files
Cielonos/Assets/Scripts/MainGame/Managers/MainGameBaseCollection.cs
SoulliesOfficial b5cb6152ff MusicBeat
2026-05-26 00:21:27 -04:00

141 lines
4.6 KiB
C#

using System;
using System.Collections.Generic;
using Cielonos.Core;
using Cielonos.MainGame.Inventory;
using DamageNumbersPro;
using Sirenix.OdinInspector;
using SLSUtilities.General;
using UnityEngine;
using UnityEngine.Serialization;
namespace Cielonos.MainGame
{
[CreateAssetMenu(fileName = "BasePrefabsCollection", menuName = "Cielonos/BaseCollections/MainGameBaseCollection")]
public partial class MainGameBaseCollection : BaseCollection<MainGameBaseCollection>
{
}
public partial class MainGameBaseCollection
{
public Dictionary<Breakthrough.Type, Color> outlineColorCollection = new Dictionary<Breakthrough.Type, 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.Type type, bool isCritical)
{
if (type == Attack.Type.Blank)
{
return hudTextCollection["DN_Blank"];
}
string prefix = "DN";
string typeStr = type.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 DamageNumber HealText()
{
return hudTextCollection.GetValueOrDefault("Heal");
}
public DamageNumber ShieldedDamageNumber()
{
return hudTextCollection.GetValueOrDefault("DN_Shielded");
}
}
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;
}
}
}
public partial class MainGameBaseCollection
{
//Music Beat Combat System
[FormerlySerializedAs("beatPointerCollection")]
public SerializedDictionary<string, GameObject> beatMarkerCollection = new SerializedDictionary<string, GameObject>();
}
}