1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-02-04 15:12:17 +08:00

partial fix for new game release

This commit is contained in:
2026-01-22 22:45:02 +08:00
parent 6eb9161af1
commit ed8d7d61ff
6 changed files with 18 additions and 24 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -186,7 +186,7 @@ public class Patch : BaseUnityPlugin, IModCanSave
sorter.stt = sorter.stt * om / nm; sorter.stt = sorter.stt * om / nm;
if (sorter.time > sorter.stt) if (sorter.time > sorter.stt)
{ {
sorter.time = sorter.stt - sorter.speed; sorter.time = sorter.stt - InserterComponent.speed;
} }
if (powerSystem == null) continue; if (powerSystem == null) continue;

View File

@@ -383,8 +383,8 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlanetSimulator), nameof(PlanetSimulator.LateUpdate))] [HarmonyPatch(typeof(PlanetSimulator), nameof(PlanetSimulator.LateRefresh))]
private static IEnumerable<CodeInstruction> PlanetSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlanetSimulator_LateRefresh_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
// var vec = (NightlightEnabled ? GameMain.mainPlayer.transform.up : (Quaternion.Inverse(localPlanet.runtimeRotation) * (__instance.planetData.star.uPosition - __instance.planetData.uPosition).normalized)); // var vec = (NightlightEnabled ? GameMain.mainPlayer.transform.up : (Quaternion.Inverse(localPlanet.runtimeRotation) * (__instance.planetData.star.uPosition - __instance.planetData.uPosition).normalized));
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);
@@ -2153,13 +2153,14 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false, matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldarg_0), new CodeMatch(OpCodes.Ldarg_0),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(LabComponent), nameof(LabComponent.timeSpend))), new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(LabComponent), nameof(LabComponent.recipeExecuteData))),
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(RecipeExecuteData), nameof(RecipeExecuteData.timeSpend))),
new CodeMatch(OpCodes.Ldc_I4, 5400000), new CodeMatch(OpCodes.Ldc_I4, 5400000),
new CodeMatch(ci => ci.opcode == OpCodes.Bgt_S || ci.opcode == OpCodes.Bgt), new CodeMatch(ci => ci.opcode == OpCodes.Bgt_S || ci.opcode == OpCodes.Bgt),
new CodeMatch(OpCodes.Ldc_I4_3) new CodeMatch(OpCodes.Ldc_I4_3)
); );
var extraCount = LabBufferExtraCountForAdvancedAssemble.Value; var extraCount = LabBufferExtraCountForAdvancedAssemble.Value;
matcher.Advance(4).SetAndAdvance(OpCodes.Ldc_I4, extraCount); matcher.Advance(5).SetAndAdvance(OpCodes.Ldc_I4, extraCount);
matcher.MatchForward(false, matcher.MatchForward(false,
new CodeMatch(OpCodes.Div), new CodeMatch(OpCodes.Div),
new CodeMatch(OpCodes.Mul), new CodeMatch(OpCodes.Mul),

View File

@@ -98,10 +98,12 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
Label? jumpPos = null; Label? jumpPos = null;
matcher.MatchForward(false, matcher.MatchForward(false,
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(UIStarmapStar), nameof(UIStarmapStar.projectedCoord))), new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(UIStarmapStar), nameof(UIStarmapStar.projectedCoord))),
new CodeMatch(OpCodes.Ldarg_0)
).Advance(2).MatchForward(false,
new CodeMatch(ci => ci.IsStloc()),
new CodeMatch(ci => ci.IsLdloc()), new CodeMatch(ci => ci.IsLdloc()),
new CodeMatch(ci => ci.Branches(out jumpPos)) new CodeMatch(ci => ci.Branches(out jumpPos))
); ).Advance(3);
matcher.Advance(3);
var labels = matcher.Labels; var labels = matcher.Labels;
matcher.Labels = []; matcher.Labels = [];
matcher.CreateLabel(out var jumpPos2); matcher.CreateLabel(out var jumpPos2);

