115 lines
3.2 KiB
C#
115 lines
3.2 KiB
C#
using BoneSync.Networking;
|
|
using BoneSync.Networking.LobbyManager;
|
|
using BoneSync.Networking.Transport;
|
|
using MelonLoader;
|
|
using HarmonyLib;
|
|
using UnityEngine;
|
|
using BoneSync.Player;
|
|
using BoneSync.Sync;
|
|
using Facepunch.Steamworks;
|
|
using System.Reflection.Emit;
|
|
using BoneSync.Data;
|
|
|
|
namespace BoneSync
|
|
{
|
|
public static class BuildInfo
|
|
{
|
|
public const string Name = "BoneSync"; // Name of the Mod. (MUST BE SET)
|
|
public const string Author = "aarov"; // Author of the Mod. (Set as null if none)
|
|
public const string Company = null; // Company that made the Mod. (Set as null if none)
|
|
public const string Version = "0.0.1"; // Version of the Mod. (MUST BE SET)
|
|
public const string DownloadLink = null; // Download Link for the Mod. (Set as null if none)
|
|
}
|
|
|
|
public class BoneSync : MelonMod
|
|
{
|
|
public static LobbyManager lobby;
|
|
public static TransportBase transport;
|
|
public override void OnApplicationStart()
|
|
{
|
|
SteamClient.Init(823500, true);
|
|
|
|
SteamLobbyManager steamLobbyManager = new SteamLobbyManager();
|
|
|
|
lobby = steamLobbyManager;
|
|
transport = new SteamTransport();
|
|
|
|
SceneSync.Initialize();
|
|
NetworkMessage.RegisterPacketTypes();
|
|
|
|
SpawnableManager.Initialize();
|
|
|
|
PatchAll();
|
|
}
|
|
|
|
public static void PatchAll()
|
|
{
|
|
HarmonyLib.Harmony harmony = new HarmonyLib.Harmony("com.aarov.bonesync");
|
|
harmony.PatchAll();
|
|
}
|
|
|
|
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
|
|
{
|
|
//MelonLogger.Msg("OnLevelWasLoaded: " + sceneName);
|
|
}
|
|
|
|
public override void OnSceneWasInitialized(int buildIndex, string sceneName)
|
|
{
|
|
//MelonLogger.Msg("OnLevelWasInitialized: " + sceneName);
|
|
SceneSync.OnSceneInit(buildIndex);
|
|
}
|
|
|
|
public override void OnSceneWasUnloaded(int buildIndex, string sceneName)
|
|
{
|
|
//MelonLogger.Msg("OnLevelWasLoaded: " + sceneName);
|
|
}
|
|
|
|
public override void OnUpdate()
|
|
{
|
|
|
|
transport.Tick();
|
|
//PlayerRig.Tick();
|
|
|
|
if (Input.GetKeyDown(KeyCode.P))
|
|
{
|
|
MelonLogger.Msg("P key pressed");
|
|
//PlayerRig playerRig = PlayerRig.InstantiatePlayerRigPrefab();
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.I))
|
|
{
|
|
lobby.CreateLobby();
|
|
}
|
|
}
|
|
|
|
public override void BONEWORKS_OnLoadingScreen()
|
|
{
|
|
base.BONEWORKS_OnLoadingScreen();
|
|
}
|
|
|
|
public override void OnFixedUpdate()
|
|
{
|
|
//MelonLogger.Msg("OnFixedUpdate");
|
|
}
|
|
|
|
public override void OnLateUpdate()
|
|
{
|
|
//MelonLogger.Msg("OnLateUpdate");
|
|
}
|
|
|
|
public override void OnGUI()
|
|
{
|
|
//MelonLogger.Msg("OnGUI");
|
|
}
|
|
|
|
public override void OnApplicationQuit()
|
|
{
|
|
//MelonLogger.Msg("OnApplicationQuit");
|
|
}
|
|
|
|
public override void OnPreferencesLoaded()
|
|
{
|
|
//MelonLogger.Msg("OnPreferencesLoaded");
|
|
}
|
|
}
|
|
}
|