85 lines
3.2 KiB
C#
85 lines
3.2 KiB
C#
using MSCLoader;
|
|
using UnityEngine;
|
|
|
|
namespace MSCO
|
|
{
|
|
public class MSCO : Mod
|
|
{
|
|
public const string ModVersion = "2.8";
|
|
|
|
public override string ID => "MSCO"; // Your (unique) mod ID
|
|
public override string Name => "MSCO"; // Your mod name
|
|
public override string Author => "MBM"; // Name of the Author (your name)
|
|
public override string Version => ModVersion; // Version
|
|
public override string Description => "Online mod by mbm.wtf"; // Short description of your mod
|
|
public override Game SupportedGames => Game.MySummerCar;
|
|
// Logo in der MSCLoader-Modliste (branding/logo-128.png, in die DLL eingebettet)
|
|
public override byte[] Icon { get { return Branding.LogoPng; } set { } }
|
|
|
|
bool commandAdded;
|
|
|
|
public override void ModSetup()
|
|
{
|
|
SetupFunction(Setup.OnMenuLoad, Mod_OnMenuLoad);
|
|
SetupFunction(Setup.OnLoad, Mod_OnLoad);
|
|
SetupFunction(Setup.PostLoad, Mod_PostLoad);
|
|
SetupFunction(Setup.OnSave, Mod_OnSave);
|
|
SetupFunction(Setup.OnGUI, Mod_OnGUI);
|
|
SetupFunction(Setup.Update, Mod_Update);
|
|
SetupFunction(Setup.FixedUpdate, Mod_FixedUpdate);
|
|
SetupFunction(Setup.ModSettings, Mod_Settings);
|
|
}
|
|
|
|
/// <summary>Taste zum Ein-/Aussteigen als Beifahrer (in den MSCLoader-Einstellungen änderbar).</summary>
|
|
internal static SettingsKeybind PassengerKey;
|
|
/// <summary>MSCO-Konsole (Standard F7) und Chat (Standard T), ebenfalls änderbar.</summary>
|
|
internal static SettingsKeybind ConsoleKey, ChatKey;
|
|
|
|
private void Mod_Settings()
|
|
{
|
|
// All settings should be created here.
|
|
// DO NOT put anything that isn't settings or keybinds in here!
|
|
PassengerKey = Keybind.Add("passenger", "Ride as passenger (toggle)", KeyCode.P);
|
|
ChatKey = Keybind.Add("chat", "Open chat", KeyCode.T);
|
|
// Nicht F8: im Pausenmenü öffnet F8 ein Test-Menü des Spiels. Neue ID, damit alte F8-Belegungen nicht übernommen werden
|
|
ConsoleKey = Keybind.Add("console_f7", "Open MSCO console", KeyCode.F7);
|
|
}
|
|
|
|
private void Mod_OnMenuLoad()
|
|
{
|
|
MscoLog.Info("Welcome to MSCO by mbm.wtf");
|
|
// Netzwerk + Lobby leben in einem eigenen Objekt, das Szenenwechsel überlebt
|
|
MultiplayerManager.Ensure();
|
|
if (!commandAdded)
|
|
{
|
|
ConsoleCommand.Add(new MpCommand());
|
|
commandAdded = true;
|
|
}
|
|
}
|
|
private void Mod_OnLoad()
|
|
{
|
|
// Called once, when mod is loading after game is fully loaded
|
|
}
|
|
private void Mod_PostLoad()
|
|
{
|
|
// Called once, after all mods finished OnLoad
|
|
}
|
|
private void Mod_OnSave()
|
|
{
|
|
// Called once, when save and quit
|
|
}
|
|
private void Mod_OnGUI()
|
|
{
|
|
// Lobby/Status zeichnet der MultiplayerManager
|
|
}
|
|
private void Mod_Update()
|
|
{
|
|
// Netzwerk läuft im MultiplayerManager
|
|
}
|
|
private void Mod_FixedUpdate()
|
|
{
|
|
// FixedUpdate is called once per fixed frame
|
|
}
|
|
}
|
|
}
|