Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added AssetsEmbedded/mapinfo
Binary file not shown.
31 changes: 30 additions & 1 deletion UnboundLib/Patches/MapLoader.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
using TMPro;

namespace UnboundLib.Patches
{
internal class MapLoaderPatch
{
[HarmonyPatch(typeof (MapManager), "OnLevelFinishedLoading")]
[HarmonyPatch(typeof(MapManager), "OnLevelFinishedLoading")]
private class Patch_OnLevelFinishedLoading
{
private static GameObject _mapInfoPrefab;
private static GameObject MapInfoPrefab
{
get
{
if (_mapInfoPrefab == null)
{
_mapInfoPrefab = Unbound.mapInfoAssets.LoadAsset<GameObject>("Map Info Canvas");
}
return _mapInfoPrefab;
}
}
private static Canvas mapDetailsCanvas;

private static void Prefix(Scene scene, LoadSceneMode mode)
{
var sfPoly = Resources.FindObjectsOfTypeAll<SFPolygon>();
Expand All @@ -32,6 +47,20 @@ private static void Prefix(Scene scene, LoadSceneMode mode)
}
}
}

private static void Postfix(Scene scene, LoadSceneMode mode)
{
// disable canvas in last map
if (mapDetailsCanvas) mapDetailsCanvas.gameObject.SetActive(false);

// create canvas for new map
mapDetailsCanvas = GameObject.Instantiate(MapInfoPrefab).GetComponent<Canvas>();
SceneManager.MoveGameObjectToScene(mapDetailsCanvas.gameObject, scene);

// set level text
var mapName = MapManager.instance.levels[MapManager.instance.currentLevelID];
mapDetailsCanvas.GetComponentInChildren<TextMeshProUGUI>().text = mapName;
}
}
}
}
7 changes: 5 additions & 2 deletions UnboundLib/Unbound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Unbound : BaseUnityPlugin
{
private const string ModId = "com.willis.rounds.unbound";
private const string ModName = "Rounds Unbound";
public const string Version = "3.2.7";
public const string Version = "3.2.8";

public static Unbound Instance { get; private set; }
public static readonly ConfigFile config = new ConfigFile(Path.Combine(Paths.ConfigPath, "UnboundLib.cfg"), true);
Expand Down Expand Up @@ -74,9 +74,11 @@ public const string

public static readonly Dictionary<string, bool> lockInputBools = new Dictionary<string, bool>();

internal static AssetBundle UIAssets;
public static AssetBundle toggleUI;
internal static AssetBundle UIAssets;
internal static AssetBundle linkAssets;
internal static AssetBundle mapInfoAssets;

private static GameObject modalPrefab;

private TextMeshProUGUI text;
Expand Down Expand Up @@ -371,6 +373,7 @@ private static void LoadAssets()
modalPrefab = UIAssets.LoadAsset<GameObject>("Modal");
//Instantiate(UIAssets.LoadAsset<GameObject>("Card Toggle Menu"), canvas.transform).AddComponent<CardToggleMenuHandler>();
}
mapInfoAssets = AssetUtils.LoadAssetBundleFromResources("mapinfo", typeof(Unbound).Assembly);
}

private static void OnJoinedRoomAction()
Expand Down
1 change: 1 addition & 0 deletions UnboundLib/UnboundLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<None Remove="UnboundLib.csproj.user.dist" />
<None Remove="PostBuild.msbuild" />
<None Remove="unboundlinks" />
<EmbeddedResource Include="..\AssetsEmbedded\mapinfo" Link="Assets\mapinfo" />
<None Include="..\README.md" />
<None Include="..\.gitignore" />
</ItemGroup>
Expand Down