This commit is contained in:
anavoi 2025-03-14 21:37:52 +01:00
commit d5b2b3393a
9 changed files with 1598 additions and 0 deletions

39
Addons/GBSUServer.cs Normal file
View file

@ -0,0 +1,39 @@
using GB.Game;
using HarmonyLib;
using UnityEngine;
#pragma warning disable IDE0051 // Private member is unused
namespace GBSU.Addons;
public class GBSUServer : MonoBehaviour
{
//public MethodInfo _gmInit;
private Traverse localSingleGang;
private Traverse gameTimer;
void FixedUpdate()
{
SetLocalGangToOff(); // make sure correct multiplayer logic applies
}
void Awake()
{
Plugin.Log.LogInfo("GBSU Server awaken");
SetLocalGangToOff();
//_gmInit = AccessTools.Method(typeof(GameMode), "Init");
localSingleGang = Traverse.Create(nameof(GameMode)).Field("localSingleGang");
gameTimer = Traverse.Create(nameof(GameMode)).Field("timer");
}
void SetLocalGangToOff()
{
localSingleGang.SetValue(false);
}
/*
public string GetRemainingRoundTime()
{
float t = (float)gameTimer.GetValue();
return t.ToString("0.00"); // 2 decimal places https://stackoverflow.com/a/164932
}
*/
}