diff --git a/AssetLoadingPatches.cs b/AssetLoadingPatches.cs index 3dfe1db..99a6d0f 100644 --- a/AssetLoadingPatches.cs +++ b/AssetLoadingPatches.cs @@ -8,8 +8,7 @@ public static bool Prefix(ref Factory.__c__DisplayClass21_0 __instance,ref Unity if(towerName!=null&&TowerTypes.ContainsKey(towerName)){ try{ SC2Tower tower=TowerTypes[towerName]; - GameObject gObj=uObject.Instantiate(LoadAsset(__instance.objectId.guidRef,tower.LoadedBundle).Cast(), - __instance.__4__this.DisplayRoot); + GameObject gObj=uObject.Instantiate(LoadAsset(__instance.objectId.guidRef,tower.LoadedBundle),__instance.__4__this.DisplayRoot); gObj.name=__instance.objectId.guidRef; gObj.transform.position=new(0,0,30000); gObj.AddComponent(); @@ -24,7 +23,7 @@ public static bool Prefix(ref Factory.__c__DisplayClass21_0 __instance,ref Unity } return false; } - return true; + return true; } } [HarmonyPatch(typeof(UnityEngine.U2D.SpriteAtlas),"GetSprite")] @@ -37,10 +36,10 @@ public static void Postfix(string name,ref Sprite __result){ }catch{} if(TowerTypes.ContainsKey(towerName)){ try{ - Texture2D texture=LoadAsset(name,TowerTypes[towerName].LoadedBundle).Cast(); + Texture2D texture=LoadAsset(name,TowerTypes[towerName].LoadedBundle); __result=Sprite.Create(texture,new(0,0,texture.width,texture.height),new()); }catch(Exception error){ - PrintError(error,"Failed to set "+name+" up"); + PrintError(error,"Failed to set "+name+" up, Sprite "+(__result==null)); } } } diff --git a/Bundles/heroupgrademenu.bundle b/Bundles/heroupgrademenu.bundle new file mode 100644 index 0000000..f193867 Binary files /dev/null and b/Bundles/heroupgrademenu.bundle differ diff --git a/Bundles/protossupgrademenu.bundle b/Bundles/protossupgrademenu.bundle new file mode 100644 index 0000000..e3f0b0d Binary files /dev/null and b/Bundles/protossupgrademenu.bundle differ diff --git a/Bundles/terranupgrademenu.bundle b/Bundles/terranupgrademenu.bundle new file mode 100644 index 0000000..36eabbd Binary files /dev/null and b/Bundles/terranupgrademenu.bundle differ diff --git a/Bundles/ui.protossupgrademenu.bundle b/Bundles/ui.protossupgrademenu.bundle deleted file mode 100644 index ac3da06..0000000 Binary files a/Bundles/ui.protossupgrademenu.bundle and /dev/null differ diff --git a/Bundles/ui.terranupgrademenu.bundle b/Bundles/ui.terranupgrademenu.bundle deleted file mode 100644 index 5e605ea..0000000 Binary files a/Bundles/ui.terranupgrademenu.bundle and /dev/null differ diff --git a/Extensions.cs b/Extensions.cs index 8bdea3a..dd69f23 100644 --- a/Extensions.cs +++ b/Extensions.cs @@ -16,9 +16,14 @@ public static T GetModel(this Il2CppReferenceArrayarray,string modelNa return null; } } - public static Il2CppReferenceArrayGetModels(this Il2CppReferenceArrayarray)where T:Model{ + public static Il2CppReferenceArrayGetModels(this Il2CppReferenceArrayarray)where T:Model{ try{ - return array.Where(a=>a.GetIl2CppType()==Il2CppType.Of()).ToArray(); + Model[]models=array.Where(a=>a.GetIl2CppType()==Il2CppType.Of()).ToArray(); + Il2CppReferenceArrayreturnArray=new Il2CppReferenceArray(models.Count()); + for(int i=0;i(); + } + return returnArray; }catch(Exception error){ PrintError(error,"Failed to get models "+Il2CppType.Of().Name+" from array"); return null; diff --git a/HeroMenuPatches.cs b/HeroMenuPatches.cs new file mode 100644 index 0000000..e69de29 diff --git a/HeroMenuPatchesOld.cs b/HeroMenuPatchesOld.cs new file mode 100644 index 0000000..6c5e3e2 --- /dev/null +++ b/HeroMenuPatchesOld.cs @@ -0,0 +1,181 @@ +//only left it here in case someone wants to try to understand the vanilla hero screen +/*namespace SC2ExpansionLoader.HeroPatches{ + [HarmonyPatch(typeof(CosmeticHelper),"ApplyTowerSkinToTowerModel")] + public class CosmeticHelperApplyTowerSkinToTowerModel_Patch{ + public static bool Prefix(TowerModel towerModel){ + if(TowerTypes.ContainsKey(towerModel.baseId)){ + return false; + }else{ + return true; + } + } + } + //most of this specific patch is kosmics code, ty for figuring it out + [HarmonyPatch(typeof(HeroUpgradeDetails),"BindDetails")] + public class HeroUpgradeDetailsBindDetails_Patch{ + public static bool Prefix(ref HeroUpgradeDetails __instance,ref bool __result,string heroIdToUse,bool showingSelected,bool forceUpdate){ + if(TowerTypes.ContainsKey(heroIdToUse)){ + try{ + __instance.selectedHeroId=heroIdToUse; + Btd6Player Player=DailyChallengeManager.Player; + __instance.skinData=SkinManager.GetSelectedSkin(Player,__instance.selectedHeroId); + Transform heroBackgroundBannerTransform=__instance.heroBackgroundBanner.transform; + heroBackgroundBannerTransform.DestroyAllChildren(); + SkinData skin=__instance.skinData; + _=ResourceLoader.InstantiateAsync(skin.backgroundBanner.guidRef,heroBackgroundBannerTransform).Result; + __instance.StartBackgroundColourSwap(); + __instance.SetHeroFontMaterial(); + string guidRef=skin.GetPortraitForLevel(__instance.selectedUpgradeIndex+1).guidRef; + ResourceLoader.LoadSpriteFromSpriteReferenceAsync(new(){guidRef=guidRef},__instance.heroPortrait,false); + __instance.selectedHeroPortraitSpriteId.guidRef=guidRef; + __instance.heroName.text=GameMenu.Locs.GetText(__instance.selectedHeroId); + __instance.heroShortDescription.text=GameMenu.Locs.GetText(skin.skinName); + __instance.heroDescription.text=GameMenu.Locs.GetText(skin.description); + __instance.buyHeroButton.gameObject.SetActive(false); + __instance.selectButton.gameObject.SetActive(true); + __instance.inGameCostPanel.SetActive(true); + __instance.heroRequirements.SetActive(false); + __instance.saleObj.SetActive(false); + __instance.saleOrigAmountTxt.gameObject.SetActive(false); + if(Player.Data.primaryHero==__instance.selectedHeroId){ + __instance.selectedText.gameObject.SetActive(true); + __instance.selectButton.gameObject.SetActive(false); + }else{ + __instance.selectedText.gameObject.SetActive(false); + __instance.selectButton.gameObject.SetActive(true); + } + __instance.GetSelectedButton(__instance.selectedHeroId).hasPurchasedHero=true; + __instance.UpdateAllButtons(forceUpdate); + foreach(TextMeshProUGUI cost in __instance.heroCost){ + Log(1); + cost.text=gameModel.GetTowersWithBaseId(heroIdToUse)[0].cost.ToString(); + Log(2); + } + var towers=gameModel.GetTowersWithBaseId(__instance.selectedHeroId); + var upgradeButtons=__instance.heroUpgrades; + for(int i=0;i=towers.Count){ + tower=towers[i]; + }else{ + tower=towers[i+1]; + } + if(tower.GetDescendant()!=null){ + Log("ability"); + Log(tower.name+" "+tower.GetDescendants().Last().addedViaUpgrade); + if(tower.GetDescendants().Last().addedViaUpgrade.Split(' ')[2]==(i+1).ToString()){ + Log("ability1"); + upgradeButtons[i].Init(__instance.selectedHeroId,i+1,tower.GetDescendants().Last(),__instance.selectedUpgradeIndex==i,tower.portrait,null,__instance); + } + }else{ + Log("no ability"); + upgradeButtons[i].Init(__instance.selectedHeroId,i+1,null,__instance.selectedUpgradeIndex==i,tower.portrait,null,__instance); + } + } + }catch(Exception error){ + Log("Is addedViaUpgrade missing?"); + PrintError(error); + } + __result=true; + return false; + } + return true; + } + } + [HarmonyPatch(typeof(HeroUpgradeDetails),"SetupButtonsPanel")] + public class HeroUpgradeDetailsSetupButtonsPanel_Patch{ + public static bool Prefix(ref HeroUpgradeDetails __instance){ + try{ + var selectedHeroes=__instance.selectedHeroes=new(); + __instance.sortedTowers.Clear(); + var heroButtons=__instance.heroButtons; + foreach(var heroButton in heroButtons){ + __instance.unusedHeroButtons.Add(heroButton); + heroButton.gameObject.SetActive(false); + } + __instance.SortHerosByUnlockLevel(); + foreach(SC2Tower tower in HeroTypes.Values){ + if(!selectedHeroes.Contains(tower.HeroDetails)){ + selectedHeroes.Add(tower.HeroDetails); + } + } + foreach(var thing in selectedHeroes){ + var limitedHeroSelection=__instance.limitedHeroSelection; + if(limitedHeroSelection!=null&&limitedHeroSelection.Contains(thing.towerId)){ + break; + } + var NextButton=__instance.GetNextButton(); + heroButtons.Add(NextButton); + NextButton.gameObject.SetActive(true); + NextButton.Init(__instance,thing,thing.monkeyMoneyCost,false,false); + } + }catch(Exception error){ + PrintError(error); + } + return false; + } + } + [HarmonyPatch(typeof(HeroInGameScreen),"Open")] + public class HeroInGameScreenOpen_Patch{ + public static bool Prefix(ref HeroInGameScreen __instance,Il2CppSystem.Object data){ + var heroData=data.Cast>(); + if(HeroTypes.ContainsKey(heroData.Item1)){ + try{ + __instance.heroId=heroData.Item1; + __instance.selectedHero=heroData.Item2; + var instance=InGame.instance; + var bridge=instance.bridge; + bridge.GetFirstTowerWithBaseID(__instance.heroId,bridge.GetInputId()); + __instance.UpdateDisplay(0); + __instance.unlockHeroPanel.SetActive(false); + __instance.heroName.text=LocManager.GetText(__instance.heroId); + __instance.skinData=SkinManager.GetSkin(DailyChallengeManager.Player.GetSelectedTowerSkin(__instance.heroId)); + var skinData=__instance.skinData; + __instance.StartBackgroundColourSwap(skinData); + __instance.SetHeroFontMaterial(); + __instance.heroShortDescription.text=LocManager.GetText(skinData.skinName); + __instance.heroDescription.text=LocManager.GetText(skinData.description); + var towers=gameModel.GetTowersWithBaseId(__instance.heroId); + var upgradeButtons=__instance.heroUpgrades; + for(int i=0;i=towers.Count){ + tower=towers[i]; + }else{ + tower=towers[i+1]; + } + if(tower.GetDescendant()!=null&&tower.GetDescendants().Last().addedViaUpgrade.Split(' ')[2]==(i+1).ToString()){ + upgradeButtons[i].Init(__instance.heroId,i+1,tower.GetDescendants().Last(),__instance.selectedUpgradeIndex==i,tower.portrait); + }else{ + upgradeButtons[i].Init(__instance.heroId,i+1,null,__instance.selectedUpgradeIndex==i,tower.portrait); + } + } + __instance.heroBoosterCaveatTxt.text=LocManager.GetText("Applies For This Game Only"); + NavigationExt.LinkVertical(upgradeButtons[0].transform.parent); + }catch(Exception error){ + PrintError(error); + } + return false; + } + return true; + } + [HarmonyPatch(typeof(HeroUpgradeButton),"Highlight")] + public class HeroUpgradeButtonHighlight_Patch{ + public static bool Prefix(ref HeroUpgradeButton __instance){ + string guid=__instance.portraitSprite.guidRef; + try{ + guid=guid.Split('[')[1].Split(']')[0].Split('-')[0]; + if(HeroTypes.ContainsKey(guid)){ + if(__instance.highlightEffect.activeSelf==false){ + __instance.highlightEffect.SetActive(true); + }else{ + __instance.highlightEffect.SetActive(false); + } + return false; + } + }catch{} + return true; + } + } + } +}*/ \ No newline at end of file diff --git a/HeroPatches.cs b/HeroPatches.cs deleted file mode 100644 index c964337..0000000 --- a/HeroPatches.cs +++ /dev/null @@ -1,171 +0,0 @@ -namespace SC2ExpansionLoader.HeroPatches{ - [HarmonyPatch(typeof(CosmeticHelper),"ApplyTowerSkinToTowerModel")] - public class CosmeticHelperApplyTowerSkinToTowerModel_Patch{ - public static bool Prefix(TowerModel towerModel){ - if(TowerTypes.ContainsKey(towerModel.baseId)){ - return false; - }else{ - return true; - } - } - } - //most of this specific patch is kosmics code, ty for figuring it out - [HarmonyPatch(typeof(HeroUpgradeDetails),"BindDetails")] - public class HeroUpgradeDetailsBindDetails_Patch{ - public static bool Prefix(ref HeroUpgradeDetails __instance,ref bool __result,string heroIdToUse,bool showingSelected,bool forceUpdate){ - if(TowerTypes.ContainsKey(heroIdToUse)){ - try{ - __instance.selectedHeroId=heroIdToUse; - Btd6Player Player=DailyChallengeManager.Player; - __instance.skinData=SkinManager.GetSelectedSkin(Player,__instance.selectedHeroId); - Transform heroBackgroundBannerTransform=__instance.heroBackgroundBanner.transform; - heroBackgroundBannerTransform.DestroyAllChildren(); - SkinData skin=__instance.skinData; - _=ResourceLoader.InstantiateAsync(skin.backgroundBanner.guidRef,heroBackgroundBannerTransform).Result; - __instance.StartBackgroundColourSwap(); - __instance.SetHeroFontMaterial(); - string guidRef=skin.GetPortraitForLevel(__instance.selectedUpgradeIndex+1).guidRef; - ResourceLoader.LoadSpriteFromSpriteReferenceAsync(new(){guidRef=guidRef},__instance.heroPortrait,false); - __instance.selectedHeroPortraitSpriteId.guidRef=guidRef; - __instance.heroName.text=GameMenu.Locs.GetText(__instance.selectedHeroId); - __instance.heroShortDescription.text=GameMenu.Locs.GetText(skin.skinName); - __instance.heroDescription.text=GameMenu.Locs.GetText(skin.description); - __instance.buyHeroButton.gameObject.SetActive(false); - __instance.selectButton.gameObject.SetActive(true); - __instance.inGameCostPanel.SetActive(true); - __instance.heroRequirements.SetActive(false); - __instance.saleObj.SetActive(false); - __instance.saleOrigAmountTxt.gameObject.SetActive(false); - if(Player.Data.primaryHero==__instance.selectedHeroId){ - __instance.selectedText.gameObject.SetActive(true); - __instance.selectButton.gameObject.SetActive(false); - }else{ - __instance.selectedText.gameObject.SetActive(false); - __instance.selectButton.gameObject.SetActive(true); - } - __instance.GetSelectedButton(__instance.selectedHeroId).hasPurchasedHero=true; - __instance.UpdateAllButtons(forceUpdate); - foreach(TextMeshProUGUI cost in __instance.heroCost){ - cost.text=gameModel.GetTowersWithBaseId(heroIdToUse)[0].cost.ToString(); - } - var towers=gameModel.GetTowersWithBaseId(__instance.selectedHeroId); - var upgradeButtons=__instance.heroUpgrades; - for(int i=0;i=towers.Count){ - tower=towers[i]; - }else{ - tower=towers[i+1]; - } - if(tower.GetDescendant()!=null&&tower.GetDescendants().Last().addedViaUpgrade.Split(' ')[2]==(i+1).ToString()){ - upgradeButtons[i].Init(__instance.selectedHeroId,i+1,tower.GetDescendants().Last(),__instance.selectedUpgradeIndex==i,tower.portrait,null,__instance); - }else{ - upgradeButtons[i].Init(__instance.selectedHeroId,i+1,null,__instance.selectedUpgradeIndex==i,tower.portrait,null,__instance); - } - } - }catch(Exception error){ - PrintError(error); - } - __result=true; - return false; - } - return true; - } - } - [HarmonyPatch(typeof(HeroUpgradeDetails),"SetupButtonsPanel")] - public class HeroUpgradeDetailsSetupButtonsPanel_Patch{ - public static bool Prefix(ref HeroUpgradeDetails __instance){ - try{ - var selectedHeroes=__instance.selectedHeroes=new(); - __instance.sortedTowers.Clear(); - var heroButtons=__instance.heroButtons; - foreach(var heroButton in heroButtons){ - __instance.unusedHeroButtons.Add(heroButton); - heroButton.gameObject.SetActive(false); - } - __instance.SortHerosByUnlockLevel(); - foreach(SC2Tower tower in HeroTypes.Values){ - if(!selectedHeroes.Contains(tower.HeroDetails)){ - selectedHeroes.Add(tower.HeroDetails); - } - } - foreach(var thing in selectedHeroes){ - var limitedHeroSelection=__instance.limitedHeroSelection; - if(limitedHeroSelection!=null&&limitedHeroSelection.Contains(thing.towerId)){ - break; - } - var NextButton=__instance.GetNextButton(); - heroButtons.Add(NextButton); - NextButton.gameObject.SetActive(true); - NextButton.Init(__instance,thing,thing.monkeyMoneyCost,false,false); - } - }catch(Exception error){ - PrintError(error); - } - return false; - } - } - [HarmonyPatch(typeof(HeroInGameScreen),"Open")] - public class HeroInGameScreenOpen_Patch{ - public static bool Prefix(ref HeroInGameScreen __instance,Il2CppSystem.Object data){ - var heroData=data.Cast>(); - if(HeroTypes.ContainsKey(heroData.Item1)){ - try{ - __instance.heroId=heroData.Item1; - __instance.selectedHero=heroData.Item2; - var instance=InGame.instance; - var bridge=instance.bridge; - bridge.GetFirstTowerWithBaseID(__instance.heroId,bridge.GetInputId()); - __instance.UpdateDisplay(0); - __instance.unlockHeroPanel.SetActive(false); - __instance.heroName.text=LocManager.GetText(__instance.heroId); - __instance.skinData=SkinManager.GetSkin(DailyChallengeManager.Player.GetSelectedTowerSkin(__instance.heroId)); - var skinData=__instance.skinData; - __instance.StartBackgroundColourSwap(skinData); - __instance.SetHeroFontMaterial(); - __instance.heroShortDescription.text=LocManager.GetText(skinData.skinName); - __instance.heroDescription.text=LocManager.GetText(skinData.description); - var towers=gameModel.GetTowersWithBaseId(__instance.heroId); - var upgradeButtons=__instance.heroUpgrades; - for(int i=0;i=towers.Count){ - tower=towers[i]; - }else{ - tower=towers[i+1]; - } - if(tower.GetDescendant()!=null&&tower.GetDescendants().Last().addedViaUpgrade.Split(' ')[2]==(i+1).ToString()){ - upgradeButtons[i].Init(__instance.heroId,i+1,tower.GetDescendants().Last(),__instance.selectedUpgradeIndex==i,tower.portrait); - }else{ - upgradeButtons[i].Init(__instance.heroId,i+1,null,__instance.selectedUpgradeIndex==i,tower.portrait); - } - } - __instance.heroBoosterCaveatTxt.text=LocManager.GetText("Applies For This Game Only"); - NavigationExt.LinkVertical(upgradeButtons[0].transform.parent); - }catch(Exception error){ - PrintError(error); - } - return false; - } - return true; - } - } - [HarmonyPatch(typeof(HeroUpgradeButton),"Highlight")] - public class HeroUpgradeButtonHighlight_Patch{ - public static bool Prefix(ref HeroUpgradeButton __instance){ - string guid=__instance.portraitSprite.guidRef; - try{ - guid=guid.Split('[')[1].Split(']')[0].Split('-')[0]; - if(HeroTypes.ContainsKey(guid)){ - if(__instance.highlightEffect.activeSelf==false){ - __instance.highlightEffect.SetActive(true); - }else{ - __instance.highlightEffect.SetActive(false); - } - return false; - } - }catch{} - return true; - } - } -} \ No newline at end of file diff --git a/ModHelperData.cs b/ModHelperData.cs index f8c089f..cd935c4 100644 --- a/ModHelperData.cs +++ b/ModHelperData.cs @@ -1,7 +1,7 @@ namespace SC2ExpansionLoader{ public static class ModHelperData{ public const string WorksOnVersion="34.3"; - public const string Version="2.6.1"; + public const string Version="2.7.0"; public const string Name="SC2ExpansionLoader"; public const string Description="Loader for any SC2Expansion mods, this mod adds nothing by itself. Will be automatically downloaded if required"; public const string RepoOwner = "Onixiya"; diff --git a/ModMain.cs b/ModMain.cs index 782f3d9..d5adc9a 100755 --- a/ModMain.cs +++ b/ModMain.cs @@ -1,9 +1,10 @@ [assembly:MelonGame("Ninja Kiwi","BloonsTD6")] [assembly:MelonInfo(typeof(SC2ExpansionLoader.ModMain),ModHelperData.Name,ModHelperData.Version,"Silentstorm")] +[assembly:MelonOptionalDependencies("SC2ExpansionLoader")] namespace SC2ExpansionLoader{ public class ModMain:MelonMod{ public static DictionaryTowerTypes=new Dictionary(); - public static DictionaryHeroTypes=new Dictionary(); + //public static DictionaryHeroTypes=new Dictionary(); public static AbilityModel BlankAbilityModel; private static MelonLogger.Instance mllog; public static string BundleDir; @@ -31,10 +32,11 @@ public override void OnInitializeMelon(){ Directory.CreateDirectory(BundleDir); } ListtowerList=new(); - foreach(MelonMod mod in RegisteredMelons){ - if(mod.Info.Name.StartsWith("SC2Expansion")){ - Assembly assembly=mod.MelonAssembly.Assembly; - foreach(string bundle in assembly.GetManifestResourceNames()){ + foreach(MelonMod mod in RegisteredMelons.Where(a=>a.OptionalDependencies!=null&&a.OptionalDependencies.AssemblyNames.Contains("SC2ExpansionLoader"))){ + Assembly assembly=mod.MelonAssembly.Assembly; + string[]resources=assembly.GetManifestResourceNames(); + if(resources.Count()>0){ + foreach(string bundle in resources){ try{ if(bundle.EndsWith(".bundle")){ Stream stream=assembly.GetManifestResourceStream(bundle); @@ -46,23 +48,24 @@ public override void OnInitializeMelon(){ PrintError(error,"Failed to write "+bundle); } } - foreach(Type type in assembly.GetTypes()){ - try{ - SC2Tower tower=(SC2Tower)Activator.CreateInstance(type); - if(tower.Name!=""){ - towerList.Add(tower); - if(tower.HasBundle){ - tower.LoadedBundle=UnityEngine.AssetBundle.LoadFromFileAsync(BundleDir+tower.Name.ToLower()).assetBundle; - } - if(tower.Hero){ - HeroTypes.Add(tower.Name,tower); - } + } + foreach(Type type in assembly.GetTypes()){ + try{ + SC2Tower tower=(SC2Tower)Activator.CreateInstance(type); + if(tower.Name!=""&&!tower.Hero){ + towerList.Add(tower); + if(tower.HasBundle){ + tower.LoadedBundle=UnityEngine.AssetBundle.LoadFromFileAsync(BundleDir+tower.Name).assetBundle; } - }catch{} - } + if(tower.Hero){ + //HeroTypes.Add(tower.Name,tower); + Log("Custom heroes are currently not supported due to a bug"); + } + } + }catch{} } } - //i really cannot think of any better way to sort a this, orderby from a dictionary itself fucks it over + //i really cannot think of any better way to sort this, orderby from a dictionary itself fucks it over if(towerList.Count()>0){ towerList=towerList.OrderBy(a=>a.Order).ToList(); foreach(SC2Tower tower in towerList){ @@ -82,24 +85,17 @@ public static void PrintError(Exception exception,string message=null){ public static T LoadAsset(string Asset,AssetBundle Bundle)where T:uObject{ try{ return Bundle.LoadAssetAsync(Asset,Il2CppType.Of()).asset.Cast(); - }catch{ - foreach(KeyValuePairtower in TowerTypes){ - tower.Value.LoadedBundle=UnityEngine.AssetBundle.LoadFromFileAsync(BundleDir+tower.Key.ToLower()).assetBundle; - } + }catch(Exception error){ + PrintError(error,"Failed to load "+Asset); try{ - return Bundle.LoadAssetAsync(Asset,Il2CppType.Of()).asset.Cast(); - }catch(Exception error){ - PrintError(error,"Failed to load "+Asset+" from "+Bundle.name); - try{ - Log("Attempting to get available assets"); - foreach(string asset in Bundle.GetAllAssetNames()){ - Log(asset); - } - }catch{ - Log("Bundle is null"); + Log("Attempting to get available assets"); + foreach(string asset in Bundle.GetAllAssetNames()){ + Log(asset); } - return null; + }catch{ + Log("Bundle is null"); } + return null; } } public static void PlaySound(string name){ diff --git a/SC2ExpansionLoader.csproj b/SC2ExpansionLoader.csproj index 4095756..24b28a8 100755 --- a/SC2ExpansionLoader.csproj +++ b/SC2ExpansionLoader.csproj @@ -72,7 +72,7 @@ /home/silentstorm/.steam/steam/steamapps/common/BloonsTD6/MelonLoader/Il2CppAssemblies/Unity.ResourceManager.dll - - + + \ No newline at end of file diff --git a/SC2Tower.cs b/SC2Tower.cs index 5c6ce0d..6cba327 100755 --- a/SC2Tower.cs +++ b/SC2Tower.cs @@ -8,7 +8,6 @@ public class SC2Tower{ public virtual TowerModel[]GenerateTowerModels()=>null; public TowerModel[]TowerModels=null; public virtual int MaxTier=>0; - public virtual string Description=>""; public virtual UpgradeModel[]GenerateUpgradeModels()=>null; public UpgradeModel[]UpgradeModels=null; public AssetBundle LoadedBundle=null; @@ -34,6 +33,7 @@ public enum Faction{ Protoss, Terran, Zerg, + Misc, NotSet } public virtual Faction TowerFaction=>Faction.NotSet; diff --git a/UpgradeMenu.cs b/UpgradeMenu.cs index 3f3d7ef..15b164c 100644 --- a/UpgradeMenu.cs +++ b/UpgradeMenu.cs @@ -54,16 +54,16 @@ void Start(){ public class UpgradeMenuCom:MonoBehaviour{ public UpgradeMenuCom(IntPtr ptr):base(ptr){} public SC2Tower CurrentTower; - public Il2CppTMPro.TextMeshProUGUI Title; - public Il2CppTMPro.TextMeshProUGUI Description; - public Il2CppTMPro.TextMeshProUGUI Cost; - public Il2CppTMPro.TextMeshProUGUI UpgradeDescription; + public NK_TextMeshProUGUI Title; + public NK_TextMeshProUGUI Description; + public NK_TextMeshProUGUI Cost; + public NK_TextMeshProUGUI UpgradeDescription; public Image Portrait; public List