using System; using System.Linq; using UnityEngine; namespace AibisDream { public class BubbleSlotGroup : MonoBehaviour { [SerializeField] private BubbleSlotGroupData data; public BubbleSlotGroupData CollectData() { // 获取子类 var bubbleSlots = GetComponentsInChildren(); var optionSlots = GetComponentsInChildren(); // 抽取数据 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, Center } }