Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of REPONetTune v0.0.1
REPONetTune.dll
Decompiled 3 days agousing System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using Photon.Pun; using UnityEngine; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace REPONetTune; [BepInPlugin("user.reponettune", "REPONetTune", "0.1.0")] public class Plugin : BaseUnityPlugin { private ConfigEntry<bool> tuneRates; private ConfigEntry<int> sendRate; private ConfigEntry<int> serializationRate; private ConfigEntry<bool> diagnostics; private ConfigEntry<float> logInterval; private float worstFrame; private float frames; private float timer; private int minPing = int.MaxValue; private int maxPing; private void Awake() { tuneRates = ((BaseUnityPlugin)this).Config.Bind<bool>("Network", "TuneRates", true, "Змінювати SendRate/SerializationRate"); sendRate = ((BaseUnityPlugin)this).Config.Bind<int>("Network", "SendRate", 40, "Скільки разів/с Photon відправляє пакети (станд. ~30)"); serializationRate = ((BaseUnityPlugin)this).Config.Bind<int>("Network", "SerializationRate", 20, "Скільки разів/с оновлюється стан об'єктів (станд. ~10)"); diagnostics = ((BaseUnityPlugin)this).Config.Bind<bool>("Diagnostics", "Enabled", true, "Писати пінг/джитер/кадри в BepInEx лог"); logInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Diagnostics", "IntervalSeconds", 5f, "Інтервал запису"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"REPONetTune loaded"); } private void Update() { if (!PhotonNetwork.InRoom) { return; } if (tuneRates.Value) { if (PhotonNetwork.SendRate != sendRate.Value) { PhotonNetwork.SendRate = sendRate.Value; } if (PhotonNetwork.SerializationRate != serializationRate.Value) { PhotonNetwork.SerializationRate = serializationRate.Value; } } if (diagnostics.Value) { float unscaledDeltaTime = Time.unscaledDeltaTime; if (unscaledDeltaTime > worstFrame) { worstFrame = unscaledDeltaTime; } frames += 1f; timer += unscaledDeltaTime; int ping = PhotonNetwork.GetPing(); if (ping < minPing) { minPing = ping; } if (ping > maxPing) { maxPing = ping; } if (timer >= logInterval.Value) { int ping2 = PhotonNetwork.GetPing(); int num = maxPing - ((minPing != int.MaxValue) ? minPing : maxPing); minPing = int.MaxValue; maxPing = 0; ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("role={0} ping={1}ms jitter(max-min ping)={2}ms fps={3:F0} worstFrame={4:F0}ms send/ser={5}/{6}", (!PhotonNetwork.IsMasterClient) ? "CLIENT" : "HOST", ping2, num, frames / timer, worstFrame * 1000f, PhotonNetwork.SendRate, PhotonNetwork.SerializationRate)); worstFrame = 0f; frames = 0f; timer = 0f; } } } }