Skip to content

Commit c5f813c

Browse files
committed
Merge 3.12.0.0 to master
2 parents 3fc8bbe + 8c708f7 commit c5f813c

29 files changed

+154
-97
lines changed

KerbalAlarmClock/Framework/ConfigNodeStorage.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Part of KSPPluginFramework
22
Version 1.2
33
4-
Forum Thread:http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework
4+
Forum Thread:https://forum.kerbalspaceprogram.com/topic/60381-ksp-plugin-framework-plugin-examples-and-structure/
55
Author: TriggerAu, 2014
66
License: The MIT License (MIT)
77
*/
@@ -156,6 +156,19 @@ public Boolean Save()
156156
public Boolean Save(String fileFullName)
157157
{
158158
Boolean blnReturn = false;
159+
try
160+
{
161+
if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(fileFullName)))
162+
{
163+
System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(fileFullName));
164+
}
165+
}
166+
catch (Exception ex)
167+
{
168+
LogFormatted("Unable to create directory for ConfigNode file({0})-Error:{1}", fileFullName, ex.Message);
169+
blnReturn = false;
170+
}
171+
159172
try
160173
{
161174
//Encode the current object

KerbalAlarmClock/Framework/ExtensionsUnity.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Part of KSPPluginFramework
22
Version 1.2
33
4-
Forum Thread:http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework
4+
Forum Thread:https://forum.kerbalspaceprogram.com/topic/60381-ksp-plugin-framework-plugin-examples-and-structure/
55
Author: TriggerAu, 2014
66
License: The MIT License (MIT)
77
*/
@@ -37,13 +37,23 @@ public static Rect ClampToScreen(this Rect r, RectOffset ScreenBorder)
3737
return r.ClampToScreen(ScreenBorder, 1f);
3838
}
3939

