• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Administrator's Toolkit VS plugin


Commit MetaInfo

修订版7093d8fa8159e7e8d1f356433224a5a4c1e818ad (tree)
时间2020-11-18 10:39:14
作者melchior <melchior@user...>
Commitermelchior

Log Message

WIP partly completed ML support

更改概述

差异

--- a/AdminToolkit/ATK_BasicFeatures.cs
+++ b/AdminToolkit/ATK_BasicFeatures.cs
@@ -102,13 +102,22 @@ namespace AdminToolkit
102102 double.TryParse(elapsedDayStr, out elapsedDays)) {
103103 elapsedDays = ServerAPI.World.Calendar.TotalDays - elapsedDays;
104104 var playerPos = byPlayer.Entity.Pos.AsBlockPos.Copy();
105- //No Localized Season names?
106- var welcomeMsg = $"Meantime... {elapsedDays:F1} days have passed. {ServerAPI.World.AllOnlinePlayers.Length} Players online. It is {ServerAPI.World.Calendar.GetSeason(playerPos)} in the {ServerAPI.World.Calendar.GetHemisphere(playerPos)}.";
107-
108- byPlayer.SendMessage(GlobalConstants.CurrentChatGroup, welcomeMsg, EnumChatType.OthersMessage);
105+
106+ //No Localized Season/Hemispehere names?
107+ string welcomebackMsg = Lang.Get(@"welcomeback-message",
108+ elapsedDays,
109+ ServerAPI.World.AllOnlinePlayers.Length,
110+ ServerAPI.World.Calendar.GetSeason(playerPos),
111+ ServerAPI.World.Calendar.GetHemisphere(playerPos)
112+ );
113+
114+ byPlayer.SendMessage(GlobalConstants.CurrentChatGroup, welcomebackMsg, EnumChatType.OthersMessage);
109115 }
110116 else {
111- byPlayer.SendMessage(GlobalConstants.CurrentChatGroup, $"In the year; {ServerAPI.World.Calendar.PrettyDate( )}", EnumChatType.OthersMessage);
117+ string welcomeMsg = Lang.Get(@"welcome-message",
118+ ServerAPI.World.Calendar.PrettyDate( )
119+ );
120+ byPlayer.SendMessage(GlobalConstants.CurrentChatGroup,welcomeMsg, EnumChatType.OthersMessage);
112121 }
113122
114123 byPlayer.ServerData.CustomPlayerData[AdminToolkit._lastGameDayCountKey] = ServerAPI.World.Calendar.TotalDays.ToString("R");
@@ -116,6 +125,12 @@ namespace AdminToolkit
116125
117126 }
118127
128+ /* Something like:
129+
130+ string GetLang(string key, string langCode, params object[ ] parameters) //No fallback
131+ string GetLang_Fallback(string key, string langCode, params object[ ] parameters) //Uses 'Local' language for missing key
132+
133+ */
119134 }
120135 }
121136
--- a/AdminToolkit/AdminToolkit.csproj
+++ b/AdminToolkit/AdminToolkit.csproj
@@ -65,6 +65,10 @@
6565 <HintPath>VS_libs\VintagestoryLib.dll</HintPath>
6666 <Private>False</Private>
6767 </Reference>
68+ <Reference Include="Newtonsoft.Json">
69+ <HintPath>VS_libs\Newtonsoft.Json.dll</HintPath>
70+ <Private>False</Private>
71+ </Reference>
6872 </ItemGroup>
6973 <ItemGroup>
7074 <Compile Include="AdminToolkitMod.cs" />
@@ -78,10 +82,14 @@
7882 <Compile Include="Commands\PingerCommand.cs" />
7983 <Compile Include="Commands\VariableSpawnpoints.cs" />
8084 <Compile Include="ATK_BasicFeatures.cs" />
85+ <Compile Include="MultiLang.cs" />
8186 </ItemGroup>
8287 <ItemGroup>
8388 <Folder Include="VS_libs\" />
8489 <Folder Include="Commands\" />
90+ <Folder Include="assets\" />
91+ <Folder Include="assets\atk\" />
92+ <Folder Include="assets\atk\lang\" />
8593 </ItemGroup>
8694 <ItemGroup>
8795 <None Include="modinfo.json">
@@ -89,6 +97,9 @@
8997 </None>
9098 <None Include="LICENSE.txt" />
9199 <None Include="readme.md" />
100+ <None Include="assets\atk\lang\en.json">
101+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
102+ </None>
92103 </ItemGroup>
93104 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
94105 </Project>
\ No newline at end of file
--- a/AdminToolkit/AdminToolkitMod.cs
+++ b/AdminToolkit/AdminToolkitMod.cs
@@ -32,6 +32,8 @@ namespace AdminToolkit
3232 * [???] Custom Server name : custom formats to indicate server state/time/things
3333 * [IDEA]: Player VIRTUAL (temp) Inventory; Move Player inventory to alternate [world] D.B. as Inventory backup
3434 * [WIP]: Variable Player (re)Spawn points from a list ~ at random
35+ *
36+ * WORKAROUND -- Localized messages are by SERVERS Native Language code...Not the players...
3537 */
3638
3739 private ICoreAPI API { get; set; }
--- a/AdminToolkit/assets/atk/lang/en.json
+++ b/AdminToolkit/assets/atk/lang/en.json
@@ -1 +1,12 @@
1-
1+{
2+ "welcomeback-message": "Meantime... {0:F1} days have passed. {1} Players online. It is {2} in the {3}.",
3+ "welcome-message":"In the year; {0}",
4+ "display-rules":"Display server Rules",
5+ "already-accept":"{0} ALREADY ACCEPTED RULES!",
6+ "type-chat-rules":"{0} type in chat console: /rules {1}",
7+ "missing-rules":"* MISSING RULES FILE ({0})! *",
8+ "type-rules":"type ' /rules ' command for reading server rules.",
9+ "accepted-rules":"{0} HAS ACCEPTED THE RULES!",
10+ "promoted-to":"{0} have been promoted to: {1}",
11+ "demoted-to":"{0} have been demoted to: {1}",
12+}
--- a/AdminToolkit/modinfo.json
+++ b/AdminToolkit/modinfo.json
@@ -1,11 +1,12 @@
11 {
22 "type": "code",
33 "name": "Administrator's Toolkit mod",
4- "description" : "Provides misc. Admin functions;\n admin listing, rules display (multi-lingual), auto-backup & more...",
4+ "ModID":"atk",
5+ "description" : "Provides misc. Admin functions;\n admin listing, rules display (multi-lingual), auto-backup & much more.",
56 "authors": ["Melchior", ],
67 "version": "0.3.6",
78 "dependencies": {
8- "game": "1.13.0"
9+ "game": "1.13.4"
910 },
1011 "requiredonclient":false,
1112 "website": "https://osdn.net/users/melchior/pf/admintoolkit/"