Skip to content

Commit

Permalink
Merge pull request #249 from DMagic1/release
Browse files Browse the repository at this point in the history
Version 16.10; fixes #243, #244, closes #248
  • Loading branch information
DMagic1 authored Oct 24, 2016
2 parents ef0b20c + 23ec754 commit b147380
Show file tree
Hide file tree
Showing 20 changed files with 193 additions and 110 deletions.
2 changes: 1 addition & 1 deletion SCANassets/SCANsat.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"MAJOR":1,
"MINOR":1,
"PATCH":6,
"BUILD":9
"BUILD":10
},
"KSP_VERSION":{
"MAJOR":1,
Expand Down
6 changes: 3 additions & 3 deletions SCANmechjeb/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
// 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.6.0.9")]
[assembly: AssemblyFileVersion("1.6.0.9")]
[assembly: AssemblyInformationalVersion ("v16.9")]
[assembly: AssemblyVersion("1.6.0.10")]
[assembly: AssemblyFileVersion("1.6.0.10")]
[assembly: AssemblyInformationalVersion ("v16.10")]

[assembly: KSPAssembly ("SCANmechjeb", 0, 4)]
[assembly: KSPAssemblyDependency ("SCANsat", 1, 6)]
Expand Down
9 changes: 8 additions & 1 deletion SCANsat/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
Version 16.10 - 2016-10-24
-----------------------

- Update Toolbar wrapper
- Fix Unity initialization issues
- Fix error in ground track display
- Fix hiding windows in KSC scene

Version 16.9 - 2016-10-13
-----------------------

- Update for KSP 1.2 final
- Update to new resource consumption system
- Fix intermittent background scanning gaps
- Only show the manual map size input field in the flight scene
- Adjust Ore concentration cutoff values

Version 16.8 - 2016-9-23
-----------------------
Expand Down
6 changes: 3 additions & 3 deletions SCANsat/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.6.0.9")]
[assembly: AssemblyFileVersion ("1.6.0.9")]
[assembly: AssemblyInformationalVersion ("v16.9")]
[assembly: AssemblyVersion ("1.6.0.10")]
[assembly: AssemblyFileVersion ("1.6.0.10")]
[assembly: AssemblyInformationalVersion ("v16.10")]

[assembly: KSPAssembly ("SCANsat", 1, 6)]

Expand Down
18 changes: 5 additions & 13 deletions SCANsat/SCAN_PartModules/SCANsat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,14 @@ protected virtual void FixedUpdate()
{
if (sensorType != 0 || SCANcontroller.controller.isVesselKnown(vessel.id, (SCANtype)sensorType))
{
if (TimeWarp.CurrentRate < 15000)
if (!resHandler.UpdateModuleResourceInputs(ref alt_indicator, 1, 0.9, false, true))
{
if (!resHandler.UpdateModuleResourceInputs(ref alt_indicator, 1, 0.9, false, true))
{
unregisterScanner();
powerIsProblem = true;
powerTimer = 0;
}
else
powerIsProblem = false;
unregisterScanner();
powerIsProblem = true;
powerTimer = 0;
}
else if (powerIsProblem)
{
registerScanner();
else
powerIsProblem = false;
}
}
else
unregisterScanner();
Expand Down
2 changes: 1 addition & 1 deletion SCANsat/SCAN_Platform/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ConsoleLogger
public static void Now(string message, params object[] strParams)
{
message = string.Format(message, strParams); // This fills the params into the message
string strMessageLine = string.Format("{1},{0}", message, _AssemblyName); // This adds our standardised wrapper to each line
string strMessageLine = string.Format("[{1}],{0}", message, _AssemblyName); // This adds our standardised wrapper to each line
UnityEngine.Debug.Log(strMessageLine); // And this puts it in the log
}

Expand Down
44 changes: 28 additions & 16 deletions SCANsat/SCAN_Platform/SCAN_MBE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,27 @@ namespace SCANsat.SCAN_Platform
{
public abstract class SCAN_MBE : MonoBehaviour
{
#region Constructor
//private MonoBehaviourExtended()
//#region Constructor
////private MonoBehaviourExtended()
////{
////}
////internal static MonoBehaviourExtended CreateComponent(GameObject AttachTo)
////{
//// MonoBehaviourExtended monoReturn;
//// monoReturn = AttachTo.AddComponent<MonoBehaviourExtended>();
//// return monoReturn;
////}
//static SCAN_MBE()
//{
// UnityEngine.Random.seed = (int)(DateTime.Now - DateTime.Now.Date).TotalSeconds;
// Log.Now("Seed Generated...");
//}
//internal static MonoBehaviourExtended CreateComponent(GameObject AttachTo)
//{
// MonoBehaviourExtended monoReturn;
// monoReturn = AttachTo.AddComponent<MonoBehaviourExtended>();
// return monoReturn;
//}
static SCAN_MBE()
{
UnityEngine.Random.seed = (int)(DateTime.Now - DateTime.Now.Date).TotalSeconds;
}
#endregion
//#endregion
internal T AddComponent<T>() where T : UnityEngine.Component { return gameObject.AddComponent<T>(); }

private bool _RepeatRunning = false;
private bool _OnGUI_FirstRun = false;
private static bool _seedGenerated;
private bool _RepeatRunning;
private bool _OnGUI_FirstRun;
private float _RepeatInitialWait;
private float _RepeatSecs;
private double LooperUTLastStart { get; set; }
Expand Down Expand Up @@ -125,7 +127,17 @@ private void LooperWrapper()

//See this for info on order of execuction
// http://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html
protected virtual void Awake() { Log.Debug("MBE Awakened"); } // 1.
protected virtual void Awake()
{
Log.Debug("MBE Awakened");

if (!_seedGenerated)
{
UnityEngine.Random.InitState((int)(DateTime.Now - DateTime.Now.Date).TotalSeconds);

_seedGenerated = true;
}
} // 1.
//internal virtual void OnEnable() { } // 2.
protected virtual void Start() { Log.Debug("MBE Started"); } // 3.
protected virtual void FixedUpdate() { } // 4a. called (>1) per frame
Expand Down
127 changes: 83 additions & 44 deletions SCANsat/SCAN_Platform/SCAN_MBW.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,35 +93,35 @@ public abstract class SCAN_MBW : SCAN_MBE
* + Ref: http://docs.unity3d.com/Manual/ExecutionOrder.html
*/

#region "Constructor"
protected SCAN_MBW()
: base()
{
//do the assembly name add so we get different windowIDs for multiple plugins
WindowID = UnityEngine.Random.Range(1000, 2000000) + Log._AssemblyName.GetHashCode();
_Visible = false;
Log.Debug("WindowID:{0}", WindowID);

//and look for any customattributes
WindowInitialsAttribute[] attrs = (WindowInitialsAttribute[])Attribute.GetCustomAttributes(GetType(), typeof(WindowInitialsAttribute));
foreach (WindowInitialsAttribute attr in attrs)
{
Visible = attr.Visible;
WindowCaption = attr.Caption;

IsDragging = attr.IsDragging;
DragEnabled = attr.DragEnabled;
ClampEnabled = attr.ClampEnabled;

TooltipsEnabled = attr.TooltipsEnabled;

IsResizing = attr.IsResizing;

WindowSize_Min = attr.MinSize;
WindowSize_Max = attr.MaxSize;
}
}
#endregion
//#region "Constructor"
//protected SCAN_MBW()
// : base()
//{
// //do the assembly name add so we get different windowIDs for multiple plugins
// WindowID = UnityEngine.Random.Range(1000, 2000000) + Log._AssemblyName.GetHashCode();
// _Visible = false;
// Log.Debug("WindowID:{0}", WindowID);

// //and look for any customattributes
// WindowInitialsAttribute[] attrs = (WindowInitialsAttribute[])Attribute.GetCustomAttributes(GetType(), typeof(WindowInitialsAttribute));
// foreach (WindowInitialsAttribute attr in attrs)
// {
// Visible = attr.Visible;
// WindowCaption = attr.Caption;

// IsDragging = attr.IsDragging;
// DragEnabled = attr.DragEnabled;
// ClampEnabled = attr.ClampEnabled;

// TooltipsEnabled = attr.TooltipsEnabled;

// IsResizing = attr.IsResizing;

// WindowSize_Min = attr.MinSize;
// WindowSize_Max = attr.MaxSize;
// }
//}
//#endregion

internal Int32 WindowID { get; private set; }
internal TimeSpan DrawWindowInternalDuration { get; private set; }
Expand All @@ -139,27 +139,26 @@ public Rect GetWindowRect
/* dragging and clamping */

internal Rect DragRect;
public bool DragEnabled = false;
public bool ClampEnabled = true;
internal bool IsDragging = false;
internal RectOffset ClampToScreenOffset = new RectOffset(0, 0, 0, 0);
public bool DragEnabled;
public bool ClampEnabled;
internal bool IsDragging;
internal RectOffset ClampToScreenOffset;

/* tooltips */
protected bool TooltipShown { get; set; }
internal Rect TooltipPosition { get { return _TooltipPosition; } }
internal Vector2d TooltipMouseOffset = new Vector2d();
private Rect _TooltipPosition = new Rect();
internal Vector2d TooltipMouseOffset;
private Rect _TooltipPosition;

public bool TooltipsEnabled = false;
protected Int32 TooltipDisplayForSecs = 15;
protected Int32 TooltipMaxWidth = 250;
private string strToolTipText = "";
private string strLastTooltipText = "";
private float fltTooltipTime = 0f; // display dt for tooltip
internal bool TooltipStatic = false; // FIXME: unused
public bool TooltipsEnabled;
protected Int32 TooltipDisplayForSecs;
protected Int32 TooltipMaxWidth;
private string strToolTipText;
private string strLastTooltipText;
private float fltTooltipTime; // display dt for tooltip

/* resizing windows */
internal bool IsResizing = false;
internal bool IsResizing;
protected Rect WindowRect_Default;
protected Vector2 WindowSize_Min;
protected Vector2 WindowSize_Max;
Expand Down Expand Up @@ -208,7 +207,44 @@ internal void resetWindowPos(Rect r)
public static GUIContent textWithTT(string label, string tooltip) { return new GUIContent(label, tooltip); }
public static GUIContent iconWithTT(Texture tex, string tooltip) { return new GUIContent(tex, tooltip); }

protected override void Awake() { Log.Debug("New MBWindow Awakened"); }
protected override void Awake()
{
Log.Debug("New MBWindow Awakened");

base.Awake();

//do the assembly name add so we get different windowIDs for multiple plugins
WindowID = UnityEngine.Random.Range(1000, 2000000) + Log._AssemblyName.GetHashCode();
_Visible = false;
Log.Debug("WindowID:{0}", WindowID);

ClampToScreenOffset = new RectOffset(0, 0, 0, 0);
_TooltipPosition = new Rect();
ClampEnabled = true;
TooltipDisplayForSecs = 15;
TooltipMaxWidth = 250;
strToolTipText = "";
strLastTooltipText = "";

//and look for any customattributes
WindowInitialsAttribute[] attrs = (WindowInitialsAttribute[])Attribute.GetCustomAttributes(GetType(), typeof(WindowInitialsAttribute));
foreach (WindowInitialsAttribute attr in attrs)
{
Visible = attr.Visible;
WindowCaption = attr.Caption;

IsDragging = attr.IsDragging;
DragEnabled = attr.DragEnabled;
ClampEnabled = attr.ClampEnabled;

TooltipsEnabled = attr.TooltipsEnabled;

IsResizing = attr.IsResizing;

WindowSize_Min = attr.MinSize;
WindowSize_Max = attr.MaxSize;
}
}
protected virtual void DrawWindowPre(Int32 id) { }
protected abstract void DrawWindow(Int32 id);
protected virtual void DrawWindowPost(Int32 id) { }
Expand Down Expand Up @@ -284,6 +320,9 @@ protected void DrawToolTip()
// if the content of the tooltip changes then reset the counter
if (!TooltipShown || hasChanged()) fltTooltipTime = 0f;

if (TooltipMouseOffset == null)
TooltipMouseOffset = new Vector2d();

// Calc the size of the Tooltip
_TooltipPosition.x = Event.current.mousePosition.x + (float)TooltipMouseOffset.x;
_TooltipPosition.y = Event.current.mousePosition.y + (float)TooltipMouseOffset.y;
Expand Down
3 changes: 0 additions & 3 deletions SCANsat/SCAN_Toolbar/SCANtoolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ internal SCANtoolbar()

private void toggleMenu(IButton menu)
{
if (!ToolbarManager.ToolbarAvailable) return; // bail if we don't have a toolbar
if (menu.Drawable == null)
createMenu(menu);
else
Expand Down Expand Up @@ -197,14 +196,12 @@ private void createMenu(IButton menu)

private void destroyMenu(IButton menu)
{
if (!ToolbarManager.ToolbarAvailable) return; // bail if we don't have a toolbar
((PopupMenuDrawable)menu.Drawable).Destroy();
menu.Drawable = null;
}

internal void OnDestroy()
{
if (!ToolbarManager.ToolbarAvailable) return; // bail if we don't have a toolbar
if (SCANButton != null)
SCANButton.Destroy();
if (MapButton != null)
Expand Down
21 changes: 8 additions & 13 deletions SCANsat/SCAN_Toolbar/SCANtoolbarwrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -727,22 +727,17 @@ internal ToolbarTypes() {
button = new ButtonTypes(iButtonType);
}

internal static Type getType(string name) {
foreach (AssemblyLoader.LoadedAssembly assembly in AssemblyLoader.loadedAssemblies)
internal static Type getType(string name)
{
Type type = null;
AssemblyLoader.loadedAssemblies.TypeOperation(t =>
{
try
{
var type = assembly.assembly.GetExportedTypes().SingleOrDefault(t => t.FullName == name);
if (type != null)
{
return type;
}
}
catch (InvalidOperationException)
if (t.FullName == name)
{
type = t;
}
}
return null;
});
return type;
}

internal static PropertyInfo getProperty(Type type, string name) {
Expand Down
Loading

0 comments on commit b147380

Please sign in to comment.