View File

@@ -19,24 +19,12 @@ public class MyComboBox : MonoBehaviour
{ {
if (_baseObject) return; if (_baseObject) return;
var fontSource = UIRoot.instance.uiGame.buildMenu.uxFacilityCheck.transform.Find("text")?.GetComponent<Text>(); var fontSource = UIRoot.instance.uiGame.buildMenu.uxFacilityCheck.transform.Find("text")?.GetComponent<Text>();
var go = Instantiate(UIRoot.instance.optionWindow.resolutionComp.transform.parent.gameObject); var go = Instantiate(UIRoot.instance.optionWindow.resolutionComp.gameObject);
go.name = "my-combobox"; go.name = "my-combobox";
go.SetActive(false); go.SetActive(false);
var txt = go.GetComponent<Text>();
if (txt) txt.text = "";
if (txt && fontSource)
{
txt.font = fontSource.font;
txt.fontSize = fontSource.fontSize;
txt.fontStyle = fontSource.fontStyle;
txt.color = new Color(1f, 1f, 1f, 0.6f);
}
var localizer = go.GetComponent<Localizer>();
if (localizer) DestroyImmediate(localizer);
var rect = (RectTransform)go.transform; var rect = (RectTransform)go.transform;
var cbctrl = rect.transform.Find("ComboBox").GetComponent<UIComboBox>(); var cbctrl = rect.GetComponent<UIComboBox>();
foreach (var button in cbctrl.ItemButtons) foreach (var button in cbctrl.ItemButtons)
{ {
Destroy(button.gameObject); Destroy(button.gameObject);
@@ -46,13 +34,15 @@ public class MyComboBox : MonoBehaviour
if (fontSource) if (fontSource)
{ {
var txtComp = cbctrl.m_ListItemRes.GetComponentInChildren<Text>(); var txtComp = cbctrl.m_ListItemRes.GetComponentInChildren<Text>();
UXAssist.Logger.LogDebug($"txtComp: [{txtComp}]");
if (txtComp) if (txtComp)
{ {
txtComp.font = fontSource.font; txtComp.font = fontSource.font;
txtComp.fontSize = fontSource.fontSize; txtComp.fontSize = fontSource.fontSize;
txtComp.fontStyle = fontSource.fontStyle; txtComp.fontStyle = fontSource.fontStyle;
} }
txtComp = cbctrl.transform.Find("Main Button")?.GetComponentInChildren<Text>(); txtComp = rect.Find("Main Button/Text")?.GetComponent<Text>();
UXAssist.Logger.LogDebug($"txtComp: [{txtComp}]");
if (txtComp) if (txtComp)
{ {
txtComp.font = fontSource.font; txtComp.font = fontSource.font;
@@ -73,8 +63,9 @@ public class MyComboBox : MonoBehaviour
var cb = gameObject.AddComponent<MyComboBox>(); var cb = gameObject.AddComponent<MyComboBox>();
var rtrans = Util.NormalizeRectWithTopLeft(cb, x, y, parent); var rtrans = Util.NormalizeRectWithTopLeft(cb, x, y, parent);
cb._rectTrans = rtrans; cb._rectTrans = rtrans;
cb._text = gameObject.GetComponent<Text>(); cb._text = gameObject.transform.Find("Main Button/Text")?.GetComponent<Text>();
var box = rtrans.Find("ComboBox").GetComponent<UIComboBox>(); UXAssist.Logger.LogDebug($"cb._text: [{cb._text}]");
var box = rtrans.GetComponent<UIComboBox>();
cb._comboBox = box; cb._comboBox = box;
box.onItemIndexChange.AddListener(() => { cb.OnSelChanged?.Invoke(box.itemIndex); }); box.onItemIndexChange.AddListener(() => { cb.OnSelChanged?.Invoke(box.itemIndex); });
cb.UpdateComboBoxPosition(); cb.UpdateComboBoxPosition();