mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-08-05 09:40:18 +08:00
refactor: use localization constants at remaining call sites
This commit is contained in:
@@ -28,7 +28,7 @@ public static class DysonSphereResolver
|
||||
var star = GameMain.localStar;
|
||||
if (star == null)
|
||||
{
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), "You are not in any system.".Translate(), Localization.OK.Translate(), UIMessageBox.ERROR, null);
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), Localization.YouAreNotInAnySystem.Translate(), Localization.OK.Translate(), UIMessageBox.ERROR, null);
|
||||
}
|
||||
return star;
|
||||
}
|
||||
@@ -40,12 +40,12 @@ public static class DysonSphereResolver
|
||||
var sphere = GameMain.data?.dysonSpheres[star.index];
|
||||
if (sphere == null)
|
||||
{
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format("There is no Dyson Sphere data on \"{0}\".".Translate(), star.displayName), Localization.OK.Translate(), UIMessageBox.ERROR, null);
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThereIsNoDysonSphereDataOn0.Translate(), star.displayName), Localization.OK.Translate(), UIMessageBox.ERROR, null);
|
||||
return null;
|
||||
}
|
||||
if (requireLayer && sphere.layerCount == 0)
|
||||
{
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format("There is no Dyson Sphere shell on \"{0}\".".Translate(), star.displayName), Localization.OK.Translate(), UIMessageBox.ERROR, null);
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThereIsNoDysonSphereShellOn0.Translate(), star.displayName), Localization.OK.Translate(), UIMessageBox.ERROR, null);
|
||||
return null;
|
||||
}
|
||||
return (sphere, star);
|
||||
|
||||
@@ -17,7 +17,7 @@ public static class FrameRemovalFunctions
|
||||
if (resolved == null) return;
|
||||
var (dysonSphere, star) = resolved.Value;
|
||||
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format("This will remove all frames on \"{0}\". Are you sure?".Translate(), star.displayName), Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThisWillRemoveAllFramesOn0AreYouSure.Translate(), star.displayName), Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
{
|
||||
var totalFrameSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public static class ShellCompletionFunctions
|
||||
if (resolved == null) return;
|
||||
var (dysonSphere, star) = resolved.Value;
|
||||
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format("This will complete all Dyson Sphere shells on \"{0}\". Are you sure?".Translate(), star.displayName), Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThisWillCompleteAllDysonSphereShellsOn0InstantlyAreYouSure.Translate(), star.displayName), Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
{
|
||||
var totalNodeSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalNodeSP");
|
||||
var totalFrameSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
|
||||
|
||||
@@ -89,10 +89,10 @@ public static class PlayerFunctions
|
||||
|
||||
if (itemCnt.All(cnt => cnt == 0))
|
||||
{
|
||||
UIMessageBox.Show("Remove all metadata consumption records".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), UIMessageBox.INFO);
|
||||
UIMessageBox.Show(Localization.RemoveAllMetadataConsumptionRecords.Translate(), Localization.NoMetadataConsumptionRecord.Translate(), Localization.OK.Translate(), UIMessageBox.INFO);
|
||||
return;
|
||||
}
|
||||
var msg = "ClearAllMetadataConsumptionDetails".Translate();
|
||||
var msg = Localization.ClearAllMetadataConsumptionDetails.Translate();
|
||||
for (var i = 0; i < itemCnt.Length; i++)
|
||||
{
|
||||
if (itemCnt[i] > 0)
|
||||
@@ -100,7 +100,7 @@ public static class PlayerFunctions
|
||||
msg += $"\n {LDB.items.Select(i + ItemIds.HydrogenFuelRod).propertyName} x{itemCnt[i]}";
|
||||
}
|
||||
}
|
||||
UIMessageBox.Show("Remove all metadata consumption records".Translate(), msg, "Cancel".Translate(), "OK".Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
UIMessageBox.Show(Localization.RemoveAllMetadataConsumptionRecords.Translate(), msg, Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
{
|
||||
foreach (var data in propertySystem.propertyDatas)
|
||||
{
|
||||
@@ -126,7 +126,7 @@ public static class PlayerFunctions
|
||||
var clusterPropertyData = propertySystem.propertyDatas.FirstOrDefault(cpd => cpd.seedKey == seedKey);
|
||||
if (clusterPropertyData == null)
|
||||
{
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), UIMessageBox.INFO);
|
||||
UIMessageBox.Show(Localization.RemoveMetadataConsumptionRecordInCurrentGame.Translate(), Localization.NoMetadataConsumptionRecord.Translate(), Localization.OK.Translate(), UIMessageBox.INFO);
|
||||
return;
|
||||
}
|
||||
var currentGamePropertyData = GameMain.data.history.propertyData;
|
||||
@@ -140,7 +140,7 @@ public static class PlayerFunctions
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), UIMessageBox.INFO);
|
||||
return;
|
||||
}
|
||||
var msg = "ClearCurrentMetadataConsumptionDetails".Translate();
|
||||
var msg = Localization.ClearCurrentMetadataConsumptionDetails.Translate();
|
||||
for (var i = 0; i < itemCnt.Length; i++)
|
||||
{
|
||||
if (itemCnt[i] > 0)
|
||||
@@ -148,7 +148,7 @@ public static class PlayerFunctions
|
||||
msg += $"\n {LDB.items.Select(i + ItemIds.HydrogenFuelRod).propertyName} x{itemCnt[i]}";
|
||||
}
|
||||
}
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), msg, "Cancel".Translate(), "OK".Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
UIMessageBox.Show(Localization.RemoveMetadataConsumptionRecordInCurrentGame.Translate(), msg, Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
{
|
||||
for (var i = 0; i < clusterPropertyData.totalConsumption.Count; i++)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ public static class Localization
|
||||
public const string YouAreNotInAnySystem = "You are not in any system.";
|
||||
public const string ThereIsNoDysonSphereShellOn0 = "There is no Dyson Sphere shell on \"{0}\".";
|
||||
public const string ThereIsNoDysonSphereDataOn0 = "There is no Dyson Sphere data on \"{0}\".";
|
||||
public const string ThisWillCompleteAllDysonSphereShellsOn0InstantlyAreYouSure = "This will complete all Dyson Sphere shells on \"{0}\" instantly. Are you sure?";
|
||||
public const string ThisWillCompleteAllDysonSphereShellsOn0InstantlyAreYouSure = "This will complete all Dyson Sphere shells on \"{0}\". Are you sure?";
|
||||
public const string ThisWillRemoveAllFramesOn0AreYouSure = "This will remove all frames on \"{0}\". Are you sure?";
|
||||
public const string NoPrecalculatedShellFoundForRadius0 = "No precalculated shell found for radius {0}.";
|
||||
public const string ClearAllMetadataConsumptionDetails = "ClearAllMetadataConsumptionDetails";
|
||||
@@ -98,7 +98,7 @@ public static class Localization
|
||||
I18N.Add(YouAreNotInAnySystem, "You are not in any system.", "你不在任何星系中");
|
||||
I18N.Add(ThereIsNoDysonSphereShellOn0, "There is no Dyson Sphere shell on \"{0}\".", "“{0}”上没有可建造的戴森壳");
|
||||
I18N.Add(ThereIsNoDysonSphereDataOn0, "There is no Dyson Sphere data on \"{0}\".", "“{0}”上没有戴森球数据");
|
||||
I18N.Add(ThisWillCompleteAllDysonSphereShellsOn0InstantlyAreYouSure, "This will complete all Dyson Sphere shells on \"{0}\" instantly. Are you sure?", "这将立即完成“{0}”上的所有戴森壳。你确定吗?");
|
||||
I18N.Add(ThisWillCompleteAllDysonSphereShellsOn0InstantlyAreYouSure, "This will complete all Dyson Sphere shells on \"{0}\". Are you sure?", "这将完成“{0}”上的所有戴森壳。你确定吗?");
|
||||
I18N.Add(ThisWillRemoveAllFramesOn0AreYouSure, "This will remove all frames on \"{0}\". Are you sure?", "这将移除“{0}”上的所有框架。你确定吗?");
|
||||
I18N.Add(NoPrecalculatedShellFoundForRadius0, "No precalculated shell found for radius {0}.", "没有找到适合半径 {0} 的预计算壳面");
|
||||
I18N.Add(ClearAllMetadataConsumptionDetails, """
|
||||
|
||||
@@ -123,7 +123,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
NoConditionEnabled.Value = !NoConditionEnabled.Value;
|
||||
if (!DSPGame.IsMenuDemo && GameMain.isRunning)
|
||||
{
|
||||
UIRoot.instance.uiGame.generalTips.InvokeRealtimeTipAhead((NoConditionEnabled.Value ? "NoConditionOn" : "NoConditionOff").Translate());
|
||||
UIRoot.instance.uiGame.generalTips.InvokeRealtimeTipAhead((NoConditionEnabled.Value ? Localization.NoConditionOn : Localization.NoConditionOff).Translate());
|
||||
}
|
||||
}
|
||||
if (_noCollisionKey.keyValue)
|
||||
@@ -131,7 +131,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
NoCollisionEnabled.Value = !NoCollisionEnabled.Value;
|
||||
if (!DSPGame.IsMenuDemo && GameMain.isRunning)
|
||||
{
|
||||
UIRoot.instance.uiGame.generalTips.InvokeRealtimeTipAhead((NoCollisionEnabled.Value ? "NoCollisionOn" : "NoCollisionOff").Translate());
|
||||
UIRoot.instance.uiGame.generalTips.InvokeRealtimeTipAhead((NoCollisionEnabled.Value ? Localization.NoCollisionOn : Localization.NoCollisionOff).Translate());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -248,11 +248,11 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
{
|
||||
if (NoConditionEnabled.Value)
|
||||
{
|
||||
w.criticalWarningTexts = "Build without condition is enabled!".Translate() + "\r\n";
|
||||
w.criticalWarningTexts = Localization.BuildWithoutConditionIsEnabled.Translate() + "\r\n";
|
||||
}
|
||||
else if (NoCollisionEnabled.Value)
|
||||
{
|
||||
w.criticalWarningTexts = "No collision is enabled!".Translate() + "\r\n";
|
||||
w.criticalWarningTexts = Localization.NoCollisionIsEnabled.Translate() + "\r\n";
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user