-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModEntry.cs
70 lines (63 loc) · 1.78 KB
/
ModEntry.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using StardewValley;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using MinigameFramework.Utilities;
namespace StardopPoolMinigame
{
public class ModEntry : Mod
{
/// <summary>
/// Mod entry.
/// </summary>
public override void Entry(IModHelper helper)
{
// Multiplayer.SetHelper(helper);
Logger.SetMonitor(Monitor);
Translations.SetHelper(helper.Translation);
helper.Events.Input.ButtonPressed += OnButtonPressed;
}
/// <summary>
/// Hanldes button presses. No need to handle after start, as button presses are passed to minigames.
/// </summary>
private void OnButtonPressed(
object sender,
ButtonPressedEventArgs e
) {
if (!Context.IsWorldReady)
{
return;
}
if (e.Button.IsActionButton()) // && PoolTableDetector.IsPoolTable()
{
StartGame();
}
}
/// <summary>
/// Starts the minigame.
/// </summary>
private void StartGame()
{
Game1.currentMinigame = new StardropPoolMinigame();
}
/// <summary>
/// A message!
/// </summary>
private void OnModMessageRecieved(
object sender,
ModMessageReceivedEventArgs e
) {
if (e.FromModID == ModManifest.UniqueID)
{
IModMessage message;
switch (e.Type)
{
case "Test":
message = e.ReadAs<IModMessage>();
break;
default:
break;
}
}
}
}
}