-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from Makinolo/feature/optional_menus
Creates interface to communicate with other mods and menus optional
- Loading branch information
Showing
7 changed files
with
109 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Lidgren.Network; | ||
|
||
namespace CoopClient | ||
{ | ||
public static class Interface | ||
{ | ||
public delegate void ConnectEvent(bool connected, string bye_message); | ||
public static event ConnectEvent OnConnect; | ||
public static event ConnectEvent OnDisconnect; | ||
public delegate void MessageEvent(NetIncomingMessage message); | ||
public static event MessageEvent OnMessage; | ||
|
||
public static void Connect(string serverAddress) | ||
{ | ||
Main.MainNetworking.DisConnectFromServer(serverAddress); | ||
} | ||
|
||
public static void Configure(string playerName, bool shareNpcsWithPlayers, int streamedNpcs, bool debug = false) | ||
{ | ||
Main.MainSettings.Username = playerName; | ||
Main.ShareNpcsWithPlayers = shareNpcsWithPlayers; | ||
Main.MainSettings.StreamedNpc = streamedNpcs; | ||
#if DEBUG | ||
Main.UseDebug = debug; | ||
#endif | ||
} | ||
|
||
public static void Disconnected( string bye_message) | ||
{ | ||
OnDisconnect?.Invoke(false, bye_message); | ||
} | ||
|
||
public static void Connected() | ||
{ | ||
OnConnect?.Invoke(true, ""); | ||
} | ||
|
||
public static void MessageReceived(NetIncomingMessage message) | ||
{ | ||
OnMessage?.Invoke(message); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters