Ignore assembly references, add project, modify README
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -400,3 +400,4 @@ FodyWeavers.xsd
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
||||
/AssemblyReferences
|
||||
|
||||
55
Managers/PingPongManager.cs
Normal file
55
Managers/PingPongManager.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Radium.PingPongPatch.Managers;
|
||||
|
||||
public sealed class PingPongManager(IntPtr ptr) : MonoBehaviour(ptr)
|
||||
{
|
||||
private PerformanceCounters performanceCounters;
|
||||
|
||||
private void Awake()
|
||||
=> performanceCounters = FindObjectOfType<PerformanceCounters>();
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (performanceCounters == null)
|
||||
{
|
||||
performanceCounters = FindObjectOfType<PerformanceCounters>();
|
||||
if (performanceCounters == null)
|
||||
return;
|
||||
}
|
||||
|
||||
var x = 0f;
|
||||
|
||||
if (Plugin.ShowFPS.Value)
|
||||
{
|
||||
var fps = performanceCounters.JLBFLIBDIIN;
|
||||
|
||||
var text = $"FPS: {fps:F1}";
|
||||
var size = GUI.skin.label.CalcSize(new GUIContent(text));
|
||||
|
||||
GUI.Box(new Rect(x, 0, size.x + 12, 22), string.Empty);
|
||||
GUI.Label(new Rect(x + 6, 1, size.x, 20), text);
|
||||
|
||||
x += size.x + 12;
|
||||
}
|
||||
|
||||
if (Plugin.ShowPing.Value)
|
||||
{
|
||||
var ping = performanceCounters.GABBHJIKILN;
|
||||
|
||||
var text = $"Ping: {ping}ms";
|
||||
var size = GUI.skin.label.CalcSize(new GUIContent(text));
|
||||
|
||||
var t = Mathf.Clamp01(ping / 270f);
|
||||
var oldColor = GUI.contentColor;
|
||||
|
||||
GUI.contentColor = t < 0.5f ? Color.Lerp(Color.green, Color.yellow, t * 2f) : Color.Lerp(Color.yellow, Color.red, (t - 0.5f) * 2f);
|
||||
|
||||
GUI.Box(new Rect(x, 0, size.x + 12, 22), string.Empty);
|
||||
GUI.Label(new Rect(x + 6, 1, size.x, 20), text);
|
||||
|
||||
GUI.contentColor = oldColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
Plugin.cs
Normal file
45
Plugin.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Logging;
|
||||
using BepInEx.Unity.IL2CPP;
|
||||
using Radium.PingPongPatch.Managers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Radium.PingPongPatch;
|
||||
|
||||
[BepInPlugin("com.radium.pingpong", "Radium.PingPongPatch", "1.0.0")]
|
||||
internal class Plugin : BasePlugin
|
||||
{
|
||||
internal static new ManualLogSource Log;
|
||||
|
||||
#region Config
|
||||
/// <summary>
|
||||
/// If this plugin should be enabled or not or if we should break before anything gets patched
|
||||
/// </summary>
|
||||
internal static ConfigEntry<bool> Enabled;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if we should show a UI for FPS
|
||||
/// </summary>
|
||||
internal static ConfigEntry<bool> ShowFPS;
|
||||
/// <summary>
|
||||
/// Determines if we should show a UI for local ping
|
||||
/// </summary>
|
||||
internal static ConfigEntry<bool> ShowPing;
|
||||
#endregion
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
Log = base.Log;
|
||||
|
||||
Enabled = Config.Bind(section: "General", key: "Enabled", defaultValue: true, description: "Determines if the patch is enabled.");
|
||||
if (!Enabled.Value) return;
|
||||
|
||||
ShowFPS = Config.Bind(section: "General", key: "Show FPS", defaultValue: true, description: "Determines if we should show a UI for FPS");
|
||||
ShowPing = Config.Bind(section: "General", key: "Show Ping", defaultValue: true, description: "Determines if we should show a UI for local ping");
|
||||
|
||||
AddComponent<PingPongManager>();
|
||||
|
||||
Log.LogInfo($"Ping, pong, ping, pong, ping, pong! Scram, you two! This is my bedroom now! No way, this is our REC ROOM");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
# Radium.PingPongPatch
|
||||
|
||||

|
||||
|
||||
Scram you two, this is my bedroom now! No way, this is our REC ROOM
|
||||
|
||||
Displays FPS and Ping on screen platforms of Radium
|
||||
38
Radium.PingPongPatch.csproj
Normal file
38
Radium.PingPongPatch.csproj
Normal file
@@ -0,0 +1,38 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AssemblyName>Radium.PingPongPatch</AssemblyName>
|
||||
<Product>pingpong</Product>
|
||||
<Version>1.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RestoreAdditionalProjectSources>
|
||||
https://api.nuget.org/v3/index.json;
|
||||
https://nuget.bepinex.dev/v3/index.json;
|
||||
https://nuget.samboy.dev/v3/index.json
|
||||
</RestoreAdditionalProjectSources>
|
||||
<RootNamespace>Radium.PingPongPatch</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.*" IncludeAssets="compile" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>AssemblyReferences\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Il2Cppmscorlib">
|
||||
<HintPath>AssemblyReferences\Il2Cppmscorlib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule">
|
||||
<HintPath>AssemblyReferences\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>AssemblyReferences\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
BIN
media/ping-pong.gif
Normal file
BIN
media/ping-pong.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 MiB |
Reference in New Issue
Block a user