Skip to content

Commit

Permalink
Merge pull request #259 from DMagic1/dev
Browse files Browse the repository at this point in the history
Version 17.3
  • Loading branch information
DMagic1 authored Mar 2, 2017
2 parents e812b34 + 27426a5 commit 24559e0
Show file tree
Hide file tree
Showing 127 changed files with 2,792 additions and 774 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":7,
"BUILD":2
"BUILD":3
},
"KSP_VERSION":{
"MAJOR":1,
Expand Down
4 changes: 3 additions & 1 deletion SCANsat.Unity/Interfaces/ISCAN_Color.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ public interface ISCAN_Color

bool BiomeBigMapStockColor { get; set; }

bool BiomeBigMapWhiteBoder { get; set; }
bool BiomeBigMapWhiteBorder { get; set; }

bool BiomeSmallMapStockColor { get; set; }

bool BiomeSmallMapWhiteBorder { get; set; }

bool BiomeZoomMapWhiteBorder { get; set; }

bool TerrainClampOn { get; set; }

bool TerrainReverse { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion SCANsat.Unity/Interfaces/ISCAN_Instruments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface ISCAN_Instruments

bool ResourceButtons { get; }

bool Anomaly { get; }
bool MouseAnomaly { get; set; }

bool TooltipsOn { get; }

Expand Down
6 changes: 4 additions & 2 deletions SCANsat.Unity/Interfaces/ISCAN_Overlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ public interface ISCAN_Overlay

string CurrentResource { get; }

string TooltipText { get; }

bool IsVisible { get; set; }

bool Tooltips { get; set; }
bool OverlayTooltip { get; }

bool DrawOverlay { get; set; }

Expand All @@ -35,7 +37,7 @@ public interface ISCAN_Overlay

bool DrawResource { get; }

bool TooltipsOn { get; }
bool WindowTooltips { get; }

float Scale { get; }

Expand Down
2 changes: 2 additions & 0 deletions SCANsat.Unity/Interfaces/ISCAN_Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public interface ISCAN_Settings

string SaveToConfig { get; }

string CurrentBody { get; }

int TimeWarp { get; set; }

int MapWidth { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions SCANsat.Unity/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0c523d04-a52e-48bb-85b6-d75e8b7a63b9")]

[assembly: AssemblyVersion("1.7.2.0")]
[assembly: AssemblyFileVersion("1.7.2.0")]
[assembly: AssemblyVersion("1.7.3.0")]
[assembly: AssemblyFileVersion("1.7.3.0")]
106 changes: 68 additions & 38 deletions SCANsat.Unity/Unity/SCAN_BigMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public class SCAN_BigMap : CanvasFader, IDragHandler, IBeginDragHandler, IEndDra
private List<SCAN_MapLabel> flagLabels = new List<SCAN_MapLabel>();
private SCAN_MapLabel vesselLabel;
private SCAN_MapLabel tempWaypointLabel;
private SCAN_MapLabel hoverWaypointLabel;

private SCAN_DropDown dropDown;

Expand Down Expand Up @@ -152,6 +153,23 @@ private void Update()
RectTransformUtility.ScreenPointToLocalPointInRectangle(m_MapImage.rectTransform, Input.mousePosition, bigInterface.MainCanvas.worldCamera, out rectPos);

m_ReadoutText.OnTextUpdate.Invoke(bigInterface.MapInfo(rectPos));

if (waypointSelecting)
{
if (hoverWaypointLabel != null)
{
Vector2 mapPos = new Vector2(rectPos.x, rectPos.y + bigInterface.Size.y);

hoverWaypointLabel.UpdateActive(true);

hoverWaypointLabel.UpdatePosition(mapPos);
}
}
}
else if (waypointSelecting)
{
if (hoverWaypointLabel != null)
hoverWaypointLabel.UpdateActive(false);
}

if (bigInterface.OrbitToggle && bigInterface.ShowOrbit)
Expand Down Expand Up @@ -372,16 +390,16 @@ public void SetSize(Vector2 size)
if (m_MapLayout == null)
return;

if (size.x < m_MapLayout.minWidth)
size.x = m_MapLayout.minWidth;
if (size.x + 8 < m_MapLayout.minWidth)
size.x = m_MapLayout.minWidth - 8;
else if (size.x > 8192)
size.x = 8192;

if (size.x % 2 != 0)
size.x += 1;

m_MapLayout.preferredWidth = size.x;
m_MapLayout.preferredHeight = m_MapLayout.preferredWidth / 2;
m_MapLayout.preferredWidth = size.x + 8;
m_MapLayout.preferredHeight = m_MapLayout.preferredWidth / 2 + 8;
}

private void SetLegend(bool isOn, Texture2D tex, IList<string> labels)
Expand Down Expand Up @@ -656,19 +674,14 @@ private void ClearIcons()
Destroy(vesselLabel.gameObject);
}

