using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using ContentWarningCustomFaces.Logger;
using ContentWarningCustomFaces.Patches;
using ContentWarningCustomFaces.Utils;
using HarmonyLib;
using MyceliumNetworking;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Localization.PropertyVariants;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ContentWarningCustomFaces")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ContentWarningCustomFaces")]
[assembly: AssemblyTitle("ContentWarningCustomFaces")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ContentWarningCustomFaces
{
public static class Assets
{
public static AssetBundle MainAssetBundle;
public static void PopulateAssets(string streamName)
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(streamName))
{
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
}
[BepInPlugin("tv.bakuma.contentWarning.customFaces", "ContentWarningCustomFaces", "1.0.0")]
public class ContentWarningCustomFacesMod : BaseUnityPlugin
{
private const uint modId = 926482371u;
private const string modGUID = "tv.bakuma.contentWarning.customFaces";
private const string modName = "ContentWarningCustomFaces";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("tv.bakuma.contentWarning.customFaces");
public static ContentWarningCustomFacesMod Instance;
private string filePath = "BAKUMA_CWCF_face_path";
private bool initialized;
public void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
ModLogger.Log("Loaded ContentWarningCustomFaces");
harmony.PatchAll(typeof(ContentWarningCustomFacesMod));
harmony.PatchAll(typeof(PlayerHandlerPatch));
harmony.PatchAll(typeof(PlayerPatch));
SceneManager.sceneLoaded += OnSceneWasLoaded;
MyceliumNetwork.RegisterNetworkObject((object)this, 926482371u, 0);
Assets.PopulateAssets("ContentWarningCustomFaces.customfacesprefab");
}
public void onPlayerAdded(Player player)
{
ModLogger.Log("Player added: " + player.refs.view.Owner.NickName);
((MonoBehaviour)this).StartCoroutine(shareCustomFaceCoroutine());
}
private IEnumerator shareCustomFaceCoroutine()
{
yield return (object)new WaitForSeconds(2f);
shareCustomFace();
}
public void OnSceneWasLoaded(Scene scene, LoadSceneMode mode)
{
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Expected O, but got Unknown
//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
//IL_04c7: Expected O, but got Unknown
//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
//IL_04da: Expected O, but got Unknown
//IL_04db: Unknown result type (might be due to invalid IL or missing references)
//IL_04e2: Expected O, but got Unknown
//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
//IL_04f5: Expected O, but got Unknown
//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
//IL_04fd: Expected O, but got Unknown
//IL_0506: Unknown result type (might be due to invalid IL or missing references)
//IL_0510: Expected O, but got Unknown
//IL_0511: Unknown result type (might be due to invalid IL or missing references)
//IL_0518: Expected O, but got Unknown
//IL_0521: Unknown result type (might be due to invalid IL or missing references)
//IL_052b: Expected O, but got Unknown
ModLogger.Log("Scene loaded: " + ((Scene)(ref scene)).name);
if (((Scene)(ref scene)).name == "SurfaceScene" || ((Scene)(ref scene)).name == "FactoryScene")
{
ModLogger.Log("ContentWarning scene loaded");
}
else
{
if (!(((Scene)(ref scene)).name == "NewMainMenu"))
{
return;
}
ModLogger.Log("Main Menu loaded");
GameObject val = (GameObject)Assets.MainAssetBundle.LoadAsset("CustomFacesSettings");
ModLogger.Log("Added Prefab");
GameObject gameObject = ((Component)MainMenuHandler.Instance).gameObject;
Debug.Log((object)("Canvas found: " + ((Object)gameObject).name));
if ((Object)(object)gameObject.transform.parent != (Object)null)
{
Debug.Log((object)("Canvas found: " + ((Object)gameObject.transform.parent).name));
}
else
{
Debug.Log((object)"Canvas parent is null");
}
GameObject settingsMenu = Object.Instantiate<GameObject>(val, gameObject.transform);
float num = (float)Screen.width / 1920f * 960f;
float num2 = (float)Screen.height / 1080f * 540f;
settingsMenu.transform.position = new Vector3(num, num2, 0f);
GameObject mainPage = GameObject.Find("MainPage");
GameObject gameObject2 = ((Component)settingsMenu.transform.GetChild(3)).gameObject;
GameObject gameObject3 = ((Component)settingsMenu.transform.GetChild(2)).gameObject;
GameObject gameObject4 = ((Component)settingsMenu.transform.GetChild(1)).gameObject;
((Object)settingsMenu).name = "CustomFacesSettings";
settingsMenu.SetActive(false);
GameObject gameObject5 = ((Component)gameObject.transform.GetChild(0).GetChild(3)).gameObject;
Debug.Log((object)gameObject5);
Debug.Log((object)gameObject5.transform);
Debug.Log((object)gameObject5.transform.parent);
Debug.Log((object)((Component)gameObject5.transform.parent).transform);
GameObject val2 = Object.Instantiate<GameObject>(gameObject5, ((Component)gameObject5.transform.parent).transform);
float num3 = (float)Screen.width / 1920f * 1500f;
ModLogger.Log("X: " + num3);
val2.transform.position = new Vector3(num3, gameObject5.transform.position.y, gameObject5.transform.position.z);
((Object)val2).name = "CustomFacesMenu";
foreach (Transform item in val2.transform)
{
Transform val3 = item;
Object.Destroy((Object)(object)((Component)val3).gameObject);
}
GameObject gameObject6 = ((Component)val2.transform.GetChild(4)).gameObject;
GameObject val4 = Object.Instantiate<GameObject>(gameObject6, val2.transform);
gameObject6.transform.SetAsLastSibling();
((Object)val4).name = "CustomFacesButtonOpenMenu";
Debug.Log((object)1);
EscapeMenuButton component = ((Component)val4.transform).GetComponent<EscapeMenuButton>();
((Behaviour)component).enabled = true;
Debug.Log((object)2);
Button component2 = ((Component)val4.transform).GetComponent<Button>();
((Behaviour)component2).enabled = true;
Debug.Log((object)3);
GameObject gameObject7 = ((Component)val4.transform.GetChild(2)).gameObject;
Image component3 = gameObject7.GetComponent<Image>();
((Behaviour)component3).enabled = true;
GameObject gameObject8 = ((Component)val4.transform.GetChild(0)).gameObject;
Image component4 = gameObject8.GetComponent<Image>();
((Behaviour)component4).enabled = true;
Debug.Log((object)4);
GameObject gameObject9 = ((Component)val4.transform.GetChild(1)).gameObject;
TextMeshProUGUI component5 = gameObject9.GetComponent<TextMeshProUGUI>();
((Behaviour)component5).enabled = true;
Object.Destroy((Object)(object)gameObject9.GetComponent<GameObjectLocalizer>());
if ((Object)(object)gameObject9 == (Object)null)
{
ModLogger.Log("Text component is null");
}
else
{
ModLogger.Log("Text component is not null");
}
((TMP_Text)component5).SetText("Custom Faces", true);
((TMP_Text)component5).text = "Custom Faces";
Button component6 = val4.GetComponent<Button>();
Button component7 = gameObject2.GetComponent<Button>();
Button component8 = gameObject4.GetComponent<Button>();
Button component9 = gameObject3.GetComponent<Button>();
if ((Object)(object)component6 == (Object)null)
{
ModLogger.Log("Button component is null");
}
else
{
ModLogger.Log("Button component is not null");
}
ButtonClickedEvent val5 = new ButtonClickedEvent();
((UnityEvent)val5).AddListener((UnityAction)delegate
{
ModLogger.Log("PARENT :" + ((Object)settingsMenu.transform.parent).name);
ModLogger.Log("Button clicked");
settingsMenu.SetActive(true);
mainPage.SetActive(false);
onOpenSettingsMenu();
});
ButtonClickedEvent val6 = new ButtonClickedEvent();
((UnityEvent)val6).AddListener((UnityAction)delegate
{
ModLogger.Log("Button clicked");
settingsMenu.SetActive(false);
mainPage.SetActive(true);
});
ButtonClickedEvent val7 = new ButtonClickedEvent();
((UnityEvent)val7).AddListener((UnityAction)delegate
{
clearPlayerFace();
});
ButtonClickedEvent val8 = new ButtonClickedEvent();
((UnityEvent)val8).AddListener((UnityAction)delegate
{
OpenFileName openFileName = new OpenFileName();
openFileName.structSize = Marshal.SizeOf(openFileName);
openFileName.filter = "Image Files\0*.png;*.jpg;*.jpeg";
openFileName.file = new string(new char[256]);
openFileName.maxFile = openFileName.file.Length;
openFileName.fileTitle = new string(new char[64]);
openFileName.maxFileTitle = openFileName.fileTitle.Length;
openFileName.initialDir = Application.dataPath;
openFileName.title = "Select Custom Face";
openFileName.defExt = "PNG";
openFileName.flags = 530952;
if (DllTest.GetOpenFileName(openFileName))
{
ModLogger.Log("Selected file with full path: " + openFileName.file);
((MonoBehaviour)this).StartCoroutine(LoadImage(openFileName.file));
}
else
{
ModLogger.Log("Selected file with full path: " + openFileName.file);
}
});
component7.onClick = val6;
component6.onClick = val5;
component8.onClick = val8;
component9.onClick = val7;
}
}
public static Texture2D LoadPNG(string filePath)
{
Texture2D result = null;
if (File.Exists(filePath))
{
result = Resources.Load<Texture2D>("Textures/texture01");
}
return result;
}
private IEnumerator LoadImage(string path)
{
UnityWebRequest www = UnityWebRequestTexture.GetTexture(path);
try
{
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log((object)www.error);
yield break;
}
Debug.Log((object)"heyyyyy");
Texture2D texture = ((DownloadHandlerTexture)www.downloadHandler).texture;
int maxSize = 200;
int newWidth = 0;
int newHeight = 0;
if (((Texture)texture).width > maxSize || ((Texture)texture).height > maxSize)
{
int max = ((((Texture)texture).width > ((Texture)texture).height) ? ((Texture)texture).width : ((Texture)texture).height);
float scale = (float)maxSize / (float)max;
newWidth = (int)((float)((Texture)texture).width * scale);
newHeight = (int)((float)((Texture)texture).height * scale);
}
Resize(texture, newWidth, newHeight);
string[] obj = new string[6]
{
"Texture loaded: ",
((Texture)texture).height.ToString(),
" : ",
((Texture)texture).width.ToString(),
" : ",
null
};
TextureFormat format = texture.format;
obj[5] = ((object)(TextureFormat)(ref format)).ToString();
ModLogger.Log(string.Concat(obj));
GameObject previewImage = GameObject.Find("PreviewImage");
Image imagePreview = previewImage.GetComponent<Image>();
Sprite sprite = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), Vector2.zero);
imagePreview.sprite = sprite;
byte[] bytes = ImageConversion.EncodeToPNG(texture);
string base64String = Convert.ToBase64String(bytes);
saveFilePath(base64String);
Debug.Log((object)"heyyyyy");
}
finally
{
((IDisposable)www)?.Dispose();
}
}
public void saveFilePath(string path)
{
PlayerPrefs.SetString(filePath, path);
}
private void onOpenSettingsMenu()
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("ClearImageButton");
GameObject val2 = GameObject.Find("SelectImageButton");
GameObject val3 = GameObject.Find("PreviewImage");
ModLogger.Log("Open Settings Menu");
if (PlayerPrefs.HasKey(filePath))
{
string @string = PlayerPrefs.GetString(filePath);
ModLogger.Log("File Path: " + filePath);
if (@string != null)
{
try
{
ModLogger.Log("Loading image");
byte[] array = Convert.FromBase64String(@string);
ModLogger.Log("Bytes loaded from base 64");
Texture2D val4 = new Texture2D(1, 1);
ImageConversion.LoadImage(val4, array);
val3.GetComponent<Image>().sprite = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), Vector2.zero);
return;
}
catch (Exception ex)
{
ModLogger.Log("Error loading image: " + ex.Message);
val.SetActive(false);
return;
}
}
ModLogger.Log("No file content stored");
val.SetActive(false);
}
else
{
ModLogger.Log("No file path stored");
val.SetActive(false);
}
}
public void clearPlayerFace()
{
PlayerPrefs.DeleteKey(filePath);
Debug.Log((object)"File Path Cleared");
GameObject val = GameObject.Find("PreviewImage");
Image component = val.GetComponent<Image>();
component.sprite = null;
}
public void shareCustomFace()
{
ModLogger.Log("Sharing custom face");
if (PlayerPrefs.HasKey(filePath))
{
string @string = PlayerPrefs.GetString(filePath);
ModLogger.Log("File Path: " + filePath);
if (@string != null)
{
byte[] array = Convert.FromBase64String(@string);
ModLogger.Log("Sending custom face");
MyceliumNetwork.RPC(926482371u, "receiveCustomFace", (ReliableType)1, new object[1] { array });
}
else
{
ModLogger.Log("No customFace stored");
}
}
else
{
ModLogger.Log("No customFace Stored");
}
}
[CustomRPC]
private void receiveCustomFace(byte[] fileContent, RPCInfo info)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Expected O, but got Unknown
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Expected O, but got Unknown
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Expected O, but got Unknown
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
//IL_0366: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_041b: Unknown result type (might be due to invalid IL or missing references)
//IL_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_0424: Unknown result type (might be due to invalid IL or missing references)
ModLogger.Log("Received custom face: " + fileContent);
CSteamID senderSteamID = info.SenderSteamID;
string username = SteamFriends.GetFriendPersonaName(senderSteamID);
ModLogger.Log("Received Face from " + username);
CSteamID val = senderSteamID;
ModLogger.Log("Finding player with steam id: " + ((object)(CSteamID)(ref val)).ToString());
ModLogger.Log("Players: " + PlayerHandler.instance.players.Count);
Player val2 = ((IEnumerable<Player>)PlayerHandler.instance.players).FirstOrDefault((Func<Player, bool>)delegate(Player player)
{
ModLogger.Log("Player: " + player.refs.view.Owner.NickName);
return player.refs.view.Owner.NickName == username;
});
if ((Object)(object)val2 != (Object)null)
{
ModLogger.Log("Player found: " + val2.refs.view.Owner.NickName);
GameObject gameObject = ((Component)val2.refs.view).gameObject;
ModLogger.Log("Player model found: " + ((Object)gameObject).name);
GameObject gameObject2 = ((Component)gameObject.transform.GetChild(0)).gameObject;
ModLogger.Log("Parent found: " + ((Object)gameObject2).name);
if ((Object)(object)gameObject2.transform.Find("CustomFace") != (Object)null)
{
ModLogger.Log("Custom face already exists");
GameObject gameObject3 = ((Component)gameObject2.transform.Find("CustomFace")).gameObject;
gameObject3.SetActive(true);
Texture2D val3 = new Texture2D(1, 1);
ImageConversion.LoadImage(val3, fileContent);
Sprite sprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), Vector2.zero);
SpriteRenderer component = gameObject3.GetComponent<SpriteRenderer>();
component.sprite = sprite;
gameObject3.SetActive(true);
return;
}
GameObject val4 = new GameObject("CustomFace");
val4.transform.SetParent(gameObject2.transform);
val4.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
val4.transform.localScale = new Vector3(0.11f, 0.11f, 0.11f);
Debug.Log((object)(val2.refs.view.Owner.NickName + " : " + val2.refs.view.Owner.IsLocal));
if (val2.refs.view.Owner.IsLocal)
{
val4.layer = LayerMask.NameToLayer("LocalDontSee");
}
((Object)val4).name = "CustomFace";
Texture2D val5 = new Texture2D(1, 1);
ModLogger.Log("Texture created");
ImageConversion.LoadImage(val5, fileContent);
string[] obj = new string[6]
{
"Texture loaded: ",
((Texture)val5).height.ToString(),
" : ",
((Texture)val5).width.ToString(),
" : ",
null
};
TextureFormat format = val5.format;
obj[5] = ((object)(TextureFormat)(ref format)).ToString();
ModLogger.Log(string.Concat(obj));
Sprite val6 = Sprite.Create(val5, new Rect(0f, 0f, (float)((Texture)val5).width, (float)((Texture)val5).height), Vector2.zero);
ModLogger.Log("Sprite created");
float num = -0.11f - (0.11f - 0.11f * (200f / (float)((Texture)val5).width)) / 2f;
float num2 = -0.11f - (0.11f - 0.11f * (200f / (float)((Texture)val5).height)) / 2f;
float num3 = 0.295f;
val4.transform.localPosition = new Vector3(num, num2, num3);
SpriteRenderer val7 = val4.AddComponent<SpriteRenderer>();
val7.sprite = val6;
ModLogger.Log("Image added");
Bounds bounds = val6.bounds;
Vector3 size = ((Bounds)(ref bounds)).size;
ModLogger.Log("Sprit size: " + ((object)(Vector3)(ref size)).ToString());
val4.SetActive(true);
GameObject gameObject4 = ((Component)gameObject2.transform.Find("FACE")).gameObject;
gameObject4.SetActive(false);
}
else
{
ModLogger.Log("Player not found");
}
}
private void Resize(Texture2D texture, int newWidth, int newHeight)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
RenderTexture val = (RenderTexture.active = RenderTexture.GetTemporary(newWidth, newHeight, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)0));
Graphics.Blit((Texture)(object)texture, val);
texture.Resize(newWidth, newHeight, texture.format, false);
((Texture)texture).filterMode = (FilterMode)1;
texture.ReadPixels(new Rect(Vector2.zero, new Vector2((float)newWidth, (float)newHeight)), 0, 0);
texture.Apply();
RenderTexture.ReleaseTemporary(val);
}
public void onPlayerDie(Player player)
{
ModLogger.Log("Player died: " + player.refs.view.Owner.NickName);
GameObject gameObject = ((Component)player.refs.view).gameObject;
GameObject gameObject2 = ((Component)gameObject.transform.GetChild(0)).gameObject;
if ((Object)(object)gameObject2 != (Object)null && (Object)(object)gameObject2.transform.Find("CustomFace") != (Object)null)
{
GameObject gameObject3 = ((Component)gameObject2.transform.Find("CustomFace")).gameObject;
gameObject3.SetActive(false);
}
}
public void onPlayerRevive(Player player)
{
GameObject gameObject = ((Component)player.refs.view).gameObject;
GameObject gameObject2 = ((Component)gameObject.transform.GetChild(0)).gameObject;
if ((Object)(object)gameObject2 == (Object)null)
{
return;
}
for (int i = 0; i < gameObject2.transform.childCount; i++)
{
Transform child = gameObject2.transform.GetChild(i);
if (((Object)child).name == "CustomFace")
{
GameObject gameObject3 = ((Component)child).gameObject;
gameObject3.SetActive(true);
return;
}
}
ModLogger.Log("Player revived: " + player.refs.view.Owner.NickName);
}
}
}
namespace ContentWarningCustomFaces.Utils
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class OpenFileName
{
public int structSize = 0;
public IntPtr dlgOwner = IntPtr.Zero;
public IntPtr instance = IntPtr.Zero;
public string filter = null;
public string customFilter = null;
public int maxCustFilter = 0;
public int filterIndex = 0;
public string file = null;
public int maxFile = 0;
public string fileTitle = null;
public int maxFileTitle = 0;
public string initialDir = null;
public string title = null;
public int flags = 0;
public short fileOffset = 0;
public short fileExtension = 0;
public string defExt = null;
public IntPtr custData = IntPtr.Zero;
public IntPtr hook = IntPtr.Zero;
public string templateName = null;
public IntPtr reservedPtr = IntPtr.Zero;
public int reservedInt = 0;
public int flagsEx = 0;
}
public class DllTest
{
[DllImport("Comdlg32.dll", CharSet = CharSet.Auto, SetLastError = true, ThrowOnUnmappableChar = true)]
public static extern bool GetOpenFileName([In][Out] OpenFileName ofn);
public static bool GetOpenFileName1([In][Out] OpenFileName ofn)
{
return GetOpenFileName(ofn);
}
}
}
namespace ContentWarningCustomFaces.Patches
{
[HarmonyPatch]
public class PlayerHandlerPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerHandler), "AddPlayer")]
public static void AddPlayerPostfix(Player player)
{
ContentWarningCustomFacesMod.Instance.onPlayerAdded(player);
}
}
[HarmonyPatch]
public class PlayerPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(Player), "RPCA_PlayerDie")]
public static void onPlayerDie(Player __instance)
{
ContentWarningCustomFacesMod.Instance.onPlayerDie(__instance);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Player), "RPCA_PlayerRevive")]
public static void onPlayerRevive(Player __instance)
{
ContentWarningCustomFacesMod.Instance.onPlayerRevive(__instance);
}
}
}
namespace ContentWarningCustomFaces.Logger
{
public class ModLogger
{
private static ManualLogSource logger;
private static void CreateLogger()
{
logger = Logger.CreateLogSource("ContentWarningCustomFaces");
}
public static void Log(object message)
{
if (logger == null)
{
CreateLogger();
}
logger.LogInfo(message);
}
public static void Log(string message)
{
if (logger == null)
{
CreateLogger();
}
logger.LogInfo((object)message);
}
public static void Error(string message)
{
if (logger == null)
{
CreateLogger();
}
logger.LogError((object)message);
}
public static void Error(Exception e)
{
if (logger == null)
{
CreateLogger();
}
logger.LogError((object)e);
}
}
}