GBSU/Addons/GBSUServer.cs

39 lines
1,016 B
C#

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
}
*/
}