if (tempWaypointLabel != null)
{
tempWaypointLabel.gameObject.SetActive(false);
Destroy(tempWaypointLabel.gameObject);
}
DestroyWaypoint(tempWaypointLabel);

flagLabels.Clear();
anomalyLabels.Clear();
waypointLabels.Clear();
orbitLabels.Clear();
orbitIconLabels.Clear();
vesselLabel = null;
tempWaypointLabel = null;
}

public void RefreshIcons()
Expand Down Expand Up @@ -759,8 +772,8 @@ public void OnResize(BaseEventData eventData)

if (m_MapLayout.preferredWidth < m_MapLayout.minWidth)
m_MapLayout.preferredWidth = m_MapLayout.minWidth;
else if (m_MapLayout.preferredWidth > 8192)
m_MapLayout.preferredWidth = 8192;
else if (m_MapLayout.preferredWidth > 8200)
m_MapLayout.preferredWidth = 8200;

if (m_MapLayout.preferredWidth % 2 != 0)
m_MapLayout.preferredWidth += 1;
Expand All @@ -773,7 +786,7 @@ public void OnEndResize(BaseEventData eventData)
if (m_MapLayout == null || bigInterface == null)
return;

bigInterface.Size = new Vector2(m_MapLayout.preferredWidth, m_MapLayout.preferredHeight);
bigInterface.Size = new Vector2(m_MapLayout.preferredWidth - 8, m_MapLayout.preferredHeight - 8);

SetIcons();
}
Expand Down Expand Up @@ -813,12 +826,7 @@ public void OnClickMap(BaseEventData eventData)

if (waypointSelecting)
{
if (tempWaypointLabel != null)
{
tempWaypointLabel.gameObject.SetActive(false);
Destroy(tempWaypointLabel.gameObject);
tempWaypointLabel = null;
}
DestroyWaypoint(tempWaypointLabel);

SetWaypoint(pos);
}
Expand Down Expand Up @@ -1238,12 +1246,7 @@ public void GenerateWaypoint()
{
waypointSelecting = !waypointSelecting;

if (tempWaypointLabel != null)
{
tempWaypointLabel.gameObject.SetActive(false);
Destroy(tempWaypointLabel.gameObject);
tempWaypointLabel = null;
}
DestroyWaypoint(tempWaypointLabel);

if (bigInterface == null)
return;
Expand All @@ -1253,15 +1256,38 @@ public void GenerateWaypoint()
if (m_WaypointBar != null)
m_WaypointBar.SetActive(waypointSelecting);

if (waypointSelecting && m_WaypointInput != null)
if (waypointSelecting)
{
if (string.IsNullOrEmpty(waypoint))
m_WaypointInput.text = bigInterface.RandomWaypoint;
else
m_WaypointInput.text = waypoint;
HoverWaypoint();

if (m_WaypointInput != null)
{
if (string.IsNullOrEmpty(waypoint))
m_WaypointInput.text = bigInterface.RandomWaypoint;
else
m_WaypointInput.text = waypoint;
}
}
}

