This commit is contained in:
linmeideli committed 2026-08-18 21:25:22 +08:00
1 parent 525f987926
commit acfe345133
9 files changed
+38 -38

No files matched your search

@@ -1,15 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="teleporter.name">Teleporter</string>
<string name="teleporter.description">Zoom out and teleport across the map!</string>
<string name="freezer.name">Freezer</string>
<string name="freezer.description">Freeze another player for a duration of time.</string>
<string name="mayor.name">Mayor</string>
<string name="mayor.description">You get extra votes!</string>
<string name="chamelon.name">Chamelon</string>
<string name="chamelon.description">Stay invisible while not moving.</string>
<string name="outcastKiller.name">Outcast Killer</string>
<string name="outcastKiller.description">Outcast who can kill.</string>
<string name="teleporterrole.name">Teleporter</string>
<string name="teleporterrole.description">Zoom out and teleport across the map!</string>
<string name="freezerrole.name">Freezer</string>
<string name="freezerrole.description">Freeze another player for a duration of time.</string>
<string name="mayorrole.name">Mayor</string>
<string name="mayorrole.description">You get extra votes!</string>
<string name="chamelonrole.name">Chamelon</string>
<string name="chamelonrole.description">Stay invisible while not moving.</string>
<string name="outcastkillerrole.name">Outcast Killer</string>
<string name="outcastkillerrole.description">Outcast who can kill.</string>
<string name="outcast.name">Outcast</string>
<string name="outcast.roleTitle">OUTCAST</string>
<string name="outcast.teamIntroDescription">You are an Outcast. You do not have a team.</string>
@@ -1,15 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="teleporter.name">传送者</string>
<string name="teleporter.description">缩小视野并在地图上传送!</string>
<string name="freezer.name">冰冻者</string>
<string name="freezer.description">将其他玩家冰冻一段时间。</string>
<string name="mayor.name">市长</string>
<string name="mayor.description">你拥有额外投票权!</string>
<string name="chamelon.name">变色龙</string>
<string name="chamelon.description">静止不动时保持隐身。</string>
<string name="outcastKiller.name">流放杀手</string>
<string name="outcastKiller.description">可以击杀的流放者。</string>
<string name="teleporterrole.name">传送者</string>
<string name="teleporterrole.description">缩小视野并在地图上传送!</string>
<string name="freezerrole.name">冰冻者</string>
<string name="freezerrole.description">将其他玩家冰冻一段时间。</string>
<string name="mayorrole.name">市长</string>
<string name="mayorrole.description">你拥有额外投票权!</string>
<string name="chamelonrole.name">变色龙</string>
<string name="chamelonrole.description">静止不动时保持隐身。</string>
<string name="outcastKillerrole.name">流放杀手</string>
<string name="outcastKillerrole.description">可以击杀的流放者。</string>
<string name="outcast.name">流放者</string>
<string name="outcast.roleTitle">流放者</string>
<string name="outcast.teamIntroDescription">你是流放者,你没有队伍。</string>
+1 -3
View File
@@ -10,9 +10,7 @@ namespace MiraAPI.Example.Roles;
public class ChameloenRole : CrewmateRole, ICustomRole
{
public string RoleName => "chamelon.name";
public string RoleLongDescription => "chamelon.description";
public string RoleDescription => RoleLongDescription;
public string IdPart => "chamelon";
public Color RoleColor => Palette.AcceptedGreen;
public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate;
+1 -3
View File
@@ -6,9 +6,7 @@ namespace MiraAPI.Example.Roles;
public class FreezerRole : ImpostorRole, ICustomRole
{
public string RoleName => "freezer.name";
public string RoleLongDescription => "freezer.description";
public string RoleDescription => RoleLongDescription;
public string IdPart => "freezer";
public Color RoleColor => Palette.Blue;
public ModdedRoleTeams Team => ModdedRoleTeams.Impostor;
+1 -3
View File
@@ -5,9 +5,7 @@ namespace MiraAPI.Example.Roles;
public class MayorRole : CrewmateRole, ICustomRole
{
public string RoleName => "mayor.name";
public string RoleLongDescription => "mayor.description";
public string RoleDescription => RoleLongDescription;
public string IdPart => "mayor";
public Color RoleColor => new Color32(221, 176, 152, 255);
public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate;
public CustomRoleConfiguration Configuration => new(this);
+1 -3
View File
@@ -8,9 +8,7 @@ namespace MiraAPI.Example.Roles;
public class NeutralKillerRole : ImpostorRole, ICustomRole
{
public string RoleName => "outcastKiller.name";
public string RoleDescription => "outcastKiller.description";
public string RoleLongDescription => RoleDescription;
public string IdPart => "outcastKiller";
public Color RoleColor => Color.magenta;
public ModdedRoleTeams Team => ModdedRoleTeams.Custom;
+1 -3
View File
@@ -5,9 +5,7 @@ namespace MiraAPI.Example.Roles;
public class TeleporterRole : CrewmateRole, ICustomRole
{
public string RoleName => "teleporter.name";
public string RoleLongDescription => "teleporter.description";
public string RoleDescription => RoleLongDescription;
public string IdPart => "teleporter";
public Color RoleColor => new Color32(221, 176, 152, 255);
public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate;
+8 -3
View File
@@ -14,20 +14,25 @@ namespace MiraAPI.Roles;
/// </summary>
public interface ICustomRole : IOptionable
{
/// <summary>
/// Gets the id part used to build the role's translation keys.
/// </summary>
string IdPart => GetType().Name.ToLower();
/// <summary>
/// Gets the name of the role.
/// </summary>
string RoleName { get; }
string RoleName => TranslationManager.BuildTranslationId(IdPart, "name");
/// <summary>
/// Gets the description of the role. Used in the Intro Cutscene.
/// </summary>
string RoleDescription { get; }
string RoleDescription => TranslationManager.BuildTranslationId(IdPart, "description");
/// <summary>
/// Gets the long description of the role. Used in the Role Tab and Role Options.
/// </summary>
string RoleLongDescription { get; }
string RoleLongDescription => TranslationManager.BuildTranslationId(IdPart, "description");
/// <summary>
/// Gets the <see cref="Color"/> of the role.
@@ -119,6 +119,11 @@ public static class TranslationManager
return key;
}
public static string BuildTranslationId(string idPart, string suffix)
{
return idPart.StartsWith('#') ? idPart[1..] : $"{idPart}.{suffix}";
}
private static string GetModLangDir(string modGuid)
{
return Path.Combine(Application.persistentDataPath, LangDirectory, modGuid);