Files
Cielonos/Assets/Scripts/MainGame/Managers/MainGameBaseCollection.cs

141 lines
4.6 KiB
C#
Raw Permalink Normal View History

2026-05-10 11:47:55 -04:00
using System;
2025-11-25 08:19:33 -05:00
using System.Collections.Generic;
2026-02-13 09:22:11 -05:00
using Cielonos.Core;
2026-05-23 08:27:50 -04:00
using Cielonos.MainGame.Inventory;
2025-12-22 18:36:29 -05:00
using DamageNumbersPro;
2025-11-25 08:19:33 -05:00
using Sirenix.OdinInspector;
2026-05-10 11:47:55 -04:00
using SLSUtilities.General;
2025-11-25 08:19:33 -05:00
using UnityEngine;
2026-05-26 00:21:27 -04:00
using UnityEngine.Serialization;
2025-11-25 08:19:33 -05:00
namespace Cielonos.MainGame
{
2026-02-13 09:22:11 -05:00
[CreateAssetMenu(fileName = "BasePrefabsCollection", menuName = "Cielonos/BaseCollections/MainGameBaseCollection")]
public partial class MainGameBaseCollection : BaseCollection<MainGameBaseCollection>
2025-11-25 08:19:33 -05:00
{
2026-01-03 18:19:39 -05:00
}
2026-02-13 09:22:11 -05:00
public partial class MainGameBaseCollection
{
2026-05-23 08:27:50 -04:00
public Dictionary<Breakthrough.Type, Color> outlineColorCollection = new Dictionary<Breakthrough.Type, Color>();
2026-02-13 09:22:11 -05:00
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
2026-01-03 18:19:39 -05:00
{
2026-02-13 09:22:11 -05:00
public Dictionary<string, DamageNumber> hudTextCollection = new Dictionary<string, DamageNumber>();
2026-05-23 08:27:50 -04:00
public DamageNumber DamageNumber(Attack.Type type, bool isCritical)
2026-01-03 18:19:39 -05:00
{
2026-05-23 08:27:50 -04:00
if (type == Attack.Type.Blank)
2026-04-18 13:57:19 -04:00
{
return hudTextCollection["DN_Blank"];
}
2026-01-03 18:19:39 -05:00
string prefix = "DN";
2026-05-23 08:27:50 -04:00
string typeStr = type.ToString();
2026-01-03 18:19:39 -05:00
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.");
}
2026-02-13 09:22:11 -05:00
public DamageNumber InfoText()
2026-01-03 18:19:39 -05:00
{
return hudTextCollection.GetValueOrDefault("Info_Normal");
}
2026-05-23 08:27:50 -04:00
public DamageNumber HealText()
{
return hudTextCollection.GetValueOrDefault("Heal");
}
public DamageNumber ShieldedDamageNumber()
{
return hudTextCollection.GetValueOrDefault("DN_Shielded");
}
2025-11-25 08:19:33 -05:00
}
2026-02-13 09:22:11 -05:00
public partial class MainGameBaseCollection
{
2026-05-10 11:47:55 -04:00
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;
}
}
2026-02-13 09:22:11 -05:00
}
2026-05-26 00:21:27 -04:00
public partial class MainGameBaseCollection
{
//Music Beat Combat System
[FormerlySerializedAs("beatPointerCollection")]
public SerializedDictionary<string, GameObject> beatMarkerCollection = new SerializedDictionary<string, GameObject>();
}
2025-11-25 08:19:33 -05:00
}