40+
private static RectOffset zeroRectOffset;
4041
/// <summary>
4142
/// Ensure that the Rect remains within the screen bounds
4243
/// </summary>
4344
/// <param name="ScreenBorder">A Border to the screen bounds that the Rect will be clamped inside (can be negative)</param>
4445
/// <param name="scale">the UIScale to calc at</param>
4546
public static Rect ClampToScreen(this Rect r, RectOffset ScreenBorder, float scale)
4647
{
48+
if (ScreenBorder == null)
49+
{
50+
//catch a default if we need it
51+
if (zeroRectOffset == null)
52+
{
53+
zeroRectOffset = new RectOffset(0, 0, 0, 0);
54+
}
55+
ScreenBorder = zeroRectOffset;
56+
}
4757
r.x = Mathf.Clamp(r.x * scale, ScreenBorder.left * scale, Screen.width - r.width * scale - ScreenBorder.right * scale) / scale;
4858
r.y = Mathf.Clamp(r.y * scale, ScreenBorder.top * scale, Screen.height - r.height * scale - ScreenBorder.bottom * scale) / scale;
4959

KerbalAlarmClock/Framework/MonoBehaviourExtended.cs

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Part of KSPPluginFramework
22
Version 1.2
33
4-
Forum Thread:http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework
4+
Forum Thread:https://forum.kerbalspaceprogram.com/topic/60381-ksp-plugin-framework-plugin-examples-and-structure/
55
Author: TriggerAu, 2014
66
License: The MIT License (MIT)
77
*/
@@ -57,8 +57,8 @@ public abstract class MonoBehaviourExtended : MonoBehaviour
5757
//}
5858
static MonoBehaviourExtended()
5959
{
60+
//Must do this in awake now
6061
//UnityEngine.Random.seed = (int)(DateTime.Now - DateTime.Now.Date).TotalSeconds;
61-
UnityEngine.Random.InitState((int)(DateTime.Now - DateTime.Now.Date).TotalSeconds);
6262
}
6363
#endregion
6464

@@ -256,16 +256,29 @@ private void RepeatingWorkerWrapper()
256256
#endregion
257257

258258
#region Standard Monobehaviour definitions-for overriding
259-
//See this for info on order of execuction
260-
// http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html
259+
//See this for info on order of execution
260+
// https://docs.unity3d.com/Manual/ExecutionOrder.html
261261

262262
/// <summary>
263263
/// Unity Help: Awake is called when the script instance is being loaded.
264264
///
265265
/// Trigger: Override this for initialization Code - this is before the Start Event
266-
/// See this for info on order of execuction: http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html
266+
/// See this for info on order of execution: https://docs.unity3d.com/Manual/ExecutionOrder.html
267267
/// </summary>
268-
internal virtual void Awake()
268+
private void Awake()
269+
{
270+
if(!randomInitialized)
271+
{
272+
UnityEngine.Random.InitState((int)(DateTime.Now - DateTime.Now.Date).TotalMilliseconds);
273+
randomInitialized = true;
274+
}
275+
276+
OnAwake();
277+
}
278+
279+
private static bool randomInitialized = false;
280+
281+
internal virtual void OnAwake()
269282
{
270283
LogFormatted_DebugOnly("New MBExtended Awakened");
271284
}
@@ -274,7 +287,7 @@ internal virtual void Awake()
274287
/// Unity: Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.
275288
///
276289
/// Trigger: This is the last thing that happens before the scene starts doing stuff
277-
/// See this for info on order of execuction: http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html
290+
/// See this for info on order of execution: https://docs.unity3d.com/Manual/ExecutionOrder.html
278291
/// </summary>
279292
internal virtual void Start()
280293
{
@@ -285,7 +298,7 @@ internal virtual void Start()
285298
/// Unity: This function is called every fixed framerate frame, if the MonoBehaviour is enabled.
286299
///
287300
/// Trigger: This Update is called at a fixed rate and usually where you do all your physics stuff for consistent results
288-
/// See this for info on order of execuction: http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html
301+
/// See this for info on order of execution: https://docs.unity3d.com/Manual/ExecutionOrder.html
289302
/// </summary>
290303
internal virtual void FixedUpdate()
291304
{ }
@@ -294,7 +307,7 @@ internal virtual void FixedUpdate()
294307
/// Unity: LateUpdate is called every frame, if the MonoBehaviour is enabled.
295308
///
296309
/// Trigger: This Update is called just before the rendering, and where you can adjust any graphical values/positions based on what has been updated in the physics, etc
297-
/// See this for info on order of execuction: http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html
310+
/// See this for info on order of execution: https://docs.unity3d.com/Manual/ExecutionOrder.html
298311
/// </summary>
299312
internal virtual void LateUpdate()
300313
{ }
@@ -308,7 +321,7 @@ internal virtual void LateUpdate()
308321
///
309322
/// NOTE: The class must be attached to a camera object to have this get called - obj = MapView.MapCamera.gameObject.AddComponent<MBExtended>();
310323
///
311-
/// See this for info on order of execuction: http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html
324+
/// See this for info on order of execution: https://docs.unity3d.com/Manual/ExecutionOrder.html
312325
/// </summary>
313326
internal virtual void OnPreCull()
314327
{ }
@@ -317,7 +330,7 @@ internal virtual void OnPreCull()
317330
/// Unity: Update is called every frame, if the MonoBehaviour is enabled.
318331
///
319332
/// Trigger: This is usually where you stick all your control inputs, keyboard handling, etc
320-
/// See this for info on order of execuction: http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html
333+
/// See this for info on order of execution: https://docs.unity3d.com/Manual/ExecutionOrder.html
321334
/// </summary>
322335
internal virtual void Update()
323336
{ }
@@ -326,7 +339,7 @@ internal virtual void Update()
326339
/// Unity Help: This function is called when the MonoBehaviour will be destroyed..
327340
///
328341
/// Trigger: Override this for destruction and cleanup code
329-
/// See this for info on order of execuction: http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html
342+
/// See this for info on order of execution: https://docs.unity3d.com/Manual/ExecutionOrder.html
330343
/// </summary>
331344
internal virtual void OnDestroy()
332345
{

KerbalAlarmClock/FrameworkExt/KSPDateStructure.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
using System.Linq;
55
using System.Text;
66

7-
using KerbalAlarmClock;
8-
97
namespace KSPPluginFramework
108
{
119

KerbalAlarmClock/KerbalAlarmClock.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public KerbalAlarmClock()
105105
}
106106

107107
//Awake Event - when the DLL is loaded
108-
internal override void Awake()
108+
internal override void OnAwake()
109109
{
110110
LogFormatted("Awakening the KerbalAlarmClock-{0}", MonoName);
111111

@@ -599,15 +599,10 @@ public void DrawGUI()
599599
//If the mainwindow is visible And no pause menu then draw it
600600
if (WindowVisibleByActiveScene)
601601
{
602+
GUIUtility.ScaleAroundPivot(guiScale, Vector2.zero);
602603
DrawWindowsPre();
603-
604-
// Set the scale for this run at stuff
605-
GUIUtility.ScaleAroundPivot(guiScale, Vector2.zero);
606-
DrawWindows();
607-
GUIUtility.ScaleAroundPivot(Vector2.one, Vector2.zero);
608-
609-
DrawWindowsPost();
610-
604+
DrawWindows();
605+
DrawWindowsPost();
611606
}
612607

613608
if (settings.WarpToEnabled)
@@ -619,7 +614,7 @@ public void DrawGUI()
619614
ControlInputLocks();
620615

621616
//Now do the stuff to close the quick alarms window if you click off it
622-
if (_ShowQuickAdd && Event.current.type == EventType.mouseDown && !_WindowQuickAddRect.Contains(Event.current.mousePosition) && !WindowPosByActiveScene.Contains(Event.current.mousePosition))
617+
if (_ShowQuickAdd && Event.current.type == EventType.MouseDown && !_WindowQuickAddRect.Contains(Event.current.mousePosition) && !WindowPosByActiveScene.Contains(Event.current.mousePosition))
623618
_ShowQuickAdd = false;
624619

625620
//If Game is paused then update Earth Alarms for list drawing
@@ -1881,7 +1876,7 @@ private void ParseAlarmsAndAffectWarpAndPause(double SecondsTillNextUpdate)
18811876
}
18821877

18831878
LogFormatted("Actioning Alarm");
1884-
LogFormatted("{0}",tmpAlarm.Actions);
1879+
LogFormatted_DebugOnly("{0}",tmpAlarm.Actions);
18851880
}
18861881

18871882
}

KerbalAlarmClock/KerbalAlarmClock.csproj

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<AppDesignerFolder>Properties</AppDesignerFolder>
1515
<RootNamespace>KerbalAlarmClock</RootNamespace>
1616
<AssemblyName>KerbalAlarmClock</AssemblyName>
17-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
17+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1818
<FileAlignment>512</FileAlignment>
1919
<TargetFrameworkProfile />
2020
<SccProjectName>SAK</SccProjectName>
@@ -50,9 +50,29 @@
5050
<Reference Include="System" />
5151
<Reference Include="System.Data" />
5252
<Reference Include="System.Xml" />
53-
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
54-
<SpecificVersion>False</SpecificVersion>
55-
<HintPath>$(KSP_DIR)\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
53+
<Reference Include="UnityEngine.AnimationModule">
54+
<HintPath>$(KSP_DIR)\KSP_x64_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
55+
</Reference>
56+
<Reference Include="UnityEngine.AudioModule">
57+
<HintPath>$(KSP_DIR)\KSP_x64_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
58+
</Reference>
59+
<Reference Include="UnityEngine.CoreModule">
60+
<HintPath>$(KSP_DIR)\KSP_x64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
61+
</Reference>
62+
<Reference Include="UnityEngine.ImageConversionModule">
63+
<HintPath>$(KSP_DIR)\KSP_x64_Data\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
64+
</Reference>
65+
<Reference Include="UnityEngine.IMGUIModule">
66+
<HintPath>$(KSP_DIR)\KSP_x64_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
67+
</Reference>
68+
<Reference Include="UnityEngine.InputLegacyModule">
69+
<HintPath>$(KSP_DIR)\KSP_x64_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
70+
</Reference>
71+
<Reference Include="UnityEngine.TextRenderingModule">
72+
<HintPath>$(KSP_DIR)\KSP_x64_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
73+
</Reference>
74+
<Reference Include="UnityEngine.UnityWebRequestWWWModule">
75+
<HintPath>$(KSP_DIR)\KSP_x64_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll</HintPath>
5676
</Reference>
5777
</ItemGroup>
5878
<ItemGroup>

KerbalAlarmClock/KerbalAlarmClock.version

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"DOWNLOAD" : "https://github.com/TriggerAu/KerbalAlarmClock/releases",
55
"VERSION": {
66
"MAJOR": 3,
7-
"MINOR": 10,
7+
"MINOR": 12,
88
"PATCH": 0,
99
"BUILD": 0
1010
},
1111
"KSP_VERSION": {
1212
"MAJOR": 1,
13-
"MINOR": 6,
14-
"PATCH": 0
13+
"MINOR": 8,
14+
"PATCH": 1
1515
},
1616
"KSP_VERSION_MIN": {
1717
"MAJOR": 1,
18-
"MINOR": 6,
18+
"MINOR": 8,
1919
"PATCH": 0
2020
},
2121
"KSP_VERSION_MAX": {
2222
"MAJOR": 1,
23-
"MINOR": 6,
23+
"MINOR": 8,
2424
"PATCH": 99
2525
}
2626
}

