-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45c583b
commit 764d8f8
Showing
10 changed files
with
108 additions
and
4 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
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
42 changes: 42 additions & 0 deletions
42
BloonsTD6 Mod Helper/Patches/UpgradeScreen_PopulatePath.cs
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,42 @@ | ||
using Assets.Scripts.Models.Towers; | ||
using Assets.Scripts.Models.Towers.Behaviors.Abilities; | ||
using Assets.Scripts.Unity; | ||
using Assets.Scripts.Unity.UI_New.Upgrade; | ||
using BTD_Mod_Helper.Extensions; | ||
using Harmony; | ||
using Il2CppSystem.Collections.Generic; | ||
using MelonLoader; | ||
using UnhollowerBaseLib; | ||
using UnityEngine; | ||
|
||
namespace BTD_Mod_Helper.Patches | ||
{ | ||
[HarmonyPatch(typeof(UpgradeScreen), nameof(UpgradeScreen.PopulatePath))] | ||
internal class UpgradeScreen_PopulatePath | ||
{ | ||
[HarmonyPostfix] | ||
internal static void Postfix(UpgradeScreen __instance, TowerModel tower, int pathIndex, Il2CppReferenceArray<UpgradeDetails> pathUpgrades) | ||
{ | ||
var modTower = tower.GetModTower(); | ||
if (modTower != null) | ||
{ | ||
var portrait = modTower.GetSpriteReference(modTower.Portrait); | ||
var maxPathTier = modTower.tierMaxes[pathIndex]; | ||
var emptyAbilities = new List<AbilityModel>().Cast<ICollection<AbilityModel>>(); | ||
var upgradeModel = Game.instance.model.GetUpgrade("Faster Throwing"); // random real upgrade to internally use | ||
for (var i = maxPathTier; i < 5; i++) | ||
{ | ||
var upgradeDetails = pathUpgrades[i]; | ||
upgradeDetails.SetUpgrade(tower.baseId, upgradeModel, emptyAbilities, pathIndex, portrait); | ||
upgradeDetails.gameObject.SetActive(false); | ||
|
||
var array = new[] {0, 0, 0}; | ||
array[pathIndex] = i + 1; | ||
|
||
var arrow = __instance.transform.GetComponentFromChildrenByName<RectTransform>($"Arrow{array.Printed()}"); | ||
arrow.gameObject.Hide(); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,31 @@ | ||
using Assets.Scripts.Unity.UI_New.Upgrade; | ||
using BTD_Mod_Helper.Extensions; | ||
using Harmony; | ||
using MelonLoader; | ||
using UnityEngine; | ||
|
||
namespace BTD_Mod_Helper.Patches | ||
{ | ||
[HarmonyPatch(typeof(UpgradeScreen), nameof(UpgradeScreen.UpdateUi))] | ||
internal class UpgradeScreen_UpdateUi | ||
{ | ||
[HarmonyPrefix] | ||
internal static void Prefix(UpgradeScreen __instance) | ||
{ | ||
var bgArrows = __instance.GetComponentFromChildrenByName<RectTransform>("BGArrows"); | ||
foreach (var arrow in bgArrows.GetComponentsInChildren<CanvasRenderer>()) | ||
{ | ||
arrow.gameObject.Show(); | ||
} | ||
} | ||
|
||
[HarmonyPostfix] | ||
internal static void Postfix(UpgradeScreen __instance) | ||
{ | ||
if (!__instance.selectedDetails.gameObject.active) | ||
{ | ||
__instance.SelectUpgrade(__instance.path2Upgrades[0]); | ||
} | ||
} | ||
} | ||
} |