-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from andreharv/BetterEducationToolbarFix
Better education toolbar fix
- Loading branch information
Showing
10 changed files
with
72 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
using HarmonyLib; | ||
using NetworkExtensions; | ||
using System.Reflection; | ||
using HarmonyLib; | ||
|
||
namespace NetworkExtensions2.Patching | ||
{ | ||
internal class Patcher | ||
public static class Patcher | ||
{ | ||
private static Harmony harmony => new Harmony("andreharv.CSL.NetworkExtensions2"); | ||
internal static void PatchAll() | ||
private const string HarmonyId = "boformer.Harmony2Example"; | ||
|
||
private static bool patched = false; | ||
|
||
public static void PatchAll() | ||
{ | ||
CheckBuildPositionPatch.Apply(harmony); | ||
GetLengthSnapPatch.Apply(harmony); | ||
GetCategoryOrderPatch.Apply(harmony); | ||
SpawnButtonEntryPatch.Apply(harmony); | ||
if (patched) return; | ||
|
||
UnityEngine.Debug.Log("Harmony 2 NExt2: Patching..."); | ||
|
||
patched = true; | ||
|
||
// Apply your patches here! | ||
// Harmony.DEBUG = true; | ||
var harmony = new Harmony("andreharv.CSL.NetworkExtensions2"); | ||
harmony.PatchAll(Assembly.GetExecutingAssembly()); | ||
} | ||
internal static void UnpatchAll() | ||
|
||
public static void UnpatchAll() | ||
{ | ||
harmony.UnpatchAll(); | ||
if (!patched) return; | ||
|
||
var harmony = new Harmony(HarmonyId); | ||
harmony.UnpatchAll(HarmonyId); | ||
|
||
patched = false; | ||
|
||
UnityEngine.Debug.Log("Harmony 2 NExt2: Reverted..."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using ColossalFramework; | ||
using ColossalFramework.UI; | ||
using HarmonyLib; | ||
using System; | ||
using System.Reflection; | ||
using Transit.Framework; | ||
using UnityEngine; | ||
|
||
namespace NetworkExtensions2.Patching | ||
{ | ||
[HarmonyPatch(typeof(GeneratedGroupPanel), "CreateGroupItem")] | ||
internal class CreateGroupItemPatch | ||
{ | ||
private static MethodInfo m_spawnButtonEntry = typeof(GeneratedGroupPanel).GetMethod("SpawnButtonEntry", BindingFlags.Instance | BindingFlags.NonPublic, null , new Type[] { typeof(UITabstrip), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool) }, null); | ||
[HarmonyPrefix] | ||
public static bool Prefix(GeneratedGroupPanel __instance, GeneratedGroupPanel.GroupInfo info, string localeID, UITabstrip ___m_Strip) | ||
{ | ||
var argName = info.subPanelType.IsNullOrWhiteSpace() ? __instance.service.Name() : info.subPanelType; | ||
var category = info.name; | ||
var button = (UIButton)m_spawnButtonEntry.Invoke(__instance, new object[] { ___m_Strip, argName, category, false, localeID, info.unlockText, "SubBar", info.isUnlocked, false }); | ||
var customAtlas = AtlasManager.instance.GetAtlas(category); | ||
if (customAtlas != null) | ||
{ | ||
button.atlas = customAtlas; | ||
} | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters