-
Notifications
You must be signed in to change notification settings - Fork 0
/
WindowTemplate.cs
45 lines (37 loc) · 1.03 KB
/
WindowTemplate.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CareerManager.RectExtensions;
using KSPPluginFramework;
using UnityEngine;
namespace MissionList
{
///[KSPAddon(KSPAddon.Startup.MainMenu,true)]
public class WindowTemplate : MonoBehaviourExtended
{
// create window position object as a new rect value
private static Rect _mainwindowPosition = new Rect();
internal override void Awake()
{
DontDestroyOnLoad(this);
}
internal override void Update()
{
}
void OnGUI()
{
OnDraw();
}
private void OnDraw()
{
_mainwindowPosition = GUILayout.Window(01, _mainwindowPosition, OnWindow, "Title");
if (_mainwindowPosition.x == 0f && -_mainwindowPosition.y == 0f)
_mainwindowPosition = _mainwindowPosition.CenterScreen();
}
private void OnWindow(int windowId)
{
GUI.DragWindow();
}
}
}