Skip to content

Commit

Permalink
Merge pull request #48 from shanepaton/main
Browse files Browse the repository at this point in the history
Polished Console UI Theme
  • Loading branch information
cheese3660 authored Feb 27, 2023
2 parents f202237 + c680451 commit 54d04f2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Binary file added Bundles/swconsoleui.bundle
Binary file not shown.
24 changes: 17 additions & 7 deletions SpaceWarp/UI/SpaceWarpConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
using KSP.Game;
using KSP.Sim.impl;
using UnityEngine;

using SpaceWarp.API.AssetBundles;
using KSP.Logging;
using static KSP.Map.impl.Targeting.Sample;
using static RTG.Object2ObjectSnap;
using UnityEngine.UI;
using BepInEx.Logging;

namespace SpaceWarp.UI
{
public class SpaceWarpConsole : KerbalBehavior
Expand All @@ -20,6 +25,9 @@ public class SpaceWarpConsole : KerbalBehavior
private static GUIStyle _boxStyle;
private static Vector2 _scrollPosition;

public GUISkin _spaceWarpUISkin;

private readonly List<string> _debugMessages = new List<string>();

public void Start()
{
Expand All @@ -36,19 +44,21 @@ private void Awake()

_windowWidth = (int)(Screen.width * 0.5f);
_windowHeight = (int)(Screen.height * 0.5f);
_windowRect = new Rect((Screen.width * 0.15f), (Screen.height * 0.15f),
0, 0);
_windowRect = new Rect((Screen.width * 0.15f), (Screen.height * 0.15f),0, 0);

ResourceManager.TryGetAsset($"space_warp/swconsoleui/spacewarpConsole.guiskin", out _spaceWarpUISkin);
}

private void OnGUI()
{
GUI.skin = _spaceWarpUISkin;
if (!_drawUI)
{
return;
}

int controlID = GUIUtility.GetControlID(FocusType.Passive);
string header = $"Space Warp Console";
string header = $"spacewarp.console";
GUILayoutOption width = GUILayout.Width((float)(_windowWidth * 0.8));
GUILayoutOption height = GUILayout.Height((float)(_windowHeight * 0.8));

Expand All @@ -73,10 +83,10 @@ private void DrawConsole(int windowID)
{
GUILayout.Label(debugMessage);
}

GUILayout.EndScrollView();
GUILayout.BeginHorizontal();

if (GUILayout.Button("Close"))
{
_drawUI = false;
Expand All @@ -91,7 +101,7 @@ private void DrawConsole(int windowID)
{
GameManager.Instance.Game.ViewController.inputLockManager.ClearControlLocks();
}

GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUI.DragWindow(new Rect(0, 0, 10000, 500));
Expand Down

0 comments on commit 54d04f2

Please sign in to comment.