Skip to content

Commit

Permalink
Merge 3.1.2.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed Jan 1, 2015
2 parents 07bed9d + 76aca4a commit a5fcfba
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 20 deletions.
8 changes: 3 additions & 5 deletions KerbalAlarmClock/FrameworkExt/KSPDateStructure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ public static class KSPDateStructure
static public Int32 EpochDayOfYear { get; private set; }
/// <summary>What Year does UT 0 represent</summary>
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
/// <summary>How many seconds (game UT) make up a minute</summary>
static public Int32 SecondsPerMinute { get; private set; }
Expand Down
9 changes: 9 additions & 0 deletions KerbalAlarmClock/KerbalAlarmClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -354,6 +360,9 @@ internal override void OnGUIEvery()
private Int32 WarpRateWorkerInitialPeriodCounter = 0;
internal override void RepeatingWorker()
{
if (AppLauncherToBeSetTrue)
SetAppButtonToTrue();

UpdateDetails();

//Contract stuff
Expand Down
2 changes: 1 addition & 1 deletion KerbalAlarmClock/KerbalAlarmClock.version
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"VERSION": {
"MAJOR": 3,
"MINOR": 1,
"PATCH": 1,
"PATCH": 2,
"BUILD": 0
},
"KSP_VERSION": {
Expand Down
2 changes: 1 addition & 1 deletion KerbalAlarmClock/KerbalAlarmClock_ToolbarButtons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
{
Expand Down
8 changes: 4 additions & 4 deletions KerbalAlarmClock/KerbalAlarmClock_Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}

Expand Down
9 changes: 9 additions & 0 deletions KerbalAlarmClock/KerbalAlarmClock_WindowAdd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
5 changes: 5 additions & 0 deletions KerbalAlarmClock/KerbalAlarmClock_WindowDropDowns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions KerbalAlarmClock/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions KerbalAlarmClock/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,15 @@ 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;
}

internal static String GetPauseIconTexturePath()
{
String textureReturn = "TriggerTech/KerbalAlarmClock/ToolbarIcons/KACIcon-PauseEffect_";
String textureReturn = KACUtils.PathToolbarTexturePath + "/KACIcon-PauseEffect_";

textureReturn = GetIconPercentageFromTime(textureReturn);
return textureReturn;
Expand Down
2 changes: 2 additions & 0 deletions KerbalAlarmClock/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
50 changes: 45 additions & 5 deletions KerbalAlarmClock/SharedStuff/AppLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"); }
Expand Down Expand Up @@ -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");

Expand Down
2 changes: 2 additions & 0 deletions KerbalAlarmClock/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions PlugInFiles/ReadMe-KerbalAlarmClock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a5fcfba

Please sign in to comment.