using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ColorScreenMod;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Utilities;
using MelonLoader;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(main), "Color Screen", "2.1.1", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTitle("ColorScreen")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ColorScreen")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0bbb5e6e-12ca-4068-8a79-6605427fba1b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ColorScreenMod;
public class main : MelonMod
{
private string FILEPATH = "UserData\\ColorScreen";
private string FILENAME = "Color.txt";
private string currentScene = "Loader";
private bool gKeyReleased = true;
private bool gKeyPressed = false;
private bool gScreenActive = false;
private bool fKeyReleased = true;
private bool fKeyPressed = false;
private bool fPlainActive = false;
private Vector3 wallColor;
private Vector3 floorColor;
public override void OnLateInitializeMelon()
{
MelonCoroutines.Start(CheckIfFileExists(FILEPATH, FILENAME));
}
public IEnumerator CheckIfFileExists(string filePath, string fileName)
{
if (!File.Exists(filePath + "\\" + fileName))
{
if (!Directory.Exists(filePath))
{
Log("Folder Not Found, Creating Folder: " + filePath);
Directory.CreateDirectory(filePath);
}
if (!File.Exists(filePath + "\\" + fileName))
{
Log("Creating File " + filePath + "\\" + fileName);
File.Create(filePath + "\\" + fileName);
}
wallColor = new Vector3(255f, 68f, 237f);
floorColor = new Vector3(255f, 68f, 237f);
for (int i = 0; i < 60; i++)
{
yield return (object)new WaitForFixedUpdate();
}
File.WriteAllLines(contents: new string[8] { "Screen Color:", "255", "68", "237", "Floor Color:", "255", "68", "237" }, path: filePath + "\\" + fileName);
}
else
{
try
{
string[] fileContents = File.ReadAllLines(filePath + "\\" + fileName);
wallColor = new Vector3((float)int.Parse(fileContents[1]), (float)int.Parse(fileContents[2]), (float)int.Parse(fileContents[3]));
Log($"Wall Color Loaded | R: {wallColor.x} | G: {wallColor.y} | B: {wallColor.z}");
floorColor = new Vector3((float)int.Parse(fileContents[5]), (float)int.Parse(fileContents[6]), (float)int.Parse(fileContents[7]));
Log($"Floor Color Loaded | R: {floorColor.x} | G: {floorColor.y} | B: {floorColor.z}");
}
catch
{
MelonLogger.Error("Error Reading " + filePath + "\\" + fileName + " | Setting to Blue");
wallColor = new Vector3(0f, 0f, 255f);
floorColor = new Vector3(0f, 0f, 255f);
}
}
yield return null;
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
currentScene = sceneName;
}
public override void OnUpdate()
{
if (!(currentScene == "Loader"))
{
if (Input.GetKeyDown((KeyCode)103) && gKeyReleased)
{
gKeyPressed = true;
gKeyReleased = false;
}
if (Input.GetKeyUp((KeyCode)103) && !gKeyReleased)
{
gKeyReleased = true;
}
if (Input.GetKeyDown((KeyCode)102) && fKeyReleased)
{
fKeyPressed = true;
fKeyReleased = false;
}
if (Input.GetKeyUp((KeyCode)102) && !fKeyReleased)
{
fKeyReleased = true;
}
}
}
public override void OnFixedUpdate()
{
if (gKeyPressed)
{
if (gScreenActive)
{
Object.Destroy((Object)(object)GameObject.Find("ColorScreen"));
gScreenActive = false;
}
else
{
CreateWall();
gScreenActive = true;
}
gKeyPressed = false;
}
if (fKeyPressed)
{
if (fPlainActive)
{
Object.Destroy((Object)(object)GameObject.Find("ColorPlain"));
fPlainActive = false;
}
else
{
CreatePlane();
fPlainActive = true;
}
fKeyPressed = false;
}
}
private void CreateWall()
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
try
{
GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
((Object)val).name = "ColorScreen";
val.GetComponent<Renderer>().material.shader = Shader.Find("Universal Render Pipeline/Lit");
((Renderer)val.GetComponent<MeshRenderer>()).material.color = new Color(wallColor.x / 255f, wallColor.y / 255f, wallColor.z / 255f, 1f);
GameObject val2 = GameObject.Find("Health/Local");
PlayerManager instance = Singleton<PlayerManager>.instance;
val.transform.rotation = ((Component)((Component)instance.localPlayer.Controller).gameObject.transform.GetChild(2).GetChild(12)).transform.rotation;
val.transform.position = val2.transform.position;
val.transform.localScale = new Vector3(0.01f, 1000f, 1000f);
val.SetActive(true);
}
catch (Exception ex)
{
MelonLogger.Error((object)ex);
}
}
private void CreatePlane()
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
try
{
GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
((Object)val).name = "ColorPlain";
val.GetComponent<Renderer>().material.shader = Shader.Find("Universal Render Pipeline/Lit");
((Renderer)val.GetComponent<MeshRenderer>()).material.color = new Color(floorColor.x / 255f, floorColor.y / 255f, floorColor.z / 255f, 1f);
GameObject val2 = GameObject.Find("Health/Local");
PlayerManager instance = Singleton<PlayerManager>.instance;
val.transform.position = ((Component)((Component)instance.localPlayer.Controller).gameObject.transform.GetChild(2).GetChild(13).GetChild(0)).gameObject.transform.position;
val.transform.position = new Vector3(val.transform.position.x, val.transform.position.y - 0.102f, val.transform.position.z);
val.transform.localScale = new Vector3(1000f, 0.01f, 1000f);
val.SetActive(true);
}
catch (Exception ex)
{
MelonLogger.Error((object)ex);
}
}
public static void Log(string msg)
{
MelonLogger.Msg(msg);
}
}