forked from solidDoWant/Planetbase-Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModListGameState.cs
51 lines (43 loc) · 1.66 KB
/
ModListGameState.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
using Planetbase;
using UnityEngine;
namespace PlanetbaseFramework
{
//This class was thrown together fairly quickly, but should be a decent example on making new gamestates.
public class ModListGameState : GameState
{
private GuiRenderer Renderer { get; } = new GuiRenderer();
public override bool isTitleState()
{
return true;
}
public override void onGui()
{
if (Input.GetKey(KeyCode.Space))
{
return;
}
PrintLine("Loaded Mods:", 0);
for(var i = 0; i < ModLoader.ModList.Count; i++)
{
PrintLine(ModLoader.ModList[i].ModName, i + 1);
}
if (Renderer.renderBackButton(
new Vector2(
Screen.width - GuiRenderer.getMenuButtonSize(FontSize.Huge).x,
Screen.height - GuiRenderer.getMenuButtonSize(FontSize.Huge).y
)
))
{
GameManager.getInstance().setGameStateTitle();
}
}
private void PrintLine(string text, int lineNumber)
{
Vector2 textLocation = new Vector2(50, 80);
GUIStyle labelStyle = Renderer.getLabelStyle(FontSize.Huge, FontStyle.Bold, TextAnchor.LowerLeft, FontType.Title);
labelStyle.normal.textColor = Color.blue;
GUI.Label(new Rect(textLocation.x, textLocation.y + (GuiRenderer.getMenuButtonSize(FontSize.Huge).y )* lineNumber, Screen.width, GuiRenderer.getMenuButtonSize(FontSize.Huge).y - 30), text, labelStyle);
labelStyle.normal.textColor = Color.white;
}
}
}