Add flag to show in all replays
This commit is contained in:
parent
4371b20c87
commit
5802f3e414
2 changed files with 32 additions and 0 deletions
|
@ -18,6 +18,7 @@ namespace CustomCosmeticLoader
|
|||
public const string PROPERTY_SKIN_NAME_TO_HIJACK = "skinNameToHijack";
|
||||
public const string PROPERTY_IN_MAIN_MENU = "inMainMenu";
|
||||
public const string PROPERTY_IN_COSMETIC_MENU = "inCosmeticMenu";
|
||||
public const string PROPERTY_IN_ALL_REPLAYS = "inAllReplays";
|
||||
public const string PROPERTY_OTHER_PLAYERS = "otherPlayers";
|
||||
|
||||
public static bool enabled = true;
|
||||
|
@ -25,6 +26,7 @@ namespace CustomCosmeticLoader
|
|||
public static string skinNameToHijack = "Swirl_M"; // Mirage, simple skin with nice properties
|
||||
public static bool inMainMenu = true;
|
||||
public static bool inCosmeticMenu = false;
|
||||
public static bool inAllReplays = false;
|
||||
public static Dictionary<string, string> otherPlayers = new Dictionary<string, string>();
|
||||
|
||||
public static Dictionary<string, Texture2D> skins = new Dictionary<string, Texture2D>();
|
||||
|
@ -78,6 +80,9 @@ namespace CustomCosmeticLoader
|
|||
if (data[PROPERTY_IN_COSMETIC_MENU] != null)
|
||||
inCosmeticMenu = data[PROPERTY_IN_COSMETIC_MENU].AsBool;
|
||||
|
||||
if (data[PROPERTY_IN_ALL_REPLAYS] != null)
|
||||
inAllReplays = data[PROPERTY_IN_ALL_REPLAYS].AsBool;
|
||||
|
||||
if (data[PROPERTY_OTHER_PLAYERS] != null)
|
||||
{
|
||||
JSONClass otherPlayersData = data[PROPERTY_OTHER_PLAYERS].AsObject;
|
||||
|
@ -110,6 +115,7 @@ namespace CustomCosmeticLoader
|
|||
{ PROPERTY_SKIN_NAME_TO_HIJACK, skinNameToHijack },
|
||||
{ PROPERTY_IN_MAIN_MENU, inMainMenu ? "true" : "false" },
|
||||
{ PROPERTY_IN_COSMETIC_MENU, inCosmeticMenu ? "true" : "false" },
|
||||
{ PROPERTY_IN_ALL_REPLAYS, inAllReplays ? "true" : "false" },
|
||||
};
|
||||
|
||||
JSONNode otherPlayersData = new JSONClass();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using HarmonyLib;
|
||||
using MIU;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -31,4 +32,29 @@ namespace CustomCosmeticLoader.Patches
|
|||
mHolder.CosmeticSet.skin = actualSkinId;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Hijack the cosmetic of the marble when watching Replays. This doesn't apply the custom texture, just swaps out
|
||||
* the marble with the designated marble to hijack.
|
||||
*/
|
||||
[HarmonyPatch(typeof(MarbleController), nameof(MarbleController.ApplyCosmetics))]
|
||||
internal class MarbleControllerApplyCosmeticsPatch
|
||||
{
|
||||
static void Postfix(MarbleController __instance, ReplayCosmetics cosmetics)
|
||||
{
|
||||
if (!Config.enabled)
|
||||
return;
|
||||
|
||||
if (Config.skinNameToHijack == "*")
|
||||
return;
|
||||
|
||||
if (!Config.inAllReplays)
|
||||
return;
|
||||
|
||||
MarbleHolder mHolder = __instance.GetComponentInChildren<MarbleHolder>();
|
||||
string actualSkinId = mHolder.CosmeticSet.skin;
|
||||
mHolder.SetMarble(Shared.SkinToHijack);
|
||||
mHolder.CosmeticSet.skin = actualSkinId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue