using ColdMint.scripts.utils;
using Godot;
namespace ColdMint.scripts;
///
/// SloganProvider
/// 标语提供器
///
public static class SloganProvider
{
static SloganProvider()
{
// Calculate SloganCount From translation file
// 从翻译文件中计算口号计数
var sloganTrans = ResourceLoader.Load("res://locals/Slogan.en.translation")!;
SloganCount = sloganTrans.GetTranslatedMessageList().Length;
}
private static int SloganCount { get; }
///
/// Swipe the machine to get a slogan
/// 刷机获取一个标语
///
///
public static string? GetSlogan()
{
var index = GD.Randi() % SloganCount;
return TranslationServerUtils.Translate($"slogan_{index}");
}
}