Custom logging function

This commit is contained in:
Terry Hearst 2023-09-04 16:38:48 -04:00
parent 1befbcc31f
commit e3001bedfc
4 changed files with 16 additions and 9 deletions

View file

@ -58,7 +58,7 @@ namespace CustomCosmeticLoader
} }
catch (Exception e) catch (Exception e)
{ {
Debug.LogError("Couldn't load CustomCosmeticLoader config!"); Shared.Log("Couldn't load CustomCosmeticLoader config!");
Debug.LogException(e); Debug.LogException(e);
return; return;
} }
@ -87,12 +87,15 @@ namespace CustomCosmeticLoader
{ {
string nickname = node.Key; string nickname = node.Key;
string skinName = node.Value.Value; string skinName = node.Value.Value;
Debug.Log("Other player: " + nickname + " | " + skinName);
if (skins.ContainsKey(skinName)) if (skins.ContainsKey(skinName))
{ {
Debug.Log("Skin found, adding other player!"); Shared.Log("Adding other player: " + nickname + " -> " + skinName);
otherPlayers.Add(nickname, skinName); otherPlayers.Add(nickname, skinName);
} }
else
{
Shared.Log("NOT adding other player " + nickname + ", skin " + skinName + " not found");
}
} }
} }
} }
@ -124,7 +127,7 @@ namespace CustomCosmeticLoader
{ {
if (skins.Count == 0) if (skins.Count == 0)
{ {
Debug.LogWarning("No custom skins found, disabling"); Shared.Log("No custom skins found, disabling mod");
enabled = false; enabled = false;
return; return;
} }

View file

@ -34,7 +34,7 @@ namespace CustomCosmeticLoader
skinsPath = Path.Combine(skinsPath, "skins"); skinsPath = Path.Combine(skinsPath, "skins");
if (!Directory.Exists(skinsPath)) if (!Directory.Exists(skinsPath))
{ {
Debug.Log(skinsPath + " directory does not exist, no skins to load"); Shared.Log(skinsPath + " directory does not exist, no skins to load");
return; return;
} }
string printStr = "Loaded custom skins: "; string printStr = "Loaded custom skins: ";
@ -46,7 +46,7 @@ namespace CustomCosmeticLoader
skinTexture.LoadImage(File.ReadAllBytes(skinFile)); skinTexture.LoadImage(File.ReadAllBytes(skinFile));
Config.skins.Add(skinName, skinTexture); Config.skins.Add(skinName, skinTexture);
} }
Debug.Log(printStr); Shared.Log(printStr);
} }
} }
} }

View file

@ -67,8 +67,6 @@ namespace CustomCosmeticLoader.Patches
if (controller == null) if (controller == null)
return; return;
Debug.Log("========= MarbleHolder.CheckSet with nickname " + controller.nickname);
if (!controller.isMyClientMarble()) if (!controller.isMyClientMarble())
{ {
if (!Config.otherPlayers.ContainsKey(controller.nickname)) if (!Config.otherPlayers.ContainsKey(controller.nickname))

View file

@ -16,7 +16,7 @@ namespace CustomCosmeticLoader
DetermineSkinToHijack(); DetermineSkinToHijack();
if (skinToHijack == null) if (skinToHijack == null)
{ {
Debug.LogWarning("Couldn't find skin " + Config.skinNameToHijack + " to hijack"); Shared.Log("Couldn't find skin " + Config.skinNameToHijack + " to hijack");
Config.skinNameToHijack = "Swirl_M"; Config.skinNameToHijack = "Swirl_M";
DetermineSkinToHijack(); DetermineSkinToHijack();
} }
@ -50,5 +50,11 @@ namespace CustomCosmeticLoader
material.mainTexture = skin; material.mainTexture = skin;
} }
} }
public static void Log(string message)
{
message = "[CUSTOM COSMETIC LOADER] " + message;
Debug.Log(message);
}
} }
} }