Files
aibis-dream/Assets/Scripts/UI/DialogUI/Bubbles/BubbleSlotGroup.cs
T
2025-06-09 14:43:58 +08:00

45 lines
1.2 KiB
C#

using System;
using System.Linq;
using UnityEngine;
namespace AibisDream
{
public class BubbleSlotGroup : MonoBehaviour
{
[SerializeField] private BubbleSlotGroupData data;
public BubbleSlotGroupData CollectData()
{
// 获取子类
var bubbleSlots = GetComponentsInChildren<BubbleSlot>();
var optionSlots = GetComponentsInChildren<BubbleOptionSlot>();
// 抽取数据
data.bubbleSlots = bubbleSlots.Select(item => item.Data).ToArray();
if (optionSlots is { Length: 0 })
{
data.bubbleOptionSlots = optionSlots.Select(item => item.Data).ToArray();
}
return data;
}
}
[Serializable]
public struct BubbleSlotGroupData
{
public DialogViewType dialogViewType;
[HideInInspector] public BubbleSlotData[] bubbleSlots;
[HideInInspector] public BubbleOptionSlotData[] bubbleOptionSlots;
}
public enum PivotType {
Top,
Bottom,
Left,
Right,
TopLeft,
TopRight,
BottomLeft,
BottomRight
}
}