using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GAMINGGAMING")]
[assembly: AssemblyTitle("GAMINGGAMING")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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;
}
}
}
internal static class PongLog
{
public static bool on = true;
public static void Info(string m)
{
if (on)
{
Debug.Log((object)("[PONG-DIRECT] " + m));
}
}
public static void Warn(string m)
{
if (on)
{
Debug.LogWarning((object)("[PONG-DIRECT] " + m));
}
}
}
[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(PhotonView))]
public class AudioReactiveValuableDirect : Trap, IPunObservable
{
[Header("Debug")]
public KeyCode toggleDebugKey = (KeyCode)289;
[Header("Rules")]
public int winScore = 5;
private PhotonView _pv;
private Rigidbody _rb;
private bool _wasGrabbed;
private bool _netActive;
private bool _consumed;
private double _netStartTime;
private float _lastControlRefresh;
private void Awake()
{
_pv = ((Component)this).GetComponent<PhotonView>();
_rb = ((Component)this).GetComponent<Rigidbody>();
if ((Object)(object)_pv == (Object)null)
{
PongLog.Warn("PhotonView missing!");
}
if ((Object)(object)_rb == (Object)null)
{
PongLog.Warn("Rigidbody missing!");
}
PongHUD.Ensure();
}
private void OnDisable()
{
PongHUD.Instance?.StopPongFrom(this);
UnlockControls();
_netActive = false;
}
public override void Update()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
((Trap)this).Update();
if (Input.GetKeyDown(toggleDebugKey))
{
PongLog.on = !PongLog.on;
PongLog.Info("Debug: " + PongLog.on);
}
if (_consumed)
{
return;
}
bool flag = PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient;
bool flag2 = (Object)(object)base.physGrabObject != (Object)null && base.physGrabObject.grabbed;
if (flag)
{
if (!_netActive && flag2 && !_wasGrabbed)
{
_wasGrabbed = true;
_netStartTime = PhotonNetwork.Time;
PongLog.Info("GRAB -> RPC Play (sticky; no auto-stop)");
_pv.RPC("PONG_PlayRPC", (RpcTarget)0, new object[2] { _netStartTime, winScore });
}
if (!flag2 && _wasGrabbed && !_netActive)
{
_wasGrabbed = false;
}
}
if (_netActive)
{
LockControls();
if (IsLocalPlayer())
{
PongHUD instance = PongHUD.Instance;
if ((Object)(object)instance != (Object)null && !instance.ActiveFrom(this))
{
instance.StartPongFrom(this);
}
}
}
else
{
PongHUD.Instance?.StopPongFrom(this);
UnlockControls();
}
}
private bool IsLocalPlayer()
{
try
{
PlayerController instance = PlayerController.instance;
return (Object)(object)instance != (Object)null && (Object)(object)instance.playerAvatarScript != (Object)null && instance.playerAvatarScript.isLocal;
}
catch
{
return true;
}
}
internal void OnLocalPlayerWin()
{
if (!_consumed)
{
PongLog.Info("Player WON — spared.");
_pv.RPC("PONG_ConsumedRPC", (RpcTarget)0, Array.Empty<object>());
PongHUD.Instance?.StopPongFrom(this);
UnlockControls();
}
}
internal void OnLocalPlayerLose()
{
if (!_consumed)
{
PongLog.Info("AI WON — self-destructing local player.");
TriggerLocalSelfDestruct();
_pv.RPC("PONG_ConsumedRPC", (RpcTarget)0, Array.Empty<object>());
PongHUD.Instance?.StopPongFrom(this);
UnlockControls();
}
}
private void TriggerLocalSelfDestruct()
{
try
{
Component val = ((IEnumerable<Component>)Object.FindObjectsOfType<Component>()).FirstOrDefault((Func<Component, bool>)((Component c) => Object.op_Implicit((Object)(object)c) && ((object)c).GetType().Name == "PlayerAvatar" && (bool)(((object)c).GetType().GetField("isLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(c) ?? ((object)false))));
if ((Object)(object)val == (Object)null)
{
PongLog.Warn("PlayerAvatar not found");
return;
}
if (!GameManager.Multiplayer())
{
Type type = ((object)val).GetType();
object obj = type.GetField("playerHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val);
if (obj != null)
{
FieldInfo field = obj.GetType().GetField("health", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
int num = ((field != null) ? ((int)field.GetValue(obj)) : 9999);
MethodInfo method = obj.GetType().GetMethod("Hurt", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[3]
{
typeof(int),
typeof(bool),
typeof(int)
}, null);
if (method != null)
{
method.Invoke(obj, new object[3] { num, false, -1 });
return;
}
}
MethodInfo method2 = ((object)val).GetType().GetMethod("PlayerDeath", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method2 != null)
{
method2.Invoke(val, new object[1] { -1 });
}
return;
}
Type type2 = AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly a) => a.GetTypes()).FirstOrDefault((Type x) => x.Name == "ChatManager");
if (type2 != null)
{
object obj2 = type2.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
MethodInfo method3 = type2.GetMethod("PossessSelfDestruction", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (obj2 != null && method3 != null)
{
method3.Invoke(obj2, null);
return;
}
}
MethodInfo method4 = ((object)val).GetType().GetMethod("PlayerDeath", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method4 != null)
{
method4.Invoke(val, new object[1] { -1 });
}
}
catch (Exception ex)
{
PongLog.Warn("Self-destruct error: " + ex.Message);
}
}
[PunRPC]
private void PONG_PlayRPC(double startTime, int goal)
{
if (!_consumed)
{
_netActive = true;
_netStartTime = startTime;
PongLog.Info("PONG_PlayRPC -> netActive=true");
PongHUD instance = PongHUD.Instance;
if ((Object)(object)instance != (Object)null)
{
instance.SetGoal(goal);
}
}
}
[PunRPC]
private void PONG_ConsumedRPC()
{
_consumed = true;
_netActive = false;
_wasGrabbed = false;
PongLog.Info("PONG_ConsumedRPC -> consumed forever");
PongHUD.Instance?.StopPongFrom(this);
UnlockControls();
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
}
private void LockControls()
{
PlayerController instance = PlayerController.instance;
if (!((Object)(object)instance == (Object)null))
{
instance.InputDisable(0.25f);
instance.OverrideSpeed(0f, 0.3f);
if (Time.unscaledTime - _lastControlRefresh > 0.2f)
{
instance.OverrideLookSpeed(0.2f, 0.15f, 0.15f, 0.3f);
_lastControlRefresh = Time.unscaledTime;
}
}
}
private void UnlockControls()
{
}
}
public class PongHUD : MonoBehaviour
{
private readonly HashSet<AudioReactiveValuableDirect> _sources = new HashSet<AudioReactiveValuableDirect>();
private AudioReactiveValuableDirect _current;
private int _goal = 5;
private bool _init;
private int _scoreL;
private int _scoreR;
private float _paddleL = 0.5f;
private float _paddleR = 0.5f;
private float _ballX = 0.5f;
private float _ballY = 0.5f;
private float _ballVX = 0.38f;
private float _ballVY = 0.28f;
private const float PADDLE_H = 0.18f;
private const float PADDLE_W = 0.015f;
private const float BALL_R = 0.012f;
private const float PADDLE_SPEED = 0.64f;
private AudioSource _snd;
private AudioClip _click;
private Texture2D _white;
private Texture2D _disc;
private Texture2D _panelGrad;
private readonly Queue<Vector2> _ballTrail = new Queue<Vector2>();
private const int TRAIL_LEN = 14;
private float _ballFlash;
private float _aiReactTimer;
private const float AI_REACT_DELAY = 0.14f;
private float _aiTargetY = 0.5f;
private readonly List<Rect> _bricks = new List<Rect>();
private Random _rng = new Random();
private bool _finished;
private string _finishText = "";
private float _finishTime;
public static PongHUD Instance { get; private set; }
private bool Active => _sources.Count > 0;
private Texture2D White => Object.op_Implicit((Object)(object)_white) ? _white : (_white = MakeWhite());
private Texture2D Disc => Object.op_Implicit((Object)(object)_disc) ? _disc : (_disc = MakeDisc(96));
private Texture2D PanelGrad => Object.op_Implicit((Object)(object)_panelGrad) ? _panelGrad : (_panelGrad = MakeVerticalGradient(8, 256, new Color(0.04f, 0.05f, 0.08f, 0.9f), new Color(0.07f, 0.1f, 0.16f, 0.9f)));
public static void Ensure()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
if (!((Object)(object)Instance != (Object)null))
{
GameObject val = new GameObject("PongHUD (Local)");
Object.DontDestroyOnLoad((Object)(object)val);
Instance = val.AddComponent<PongHUD>();
}
}
public bool ActiveFrom(AudioReactiveValuableDirect src)
{
return _sources.Contains(src);
}
private void Awake()
{
_snd = ((Component)this).gameObject.AddComponent<AudioSource>();
_snd.playOnAwake = false;
_snd.spatialBlend = 0f;
_snd.volume = 0.25f;
}
public void SetGoal(int g)
{
_goal = Mathf.Max(1, g);
}
public void StartPongFrom(AudioReactiveValuableDirect src)
{
if (_sources.Add(src))
{
_current = src;
if (!_init)
{
Init();
}
ResetRound();
_finished = false;
_finishText = "";
}
}
public void StopPongFrom(AudioReactiveValuableDirect src)
{
_sources.Remove(src);
if ((Object)(object)_current == (Object)(object)src)
{
_current = _sources.LastOrDefault();
}
if (!Active)
{
_finished = false;
_finishText = "";
}
}
private void Update()
{
if (Active && !_finished)
{
float num = Mathf.Clamp(Time.unscaledDeltaTime, 0f, 0.05f);
Step(num);
_ballFlash = Mathf.Max(0f, _ballFlash - num * 3f);
}
}
private void OnGUI()
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: 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_011c: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Expected O, but got Unknown
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
//IL_03de: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0418: Expected O, but got Unknown
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: Unknown result type (might be due to invalid IL or missing references)
//IL_045d: 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_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: 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_0358: Expected O, but got Unknown
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
if (Active)
{
int width = Screen.width;
int height = Screen.height;
float num = Mathf.Round((float)width * 0.07f);
float num2 = Mathf.Round((float)height * 0.1f);
Rect val = default(Rect);
((Rect)(ref val))..ctor(num, num2, (float)width - num * 2f, (float)height - num2 * 2f);
GUI.color = new Color(1f, 1f, 1f, 0.95f);
GUI.DrawTexture(val, (Texture)(object)PanelGrad);
GUI.color = new Color(1f, 1f, 1f, 0.12f);
GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 2f), (Texture)(object)White);
GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).yMax - 2f, ((Rect)(ref val)).width, 2f), (Texture)(object)White);
GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, 2f, ((Rect)(ref val)).height), (Texture)(object)White);
GUI.DrawTexture(new Rect(((Rect)(ref val)).xMax - 2f, ((Rect)(ref val)).y, 2f, ((Rect)(ref val)).height), (Texture)(object)White);
float num3 = Mathf.Clamp(((Rect)(ref val)).height * 0.085f, 42f, 88f);
Rect val2 = default(Rect);
((Rect)(ref val2))..ctor(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, num3);
GUI.color = new Color(0f, 0f, 0f, 0.25f);
GUI.DrawTexture(val2, (Texture)(object)White);
GUIStyle val3 = new GUIStyle(GUI.skin.label)
{
alignment = (TextAnchor)4,
fontStyle = (FontStyle)1,
fontSize = Mathf.RoundToInt(Mathf.Clamp(((Rect)(ref val)).width * 0.028f, 22f, 44f))
};
val3.normal.textColor = new Color(1f, 1f, 1f, 0.96f);
DrawOutlinedLabel(val2, "OMNI-PONG", val3, new Color(0f, 0f, 0f, 0.7f), 2f);
float num4 = Mathf.Clamp(((Rect)(ref val)).width * 0.02f, 12f, 28f);
Rect val4 = default(Rect);
((Rect)(ref val4))..ctor(((Rect)(ref val)).x + num4, ((Rect)(ref val)).y + num3 + num4, ((Rect)(ref val)).width - num4 * 2f, ((Rect)(ref val)).height - num3 - num4 * 2f);
GUI.color = new Color(0f, 0f, 0f, 0.22f);
GUI.DrawTexture(val4, (Texture)(object)White);
if (!_finished)
{
GUI.color = Color.white;
DrawPong(val4);
GUIStyle val5 = new GUIStyle(GUI.skin.label)
{
alignment = (TextAnchor)8,
fontSize = Mathf.RoundToInt(Mathf.Clamp(((Rect)(ref val)).width * 0.015f, 12f, 18f))
};
val5.normal.textColor = new Color(1f, 1f, 1f, 0.7f);
GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 8f, ((Rect)(ref val)).height - 8f), $"First to {_goal} • Hold W/S", val5);
}
else
{
GUIStyle val6 = new GUIStyle(GUI.skin.label)
{
alignment = (TextAnchor)4,
fontStyle = (FontStyle)1,
fontSize = Mathf.RoundToInt(Mathf.Clamp(((Rect)(ref val)).width * 0.035f, 28f, 60f))
};
val6.normal.textColor = new Color(1f, 1f, 1f, 0.96f);
DrawOutlinedLabel(val4, _finishText, val6, new Color(0f, 0f, 0f, 0.7f), 3f);
}
}
}
private void Init()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
_init = true;
_white = MakeWhite();
_disc = MakeDisc(96);
_panelGrad = MakeVerticalGradient(8, 256, new Color(0.04f, 0.05f, 0.08f, 0.9f), new Color(0.07f, 0.1f, 0.16f, 0.9f));
ResetRound();
}
private void ResetRound()
{
_scoreL = (_scoreR = 0);
_paddleL = (_paddleR = 0.5f);
_ballX = 0.5f;
_ballY = 0.5f;
_ballTrail.Clear();
SpawnBricks();
Serve();
}
private void Step(float dt)
{
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
float num = 0f;
if (Input.GetKey((KeyCode)119))
{
num += 0.64f * dt;
}
if (Input.GetKey((KeyCode)115))
{
num -= 0.64f * dt;
}
_paddleL = Mathf.Clamp01(_paddleL + num);
_aiReactTimer -= dt;
if (_aiReactTimer <= 0f)
{
_aiReactTimer = 0.14f;
float num2 = Mathf.Lerp(0.06f, 0.18f, (float)_rng.NextDouble());
_aiTargetY = Mathf.Clamp01(_ballY + ((_ballVX > 0f) ? (num2 * ((_ballVY >= 0f) ? 1f : (-1f))) : 0f));
}
float num3 = 0.352f;
_paddleR = Mathf.MoveTowards(_paddleR, _aiTargetY, num3 * dt);
_ballX += _ballVX * dt;
_ballY += _ballVY * dt;
Vector2 item = default(Vector2);
((Vector2)(ref item))..ctor(_ballX, _ballY);
if (_ballTrail.Count >= 14)
{
_ballTrail.Dequeue();
}
_ballTrail.Enqueue(item);
if (_ballY < 0.012f)
{
_ballY = 0.012f;
_ballVY = Mathf.Abs(_ballVY);
}
if (_ballY > 0.988f)
{
_ballY = 0.988f;
_ballVY = 0f - Mathf.Abs(_ballVY);
}
float num4 = 0.06f;
float num5 = 0.94f;
if (_ballVX < 0f && _ballX - 0.012f <= num4 + 0.015f && _ballX >= num4 && Mathf.Abs(_ballY - _paddleL) <= 0.10800001f)
{
_ballX = num4 + 0.015f + 0.012f;
_ballVX = Mathf.Abs(_ballVX) * 1.02f;
float num6 = (_ballY - _paddleL) / 0.10800001f;
_ballVY = Mathf.Clamp(_ballVY + num6 * 0.28f, -0.7f, 0.7f);
Click();
_ballFlash = 1f;
}
if (_ballVX > 0f && _ballX + 0.012f >= num5 && _ballX <= num5 + 0.015f && Mathf.Abs(_ballY - _paddleR) <= 0.10800001f)
{
_ballX = num5 - 0.012f;
_ballVX = (0f - Mathf.Abs(_ballVX)) * 1.02f;
float num7 = (_ballY - _paddleR) / 0.10800001f;
_ballVY = Mathf.Clamp(_ballVY + num7 * 0.24f, -0.65f, 0.65f);
Click();
_ballFlash = 1f;
}
if (_bricks.Count > 0)
{
float num8 = 0.024f;
Rect a = default(Rect);
((Rect)(ref a))..ctor(_ballX - 0.012f, _ballY - 0.012f, num8, num8);
for (int num9 = _bricks.Count - 1; num9 >= 0; num9--)
{
if (RectOverlap(a, _bricks[num9]))
{
if (Random.value > 0.5f)
{
_ballVX = (0f - _ballVX) * 1.03f;
}
else
{
_ballVY = (0f - _ballVY) * 1.03f;
}
_ballVX = Mathf.Clamp(_ballVX + Random.Range(-0.04f, 0.04f), -1.2f, 1.2f);
_ballVY = Mathf.Clamp(_ballVY + Random.Range(-0.04f, 0.04f), -1.2f, 1.2f);
_bricks.RemoveAt(num9);
Click();
_ballFlash = 1f;
break;
}
}
}
if (_ballX < 0f)
{
_scoreR++;
Serve();
}
else if (_ballX > 1f)
{
_scoreL++;
Serve();
}
if (_scoreL >= _goal)
{
Finish(win: true);
}
else if (_scoreR >= _goal)
{
Finish(win: false);
}
}
private void Serve()
{
_paddleL = (_paddleR = Mathf.Clamp01(_ballY));
_ballX = 0.5f;
_ballY = 0.5f;
float num = ((Random.value < 0.5f) ? (-1f) : 1f);
_ballVX = 0.38f * num;
_ballVY = (Random.value * 0.26f + 0.16f) * ((Random.value < 0.5f) ? (-1f) : 1f);
_aiReactTimer = 0.14f;
_ballTrail.Clear();
}
private void Finish(bool win)
{
_finished = true;
_finishTime = Time.unscaledTime;
if (win)
{
_finishText = "Congrats — Omniscye lets you live.";
_current?.OnLocalPlayerWin();
}
else
{
_finishText = "You lost — Omniscye claims a soul.";
_current?.OnLocalPlayerLose();
}
}
private void DrawPong(Rect r)
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: 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_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: 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_02a0: 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_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_0380: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_03b2: Expected O, but got Unknown
//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0411: Unknown result type (might be due to invalid IL or missing references)
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
float x = ((Rect)(ref r)).x;
float y = ((Rect)(ref r)).y;
float width = ((Rect)(ref r)).width;
float height = ((Rect)(ref r)).height;
float num = Mathf.Clamp(height * 0.03f, 6f, 18f);
float num2 = num * 0.7f;
float num3 = x + width * 0.5f - 2f;
GUI.color = new Color(1f, 1f, 1f, 0.2f);
for (float num4 = y + 10f; num4 < y + height - 10f; num4 += num + num2)
{
GUI.DrawTexture(new Rect(num3, num4, 4f, num), (Texture)(object)White);
}
Rect r2 = default(Rect);
foreach (Rect brick in _bricks)
{
Rect current = brick;
((Rect)(ref r2))..ctor(x + ((Rect)(ref current)).x * width, y + ((Rect)(ref current)).y * height, ((Rect)(ref current)).width * width, ((Rect)(ref current)).height * height);
DrawCapsuleWithShadow(r2, new Color(0.9f, 0.75f, 0.35f, 0.95f), 0.4f);
}
float num5 = 0.18f * height * 0.5f;
float num6 = Mathf.Max(6f, 0.015f * width);
Rect r3 = default(Rect);
((Rect)(ref r3))..ctor(x + width * 0.06f, y + _paddleL * height - num5, num6, num5 * 2f);
Rect r4 = default(Rect);
((Rect)(ref r4))..ctor(x + width * 0.94f - num6, y + _paddleR * height - num5, num6, num5 * 2f);
DrawCapsuleWithShadow(r3, new Color(0.85f, 0.92f, 1f, 0.95f), 0.55f);
DrawCapsuleWithShadow(r4, new Color(0.85f, 0.92f, 1f, 0.95f), 0.55f);
float num7 = Mathf.Max(5f, 0.012f * Mathf.Min(width, height));
DrawBallTrail(r, num7);
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(x + _ballX * width, y + _ballY * height);
DrawGlowDisc(val, num7 * 1.9f, new Color(0.45f, 0.9f, 1f, 0.2f));
DrawGlowDisc(val, num7 * 1.4f, new Color(0.45f, 0.9f, 1f, 0.3f));
GUI.color = Color.white;
GUI.DrawTexture(new Rect(val.x - num7, val.y - num7, num7 * 2f, num7 * 2f), (Texture)(object)Disc);
if (_ballFlash > 0f)
{
DrawGlowDisc(val, num7 * Mathf.Lerp(1.6f, 2.2f, _ballFlash), new Color(1f, 1f, 1f, 0.22f * _ballFlash));
}
Rect r5 = default(Rect);
((Rect)(ref r5))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y + 4f, ((Rect)(ref r)).width, Mathf.Clamp(((Rect)(ref r)).height * 0.1f, 36f, 72f));
GUIStyle val2 = new GUIStyle(GUI.skin.label)
{
alignment = (TextAnchor)1,
fontStyle = (FontStyle)1,
fontSize = Mathf.RoundToInt(Mathf.Clamp(((Rect)(ref r)).width * 0.055f, 26f, 64f))
};
val2.normal.textColor = new Color(1f, 1f, 1f, 0.98f);
DrawOutlinedLabel(r5, $"{_scoreL} : {_scoreR}", val2, new Color(0f, 0f, 0f, 0.75f), 2f);
GUI.color = Color.white;
}
private Texture2D MakeWhite()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
val.SetPixels((Color[])(object)new Color[4]
{
Color.white,
Color.white,
Color.white,
Color.white
});
val.Apply();
return val;
}
private Texture2D MakeDisc(int size)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
size = Mathf.Max(8, size | 1);
Texture2D val = new Texture2D(size, size, (TextureFormat)4, false)
{
filterMode = (FilterMode)1
};
Color[] array = (Color[])(object)new Color[size * size];
float num = (float)(size - 1) * 0.5f;
float num2 = num * num;
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
float num3 = (float)j - num;
float num4 = (float)i - num;
float num5 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(1f - (num3 * num3 + num4 * num4) / num2));
array[i * size + j] = new Color(1f, 1f, 1f, num5);
}
}
val.SetPixels(array);
val.Apply();
return val;
}
private Texture2D MakeVerticalGradient(int w, int h, Color top, Color bot)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(w, h, (TextureFormat)4, false)
{
wrapMode = (TextureWrapMode)1,
filterMode = (FilterMode)1
};
for (int i = 0; i < h; i++)
{
float num = (float)i / (float)(h - 1);
Color val2 = Color.Lerp(top, bot, num);
for (int j = 0; j < w; j++)
{
val.SetPixel(j, i, val2);
}
}
val.Apply();
return val;
}
private void DrawOutlinedLabel(Rect r, string text, GUIStyle style, Color outline, float thickness)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
Color textColor = style.normal.textColor;
style.normal.textColor = outline;
GUI.Label(new Rect(((Rect)(ref r)).x - thickness, ((Rect)(ref r)).y, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
GUI.Label(new Rect(((Rect)(ref r)).x + thickness, ((Rect)(ref r)).y, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y - thickness, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + thickness, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
GUI.Label(new Rect(((Rect)(ref r)).x - thickness, ((Rect)(ref r)).y - thickness, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
GUI.Label(new Rect(((Rect)(ref r)).x - thickness, ((Rect)(ref r)).y + thickness, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
GUI.Label(new Rect(((Rect)(ref r)).x + thickness, ((Rect)(ref r)).y - thickness, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
GUI.Label(new Rect(((Rect)(ref r)).x + thickness, ((Rect)(ref r)).y + thickness, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
style.normal.textColor = textColor;
GUI.Label(r, text, style);
}
private void DrawCapsuleWithShadow(Rect r, Color color, float shadowAlpha)
{
//IL_0017: 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_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
GUI.color = new Color(0f, 0f, 0f, 0.25f * shadowAlpha);
GUI.DrawTexture(new Rect(((Rect)(ref r)).x + 3f, ((Rect)(ref r)).y + 3f, ((Rect)(ref r)).width, ((Rect)(ref r)).height), (Texture)(object)White);
GUI.color = new Color(color.r, color.g, color.b, color.a);
Rect val = default(Rect);
((Rect)(ref val))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y + ((Rect)(ref r)).width * 0.5f, ((Rect)(ref r)).width, ((Rect)(ref r)).height - ((Rect)(ref r)).width);
if (((Rect)(ref val)).height > 0f)
{
GUI.DrawTexture(val, (Texture)(object)White);
}
float width = ((Rect)(ref r)).width;
GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, width, width), (Texture)(object)Disc);
GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + ((Rect)(ref r)).height - width, width, width), (Texture)(object)Disc);
}
private void DrawGlowDisc(Vector2 center, float radius, Color c)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
GUI.color = c;
GUI.DrawTexture(new Rect(center.x - radius, center.y - radius, radius * 2f, radius * 2f), (Texture)(object)Disc);
}
private void DrawBallTrail(Rect r, float ballRadiusPx)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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 (_ballTrail.Count < 2)
{
return;
}
int num = 0;
Vector2 center = default(Vector2);
foreach (Vector2 item in _ballTrail)
{
float num2 = (float)num / 13f;
float num3 = Mathf.Lerp(0.02f, 0.18f, num2);
float radius = Mathf.Lerp(ballRadiusPx * 0.6f, ballRadiusPx * 1.2f, num2);
((Vector2)(ref center))..ctor(((Rect)(ref r)).x + item.x * ((Rect)(ref r)).width, ((Rect)(ref r)).y + item.y * ((Rect)(ref r)).height);
DrawGlowDisc(center, radius, new Color(0.45f, 0.9f, 1f, num3));
num++;
}
}
private void Click()
{
if (!((Object)(object)_snd == (Object)null))
{
if ((Object)(object)_click == (Object)null)
{
_click = CreateClickClip(0.035f, 920f);
}
_snd.PlayOneShot(_click, 0.9f);
}
}
private AudioClip CreateClickClip(float duration, float frequency)
{
int num = 44100;
int num2 = Mathf.CeilToInt(duration * (float)num);
AudioClip val = AudioClip.Create("pong_click", num2, 1, num, false);
float[] array = new float[num2];
for (int i = 0; i < num2; i++)
{
float num3 = (float)i / (float)num;
float num4 = Mathf.Exp(-24f * num3);
array[i] = Mathf.Sin(MathF.PI * 2f * frequency * num3) * num4 * 0.35f;
}
val.SetData(array, 0);
return val;
}
private void SpawnBricks()
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
_bricks.Clear();
int num = _rng.Next(6, 11);
for (int i = 0; i < num; i++)
{
float num2 = ((_rng.Next(0, 2) == 0) ? 0.03f : 0.04f);
float num3 = 0.06f;
float num4 = Mathf.Lerp(0.4f, 0.6f, (float)_rng.NextDouble());
float num5 = Mathf.Lerp(0.1f, 0.9f, (float)_rng.NextDouble());
if (Mathf.Abs(num4 - 0.5f) < 0.03f)
{
num4 += ((num4 < 0.5f) ? (-0.03f) : 0.03f);
}
_bricks.Add(new Rect(num4 - num2 * 0.5f, num5 - num3 * 0.5f, num2, num3));
}
}
private bool RectOverlap(Rect a, Rect b)
{
return ((Rect)(ref a)).xMin < ((Rect)(ref b)).xMax && ((Rect)(ref a)).xMax > ((Rect)(ref b)).xMin && ((Rect)(ref a)).yMin < ((Rect)(ref b)).yMax && ((Rect)(ref a)).yMax > ((Rect)(ref b)).yMin;
}
}
namespace GAMINGGAMING
{
[BepInPlugin("Omniscye.GAMINGGAMING", "GAMINGGAMING", "1.0")]
public class GAMINGGAMING : BaseUnityPlugin
{
internal static GAMINGGAMING Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}