upscaled cursors
@@ -1646,8 +1646,8 @@ public static class FactoryPatch
|
||||
ID = 301,
|
||||
Name = "存储单元",
|
||||
GridIndex = 3601,
|
||||
IconPath = "assets/memory.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/memory.png"),
|
||||
IconPath = "assets/signal/memory.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/signal/memory.png"),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1655,8 +1655,8 @@ public static class FactoryPatch
|
||||
ID = 302,
|
||||
Name = "能量碎片",
|
||||
GridIndex = 3602,
|
||||
IconPath = "assets/energy-fragment.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/energy-fragment.png"),
|
||||
IconPath = "assets/signal/energy-fragment.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/signal/energy-fragment.png"),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1664,8 +1664,8 @@ public static class FactoryPatch
|
||||
ID = 303,
|
||||
Name = "硅基神经元",
|
||||
GridIndex = 3603,
|
||||
IconPath = "assets/silicon-neuron.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/silicon-neuron.png"),
|
||||
IconPath = "assets/signal/silicon-neuron.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/signal/silicon-neuron.png"),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1673,8 +1673,8 @@ public static class FactoryPatch
|
||||
ID = 304,
|
||||
Name = "负熵奇点",
|
||||
GridIndex = 3604,
|
||||
IconPath = "Assets/negentropy.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/negentropy.png"),
|
||||
IconPath = "assets/signal/negentropy.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/signal/negentropy.png"),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1682,8 +1682,8 @@ public static class FactoryPatch
|
||||
ID = 305,
|
||||
Name = "物质重组器",
|
||||
GridIndex = 3605,
|
||||
IconPath = "assets/reassembler.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/reassembler.png"),
|
||||
IconPath = "assets/signal/reassembler.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/signal/reassembler.png"),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1691,8 +1691,8 @@ public static class FactoryPatch
|
||||
ID = 306,
|
||||
Name = "虚粒子",
|
||||
GridIndex = 3606,
|
||||
IconPath = "assets/virtual-particle.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/virtual-particle.png"),
|
||||
IconPath = "assets/signal/virtual-particle.png",
|
||||
_iconSprite = Util.LoadSprite($"{pluginfolder}/assets/signal/virtual-particle.png"),
|
||||
SID = ""
|
||||
},
|
||||
];
|
||||
|
||||
@@ -55,7 +55,7 @@ public static class GamePatch
|
||||
LoadLastWindowRectEnabled.SettingChanged += (_, _) => LoadLastWindowRect.Enable(LoadLastWindowRectEnabled.Value);
|
||||
MouseCursorScaleUpMultiplier.SettingChanged += (_, _) =>
|
||||
{
|
||||
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1);
|
||||
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1, true);
|
||||
};
|
||||
// AutoSaveOptEnabled.SettingChanged += (_, _) => AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
|
||||
ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
||||
@@ -69,7 +69,7 @@ public static class GamePatch
|
||||
};
|
||||
EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
||||
LoadLastWindowRect.Enable(LoadLastWindowRectEnabled.Value);
|
||||
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1);
|
||||
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1, false);
|
||||
// AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
|
||||
ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
||||
_gamePatch ??= Harmony.CreateAndPatchAll(typeof(GamePatch));
|
||||
@@ -79,7 +79,7 @@ public static class GamePatch
|
||||
{
|
||||
LoadLastWindowRect.Enable(false);
|
||||
EnableWindowResize.Enable(false);
|
||||
MouseCursorScaleUp.Enable(false);
|
||||
MouseCursorScaleUp.Enable(false, false);
|
||||
// AutoSaveOpt.Enable(false);
|
||||
ConvertSavesFromPeace.Enable(false);
|
||||
_gamePatch?.UnpatchSelf();
|
||||
@@ -500,11 +500,12 @@ public static class GamePatch
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool on)
|
||||
public static void Enable(bool on, bool reload)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(MouseCursorScaleUp));
|
||||
if (!reload) return;
|
||||
if (!UICursor.loaded) return;
|
||||
UICursor.loaded = false;
|
||||
UICursor.LoadCursors();
|
||||
@@ -513,6 +514,7 @@ public static class GamePatch
|
||||
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
if (!reload) return;
|
||||
if (!UICursor.loaded) return;
|
||||
UICursor.loaded = false;
|
||||
UICursor.LoadCursors();
|
||||
@@ -524,20 +526,60 @@ public static class GamePatch
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.Start().MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldc_I4_S),
|
||||
new CodeMatch(OpCodes.Newarr)
|
||||
);
|
||||
var startPos = matcher.Pos;
|
||||
matcher.Advance(2).MatchForward(false,
|
||||
new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.cursorTexs)))
|
||||
);
|
||||
var endPos = matcher.Pos + 1;
|
||||
matcher.Start().Advance(startPos).RemoveInstructions(endPos - startPos);
|
||||
matcher.InsertAndAdvance(
|
||||
Transpilers.EmitDelegate(() =>
|
||||
{
|
||||
var pluginfolder = Util.PluginFolder;
|
||||
UICursor.cursorTexs =
|
||||
[
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-transfer.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-in.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-out.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-a.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-b.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-ban.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-delete.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-reform.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-dyson-node-create.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-painter.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-eyedropper.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-eraser.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-upgrade.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-downgrade.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-blank.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-remove.png")
|
||||
];
|
||||
})
|
||||
);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.cursorHots))),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.loaded)))
|
||||
).InsertAndAdvance(
|
||||
).Advance(1).InsertAndAdvance(
|
||||
Transpilers.EmitDelegate(() =>
|
||||
{
|
||||
var multiplier = MouseCursorScaleUpMultiplier.Value;
|
||||
if (multiplier <= 1) return;
|
||||
for (var i = 0; i < UICursor.cursorTexs.Length; i++)
|
||||
{
|
||||
var cursor = UICursor.cursorTexs[i];
|
||||
if (cursor == null) continue;
|
||||
UICursor.cursorTexs[i] = ResizeTexture2D(cursor, cursor.width * multiplier, cursor.height * multiplier);
|
||||
var newWidth = 32 * multiplier;
|
||||
var newHeight = 32 * multiplier;
|
||||
if (cursor.width == newWidth && cursor.height == newHeight) continue;
|
||||
UICursor.cursorTexs[i] = ResizeTexture2D(cursor, 32 * multiplier, 32 * multiplier);
|
||||
}
|
||||
|
||||
if (multiplier <= 1) return;
|
||||
for (var i = UICursor.cursorHots.Length - 1; i >= 0; i--)
|
||||
{
|
||||
UICursor.cursorHots[i] = new Vector2(UICursor.cursorHots[i].x * multiplier, UICursor.cursorHots[i].y * multiplier);
|
||||
@@ -559,7 +601,7 @@ public static class GamePatch
|
||||
RenderTexture.active = rt;
|
||||
Graphics.Blit(texture2D, rt);
|
||||
rt.ResolveAntiAliasedSurface();
|
||||
var result = new Texture2D(targetWidth, targetHeight, texture2D.format, texture2D.mipmapCount > 1);
|
||||
var result = new Texture2D(targetWidth, targetHeight, texture2D.format, false);
|
||||
result.ReadPixels(new Rect(0, 0, targetWidth, targetHeight), 0, 0);
|
||||
result.Apply();
|
||||
RenderTexture.active = oldActive;
|
||||
|
||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 634 B After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 597 B After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 12 KiB |