From 6e7678c55c1863546ff65232cb7637d1791bd6fe Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Fri, 24 Mar 2023 22:54:02 +0800 Subject: [PATCH 01/18] first loc strings --- AlternateResourcePanel/ARPPartWindow.cs | 14 ++++++++++---- .../Localization/en-us.cfg | 11 +++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg diff --git a/AlternateResourcePanel/ARPPartWindow.cs b/AlternateResourcePanel/ARPPartWindow.cs index 553cda7..314ad23 100644 --- a/AlternateResourcePanel/ARPPartWindow.cs +++ b/AlternateResourcePanel/ARPPartWindow.cs @@ -6,11 +6,17 @@ using KSP; using UnityEngine; using KSPPluginFramework; +using KSP.Localization; namespace KSPAlternateResourcePanel { class ARPPartWindow : MonoBehaviourWindow { + // Localization strings + private static string TRANSFER = Localizer.Format("#ARP_LOC_001"); + private static string STOP = Localizer.Format("#ARP_LOC_002"); + private static string IN = Localizer.Format("#ARP_LOC_003"); + private static string OUT = Localizer.Format("#ARP_LOC_004"); //internal ARPPartWindow(Part Part) //{ // this.Part = Part; @@ -261,7 +267,7 @@ internal override void DrawWindow(int id) styleTransfer.padding.top = -8; styleTransfer.padding.bottom = 0; //GUILayout.Label("Transfer: " + tmpTransfer.transferState, styleTransfer); - GUILayout.Label("Transfer: " , styleTransfer); + GUILayout.Label($"{TRANSFER}: " , styleTransfer); // Transfer GUILayout.Space(21); @@ -274,8 +280,8 @@ internal override void DrawWindow(int id) styleTransferButton.margin = new RectOffset(0, 0, 0, 0); - String strOut = (tmpTransfer.transferState == TransferStateEnum.Out && tmpTransfer.Active) ? "Stop" : "Out"; - String strIn = (tmpTransfer.transferState == TransferStateEnum.In && tmpTransfer.Active) ? "Stop" : "In"; + String strOut = (tmpTransfer.transferState == TransferStateEnum.Out && tmpTransfer.Active) ? STOP : OUT; //"Stop""Out" + String strIn = (tmpTransfer.transferState == TransferStateEnum.In && tmpTransfer.Active) ? STOP : OUT; // "Stop""In" Boolean blnTempOut = GUILayout.Toggle(tmpTransfer.transferState == TransferStateEnum.Out, strOut, styleTransferButton); Boolean blnTempIn = GUILayout.Toggle(tmpTransfer.transferState == TransferStateEnum.In, strIn, styleTransferButton); @@ -355,7 +361,7 @@ internal override void OnGUIEvery() if (Visible && !UIHidden) { Boolean oldMouseOver = MouseOver; - MouseOver = (Event.current.type== EventType.repaint) && WindowRect.Contains(Event.current.mousePosition); + MouseOver = (Event.current.type== EventType.Repaint) && WindowRect.Contains(Event.current.mousePosition); if (oldMouseOver != MouseOver) { diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg new file mode 100644 index 0000000..1bc890e --- /dev/null +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -0,0 +1,11 @@ +Localization +{ + en-us + { + #ARP_LOC_001 = Transfer + #ARP_LOC_002 = Stop + #ARP_LOC_003 = Out + #ARP_LOC_004 = In + + } +} From 84eecaf685529d61b338547a37ff65fc37c1ac7a Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Fri, 24 Mar 2023 23:03:03 +0800 Subject: [PATCH 02/18] 2 --- AlternateResourcePanel/ARP.cs | 17 +++++++++++------ .../Localization/en-us.cfg | 5 +++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/AlternateResourcePanel/ARP.cs b/AlternateResourcePanel/ARP.cs index 3389f0a..4e19f9f 100644 --- a/AlternateResourcePanel/ARP.cs +++ b/AlternateResourcePanel/ARP.cs @@ -9,6 +9,7 @@ using KSPPluginFramework; using ARPToolbarWrapper; +using KSP.Localization; namespace KSPAlternateResourcePanel { @@ -19,7 +20,11 @@ private KSPAlternateResourcePanel() { APIInstance = this; } - + // Localization strings + private static string ARMEDWAITSTAGE = Localizer.Format("#ARP_LOC_005"); + private static string RUNNING = Localizer.Format("#ARP_LOC_006"); + private static string NOTARMED = Localizer.Format("#ARP_LOC_008"); + private static string RUNCOMPLETE = Localizer.Format("#ARP_LOC_009"); //windows internal ARPWindow windowMain; internal ARPWindowSettings windowSettings; @@ -838,7 +843,7 @@ internal override void RepeatingWorker() if (!AutoStagingRunning) { AutoStagingStatusColor = Color.white; - AutoStagingStatus = "Armed... waiting for stage"; + AutoStagingStatus = ARMEDWAITSTAGE; //"Armed... waiting for stage" //when to set it to running if (lstLastStageEngineModules.Any(x => x.staged) || lstLastStageEngineFXModules.Any(x => x.staged)) AutoStagingRunning = true; @@ -847,7 +852,7 @@ internal override void RepeatingWorker() { //we are running, so now what AutoStagingStatusColor = new Color32(183, 254, 0, 255); - AutoStagingStatus = "Running"; + AutoStagingStatus = RUNNING; // "Running" //are all the engines that are active flamed out in the last stage if (AutoStagingTriggeredAt == 0 && lstPartsLastStageEngines.Count > 0 && @@ -869,7 +874,7 @@ internal override void RepeatingWorker() AutoStagingTriggeredAt = 0; } else { AutoStagingStatusColor = new Color32(232, 232, 0, 255); - AutoStagingStatus = String.Format("Delay:{0:0.0}s", ((Double)settings.AutoStagingDelayInTenths / 10) - (Planetarium.GetUniversalTime() -AutoStagingTriggeredAt )); + AutoStagingStatus = Localizer.Format("#ARP_LOC_007", ((Double)settings.AutoStagingDelayInTenths / 10) - (Planetarium.GetUniversalTime() -AutoStagingTriggeredAt )); //String.Format("Delay:{0:0.0}s", ((Double)settings.AutoStagingDelayInTenths / 10) - (Planetarium.GetUniversalTime() -AutoStagingTriggeredAt )) } } } @@ -886,7 +891,7 @@ internal override void RepeatingWorker() if (AutoStagingTriggeredAt == 0) { AutoStagingStatusColor = new Color32(140, 140, 140,255); - AutoStagingStatus = "Not Armed"; + AutoStagingStatus = NOTARMED; // "Not Armed" } else { @@ -894,7 +899,7 @@ internal override void RepeatingWorker() AutoStagingTriggeredAt = 0; else { - AutoStagingStatus = "Run Complete"; + AutoStagingStatus = RUNCOMPLETE; // "Run Complete" AutoStagingStatusColor = new Color32(183, 254, 0, 255); } } diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg index 1bc890e..9db8400 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -6,6 +6,11 @@ Localization #ARP_LOC_002 = Stop #ARP_LOC_003 = Out #ARP_LOC_004 = In + #ARP_LOC_005 = Armed... waiting for stage + #ARP_LOC_006 = Running + #ARP_LOC_007 = Delay:<<1>>s + #ARP_LOC_008 = Not Armed + #ARP_LOC_009 = Run Complete } } From d734552c073c3db1e9ff682c3836e4a1a05f79f0 Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Fri, 24 Mar 2023 23:17:21 +0800 Subject: [PATCH 03/18] JUST DO IT --- AlternateResourcePanel/ARPWindow.cs | 48 +++- .../Localization/en-us.cfg | 259 ++++++++++++++++++ 2 files changed, 293 insertions(+), 14 deletions(-) diff --git a/AlternateResourcePanel/ARPWindow.cs b/AlternateResourcePanel/ARPWindow.cs index a9fc2fc..c2133b0 100644 --- a/AlternateResourcePanel/ARPWindow.cs +++ b/AlternateResourcePanel/ARPWindow.cs @@ -7,6 +7,7 @@ using KSP.UI.Screens; using UnityEngine; using KSPPluginFramework; +using KSP.Localization; namespace KSPAlternateResourcePanel { @@ -36,6 +37,24 @@ class ARPWindow: MonoBehaviourWindowPlus private PartResourceVisibleList SelectedResources; internal Int32 intLineHeight = 20; + // Localization strings + private static string NODISPLAY = Localizer.Format("#ARP_LOC_010"); + private static string STAGE = Localizer.Format("#ARP_LOC_011"); + private static string ACTSTAGE = Localizer.Format("#ARP_LOC_012"); + private static string NOCONTROL = Localizer.Format("#ARP_LOC_013"); + private static string AUTO = Localizer.Format("#ARP_LOC_014"); + private static string TO = Localizer.Format("#ARP_LOC_015"); + private static string ARM = Localizer.Format("#ARP_LOC_016"); + private static string DISARM = Localizer.Format("#ARP_LOC_017"); + private static string BACKTOVESSEL = Localizer.Format("#ARP_LOC_018"); + private static string SHOWBASE = Localizer.Format("#ARP_LOC_019"); + private static string HIDETIME = Localizer.Format("#ARP_LOC_020"); + private static string SHOWTIME = Localizer.Format("#ARP_LOC_021"); + private static string TOGGLERES = Localizer.Format("#ARP_LOC_022"); + private static string SHOWSETTING = Localizer.Format("#ARP_LOC_023"); + private static string HIDESETTING = Localizer.Format("#ARP_LOC_024"); + private static string UPDATEVERSION = Localizer.Format("#ARP_LOC_025"); + internal override void OnAwake() { TooltipMouseOffset = new Vector2d(-10, 10); @@ -78,7 +97,7 @@ internal override void DrawWindow(Int32 id) if (mbARP.lstResourcesToDisplay.Count == 0) { - GUILayout.Label("No current resources configured to display"); + GUILayout.Label(NODISPLAY); // "No current resources configured to display" } else { @@ -189,7 +208,7 @@ internal override void DrawWindow(Int32 id) if (!settings.AutoStagingEnabled) { //GUILayout.Label("Stage:", Styles.styleStageTextHead, GUILayout.Width(50)); - if (GUILayout.Button("Stage:", Styles.styleStageTextHead, GUILayout.Width(50))) + if (GUILayout.Button($"{STAGE}:", Styles.styleStageTextHead, GUILayout.Width(50))) // Stage settings.AutoStagingEnabled = !settings.AutoStagingEnabled; GUIStyle styleStageNum = new GUIStyle(Styles.styleStageTextHead); GUIContent contStageNum = new GUIContent(StageManager.CurrentStage.ToString()); @@ -206,13 +225,13 @@ internal override void DrawWindow(Int32 id) if (settings.StagingEnabledInMapView || !MapView.MapIsEnabled) { if (mbARP.blnVesselIsControllable) { - if (GUILayout.Button("Activate Stage", "ButtonGeneral", GUILayout.Width(100))) + if (GUILayout.Button(ACTSTAGE, "ButtonGeneral", GUILayout.Width(100))) // "Activate Stage" StageManager.ActivateNextStage(); GUILayout.Space(21 + IconAlarmOffset); //GUILayout.Space(51 + IconAlarmOffset); } else { - GUILayout.Label("No Vessel Control", GUILayout.Width(120)); + GUILayout.Label(NOCONTROL, GUILayout.Width(120)); // "No Vessel Control" GUILayout.Space(1 + IconAlarmOffset); //GUILayout.Space(31 + IconAlarmOffset); } @@ -222,20 +241,20 @@ internal override void DrawWindow(Int32 id) } else { - if (GUILayout.Button("Auto:", Styles.styleStageTextHead, GUILayout.Width(50))) + if (GUILayout.Button($"{AUTO}:", Styles.styleStageTextHead, GUILayout.Width(50))) // Auto settings.AutoStagingEnabled = !settings.AutoStagingEnabled; GUILayout.Label(StageManager.CurrentStage.ToString(),Styles.styleStageTextHead, GUILayout.Width(20)); - GUILayout.Label("to", Styles.styleStageTextHead, GUILayout.Width(30)); + GUILayout.Label(TO, Styles.styleStageTextHead, GUILayout.Width(30)); // "to" GUILayout.Label(mbARP.AutoStagingTerminateAt.ToString(), Styles.styleStageTextHead, GUILayout.Width(30)); DrawHorizontalSlider(ref mbARP.AutoStagingTerminateAt, 0, mbARP.AutoStagingMaxStage); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - String strButtonArm = "Arm"; + String strButtonArm = ARM; // "Arm" GUIStyle styleArm = new GUIStyle(SkinsLibrary.CurrentSkin.button) { fontStyle = FontStyle.Bold }; if (mbARP.AutoStagingArmed) { - strButtonArm = "Disarm"; + strButtonArm = DISARM; // "Disarm" styleArm.normal.textColor = styleArm.hover.textColor = new Color32(207,31,31,255) ; } else @@ -262,7 +281,7 @@ internal override void DrawWindow(Int32 id) // ShowBase Button Boolean blnShowBase = settings.ShowBase; - if (DrawToggle(ref blnShowBase, new GUIContent(Resources.btnViewBaseActive, blnShowBase ? "Back to Vessel Display" : "Show Base Display\r\nAll resource within 2km of active vessel"), SkinsLibrary.GetStyle(SkinsLibrary.CurrentSkin, "ButtonToggle").PaddingChange(1), GUILayout.Width(23))) + if (DrawToggle(ref blnShowBase, new GUIContent(Resources.btnViewBaseActive, blnShowBase ? BACKTOVESSEL : SHOWBASE), SkinsLibrary.GetStyle(SkinsLibrary.CurrentSkin, "ButtonToggle").PaddingChange(1), GUILayout.Width(23))) // "Back to Vessel Display"|"Show Base Display\r\nAll resource within 2km of active vessel" { settings.ShowBase = blnShowBase; } @@ -273,7 +292,8 @@ internal override void DrawWindow(Int32 id) // ShowTime Button Boolean blnShowTimeRem = settings.ShowTimeRem; - if (DrawToggle(ref blnShowTimeRem, new GUIContent(Resources.btnViewTimes, blnShowTimeRem ? "Hide time Remianing": "Show Time Remaining"), SkinsLibrary.GetStyle(SkinsLibrary.CurrentSkin,"ButtonToggle").PaddingChange(1), GUILayout.Width(23))) { + if (DrawToggle(ref blnShowTimeRem, new GUIContent(Resources.btnViewTimes, blnShowTimeRem ? HIDETIME : SHOWTIME), SkinsLibrary.GetStyle(SkinsLibrary.CurrentSkin,"ButtonToggle").PaddingChange(1), GUILayout.Width(23))) // "Hide time Remianing" "Show Time Remaining" + { settings.ShowTimeRem = blnShowTimeRem; } //if (GUILayout.Button(new GUIContent(Resources.btnViewTimes, "Toggle Time Remaining"), SkinsLibrary.CurrentSkin.button.PaddingChange(1), GUILayout.Width(23))) @@ -283,7 +303,7 @@ internal override void DrawWindow(Int32 id) // ShowAll Button Boolean blnToggleHidden = KSPAlternateResourcePanel.ShowAll; - if (DrawToggle(ref blnToggleHidden, new GUIContent(Resources.btnViewAll, "Toggle Hidden Resources"), SkinsLibrary.GetStyle(SkinsLibrary.CurrentSkin, "ButtonToggle").PaddingChange(1), GUILayout.Width(23))) + if (DrawToggle(ref blnToggleHidden, new GUIContent(Resources.btnViewAll, TOGGLERES), SkinsLibrary.GetStyle(SkinsLibrary.CurrentSkin, "ButtonToggle").PaddingChange(1), GUILayout.Width(23))) // "Toggle Hidden Resources" { KSPAlternateResourcePanel.ShowAll = blnToggleHidden; } @@ -293,15 +313,15 @@ internal override void DrawWindow(Int32 id) //} //Settings Toggle button - GUIContent btnMinMax = new GUIContent(Resources.btnChevronDown, "Show Settings..."); + GUIContent btnMinMax = new GUIContent(Resources.btnChevronDown, SHOWSETTING); // "Show Settings..." if (windowSettings.Visible) { - btnMinMax.image = Resources.btnChevronUp; btnMinMax.tooltip = "Hide Settings"; + btnMinMax.image = Resources.btnChevronUp; btnMinMax.tooltip = HIDESETTING; // "Hide Settings" } else if (settings.VersionAttentionFlag && DateTime.Now.Millisecond < 500) { btnMinMax.image = Resources.btnSettingsAttention; } - if (settings.VersionAttentionFlag) btnMinMax.tooltip = "Updated Version Available - " + btnMinMax.tooltip; + if (settings.VersionAttentionFlag) btnMinMax.tooltip = $"{UPDATEVERSION} - " + btnMinMax.tooltip; // Updated Version Available if (GUILayout.Button(btnMinMax,"ButtonSettings",GUILayout.Width(23))) { diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg index 9db8400..2f178f3 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -11,6 +11,265 @@ Localization #ARP_LOC_007 = Delay:<<1>>s #ARP_LOC_008 = Not Armed #ARP_LOC_009 = Run Complete + #ARP_LOC_010 = No current resources configured to display + + #ARP_LOC_011 = Stage + #ARP_LOC_012 = Activate Stage + #ARP_LOC_013 = No Vessel Control + #ARP_LOC_014 = Auto + #ARP_LOC_015 = to + #ARP_LOC_016 = Arm + #ARP_LOC_017 = Disarm + #ARP_LOC_018 = Back to Vessel Display + #ARP_LOC_019 = Show Base Display\r\nAll resource within 2km of active vessel + #ARP_LOC_020 = Hide time Remianing + + #ARP_LOC_021 = Show Time Remaining + #ARP_LOC_022 = Toggle Hidden Resources + #ARP_LOC_023 = Show Settings... + #ARP_LOC_024 = Hide Settings + #ARP_LOC_025 = Updated Version Available + #ARP_LOC_026 = + #ARP_LOC_027 = + #ARP_LOC_028 = + #ARP_LOC_029 = + #ARP_LOC_030 = + + #ARP_LOC_031 = + #ARP_LOC_032 = + #ARP_LOC_033 = + #ARP_LOC_034 = + #ARP_LOC_035 = + #ARP_LOC_036 = + #ARP_LOC_037 = + #ARP_LOC_038 = + #ARP_LOC_039 = + #ARP_LOC_040 = + + #ARP_LOC_041 = + #ARP_LOC_042 = + #ARP_LOC_043 = + #ARP_LOC_044 = + #ARP_LOC_045 = + #ARP_LOC_046 = + #ARP_LOC_047 = + #ARP_LOC_048 = + #ARP_LOC_049 = + #ARP_LOC_050 = + + #ARP_LOC_051 = + #ARP_LOC_052 = + #ARP_LOC_053 = + #ARP_LOC_054 = + #ARP_LOC_055 = + #ARP_LOC_056 = + #ARP_LOC_057 = + #ARP_LOC_058 = + #ARP_LOC_059 = + #ARP_LOC_060 = + + #ARP_LOC_061 = + #ARP_LOC_062 = + #ARP_LOC_063 = + #ARP_LOC_064 = + #ARP_LOC_065 = + #ARP_LOC_066 = + #ARP_LOC_067 = + #ARP_LOC_068 = + #ARP_LOC_069 = + #ARP_LOC_070 = + #ARP_LOC_071 = + #ARP_LOC_072 = + #ARP_LOC_073 = + #ARP_LOC_074 = + #ARP_LOC_075 = + #ARP_LOC_076 = + #ARP_LOC_077 = + #ARP_LOC_078 = + #ARP_LOC_079 = + #ARP_LOC_080 = + #ARP_LOC_081 = + #ARP_LOC_082 = + #ARP_LOC_083 = + #ARP_LOC_084 = + #ARP_LOC_085 = + #ARP_LOC_086 = + #ARP_LOC_087 = + #ARP_LOC_088 = + #ARP_LOC_089 = + #ARP_LOC_090 = + #ARP_LOC_091 = + #ARP_LOC_092 = + #ARP_LOC_093 = + #ARP_LOC_094 = + #ARP_LOC_095 = + #ARP_LOC_096 = + #ARP_LOC_097 = + #ARP_LOC_098 = + #ARP_LOC_099 = + #ARP_LOC_100 = + #ARP_LOC_101 = + #ARP_LOC_102 = + #ARP_LOC_103 = + #ARP_LOC_104 = + #ARP_LOC_105 = + #ARP_LOC_106 = + #ARP_LOC_107 = + #ARP_LOC_108 = + #ARP_LOC_109 = + #ARP_LOC_110 = + #ARP_LOC_111 = + #ARP_LOC_112 = + #ARP_LOC_113 = + #ARP_LOC_114 = + #ARP_LOC_115 = + #ARP_LOC_116 = + #ARP_LOC_117 = + #ARP_LOC_118 = + #ARP_LOC_119 = + #ARP_LOC_120 = + #ARP_LOC_121 = + #ARP_LOC_122 = + #ARP_LOC_123 = + #ARP_LOC_124 = + #ARP_LOC_125 = + #ARP_LOC_126 = + #ARP_LOC_127 = + #ARP_LOC_128 = + #ARP_LOC_129 = + #ARP_LOC_130 = + #ARP_LOC_131 = + #ARP_LOC_132 = + #ARP_LOC_133 = + #ARP_LOC_134 = + #ARP_LOC_135 = + #ARP_LOC_136 = + #ARP_LOC_137 = + #ARP_LOC_138 = + #ARP_LOC_139 = + #ARP_LOC_140 = + #ARP_LOC_141 = + #ARP_LOC_142 = + #ARP_LOC_143 = + #ARP_LOC_144 = + #ARP_LOC_145 = + #ARP_LOC_146 = + #ARP_LOC_147 = + #ARP_LOC_148 = + #ARP_LOC_149 = + #ARP_LOC_150 = + #ARP_LOC_151 = + #ARP_LOC_152 = + #ARP_LOC_153 = + #ARP_LOC_154 = + #ARP_LOC_155 = + #ARP_LOC_156 = + #ARP_LOC_157 = + #ARP_LOC_158 = + #ARP_LOC_159 = + #ARP_LOC_160 = + #ARP_LOC_161 = + #ARP_LOC_162 = + #ARP_LOC_163 = + #ARP_LOC_164 = + #ARP_LOC_165 = + #ARP_LOC_166 = + #ARP_LOC_167 = + #ARP_LOC_168 = + #ARP_LOC_169 = + #ARP_LOC_170 = + #ARP_LOC_171 = + #ARP_LOC_172 = + #ARP_LOC_173 = + #ARP_LOC_174 = + #ARP_LOC_175 = + #ARP_LOC_176 = + #ARP_LOC_177 = + #ARP_LOC_178 = + #ARP_LOC_179 = + #ARP_LOC_180 = + #ARP_LOC_181 = + #ARP_LOC_182 = + #ARP_LOC_183 = + #ARP_LOC_184 = + #ARP_LOC_185 = + #ARP_LOC_186 = + #ARP_LOC_187 = + #ARP_LOC_188 = + #ARP_LOC_189 = + #ARP_LOC_190 = + #ARP_LOC_191 = + #ARP_LOC_192 = + #ARP_LOC_193 = + #ARP_LOC_194 = + #ARP_LOC_195 = + #ARP_LOC_196 = + #ARP_LOC_197 = + #ARP_LOC_198 = + #ARP_LOC_199 = + #ARP_LOC_200 = + #ARP_LOC_201 = + #ARP_LOC_202 = + #ARP_LOC_203 = + #ARP_LOC_204 = + #ARP_LOC_205 = + #ARP_LOC_206 = + #ARP_LOC_207 = + #ARP_LOC_208 = + #ARP_LOC_209 = + #ARP_LOC_210 = + #ARP_LOC_211 = + #ARP_LOC_212 = + #ARP_LOC_213 = + #ARP_LOC_214 = + #ARP_LOC_215 = + #ARP_LOC_216 = + #ARP_LOC_217 = + #ARP_LOC_218 = + #ARP_LOC_219 = + #ARP_LOC_220 = + #ARP_LOC_221 = + #ARP_LOC_222 = + #ARP_LOC_223 = + #ARP_LOC_224 = + #ARP_LOC_225 = + #ARP_LOC_226 = + #ARP_LOC_227 = + #ARP_LOC_228 = + #ARP_LOC_229 = + #ARP_LOC_230 = + #ARP_LOC_231 = + #ARP_LOC_232 = + #ARP_LOC_233 = + #ARP_LOC_234 = + #ARP_LOC_235 = + #ARP_LOC_236 = + #ARP_LOC_237 = + #ARP_LOC_238 = + #ARP_LOC_239 = + #ARP_LOC_240 = + #ARP_LOC_241 = + #ARP_LOC_242 = + #ARP_LOC_243 = + #ARP_LOC_244 = + #ARP_LOC_245 = + #ARP_LOC_246 = + #ARP_LOC_247 = + #ARP_LOC_248 = + #ARP_LOC_249 = + #ARP_LOC_250 = + #ARP_LOC_251 = + #ARP_LOC_252 = + #ARP_LOC_253 = + #ARP_LOC_254 = + #ARP_LOC_255 = + #ARP_LOC_256 = + #ARP_LOC_257 = + #ARP_LOC_258 = + #ARP_LOC_259 = + #ARP_LOC_260 = + + } } From 39466af6ddffb5f93c1a7ab2d20199e48d0e910d Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Fri, 24 Mar 2023 23:37:45 +0800 Subject: [PATCH 04/18] 4 --- .../ARPWindowResourceConfig.cs | 106 ++-- .../Localization/en-us.cfg | 478 +++++++++--------- 2 files changed, 309 insertions(+), 275 deletions(-) diff --git a/AlternateResourcePanel/ARPWindowResourceConfig.cs b/AlternateResourcePanel/ARPWindowResourceConfig.cs index 1075d6c..ebcb700 100644 --- a/AlternateResourcePanel/ARPWindowResourceConfig.cs +++ b/AlternateResourcePanel/ARPWindowResourceConfig.cs @@ -7,6 +7,7 @@ using KSP; using UnityEngine; using KSPPluginFramework; +using KSP.Localization; namespace KSPAlternateResourcePanel { @@ -29,6 +30,39 @@ class ARPWindowResourceConfig : MonoBehaviourWindowPlus DropDownList ddlMonType; DropDownList ddlDisplayValueAs; + // Localization strings + private static string CONFIGRES = Localizer.Format("#ARP_LOC_026"); + private static string CLOSE = Localizer.Format("#ARP_LOC_027"); + private static string ICON = Localizer.Format("#ARP_LOC_028"); + private static string NAME = Localizer.Format("#ARP_LOC_029"); + private static string POSITION = Localizer.Format("#ARP_LOC_030"); + private static string VISIBILITY = Localizer.Format("#ARP_LOC_031"); + private static string MONITOR = Localizer.Format("#ARP_LOC_032"); + private static string ADDSEPARATOR = Localizer.Format("#ARP_LOC_033"); + private static string MOVEUP = Localizer.Format("#ARP_LOC_034"); + private static string MOVETOTOP = Localizer.Format("#ARP_LOC_035"); + private static string MOVETOBOTTOM = Localizer.Format("#ARP_LOC_036"); + private static string DELETE = Localizer.Format("#ARP_LOC_037"); + private static string DISPLAYAS = Localizer.Format("#ARP_LOC_038"); + private static string MONITORLV = Localizer.Format("#ARP_LOC_039"); + private static string WARNINGLV = Localizer.Format("#ARP_LOC_040"); + private static string ALERTLV = Localizer.Format("#ARP_LOC_041"); + private static string ALARMSFORTHIS = Localizer.Format("#ARP_LOC_042"); + private static string ALARMENABLE = Localizer.Format("#ARP_LOC_043"); + private static string EMPTYBEHAV = Localizer.Format("#ARP_LOC_044"); + private static string HIDEEMPTY = Localizer.Format("#ARP_LOC_045"); + private static string FULLBEHAV = Localizer.Format("#ARP_LOC_046"); + private static string HIDEFULL = Localizer.Format("#ARP_LOC_047"); + private static string STAGEBAR = Localizer.Format("#ARP_LOC_048"); + private static string SPLITENABLE = Localizer.Format("#ARP_LOC_049"); + private static string SPLITBEHAV = Localizer.Format("#ARP_LOC_050"); + private static string SHOWRESERVELV = Localizer.Format("#ARP_LOC_051"); + private static string INSTEADWHOLE = Localizer.Format("#ARP_LOC_052"); + private static string SORTGROUP = Localizer.Format("#ARP_LOC_053"); + private static string SAVE = Localizer.Format("#ARP_LOC_054"); + private static string UNABLETOFIND = Localizer.Format("#ARP_LOC_055"); + private static string MOVING = Localizer.Format("#ARP_LOC_056"); + private static string SEPARATOR = Localizer.Format("#ARP_LOC_057"); internal override void OnAwake() { settings = KSPAlternateResourcePanel.settings; @@ -75,18 +109,18 @@ internal override void DrawWindow(int id) GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); - GUILayout.Label("Configure Resources",Styles.styleTextYellowBold); + GUILayout.Label(CONFIGRES,Styles.styleTextYellowBold); // "Configure Resources" GUILayout.FlexibleSpace(); - if (GUILayout.Button("Close")) this.Visible = false; + if (GUILayout.Button(CLOSE)) this.Visible = false; // "Close" GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(2); - GUILayout.Label("Icon", Styles.styleStageTextHead,GUILayout.Width(32)); - GUILayout.Label("Name", Styles.styleStageTextHead, GUILayout.Width(120)); - GUILayout.Label("Position", Styles.styleStageTextHead, GUILayout.Width(56)); + GUILayout.Label(ICON, Styles.styleStageTextHead,GUILayout.Width(32)); // "Icon" + GUILayout.Label(NAME, Styles.styleStageTextHead, GUILayout.Width(120)); // "Name" + GUILayout.Label(POSITION, Styles.styleStageTextHead, GUILayout.Width(56)); // "Position" GUILayout.Space(6); - GUILayout.Label("Visibility", Styles.styleStageTextHead, GUILayout.Width(80)); - GUILayout.Label("Monitor", Styles.styleStageTextHead, GUILayout.Width(60)); + GUILayout.Label(VISIBILITY, Styles.styleStageTextHead, GUILayout.Width(80)); // "Visibility" + GUILayout.Label(MONITOR, Styles.styleStageTextHead, GUILayout.Width(60)); // "Monitor" GUILayout.EndHorizontal(); Int32 SepToDelete = 0; @@ -163,7 +197,7 @@ internal override void DrawWindow(int id) } } - if (GUILayout.Button(new GUIContent("S","Add Separator"), GUILayout.Width(21))) + if (GUILayout.Button(new GUIContent("S",ADDSEPARATOR), GUILayout.Width(21))) // "Add Separator" { AddSeparatorAtEnd(); MoveResource(settings.Resources.Count - 1, i + 1); @@ -171,7 +205,7 @@ internal override void DrawWindow(int id) //Move up and down if (i > 0) { - if (GUILayout.Button(new GUIContent("↑","Move Up"), GUILayout.Width(21))) + if (GUILayout.Button(new GUIContent("↑",MOVEUP), GUILayout.Width(21))) // "Move Up" { SwapResource(i - 1, i); } @@ -190,7 +224,7 @@ internal override void DrawWindow(int id) //Move top and Bottom if (i > 0) { - if (GUILayout.Button(new GUIContent("↑↑","Move to Top"), GUILayout.Width(27))) + if (GUILayout.Button(new GUIContent("↑↑", MOVETOTOP), GUILayout.Width(27))) // "Move to Top" { MoveResource(i,0); } @@ -201,7 +235,7 @@ internal override void DrawWindow(int id) } if (i < settings.Resources.Count - 1) { - if (GUILayout.Button(new GUIContent("↓↓", "Move to Bottom"), GUILayout.Width(27))) + if (GUILayout.Button(new GUIContent("↓↓", MOVETOBOTTOM), GUILayout.Width(27))) // "Move to Bottom" { MoveResource(i, settings.Resources.Count); } @@ -233,7 +267,7 @@ internal override void DrawWindow(int id) } else { - if (GUILayout.Button("Delete", GUILayout.Width(75 + 58 + 4))) + if (GUILayout.Button(DELETE, GUILayout.Width(75 + 58 + 4))) // "Delete" { SepToDelete = item.id; } @@ -248,15 +282,15 @@ internal override void DrawWindow(int id) GUILayout.Space(8);//4 GUILayout.BeginHorizontal(); - GUILayout.Label("Display As:", Styles.styleStageTextHead, GUILayout.Width(151)); - //GUILayout.Label("Monitoring Type:", GUILayout.Width(mbARP.windowDebug.intTest1)); + GUILayout.Label($"{DISPLAYAS}:", Styles.styleStageTextHead, GUILayout.Width(151)); // + //GUILayout.Label("Monitoring Type:", GUILayout.Width(mbARP.windowDebug.intTest1));Display As ddlDisplayValueAs.SetListBoxOffset(vectMonTypeOffset - ScrollPosition); ddlDisplayValueAs.DrawButton(); GUILayout.Space(4); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Monitoring Levels:",Styles.styleStageTextHead, GUILayout.Width(151)); + GUILayout.Label($"{MONITORLV}:",Styles.styleStageTextHead, GUILayout.Width(151)); // Monitoring Levels //GUILayout.Label("Monitoring Type:", GUILayout.Width(mbARP.windowDebug.intTest1)); ddlMonType.SetListBoxOffset(vectMonTypeOffset - ScrollPosition); ddlMonType.DrawButton(); @@ -264,13 +298,13 @@ internal override void DrawWindow(int id) GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Warning Level:",GUILayout.Width(90)); + GUILayout.Label($"{WARNINGLV}:",GUILayout.Width(90)); // Warning Level settings.Resources[item.id].MonitorWarningLevel = (Int32)Math.Round(GUILayout.HorizontalSlider(settings.Resources[item.id].MonitorWarningLevel, 0, 100,GUILayout.Width(220))); GUILayout.Label(settings.Resources[item.id].MonitorWarningLevel.ToString() + "%",GUILayout.Width(35)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Alert Level:", GUILayout.Width(90)); + GUILayout.Label($"{ALERTLV}:", GUILayout.Width(90)); // Alert Level settings.Resources[item.id].MonitorAlertLevel = (Int32)Math.Round(GUILayout.HorizontalSlider(settings.Resources[item.id].MonitorAlertLevel, 0, 100, GUILayout.Width(220))); GUILayout.Label(settings.Resources[item.id].MonitorAlertLevel.ToString() + "%", GUILayout.Width(35)); GUILayout.EndHorizontal(); @@ -286,28 +320,28 @@ internal override void DrawWindow(int id) GUIStyle temp = new GUIStyle(Styles.styleStageTextHead); temp.padding.top = 0; GUILayout.BeginHorizontal(); - GUILayout.Label("Alarms for this:", temp, GUILayout.Width(120)); - DrawToggle(ref settings.Resources[item.id].AlarmEnabled, "Alarm Enabled", Styles.styleToggle); + GUILayout.Label($"{ALARMSFORTHIS}:", temp, GUILayout.Width(120)); // Alarms for this + DrawToggle(ref settings.Resources[item.id].AlarmEnabled, ALARMENABLE, Styles.styleToggle); // "Alarm Enabled" GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Empty Behaviour:", temp, GUILayout.Width(120)); - DrawToggle(ref settings.Resources[item.id].HideWhenEmpty, "Hide When Empty", Styles.styleToggle); + GUILayout.Label($"{EMPTYBEHAV}:", temp, GUILayout.Width(120)); // Empty Behaviour + DrawToggle(ref settings.Resources[item.id].HideWhenEmpty, HIDEEMPTY, Styles.styleToggle); // "Hide When Empty" GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Full Behaviour:", temp, GUILayout.Width(120)); - DrawToggle(ref settings.Resources[item.id].HideWhenFull, "Hide When Full", Styles.styleToggle); + GUILayout.Label($"{FULLBEHAV}:", temp, GUILayout.Width(120)); // Full Behaviour + DrawToggle(ref settings.Resources[item.id].HideWhenFull, HIDEFULL, Styles.styleToggle); // "Hide When Full" GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Stage Bars:", temp, GUILayout.Width(120)); - DrawToggle(ref settings.Resources[item.id].SplitLastStage, "Split Enabled", Styles.styleToggle); + GUILayout.Label($"{STAGEBAR}:", temp, GUILayout.Width(120)); // Stage Bars + DrawToggle(ref settings.Resources[item.id].SplitLastStage, SPLITENABLE, Styles.styleToggle); // "Split Enabled" GUILayout.EndHorizontal(); if (settings.Resources[item.id].SplitLastStage && ( PartResourceLibrary.Instance.resourceDefinitions[item.id].resourceFlowMode == ResourceFlowMode.ALL_VESSEL || PartResourceLibrary.Instance.resourceDefinitions[item.id].resourceFlowMode == ResourceFlowMode.STAGE_PRIORITY_FLOW) ) { GUILayout.BeginHorizontal(); - GUILayout.Label("Split Behaviour:", temp, GUILayout.Width(120)); - DrawToggle(ref settings.Resources[item.id].ShowReserveLevels, new GUIContent("Show Reserve Levels","instead of Whole Vessel/Last Stage split"), Styles.styleToggle); + GUILayout.Label($"{SPLITBEHAV}:", temp, GUILayout.Width(120)); // Split Behaviour + DrawToggle(ref settings.Resources[item.id].ShowReserveLevels, new GUIContent(SHOWRESERVELV, INSTEADWHOLE), Styles.styleToggle); // "Show Reserve Levels""instead of Whole Vessel/Last Stage split" GUILayout.EndHorizontal(); } GUILayout.Space(3); @@ -329,16 +363,16 @@ internal override void DrawWindow(int id) } GUILayout.BeginHorizontal(); - if (DrawButton("Add Separator")) + if (DrawButton(ADDSEPARATOR)) // "Add Separator" { AddSeparatorAtEnd(); } - if (DrawButton("Sort Groups")) + if (DrawButton(SORTGROUP)) // "Sort Groups" { SortGroups(); } - if (DrawButton("Save")) + if (DrawButton(SAVE)) // "Save" { settings.Save(); } @@ -384,7 +418,7 @@ private void AddSeparatorAtEnd() } if (SepAttempts > 100) { - ScreenMessages.PostScreenMessage("Unable to find a new Separator ID", 3, ScreenMessageStyle.UPPER_RIGHT); + ScreenMessages.PostScreenMessage(UNABLETOFIND, 3, ScreenMessageStyle.UPPER_RIGHT); // "Unable to find a new Separator ID" } settings.Resources.Add(SepID, new ResourceSettings() { id = SepID, IsSeparator = true }); } @@ -415,7 +449,7 @@ void IconMouseEvents() else { resourceOver = null; iconOver = null; } //did we click on an Icon with mouse button 0 - if (Event.current.type == EventType.mouseDown && + if (Event.current.type == EventType.MouseDown && Event.current.button==0 && iconOver!=null) { LogFormatted_DebugOnly("Drag Start"); @@ -425,7 +459,7 @@ void IconMouseEvents() DropWillReorderList = false; } //did we release the mouse - if (Event.current.type == EventType.mouseUp && + if (Event.current.type == EventType.MouseUp && Event.current.button == 0) { if (resourceOver != null) @@ -455,7 +489,7 @@ internal override void OnGUIEvery() base.OnGUIEvery(); //disable resource dragging if we mouseup outside the window - if (Event.current.type == EventType.mouseUp && + if (Event.current.type == EventType.MouseUp && Event.current.button == 0 && !this.WindowRect.Contains(new Vector2(Input.mousePosition.x,Screen.height-Input.mousePosition.y))) { @@ -472,8 +506,8 @@ internal override void OnGUIEvery() styleResMove.alignment = TextAnchor.MiddleLeft; //set and draw the text like a tooltip - String Message = " Moving"; - if (resourceDrag.name == "Separator") Message += " Separator"; + String Message = " " + MOVING; // Moving + if (resourceDrag.name == "Separator") Message += " " + SEPARATOR; // Separator Rect LabelPos = new Rect(Input.mousePosition.x-5,Screen.height-Input.mousePosition.y-9,120,22); GUI.Label(LabelPos, Message, SkinsLibrary.CurrentTooltip); diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg index 2f178f3..74cf582 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -29,245 +29,245 @@ Localization #ARP_LOC_023 = Show Settings... #ARP_LOC_024 = Hide Settings #ARP_LOC_025 = Updated Version Available - #ARP_LOC_026 = - #ARP_LOC_027 = - #ARP_LOC_028 = - #ARP_LOC_029 = - #ARP_LOC_030 = - - #ARP_LOC_031 = - #ARP_LOC_032 = - #ARP_LOC_033 = - #ARP_LOC_034 = - #ARP_LOC_035 = - #ARP_LOC_036 = - #ARP_LOC_037 = - #ARP_LOC_038 = - #ARP_LOC_039 = - #ARP_LOC_040 = - - #ARP_LOC_041 = - #ARP_LOC_042 = - #ARP_LOC_043 = - #ARP_LOC_044 = - #ARP_LOC_045 = - #ARP_LOC_046 = - #ARP_LOC_047 = - #ARP_LOC_048 = - #ARP_LOC_049 = - #ARP_LOC_050 = - - #ARP_LOC_051 = - #ARP_LOC_052 = - #ARP_LOC_053 = - #ARP_LOC_054 = - #ARP_LOC_055 = - #ARP_LOC_056 = - #ARP_LOC_057 = - #ARP_LOC_058 = - #ARP_LOC_059 = - #ARP_LOC_060 = - - #ARP_LOC_061 = - #ARP_LOC_062 = - #ARP_LOC_063 = - #ARP_LOC_064 = - #ARP_LOC_065 = - #ARP_LOC_066 = - #ARP_LOC_067 = - #ARP_LOC_068 = - #ARP_LOC_069 = - #ARP_LOC_070 = - #ARP_LOC_071 = - #ARP_LOC_072 = - #ARP_LOC_073 = - #ARP_LOC_074 = - #ARP_LOC_075 = - #ARP_LOC_076 = - #ARP_LOC_077 = - #ARP_LOC_078 = - #ARP_LOC_079 = - #ARP_LOC_080 = - #ARP_LOC_081 = - #ARP_LOC_082 = - #ARP_LOC_083 = - #ARP_LOC_084 = - #ARP_LOC_085 = - #ARP_LOC_086 = - #ARP_LOC_087 = - #ARP_LOC_088 = - #ARP_LOC_089 = - #ARP_LOC_090 = - #ARP_LOC_091 = - #ARP_LOC_092 = - #ARP_LOC_093 = - #ARP_LOC_094 = - #ARP_LOC_095 = - #ARP_LOC_096 = - #ARP_LOC_097 = - #ARP_LOC_098 = - #ARP_LOC_099 = - #ARP_LOC_100 = - #ARP_LOC_101 = - #ARP_LOC_102 = - #ARP_LOC_103 = - #ARP_LOC_104 = - #ARP_LOC_105 = - #ARP_LOC_106 = - #ARP_LOC_107 = - #ARP_LOC_108 = - #ARP_LOC_109 = - #ARP_LOC_110 = - #ARP_LOC_111 = - #ARP_LOC_112 = - #ARP_LOC_113 = - #ARP_LOC_114 = - #ARP_LOC_115 = - #ARP_LOC_116 = - #ARP_LOC_117 = - #ARP_LOC_118 = - #ARP_LOC_119 = - #ARP_LOC_120 = - #ARP_LOC_121 = - #ARP_LOC_122 = - #ARP_LOC_123 = - #ARP_LOC_124 = - #ARP_LOC_125 = - #ARP_LOC_126 = - #ARP_LOC_127 = - #ARP_LOC_128 = - #ARP_LOC_129 = - #ARP_LOC_130 = - #ARP_LOC_131 = - #ARP_LOC_132 = - #ARP_LOC_133 = - #ARP_LOC_134 = - #ARP_LOC_135 = - #ARP_LOC_136 = - #ARP_LOC_137 = - #ARP_LOC_138 = - #ARP_LOC_139 = - #ARP_LOC_140 = - #ARP_LOC_141 = - #ARP_LOC_142 = - #ARP_LOC_143 = - #ARP_LOC_144 = - #ARP_LOC_145 = - #ARP_LOC_146 = - #ARP_LOC_147 = - #ARP_LOC_148 = - #ARP_LOC_149 = - #ARP_LOC_150 = - #ARP_LOC_151 = - #ARP_LOC_152 = - #ARP_LOC_153 = - #ARP_LOC_154 = - #ARP_LOC_155 = - #ARP_LOC_156 = - #ARP_LOC_157 = - #ARP_LOC_158 = - #ARP_LOC_159 = - #ARP_LOC_160 = - #ARP_LOC_161 = - #ARP_LOC_162 = - #ARP_LOC_163 = - #ARP_LOC_164 = - #ARP_LOC_165 = - #ARP_LOC_166 = - #ARP_LOC_167 = - #ARP_LOC_168 = - #ARP_LOC_169 = - #ARP_LOC_170 = - #ARP_LOC_171 = - #ARP_LOC_172 = - #ARP_LOC_173 = - #ARP_LOC_174 = - #ARP_LOC_175 = - #ARP_LOC_176 = - #ARP_LOC_177 = - #ARP_LOC_178 = - #ARP_LOC_179 = - #ARP_LOC_180 = - #ARP_LOC_181 = - #ARP_LOC_182 = - #ARP_LOC_183 = - #ARP_LOC_184 = - #ARP_LOC_185 = - #ARP_LOC_186 = - #ARP_LOC_187 = - #ARP_LOC_188 = - #ARP_LOC_189 = - #ARP_LOC_190 = - #ARP_LOC_191 = - #ARP_LOC_192 = - #ARP_LOC_193 = - #ARP_LOC_194 = - #ARP_LOC_195 = - #ARP_LOC_196 = - #ARP_LOC_197 = - #ARP_LOC_198 = - #ARP_LOC_199 = - #ARP_LOC_200 = - #ARP_LOC_201 = - #ARP_LOC_202 = - #ARP_LOC_203 = - #ARP_LOC_204 = - #ARP_LOC_205 = - #ARP_LOC_206 = - #ARP_LOC_207 = - #ARP_LOC_208 = - #ARP_LOC_209 = - #ARP_LOC_210 = - #ARP_LOC_211 = - #ARP_LOC_212 = - #ARP_LOC_213 = - #ARP_LOC_214 = - #ARP_LOC_215 = - #ARP_LOC_216 = - #ARP_LOC_217 = - #ARP_LOC_218 = - #ARP_LOC_219 = - #ARP_LOC_220 = - #ARP_LOC_221 = - #ARP_LOC_222 = - #ARP_LOC_223 = - #ARP_LOC_224 = - #ARP_LOC_225 = - #ARP_LOC_226 = - #ARP_LOC_227 = - #ARP_LOC_228 = - #ARP_LOC_229 = - #ARP_LOC_230 = - #ARP_LOC_231 = - #ARP_LOC_232 = - #ARP_LOC_233 = - #ARP_LOC_234 = - #ARP_LOC_235 = - #ARP_LOC_236 = - #ARP_LOC_237 = - #ARP_LOC_238 = - #ARP_LOC_239 = - #ARP_LOC_240 = - #ARP_LOC_241 = - #ARP_LOC_242 = - #ARP_LOC_243 = - #ARP_LOC_244 = - #ARP_LOC_245 = - #ARP_LOC_246 = - #ARP_LOC_247 = - #ARP_LOC_248 = - #ARP_LOC_249 = - #ARP_LOC_250 = - #ARP_LOC_251 = - #ARP_LOC_252 = - #ARP_LOC_253 = - #ARP_LOC_254 = - #ARP_LOC_255 = - #ARP_LOC_256 = - #ARP_LOC_257 = - #ARP_LOC_258 = - #ARP_LOC_259 = - #ARP_LOC_260 = + #ARP_LOC_026 = Configure Resources + #ARP_LOC_027 = Close + #ARP_LOC_028 = Icon + #ARP_LOC_029 = Name + #ARP_LOC_030 = Position + + #ARP_LOC_031 = Visibility + #ARP_LOC_032 = Monitor + #ARP_LOC_033 = Add Separator + #ARP_LOC_034 = Move Up + #ARP_LOC_035 = Move to Top + #ARP_LOC_036 = Move to Bottom + #ARP_LOC_037 = Delete + #ARP_LOC_038 = Display As + #ARP_LOC_039 = Monitoring Levels + #ARP_LOC_040 = Warning Level + + #ARP_LOC_041 = Alert Level + #ARP_LOC_042 = Alarms for this + #ARP_LOC_043 = Alarm Enabled + #ARP_LOC_044 = Empty Behaviour + #ARP_LOC_045 = Hide When Empty + #ARP_LOC_046 = Full Behaviour + #ARP_LOC_047 = Hide When Full + #ARP_LOC_048 = Stage Bars + #ARP_LOC_049 = Split Enabled + #ARP_LOC_050 = Split Behaviour + + #ARP_LOC_051 = Show Reserve Levels + #ARP_LOC_052 = instead of Whole Vessel/Last Stage split + #ARP_LOC_053 = Sort Groups + #ARP_LOC_054 = Save + #ARP_LOC_055 = Unable to find a new Separator ID + #ARP_LOC_056 = Moving + #ARP_LOC_057 = Separator + #ARP_LOC_058 = + #ARP_LOC_059 = + #ARP_LOC_060 = + + #ARP_LOC_061 = + #ARP_LOC_062 = + #ARP_LOC_063 = + #ARP_LOC_064 = + #ARP_LOC_065 = + #ARP_LOC_066 = + #ARP_LOC_067 = + #ARP_LOC_068 = + #ARP_LOC_069 = + #ARP_LOC_070 = + #ARP_LOC_071 = + #ARP_LOC_072 = + #ARP_LOC_073 = + #ARP_LOC_074 = + #ARP_LOC_075 = + #ARP_LOC_076 = + #ARP_LOC_077 = + #ARP_LOC_078 = + #ARP_LOC_079 = + #ARP_LOC_080 = + #ARP_LOC_081 = + #ARP_LOC_082 = + #ARP_LOC_083 = + #ARP_LOC_084 = + #ARP_LOC_085 = + #ARP_LOC_086 = + #ARP_LOC_087 = + #ARP_LOC_088 = + #ARP_LOC_089 = + #ARP_LOC_090 = + #ARP_LOC_091 = + #ARP_LOC_092 = + #ARP_LOC_093 = + #ARP_LOC_094 = + #ARP_LOC_095 = + #ARP_LOC_096 = + #ARP_LOC_097 = + #ARP_LOC_098 = + #ARP_LOC_099 = + #ARP_LOC_100 = + #ARP_LOC_101 = + #ARP_LOC_102 = + #ARP_LOC_103 = + #ARP_LOC_104 = + #ARP_LOC_105 = + #ARP_LOC_106 = + #ARP_LOC_107 = + #ARP_LOC_108 = + #ARP_LOC_109 = + #ARP_LOC_110 = + #ARP_LOC_111 = + #ARP_LOC_112 = + #ARP_LOC_113 = + #ARP_LOC_114 = + #ARP_LOC_115 = + #ARP_LOC_116 = + #ARP_LOC_117 = + #ARP_LOC_118 = + #ARP_LOC_119 = + #ARP_LOC_120 = + #ARP_LOC_121 = + #ARP_LOC_122 = + #ARP_LOC_123 = + #ARP_LOC_124 = + #ARP_LOC_125 = + #ARP_LOC_126 = + #ARP_LOC_127 = + #ARP_LOC_128 = + #ARP_LOC_129 = + #ARP_LOC_130 = + #ARP_LOC_131 = + #ARP_LOC_132 = + #ARP_LOC_133 = + #ARP_LOC_134 = + #ARP_LOC_135 = + #ARP_LOC_136 = + #ARP_LOC_137 = + #ARP_LOC_138 = + #ARP_LOC_139 = + #ARP_LOC_140 = + #ARP_LOC_141 = + #ARP_LOC_142 = + #ARP_LOC_143 = + #ARP_LOC_144 = + #ARP_LOC_145 = + #ARP_LOC_146 = + #ARP_LOC_147 = + #ARP_LOC_148 = + #ARP_LOC_149 = + #ARP_LOC_150 = + #ARP_LOC_151 = + #ARP_LOC_152 = + #ARP_LOC_153 = + #ARP_LOC_154 = + #ARP_LOC_155 = + #ARP_LOC_156 = + #ARP_LOC_157 = + #ARP_LOC_158 = + #ARP_LOC_159 = + #ARP_LOC_160 = + #ARP_LOC_161 = + #ARP_LOC_162 = + #ARP_LOC_163 = + #ARP_LOC_164 = + #ARP_LOC_165 = + #ARP_LOC_166 = + #ARP_LOC_167 = + #ARP_LOC_168 = + #ARP_LOC_169 = + #ARP_LOC_170 = + #ARP_LOC_171 = + #ARP_LOC_172 = + #ARP_LOC_173 = + #ARP_LOC_174 = + #ARP_LOC_175 = + #ARP_LOC_176 = + #ARP_LOC_177 = + #ARP_LOC_178 = + #ARP_LOC_179 = + #ARP_LOC_180 = + #ARP_LOC_181 = + #ARP_LOC_182 = + #ARP_LOC_183 = + #ARP_LOC_184 = + #ARP_LOC_185 = + #ARP_LOC_186 = + #ARP_LOC_187 = + #ARP_LOC_188 = + #ARP_LOC_189 = + #ARP_LOC_190 = + #ARP_LOC_191 = + #ARP_LOC_192 = + #ARP_LOC_193 = + #ARP_LOC_194 = + #ARP_LOC_195 = + #ARP_LOC_196 = + #ARP_LOC_197 = + #ARP_LOC_198 = + #ARP_LOC_199 = + #ARP_LOC_200 = + #ARP_LOC_201 = + #ARP_LOC_202 = + #ARP_LOC_203 = + #ARP_LOC_204 = + #ARP_LOC_205 = + #ARP_LOC_206 = + #ARP_LOC_207 = + #ARP_LOC_208 = + #ARP_LOC_209 = + #ARP_LOC_210 = + #ARP_LOC_211 = + #ARP_LOC_212 = + #ARP_LOC_213 = + #ARP_LOC_214 = + #ARP_LOC_215 = + #ARP_LOC_216 = + #ARP_LOC_217 = + #ARP_LOC_218 = + #ARP_LOC_219 = + #ARP_LOC_220 = + #ARP_LOC_221 = + #ARP_LOC_222 = + #ARP_LOC_223 = + #ARP_LOC_224 = + #ARP_LOC_225 = + #ARP_LOC_226 = + #ARP_LOC_227 = + #ARP_LOC_228 = + #ARP_LOC_229 = + #ARP_LOC_230 = + #ARP_LOC_231 = + #ARP_LOC_232 = + #ARP_LOC_233 = + #ARP_LOC_234 = + #ARP_LOC_235 = + #ARP_LOC_236 = + #ARP_LOC_237 = + #ARP_LOC_238 = + #ARP_LOC_239 = + #ARP_LOC_240 = + #ARP_LOC_241 = + #ARP_LOC_242 = + #ARP_LOC_243 = + #ARP_LOC_244 = + #ARP_LOC_245 = + #ARP_LOC_246 = + #ARP_LOC_247 = + #ARP_LOC_248 = + #ARP_LOC_249 = + #ARP_LOC_250 = + #ARP_LOC_251 = + #ARP_LOC_252 = + #ARP_LOC_253 = + #ARP_LOC_254 = + #ARP_LOC_255 = + #ARP_LOC_256 = + #ARP_LOC_257 = + #ARP_LOC_258 = + #ARP_LOC_259 = + #ARP_LOC_260 = From 8497f3b8732d162d7dd98fec574371b59192b6b6 Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 12:33:32 +0800 Subject: [PATCH 05/18] Resource label Localized get the resource's displayName from RESOURCE_DEFINITION --- .../ARPWindowResourceConfig.cs | 2 +- AlternateResourcePanel/SharedStuff/Drawing.cs | 67 ++++++++++--------- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/AlternateResourcePanel/ARPWindowResourceConfig.cs b/AlternateResourcePanel/ARPWindowResourceConfig.cs index ebcb700..0b5ae65 100644 --- a/AlternateResourcePanel/ARPWindowResourceConfig.cs +++ b/AlternateResourcePanel/ARPWindowResourceConfig.cs @@ -169,7 +169,7 @@ internal override void DrawWindow(int id) } GUILayout.EndVertical(); //GUILayout.Label(item.name, GUILayout.Width(NameWidth)); - if (GUILayout.Button(item.name, SkinsLibrary.CurrentSkin.label, GUILayout.Width(NameWidth))) { + if (GUILayout.Button(PartResourceLibrary.Instance.GetDefinition(item.name).displayName, SkinsLibrary.CurrentSkin.label, GUILayout.Width(NameWidth))) { if (ResourceToShowAlarmChanger == item.id) ResourceToShowAlarmChanger = 0; else diff --git a/AlternateResourcePanel/SharedStuff/Drawing.cs b/AlternateResourcePanel/SharedStuff/Drawing.cs index 1f661ac..247f04f 100644 --- a/AlternateResourcePanel/SharedStuff/Drawing.cs +++ b/AlternateResourcePanel/SharedStuff/Drawing.cs @@ -267,39 +267,40 @@ internal static void DrawTimeRemaining(Rect rectStart, ARPResource Res) internal static String FormatTime(Double TimeInSecs) { - String strReturn = ""; - - Double Second = TimeInSecs % 60; - Double Minute = Math.Truncate((TimeInSecs / 60) % 60); - Double HourRaw = TimeInSecs / 60 / 60; - - Double Hour; - if (GameSettings.KERBIN_TIME) - Hour = Math.Truncate(HourRaw % 6); - else - Hour = Math.Truncate(HourRaw % 24); - - Double Day; - if (GameSettings.KERBIN_TIME) - Day = Math.Truncate((HourRaw % (426 * 6)) / 6); - else - Day = Math.Truncate((HourRaw % (365 * 24)) / 24); - - Double Year; - if (GameSettings.KERBIN_TIME) - Year = Math.Truncate((HourRaw / (426 * 6))); - else - Year = Math.Truncate((HourRaw / (365 * 24))); - - if (Year > 0) - strReturn = String.Format("{0:0}y {1:0}d {2:00}:{3:00}:{4:00}", Year, Day, Hour, Minute, Second); - else if (Day > 0) - strReturn = String.Format("{0:0}d {1:00}:{2:00}:{3:00}", Day, Hour, Minute, Second); - else if (Hour > 0) - strReturn = String.Format("{1:0}:{2:00}:{3:00}", Day, Hour, Minute, Second); - else - strReturn = String.Format("{2:0}:{3:00.0}", Day, Hour, Minute, Second); - return strReturn; + return KSPUtil.dateTimeFormatter.PrintDateDeltaCompact(TimeInSecs, true, true, true); + //String strReturn = ""; + + //Double Second = TimeInSecs % 60; + //Double Minute = Math.Truncate((TimeInSecs / 60) % 60); + //Double HourRaw = TimeInSecs / 60 / 60; + + //Double Hour; + //if (GameSettings.KERBIN_TIME) + // Hour = Math.Truncate(HourRaw % 6); + //else + // Hour = Math.Truncate(HourRaw % 24); + + //Double Day; + //if (GameSettings.KERBIN_TIME) + // Day = Math.Truncate((HourRaw % (426 * 6)) / 6); + //else + // Day = Math.Truncate((HourRaw % (365 * 24)) / 24); + + //Double Year; + //if (GameSettings.KERBIN_TIME) + // Year = Math.Truncate((HourRaw / (426 * 6))); + //else + // Year = Math.Truncate((HourRaw / (365 * 24))); + + //if (Year > 0) + // strReturn = String.Format("{0:0}y {1:0}d {2:00}:{3:00}:{4:00}", Year, Day, Hour, Minute, Second); + //else if (Day > 0) + // strReturn = String.Format("{0:0}d {1:00}:{2:00}:{3:00}", Day, Hour, Minute, Second); + //else if (Hour > 0) + // strReturn = String.Format("{1:0}:{2:00}:{3:00}", Day, Hour, Minute, Second); + //else + // strReturn = String.Format("{2:0}:{3:00.0}", Day, Hour, Minute, Second); + //return strReturn; } From d309bd38b49947d1236d852e895259ab688145cb Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 12:51:12 +0800 Subject: [PATCH 06/18] Update ARPWindowResourceConfig.cs --- AlternateResourcePanel/ARPWindowResourceConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlternateResourcePanel/ARPWindowResourceConfig.cs b/AlternateResourcePanel/ARPWindowResourceConfig.cs index 0b5ae65..4e66948 100644 --- a/AlternateResourcePanel/ARPWindowResourceConfig.cs +++ b/AlternateResourcePanel/ARPWindowResourceConfig.cs @@ -115,7 +115,7 @@ internal override void DrawWindow(int id) GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(2); - GUILayout.Label(ICON, Styles.styleStageTextHead,GUILayout.Width(32)); // "Icon" + GUILayout.Label(ICON, Styles.styleStageTextHead, GUILayout.Width(32)); // "Icon" GUILayout.Label(NAME, Styles.styleStageTextHead, GUILayout.Width(120)); // "Name" GUILayout.Label(POSITION, Styles.styleStageTextHead, GUILayout.Width(56)); // "Position" GUILayout.Space(6); From a070569203fbc9194e3ffe75bcb686017c3b8f90 Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 17:30:35 +0800 Subject: [PATCH 07/18] 5 --- AlternateResourcePanel/ARPWindowSettings.cs | 221 ++++++++++++------ .../Localization/en-us.cfg | 161 +++++++------ 2 files changed, 230 insertions(+), 152 deletions(-) diff --git a/AlternateResourcePanel/ARPWindowSettings.cs b/AlternateResourcePanel/ARPWindowSettings.cs index 7980da7..2fd60c4 100644 --- a/AlternateResourcePanel/ARPWindowSettings.cs +++ b/AlternateResourcePanel/ARPWindowSettings.cs @@ -7,6 +7,7 @@ using KSP; using UnityEngine; using KSPPluginFramework; +using KSP.Localization; namespace KSPAlternateResourcePanel { @@ -21,22 +22,92 @@ class ARPWindowSettings : MonoBehaviourWindowPlus private DropDownList ddlSettingsAlarmsWarning; private DropDownList ddlSettingsAlarmsAlert; + // Localization Strings + private static string SETTINGSECTION = Localizer.Format("#ARP_LOC_067"); + private static string RATES = Localizer.Format("#ARP_LOC_068"); + private static string CALCBY = Localizer.Format("#ARP_LOC_069"); + private static string RATESTYLE = Localizer.Format("#ARP_LOC_070"); + private static string SHOWRATECHANGE = Localizer.Format("#ARP_LOC_071"); + private static string SHOWRATEFORPART = Localizer.Format("#ARP_LOC_072"); + private static string REALTIME = Localizer.Format("#ARP_LOC_073"); + private static string STAGEBARS = Localizer.Format("#ARP_LOC_074"); + private static string BARSPOS = Localizer.Format("#ARP_LOC_075"); + private static string ENABLED = Localizer.Format("#ARP_LOC_076"); + private static string SINGLEBAR = Localizer.Format("#ARP_LOC_077"); + private static string ONLEFT = Localizer.Format("#ARP_LOC_078"); + private static string ONRIGHT = Localizer.Format("#ARP_LOC_079"); + private static string RESOURCES = Localizer.Format("#ARP_LOC_080"); + private static string CONFIGRESOURCESETTING = Localizer.Format("#ARP_LOC_081"); + private static string SHOWWINDOWALARM = Localizer.Format("#ARP_LOC_082"); + private static string POPWINDOW = Localizer.Format("#ARP_LOC_083"); + private static string STYLING = Localizer.Format("#ARP_LOC_084"); + private static string BUTTON = Localizer.Format("#ARP_LOC_085"); + private static string NOTINSTALLTOOLBAR = Localizer.Format("#ARP_LOC_086"); + private static string OPENBROWSER = Localizer.Format("#ARP_LOC_087"); + private static string HIDEWHNESHOW = Localizer.Format("#ARP_LOC_088"); + private static string HIDEARP = Localizer.Format("#ARP_LOC_089"); + private static string RESTOREDONCHANGE = Localizer.Format("#ARP_LOC_090"); + private static string ICONSETS = Localizer.Format("#ARP_LOC_091"); + private static string SELECTICONORDER = Localizer.Format("#ARP_LOC_092"); + private static string SEPARATOR = Localizer.Format("#ARP_LOC_093"); + private static string PADDING = Localizer.Format("#ARP_LOC_094"); + private static string EMPTIES = Localizer.Format("#ARP_LOC_095"); + private static string HIDEEMPTYRES = Localizer.Format("#ARP_LOC_096"); + private static string HIDEFULLRES = Localizer.Format("#ARP_LOC_097"); + private static string AFTER = Localizer.Format("#ARP_LOC_098"); + private static string SECS = Localizer.Format("#ARP_LOC_099"); + private static string VISUALS = Localizer.Format("#ARP_LOC_100"); + private static string DISABLEHOVER = Localizer.Format("#ARP_LOC_101"); + private static string LOCKPOS = Localizer.Format("#ARP_LOC_102"); + private static string SAVEPOS = Localizer.Format("#ARP_LOC_103"); + private static string RESETPOS = Localizer.Format("#ARP_LOC_104"); + private static string ALARMS = Localizer.Format("#ARP_LOC_105"); + private static string VOLUME = Localizer.Format("#ARP_LOC_106"); + private static string LEVEL = Localizer.Format("#ARP_LOC_107"); + private static string ENABLEALARMS = Localizer.Format("#ARP_LOC_108"); + private static string USEKSPUIVOLUME = Localizer.Format("#ARP_LOC_109"); + private static string SOUNDS = Localizer.Format("#ARP_LOC_110"); + private static string WARNING = Localizer.Format("#ARP_LOC_111"); + private static string REPEAT = Localizer.Format("#ARP_LOC_112"); + private static string ALERT = Localizer.Format("#ARP_LOC_113"); + private static string STAGING = Localizer.Format("#ARP_LOC_114"); + private static string AUTO = Localizer.Format("#ARP_LOC_115"); + private static string DELAY = Localizer.Format("#ARP_LOC_116"); + private static string AUTOSTAGING = Localizer.Format("#ARP_LOC_117"); + private static string VERSIONCHECK = Localizer.Format("#ARP_LOC_118"); + private static string DAILYCHECK = Localizer.Format("#ARP_LOC_119"); + private static string NOWCHECK = Localizer.Format("#ARP_LOC_120"); + private static string LASTCHECK = Localizer.Format("#ARP_LOC_121"); + private static string CURVERSION = Localizer.Format("#ARP_LOC_122"); + private static string LASTVERSION = Localizer.Format("#ARP_LOC_123"); + private static string CHECKING = Localizer.Format("#ARP_LOC_124"); + private static string UPDATEDAVAILABLE = Localizer.Format("#ARP_LOC_125"); + private static string DOCUMENT = Localizer.Format("#ARP_LOC_126"); + private static string SOURCECODE = Localizer.Format("#ARP_LOC_127"); + private static string FORUMPAGE = Localizer.Format("#ARP_LOC_128"); + private static string CLICKHERE = Localizer.Format("#ARP_LOC_129"); + private static string TESTSOUND = Localizer.Format("#ARP_LOC_130"); + private static string STOPPLAYSOUND = Localizer.Format("#ARP_LOC_131"); + private static string STAGINGENABLED = Localizer.Format("#ARP_LOC_132"); + private static string MAPVIEWSTAGING = Localizer.Format("#ARP_LOC_133"); + private static string MAPVIEWSPACEBAR = Localizer.Format("#ARP_LOC_134"); + internal enum SettingsTabs { - [Description("General Properties")] General, - [Description("Styling/Visuals")] Styling, - [Description("Alarm Properties")] Alarms, - [Description("Staging Controls")] Staging, - [Description("About...")] About, + [Description("#ARP_LOC_058")] General, // General Properties + [Description("#ARP_LOC_059")] Styling, // Styling/Visuals + [Description("#ARP_LOC_060")] Alarms, // Alarm Properties + [Description("#ARP_LOC_061")] Staging, // Staging Controls + [Description("#ARP_LOC_062")] About, // About... } internal enum ButtonStyleEnum { - [Description("Basic button")] Basic, - [Description("Common Toolbar (by Blizzy78)")] Toolbar, - [Description("KSP App Launcher Button")] Launcher, - [Description("Replace Stock Resources App")] StockReplace, + [Description("#ARP_LOC_063")] Basic, // Basic button + [Description("#ARP_LOC_064")] Toolbar, // Common Toolbar (by Blizzy78) + [Description("#ARP_LOC_065")] Launcher, // KSP App Launcher Button + [Description("#ARP_LOC_066")] StockReplace, // Replace Stock Resources App } private DropDownList ddlSettingsButtonStyle; @@ -177,7 +248,7 @@ internal override void DrawWindow(int id) GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); - GUILayout.Label("Settings Section", Styles.styleStageTextHead,GUILayout.Width(140)); + GUILayout.Label(SETTINGSECTION, Styles.styleStageTextHead,GUILayout.Width(140)); // "Settings Section" GUILayout.Space(5); ddlSettingsTab.DrawButton(); GUILayout.Space(4); @@ -221,18 +292,18 @@ private void DrawWindow_General() GUILayout.BeginHorizontal(Styles.styleSettingsArea, GUILayout.Width(SettingsAreaWidth)); GUILayout.BeginVertical(GUILayout.Width(60)); GUILayout.Space(2); - GUILayout.Label("Rates:", Styles.styleStageTextHead); + GUILayout.Label($"{RATES}:", Styles.styleStageTextHead); // Rates GUILayout.Space(13); - GUILayout.Label("Calc By:", Styles.styleStageTextHead); - GUILayout.Label("Rate Style:", Styles.styleStageTextHead); + GUILayout.Label($"{CALCBY}:", Styles.styleStageTextHead); // Calc By + GUILayout.Label($"{RATESTYLE}:", Styles.styleStageTextHead); // Rate Style GUILayout.EndVertical(); GUILayout.BeginVertical(); - if (DrawToggle(ref settings.ShowRates, "Show Rate Change Values", Styles.styleToggle)) + if (DrawToggle(ref settings.ShowRates, SHOWRATECHANGE, Styles.styleToggle)) // "Show Rate Change Values" settings.Save(); //if (DrawToggle(ref settings.ShowRatesTimeRem, "Toggle Time Remaining", Styles.styleToggle)) // settings.Save(); - if (DrawToggle(ref settings.ShowRatesForParts, "Show Rates for Parts", Styles.styleToggle)) + if (DrawToggle(ref settings.ShowRatesForParts, SHOWRATEFORPART, Styles.styleToggle)) // "Show Rates for Parts" { settings.Save(); } @@ -241,7 +312,7 @@ private void DrawWindow_General() if (DrawToggle(ref settings.RatesUseUT, "UT", Styles.styleToggle,GUILayout.Width(60))) settings.Save(); Boolean NotUT = !settings.RatesUseUT; - if (DrawToggle(ref NotUT, "Real Time", Styles.styleToggle)) + if (DrawToggle(ref NotUT, REALTIME, Styles.styleToggle)) // "Real Time" { settings.RatesUseUT=!settings.RatesUseUT; settings.Save(); @@ -256,27 +327,27 @@ private void DrawWindow_General() GUILayout.BeginVertical(GUILayout.Width(60)); GUILayout.Space(2); - GUILayout.Label("Stage Bars:", Styles.styleStageTextHead); + GUILayout.Label($"{STAGEBARS}:", Styles.styleStageTextHead); // Stage Bars if (settings.SplitLastStage) { GUILayout.Space(-6); - GUILayout.Label("Bars Pos:", Styles.styleStageTextHead); + GUILayout.Label($"{BARSPOS}:", Styles.styleStageTextHead); // Bars Pos } GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Space(2); - if (DrawToggle(ref settings.SplitLastStage, new GUIContent("Enabled", "Turn this off to show single green bars and no last stage separation."), Styles.styleToggle)) + if (DrawToggle(ref settings.SplitLastStage, new GUIContent(ENABLED, SINGLEBAR), Styles.styleToggle)) // "Enabled""Turn this off to show single green bars and no last stage separation." settings.Save(); if (settings.SplitLastStage) { GUILayout.BeginHorizontal(); Boolean NotRight = !settings.StageBarOnRight; - if (DrawToggle(ref NotRight, "On Left", Styles.styleToggle, GUILayout.Width(90))) + if (DrawToggle(ref NotRight, ONLEFT, Styles.styleToggle, GUILayout.Width(90))) // "On Left" { settings.StageBarOnRight = !settings.StageBarOnRight; settings.Save(); } - if (DrawToggle(ref settings.StageBarOnRight, "On Right", Styles.styleToggle)) + if (DrawToggle(ref settings.StageBarOnRight, ONRIGHT, Styles.styleToggle)) // "On Right" { settings.Save(); } @@ -289,10 +360,10 @@ private void DrawWindow_General() GUILayout.BeginHorizontal(Styles.styleSettingsArea, GUILayout.Width(SettingsAreaWidth)); GUILayout.BeginVertical(GUILayout.Width(60)); GUILayout.Space(2); - GUILayout.Label("Resources:", Styles.styleStageTextHead); + GUILayout.Label($"{RESOURCES}:", Styles.styleStageTextHead); // Resources GUILayout.EndVertical(); GUILayout.BeginVertical(); - if (DrawButton("Configure Resource Settings")) + if (DrawButton(CONFIGRESOURCESETTING)) // "Configure Resource Settings" { mbARP.windowResourceConfig.Visible = !mbARP.windowResourceConfig.Visible; if (mbARP.windowResourceConfig.Visible) @@ -304,7 +375,7 @@ private void DrawWindow_General() mbARP.windowResourceConfig.WindowRect.x = mbARP.windowMain.WindowRect.x + mbARP.windowMain.WindowRect.width; } } - if (DrawToggle(ref settings.ShowWindowOnResourceMonitor, new GUIContent("Show Window on Alarm", "If an alarm is exceeded then popup the window if it is not already visible. Will hide again when acknowledged."),Styles.styleToggle)) + if (DrawToggle(ref settings.ShowWindowOnResourceMonitor, new GUIContent(SHOWWINDOWALARM, POPWINDOW),Styles.styleToggle)) // "Show Window on Alarm""If an alarm is exceeded then popup the window if it is not already visible. Will hide again when acknowledged." settings.Save(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); @@ -319,8 +390,8 @@ private void DrawWindow_Styling() GUILayout.BeginVertical(GUILayout.Width(60)); GUILayout.Space(2); //to even up the text - GUILayout.Label("Styling:", Styles.styleStageTextHead); - GUILayout.Label("Button:", Styles.styleStageTextHead); + GUILayout.Label($"{STYLING}:", Styles.styleStageTextHead); // Styling + GUILayout.Label($"{BUTTON}:", Styles.styleStageTextHead); // Button GUILayout.EndVertical(); GUILayout.BeginVertical(); @@ -333,7 +404,7 @@ private void DrawWindow_Styling() { if (settings.ButtonStyleChosen == ButtonStyleEnum.Toolbar) { - if (GUILayout.Button(new GUIContent("Not Installed. Click for Toolbar Info", "Click to open your browser and find out more about the Common Toolbar"), Styles.styleTextCenterGreen)) + if (GUILayout.Button(new GUIContent(NOTINSTALLTOOLBAR, OPENBROWSER), Styles.styleTextCenterGreen)) // "Not Installed. Click for Toolbar Info""Click to open your browser and find out more about the Common Toolbar" Application.OpenURL("http://forum.kerbalspaceprogram.com/threads/60863"); intBlizzyToolbarMissingHeight=18; } @@ -351,7 +422,7 @@ private void DrawWindow_Styling() } if (settings.ButtonStyleToDisplay == ButtonStyleEnum.Launcher) { - if (DrawToggle(ref settings.AppLauncherMutuallyExclusive, new GUIContent("Hide when other Apps show", "Hide the ARP when other stock Apps display (like the stock Resource App)"), Styles.styleToggle)) + if (DrawToggle(ref settings.AppLauncherMutuallyExclusive, new GUIContent(HIDEWHNESHOW, HIDEARP), Styles.styleToggle)) // "Hide when other Apps show""Hide the ARP when other stock Apps display (like the stock Resource App)" { mbARP.AppLauncherButtonMutuallyExclusive(settings.AppLauncherMutuallyExclusive); @@ -374,7 +445,7 @@ private void DrawWindow_Styling() if (mbARP.SceneChangeRequiredToRestoreResourcesApp) { GUILayout.Space(-4); - GUILayout.Label("Stock App restored on scene change", Styles.styleTextYellowBold); + GUILayout.Label(RESTOREDONCHANGE, Styles.styleTextYellowBold); // "Stock App restored on scene change" GUILayout.Space(4); } @@ -389,10 +460,10 @@ private void DrawWindow_Styling() //Icons GUILayout.BeginHorizontal(Styles.styleSettingsArea, GUILayout.Width(SettingsAreaWidth)); GUILayout.BeginVertical(GUILayout.Width(60)); - GUILayout.Label(new GUIContent("Iconsets:","Select the order of priority for choosing icons. Highest priority to the left"), Styles.styleStageTextHead); + GUILayout.Label(new GUIContent($"{ICONSETS}:",SELECTICONORDER), Styles.styleStageTextHead); // Iconsets"Select the order of priority for choosing icons. Highest priority to the left" GUILayout.Space(2); - GUILayout.Label(new GUIContent("Separator:","Padding around resource separators"), Styles.styleStageTextHead); - GUILayout.Label("Empties:", Styles.styleStageTextHead); + GUILayout.Label(new GUIContent($"{SEPARATOR}:",PADDING), Styles.styleStageTextHead); // Separator"Padding around resource separators" + GUILayout.Label($"{EMPTIES}:", Styles.styleStageTextHead); // Empties GUILayout.EndVertical(); GUILayout.BeginVertical(); @@ -420,17 +491,17 @@ private void DrawWindow_Styling() GUILayout.Label(String.Format("{0}px",settings.SpacerPadding)); GUILayout.EndHorizontal(); - if (DrawToggle(ref settings.HideEmptyResources, "Hide Empty Resources", Styles.styleToggle)) { + if (DrawToggle(ref settings.HideEmptyResources, HIDEEMPTYRES, Styles.styleToggle)) { // "Hide Empty Resources" settings.Save(); } - if (DrawToggle(ref settings.HideFullResources, "Hide Full Resources", Styles.styleToggle)) { + if (DrawToggle(ref settings.HideFullResources, HIDEFULLRES, Styles.styleToggle)) { // "Hide Full Resources" settings.Save(); } GUILayout.BeginHorizontal(); - GUILayout.Label("After:"); + GUILayout.Label($"{AFTER}:"); // After settings.HideAfter = (Int32)GUILayout.HorizontalSlider(settings.HideAfter, 0, 10, GUILayout.Width(128 + mbARP.windowMain.IconAlarmOffset)); GUILayout.Space(3); - GUILayout.Label(String.Format("{0} secs", settings.HideAfter)); + GUILayout.Label(String.Format("{0} {1}", settings.HideAfter, SECS)); // secs GUILayout.EndHorizontal(); GUILayout.Space(4); GUILayout.EndVertical(); @@ -443,26 +514,26 @@ private void DrawWindow_Styling() //Visuals GUILayout.BeginHorizontal(Styles.styleSettingsArea, GUILayout.Width(SettingsAreaWidth)); GUILayout.BeginVertical(GUILayout.Width(60)); - GUILayout.Label("Visuals:", Styles.styleStageTextHead); + GUILayout.Label($"{VISUALS}:", Styles.styleStageTextHead); // Visuals GUILayout.EndVertical(); GUILayout.BeginVertical(); - if (DrawToggle(ref settings.DisableHover, "Disable Show on Button Hover", Styles.styleToggle)) { + if (DrawToggle(ref settings.DisableHover, DISABLEHOVER, Styles.styleToggle)) { // "Disable Show on Button Hover" settings.Save(); } //if (DrawToggle(ref settings.LockLocation, "Lock Window Position", Styles.styleToggle)) { - if (DrawToggle(ref settings.LockLocation, "Lock Window Position", Styles.styleToggle)) + if (DrawToggle(ref settings.LockLocation, LOCKPOS, Styles.styleToggle)) // "Lock Window Position" { mbARP.windowMain.DragEnabled = !settings.LockLocation; settings.Save(); } GUILayout.BeginHorizontal(); - if (GUILayout.Button("Save Position")) + if (GUILayout.Button(SAVEPOS)) // "Save Position" { settings.WindowPosition = mbARP.windowMain.WindowRect; settings.Save(); } - if (GUILayout.Button("Reset Position")) + if (GUILayout.Button(RESETPOS)) // "Reset Position" mbARP.blnResetWindow = true; GUILayout.EndHorizontal(); GUILayout.EndVertical(); @@ -493,17 +564,17 @@ private void DrawWindow_Alarms() GUILayout.BeginHorizontal(Styles.styleSettingsArea, GUILayout.Width(SettingsAreaWidth)); GUILayout.BeginVertical(GUILayout.Width(70)); GUILayout.Space(2); - GUILayout.Label("Alarms:", Styles.styleStageTextHead); + GUILayout.Label($"{ALARMS}:", Styles.styleStageTextHead); // Alarms GUILayout.Space(-5); - GUILayout.Label("Volume:", Styles.styleStageTextHead); + GUILayout.Label($"{VOLUME}:", Styles.styleStageTextHead); // Volume GUILayout.Space(-3); - GUILayout.Label(" Level:"); + GUILayout.Label($" {LEVEL}:"); // Level GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Space(2); - if (DrawToggle(ref settings.AlarmsEnabled, "Enable Alarms Functionality", Styles.styleToggle)) + if (DrawToggle(ref settings.AlarmsEnabled, ENABLEALARMS, Styles.styleToggle)) // "Enable Alarms Functionality" settings.Save(); - if (DrawToggle(ref settings.AlarmsVolumeFromUI, "Use KSP UI Volume", Styles.styleToggle)) + if (DrawToggle(ref settings.AlarmsVolumeFromUI, USEKSPUIVOLUME, Styles.styleToggle)) // "Use KSP UI Volume" { settings.Save(); } @@ -518,15 +589,15 @@ private void DrawWindow_Alarms() GUILayout.EndVertical(); GUILayout.EndHorizontal(); - GUILayout.Label("Sounds",Styles.styleStageTextHead); + GUILayout.Label(SOUNDS,Styles.styleStageTextHead); // "Sounds" GUILayout.BeginVertical(Styles.styleSettingsArea, GUILayout.Width(SettingsAreaWidth)); GUILayout.BeginHorizontal(); - GUILayout.Label("Warning:", GUILayout.Width(70)); + GUILayout.Label($"{WARNING}:", GUILayout.Width(70)); // Warning ddlSettingsAlarmsWarning.DrawButton(); DrawTestSoundButton(mbARP.clipAlarmsWarning, settings.AlarmsWarningRepeats); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Repeat:", GUILayout.Width(70)); + GUILayout.Label($"{REPEAT}:", GUILayout.Width(70)); // Repeat //settings.AlarmsWarningRepeats = (Int32)GUILayout.HorizontalSlider(settings.AlarmsWarningRepeats, 1, 6, GUILayout.Width(130)); if (DrawHorizontalSlider(ref settings.AlarmsWarningRepeats, 1, 6, GUILayout.Width(130))) settings.Save(); @@ -537,12 +608,12 @@ private void DrawWindow_Alarms() GUILayout.Label("", Styles.styleSeparatorH); GUILayout.BeginHorizontal(); - GUILayout.Label("Alert:", GUILayout.Width(70)); + GUILayout.Label($"{ALERT}:", GUILayout.Width(70)); // Alert ddlSettingsAlarmsAlert.DrawButton(); DrawTestSoundButton(mbARP.clipAlarmsAlert, settings.AlarmsAlertRepeats); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Repeat:", GUILayout.Width(70)); + GUILayout.Label($"{REPEAT}:", GUILayout.Width(70)); // Repeat //settings.AlarmsAlertRepeats = (Int32)GUILayout.HorizontalSlider(settings.AlarmsAlertRepeats, 1, 6, GUILayout.Width(130)); if (DrawHorizontalSlider(ref settings.AlarmsAlertRepeats,1,6, GUILayout.Width(130))) settings.Save(); @@ -556,10 +627,10 @@ private void DrawWindow_Alarms() private void DrawTestSoundButton(AudioClip clip, Int32 Repeats) { Boolean blnStop = false; - GUIContent btn = new GUIContent(Resources.btnPlay, "Test Sound"); + GUIContent btn = new GUIContent(Resources.btnPlay, TESTSOUND); // "Test Sound" if (KSPAlternateResourcePanel.audioController.isClipPlaying(clip)) { - btn = new GUIContent(Resources.btnStop, "StopPlaying"); + btn = new GUIContent(Resources.btnStop, STOPPLAYSOUND); // "StopPlaying" blnStop=true; } if (GUILayout.Button(btn, GUILayout.Width(20))) @@ -576,7 +647,7 @@ private void DrawWindow_Staging() //Staging GUILayout.BeginHorizontal(Styles.styleSettingsArea, GUILayout.Width(SettingsAreaWidth), GUILayout.Height(64));//, GUILayout.Height(84)); GUILayout.BeginVertical(GUILayout.Width(60)); - GUILayout.Label("Staging:", Styles.styleStageTextHead); + GUILayout.Label($"{STAGING}:", Styles.styleStageTextHead); // Staging //if (settings.StagingEnabled) //{ // GUILayout.Space(34); @@ -584,14 +655,14 @@ private void DrawWindow_Staging() //} GUILayout.EndVertical(); GUILayout.BeginVertical(); - if (DrawToggle(ref settings.StagingEnabled, "Staging Enabled", Styles.styleToggle)) + if (DrawToggle(ref settings.StagingEnabled, STAGINGENABLED, Styles.styleToggle)) // "Staging Enabled" settings.Save(); if (settings.StagingEnabled) { - if (DrawToggle(ref settings.StagingEnabledInMapView, "Allow Staging in Mapview", Styles.styleToggle)) + if (DrawToggle(ref settings.StagingEnabledInMapView, MAPVIEWSTAGING, Styles.styleToggle)) // "Allow Staging in Mapview" settings.Save(); if (settings.StagingEnabledInMapView) - if (DrawToggle(ref settings.StagingEnabledSpaceInMapView, "Allow Space Bar in Mapview", Styles.styleToggle) ) + if (DrawToggle(ref settings.StagingEnabledSpaceInMapView, MAPVIEWSPACEBAR, Styles.styleToggle) ) // "Allow Space Bar in Mapview" settings.Save(); //if (DrawToggle(ref settings.StagingIgnoreStageLock, "Ignore Keyboard Stage Lock", Styles.styleToggle)) // settings.Save(); @@ -604,15 +675,15 @@ private void DrawWindow_Staging() { GUILayout.BeginHorizontal(Styles.styleSettingsArea, GUILayout.Width(SettingsAreaWidth), GUILayout.Height(50)); GUILayout.BeginVertical(GUILayout.Width(60)); - GUILayout.Label("Auto:", Styles.styleStageTextHead); + GUILayout.Label($"{AUTO}:", Styles.styleStageTextHead); // Auto if (settings.AutoStagingEnabled) { GUILayout.Space(-2); - GUILayout.Label("Delay:", Styles.styleStageTextHead.PaddingChangeBottom(-5)); + GUILayout.Label($"{DELAY}:", Styles.styleStageTextHead.PaddingChangeBottom(-5)); // Delay } GUILayout.EndVertical(); GUILayout.BeginVertical(); - if (DrawToggle(ref settings.AutoStagingEnabled, "Auto Staging Enabled", Styles.styleToggle)) + if (DrawToggle(ref settings.AutoStagingEnabled, AUTOSTAGING, Styles.styleToggle)) // "Auto Staging Enabled" settings.Save(); if (settings.AutoStagingEnabled) { @@ -623,7 +694,7 @@ private void DrawWindow_Staging() settings.AutoStagingDelayInTenths = (Int32)(AutoStagingDelay * 10); settings.Save(); } - GUILayout.Label(String.Format("{0:0.0} sec", AutoStagingDelay), GUILayout.Width(50)); + GUILayout.Label(String.Format("{0:0.0} {1}", AutoStagingDelay, SECS), GUILayout.Width(50)); // sec GUILayout.EndHorizontal(); } GUILayout.EndVertical(); @@ -635,17 +706,17 @@ private void DrawWindow_About() { //Update check Area to Add //Update Check Area - GUILayout.Label("Version Check", Styles.styleStageTextHead); + GUILayout.Label(VERSIONCHECK, Styles.styleStageTextHead); // "Version Check" GUILayout.BeginVertical(Styles.styleSettingsArea, GUILayout.Width(SettingsAreaWidth)); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Space(3); - if (DrawToggle(ref settings.DailyVersionCheck, "Check Version Daily",Styles.styleToggle)) + if (DrawToggle(ref settings.DailyVersionCheck, DAILYCHECK,Styles.styleToggle)) // "Check Version Daily" settings.Save(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); - if (GUILayout.Button("Check Version Now")) + if (GUILayout.Button(NOWCHECK)) // "Check Version Now" { settings.VersionCheck(this, true); //Hide the flag as we already have the window open; @@ -656,9 +727,9 @@ private void DrawWindow_About() GUILayout.BeginHorizontal(); GUILayout.BeginVertical(GUILayout.Width(160)); GUILayout.Space(4); - GUILayout.Label("Last Check Attempt:"); - GUILayout.Label("Current Version:"); - GUILayout.Label("Last Version from Web:"); + GUILayout.Label($"{LASTCHECK}:"); // Last Check Attempt + GUILayout.Label($"{CURVERSION}:"); // Current Version + GUILayout.Label($"{LASTVERSION}:"); // Last Version from Web GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label(settings.VersionCheckDate_AttemptString, Styles.styleTextGreen); @@ -667,7 +738,7 @@ private void DrawWindow_About() if (settings.VersionCheckRunning) { Int32 intDots = Convert.ToInt32(Math.Truncate(DateTime.Now.Millisecond / 250d)) + 1; - GUILayout.Label(String.Format("{0} Checking", new String('.', intDots)), Styles.styleTextYellowBold); + GUILayout.Label(String.Format("{0} {1}", new String('.', intDots), CHECKING), Styles.styleTextYellowBold); // Checking } else { @@ -683,7 +754,7 @@ private void DrawWindow_About() { GUILayout.BeginHorizontal(); GUILayout.Space(80); - if(GUILayout.Button("Updated Version Available", Styles.styleTextYellowBold)) + if(GUILayout.Button(UPDATEDAVAILABLE, Styles.styleTextYellowBold)) // "Updated Version Available" Application.OpenURL("https://github.com/TriggerAu/AlternateResourcePanel/releases"); GUILayout.EndHorizontal(); } @@ -695,18 +766,18 @@ private void DrawWindow_About() GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); //GUILayout.Label("Written by:", Styles.styleStageTextHead); - GUILayout.Label("Documentation and Links:", Styles.styleStageTextHead); - GUILayout.Label("Source Code / Downloads:", Styles.styleStageTextHead); - GUILayout.Label("Forum Page:", Styles.styleStageTextHead); + GUILayout.Label($"{DOCUMENT}:", Styles.styleStageTextHead); // Documentation and Links + GUILayout.Label($"{SOURCECODE}:", Styles.styleStageTextHead); // Source Code / Downloads + GUILayout.Label($"{FORUMPAGE}:", Styles.styleStageTextHead); // Forum Page GUILayout.EndVertical(); GUILayout.BeginVertical(); //GUILayout.Label("Trigger Au",KACResources.styleContent); - if (GUILayout.Button("Click Here", Styles.styleTextCenterGreen)) + if (GUILayout.Button(CLICKHERE, Styles.styleTextCenterGreen)) // "Click Here" Application.OpenURL("https://sites.google.com/site/kspalternateresourcepanel/"); - if (GUILayout.Button("Click Here", Styles.styleTextCenterGreen)) + if (GUILayout.Button(CLICKHERE, Styles.styleTextCenterGreen)) // "Click Here" Application.OpenURL("https://github.com/TriggerAu/AlternateResourcePanel/"); - if (GUILayout.Button("Click Here", Styles.styleTextCenterGreen)) + if (GUILayout.Button(CLICKHERE, Styles.styleTextCenterGreen)) // "Click Here" Application.OpenURL("http://forum.kerbalspaceprogram.com/threads/60227-KSP-Alternate-Resource-Panel"); GUILayout.EndVertical(); diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg index 74cf582..be11f79 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -64,84 +64,91 @@ Localization #ARP_LOC_055 = Unable to find a new Separator ID #ARP_LOC_056 = Moving #ARP_LOC_057 = Separator - #ARP_LOC_058 = - #ARP_LOC_059 = - #ARP_LOC_060 = + #ARP_LOC_058 = General Properties + #ARP_LOC_059 = Styling/Visuals + #ARP_LOC_060 = Alarm Properties - #ARP_LOC_061 = - #ARP_LOC_062 = - #ARP_LOC_063 = - #ARP_LOC_064 = - #ARP_LOC_065 = - #ARP_LOC_066 = - #ARP_LOC_067 = - #ARP_LOC_068 = - #ARP_LOC_069 = - #ARP_LOC_070 = - #ARP_LOC_071 = - #ARP_LOC_072 = - #ARP_LOC_073 = - #ARP_LOC_074 = - #ARP_LOC_075 = - #ARP_LOC_076 = - #ARP_LOC_077 = - #ARP_LOC_078 = - #ARP_LOC_079 = - #ARP_LOC_080 = - #ARP_LOC_081 = - #ARP_LOC_082 = - #ARP_LOC_083 = - #ARP_LOC_084 = - #ARP_LOC_085 = - #ARP_LOC_086 = - #ARP_LOC_087 = - #ARP_LOC_088 = - #ARP_LOC_089 = - #ARP_LOC_090 = - #ARP_LOC_091 = - #ARP_LOC_092 = - #ARP_LOC_093 = - #ARP_LOC_094 = - #ARP_LOC_095 = - #ARP_LOC_096 = - #ARP_LOC_097 = - #ARP_LOC_098 = - #ARP_LOC_099 = - #ARP_LOC_100 = - #ARP_LOC_101 = - #ARP_LOC_102 = - #ARP_LOC_103 = - #ARP_LOC_104 = - #ARP_LOC_105 = - #ARP_LOC_106 = - #ARP_LOC_107 = - #ARP_LOC_108 = - #ARP_LOC_109 = - #ARP_LOC_110 = - #ARP_LOC_111 = - #ARP_LOC_112 = - #ARP_LOC_113 = - #ARP_LOC_114 = - #ARP_LOC_115 = - #ARP_LOC_116 = - #ARP_LOC_117 = - #ARP_LOC_118 = - #ARP_LOC_119 = - #ARP_LOC_120 = - #ARP_LOC_121 = - #ARP_LOC_122 = - #ARP_LOC_123 = - #ARP_LOC_124 = - #ARP_LOC_125 = - #ARP_LOC_126 = - #ARP_LOC_127 = - #ARP_LOC_128 = - #ARP_LOC_129 = - #ARP_LOC_130 = - #ARP_LOC_131 = - #ARP_LOC_132 = - #ARP_LOC_133 = - #ARP_LOC_134 = + #ARP_LOC_061 = Staging Controls + #ARP_LOC_062 = About... + #ARP_LOC_063 = Basic button + #ARP_LOC_064 = Common Toolbar (by Blizzy78) + #ARP_LOC_065 = KSP App Launcher Button + #ARP_LOC_066 = Replace Stock Resources App + #ARP_LOC_067 = Settings Section + #ARP_LOC_068 = Rates + #ARP_LOC_069 = Calc By + #ARP_LOC_070 = Rate Style + + #ARP_LOC_071 = Show Rate Change Values + #ARP_LOC_072 = Show Rates for Parts + #ARP_LOC_073 = Real Time + #ARP_LOC_074 = Stage Bars + #ARP_LOC_075 = Bars Pos + #ARP_LOC_076 = Enabled + #ARP_LOC_077 = Turn this off to show single green bars and no last stage separation. + #ARP_LOC_078 = On Left + #ARP_LOC_079 = On Right + #ARP_LOC_080 = Resources + + #ARP_LOC_081 = Configure Resource Settings + #ARP_LOC_082 = Show Window on Alarm + #ARP_LOC_083 = If an alarm is exceeded then popup the window if it is not already visible. Will hide again when acknowledged. + #ARP_LOC_084 = Styling + #ARP_LOC_085 = Button + #ARP_LOC_086 = Not Installed. Click for Toolbar Info + #ARP_LOC_087 = Click to open your browser and find out more about the Common Toolbar + #ARP_LOC_088 = Hide when other Apps show + #ARP_LOC_089 = Hide the ARP when other stock Apps display (like the stock Resource App) + #ARP_LOC_090 = Stock App restored on scene change + + #ARP_LOC_091 = Iconsets + #ARP_LOC_092 = Select the order of priority for choosing icons. Highest priority to the left + #ARP_LOC_093 = Separator + #ARP_LOC_094 = Padding around resource separators + #ARP_LOC_095 = Empties + #ARP_LOC_096 = Hide Empty Resources + #ARP_LOC_097 = Hide Full Resources + #ARP_LOC_098 = After + #ARP_LOC_099 = secs + #ARP_LOC_100 = Visuals + + #ARP_LOC_101 = Disable Show on Button Hover + #ARP_LOC_102 = Lock Window Position + #ARP_LOC_103 = Save Position + #ARP_LOC_104 = Reset Position + #ARP_LOC_105 = Alarms + #ARP_LOC_106 = Volume + #ARP_LOC_107 = Level + #ARP_LOC_108 = Enable Alarms Functionality + #ARP_LOC_109 = Use KSP UI Volume + #ARP_LOC_110 = Sounds + + #ARP_LOC_111 = Warning + #ARP_LOC_112 = Repeat + #ARP_LOC_113 = Alert + #ARP_LOC_114 = Staging + #ARP_LOC_115 = Auto + #ARP_LOC_116 = Delay + #ARP_LOC_117 = Auto Staging Enabled + #ARP_LOC_118 = Version Check + #ARP_LOC_119 = Check Version Daily + #ARP_LOC_120 = Check Version Now + + #ARP_LOC_121 = Last Check Attempt + #ARP_LOC_122 = Current Version + #ARP_LOC_123 = Last Version from Web + #ARP_LOC_124 = Checking + #ARP_LOC_125 = Updated Version Available + #ARP_LOC_126 = Documentation and Links + #ARP_LOC_127 = Source Code / Downloads + #ARP_LOC_128 = Forum Page + #ARP_LOC_129 = Click Here + #ARP_LOC_130 = Test Sound + + #ARP_LOC_131 = StopPlaying + #ARP_LOC_132 = Staging Enabled + #ARP_LOC_133 = Allow Staging in Mapview + #ARP_LOC_134 = Allow Space Bar in Mapview #ARP_LOC_135 = #ARP_LOC_136 = #ARP_LOC_137 = From b05d22f9ab0c7aac4616bf249584d0ef04dba5ce Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 17:31:34 +0800 Subject: [PATCH 08/18] Localized all the Description --- AlternateResourcePanel/FrameworkExt/Extensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AlternateResourcePanel/FrameworkExt/Extensions.cs b/AlternateResourcePanel/FrameworkExt/Extensions.cs index f941ad4..5a3ec78 100644 --- a/AlternateResourcePanel/FrameworkExt/Extensions.cs +++ b/AlternateResourcePanel/FrameworkExt/Extensions.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.Linq; using System.Text; +using KSP.Localization; namespace KSPPluginFramework { @@ -36,7 +37,7 @@ public static List ToEnumDescriptions(TEnum value) where TEnum : List> temp = Enum .GetValues(typeof(TEnum)) .Cast() - .Select(x => new KeyValuePair(x, ((Enum)((System.Object)x)).Description())) + .Select(x => new KeyValuePair(x, Localizer.Format(((Enum)((System.Object)x)).Description()))) .ToList(); return temp.Select(x => x.Value).ToList(); } From 6c86de9f7a1e19b166b948a6f99a42acea72e3d5 Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 17:45:07 +0800 Subject: [PATCH 09/18] 6 --- .../FrameworkExt/MonoBehaviourWindowPlus.cs | 14 +++++++++----- .../Localization/en-us.cfg | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/AlternateResourcePanel/FrameworkExt/MonoBehaviourWindowPlus.cs b/AlternateResourcePanel/FrameworkExt/MonoBehaviourWindowPlus.cs index 513b3b1..c7ef482 100644 --- a/AlternateResourcePanel/FrameworkExt/MonoBehaviourWindowPlus.cs +++ b/AlternateResourcePanel/FrameworkExt/MonoBehaviourWindowPlus.cs @@ -7,6 +7,7 @@ using KSP; using UnityEngine; using KSPPluginFramework; +using KSP.Localization; namespace KSPPluginFramework { @@ -404,6 +405,9 @@ internal void DrawBlockingSelector() } } } + private static string PAGE = Localizer.Format("#ARP_LOC_135"); + private static string PREV = Localizer.Format("#ARP_LOC_136"); + private static string NEXT = Localizer.Format("#ARP_LOC_137"); //Draw the actual button for the list internal Boolean DrawButton() @@ -418,7 +422,7 @@ internal Boolean DrawButton() if (blnReturn) ListVisible = !ListVisible; //get the drawn button rectangle - if (Event.current.type == EventType.repaint) + if (Event.current.type == EventType.Repaint) rectButton = GUILayoutUtility.GetLastRect(); //draw a dropdown symbol on the right edge if (DropDownGlyph != null) @@ -501,9 +505,9 @@ internal void DrawDropDownList() iPad = 1; //Draw paging buttons - GUI.Label(new Rect(rectListBox) { x = rectListBox.x + ListBoxPadding.left, height = 20 }, String.Format("Page {0}/{1:0}", ListPageNum + 1, Math.Floor((Single)Items.Count / ListPageLength) + 1), stylePager); - GUI.Button(new Rect(rectListBox) { x = rectListBox.x + rectListBox.width - 80 - ListBoxPadding.right, y = rectListBox.y + 2, width = 40, height = 16 }, "Prev"); - GUI.Button(new Rect(rectListBox) { x = rectListBox.x + rectListBox.width - 40 - ListBoxPadding.right, y = rectListBox.y + 2, width = 40, height = 16 }, "Next"); + GUI.Label(new Rect(rectListBox) { x = rectListBox.x + ListBoxPadding.left, height = 20 }, String.Format("{2} {0}/{1:0}", ListPageNum + 1, Math.Floor((Single)Items.Count / ListPageLength) + 1, PAGE), stylePager); // Page + GUI.Button(new Rect(rectListBox) { x = rectListBox.x + rectListBox.width - 80 - ListBoxPadding.right, y = rectListBox.y + 2, width = 40, height = 16 }, PREV); // "Prev" + GUI.Button(new Rect(rectListBox) { x = rectListBox.x + rectListBox.width - 40 - ListBoxPadding.right, y = rectListBox.y + 2, width = 40, height = 16 }, NEXT); // "Next" } //now draw each listitem @@ -530,7 +534,7 @@ internal void DrawDropDownList() internal Boolean CloseOnOutsideClick() { - if (ListVisible && Event.current.type == EventType.mouseDown && !rectListBox.Contains(Event.current.mousePosition)) + if (ListVisible && Event.current.type == EventType.MouseDown && !rectListBox.Contains(Event.current.mousePosition)) { ListVisible = false; return true; diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg index be11f79..b79d12b 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -149,9 +149,9 @@ Localization #ARP_LOC_132 = Staging Enabled #ARP_LOC_133 = Allow Staging in Mapview #ARP_LOC_134 = Allow Space Bar in Mapview - #ARP_LOC_135 = - #ARP_LOC_136 = - #ARP_LOC_137 = + #ARP_LOC_135 = Page + #ARP_LOC_136 = Prev + #ARP_LOC_137 = Next #ARP_LOC_138 = #ARP_LOC_139 = #ARP_LOC_140 = From 9a2a297333383934c045a394990c82aea961e363 Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 17:46:02 +0800 Subject: [PATCH 10/18] Update ARP.cs --- AlternateResourcePanel/ARP.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlternateResourcePanel/ARP.cs b/AlternateResourcePanel/ARP.cs index 4e19f9f..b3d1997 100644 --- a/AlternateResourcePanel/ARP.cs +++ b/AlternateResourcePanel/ARP.cs @@ -457,7 +457,7 @@ internal override void OnGUIEvery() rectButton.x = settings.vectButtonPos.x; rectButton.y = settings.vectButtonPos.y; - if (GUI.Button(rectButton, "Alternate", SkinsLibrary.CurrentSkin.GetStyle("ButtonMain"))) + if (GUI.Button(rectButton, "Alternate", SkinsLibrary.CurrentSkin.GetStyle("ButtonMain"))) // { settings.ToggleOn = !settings.ToggleOn; settings.Save(); From 059b88439d6acc6d77e271debad9770beb7e661b Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 17:53:12 +0800 Subject: [PATCH 11/18] 7 --- AlternateResourcePanel/Resources.cs | 21 ++++++++++++++----- .../Localization/en-us.cfg | 16 +++++++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/AlternateResourcePanel/Resources.cs b/AlternateResourcePanel/Resources.cs index 41cabd0..c620e89 100644 --- a/AlternateResourcePanel/Resources.cs +++ b/AlternateResourcePanel/Resources.cs @@ -8,6 +8,7 @@ using KSP; using UnityEngine; using KSPPluginFramework; +using KSP.Localization; namespace KSPAlternateResourcePanel { @@ -92,6 +93,16 @@ internal class Resources //Alarm Library internal static Dictionary clipAlarms; + // Localization strings + private static string CLICKDISABLE = Localizer.Format("#ARP_LOC_138"); + private static string CLICKENABLE = Localizer.Format("#ARP_LOC_139"); + private static string ARP = Localizer.Format("#ARP_LOC_140"); + private static string ALTERNATERESPANEL = Localizer.Format("#ARP_LOC_141"); + private static string MOD = Localizer.Format("#ARP_LOC_142"); + private static string MODRESDEFINITION = Localizer.Format("#ARP_LOC_143"); + private static string PLAYER = Localizer.Format("#ARP_LOC_144"); + private static string PLAYERSICON = Localizer.Format("#ARP_LOC_145"); + internal static void LoadSounds() { MonoBehaviourExtended.LogFormatted("Loading Sounds"); @@ -185,8 +196,8 @@ internal static void LoadTextures() LoadImageFromFile(ref btnPlayGreen, "img_PlayGreen.png"); LoadImageFromFile(ref btnBan, "img_BanRed.png"); - guiFlowEnabled = new GUIContent(btnPlayGreen, "Click to disable"); - guiFlowDisabled = new GUIContent(btnBan, "Click to enable"); + guiFlowEnabled = new GUIContent(btnPlayGreen, CLICKDISABLE); // "Click to disable" + guiFlowDisabled = new GUIContent(btnBan, CLICKENABLE); // "Click to enable" //LoadImageFromFile(ref btnDropDownSep, "img_DropDownSep.png"); //LoadImageFromFile(ref texDropDownListBox, "tex_DropDownListBox.png"); @@ -307,9 +318,9 @@ internal static GUIContent IconOrderContent(String Name) { switch (Name.ToLower()) { - case "ksparp": return new GUIContent("ARP", "Alternate Resource Panel"); - case "mod": return new GUIContent("Mod", "Mod Resource Definition"); - case "player": return new GUIContent("Player", "Players Icons"); + case "ksparp": return new GUIContent(ARP, ALTERNATERESPANEL); // "ARP""Alternate Resource Panel" + case "mod": return new GUIContent(MOD, MODRESDEFINITION); // "Mod""Mod Resource Definition" + case "player": return new GUIContent(PLAYER, PLAYERSICON); // "Player""Players Icons" default: return new GUIContent("ERROR", ""); } diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg index b79d12b..c2a0292 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -152,14 +152,14 @@ Localization #ARP_LOC_135 = Page #ARP_LOC_136 = Prev #ARP_LOC_137 = Next - #ARP_LOC_138 = - #ARP_LOC_139 = - #ARP_LOC_140 = - #ARP_LOC_141 = - #ARP_LOC_142 = - #ARP_LOC_143 = - #ARP_LOC_144 = - #ARP_LOC_145 = + #ARP_LOC_138 = Click to disable + #ARP_LOC_139 = Click to enable + #ARP_LOC_140 = ARP + #ARP_LOC_141 = Alternate Resource Panel + #ARP_LOC_142 = Mod + #ARP_LOC_143 = Mod Resource Definition + #ARP_LOC_144 = Player + #ARP_LOC_145 = Players Icons #ARP_LOC_146 = #ARP_LOC_147 = #ARP_LOC_148 = From e3792dc39a1a75cfb833689e3753bbfe6e12119d Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 18:26:49 +0800 Subject: [PATCH 12/18] set --- AlternateResourcePanel/Settings.cs | 41 +++--- .../Localization/en-us.cfg | 135 +++--------------- 2 files changed, 41 insertions(+), 135 deletions(-) diff --git a/AlternateResourcePanel/Settings.cs b/AlternateResourcePanel/Settings.cs index 40f198f..e0ab852 100644 --- a/AlternateResourcePanel/Settings.cs +++ b/AlternateResourcePanel/Settings.cs @@ -8,6 +8,8 @@ using KSP; using UnityEngine; using KSPPluginFramework; +using UnityEngine.Networking; +using KSP.Localization; namespace KSPAlternateResourcePanel { @@ -64,12 +66,17 @@ internal Settings(String FilePath) : base(FilePath) { [Persistent] internal Boolean AlarmsVolumeFromUI=true; [Persistent] internal Single AlarmsVolume=0.25f; + // Localization strings + private static string FOREVER = Localizer.Format("#ARP_LOC_146"); + private static string TIMES = Localizer.Format("#ARP_LOC_147"); + private static string NODATARECORDED = Localizer.Format("#ARP_LOC_156"); + private String RepeatsToString(Int32 value) { if (value > 5) - return "For Ever"; + return FOREVER; // "For Ever" else - return value + " Time(s)"; + return value + " " + TIMES; // Time(s) } @@ -137,17 +144,17 @@ public override void OnDecodeFromConfigNode() internal enum DisplaySkin { - [Description("KSP Style")] Default, - [Description("Unity Style")] Unity, - [Description("Unity/KSP Buttons")] UnityWKSPButtons + [Description("#ARP_LOC_148")] Default, // KSP Style + [Description("#ARP_LOC_149")] Unity, // Unity Style + [Description("#ARP_LOC_150")] UnityWKSPButtons // Unity/KSP Buttons } internal enum RateDisplayEnum { - [Description("KSP Default")] Default, - [Description("Left/Right")] LeftRight, - [Description("Left/Right + Text")] LeftRightPlus, - [Description("Up/Down")] UpDown, - [Description("Up/Down + Text")] UpDownPlus + [Description("#ARP_LOC_151")] Default, // KSP Default + [Description("#ARP_LOC_152")] LeftRight, // Left/Right + [Description("#ARP_LOC_153")] LeftRightPlus, // Left/Right + Text + [Description("#ARP_LOC_154")] UpDown, // Up/Down + [Description("#ARP_LOC_155")] UpDownPlus //Up/Down + Text } @@ -158,7 +165,7 @@ internal enum RateDisplayEnum private String ConvertVersionCheckDateToString(DateTime Date) { if (Date < DateTime.Now.AddYears(-10)) - return "No Date Recorded"; + return NODATARECORDED; // "No Date Recorded" else return String.Format("{0:yyyy-MM-dd}", Date); } @@ -412,16 +419,16 @@ internal enum VisibilityTypes } internal enum MonitorDirections { - [Description("Monitor for High Values")] High, - [Description("Monitor for Low Values")] Low + [Description("#ARP_LOC_157")] High, // Monitor for High Values + [Description("#ARP_LOC_158")] Low // Monitor for Low Values } internal enum DisplayUnitsEnum { - [Description("Default KSP Units")] Units, - [Description("Display as Tonnes")] Tonnes, - [Description("Display as Kilograms")] Kilograms, - [Description("Display as Liters")] Liters + [Description("#ARP_LOC_159")] Units, // Default KSP Units + [Description("#ARP_LOC_160")] Tonnes, // Display as Tonnes + [Description("#ARP_LOC_161")] Kilograms, // Display as Kilograms + [Description("#ARP_LOC_162")] Liters // Display as Liters } } diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg index c2a0292..cd8992a 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -160,123 +160,22 @@ Localization #ARP_LOC_143 = Mod Resource Definition #ARP_LOC_144 = Player #ARP_LOC_145 = Players Icons - #ARP_LOC_146 = - #ARP_LOC_147 = - #ARP_LOC_148 = - #ARP_LOC_149 = - #ARP_LOC_150 = - #ARP_LOC_151 = - #ARP_LOC_152 = - #ARP_LOC_153 = - #ARP_LOC_154 = - #ARP_LOC_155 = - #ARP_LOC_156 = - #ARP_LOC_157 = - #ARP_LOC_158 = - #ARP_LOC_159 = - #ARP_LOC_160 = - #ARP_LOC_161 = - #ARP_LOC_162 = - #ARP_LOC_163 = - #ARP_LOC_164 = - #ARP_LOC_165 = - #ARP_LOC_166 = - #ARP_LOC_167 = - #ARP_LOC_168 = - #ARP_LOC_169 = - #ARP_LOC_170 = - #ARP_LOC_171 = - #ARP_LOC_172 = - #ARP_LOC_173 = - #ARP_LOC_174 = - #ARP_LOC_175 = - #ARP_LOC_176 = - #ARP_LOC_177 = - #ARP_LOC_178 = - #ARP_LOC_179 = - #ARP_LOC_180 = - #ARP_LOC_181 = - #ARP_LOC_182 = - #ARP_LOC_183 = - #ARP_LOC_184 = - #ARP_LOC_185 = - #ARP_LOC_186 = - #ARP_LOC_187 = - #ARP_LOC_188 = - #ARP_LOC_189 = - #ARP_LOC_190 = - #ARP_LOC_191 = - #ARP_LOC_192 = - #ARP_LOC_193 = - #ARP_LOC_194 = - #ARP_LOC_195 = - #ARP_LOC_196 = - #ARP_LOC_197 = - #ARP_LOC_198 = - #ARP_LOC_199 = - #ARP_LOC_200 = - #ARP_LOC_201 = - #ARP_LOC_202 = - #ARP_LOC_203 = - #ARP_LOC_204 = - #ARP_LOC_205 = - #ARP_LOC_206 = - #ARP_LOC_207 = - #ARP_LOC_208 = - #ARP_LOC_209 = - #ARP_LOC_210 = - #ARP_LOC_211 = - #ARP_LOC_212 = - #ARP_LOC_213 = - #ARP_LOC_214 = - #ARP_LOC_215 = - #ARP_LOC_216 = - #ARP_LOC_217 = - #ARP_LOC_218 = - #ARP_LOC_219 = - #ARP_LOC_220 = - #ARP_LOC_221 = - #ARP_LOC_222 = - #ARP_LOC_223 = - #ARP_LOC_224 = - #ARP_LOC_225 = - #ARP_LOC_226 = - #ARP_LOC_227 = - #ARP_LOC_228 = - #ARP_LOC_229 = - #ARP_LOC_230 = - #ARP_LOC_231 = - #ARP_LOC_232 = - #ARP_LOC_233 = - #ARP_LOC_234 = - #ARP_LOC_235 = - #ARP_LOC_236 = - #ARP_LOC_237 = - #ARP_LOC_238 = - #ARP_LOC_239 = - #ARP_LOC_240 = - #ARP_LOC_241 = - #ARP_LOC_242 = - #ARP_LOC_243 = - #ARP_LOC_244 = - #ARP_LOC_245 = - #ARP_LOC_246 = - #ARP_LOC_247 = - #ARP_LOC_248 = - #ARP_LOC_249 = - #ARP_LOC_250 = - #ARP_LOC_251 = - #ARP_LOC_252 = - #ARP_LOC_253 = - #ARP_LOC_254 = - #ARP_LOC_255 = - #ARP_LOC_256 = - #ARP_LOC_257 = - #ARP_LOC_258 = - #ARP_LOC_259 = - #ARP_LOC_260 = - - - + #ARP_LOC_146 = For Ever + #ARP_LOC_147 = Time(s) + #ARP_LOC_148 = KSP Style + #ARP_LOC_149 = Unity Style + #ARP_LOC_150 = Unity/KSP Buttons + #ARP_LOC_151 = KSP Default + #ARP_LOC_152 = Left/Right + #ARP_LOC_153 = Left/Right + Text + #ARP_LOC_154 = Up/Down + #ARP_LOC_155 = Up/Down + Text + #ARP_LOC_156 = No Date Recorded + #ARP_LOC_157 = Monitor for High Values + #ARP_LOC_158 = Monitor for Low Values + #ARP_LOC_159 = Default KSP Units + #ARP_LOC_160 = Display as Tonnes + #ARP_LOC_161 = Display as Kilograms + #ARP_LOC_162 = Display as Liters } } From 6443f57ee680aec20b0fedff00feb19368dc0b48 Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 18:26:58 +0800 Subject: [PATCH 13/18] ALL done --- AlternateResourcePanel/SharedStuff/Drawing.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlternateResourcePanel/SharedStuff/Drawing.cs b/AlternateResourcePanel/SharedStuff/Drawing.cs index 247f04f..6b218e8 100644 --- a/AlternateResourcePanel/SharedStuff/Drawing.cs +++ b/AlternateResourcePanel/SharedStuff/Drawing.cs @@ -16,7 +16,7 @@ internal static Rect DrawResourceIcon(String ResourceName) GUIContent contLabel; contLabel = GetResourceIcon(ResourceName); - contLabel.tooltip = ResourceName; + contLabel.tooltip = PartResourceLibrary.Instance.GetDefinition(ResourceName).displayName;// ResourceName; GUILayout.Label(contLabel, Styles.styleBarName, GUILayout.ExpandWidth(false)); //return the rect that is the position of the Icon From b1b4b79ef3b4e29c0b00cf3ad230f12281214756 Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 22:19:16 +0800 Subject: [PATCH 14/18] reach every corner and finally done --- .../ARPWindowResourceConfig.cs | 9 +- .../Localization/en-us.cfg | 3 + .../Localization/zh-cn.cfg | 185 ++++++++++++++++++ 3 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/zh-cn.cfg diff --git a/AlternateResourcePanel/ARPWindowResourceConfig.cs b/AlternateResourcePanel/ARPWindowResourceConfig.cs index 4e66948..78dea31 100644 --- a/AlternateResourcePanel/ARPWindowResourceConfig.cs +++ b/AlternateResourcePanel/ARPWindowResourceConfig.cs @@ -248,7 +248,14 @@ internal override void DrawWindow(int id) // Visibility level and alarm values/Delete if (!item.IsSeparator) { - if (GUILayout.Button(settings.Resources[item.id].Visibility.ToString(), GUILayout.Width(75))) + string visibility = settings.Resources[item.id].Visibility.ToString(); + if (settings.Resources[item.id].Visibility.ToString() == "AlwaysOn") + visibility = Localizer.Format("#ARP_LOC_163"); + else if (settings.Resources[item.id].Visibility.ToString() == "Threshold") + visibility = Localizer.Format("#ARP_LOC_164"); + else if (settings.Resources[item.id].Visibility.ToString() == "Hidden") + visibility = Localizer.Format("#ARP_LOC_165"); + if (GUILayout.Button(visibility, GUILayout.Width(75))) // settings.Resources[item.id].Visibility.ToString() { settings.Resources[item.id].Visibility = settings.Resources[item.id].Visibility.Next(); } diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg index cd8992a..6ac34e9 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -177,5 +177,8 @@ Localization #ARP_LOC_160 = Display as Tonnes #ARP_LOC_161 = Display as Kilograms #ARP_LOC_162 = Display as Liters + #ARP_LOC_163 = AlwaysOn + #ARP_LOC_164 = Threshold + #ARP_LOC_165 = Hidden } } diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/zh-cn.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/zh-cn.cfg new file mode 100644 index 0000000..c1d2df0 --- /dev/null +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/zh-cn.cfg @@ -0,0 +1,185 @@ +Localization +{ + zh-cn + { + #ARP_LOC_001 = 转移 + #ARP_LOC_002 = 停止 + #ARP_LOC_003 = 输出 + #ARP_LOC_004 = 输入 + #ARP_LOC_005 = 已安装... 等待分级 + #ARP_LOC_006 = 运行中 + #ARP_LOC_007 = 时延:<<1>>s + #ARP_LOC_008 = 未安装 + #ARP_LOC_009 = 运行完成 + #ARP_LOC_010 = 当前没有配置要显示的资源 + + #ARP_LOC_011 = 分级 + #ARP_LOC_012 = 激活分级 + #ARP_LOC_013 = 无控制 + #ARP_LOC_014 = 自动 + #ARP_LOC_015 = 到 + #ARP_LOC_016 = 展开 + #ARP_LOC_017 = 未展开 + #ARP_LOC_018 = 回到载具显示 + #ARP_LOC_019 = 基本信息\n2km范围内载具的所有资源 + #ARP_LOC_020 = 隐藏剩余时间 + + #ARP_LOC_021 = 显示剩余时间 + #ARP_LOC_022 = 开关隐藏资源 + #ARP_LOC_023 = 显示设置... + #ARP_LOC_024 = 隐藏设置 + #ARP_LOC_025 = 新版本已发行 + #ARP_LOC_026 = 配置资源 + #ARP_LOC_027 = 关闭 + #ARP_LOC_028 = 图标 + #ARP_LOC_029 = 名称 + #ARP_LOC_030 = 位置 + + #ARP_LOC_031 = 可见度 + #ARP_LOC_032 = 监控 + #ARP_LOC_033 = 添加分割线 + #ARP_LOC_034 = 上移 + #ARP_LOC_035 = 最上方 + #ARP_LOC_036 = 最下方 + #ARP_LOC_037 = 删除 + #ARP_LOC_038 = 单位 + #ARP_LOC_039 = 监控等级 + #ARP_LOC_040 = 警报等级 + + #ARP_LOC_041 = 警报等级 + #ARP_LOC_042 = 为此启用警报 + #ARP_LOC_043 = 启用闹钟 + #ARP_LOC_044 = 资源空时行为 + #ARP_LOC_045 = 当资源空时隐藏 + #ARP_LOC_046 = 资源满时行为 + #ARP_LOC_047 = 当资源满时隐藏 + #ARP_LOC_048 = 分级显示 + #ARP_LOC_049 = 启用拆分 + #ARP_LOC_050 = 拆分行为 + + #ARP_LOC_051 = 显示存储级别 + #ARP_LOC_052 = 代替整个载具/末级分离 + #ARP_LOC_053 = 按组排序 + #ARP_LOC_054 = 保存 + #ARP_LOC_055 = 未找到新的分割线ID + #ARP_LOC_056 = 移动 + #ARP_LOC_057 = 分割线 + #ARP_LOC_058 = 常规设置 + #ARP_LOC_059 = 样式/显示 + #ARP_LOC_060 = 闹钟设置 + + #ARP_LOC_061 = 分级控制 + #ARP_LOC_062 = 关于... + #ARP_LOC_063 = 基础按钮 + #ARP_LOC_064 = 通用工具条 (Toolbar by Blizzy78) + #ARP_LOC_065 = KSP原版按钮 + #ARP_LOC_066 = 替换原版资源显示 + #ARP_LOC_067 = 设置部分 + #ARP_LOC_068 = 消耗速率 + #ARP_LOC_069 = 计算By + #ARP_LOC_070 = 速率显示样式 + + #ARP_LOC_071 = 显示消耗变化 + #ARP_LOC_072 = 部件显示消耗 + #ARP_LOC_073 = 真实时间 + #ARP_LOC_074 = 分级显示 + #ARP_LOC_075 = 条位置 + #ARP_LOC_076 = 启用 + #ARP_LOC_077 = 关闭此选项可显示单个绿色条,不显示最后分级的分隔条。 + #ARP_LOC_078 = 从左排列 + #ARP_LOC_079 = 从右排列 + #ARP_LOC_080 = 资源 + + #ARP_LOC_081 = 配置资源设置 + #ARP_LOC_082 = 闹铃弹出窗口 + #ARP_LOC_083 = 如果到达闹钟设置时间,且未打开窗口,则会自动弹出窗口。点击确认后将关闭隐藏。 + #ARP_LOC_084 = 样式 + #ARP_LOC_085 = 按钮 + #ARP_LOC_086 = 未安装. 点击获取工具条(Toolbar)的信息 + #ARP_LOC_087 = 单击打开浏览器获取更多关于通用工具条信息 + #ARP_LOC_088 = 当其他窗口打开时自动隐藏 + #ARP_LOC_089 = 当其他原版窗口(如原版的资源窗口)显示时隐藏ARP + #ARP_LOC_090 = 切换场景时自动恢复原版 + + #ARP_LOC_091 = 图标集 + #ARP_LOC_092 = 选择使用图标的优先级顺序。左边优先级最高 + #ARP_LOC_093 = 分割线 + #ARP_LOC_094 = 在资源显示区域周围的分割线 + #ARP_LOC_095 = 空 + #ARP_LOC_096 = 隐藏空的资源 + #ARP_LOC_097 = 隐藏满的资源 + #ARP_LOC_098 = 在 + #ARP_LOC_099 = 秒后 + #ARP_LOC_100 = 显示 + + #ARP_LOC_101 = 禁用悬停在按钮时的提示 + #ARP_LOC_102 = 锁定窗口位置 + #ARP_LOC_103 = 保存位置 + #ARP_LOC_104 = 重置位置 + #ARP_LOC_105 = 闹钟 + #ARP_LOC_106 = 音量 + #ARP_LOC_107 = 级别 + #ARP_LOC_108 = 启用闹钟功能 + #ARP_LOC_109 = 使用KSP的音量界面 + #ARP_LOC_110 = 声音 + + #ARP_LOC_111 = 警告 + #ARP_LOC_112 = 重复 + #ARP_LOC_113 = 警报 + #ARP_LOC_114 = 分级 + #ARP_LOC_115 = 自动 + #ARP_LOC_116 = 延时 + #ARP_LOC_117 = 自动分级启用 + #ARP_LOC_118 = 检查版本 + #ARP_LOC_119 = 每日检查 + #ARP_LOC_120 = 现在检查 + + #ARP_LOC_121 = 最后一次检查 + #ARP_LOC_122 = 当前版本 + #ARP_LOC_123 = 最新版本 + #ARP_LOC_124 = 检查中 + #ARP_LOC_125 = 新版本可用 + #ARP_LOC_126 = 文档和链接 + #ARP_LOC_127 = 源码 / 下载 + #ARP_LOC_128 = 论坛页面 + #ARP_LOC_129 = 点击这里 + #ARP_LOC_130 = 试听 + + #ARP_LOC_131 = 停止播放 + #ARP_LOC_132 = 分级启用 + #ARP_LOC_133 = 地图视角允许分级 + #ARP_LOC_134 = 地图视角允许空白条 + #ARP_LOC_135 = 页面 + #ARP_LOC_136 = 前 + #ARP_LOC_137 = 后 + #ARP_LOC_138 = 点击禁用 + #ARP_LOC_139 = 点击启用 + #ARP_LOC_140 = ARP + + #ARP_LOC_141 = Alternate Resource Panel + #ARP_LOC_142 = Mod + #ARP_LOC_143 = Mod定义资源 + #ARP_LOC_144 = 玩家 + #ARP_LOC_145 = 玩家的自定义图标 + #ARP_LOC_146 = 永久 + #ARP_LOC_147 = 次 + #ARP_LOC_148 = KSP样式 + #ARP_LOC_149 = Unity样式 + #ARP_LOC_150 = Unity样式/KSP按钮 + #ARP_LOC_151 = KSP默认 + #ARP_LOC_152 = 左/右 + #ARP_LOC_153 = 左/右 + 文本 + #ARP_LOC_154 = 上/下 + #ARP_LOC_155 = 上/下 + 文本 + #ARP_LOC_156 = 无数据记录 + #ARP_LOC_157 = 监视高资源量 + #ARP_LOC_158 = 监视低资源量 + #ARP_LOC_159 = 默认KSP单位 + #ARP_LOC_160 = 按吨显示 + #ARP_LOC_161 = 按千克显示 + #ARP_LOC_162 = 按升显示 + #ARP_LOC_163 = 总是显示 + #ARP_LOC_164 = 达到阈值 + #ARP_LOC_165 = 总是隐藏 + } +} From 8ddaf1d6027bf5bfe60a880836a7e8323d47f15b Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 22:44:48 +0800 Subject: [PATCH 15/18] fix the issue #99 --- AlternateResourcePanel/ARPWindowResourceConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlternateResourcePanel/ARPWindowResourceConfig.cs b/AlternateResourcePanel/ARPWindowResourceConfig.cs index 78dea31..474e856 100644 --- a/AlternateResourcePanel/ARPWindowResourceConfig.cs +++ b/AlternateResourcePanel/ARPWindowResourceConfig.cs @@ -139,7 +139,7 @@ internal override void DrawWindow(int id) for (int i = 0; i < settings.Resources.Count; i++) { ResourceSettings item = settings.Resources.Values.ElementAt(i); - if(item == null || PartResourceLibrary.Instance.GetDefinition(item.id) == null) + if(item == null || (PartResourceLibrary.Instance.GetDefinition(item.id) == null && !item.IsSeparator)) { continue; } From 040239b140a9d66836e7f8e20ab05190369b79d1 Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sat, 25 Mar 2023 22:47:02 +0800 Subject: [PATCH 16/18] Update Drawing.cs --- AlternateResourcePanel/SharedStuff/Drawing.cs | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/AlternateResourcePanel/SharedStuff/Drawing.cs b/AlternateResourcePanel/SharedStuff/Drawing.cs index 6b218e8..3fbd9af 100644 --- a/AlternateResourcePanel/SharedStuff/Drawing.cs +++ b/AlternateResourcePanel/SharedStuff/Drawing.cs @@ -267,40 +267,39 @@ internal static void DrawTimeRemaining(Rect rectStart, ARPResource Res) internal static String FormatTime(Double TimeInSecs) { - return KSPUtil.dateTimeFormatter.PrintDateDeltaCompact(TimeInSecs, true, true, true); - //String strReturn = ""; - - //Double Second = TimeInSecs % 60; - //Double Minute = Math.Truncate((TimeInSecs / 60) % 60); - //Double HourRaw = TimeInSecs / 60 / 60; - - //Double Hour; - //if (GameSettings.KERBIN_TIME) - // Hour = Math.Truncate(HourRaw % 6); - //else - // Hour = Math.Truncate(HourRaw % 24); - - //Double Day; - //if (GameSettings.KERBIN_TIME) - // Day = Math.Truncate((HourRaw % (426 * 6)) / 6); - //else - // Day = Math.Truncate((HourRaw % (365 * 24)) / 24); - - //Double Year; - //if (GameSettings.KERBIN_TIME) - // Year = Math.Truncate((HourRaw / (426 * 6))); - //else - // Year = Math.Truncate((HourRaw / (365 * 24))); - - //if (Year > 0) - // strReturn = String.Format("{0:0}y {1:0}d {2:00}:{3:00}:{4:00}", Year, Day, Hour, Minute, Second); - //else if (Day > 0) - // strReturn = String.Format("{0:0}d {1:00}:{2:00}:{3:00}", Day, Hour, Minute, Second); - //else if (Hour > 0) - // strReturn = String.Format("{1:0}:{2:00}:{3:00}", Day, Hour, Minute, Second); - //else - // strReturn = String.Format("{2:0}:{3:00.0}", Day, Hour, Minute, Second); - //return strReturn; + String strReturn = ""; + + Double Second = TimeInSecs % 60; + Double Minute = Math.Truncate((TimeInSecs / 60) % 60); + Double HourRaw = TimeInSecs / 60 / 60; + + Double Hour; + if (GameSettings.KERBIN_TIME) + Hour = Math.Truncate(HourRaw % 6); + else + Hour = Math.Truncate(HourRaw % 24); + + Double Day; + if (GameSettings.KERBIN_TIME) + Day = Math.Truncate((HourRaw % (426 * 6)) / 6); + else + Day = Math.Truncate((HourRaw % (365 * 24)) / 24); + + Double Year; + if (GameSettings.KERBIN_TIME) + Year = Math.Truncate((HourRaw / (426 * 6))); + else + Year = Math.Truncate((HourRaw / (365 * 24))); + + if (Year > 0) + strReturn = String.Format("{0:0}y {1:0}d {2:00}:{3:00}:{4:00}", Year, Day, Hour, Minute, Second); + else if (Day > 0) + strReturn = String.Format("{0:0}d {1:00}:{2:00}:{3:00}", Day, Hour, Minute, Second); + else if (Hour > 0) + strReturn = String.Format("{1:0}:{2:00}:{3:00}", Day, Hour, Minute, Second); + else + strReturn = String.Format("{2:0}:{3:00.0}", Day, Hour, Minute, Second); + return strReturn; } From 78caa7eb160deea5c9d1418c062312b7e0ebcc1f Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sun, 26 Mar 2023 08:07:08 +0800 Subject: [PATCH 17/18] Update ARPPartWindow.cs --- AlternateResourcePanel/ARPPartWindow.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlternateResourcePanel/ARPPartWindow.cs b/AlternateResourcePanel/ARPPartWindow.cs index 314ad23..f00a1d7 100644 --- a/AlternateResourcePanel/ARPPartWindow.cs +++ b/AlternateResourcePanel/ARPPartWindow.cs @@ -281,7 +281,7 @@ internal override void DrawWindow(int id) String strOut = (tmpTransfer.transferState == TransferStateEnum.Out && tmpTransfer.Active) ? STOP : OUT; //"Stop""Out" - String strIn = (tmpTransfer.transferState == TransferStateEnum.In && tmpTransfer.Active) ? STOP : OUT; // "Stop""In" + String strIn = (tmpTransfer.transferState == TransferStateEnum.In && tmpTransfer.Active) ? STOP : IN; // "Stop""In" Boolean blnTempOut = GUILayout.Toggle(tmpTransfer.transferState == TransferStateEnum.Out, strOut, styleTransferButton); Boolean blnTempIn = GUILayout.Toggle(tmpTransfer.transferState == TransferStateEnum.In, strIn, styleTransferButton); From ce4ed8d0ab6420462a0002394bc7ca3e5e5e27ff Mon Sep 17 00:00:00 2001 From: Tinygrox Date: Sun, 26 Mar 2023 09:31:22 +0800 Subject: [PATCH 18/18] wrong pos --- .../KSPAlternateResourcePanel/Localization/en-us.cfg | 4 ++-- .../KSPAlternateResourcePanel/Localization/zh-cn.cfg | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg index 6ac34e9..63e29e2 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/en-us.cfg @@ -4,8 +4,8 @@ Localization { #ARP_LOC_001 = Transfer #ARP_LOC_002 = Stop - #ARP_LOC_003 = Out - #ARP_LOC_004 = In + #ARP_LOC_003 = In + #ARP_LOC_004 = Out #ARP_LOC_005 = Armed... waiting for stage #ARP_LOC_006 = Running #ARP_LOC_007 = Delay:<<1>>s diff --git a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/zh-cn.cfg b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/zh-cn.cfg index c1d2df0..a96f287 100644 --- a/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/zh-cn.cfg +++ b/PlugInFiles/GameData/TriggerTech/KSPAlternateResourcePanel/Localization/zh-cn.cfg @@ -4,8 +4,8 @@ Localization { #ARP_LOC_001 = 转移 #ARP_LOC_002 = 停止 - #ARP_LOC_003 = 输出 - #ARP_LOC_004 = 输入 + #ARP_LOC_003 = 输入 + #ARP_LOC_004 = 输出 #ARP_LOC_005 = 已安装... 等待分级 #ARP_LOC_006 = 运行中 #ARP_LOC_007 = 时延:<<1>>s @@ -120,7 +120,7 @@ Localization #ARP_LOC_106 = 音量 #ARP_LOC_107 = 级别 #ARP_LOC_108 = 启用闹钟功能 - #ARP_LOC_109 = 使用KSP的音量界面 + #ARP_LOC_109 = 沿用UI音效设置 #ARP_LOC_110 = 声音 #ARP_LOC_111 = 警告 @@ -134,7 +134,7 @@ Localization #ARP_LOC_119 = 每日检查 #ARP_LOC_120 = 现在检查 - #ARP_LOC_121 = 最后一次检查 + #ARP_LOC_121 = 上次检查 #ARP_LOC_122 = 当前版本 #ARP_LOC_123 = 最新版本 #ARP_LOC_124 = 检查中