Decompiled source of AmigoConAmigos v1.0.0

Games/Amigo/Amigo.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using FMODUnity;
using Microsoft.CodeAnalysis;
using Mirror;
using TMPro;
using UnityEngine;
using UnityEngine.Events;

[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("Amigo")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Amigo")]
[assembly: AssemblyTitle("Amigo")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AmigoMod
{
	[BepInPlugin("com.kit2soin.amigo", "Amigo", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class AmigoPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Amigo Assembly loaded by BepInEx! Waiting for Base Loader...");
		}
	}
}
namespace MoreGamesBase
{
	public class Amigo : GameBase
	{
		private class Result
		{
			public int id;

			public bool win;
		}

		private class BallPath
		{
			public Result result;

			public Vector3[] path;
		}

		public GameObject ResultTelevision;

		public InteractableEventTrigger[] Buttons;

		public InteractableEventTrigger PlayButton;

		public InteractableEventTrigger ResetButton;

		private List<int> _selectedButtons = new List<int>();

		private static readonly int maxSelectionCount = 7;

		private static readonly int minVal = 0;

		private static readonly int maxVal = 27;

		private static readonly int blueCount = 7;

		private static readonly int yellowCount = 5;

		private int aaa = 0;

		private static readonly double[][] MULTIPLIERS = new double[8][]
		{
			new double[6] { 0.0, 0.0, 0.0, 0.0, 1.0, 1.5 },
			new double[6] { 0.0, 0.0, 0.0, 1.0, 1.5, 7.5 },
			new double[6] { 0.0, 0.0, 1.0, 1.5, 7.5, 50.0 },
			new double[6] { 0.0, 1.0, 1.5, 7.5, 50.0, 50.0 },
			new double[6] { 2.5, 4.0, 10.0, 52.5, 52.5, 52.5 },
			new double[6] { 20.0, 27.5, 70.0, 70.0, 70.0, 70.0 },
			new double[6] { 250.0, 300.0, 300.0, 300.0, 300.0, 300.0 },
			new double[6] { 12500.0, 12500.0, 12500.0, 12500.0, 12500.0, 12500.0 }
		};

		private TextMeshPro buttonsCurrentBetText;

		private int numberOfCrosses = 9;

		private TextMeshPro winCurrentGains;

		private Transform winSelection;

		public GameObject[] Results;

		public float breakDelay = 0.5f;

		public float ballSpeed = 3f;

		public float minMaxAngle = 10f;

		public int minBounce = 6;

		public int maxBounce = 12;

		public int maxRequestBounce = 8;

		private Transform ball;

		private Transform bar;

		private GameObject blueBar;

		private GameObject yellowBar;

		private Bounds ballPlayZone;

		private Bounds barPlayZone;

		private TextMeshPro hourText;

		private TextMeshPro minutesText;

		private TextMeshPro drawNumberText;

		private int currentDraw = 0;

		private ParticleSystem winVFX;

		private ParticleSystem loseVFX;

		private ParticleSystem tieVFX;

		[SerializeField]
		private EventReference winSFX;

		[SerializeField]
		private EventReference loseSFX;

		[SerializeField]
		private EventReference tieSFX;

		private void Start()
		{
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: 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_02fe: 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_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: 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)
			PlayButton.onInteractEvent.AddListener((UnityAction<PlayerInteract>)((GameBase)this).TryStartGame);
			ResetButton.onInteractEvent.AddListener((UnityAction<PlayerInteract>)ResetSelection);
			for (int i = 0; i < Buttons.Length; i++)
			{
				int b = i;
				ApplyStyleSelectButton(b, selected: false);
				ApplyStyleSelectResult(i, selected: false, blue: false);
				Buttons[i].onInteractEvent.AddListener((UnityAction<PlayerInteract>)delegate
				{
					OnButtonSelected(b);
				});
			}
			buttonsCurrentBetText = ((Component)((Component)this).transform.Find("Model/SM_Amigo_machine/Paper/Paper/Bet")).gameObject.GetComponent<TextMeshPro>();
			winCurrentGains = ((Component)((Component)this).transform.Find("Model/SM_Amigo_machine/Paper/PossibleWin/Total")).gameObject.GetComponent<TextMeshPro>();
			winSelection = ((Component)((Component)this).transform.Find("Model/SM_Amigo_machine/Paper/PossibleWin/Selected")).gameObject.transform;
			winVFX = ((Component)((Component)this).transform.Find("Feedbacks/GameWinVFX")).gameObject.GetComponent<ParticleSystem>();
			loseVFX = ((Component)((Component)this).transform.Find("Feedbacks/GameLoseVFX")).gameObject.GetComponent<ParticleSystem>();
			tieVFX = ((Component)((Component)this).transform.Find("Feedbacks/GameTieVFX")).gameObject.GetComponent<ParticleSystem>();
			drawNumberText = ((Component)ResultTelevision.transform.Find("Box/Screen/DrawNumber/Number")).gameObject.GetComponent<TextMeshPro>();
			hourText = ((Component)ResultTelevision.transform.Find("Box/Screen/Time/Hours")).gameObject.GetComponent<TextMeshPro>();
			minutesText = ((Component)ResultTelevision.transform.Find("Box/Screen/Time/Minutes")).gameObject.GetComponent<TextMeshPro>();
			ball = ((Component)ResultTelevision.transform.Find("Box/Screen/Ball")).gameObject.transform;
			bar = ((Component)ResultTelevision.transform.Find("Box/Screen/Bar")).gameObject.transform;
			blueBar = ((Component)ResultTelevision.transform.Find("Box/Screen/Bar/Blue")).gameObject;
			yellowBar = ((Component)ResultTelevision.transform.Find("Box/Screen/Bar/Yellow")).gameObject;
			BoxCollider component = ((Component)ball).GetComponent<BoxCollider>();
			BoxCollider component2 = ((Component)bar).GetComponent<BoxCollider>();
			BoxCollider component3 = ((Component)ResultTelevision.transform.Find("Box/Screen")).gameObject.GetComponent<BoxCollider>();
			ballPlayZone = new Bounds(component3.center, component3.size);
			barPlayZone = ballPlayZone;
			((Bounds)(ref ballPlayZone)).Expand(-new Vector3(component.size.x * ball.localScale.x, component.size.y * ball.localScale.y, 0f));
			((Bounds)(ref barPlayZone)).Expand(-new Vector3(component2.size.x * bar.localScale.x, 0f, 0f));
			UpdateWinTable();
			ResetTv();
		}

		private void Update()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			DateTime now = DateTime.Now;
			((TMP_Text)hourText).text = $"{now:HH}";
			((TMP_Text)minutesText).text = $"{now:mm}";
			((TMP_Text)buttonsCurrentBetText).text = $"${((GameBase)this).currentBet}";
		}

		protected override bool CanGameStart()
		{
			return ((GameBase)this).CanGameStart() && _selectedButtons.Count == maxSelectionCount;
		}

		public override void OnStartServer()
		{
			base.gameFeedbacks = ((Component)this).GetComponent<CasinoGameFeedbacks>();
			((GameBase)this).OnStartServer();
		}

		public override void TryStartGame(PlayerInteract playerInteract)
		{
			if (!base.isPlaying)
			{
				((GameBase)this).TryStartGame(playerInteract);
			}
		}

		[Server]
		protected override void StartGame()
		{
			if (!NetworkServer.active)
			{
				return;
			}
			((GameBase)this).StartGame();
			List<int> list = new List<int>();
			Result[] array = new Result[blueCount];
			Result[] array2 = new Result[yellowCount];
			int nbGoodBlues = 0;
			int nbGoodYellows = 0;
			for (int i = 0; i < blueCount; i++)
			{
				int uniqueResult = GetUniqueResult(list);
				bool win = false;
				list.Add(uniqueResult);
				if (_selectedButtons.Contains(uniqueResult))
				{
					nbGoodBlues++;
					win = true;
				}
				array[i] = new Result
				{
					id = uniqueResult,
					win = win
				};
			}
			for (int j = 0; j < yellowCount; j++)
			{
				int uniqueResult2 = GetUniqueResult(list);
				bool win2 = false;
				list.Add(uniqueResult2);
				if (_selectedButtons.Contains(uniqueResult2))
				{
					nbGoodYellows++;
					win2 = true;
				}
				array2[j] = new Result
				{
					id = uniqueResult2,
					win = win2
				};
			}
			ShowResult(array, array2, delegate
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				((GameBase)this).Payout(MULTIPLIERS[nbGoodBlues][nbGoodYellows], (ChangeType)1, (Dictionary<string, object>)null, (BigNumber?)((GameBase)this).currentBet);
				RpcPlayGameResultFeedback(MULTIPLIERS[nbGoodBlues][nbGoodYellows]);
				((GameBase)this).ResetGame();
			});
		}

		private int GetUniqueResult(List<int> exclude)
		{
			int num = Random.Range(minVal, maxVal + 1);
			while (exclude.Contains(num))
			{
				num = Random.Range(minVal, maxVal + 1);
			}
			return num;
		}

		private void ResetSelection(PlayerInteract playerInteract)
		{
			int[] array = _selectedButtons.ToArray();
			foreach (int i2 in array)
			{
				RpcButtonUnselected(i2);
			}
		}

		private void OnButtonSelected(int i)
		{
			if (!base.isPlaying)
			{
				if (_selectedButtons.Contains(i))
				{
					RpcButtonUnselected(i);
				}
				else if (_selectedButtons.Count < maxSelectionCount)
				{
					RpcButtonSelected(i);
				}
			}
		}

		private void ApplyStyleSelectButton(int i, bool selected)
		{
			int num = (selected ? Random.Range(1, numberOfCrosses + 1) : (-1));
			for (int j = 1; j <= numberOfCrosses; j++)
			{
				((Component)((Component)Buttons[i]).transform.Find("Model/Result/SelectionCross/Cross" + j)).gameObject.SetActive(j == num);
			}
		}

		[ClientRpc]
		private void RpcButtonSelected(int i)
		{
			if (NetworkClient.active)
			{
				_selectedButtons.Add(i);
				ApplyStyleSelectButton(i, selected: true);
			}
		}

		[ClientRpc]
		private void RpcButtonUnselected(int i)
		{
			if (NetworkClient.active)
			{
				_selectedButtons.Remove(i);
				ApplyStyleSelectButton(i, selected: false);
			}
		}

		private void UpdateWinTable()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)winCurrentGains).text = $"${((GameBase)this).currentBet}";
			for (int i = 0; i < blueCount + 1; i++)
			{
				int num = Math.Clamp(7 - i, 0, 5);
				for (int j = 0; j <= num; j++)
				{
					if (i + j >= 4)
					{
						((TMP_Text)((Component)((Component)this).transform.Find($"Model/SM_Amigo_machine/Paper/PossibleWin/Good{i + j}/Line{i}{j}/Win")).gameObject.GetComponent<TextMeshPro>()).text = $"x{MULTIPLIERS[i][j]}";
					}
				}
			}
		}

		private void RpcUpdateSelectedWin(bool show, int nbBlue = -1, int nbYellow = -1)
		{
			//IL_0054: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkClient.active)
			{
				return;
			}
			((Component)winSelection).gameObject.SetActive(show && nbBlue + nbYellow >= 4);
			if (nbBlue != -1 && nbYellow != -1)
			{
				((TMP_Text)winCurrentGains).text = "$" + ((object)(((GameBase)this).currentBet * MULTIPLIERS[nbBlue][nbYellow])/*cast due to .constrained prefix*/).ToString();
				if (nbBlue + nbYellow >= 4)
				{
					int num = nbYellow % (blueCount - nbBlue + 1);
					Vector3 localPosition = winSelection.localPosition;
					winSelection.parent = ((Component)((Component)this).transform.Find($"Model/SM_Amigo_machine/Paper/PossibleWin/Good{nbBlue + num}/Line{nbBlue}{num}")).gameObject.transform;
					winSelection.localPosition = localPosition;
				}
			}
			else
			{
				((TMP_Text)winCurrentGains).text = "$0";
			}
		}

		private void ApplyStyleSelectResult(int i, bool selected, bool blue)
		{
			((Component)Results[i].transform.Find("Model/Result/Default")).gameObject.SetActive(!selected);
			((Component)Results[i].transform.Find("Model/Result/Blue")).gameObject.SetActive(selected && blue);
			((Component)Results[i].transform.Find("Model/Result/Yellow")).gameObject.SetActive(selected && !blue);
		}

		[ClientRpc]
		private void RpcSelectResult(int i, bool isSelected, bool blue)
		{
			if (NetworkClient.active)
			{
				ApplyStyleSelectResult(i, isSelected, blue);
			}
		}

		private void ShowResult(Result[] blueResults, Result[] yellowResults, Action callback)
		{
			BallPath[] array = new BallPath[blueResults.Length];
			BallPath[] array2 = new BallPath[yellowResults.Length];
			TextMeshPro obj = drawNumberText;
			int num = ++currentDraw;
			((TMP_Text)obj).text = num.ToString();
			for (int i = 0; i < blueResults.Length; i++)
			{
				bool success;
				do
				{
					array[i] = new BallPath
					{
						result = blueResults[i],
						path = BuildBallPath(Results[blueResults[i].id], out success)
					};
				}
				while (!success);
			}
			for (int j = 0; j < yellowResults.Length; j++)
			{
				bool success2;
				do
				{
					array2[j] = new BallPath
					{
						result = yellowResults[j],
						path = BuildBallPath(Results[yellowResults[j].id], out success2)
					};
				}
				while (!success2);
			}
			((MonoBehaviour)this).StartCoroutine(ShowResultRoutine(array, array2, callback));
		}

		private Vector3[] BuildBallPath(GameObject result, out bool success)
		{
			//IL_0058: 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)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: 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_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: 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_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			float num = Random.Range(minMaxAngle, 90f - minMaxAngle);
			float num2 = ((Random.Range(0, 2) == 0) ? 1 : (-1));
			float num3 = ((Random.Range(0, 2) == 0) ? 1 : (-1));
			Vector3 val = new Vector3(Mathf.Sin(num * (MathF.PI / 180f)) * num2, Mathf.Cos(num * (MathF.PI / 180f)) * num3, 0f);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			int num4 = Random.Range(minBounce, maxRequestBounce);
			List<Vector3> list = new List<Vector3>();
			Vector3 localPosition = result.transform.localPosition;
			list.Add(localPosition);
			while (true)
			{
				Vector3 val2 = normalized * -1f;
				float num5 = (((((Bounds)(ref ballPlayZone)).min.x - localPosition.x) * val2.x > 0.001f) ? Mathf.Abs((localPosition.x - ((Bounds)(ref ballPlayZone)).min.x) / (val2.x * ballSpeed)) : float.PositiveInfinity);
				float num6 = (((((Bounds)(ref ballPlayZone)).max.x - localPosition.x) * val2.x > 0.001f) ? Mathf.Abs((((Bounds)(ref ballPlayZone)).max.x - localPosition.x) / (val2.x * ballSpeed)) : float.PositiveInfinity);
				float num7 = (((((Bounds)(ref ballPlayZone)).min.y - localPosition.y) * val2.y > 0.001f) ? Mathf.Abs((localPosition.y - ((Bounds)(ref ballPlayZone)).min.y) / (val2.y * ballSpeed)) : float.PositiveInfinity);
				float num8 = (((((Bounds)(ref ballPlayZone)).max.y - localPosition.y) * val2.y > 0.001f) ? Mathf.Abs((((Bounds)(ref ballPlayZone)).max.y - localPosition.y) / (val2.y * ballSpeed)) : float.PositiveInfinity);
				float num9 = Mathf.Min(num5, num6);
				float num10 = Mathf.Min(num7, num8);
				float num11 = Mathf.Min(num9, num10);
				((Vector3)(ref localPosition))..ctor(Mathf.Clamp(localPosition.x + val2.x * ballSpeed * num11, ((Bounds)(ref ballPlayZone)).min.x, ((Bounds)(ref ballPlayZone)).max.x), Mathf.Clamp(localPosition.y + val2.y * ballSpeed * num11, ((Bounds)(ref ballPlayZone)).min.y, ((Bounds)(ref ballPlayZone)).max.y), localPosition.z);
				if (num9 < num10)
				{
					((Vector3)(ref normalized))..ctor(normalized.x * -1f, normalized.y, normalized.z);
				}
				else if (num9 > num10)
				{
					((Vector3)(ref normalized))..ctor(normalized.x, normalized.y * -1f, normalized.z);
				}
				else
				{
					((Vector3)(ref normalized))..ctor(normalized.x * -1f, normalized.y * -1f, normalized.z);
				}
				list.Insert(0, localPosition);
				if (list.Count >= maxBounce)
				{
					success = false;
					break;
				}
				if (list.Count >= num4 && num10 < num9 && num8 > num7)
				{
					success = true;
					break;
				}
			}
			return list.ToArray();
		}

		private IEnumerator ShowResultRoutine(BallPath[] bluePaths, BallPath[] yellowPaths, Action callback)
		{
			int nbGoodBlue = 0;
			int nbGoodYellow = 0;
			foreach (BallPath p in bluePaths)
			{
				RpcMoveBall(p.path[0]);
				RpcMoveBar(ball.localPosition.x, blue: true);
				RpcSetTvElementsVisible(ballVisible: true, blueBarVisible: true);
				yield return (object)new WaitForSeconds(breakDelay);
				for (int j = 1; j < p.path.Length; j++)
				{
					Vector3 target = p.path[j];
					while (Vector3.Distance(ball.localPosition, target) > 0.001f)
					{
						RpcMoveBall(Vector3.MoveTowards(ball.localPosition, target, ballSpeed * Time.deltaTime));
						RpcMoveBar(ball.localPosition.x, blue: true);
						yield return null;
					}
				}
				nbGoodBlue += (p.result.win ? 1 : 0);
				RpcUpdateSelectedWin(show: true, nbGoodBlue, nbGoodYellow);
				RpcSelectResult(p.result.id, isSelected: true, blue: true);
				RpcSetTvElementsVisible(ballVisible: false, blueBarVisible: true);
				yield return (object)new WaitForSeconds(breakDelay);
			}
			yield return (object)new WaitForSeconds(breakDelay);
			foreach (BallPath p2 in yellowPaths)
			{
				RpcMoveBall(p2.path[0]);
				RpcMoveBar(ball.localPosition.x, blue: false);
				RpcSetTvElementsVisible(ballVisible: true, blueBarVisible: false, yellowBarVisible: true);
				yield return (object)new WaitForSeconds(breakDelay);
				for (int l = 1; l < p2.path.Length; l++)
				{
					Vector3 target2 = p2.path[l];
					while (Vector3.Distance(ball.localPosition, target2) > 0.001f)
					{
						RpcMoveBall(Vector3.MoveTowards(ball.localPosition, target2, ballSpeed * Time.deltaTime));
						RpcMoveBar(ball.localPosition.x, blue: false);
						yield return null;
					}
				}
				nbGoodYellow += (p2.result.win ? 1 : 0);
				RpcUpdateSelectedWin(show: true, nbGoodBlue, nbGoodYellow);
				RpcSelectResult(p2.result.id, isSelected: true, blue: false);
				RpcSetTvElementsVisible(ballVisible: false, blueBarVisible: false, yellowBarVisible: true);
				yield return (object)new WaitForSeconds(breakDelay);
			}
			yield return (object)new WaitForSeconds(breakDelay * 2f);
			callback();
			ResetTv();
		}

		public void ResetTv()
		{
			RpcUpdateSelectedWin(show: false);
			RpcSetTvElementsVisible();
			for (int i = 0; i < Results.Length; i++)
			{
				RpcSelectResult(i, isSelected: false, blue: false);
			}
		}

		[ClientRpc]
		public void RpcSetTvElementsVisible(bool ballVisible = false, bool blueBarVisible = false, bool yellowBarVisible = false)
		{
			if (NetworkClient.active)
			{
				((Component)ball).gameObject.SetActive(ballVisible);
				blueBar.SetActive(blueBarVisible);
				yellowBar.SetActive(yellowBarVisible);
			}
		}

		[ClientRpc]
		public void RpcMoveBall(Vector3 pos)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkClient.active)
			{
				ball.localPosition = pos;
			}
		}

		[ClientRpc]
		public void RpcMoveBar(float x, bool blue)
		{
			//IL_001c: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkClient.active)
			{
				bar.localPosition = new Vector3(Mathf.Clamp(x, ((Bounds)(ref barPlayZone)).min.x, ((Bounds)(ref barPlayZone)).max.x), bar.localPosition.y, bar.localPosition.z);
			}
		}

		[ClientRpc]
		private void RpcPlayGameResultFeedback(double multiplier)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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)
			if (multiplier < 1.0)
			{
				loseVFX.Play(true);
				SFXManager.SFXOneShot(winSFX, ((Component)this).transform.position);
			}
			else if (multiplier > 1.0)
			{
				winVFX.Play(true);
				SFXManager.SFXOneShot(loseSFX, ((Component)this).transform.position);
			}
			else
			{
				tieVFX.Play(true);
				SFXManager.SFXOneShot(tieSFX, ((Component)this).transform.position);
			}
		}
	}
}