45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
namespace BrewMonster.Scripts.Chat.EmotionData
|
||
{
|
||
/// <summary>
|
||
/// Snapshot một bộ Emotions{N} (dùng embed trong EmotionLibrarySO hoặc copy sang EmotionSetDataSO).
|
||
/// One Emotions{N} snapshot (embedded in EmotionLibrarySO or copied to EmotionSetDataSO).
|
||
/// </summary>
|
||
[Serializable]
|
||
public class EmotionSetSnapshot
|
||
{
|
||
public int EmotionSetIndex;
|
||
public int CellWidth = 32;
|
||
public int CellHeight = 32;
|
||
public Texture2D SourceAtlas;
|
||
public string SourceTxtAssetPath = "";
|
||
public List<EmotionEntryData> Entries = new List<EmotionEntryData>();
|
||
}
|
||
|
||
/// <summary>
|
||
/// Một ScriptableObject chứa nhiều bộ emotion (vd. emotions0–emotions7).
|
||
/// Single SO holding multiple emotion sets (e.g. all 8 atlases).
|
||
/// </summary>
|
||
[CreateAssetMenu(fileName = "EmotionLibrary", menuName = "Perfect World/Chat/Emotion Library (All Sets)", order = 1)]
|
||
public class EmotionLibrarySO : ScriptableObject
|
||
{
|
||
[Tooltip("Danh sách các bộ theo EmotionSetIndex (0,1,2,…).")]
|
||
public List<EmotionSetSnapshot> Sets = new List<EmotionSetSnapshot>();
|
||
|
||
public EmotionSetSnapshot GetSetOrNull(int emotionSetIndex)
|
||
{
|
||
if (Sets == null) return null;
|
||
foreach (var s in Sets)
|
||
{
|
||
if (s != null && s.EmotionSetIndex == emotionSetIndex)
|
||
return s;
|
||
}
|
||
|
||
return null;
|
||
}
|
||
}
|
||
}
|