1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 14:13:31 +08:00

tech unlock fix

This commit is contained in:
2025-04-28 21:35:41 +08:00
parent f407928579
commit 167f53e2df
2 changed files with 6 additions and 6 deletions

View File

@@ -184,17 +184,17 @@ public static class TechFunctions
techProtos.Add(techProto); techProtos.Add(techProto);
} }
} }
UnlockProtoWithMetadataAndPrompt([.. techProtos], false); UnlockProtoWithMetadataAndPrompt([.. techProtos], 16, false);
} }
public static void UnlockProtoWithMetadataAndPrompt(TechProto[] techProtos, bool withPrerequisites = true) public static void UnlockProtoWithMetadataAndPrompt(TechProto[] techProtos, int toLevel, bool withPrerequisites = true)
{ {
var techList = new List<Tuple<TechProto, int, int>>(); var techList = new List<Tuple<TechProto, int, int>>();
var properties = new SortedList<int, int>(); var properties = new SortedList<int, int>();
var history = GameMain.history; var history = GameMain.history;
foreach (var techProto in techProtos) foreach (var techProto in techProtos)
{ {
CheckTechUnlockProperties(history, techProto, properties, techList, -1, withPrerequisites); CheckTechUnlockProperties(history, techProto, properties, techList, toLevel, withPrerequisites);
} }
var propertySystem = DSPGame.propertySystem; var propertySystem = DSPGame.propertySystem;
var clusterSeedKey = history.gameData.GetClusterSeedKey(); var clusterSeedKey = history.gameData.GetClusterSeedKey();
@@ -207,7 +207,7 @@ public static class TechFunctions
} }
if (!enough) if (!enough)
{ {
UIRealtimeTip.Popup("元数据不足".Translate(), true, 0); UIMessageBox.Show("元数据".Translate(), "元数据不足".Translate(), "确定".Translate(), 3);
return; return;
} }
@@ -286,7 +286,7 @@ public static class TechFunctions
} }
foreach (var techProto in techProtos) foreach (var techProto in techProtos)
{ {
UnlockTechImmediately(techProto, -1, withPrerequisites); UnlockTechImmediately(techProto, toLevel, withPrerequisites);
} }
history.VarifyTechQueue(); history.VarifyTechQueue();
if (history.currentTech != history.techQueue[0]) if (history.currentTech != history.techQueue[0])

View File

@@ -288,7 +288,7 @@ public static class TechPatch
} }
var techProto = __instance.techProto; var techProto = __instance.techProto;
if (techProto == null) return false; if (techProto == null) return false;
Functions.TechFunctions.UnlockProtoWithMetadataAndPrompt([techProto], true); Functions.TechFunctions.UnlockProtoWithMetadataAndPrompt([techProto], -1, true);
return false; return false;
} }
} }