diff --git a/KerbalAlarmClock/FrameworkExt/KSPDateStructure.cs b/KerbalAlarmClock/FrameworkExt/KSPDateStructure.cs
index e4e86eb..1e4ea34 100644
--- a/KerbalAlarmClock/FrameworkExt/KSPDateStructure.cs
+++ b/KerbalAlarmClock/FrameworkExt/KSPDateStructure.cs
@@ -19,15 +19,13 @@ public static class KSPDateStructure
static public Int32 EpochDayOfYear { get; private set; }
/// What Year does UT 0 represent
static public Int32 EpochYear { get; private set; }
-
-
+
static public KSPDateTime EpochAsKSPDateTime {
get {
- return new KSPDateTime(EpochYear, EpochDayOfYear);
+ return new KSPDateTime(EpochYear * SecondsPerYear + EpochDayOfYear* SecondsPerDay);
}
}
-
-
+
//Define the Calendar
/// How many seconds (game UT) make up a minute
static public Int32 SecondsPerMinute { get; private set; }
diff --git a/KerbalAlarmClock/KerbalAlarmClock.cs b/KerbalAlarmClock/KerbalAlarmClock.cs
index 40ecaea..b3e613a 100644
--- a/KerbalAlarmClock/KerbalAlarmClock.cs
+++ b/KerbalAlarmClock/KerbalAlarmClock.cs
@@ -190,6 +190,12 @@ internal override void Start()
}
RemoveInputLock();
+
+ if (WindowVisibleByActiveScene && settings.ButtonStyleToDisplay==Settings.ButtonStyleEnum.Launcher)
+ {
+ AppLauncherToBeSetTrue = true;
+ AppLauncherToBeSetTrueAttemptDate = DateTime.Now;
+ }
}
//Destroy Event - when the DLL is loaded
@@ -354,6 +360,9 @@ internal override void OnGUIEvery()
private Int32 WarpRateWorkerInitialPeriodCounter = 0;
internal override void RepeatingWorker()
{
+ if (AppLauncherToBeSetTrue)
+ SetAppButtonToTrue();
+
UpdateDetails();
//Contract stuff
diff --git a/KerbalAlarmClock/KerbalAlarmClock.version b/KerbalAlarmClock/KerbalAlarmClock.version
index ad8b49b..a345a13 100644
--- a/KerbalAlarmClock/KerbalAlarmClock.version
+++ b/KerbalAlarmClock/KerbalAlarmClock.version
@@ -5,7 +5,7 @@
"VERSION": {
"MAJOR": 3,
"MINOR": 1,
- "PATCH": 1,
+ "PATCH": 2,
"BUILD": 0
},
"KSP_VERSION": {
diff --git a/KerbalAlarmClock/KerbalAlarmClock_ToolbarButtons.cs b/KerbalAlarmClock/KerbalAlarmClock_ToolbarButtons.cs
index 5ccbeea..095d103 100644
--- a/KerbalAlarmClock/KerbalAlarmClock_ToolbarButtons.cs
+++ b/KerbalAlarmClock/KerbalAlarmClock_ToolbarButtons.cs
@@ -36,7 +36,7 @@ internal IButton InitToolbarButton()
{
LogFormatted("Initialising the Toolbar Icon");
btnReturn = ToolbarManager.Instance.add("KerbalAlarmClock", "btnToolbarIcon");
- btnReturn.TexturePath = "TriggerTech/KerbalAlarmClock/ToolbarIcons/KACIcon-Norm";
+ btnReturn.TexturePath = KACUtils.PathToolbarTexturePath + "/KACIcon-Norm";
btnReturn.ToolTip = "Kerbal Alarm Clock";
btnReturn.OnClick += (e) =>
{
diff --git a/KerbalAlarmClock/KerbalAlarmClock_Window.cs b/KerbalAlarmClock/KerbalAlarmClock_Window.cs
index cde82ea..8ac19cd 100644
--- a/KerbalAlarmClock/KerbalAlarmClock_Window.cs
+++ b/KerbalAlarmClock/KerbalAlarmClock_Window.cs
@@ -275,16 +275,16 @@ internal void DrawIcons()
if (alarms.ActiveEnabledFutureAlarms(HighLogic.CurrentGame.Title))
{
if (WindowVisibleByActiveScene)
- TexturePath = "TriggerTech/KerbalAlarmClock/ToolbarIcons/KACIcon-AlarmShow";
+ TexturePath = KACUtils.PathToolbarTexturePath + "/KACIcon-AlarmShow";
else
- TexturePath = "TriggerTech/KerbalAlarmClock/ToolbarIcons/KACIcon-Alarm";
+ TexturePath = KACUtils.PathToolbarTexturePath + "/KACIcon-Alarm";
}
else
{
if (WindowVisibleByActiveScene)
- TexturePath = "TriggerTech/KerbalAlarmClock/ToolbarIcons/KACIcon-NormShow";
+ TexturePath = KACUtils.PathToolbarTexturePath + "/KACIcon-NormShow";
else
- TexturePath = "TriggerTech/KerbalAlarmClock/ToolbarIcons/KACIcon-Norm";
+ TexturePath = KACUtils.PathToolbarTexturePath + "/KACIcon-Norm";
}
}
diff --git a/KerbalAlarmClock/KerbalAlarmClock_WindowAdd.cs b/KerbalAlarmClock/KerbalAlarmClock_WindowAdd.cs
index b199305..96be85b 100644
--- a/KerbalAlarmClock/KerbalAlarmClock_WindowAdd.cs
+++ b/KerbalAlarmClock/KerbalAlarmClock_WindowAdd.cs
@@ -380,6 +380,15 @@ internal void FillAddWindow(int WindowID)
}
if (DrawButtonList(ref AddType,guiButtons))
{
+ //if the choice was the Ap/Pe one then work out the best next choice
+ if(AddType== KACAlarm.AlarmTypeEnum.Apoapsis) {
+
+ if(!KACWorkerGameState.ApPointExists && KACWorkerGameState.PePointExists)
+ AddType = KACAlarm.AlarmTypeEnum.Periapsis;
+ else if(KACWorkerGameState.ApPointExists && KACWorkerGameState.PePointExists &&
+ ((KACWorkerGameState.CurrentVessel == null) ? 0 : KACWorkerGameState.CurrentVessel.orbit.timeToAp) > ((KACWorkerGameState.CurrentVessel == null ) ? 0 : KACWorkerGameState.CurrentVessel.orbit.timeToPe))
+ AddType = KACAlarm.AlarmTypeEnum.Periapsis;
+ }
AddTypeChanged();
}
diff --git a/KerbalAlarmClock/KerbalAlarmClock_WindowDropDowns.cs b/KerbalAlarmClock/KerbalAlarmClock_WindowDropDowns.cs
index 1ea7c44..5a40478 100644
--- a/KerbalAlarmClock/KerbalAlarmClock_WindowDropDowns.cs
+++ b/KerbalAlarmClock/KerbalAlarmClock_WindowDropDowns.cs
@@ -139,6 +139,11 @@ void ddlSettingsButtonStyle_OnSelectionChanged(DropDownList sender, int OldIndex
break;
case Settings.ButtonStyleEnum.Launcher:
btnAppLauncher = InitAppLauncherButton();
+ if (WindowVisibleByActiveScene) {
+ AppLauncherToBeSetTrueAttemptDate = DateTime.Now;
+ AppLauncherToBeSetTrue = true;
+ }
+
break;
}
}
diff --git a/KerbalAlarmClock/Properties/AssemblyInfo.cs b/KerbalAlarmClock/Properties/AssemblyInfo.cs
index 6ea4c9a..8fca64e 100644
--- a/KerbalAlarmClock/Properties/AssemblyInfo.cs
+++ b/KerbalAlarmClock/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.1.1.0")]
-[assembly: AssemblyFileVersion("3.1.1.0")]
+[assembly: AssemblyVersion("3.1.2.0")]
+[assembly: AssemblyFileVersion("3.1.2.0")]
diff --git a/KerbalAlarmClock/Resources.cs b/KerbalAlarmClock/Resources.cs
index ac54c85..8755296 100644
--- a/KerbalAlarmClock/Resources.cs
+++ b/KerbalAlarmClock/Resources.cs
@@ -353,7 +353,7 @@ internal static Texture2D GetPauseIcon(Boolean AppLauncherVersion=false)
internal static String GetWarpIconTexturePath()
{
- String textureReturn = "TriggerTech/KerbalAlarmClock/ToolbarIcons/KACIcon-WarpEffect2_";
+ String textureReturn = KACUtils.PathToolbarTexturePath + "/KACIcon-WarpEffect2_";
textureReturn = GetIconPercentageFromTime(textureReturn);
return textureReturn;
@@ -361,7 +361,7 @@ internal static String GetWarpIconTexturePath()
internal static String GetPauseIconTexturePath()
{
- String textureReturn = "TriggerTech/KerbalAlarmClock/ToolbarIcons/KACIcon-PauseEffect_";
+ String textureReturn = KACUtils.PathToolbarTexturePath + "/KACIcon-PauseEffect_";
textureReturn = GetIconPercentageFromTime(textureReturn);
return textureReturn;
diff --git a/KerbalAlarmClock/Settings.cs b/KerbalAlarmClock/Settings.cs
index f3a3ff9..b8d5695 100644
--- a/KerbalAlarmClock/Settings.cs
+++ b/KerbalAlarmClock/Settings.cs
@@ -237,6 +237,8 @@ internal enum ButtonStyleEnum
internal Boolean RSSActive = false;
[Persistent] internal Boolean RSSShowCalendarToggled=false;
+ [Persistent] internal Int32 AppLauncherSetTrueTimeOut= 6;
+
//Version Stuff
[Persistent] internal Boolean DailyVersionCheck = true;
internal Boolean VersionAttentionFlag = false;
diff --git a/KerbalAlarmClock/SharedStuff/AppLauncher.cs b/KerbalAlarmClock/SharedStuff/AppLauncher.cs
index 69eacbe..237c421 100644
--- a/KerbalAlarmClock/SharedStuff/AppLauncher.cs
+++ b/KerbalAlarmClock/SharedStuff/AppLauncher.cs
@@ -19,11 +19,11 @@ void OnGUIAppLauncherReady()
if (settings.ButtonStyleChosen == Settings.ButtonStyleEnum.Launcher )
{
btnAppLauncher = InitAppLauncherButton();
- if (WindowVisibleByActiveScene)
- {
- LogFormatted("Setting Button True");
- btnAppLauncher.SetTrue();
- }
+ //if (WindowVisibleByActiveScene)
+ //{
+ // LogFormatted("Setting Button True");
+ // btnAppLauncher.SetTrue();
+ //}
}
}
else { LogFormatted("App Launcher-Not Actually Ready"); }
@@ -86,6 +86,46 @@ internal void DestroyAppLauncherButton()
LogFormatted("AppLauncher: Destroying Button-AFTER NULL CHECK");
}
+
+ internal Boolean AppLauncherToBeSetTrue = false;
+ internal DateTime AppLauncherToBeSetTrueAttemptDate;
+ internal void SetAppButtonToTrue()
+ {
+ if (!ApplicationLauncher.Ready)
+ {
+ LogFormatted_DebugOnly("not ready yet");
+ AppLauncherToBeSetTrueAttemptDate = DateTime.Now;
+ return;
+ }
+ ApplicationLauncherButton ButtonToToggle = btnAppLauncher;
+
+ if (ButtonToToggle == null)
+ {
+ LogFormatted_DebugOnly("Button Is Null");
+ AppLauncherToBeSetTrueAttemptDate = DateTime.Now;
+ return;
+ }
+
+
+ if (ButtonToToggle.State != RUIToggleButton.ButtonState.TRUE)
+ {
+ if (AppLauncherToBeSetTrueAttemptDate.AddSeconds(settings.AppLauncherSetTrueTimeOut) < DateTime.Now)
+ {
+ AppLauncherToBeSetTrue = false;
+ LogFormatted("AppLauncher: Unable to set the AppButton to true - tried for {0} secs", settings.AppLauncherSetTrueTimeOut);
+ }
+ else
+ {
+ LogFormatted("Setting App Button True");
+ ButtonToToggle.SetTrue(true);
+ }
+ }
+ else
+ {
+ AppLauncherToBeSetTrue = false;
+ }
+ }
+
void onAppLaunchToggleOn() {
MonoBehaviourExtended.LogFormatted_DebugOnly("TOn");
diff --git a/KerbalAlarmClock/Utilities.cs b/KerbalAlarmClock/Utilities.cs
index df67946..631eb6c 100644
--- a/KerbalAlarmClock/Utilities.cs
+++ b/KerbalAlarmClock/Utilities.cs
@@ -30,6 +30,8 @@ internal static class KACUtils
internal static String DBPathTextures = string.Format("{0}/Textures", DBPathPlugin);
internal static String DBPathPluginSounds = string.Format("{0}/Sounds", DBPathPlugin);
+ internal static String PathToolbarTexturePath = PathToolbarIcons.Replace("\\", "/").Substring(PathToolbarIcons.Replace("\\", "/").ToLower().IndexOf("/gamedata/") + 10);
+
internal static String SavePath;
internal static Boolean BackupSaves()
diff --git a/PlugInFiles/ReadMe-KerbalAlarmClock.txt b/PlugInFiles/ReadMe-KerbalAlarmClock.txt
index 2390a63..05e0e8f 100644
--- a/PlugInFiles/ReadMe-KerbalAlarmClock.txt
+++ b/PlugInFiles/ReadMe-KerbalAlarmClock.txt
@@ -29,6 +29,12 @@ LICENSE
This work is licensed under an MIT license as outlined at the OSI site. Visit the documentation site for more details and Attribution
VERSION HISTORY
+Version 3.1.2.0 - KSP Version: 0.90
+- Updated default button state for app button (Issue #97)
+- Fixed issue with "date" alarms not using epoch (Issue #96)
+- Added feature to detect Ap/Pe when choosing Apsis alarms (Issue #95)
+- Fixed Toolbar code to use relative paths (Issue #94)
+
Version 3.1.1.0 - KSP Version: 0.90
- Fixed issue with Contract alarms disappearing on scene change (Issue #92)
- Added feature to swap the child windows to the left side if the KAC is near the right screen edge (Issue #94)