Skip to content

Commit

Permalink
Merge 1.3.0.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed Apr 28, 2015
2 parents 317072e + 21afee1 commit 1ba0b49
Show file tree
Hide file tree
Showing 17 changed files with 600 additions and 150 deletions.
2 changes: 2 additions & 0 deletions KSPDateTimeUnitTests/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class UnitTest1
[TestMethod]
public void TestDateTime()
{
KSPDateTime dt2 = new KSPDateTime(235, 1);

Double DateUT = 301.123;

KSPDateTime dt = new KSPDateTime(DateUT);
Expand Down
4 changes: 3 additions & 1 deletion PluginBuilder/PublishKSPTWP.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ if($ChoiceRtn -eq 0)
$relKStuff = $reldescr.Replace("\r\n","`r`n")

$KerbalStuffKSPVersion = $KSPVersion.Split(":")[1].Trim(" ")
if ($KerbalStuffKSPVersion.EndsWith(".0")){
if ($KerbalStuffKSPVersion.split(".").length -gt 2 -and $KerbalStuffKSPVersion.EndsWith(".0")){
$KerbalStuffKSPVersion = $KerbalStuffKSPVersion.Substring(0,$KerbalStuffKSPVersion.Length-2)
}

Expand Down Expand Up @@ -263,6 +263,8 @@ if($ChoiceRtn -eq 0)

MergeDevToMaster

"Pausing 3 Secs to let Github catchup"
Start-Sleep -s 3
CreateGitHubRelease

#CreateCurseRelease
Expand Down
6 changes: 6 additions & 0 deletions PluginFiles/ReadMe-TransferWindowPlanner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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 1.3.0.0 - KSP Version: 1.0
- Recompiled for 1.0
- Code changes for launcher
- Updated KAC Wrapper
- Adjusted Editor Lock type

Version 1.2.3.0 - KSP Version: 0.90
- Fixed missing icon (Issue #29)
- Changed input lock in flight mode (Issue #30)
Expand Down
4 changes: 2 additions & 2 deletions TransferWindowPlanner/FrameworkExt/KSPDateTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public int Year {
get { if (CalType == CalendarTypeEnum.Earth)
return _EarthDateTime.Year;
else
return KSPDateStructure.EpochYear + (Int32)UT / KSPDateStructure.SecondsPerYear;
return KSPDateStructure.EpochYear + (Int32)(UT / KSPDateStructure.SecondsPerYear);
}
}

Expand All @@ -31,7 +31,7 @@ public int DayOfYear {
get { if (CalType == CalendarTypeEnum.Earth)
return _EarthDateTime.DayOfYear;
else
return KSPDateStructure.EpochDayOfYear + (Int32)UT / KSPDateStructure.SecondsPerDay % KSPDateStructure.DaysPerYear;
return KSPDateStructure.EpochDayOfYear + (Int32)(UT / KSPDateStructure.SecondsPerDay % KSPDateStructure.DaysPerYear);
}
}

Expand Down
20 changes: 10 additions & 10 deletions TransferWindowPlanner/FrameworkExt/KSPTimeSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Int32 Years
{
if (CalType != CalendarTypeEnum.Earth)
{
return (Int32)UT / KSPDateStructure.SecondsPerYear;
return (Int32)(UT / KSPDateStructure.SecondsPerYear);
}
else
{
Expand All @@ -46,33 +46,33 @@ public Int32 Years
public Int32 Days {
get {
if (CalType != CalendarTypeEnum.Earth) {
return (Int32)UT / KSPDateStructure.SecondsPerDay % KSPDateStructure.DaysPerYear;
return (Int32)(UT / KSPDateStructure.SecondsPerDay % KSPDateStructure.DaysPerYear);
} else {
return (Int32)UT / KSPDateStructure.SecondsPerDay;
return (Int32)(UT / KSPDateStructure.SecondsPerDay);
}
}
}

/// <summary>Gets the hours component of the time interval represented by the current KSPPluginFramework.KSPTimeSpan structure.</summary>
/// <returns>The hour component of the current KSPPluginFramework.KSPTimeSpan structure. The return value ranges between +/- <see cref="KSPDateStructure.HoursPerDay"/></returns>
public int Hours {
get { return (Int32)UT / KSPDateStructure.SecondsPerHour % KSPDateStructure.HoursPerDay; }
get { return (Int32)(UT / KSPDateStructure.SecondsPerHour % KSPDateStructure.HoursPerDay); }
}

/// <summary>Gets the minutes component of the time interval represented by the current KSPPluginFramework.KSPTimeSpan structure.</summary>
/// <returns>
/// The minute component of the current KSPPluginFramework.KSPTimeSpan structure. The return value ranges between +/- <see cref="KSPDateStructure.MinutesPerHour"/>
/// </returns>
public int Minutes {
get { return (Int32)UT / KSPDateStructure.SecondsPerMinute % KSPDateStructure.MinutesPerHour; }
get { return (Int32)(UT / KSPDateStructure.SecondsPerMinute % KSPDateStructure.MinutesPerHour); }
}

/// <summary>Gets the seconds component of the time interval represented by the current KSPPluginFramework.KSPTimeSpan structure.</summary>
/// <returns>
/// The second component of the current KSPPluginFramework.KSPTimeSpan structure. The return value ranges between +/- <see cref="KSPDateStructure.SecondsPerMinute"/>
/// </returns>
public int Seconds {
get { return (Int32)UT % KSPDateStructure.SecondsPerMinute; }
get { return (Int32)(UT % KSPDateStructure.SecondsPerMinute); }
}

/// <summary>Gets the milliseconds component of the time interval represented by the current KSPPluginFramework.KSPTimeSpan structure.</summary>
Expand Down Expand Up @@ -130,10 +130,10 @@ public KSPTimeSpan(int days, int hours, int minutes, int seconds)
/// <param name="milliseconds">Number of milliseconds.</param>
public KSPTimeSpan(int days, int hours, int minutes, int seconds, int milliseconds)
{
UT = days * KSPDateStructure.SecondsPerDay +
hours * KSPDateStructure.SecondsPerHour +
minutes * KSPDateStructure.SecondsPerMinute +
seconds +
UT = (Double)days * KSPDateStructure.SecondsPerDay +
(Double)hours * KSPDateStructure.SecondsPerHour +
(Double)minutes * KSPDateStructure.SecondsPerMinute +
(Double)seconds +
(Double)milliseconds / 1000;
}

Expand Down
4 changes: 2 additions & 2 deletions TransferWindowPlanner/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("1.2.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
2 changes: 1 addition & 1 deletion TransferWindowPlanner/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static Boolean LoadImageFromFile(ref Texture2D tex, String FileName, Stri
{
try
{
MonoBehaviourExtended.LogFormatted_DebugOnly("Loading: {0}", String.Format("{0}/{1}", FolderPath, FileName));
//MonoBehaviourExtended.LogFormatted_DebugOnly("Loading: {0}", String.Format("{0}/{1}", FolderPath, FileName));
tex.LoadImage(System.IO.File.ReadAllBytes(String.Format("{0}/{1}", FolderPath, FileName)));
blnReturn = true;
}
Expand Down
17 changes: 10 additions & 7 deletions TransferWindowPlanner/SharedStuff/AppLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace TransferWindowPlanner
{
public partial class TransferWindowPlanner
{
/// <summary>
/// Sets up the App Button - no longer called by the event as that only happens on StartMenu->SpaceCenter now
/// </summary>
void OnGUIAppLauncherReady()
{
MonoBehaviourExtended.LogFormatted_DebugOnly("AppLauncherReady");
Expand All @@ -35,8 +38,8 @@ internal ApplicationLauncherButton InitAppLauncherButton()
{
ApplicationLauncherButton retButton = null;

ApplicationLauncherButton[] lstButtons = TransferWindowPlanner.FindObjectsOfType<ApplicationLauncherButton>();
LogFormatted("AppLauncher: Creating Button-BEFORE", lstButtons.Length);
//ApplicationLauncherButton[] lstButtons = TransferWindowPlanner.FindObjectsOfType<ApplicationLauncherButton>();
//LogFormatted("AppLauncher: Creating Button-BEFORE", lstButtons.Length);
try
{
retButton = ApplicationLauncher.Instance.AddModApplication(
Expand All @@ -61,24 +64,24 @@ internal ApplicationLauncherButton InitAppLauncherButton()
MonoBehaviourExtended.LogFormatted("AppLauncher: Failed to set up App Launcher Button\r\n{0}", ex.Message);
retButton = null;
}
lstButtons = TransferWindowPlanner.FindObjectsOfType<ApplicationLauncherButton>();
LogFormatted("AppLauncher: Creating Button-AFTER", lstButtons.Length);
//lstButtons = TransferWindowPlanner.FindObjectsOfType<ApplicationLauncherButton>();
//LogFormatted("AppLauncher: Creating Button-AFTER", lstButtons.Length);

return retButton;
}


internal void DestroyAppLauncherButton()
{
LogFormatted("AppLauncher: Destroying Button-BEFORE NULL CHECK");
//LogFormatted("AppLauncher: Destroying Button-BEFORE NULL CHECK");
if (btnAppLauncher != null)
{
ApplicationLauncherButton[] lstButtons = TransferWindowPlanner.FindObjectsOfType<ApplicationLauncherButton>();
LogFormatted("AppLauncher: Destroying Button-Button Count:{0}", lstButtons.Length);
//LogFormatted("AppLauncher: Destroying Button-Button Count:{0}", lstButtons.Length);
ApplicationLauncher.Instance.RemoveModApplication(btnAppLauncher);
btnAppLauncher = null;
}
LogFormatted("AppLauncher: Destroying Button-AFTER NULL CHECK");
//LogFormatted("AppLauncher: Destroying Button-AFTER NULL CHECK");
}

void onAppLaunchToggleOn() {
Expand Down
9 changes: 6 additions & 3 deletions TransferWindowPlanner/SharedStuff/KACWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -559,16 +559,19 @@ public enum AlarmTypeEnum
TransferModelled,
Distance,
Crew,
EarthTime
EarthTime,
Contract,
ContractAuto
}

public enum AlarmActionEnum
{

[Description("Do Nothing-Delete When Past")] DoNothingDeleteWhenPassed,
[Description("Do Nothing")] DoNothing,
[Description("Message Only-No Affect on warp")] MessageOnly,
[Description("Kill Warp Only-No Message")] KillWarpOnly,
[Description("Kill Warp and Message")] KillWarp,
[Description("Pause Game and Message")] PauseGame
[Description("Pause Game and Message")] PauseGame,
}

public enum TimeEntryPrecisionEnum
Expand Down
4 changes: 2 additions & 2 deletions TransferWindowPlanner/SharedStuff/LambertSolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ public static double TransferDeltaV(CelestialBody origin, CelestialBody destinat


}
return ejectionDeltaV + insertionDeltaV;

return oTransfer.DVTotal; //ejectionDeltaV + insertionDeltaV;
}

/// <summary>
Expand Down
7 changes: 4 additions & 3 deletions TransferWindowPlanner/TWP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ internal override void Awake()
}

//Hook the App Launcher
GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
OnGUIAppLauncherReady();
//GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoadRequestedForAppLauncher);

//do the daily version check if required
Expand All @@ -82,7 +83,7 @@ internal override void OnDestroy()

RenderingManager.RemoveFromPostDrawQueue(1, DrawGUI);

GameEvents.onGUIApplicationLauncherReady.Remove(OnGUIAppLauncherReady);
//GameEvents.onGUIApplicationLauncherReady.Remove(OnGUIAppLauncherReady);
DestroyAppLauncherButton();

DestroyToolbarButton(btnToolbar);
Expand Down Expand Up @@ -297,7 +298,7 @@ void DrawGUI()

switch (HighLogic.LoadedScene) {
case GameScenes.SPACECENTER: InputLockManager.SetControlLock(ControlTypes.KSC_FACILITIES, "TWPControlLock"); break;
case GameScenes.EDITOR: InputLockManager.SetControlLock(ControlTypes.EDITOR_LOCK, "TWPControlLock"); break;
case GameScenes.EDITOR: InputLockManager.SetControlLock((ControlTypes.EDITOR_LOCK | ControlTypes.EDITOR_GIZMO_TOOLS), "TWPControlLock"); break;
case GameScenes.FLIGHT: InputLockManager.SetControlLock(ControlTypes.ALL_SHIP_CONTROLS, "TWPControlLock"); break;
case GameScenes.TRACKSTATION:
break;
Expand Down
5 changes: 3 additions & 2 deletions TransferWindowPlanner/TWPWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ internal static Boolean DrawYearMonthDay(ref String strYear, ref String strMonth
//String strDepartureMinYear, strDepartureMinDay, strDepartureMaxYear, strDepartureMaxDay;
internal KSPDateTime dateMinDeparture, dateMaxDeparture;
String strDepartureAltitude, strArrivalAltitude;
String strTravelMinDays, strTravelMaxDays;
internal String strTravelMinDays, strTravelMaxDays;

internal Vector2 vectMouse;
internal Vector2 vectSelected;
Expand Down Expand Up @@ -570,7 +570,8 @@ private void DrawTransferPlot()
GUI.Label(new Rect(PlotPosition.x, PlotPosition.y + PlotHeight / 2 - 30, PlotWidth + 45, 20),
String.Format("Calculating: {0} (@{2:0}km) -> {1} (@{3:0}km)...", TransferSpecs.OriginName, TransferSpecs.DestinationName, TransferSpecs.InitialOrbitAltitude / 1000, TransferSpecs.FinalOrbitAltitude / 1000),
Styles.styleTextYellowBold);
DrawResourceBar(new Rect(PlotPosition.x, PlotPosition.y + PlotHeight / 2 - 10, PlotWidth + 45, 20), (Single)workingpercent);
//DrawResourceBar(new Rect(PlotPosition.x, PlotPosition.y + PlotHeight / 2 - 10, PlotWidth + 45, 20), (Single)workingpercent);
DrawResourceBar(new Rect(PlotPosition.x, PlotPosition.y + 292 / 2 - 10, 292 + 45, 20), (Single)workingpercent);
}
if (Done) {
GUILayout.Label(String.Format("{0} (@{2:0}km) -> {1} (@{3:0}km)", TransferSpecs.OriginName, TransferSpecs.DestinationName, TransferSpecs.InitialOrbitAltitude / 1000, TransferSpecs.FinalOrbitAltitude / 1000), Styles.styleTextYellowBold);
Expand Down
Loading

0 comments on commit 1ba0b49

Please sign in to comment.