private void HoverWaypoint()
{
MapLabelInfo info = new MapLabelInfo()
{
label = "",
image = bigInterface.WaypointSprite,
pos = new Vector2(),
baseColor = Color.white,
flashColor = Color.red,
flash = true,
width = 20,
alignBottom = true,
show = false
};

hoverWaypointLabel = createWaypoint(0, info, true);
}

public void OnInputClick(BaseEventData eventData)
{
if (!(eventData is PointerEventData) || bigInterface == null)
Expand All @@ -1275,12 +1301,7 @@ public void OnInputClick(BaseEventData eventData)

public void RefreshWaypoint()
{
if (tempWaypointLabel != null)
{
tempWaypointLabel.gameObject.SetActive(false);
Destroy(tempWaypointLabel.gameObject);
tempWaypointLabel = null;
}
DestroyWaypoint(tempWaypointLabel);

if (bigInterface == null || m_WaypointInput == null)
return;
Expand All @@ -1301,11 +1322,11 @@ public void SetWaypoint()

waypoint = "";

RefreshIcons();

if (tempWaypointLabel != null)
bigInterface.SetWaypoint(m_WaypointInput.text, tempWaypointLabel.Info.pos);

RefreshIcons();

waypointSelecting = false;
}

Expand Down Expand Up @@ -1335,5 +1356,14 @@ public void MechJebLanding()
waypointSelecting = false;
}

private void DestroyWaypoint(SCAN_MapLabel waypoint)
{
if (waypoint != null)
{
waypoint.gameObject.SetActive(false);
Destroy(waypoint.gameObject);
waypoint = null;
}
}
}
}
19 changes: 16 additions & 3 deletions SCANsat.Unity/Unity/SCAN_ColorBiome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class SCAN_ColorBiome : SettingsPage
[SerializeField]
private Toggle m_BigMapBorder = null;
[SerializeField]
private Toggle m_ZoomMapBorder = null;
[SerializeField]
private Toggle m_SmallMapColor = null;
[SerializeField]
private Toggle m_SmallMapBorder = null;
Expand Down Expand Up @@ -66,7 +68,10 @@ public void SetBiome(ISCAN_Color color, ISCAN_Settings settings)
m_BigMapColor.isOn = color.BiomeBigMapStockColor;

if (m_BigMapBorder != null)
m_BigMapBorder.isOn = color.BiomeBigMapWhiteBoder;
m_BigMapBorder.isOn = color.BiomeBigMapWhiteBorder;

if (m_ZoomMapBorder != null)
m_ZoomMapBorder.isOn = color.BiomeZoomMapWhiteBorder;

if (m_SmallMapColor != null)
m_SmallMapColor.isOn = color.BiomeSmallMapStockColor;
Expand Down Expand Up @@ -107,7 +112,15 @@ public void BigMapBorder(bool isOn)
if (!loaded || colorInterface == null)
return;

colorInterface.BiomeBigMapWhiteBoder = isOn;
colorInterface.BiomeBigMapWhiteBorder = isOn;
}

public void ZoomMapBorder(bool isOn)
{
if (!loaded || colorInterface == null)
return;

colorInterface.BiomeZoomMapWhiteBorder = isOn;
}

public void SmallMapColor(bool isOn)
Expand Down Expand Up @@ -175,7 +188,7 @@ public void Default()
m_BigMapColor.isOn = colorInterface.BiomeBigMapStockColor;

if (m_BigMapBorder != null)
m_BigMapBorder.isOn = colorInterface.BiomeBigMapWhiteBoder;
m_BigMapBorder.isOn = colorInterface.BiomeBigMapWhiteBorder;

if (m_SmallMapColor != null)
m_SmallMapColor.isOn = colorInterface.BiomeSmallMapStockColor;
Expand Down
Loading

0 comments on commit 24559e0

Please sign in to comment.