Files
test/Assets/PerfectWorld/Scripts/Chat/StubEmotionSpriteMap.cs
T
2026-04-08 17:42:02 +07:00

32 lines
1.1 KiB
C#

using BrewMonster;
/// <summary>
/// Stub实现 — 在没有真实TMP_SpriteAsset(emotion atlas)时使用的占位映射。
/// Stub implementation used when no real TMP_SpriteAsset (emotion atlas) is available yet.
///
/// 当准备好atlas后,创建一个新的IEmotionSpriteMap实现,替换掉这个stub。
/// When atlas is ready, create a real IEmotionSpriteMap implementation and swap it in
/// ChatEmotionDisplayPipeline / CECGameUIMan emotion pipeline.
/// </summary>
public class StubEmotionSpriteMap : IEmotionSpriteMap
{
private const int EMOTIONS_PER_SET = 50;
private const int FRAMES_PER_EMOTION = 4;
private const int DEFAULT_FPS = 10;
public bool TryGetSprite(int emotionSet, int emotionIndex, out EmotionSpriteInfo info)
{
int startFrame = (emotionSet * EMOTIONS_PER_SET + emotionIndex) * FRAMES_PER_EMOTION;
BMLogger.Log("[Cuong] TryGetSprite");
info = new EmotionSpriteInfo
{
SpriteIndex = startFrame,
IsAnimated = true,
AnimEndFrame = startFrame + FRAMES_PER_EMOTION - 1,
AnimFPS = DEFAULT_FPS
};
return true;
}
}