2024-06-05 13:38:45 +00:00
|
|
|
|
using ColdMint.scripts.utils;
|
2024-06-08 12:27:02 +00:00
|
|
|
|
|
2024-05-12 15:06:07 +00:00
|
|
|
|
using Godot;
|
2024-04-28 13:55:19 +00:00
|
|
|
|
|
|
|
|
|
namespace ColdMint.scripts;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>SloganProvider</para>
|
|
|
|
|
/// <para>标语提供器</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class SloganProvider
|
|
|
|
|
{
|
2024-06-08 12:27:02 +00:00
|
|
|
|
static SloganProvider()
|
|
|
|
|
{
|
|
|
|
|
// Calculate SloganCount From translation file
|
|
|
|
|
var sloganTrans = ResourceLoader.Load<OptimizedTranslation>("res://locals/Slogan.en.translation")!;
|
|
|
|
|
SloganCount = sloganTrans.GetTranslatedMessageList().Length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static int SloganCount { get; }
|
2024-05-12 15:06:07 +00:00
|
|
|
|
|
2024-04-28 13:55:19 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>Swipe the machine to get a slogan</para>
|
|
|
|
|
/// <para>刷机获取一个标语</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2024-05-12 15:06:07 +00:00
|
|
|
|
public static string? GetSlogan()
|
2024-04-28 13:55:19 +00:00
|
|
|
|
{
|
2024-06-08 12:27:02 +00:00
|
|
|
|
var index = GD.Randi() % SloganCount;
|
|
|
|
|
return TranslationServerUtils.Translate($"slogan_{index}");
|
2024-04-28 13:55:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|