Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NoisserTVPack v1.0.0
plugins/REPO_TV.dll
Decompiled 5 months agousing System; 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 System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using REPOLib.Modules; using UnityEngine; using UnityEngine.UI; 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("REPO_TV")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("SOSRY7C6PMFEVJP")] [assembly: AssemblyProduct("REPO_TV")] [assembly: AssemblyCopyright("Copyright © SOSRY7C6PMFEVJP 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a03cea98-efc0-455e-a11b-780d04619db8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace REPO_TV; [BepInPlugin("com.xiaohai.REPO_TV", "REPO_TV", "1.0.1")] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "com.xiaohai.REPO_TV"; public const string PLUGIN_NAME = "REPO_TV"; public const string PLUGIN_VERSION = "1.0.1"; public static Plugin instance; public static ManualLogSource logger; public AudioClip pressing; public GameObject TvPrefab; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) instance = this; logger = ((BaseUnityPlugin)this).Logger; logger.LogInfo((object)"Plugin REPO_TV is loaded!"); LoadAB(); new Harmony("com.xiaohai.REPO_TV").PatchAll(); } private void LoadAB() { string location = Assembly.GetExecutingAssembly().Location; string directoryName = Path.GetDirectoryName(location); string text = Path.Combine(directoryName, "xiaohaitv"); AssetBundle val = AssetBundle.LoadFromFile(text); pressing = val.LoadAsset<AudioClip>("pressing.wav"); TvPrefab = val.LoadAsset<GameObject>("TV.prefab"); if ((Object)(object)TvPrefab != (Object)null) { TvPrefab.AddComponent<TVScript>(); TvPrefab.AddComponent<TVButtonManager>(); logger.LogInfo((object)"TV Prefab 加载成功."); NetworkPrefabs.RegisterNetworkPrefab(TvPrefab); Utilities.FixAudioMixerGroups(TvPrefab); } else { logger.LogError((object)"电视机预制体加载失败."); } } } [HarmonyPatch] public static class Patch { [HarmonyPatch(typeof(LevelGenerator))] public class LevelGeneratorPatch { [HarmonyPatch("GenerateDone")] [HarmonyPostfix] private static void AfterLevelGenerated(LevelGenerator __instance) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!ShouldRunCustomLogic() || !SemiFunc.IsMasterClientOrSingleplayer()) { return; } Plugin.logger.LogInfo((object)"在关卡生成后放置电视机."); GameObject val = GameObject.Find("cctv"); if ((Object)(object)val != (Object)null) { Plugin.logger.LogInfo((object)"cctv不为空!."); if (SemiFunc.IsMultiplayer()) { GameObject val2 = PhotonNetwork.InstantiateRoomObject(((Object)Plugin.instance.TvPrefab).name, Vector3.zero, Quaternion.identity, (byte)0, (object[])null); } else { GameObject val2 = Object.Instantiate<GameObject>(Plugin.instance.TvPrefab, Vector3.zero, Quaternion.identity); } } } private static bool ShouldRunCustomLogic() { RunManager instance = RunManager.instance; return (Object)(object)instance != (Object)null && instance.levels.Contains(instance.levelCurrent) && (Object)(object)instance.levelCurrent != (Object)(object)instance.levelTutorial && (Object)(object)instance.levelCurrent != (Object)(object)instance.levelShop && (Object)(object)instance.levelCurrent != (Object)(object)instance.levelLobbyMenu; } } } public class TVButtonManager : MonoBehaviour { private enum BtnType { None, Switch, Play, Next, VolumeUp, VolumeDown } private class Btn { public StaticGrabObject sgo; public BtnType type; public float timer; public bool pressedLast; public bool fired; public Image ring; public bool soundStarted; public AudioSource audio; public float threshold; } [SerializeField] private Transform root; [SerializeField] private float holdTime = 2f; [SerializeField] private bool debugLog = true; private TVScript tv; private Sound pressingSound; private AudioClip pressingClip; private readonly List<Btn> buttons = new List<Btn>(); private void Awake() { tv = ((Component)this).GetComponent<TVScript>(); root = (Object.op_Implicit((Object)(object)root) ? root : ((Component)this).transform); pressingClip = Plugin.instance?.pressing; if (debugLog) { Debug.Log((object)"[TVButtonManager(Mod)] Awake"); } StaticGrabObject[] componentsInChildren = ((Component)root).GetComponentsInChildren<StaticGrabObject>(true); foreach (StaticGrabObject val in componentsInChildren) { BtnType btnType = Classify(((Object)val).name); if (btnType != 0) { Image ring = null; Transform val2 = ((Component)val).transform.Find("Ring"); if (Object.op_Implicit((Object)(object)val2)) { ring = ((Component)val2).GetComponent<Image>(); } float threshold = ((btnType == BtnType.VolumeUp || btnType == BtnType.VolumeDown) ? 1f : holdTime); buttons.Add(new Btn { sgo = val, type = btnType, timer = 0f, pressedLast = false, fired = false, ring = ring, soundStarted = false, threshold = threshold }); if (debugLog) { Debug.Log((object)("[TVButtonManager(Mod)] Button: " + ((Object)val).name + " -> " + btnType)); } } } } private void Update() { //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) Btn btn = null; foreach (Btn button in buttons) { if (Object.op_Implicit((Object)(object)button.sgo) && button.sgo.grabbed && button.sgo.playerGrabbing.Count > 0) { btn = button; break; } } foreach (Btn button2 in buttons) { if (btn != null && button2 != btn && Object.op_Implicit((Object)(object)button2.sgo)) { if (((Behaviour)button2.sgo).enabled) { ((Behaviour)button2.sgo).enabled = false; } } else if (Object.op_Implicit((Object)(object)button2.sgo) && !((Behaviour)button2.sgo).enabled) { ((Behaviour)button2.sgo).enabled = true; } } foreach (Btn button3 in buttons) { bool flag = Object.op_Implicit((Object)(object)button3.sgo) && button3.sgo.grabbed && button3.sgo.playerGrabbing.Count > 0; if (flag) { if (!button3.pressedLast) { button3.timer = 0f; button3.fired = false; button3.soundStarted = false; if (Object.op_Implicit((Object)(object)button3.ring)) { button3.ring.fillAmount = 0f; } } if (!button3.fired) { button3.timer += Time.deltaTime; } if (!button3.soundStarted && Object.op_Implicit((Object)(object)pressingClip)) { if (pressingSound == null) { pressingSound = new Sound(); pressingSound.Type = (AudioType)6; pressingSound.SpatialBlend = 1f; pressingSound.Volume = 1f; pressingSound.Pitch = 1f; } pressingSound.Sounds = (AudioClip[])(object)new AudioClip[1] { pressingClip }; pressingSound.Source = null; button3.audio = pressingSound.Play(((Component)button3.sgo).transform.position, 1f, 1f, 1f, 1f); button3.soundStarted = true; } if (!button3.fired && button3.timer >= button3.threshold) { Fire(button3.type); button3.fired = true; button3.timer = 0f; } if (Object.op_Implicit((Object)(object)button3.ring)) { button3.ring.fillAmount = (button3.fired ? 0f : Mathf.Clamp01(button3.timer / button3.threshold)); } } else { button3.timer = 0f; button3.fired = false; button3.soundStarted = false; if (Object.op_Implicit((Object)(object)button3.ring)) { button3.ring.fillAmount = 0f; } if (Object.op_Implicit((Object)(object)button3.audio)) { if (button3.audio.isPlaying) { button3.audio.Stop(); } if (Object.op_Implicit((Object)(object)button3.audio)) { Object.Destroy((Object)(object)((Component)button3.audio).gameObject); } button3.audio = null; } } button3.pressedLast = flag; } } private void Fire(BtnType type) { if (Object.op_Implicit((Object)(object)tv)) { switch (type) { case BtnType.Switch: tv.Switch(); break; case BtnType.Play: tv.Play(); break; case BtnType.Next: tv.Next(); break; case BtnType.VolumeUp: tv.VolumeUp(); break; case BtnType.VolumeDown: tv.VolumeDown(); break; } } } private BtnType Classify(string name) { string text = name.ToLowerInvariant(); if (text.Contains("switch") || text.Contains("开关") || text.Contains("电源")) { return BtnType.Switch; } if (text.Contains("play") || text.Contains("播放") || text.Contains("暂停")) { return BtnType.Play; } if (text.Contains("next") || text.Contains("下一")) { return BtnType.Next; } if (text.Contains("volumeup") || text.Contains("音量+") || (text.Contains("volume") && (text.Contains("up") || text.Contains("+") || text.Contains("increase") || text.Contains("加")))) { return BtnType.VolumeUp; } if (text.Contains("volumedown") || text.Contains("音量-") || (text.Contains("volume") && (text.Contains("down") || text.Contains("-") || text.Contains("decrease") || text.Contains("减")))) { return BtnType.VolumeDown; } return BtnType.None; } } public class TVScript : MonoBehaviourPun { private readonly List<string> videoFilePaths = new List<string>(); private bool videosLoaded = false; private MeshRenderer meshRenderer; private AudioSource audioSource; private VideoPlayer videoPlayer; private Light tvLight; private GameObject volumeRoot; private Image volumeFill; private float volumeUITimer; private RenderTexture renderTexture; private Texture originalTexture; private Color originalColor; private Vector2 originalOffset; private Vector2 originalScale; private int materialIndex = 2; private Texture originalEmissionMap; private Color originalEmissionColor; private bool originalEmissionEnabled; private int currentIndex; private int lastIndex; private bool powered; private bool playing; private void Awake() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Expected O, but got Unknown GameObject gameObject = ((Component)this).gameObject; GameObject val = GameObject.Find("cctv"); if ((Object)(object)gameObject != (Object)null && (Object)(object)val != (Object)null) { Plugin.logger.LogInfo((object)"tv不为空!."); gameObject.transform.SetParent(val.transform, false); gameObject.transform.localPosition = new Vector3(3.756f, -1.947f, -0.724f); gameObject.transform.localRotation = Quaternion.identity; gameObject.transform.localScale = Vector3.one; } Transform val2 = ((Component)this).transform.Find("TVMesh"); if (Object.op_Implicit((Object)(object)val2)) { meshRenderer = ((Component)val2).GetComponentInChildren<MeshRenderer>(); } if (!Object.op_Implicit((Object)(object)meshRenderer)) { meshRenderer = ((Component)this).GetComponentInChildren<MeshRenderer>(); } Transform val3 = ((Component)this).transform.Find("Audio"); if (Object.op_Implicit((Object)(object)val3)) { audioSource = ((Component)val3).GetComponentInChildren<AudioSource>(); } if (!Object.op_Implicit((Object)(object)audioSource)) { audioSource = ((Component)this).GetComponentInChildren<AudioSource>(); } Transform val4 = ((Component)this).transform.Find("Video"); if (Object.op_Implicit((Object)(object)val4)) { videoPlayer = ((Component)val4).GetComponentInChildren<VideoPlayer>(); } if (!Object.op_Implicit((Object)(object)videoPlayer)) { videoPlayer = ((Component)this).GetComponentInChildren<VideoPlayer>(); } Transform val5 = ((Component)this).transform.Find("Light"); if (Object.op_Implicit((Object)(object)val5)) { tvLight = ((Component)val5).GetComponent<Light>(); } if (!Object.op_Implicit((Object)(object)tvLight)) { tvLight = ((Component)this).GetComponentInChildren<Light>(); } Transform val6 = ((Component)this).transform.Find("Canvas/Volume"); if (Object.op_Implicit((Object)(object)val6)) { volumeRoot = ((Component)val6).gameObject; Transform val7 = val6.Find("BG/Fill"); if (Object.op_Implicit((Object)(object)val7)) { volumeFill = ((Component)val7).GetComponent<Image>(); } if (Object.op_Implicit((Object)(object)volumeFill)) { volumeFill.type = (Type)3; volumeFill.fillMethod = (FillMethod)1; volumeFill.fillOrigin = 0; volumeFill.fillAmount = (Object.op_Implicit((Object)(object)audioSource) ? Mathf.Clamp01(audioSource.volume) : 0f); } volumeRoot.SetActive(false); } if (Object.op_Implicit((Object)(object)meshRenderer) && materialIndex >= 0 && materialIndex < ((Renderer)meshRenderer).materials.Length) { Material val8 = ((Renderer)meshRenderer).materials[materialIndex]; originalTexture = val8.mainTexture; originalColor = val8.color; originalOffset = val8.mainTextureOffset; originalScale = val8.mainTextureScale; if (val8.HasProperty("_EmissionColor")) { originalEmissionColor = val8.GetColor("_EmissionColor"); } if (val8.HasProperty("_EmissionMap")) { originalEmissionMap = val8.GetTexture("_EmissionMap"); } originalEmissionEnabled = val8.IsKeywordEnabled("_EMISSION"); } if (Object.op_Implicit((Object)(object)videoPlayer)) { videoPlayer.renderMode = (VideoRenderMode)2; if (!Object.op_Implicit((Object)(object)renderTexture)) { renderTexture = new RenderTexture(1920, 1080, 0); } videoPlayer.targetTexture = renderTexture; videoPlayer.audioOutputMode = (VideoAudioOutputMode)1; if (Object.op_Implicit((Object)(object)audioSource)) { videoPlayer.EnableAudioTrack((ushort)0, true); videoPlayer.SetTargetAudioSource((ushort)0, audioSource); } videoPlayer.playOnAwake = false; videoPlayer.source = (VideoSource)1; } LoadVideoFiles(); } private void Update() { if (Object.op_Implicit((Object)(object)volumeRoot) && volumeRoot.activeSelf && volumeUITimer > 0f) { volumeUITimer -= Time.deltaTime; if (volumeUITimer <= 0f) { volumeRoot.SetActive(false); } } } private void VolumeUIShow() { if (powered) { if (Object.op_Implicit((Object)(object)volumeRoot)) { volumeRoot.SetActive(true); volumeUITimer = 2f; } if (Object.op_Implicit((Object)(object)volumeFill) && Object.op_Implicit((Object)(object)audioSource)) { volumeFill.fillAmount = Mathf.Clamp01(audioSource.volume); } } } private void LoadVideoFiles() { string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty; string text = Path.Combine(path, "Vedio"); string text2 = Path.Combine(path, "Video"); string path2 = (Directory.Exists(text) ? text : (Directory.Exists(text2) ? text2 : text)); if (!Directory.Exists(path2)) { Directory.CreateDirectory(path2); return; } string[] supportedExtensions = new string[5] { ".mp4", ".mov", ".webm", ".avi", ".wmv" }; List<string> list = (from file in Directory.GetFiles(path2) where supportedExtensions.Contains(Path.GetExtension(file).ToLower()) orderby file select file).ToList(); if (list.Count != 0) { videoFilePaths.Clear(); videoFilePaths.AddRange(list); videosLoaded = true; } } public void Switch() { if (SemiFunc.IsMasterClientOrSingleplayer()) { bool flag = !powered; if (!flag) { lastIndex = currentIndex; } int num = (flag ? lastIndex : currentIndex); bool flag2 = flag; if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("RPC_ApplyState", (RpcTarget)3, new object[3] { flag, flag2, num }); } else { RPC_ApplyState(flag, flag2, num); } } else { ((MonoBehaviourPun)this).photonView.RPC("RPC_Switch", (RpcTarget)2, Array.Empty<object>()); } } public void Play() { if (!powered || (Object)(object)videoPlayer == (Object)null || (Object)(object)meshRenderer == (Object)null || !videosLoaded) { return; } if (SemiFunc.IsMasterClientOrSingleplayer()) { bool flag = !playing; if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("RPC_ApplyState", (RpcTarget)3, new object[3] { powered, flag, currentIndex }); } else { RPC_ApplyState(powered, flag, currentIndex); } } else { ((MonoBehaviourPun)this).photonView.RPC("RPC_PlayToggle", (RpcTarget)2, Array.Empty<object>()); } } public void Next() { if (!powered || !videosLoaded) { return; } if (SemiFunc.IsMasterClientOrSingleplayer()) { int num = (currentIndex + 1) % videoFilePaths.Count; if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("RPC_ApplyState", (RpcTarget)3, new object[3] { true, true, num }); } else { RPC_ApplyState(newPowered: true, newPlaying: true, num); } } else { ((MonoBehaviourPun)this).photonView.RPC("RPC_Next", (RpcTarget)2, Array.Empty<object>()); } } public void VolumeUp() { if (!Object.op_Implicit((Object)(object)audioSource) || !powered) { return; } if (SemiFunc.IsMasterClientOrSingleplayer()) { float num = Mathf.Clamp01(audioSource.volume + 0.1f); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("RPC_SetVolume", (RpcTarget)3, new object[1] { num }); } else { RPC_SetVolume(num); } VolumeUIShow(); } else { ((MonoBehaviourPun)this).photonView.RPC("RPC_VolumeUp", (RpcTarget)2, Array.Empty<object>()); } } public void VolumeDown() { if (!Object.op_Implicit((Object)(object)audioSource) || !powered) { return; } if (SemiFunc.IsMasterClientOrSingleplayer()) { float num = Mathf.Clamp01(audioSource.volume - 0.1f); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("RPC_SetVolume", (RpcTarget)3, new object[1] { num }); } else { RPC_SetVolume(num); } VolumeUIShow(); } else { ((MonoBehaviourPun)this).photonView.RPC("RPC_VolumeDown", (RpcTarget)2, Array.Empty<object>()); } } public void PowerOn() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) powered = true; if (Object.op_Implicit((Object)(object)tvLight)) { tvLight.color = Color.blue; } if ((Object)(object)videoPlayer != (Object)null && (Object)(object)meshRenderer != (Object)null && videosLoaded) { currentIndex = lastIndex; StartPlayInternal(); } } public void PowerOff() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) Stop(); powered = false; if (Object.op_Implicit((Object)(object)tvLight)) { tvLight.color = Color.red; } } public void Stop() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)videoPlayer)) { videoPlayer.Stop(); } if (Object.op_Implicit((Object)(object)audioSource)) { audioSource.Stop(); } if (Object.op_Implicit((Object)(object)meshRenderer) && materialIndex >= 0 && materialIndex < ((Renderer)meshRenderer).materials.Length) { Material val = ((Renderer)meshRenderer).materials[materialIndex]; val.mainTexture = originalTexture; val.color = originalColor; val.mainTextureOffset = originalOffset; val.mainTextureScale = originalScale; if (originalEmissionEnabled) { val.EnableKeyword("_EMISSION"); } else { val.DisableKeyword("_EMISSION"); } if (val.HasProperty("_EmissionMap")) { val.SetTexture("_EmissionMap", originalEmissionMap); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", originalEmissionColor); } } playing = false; } private void StartPlayInternal() { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) if (!videosLoaded || videoFilePaths.Count == 0) { return; } currentIndex = Mathf.Clamp(currentIndex, 0, videoFilePaths.Count - 1); string text = videoFilePaths[currentIndex]; if (Object.op_Implicit((Object)(object)videoPlayer)) { videoPlayer.source = (VideoSource)1; videoPlayer.url = "file:///" + text.Replace("\\", "/"); } if (Object.op_Implicit((Object)(object)meshRenderer)) { Material[] materials = ((Renderer)meshRenderer).materials; if (materialIndex >= 0 && materialIndex < materials.Length) { Material val = materials[materialIndex]; val.mainTexture = (Texture)(object)renderTexture; val.color = Color.white; val.mainTextureScale = new Vector2(1.77f, 3.18f); val.mainTextureOffset = Vector2.zero; val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)4; val.EnableKeyword("_EMISSION"); if (val.HasProperty("_EmissionMap")) { val.SetTexture("_EmissionMap", (Texture)(object)renderTexture); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", new Color(0.2f, 0.2f, 0.2f)); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0f); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", 0f); } } } if (Object.op_Implicit((Object)(object)videoPlayer)) { videoPlayer.Play(); } playing = true; } private void PauseInternal() { if (Object.op_Implicit((Object)(object)videoPlayer)) { videoPlayer.Pause(); } if (Object.op_Implicit((Object)(object)audioSource)) { audioSource.Pause(); } playing = false; } [PunRPC] private void RPC_ApplyState(bool newPowered, bool newPlaying, int newIndex) { //IL_0059: 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) newIndex = Mathf.Clamp(newIndex, 0, (videoFilePaths.Count != 0) ? (videoFilePaths.Count - 1) : 0); powered = newPowered; currentIndex = newIndex; if (Object.op_Implicit((Object)(object)tvLight)) { tvLight.color = (powered ? Color.blue : Color.red); } if (!powered) { lastIndex = currentIndex; Stop(); playing = false; } else if (newPlaying) { StartPlayInternal(); } else { PauseInternal(); } } [PunRPC] private void RPC_Switch() { if (SemiFunc.IsMasterClient()) { bool flag = !powered; if (!flag) { lastIndex = currentIndex; } int num = (flag ? lastIndex : currentIndex); bool flag2 = flag; ((MonoBehaviourPun)this).photonView.RPC("RPC_ApplyState", (RpcTarget)3, new object[3] { flag, flag2, num }); } } [PunRPC] private void RPC_PlayToggle() { if (SemiFunc.IsMasterClient() && powered && !((Object)(object)videoPlayer == (Object)null) && !((Object)(object)meshRenderer == (Object)null) && videosLoaded) { bool flag = !playing; ((MonoBehaviourPun)this).photonView.RPC("RPC_ApplyState", (RpcTarget)3, new object[3] { powered, flag, currentIndex }); } } [PunRPC] private void RPC_Next() { if (SemiFunc.IsMasterClient() && powered && videosLoaded) { int num = (currentIndex + 1) % videoFilePaths.Count; ((MonoBehaviourPun)this).photonView.RPC("RPC_ApplyState", (RpcTarget)3, new object[3] { true, true, num }); } } [PunRPC] private void RPC_SetVolume(float v) { if (Object.op_Implicit((Object)(object)audioSource)) { audioSource.volume = Mathf.Clamp01(v); VolumeUIShow(); } } [PunRPC] private void RPC_VolumeUp() { if (SemiFunc.IsMasterClient() && Object.op_Implicit((Object)(object)audioSource)) { float num = Mathf.Clamp01(audioSource.volume + 0.1f); ((MonoBehaviourPun)this).photonView.RPC("RPC_SetVolume", (RpcTarget)3, new object[1] { num }); } } [PunRPC] private void RPC_VolumeDown() { if (SemiFunc.IsMasterClient() && Object.op_Implicit((Object)(object)audioSource)) { float num = Mathf.Clamp01(audioSource.volume - 0.1f); ((MonoBehaviourPun)this).photonView.RPC("RPC_SetVolume", (RpcTarget)3, new object[1] { num }); } } }