This repository was archived by the owner on Dec 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMorePPSettings.cs
More file actions
81 lines (71 loc) · 2.25 KB
/
MorePPSettings.cs
File metadata and controls
81 lines (71 loc) · 2.25 KB
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
using HarmonyLib;
using Sandbox.Game.World;
using Sandbox.Graphics.GUI;
using Sandbox.ModAPI;
using SpaceEngineers.Game.GUI;
using System.Reflection;
using VRage.Plugins;
using VRageMath;
namespace MorePPSettings
{
public class MorePPSettings : IPlugin
{
public void Init(object gameInstance)
{
var x = new Harmony("MorePPSettings");
PPSettings.Static = PPSettings.DefaultSettings;
PPSettings.Load();
x.PatchAll(Assembly.GetExecutingAssembly());
MySession.AfterLoading += Loaded;
}
[HarmonyPatch(typeof(MyGuiScreenOptionsGraphics))]
public class ControlPanelOverridePatch
{
[HarmonyPostfix]
[HarmonyPatch("RecreateControls")]
static void ControlsAddition(ref MyGuiScreenOptionsGraphics __instance)
{
Vector2 value = new Vector2(90f) / MyGuiConstants.GUI_OPTIMAL_SIZE;
float y = MyGuiConstants.SCREEN_CAPTION_DELTA_Y * 0.5f;
Vector2 vector = (__instance.Size.Value / 2f - value) * new Vector2(-1f, -1f) + new Vector2(0f, y);
Vector2 value8 = vector + new Vector2(0.4f, 0f);
Vector2 value4 = new Vector2(0f, 0.049f);
var button = new MyGuiControlButton()
{
Position = value8 + 15f * value4,
Text = "More PP Settings",
};
button.ButtonClicked += OpenPPGui;
__instance.Controls.Add(button);
}
public static void OpenPPGui(MyGuiControlButton btn)
{
MyGuiSandbox.AddScreen(new PPGui());
}
}
//probably a dumb idea- but sometimes it just resets
int count = 300;
public void Update()
{
if (count > 0)
{
count--;
return;
}
if (MyAPIGateway.Session != null)
{
if (PPSettings.IsDifferent())
{
PPSettings.Apply();
}
}
}
public void Loaded()
{
PPSettings.Apply();
}
public void Dispose()
{
}
}
}