using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using DG.Tweening; using DG.Tweening.Core; using HarmonyLib; using Lamb.UI; using Lamb.UI.DeathScreen; using Lamb.UI.FollowerInteractionWheel; using Lamb.UI.KitchenMenu; using Lamb.UI.PauseMenu; using MMBiomeGeneration; using MMTools; using Rewired; using Spine; using Spine.Unity; using TMPro; using Unify; using Unify.Input; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using src.UINavigator; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ClassLibrary1")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ClassLibrary1")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b05729a9-afdc-413c-b90e-c3a9f2cd0a2c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace COTLMultiplayerExpansion; internal sealed class BuildingTransitionVote : MonoBehaviour { private const float BaseCountdownSeconds = 10f; private static readonly MethodInfo BuildingTriggerMethod = AccessTools.Method(typeof(EnterBuilding), "OnTriggerEnter2D", new Type[1] { typeof(Collider2D) }, (Type[])null); private static readonly FieldInfo TriggeredField = AccessTools.Field(typeof(EnterBuilding), "_triggered"); private static readonly FieldInfo DestinationField = AccessTools.Field(typeof(EnterBuilding), "Destination"); private static BuildingTransitionVote _instance; private static EnterBuilding _replayingBuilding; private EnterBuilding _selectedBuilding; private Collider2D _initiatorCollider; private Vector3 _roomAnchor; private float _remaining; private float _nextBlockedLogAt; private int _initiatorSlot = -1; private bool _active; private readonly HashSet _enteredPlayers = new HashSet(); private readonly HashSet _deniedPlayers = new HashSet(); private Canvas _canvas; private TextMeshProUGUI _titleText; private TextMeshProUGUI _statusText; private TextMeshProUGUI _timerText; private RectTransform _progressFill; private Button _denyButton; internal static bool HasActiveVote { get { if ((Object)(object)_instance != (Object)null) { return _instance._active; } return false; } } internal static bool ShouldBlockBuildingTrigger(EnterBuilding building, Collider2D collision) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)building == (Object)null || (Object)(object)collision == (Object)null || !CoopManager.CoopActive || (Object)(object)_replayingBuilding == (Object)(object)building) { return false; } PlayerFarming val = ResolvePlayer(collision); if ((Object)(object)val == (Object)null || CountActivePlayers() <= 1) { return false; } BuildingTransitionVote buildingTransitionVote = EnsureRunner(); if ((Object)(object)buildingTransitionVote == (Object)null) { return false; } if (DoorTransitionVote.HasActiveVote) { buildingTransitionVote.MovePlayerInside(building, val, ((Component)val).transform.position); return true; } return buildingTransitionVote.HandleBuildingTrigger(building, collision, val); } internal static bool BlockCompetingTrigger(Component transition, Collider2D collision) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!HasActiveVote) { return false; } PlayerFarming val = ResolvePlayer(collision); if ((Object)(object)val != (Object)null) { _instance.MovePlayerInside(_instance._selectedBuilding, val, _instance._roomAnchor); } if (Time.unscaledTime >= _instance._nextBlockedLogAt) { _instance._nextBlockedLogAt = Time.unscaledTime + 1f; Plugin.Log.LogInfo((object)"[RoomVote] Blocked another transition while the temple/building vote was active."); } return true; } internal static void EmergencyCancel() { if (HasActiveVote) { _instance.CancelVote("emergency exit"); } } private static BuildingTransitionVote EnsureRunner() { if ((Object)(object)_instance != (Object)null) { return _instance; } if ((Object)(object)CoopManager.Instance == (Object)null || (Object)(object)((Component)CoopManager.Instance).gameObject == (Object)null) { return null; } _instance = ((Component)CoopManager.Instance).gameObject.GetComponent(); if ((Object)(object)_instance == (Object)null) { _instance = ((Component)CoopManager.Instance).gameObject.AddComponent(); } return _instance; } private void OnDestroy() { TransitionVotePlayerState.RestoreAll(); DestroyVoteUI(); if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } private bool HandleBuildingTrigger(EnterBuilding building, Collider2D collision, PlayerFarming player) { //IL_0010: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (MMTransition.IsPlaying) { MovePlayerInside(building, player, ((Component)player).transform.position); return true; } if (IsBlockingCinematicActive()) { MovePlayerInside(building, player, ((Component)player).transform.position); return true; } if (GetTriggered(building)) { return false; } if (!_active) { if (TransitionVotePlayerState.IsInitiatorBlocked(player, out var _)) { MovePlayerInside(building, player, ((Component)player).transform.position); return true; } BeginVote(building, collision, player); return true; } if ((Object)(object)_selectedBuilding == (Object)(object)building) { RegisterEntry(player); EvaluateFullyResolvedVote(); return true; } MovePlayerInside(building, player, _roomAnchor); if (Time.unscaledTime >= _nextBlockedLogAt) { _nextBlockedLogAt = Time.unscaledTime + 1f; Plugin.Log.LogInfo((object)"[RoomVote] Blocked a different building entrance while a vote was active."); } return true; } private static bool IsBlockingCinematicActive() { try { if (LetterBox.IsPlaying) { return true; } return MMConversation.isPlaying && !MMConversation.isBark; } catch { return false; } } private void BeginVote(EnterBuilding building, Collider2D collision, PlayerFarming initiator) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) _selectedBuilding = building; _initiatorCollider = collision; _roomAnchor = ((Component)initiator).transform.position; _initiatorSlot = Mathf.Clamp(initiator.playerID, 0, 7); _remaining = 10f; _enteredPlayers.Clear(); _deniedPlayers.Clear(); _active = true; RegisterEntry(initiator); CreateVoteUI(); RefreshVoteUI(); Plugin.Log.LogInfo((object)$"[RoomVote] P{initiator.playerID + 1} started {GetBuildingLabel(building)} vote ({CountActivePlayers()} active players)."); } private void RegisterEntry(PlayerFarming player) { if (!((Object)(object)player == (Object)null)) { int num = Mathf.Clamp(player.playerID, 0, 7); bool num2 = _enteredPlayers.Add(num); _deniedPlayers.Remove(num); if (num2) { TransitionVotePlayerState.Hide(player); Plugin.Log.LogInfo((object)$"[RoomVote] P{num + 1} entered the selected building door; countdown speed is now x{GetCountdownSpeed():0.0}."); } } } private void Update() { if (!_active) { return; } if ((Object)(object)_selectedBuilding == (Object)null || (Object)(object)((Component)_selectedBuilding).gameObject == (Object)null || !((Component)_selectedBuilding).gameObject.activeInHierarchy) { CancelVote("selected building door disappeared"); return; } if (MMTransition.IsPlaying) { ClearVoteState(restoreHiddenPlayers: true); return; } EvaluateFullyResolvedVote(); if (!_active) { return; } PollDenyInputs(); if (_active) { _remaining -= Time.unscaledDeltaTime * GetCountdownSpeed(); RefreshVoteUI(); if (_remaining <= 0f) { ResolveTimedVote(); } } } private void PollDenyInputs() { foreach (PlayerFarming activePlayer in GetActivePlayers()) { if (_enteredPlayers.Contains(activePlayer.playerID)) { continue; } try { if (InputManager.Gameplay.GetHeavyAttackButtonDown(activePlayer)) { ToggleDeny(activePlayer); if (!_active) { break; } } } catch { } } } private void ToggleDeny(PlayerFarming player) { if (!_active || (Object)(object)player == (Object)null) { return; } int num = Mathf.Clamp(player.playerID, 0, 7); if (!_enteredPlayers.Contains(num)) { if (_deniedPlayers.Contains(num)) { _deniedPlayers.Remove(num); Plugin.Log.LogInfo((object)$"[RoomVote] P{num + 1} withdrew DENY ENTRY."); } else { _deniedPlayers.Add(num); Plugin.Log.LogInfo((object)$"[RoomVote] P{num + 1} voted DENY ENTRY."); } RefreshVoteUI(); EvaluateFullyResolvedVote(); } } private void EvaluateFullyResolvedVote() { if (_active) { int num = CountActivePlayers(); int num2 = CountActiveVotes(_enteredPlayers); int num3 = CountActiveVotes(_deniedPlayers); if (num2 >= num) { CommitVote("everyone entered"); } else if (num3 > num2) { CancelVote("DENY votes exceeded entered players", applyInitiatorCooldown: true); } else if (num2 + num3 >= num) { CommitVote("all players resolved without DENY exceeding entry"); } } } private void ResolveTimedVote() { int num = CountActiveVotes(_enteredPlayers); if (CountActiveVotes(_deniedPlayers) > num) { CancelVote("timer expired with DENY exceeding entry", applyInitiatorCooldown: true); } else { CommitVote("timer expired without DENY exceeding entry"); } } private void CommitVote(string reason) { if (!_active) { return; } EnterBuilding selectedBuilding = _selectedBuilding; Collider2D val = FindReplayCollider(); int num = CountActiveVotes(_enteredPlayers); int num2 = CountActiveVotes(_deniedPlayers); Plugin.Log.LogInfo((object)$"[RoomVote] BUILDING ENTRY APPROVED ({num} entered, {num2} denied): {reason}."); TransitionVotePlayerState.PrepareForApprovedTransition(); ClearVoteState(); if ((Object)(object)selectedBuilding == (Object)null || (Object)(object)val == (Object)null || BuildingTriggerMethod == null) { Plugin.Log.LogWarning((object)"[RoomVote] Approved building entry could not replay safely."); SetTriggered(selectedBuilding, value: false); TransitionVotePlayerState.RestoreAll(); return; } try { _replayingBuilding = selectedBuilding; BuildingTriggerMethod.Invoke(selectedBuilding, new object[1] { val }); } catch (Exception exception) { SetTriggered(selectedBuilding, value: false); try { PlayerFarming.SetCollidersActive(true, false); } catch { } Plugin.Log.LogWarning((object)("[RoomVote] Approved building replay failed: " + GetInnermostMessage(exception))); TransitionVotePlayerState.RestoreAll(); } finally { _replayingBuilding = null; } ((MonoBehaviour)this).StartCoroutine(RestoreHiddenPlayersAfterTransition()); } private void CancelVote(string reason, bool applyInitiatorCooldown = false) { if (_active) { int num = CountActiveVotes(_enteredPlayers); int num2 = CountActiveVotes(_deniedPlayers); EnterBuilding building = _selectedBuilding; int initiatorSlot = _initiatorSlot; Plugin.Log.LogInfo((object)$"[RoomVote] BUILDING ENTRY DENIED ({num} entered, {num2} denied): {reason}."); SetTriggered(building, value: false); TransitionVotePlayerState.RestoreAndSpread(delegate(PlayerFarming player) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) MovePlayerInside(building, player, _roomAnchor); }); if (applyInitiatorCooldown) { TransitionVotePlayerState.BlockDeniedInitiator(initiatorSlot); } ClearVoteState(); } } private void ClearVoteState(bool restoreHiddenPlayers = false) { if (restoreHiddenPlayers) { TransitionVotePlayerState.RestoreAll(); } _active = false; _selectedBuilding = null; _initiatorCollider = null; _initiatorSlot = -1; _enteredPlayers.Clear(); _deniedPlayers.Clear(); DestroyVoteUI(); } private IEnumerator RestoreHiddenPlayersAfterTransition() { float transitionStartDeadline = Time.unscaledTime + 0.6f; while (!MMTransition.IsPlaying && Time.unscaledTime < transitionStartDeadline) { yield return null; } float transitionEndDeadline = Time.unscaledTime + 12f; while (MMTransition.IsPlaying && Time.unscaledTime < transitionEndDeadline) { yield return null; } TransitionVotePlayerState.RestoreAll(); } private Collider2D FindReplayCollider() { if ((Object)(object)_initiatorCollider != (Object)null && (Object)(object)ResolvePlayer(_initiatorCollider) != (Object)null) { return _initiatorCollider; } foreach (PlayerFarming activePlayer in GetActivePlayers()) { Collider2D component = ((Component)activePlayer).GetComponent(); if ((Object)(object)component != (Object)null) { return component; } } return null; } private float GetCountdownSpeed() { int num = Mathf.Max(1, CountActiveVotes(_enteredPlayers)); return 1f + 0.5f * (float)(num - 1); } private static int CountActiveVotes(HashSet votes) { int num = 0; foreach (PlayerFarming activePlayer in GetActivePlayers()) { if (votes.Contains(activePlayer.playerID)) { num++; } } return num; } private static int CountActivePlayers() { return GetActivePlayers().Count; } private static List GetActivePlayers() { List list = new List(); HashSet hashSet = new HashSet(); if (PlayerFarming.players == null) { return list; } foreach (PlayerFarming player in PlayerFarming.players) { if ((Object)(object)player != (Object)null && player.playerID >= 0 && player.playerID < 8 && (Object)(object)((Component)player).gameObject != (Object)null && ((Component)player).gameObject.activeInHierarchy && hashSet.Add(player.playerID)) { list.Add(player); } } return list; } private static PlayerFarming ResolvePlayer(Collider2D collision) { if ((Object)(object)collision == (Object)null) { return null; } PlayerFarming val = ((Component)collision).gameObject.GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)collision).gameObject.GetComponentInParent(); } return val; } private void MovePlayerInside(EnterBuilding building, PlayerFarming player, Vector3 roomAnchor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Invalid comparison between Unknown and I4 //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Invalid comparison between Unknown and I4 if ((Object)(object)building == (Object)null || (Object)(object)player == (Object)null) { return; } try { Vector3 val = roomAnchor - ((Component)building).transform.position; if (((Vector3)(ref val)).sqrMagnitude < 0.04f) { val = ((Component)player).transform.position - ((Component)building).transform.position; } if (((Vector3)(ref val)).sqrMagnitude < 0.04f) { val = Vector3.down; } val.z = 0f; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f - normalized.y, normalized.x, 0f); float num = ((float)Mathf.Clamp(player.playerID, 0, 7) - 3.5f) * 0.28f; ((Component)player).transform.position = ((Component)building).transform.position + normalized * 2.25f + val2 * num; if ((Object)(object)player.state != (Object)null) { player.state.LockStateChanges = false; if ((int)player.state.CURRENT_STATE == 13 || (int)player.state.CURRENT_STATE == 24) { player.state.CURRENT_STATE = (State)0; } } } catch { } } private static bool GetTriggered(EnterBuilding building) { try { return (Object)(object)building != (Object)null && TriggeredField != null && Convert.ToBoolean(TriggeredField.GetValue(building)); } catch { return false; } } private static void SetTriggered(EnterBuilding building, bool value) { try { if ((Object)(object)building != (Object)null && TriggeredField != null) { TriggeredField.SetValue(building, value); } } catch { } } private void CreateVoteUI() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Expected O, but got Unknown //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Expected O, but got Unknown //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Expected O, but got Unknown //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Expected O, but got Unknown //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) DestroyVoteUI(); GameObject val = new GameObject("COTLMP Building Vote Canvas", new Type[4] { typeof(RectTransform), typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster) }); val.transform.SetParent(((Component)this).transform, false); _canvas = val.GetComponent(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 32700; CanvasScaler component = val.GetComponent(); component.uiScaleMode = (ScaleMode)1; component.referenceResolution = new Vector2(1920f, 1080f); component.matchWidthOrHeight = 0.5f; GameObject val2 = new GameObject("Building Vote Panel", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(val.transform, false); RectTransform component2 = val2.GetComponent(); component2.anchorMin = new Vector2(1f, 0f); component2.anchorMax = new Vector2(1f, 0f); component2.pivot = new Vector2(1f, 0f); component2.anchoredPosition = new Vector2(-14f, 14f); component2.sizeDelta = new Vector2(350f, 101f); Image component3 = val2.GetComponent(); component3.sprite = TransitionVoteSkin.GetPanelSprite(); component3.preserveAspect = true; ((Graphic)component3).color = (((Object)(object)component3.sprite != (Object)null) ? new Color(1f, 1f, 1f, 0.88f) : new Color(0.018f, 0.015f, 0.013f, 0.76f)); ((Graphic)component3).raycastTarget = false; _titleText = CreateText(val2.transform, "Vote Title", new Vector2(67f, -12f), new Vector2(194f, 29f), 20f, (TextAlignmentOptions)513, new Color(0.96f, 0.9f, 0.74f, 1f)); _timerText = CreateText(val2.transform, "Vote Timer", new Vector2(278f, -12f), new Vector2(52f, 29f), 21f, (TextAlignmentOptions)516, new Color(1f, 0.8f, 0.24f, 1f)); _statusText = CreateText(val2.transform, "Vote Status", new Vector2(67f, -43f), new Vector2(260f, 20f), 14f, (TextAlignmentOptions)513, new Color(0.88f, 0.86f, 0.78f, 1f)); GameObject val3 = new GameObject("Vote Timer Track", new Type[2] { typeof(RectTransform), typeof(Image) }); val3.transform.SetParent(val2.transform, false); RectTransform component4 = val3.GetComponent(); component4.anchorMin = new Vector2(0f, 1f); component4.anchorMax = new Vector2(0f, 1f); component4.pivot = new Vector2(0f, 1f); component4.anchoredPosition = new Vector2(67f, -78f); component4.sizeDelta = new Vector2(104f, 3f); ((Graphic)val3.GetComponent()).color = new Color(0.21f, 0.17f, 0.14f, 0.72f); GameObject val4 = new GameObject("Vote Timer Fill", new Type[2] { typeof(RectTransform), typeof(Image) }); val4.transform.SetParent(val3.transform, false); _progressFill = val4.GetComponent(); _progressFill.anchorMin = new Vector2(0f, 0f); _progressFill.anchorMax = new Vector2(0f, 1f); _progressFill.pivot = new Vector2(0f, 0.5f); _progressFill.anchoredPosition = Vector2.zero; _progressFill.sizeDelta = new Vector2(104f, 0f); ((Graphic)val4.GetComponent()).color = new Color(0.82f, 0.035f, 0.025f, 1f); GameObject val5 = new GameObject("Deny Entry Button", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Button) }); val5.transform.SetParent(val2.transform, false); RectTransform component5 = val5.GetComponent(); component5.anchorMin = new Vector2(0f, 1f); component5.anchorMax = new Vector2(0f, 1f); component5.pivot = new Vector2(0f, 1f); component5.anchoredPosition = new Vector2(242f, -65f); component5.sizeDelta = new Vector2(88f, 25f); Image component6 = val5.GetComponent(); ((Graphic)component6).color = new Color(0.58f, 0.035f, 0.025f, 0.94f); _denyButton = val5.GetComponent