Skip to content

Commit 65869d5

Browse files
Add chinese versino and translations
1 parent b9b7959 commit 65869d5

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
lines changed

RespawnProtection/RespawnProtectionConfiguration.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,90 @@
11
using Rocket.API;
2+
using System.Xml.Serialization;
3+
24

35
namespace RestoreMonarchy.RespawnProtection
46
{
57
public class RespawnProtectionConfiguration : IRocketPluginConfiguration
68
{
9+
#if CHINESE
10+
[XmlElement("消息颜色")]
11+
#endif
712
public string MessageColor { get; set; } = "yellow";
13+
#if CHINESE
14+
[XmlElement("消息图标链接")]
15+
#endif
816
public string MessageIconUrl { get; set; } = "https://i.imgur.com/Di3NWF0.png";
17+
#if CHINESE
18+
[XmlElement("保护持续时间")]
19+
#endif
920
public float ProtectionDuration { get; set; }
21+
#if CHINESE
22+
[XmlElement("启用家园出生点保护")]
23+
#endif
1024
public bool EnableHomeSpawnProtection { get; set; }
25+
#if CHINESE
26+
[XmlElement("启用加入出生点保护")]
27+
#endif
1128
public bool EnableJoinSpawnProtection { get; set; }
29+
#if CHINESE
30+
[XmlElement("启用竞技场出生点保护")]
31+
#endif
1232
public bool EnableArenaSpawnProtection { get; set; } = true;
33+
#if CHINESE
34+
[XmlElement("最大移动距离")]
35+
#endif
1336
public float MaxMoveDistance { get; set; }
37+
#if CHINESE
38+
[XmlElement("保护PVE")]
39+
#endif
1440
public bool ProtectFromPVE { get; set; }
41+
#if CHINESE
42+
[XmlElement("装备枪支时禁用")]
43+
#endif
1544
public bool DisableOnEquipGun { get; set; }
45+
#if CHINESE
46+
[XmlElement("装备近战武器时禁用")]
47+
#endif
1648
public bool DisableOnEquipMelee { get; set; }
49+
#if CHINESE
50+
[XmlElement("装备投掷物时禁用")]
51+
#endif
1752
public bool DisableOnEquipThrowable { get; set; }
53+
#if CHINESE
54+
[XmlElement("攻击时禁用")]
55+
#endif
1856
public bool DisableOnAttack { get; set; }
57+
#if CHINESE
58+
[XmlElement("移动时禁用")]
59+
#endif
1960
public bool DisableOnMove { get; set; }
61+
#if CHINESE
62+
[XmlElement("效果ID")]
63+
#endif
2064
public ushort EffectId { get; set; }
65+
#if CHINESE
66+
[XmlElement("效果触发率")]
67+
#endif
2168
public float EffectTriggerRate { get; set; }
69+
#if CHINESE
70+
[XmlElement("攻击消息率")]
71+
#endif
2272
public float AttackMessageRate { get; set; }
73+
#if CHINESE
74+
[XmlElement("发送保护启用消息")]
75+
#endif
2376
public bool SendProtectionEnabledMessage { get; set; } = true;
77+
#if CHINESE
78+
[XmlElement("保护启用消息延迟")]
79+
#endif
2480
public float ProtectionEnabledMessageDelay { get; set; } = 0f;
81+
#if CHINESE
82+
[XmlElement("发送保护禁用到期消息")]
83+
#endif
2584
public bool SendProtectionDisabledExpiredMessage { get; set; } = true;
85+
#if CHINESE
86+
[XmlElement("发送保护禁用消息")]
87+
#endif
2688
public bool SendProtectionDisabledOtherMessage { get; set; } = true;
2789

2890
public void LoadDefaults()

RespawnProtection/RespawnProtectionPlugin.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,26 @@ protected override void Unload()
4343
Logger.Log($"{Name} has been unloaded!", ConsoleColor.Yellow);
4444
}
4545

46-
public override TranslationList DefaultTranslations => new()
46+
public override TranslationList DefaultTranslations =>
47+
#if CHINESE
48+
new()
49+
{
50+
{ "SpawnProtectionEnabled", "已为[[b]]{0}[[/b]]秒启用出生点保护。" },
51+
{ "SpawnProtectionDisabledExpired", "你的出生点保护已过期。" },
52+
{ "SpawnProtectionDisabledOnMove", "由于移动距离过远,出生点保护已禁用。" },
53+
{ "SpawnProtectionDisabledOnEquipGun", "由于装备枪支,出生点保护已禁用。" },
54+
{ "SpawnProtectionDisabledOnEquipMelee", "由于装备近战武器,出生点保护已禁用。" },
55+
{ "SpawnProtectionDisabledOnEquipThrowable", "由于装备投掷物,出生点保护已禁用。" },
56+
{ "SpawnProtectionDisabledOnAttack", "由于进行攻击,出生点保护已禁用。" },
57+
{ "SpawnProtectionDisabledWithCommand", "已通过指令禁用出生点保护。" },
58+
{ "PlayerHasProtection", "你无法伤害[[b]]{0}[[/b]],因为他们处于出生点保护状态。" },
59+
{ "SpawnProtectionCommandFormat", "你必须指定玩家名称。" },
60+
{ "PlayerNotFound", "未找到玩家。" },
61+
{ "SpawnProtectionCommandDisabled", "已为[[b]]{0}[[/b]]禁用出生点保护。" },
62+
{ "SpawnProtectionCommandEnabled", "已为[[b]]{0}[[/b]]启用出生点保护,持续[[b]]{1}[[/b]]秒。" }
63+
};
64+
#else
65+
new()
4766
{
4867
{ "SpawnProtectionEnabled", "Spawn protection enabled for [[b]]{0}[[/b]] seconds." },
4968
{ "SpawnProtectionDisabledExpired", "Your spawn protection has expired." },
@@ -59,8 +78,9 @@ protected override void Unload()
5978
{ "SpawnProtectionCommandDisabled", "Spawn protection disabled for [[b]]{0}[[/b]]." },
6079
{ "SpawnProtectionCommandEnabled", "Spawn protection enabled for [[b]]{0}[[/b]] for [[b]]{1}[[/b]] seconds." }
6180
};
81+
#endif
6282

63-
private void OnPlayerConnected(UnturnedPlayer player)
83+
private void OnPlayerConnected(UnturnedPlayer player)
6484
{
6585
RespawnProtectionComponent component = player.Player.gameObject.AddComponent<RespawnProtectionComponent>();
6686
if (Configuration.Instance.EnableJoinSpawnProtection)

thumbnail.png

69.7 KB
Loading

0 commit comments

Comments
 (0)