-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
HerosModSystem.cs
91 lines (81 loc) · 2.27 KB
/
HerosModSystem.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using HEROsMod.HEROsModServices;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.IO;
using Terraria;
using Terraria.ModLoader;
using Terraria.UI;
namespace HEROsMod
{
public class HerosModSystem : ModSystem
{
public override void PostDrawFullscreenMap(ref string mouseText)
{
Teleporter.instance.PostDrawFullScreenMap(ref mouseText);
MapRevealer.instance.PostDrawFullScreenMap();
}
public override void ModifyInterfaceLayers(List<GameInterfaceLayer> layers)
{
int inventoryLayerIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text"));
if (inventoryLayerIndex != -1)
{
layers.Insert(inventoryLayerIndex, new LegacyGameInterfaceLayer(
"HerosMod: UI",
delegate {
try
{
HEROsMod.Update();
HEROsMod.ServiceHotbar.Update();
HEROsMod.Draw(Main.spriteBatch);
}
catch (Exception e)
{
ModUtils.DebugText("PostDrawInInventory Error: " + e.Message + e.StackTrace);
}
return true;
},
InterfaceScaleType.UI)
);
}
int rulerLayerIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Ruler"));
if (rulerLayerIndex != -1)
{
layers.Insert(rulerLayerIndex, new LegacyGameInterfaceLayer(
"HerosMod: Game Scale UI",
delegate {
HEROsMod.DrawWorldUI(Main.spriteBatch);
return true;
},
InterfaceScaleType.Game)
);
}
}
public override void PreSaveAndQuit()
{
HEROsMod.instance.prefixEditor.PreSaveAndQuit();
}
//public override void UpdateMusic(ref int music, ref AVF priority)
//{
// HEROsMod.CheckIfGameEnteredOrLeft();
// //Console.WriteLine("?");
// //KeybindController.DoPreviousKeyState();
//}
public override bool HijackGetData(ref byte messageType, ref BinaryReader reader, int playerNumber)
{
if (HEROsModNetwork.Network.CheckIncomingDataForHEROsModMessage(ref messageType, ref reader, playerNumber))
{
//ErrorLogger.Log("Hijacking: " + messageType);
return true;
}
return false;
}
public override void PreUpdateEntities()
{
//Handle callbacks here as this is called on all sides
//May need to filter allside vs clientside callbacks
//Only godmode for now
GodModeService.InvokeGodModeCallback();
}
}
}