using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.Video;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TvMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TvMod")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("939018a0-5928-4635-850a-3a4c3fe8c250")]
[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 TVMod;
[BepInPlugin("com.michelle.tvmod", "TV Mod", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"¡TV con Estática lista!");
}
}
public class TVController : MonoBehaviour
{
[Header("Componentes")]
public VideoPlayer tvPlayer;
public AudioSource tvAudio;
[Header("Videos")]
public VideoClip mainContent;
public VideoClip staticSignal;
[Header("Configuración")]
public float interactionDistance = 3f;
public KeyCode interactKey = (KeyCode)103;
public string videoTitle = "Canal 1";
[Header("Volumen Estática")]
[Range(0f, 1f)]
public float staticVolume = 0.1f;
private bool isTvOn = false;
private string screenMessage = "";
private float messageTimer = 0f;
private void Start()
{
if ((Object)(object)tvPlayer == (Object)null)
{
tvPlayer = ((Component)this).GetComponent<VideoPlayer>() ?? ((Component)this).GetComponentInChildren<VideoPlayer>();
}
if ((Object)(object)tvAudio == (Object)null)
{
tvAudio = ((Component)this).GetComponent<AudioSource>() ?? ((Component)this).GetComponentInChildren<AudioSource>();
}
if ((Object)(object)tvPlayer != (Object)null && (Object)(object)staticSignal != (Object)null)
{
tvPlayer.clip = staticSignal;
tvPlayer.isLooping = true;
if ((Object)(object)tvAudio != (Object)null)
{
tvAudio.volume = staticVolume;
}
tvPlayer.Play();
}
}
private void Update()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
if (messageTimer > 0f)
{
messageTimer -= Time.deltaTime;
}
if (Input.GetKeyDown(interactKey) && IsPlayerClose())
{
ToggleTV();
}
}
private void ToggleTV()
{
if ((Object)(object)tvPlayer == (Object)null)
{
return;
}
isTvOn = !isTvOn;
tvPlayer.Stop();
((Behaviour)tvPlayer).enabled = false;
if (isTvOn)
{
if ((Object)(object)mainContent != (Object)null)
{
tvPlayer.clip = mainContent;
tvPlayer.isLooping = true;
((Behaviour)tvPlayer).enabled = true;
if ((Object)(object)tvAudio != (Object)null)
{
tvAudio.volume = 1f;
}
tvPlayer.Play();
ShowMessage("▶ " + videoTitle, 3f);
}
}
else if ((Object)(object)staticSignal != (Object)null)
{
tvPlayer.clip = staticSignal;
tvPlayer.isLooping = true;
((Behaviour)tvPlayer).enabled = true;
if ((Object)(object)tvAudio != (Object)null)
{
tvAudio.volume = staticVolume;
}
tvPlayer.Play();
ShowMessage("zzz SIN SEÑAL zzz", 2f);
}
else
{
ShowMessage("¡ APAGADO !", 2f);
}
}
private bool IsPlayerClose()
{
//IL_0016: 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)
if ((Object)(object)Camera.main != (Object)null)
{
return Vector3.Distance(((Component)this).transform.position, ((Component)Camera.main).transform.position) <= interactionDistance;
}
return false;
}
private void ShowMessage(string text, float time)
{
screenMessage = text;
messageTimer = time;
}
private void OnGUI()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
if (messageTimer > 0f)
{
GUIStyle val = new GUIStyle();
val.fontSize = 40;
val.normal.textColor = Color.green;
val.fontStyle = (FontStyle)1;
val.alignment = (TextAnchor)4;
float num = Screen.width / 2 - 200;
float num2 = Screen.height / 2 - 100;
GUIStyle val2 = new GUIStyle(val);
val2.normal.textColor = Color.black;
GUI.Label(new Rect(num + 2f, num2 + 2f, 400f, 200f), screenMessage, val2);
GUI.Label(new Rect(num, num2, 400f, 200f), screenMessage, val);
}
}
}