Skip to content

Commit

Permalink
v2.6.1 fixes Dubs Performance Analyzer 'optimize labels' bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed Oct 2, 2023
1 parent 95a8541 commit 0a7282f
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
Binary file modified 1.4/Assemblies/CameraPlus.dll
Binary file not shown.
4 changes: 3 additions & 1 deletion About/About.xml
Expand Up @@ -18,7 +18,9 @@
</li>
</modDependencies>
<packageId>brrainz.cameraplus</packageId>
<modVersion>2.6.0.0</modVersion>
<modVersion>2.6.1.0</modVersion>
<steamAppId>867467808</steamAppId>
<url>https://github.com/pardeike/CameraPlus</url>
<description>You want more zoom and different paning?

Powered by Harmony Patch Library
Expand Down
2 changes: 1 addition & 1 deletion About/Manifest.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>net.pardeike.rimworld.mod.cameraplus</identifier>
<version>2.6.0.0</version>
<version>2.6.1.0</version>
<targetVersions>
<li>1.0.0</li>
<li>1.1.0</li>
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
@@ -1,10 +1,10 @@
<Project>
<Project>

<PropertyGroup>
<ModName>Camera+</ModName>
<ModFileName>CameraPlus</ModFileName>
<Repository>https://github.com/pardeike/CameraPlus</Repository>
<ModVersion>2.6.0.0</ModVersion>
<ModVersion>2.6.1.0</ModVersion>
<ProjectGuid>{AC5EE7A1-16EA-498D-B21A-83ACF78F0E5A}</ProjectGuid>
</PropertyGroup>

Expand Down
27 changes: 22 additions & 5 deletions Source/Main.cs
Expand Up @@ -18,7 +18,7 @@ public static class Defs
public static SoundDef SnapBack;
public static SoundDef ApplySnap;
}

public class CameraPlusMain : Mod
{
public static CameraPlusSettings Settings;
Expand Down Expand Up @@ -212,6 +212,20 @@ public static bool Prefix(Pawn ___pawn)
return Tools.CorrectLabelRendering(___pawn);
}
}
//
// Dubs Performance Analyzer patch on PawnUIOverlay.DrawPawnGUIOverlay needs to be turned off
//
[HarmonyPatch]
static class Analyzer_Fixes_H_DrawNamesFix_Prefix_Patch
{
public static bool Prepare() => TargetMethod() != null;
public static MethodInfo TargetMethod() => AccessTools.Method("Analyzer.Fixes.H_DrawNamesFix:Prefix");
public static bool Prefix(ref bool __result)
{
__result = true;
return false;
}
}

[HarmonyPatch(typeof(GenMapUI), nameof(GenMapUI.DrawPawnLabel))]
[HarmonyPatch(new Type[] { typeof(Pawn), typeof(Vector2), typeof(float), typeof(float), typeof(Dictionary<string, string>), typeof(GameFont), typeof(bool), typeof(bool) })]
Expand Down Expand Up @@ -451,17 +465,20 @@ static class Map_MapUpdate_Patch
static FieldInfo PlanetMaterialField(string typeName)
{
var type = AccessTools.TypeByName($"SaveOurShip2.{typeName}");
if (type == null) return null;
if (type == null)
return null;
return AccessTools.Field(type, "PlanetMaterial");
}

static void FixSoSMaterial()
{
done = true;
var fPlanetMaterial = PlanetMaterialField("RenderPlanetBehindMap") ?? PlanetMaterialField("ResourceBank");
if (fPlanetMaterial == null) return;
if (fPlanetMaterial == null)
return;
var mat = fPlanetMaterial.GetValue(null) as Material;
if (mat == null) return;
if (mat == null)
return;
mat.mainTextureOffset = new Vector2(0.3f, 0.3f);
mat.mainTextureScale = new Vector2(0.4f, 0.4f);
}
Expand All @@ -477,7 +494,7 @@ public static void Postfix(Map __instance)
FixSoSMaterial();
}
}

[HarmonyPatch(typeof(KeyBindingDef))]
[HarmonyPatch(nameof(KeyBindingDef.KeyDownEvent))]
[HarmonyPatch(MethodType.Getter)]
Expand Down
4 changes: 1 addition & 3 deletions Source/Tools.cs
Expand Up @@ -3,10 +3,8 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using UnityEngine;
using Verse;
using Verse.Noise;
using Verse.Sound;

namespace CameraPlus
Expand Down Expand Up @@ -370,7 +368,7 @@ public static void KeySettingsButton(Rect rect, bool allKeys, KeyCode setting, K

static Vector3 snapbackRootPos;
static float snapbackRootSize = 0;

public static void CreateSnapback()
{
Defs.SnapBack.PlayOneShotOnCamera(null);
Expand Down

0 comments on commit 0a7282f

Please sign in to comment.