Skip to content

Commit

Permalink
Update 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyFaceIndustries committed Jul 16, 2014
1 parent 146b054 commit 4886eff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
Binary file modified GameData/BetterTimeWarp/BetterTimeWarp.dll
Binary file not shown.
43 changes: 22 additions & 21 deletions Source/BetterTimeWarp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class BetterTimeWarp : MonoBehaviour

public TimeWarp timeWarp;
public List<TimeWarpRates> customWarps = new List<TimeWarpRates> ();
public static bool ShowUI = true;

Texture2D upArrow;
Texture2D downArrow;
Expand Down Expand Up @@ -76,16 +77,19 @@ private void Update()
bool windowOpen = false;
public void OnGUI()
{
GUI.skin = skin;

windowOpen = GUI.Toggle (new Rect(timeWarp.timeQuadrantTab.renderer.material.mainTexture.width - 55f, 0f, 20f, 20f), windowOpen, buttonContent, skin.button);
if (windowOpen)
if (ShowUI)
{
windowRect = GUI.Window (60371, windowRect, TimeWarpWindow, "Better Time Warp");
buttonContent = upContent;
GUI.skin = skin;

windowOpen = GUI.Toggle (new Rect (timeWarp.timeQuadrantTab.renderer.material.mainTexture.width - 55f, 0f, 20f, 20f), windowOpen, buttonContent, skin.button);
if (windowOpen)
{
windowRect = GUI.Window (60371, windowRect, TimeWarpWindow, "Better Time Warp");
buttonContent = upContent;
}
else
buttonContent = downContent;
}
else
buttonContent = downContent;
}

bool editToggle = false;
Expand Down Expand Up @@ -192,19 +196,6 @@ public void TimeWarpWindow(int id)
w6 = "1000000";
w7 = "10000000";
}
else
{
PopupDialog.SpawnPopupDialog ("Better Time Warp", "Cannot save custom warp rates because some variables are invalid", "Ok", true, skin);
warpName = "Name";
physics = false;
w1 = "10";
w2 = "100";
w3 = "1000";
w4 = "10000";
w5 = "100000";
w6 = "1000000";
w7 = "10000000";
}
}
}
else
Expand Down Expand Up @@ -468,6 +459,8 @@ public void Start()
BetterTimeWarp.SettingsNode.Save (KSPUtil.ApplicationRootPath + "GameData/BetterTimeWarp/Settings.cfg");

GameEvents.onGameStateSaved.Add (SaveSettings);
GameEvents.onShowUI.Add (ShowUI);
GameEvents.onHideUI.Add (HideUI);

foreach (CelestialBody body in FlightGlobals.Bodies)
{
Expand All @@ -483,6 +476,14 @@ void SaveSettings (Game game)
Debug.Log ("[BetterTimeWarp]: Settings saved");
BetterTimeWarp.SettingsNode = ConfigNode.Load (KSPUtil.ApplicationRootPath + "GameData/BetterTimeWarp/Settings.cfg");
}
void ShowUI()
{
BetterTimeWarp.ShowUI = true;
}
void HideUI()
{
BetterTimeWarp.ShowUI = false;
}
}
}

0 comments on commit 4886eff

Please sign in to comment.