KerbalAlarmClock/KerbalAlarmClock_Window.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ private void windowMainMouseEvents()
961961
}
962962

963963
//watch for mousedown
964-
if (Event.current.type == EventType.mouseDown && Event.current.button == 0)
964+
if (Event.current.type == EventType.MouseDown && Event.current.button == 0)
965965
{
966966
LogFormatted_DebugOnly("Resize Width Start");
967967
resizingWidth = true;
@@ -1020,7 +1020,7 @@ private void ClearCustomCursor(ref Boolean Flag)
10201020
private void OnGUIMouseEvents()
10211021
{
10221022
//kill the resize bools if mouse up
1023-
if ((resizingWidth || resizingHeight || resizingBoth) && Event.current.type == EventType.mouseUp && Event.current.button == 0)
1023+
if ((resizingWidth || resizingHeight || resizingBoth) && Event.current.type == EventType.MouseUp && Event.current.button == 0)
10241024
{
10251025
LogFormatted_DebugOnly("Resize Stop");
10261026
resizingWidth = resizingHeight = resizingBoth = false;
@@ -1654,7 +1654,7 @@ private Boolean ToggleResult(ref Boolean Old, ref Boolean New)
16541654
if (Old != New)
16551655
{
16561656
Old = New;
1657-
LogFormatted("Toggle Changed:" + New.ToString());
1657+
LogFormatted_DebugOnly("Toggle Changed:" + New.ToString());
16581658
return true;
16591659
}
16601660
return false;
@@ -1797,7 +1797,7 @@ internal Boolean DrawCheckbox(ref Boolean blnVar, GUIContent content, Int32 Chec
17971797
{
17981798
//if its clicked then toggle the boolean
17991799
blnVar = !blnVar;
1800-
LogFormatted("Toggle Changed:" + blnVar);
1800+
LogFormatted_DebugOnly("Toggle Changed:" + blnVar);
18011801
}
18021802

18031803
GUILayout.EndHorizontal();
@@ -2142,7 +2142,7 @@ internal Boolean DrawButtonList(ref Int32 Selected, GUIStyle ButtonStyle,Int32 S
21422142
GUILayout.EndHorizontal();
21432143

21442144
if (InitialChoice != Selected)
2145-
LogFormatted(String.Format("Button List Changed:{0} to {1}", InitialChoice, Selected));
2145+
LogFormatted_DebugOnly(String.Format("Button List Changed:{0} to {1}", InitialChoice, Selected));
21462146

21472147

21482148
return !(InitialChoice == Selected);

KerbalAlarmClock/KerbalAlarmClock_WindowAdd.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ private void WindowLayout_AddPane_Transfer()
15391539
GUILayout.Label("RSS detected - it is recommended that you use the Transfer Window Planner Plugin to plan transfers", KACResources.styleAddXferName);
15401540
GUILayout.Space(-8);
15411541
if (GUILayout.Button("Click here to open the TWP forum thread", KACResources.styleContent))
1542-
Application.OpenURL("http://forum.kerbalspaceprogram.com/threads/93115");
1542+
Application.OpenURL("https://forum.kerbalspaceprogram.com/topic/84005-transfer-window-planner/");
15431543
intAddXferHeight += 58;
15441544
}
15451545

KerbalAlarmClock/KerbalAlarmClock_WindowAlarm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private static Boolean CheckVesselOrCrewForJump(String ID, KACAlarm.AlarmTypeEnu
219219
//Stuff to do with stored VesselIDs
220220
private static void DrawStoredVesselIDMissing(String VesselID)
221221
{
222-
if (!StoredVesselExists(VesselID))
222+
if (!(VesselID == null || VesselID == "") && !StoredVesselExists(VesselID))
223223
{
224224
GUILayout.Label("Stored VesselID no longer exists",KACResources.styleLabelWarning);
225225
}

0 commit comments

Comments
 (0)