Skip to content

Commit

Permalink
UI updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DMagic1 committed Feb 21, 2017
1 parent 667a045 commit 6fba9b3
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 40 deletions.
25 changes: 21 additions & 4 deletions SCANsat.Unity/Unity/SCAN_BigMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,22 +1260,39 @@ public void OnInputClick(BaseEventData eventData)
bigInterface.LockInput = true;
}

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

if (bigInterface == null || m_WaypointInput == null)
return;

m_WaypointInput.text = bigInterface.RandomWaypoint;

waypoint = "";
}

public void SetWaypoint()
{
if (bigInterface == null || m_WaypointInput == null)
return;

bigInterface.LockInput = false;

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

waypoint = "";

GenerateWaypoint();

RefreshIcons();

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

waypointSelecting = false;
}

Expand Down
3 changes: 2 additions & 1 deletion SCANsat.Unity/Unity/SCAN_MainMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public void setMap(ISCAN_MainMap map)

SetPosition(map.Position);

SetGeneratingText(map.MapGenerating);
if (!map.MapType)
SetGeneratingText(map.MapGenerating);

ProcessTooltips();

Expand Down
2 changes: 1 addition & 1 deletion SCANsat.Unity/Unity/SCAN_Overlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void CreateResources(IList<string> resources)
if (m_ResourcePrefab == null || m_ResourceTransform == null)
return;

for (int i = resources.Count - 1; i >= 0; i--)
for (int i = 0; i < resources.Count; i++)
{
string s = resources[i];

Expand Down
74 changes: 40 additions & 34 deletions SCANsat.Unity/Unity/SCAN_ZoomMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public class SCAN_ZoomMap : CanvasFader, IDragHandler, IBeginDragHandler, IEndDr
[SerializeField]
private InputField m_WaypointInput = null;
[SerializeField]
private GameObject m_VesselSyncButton = null;
[SerializeField]
private GameObject m_VesselLockButton = null;
[SerializeField]
private Image m_VesselLockImage = null;
[SerializeField]
private Sprite m_VesselLock = null;
Expand Down Expand Up @@ -208,6 +212,15 @@ public void setMap(ISCAN_ZoomMap map)
if (m_VesselLockImage != null && m_VesselLock != null && m_VesselUnlock != null)
m_VesselLockImage.sprite = map.VesselLock ? m_VesselLock : m_VesselUnlock;

if (!map.ShowVessel)
{
if (m_VesselLockButton != null)
m_VesselLockButton.SetActive(false);

if (m_VesselSyncButton != null)
m_VesselSyncButton.SetActive(false);
}

SetLegend(map.LegendToggle, map.LegendImage, map.LegendLabels);

SetWindowState(map.WindowState);
Expand Down Expand Up @@ -1229,51 +1242,52 @@ public void OnInputClick(BaseEventData eventData)
zoomInterface.LockInput = true;
}

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

if (zoomInterface == null || m_WaypointInput == null)
return;

m_WaypointInput.text = zoomInterface.RandomWaypoint;

waypoint = "";
}

public void SetWaypoint()
{
if (zoomInterface == null || m_WaypointInput == null)
return;

zoomInterface.LockInput = false;

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

waypoint = "";

waypointSelecting = false;
RefreshIcons();

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

if (m_WaypointBar != null)
m_WaypointBar.SetActive(false);
zoomInterface.SetWaypoint(m_WaypointInput.text, tempWaypointLabel.Info.pos);

RefreshIcons();
waypointSelecting = false;
}

public void CancelWaypoint()
{
if (zoomInterface != null)
zoomInterface.LockInput = false;

waypointSelecting = false;

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

if (m_WaypointBar != null)
m_WaypointBar.SetActive(false);
GenerateWaypoint();

RefreshIcons();

waypointSelecting = false;
}

public void MechJebLanding()
Expand All @@ -1283,19 +1297,11 @@ public void MechJebLanding()

waypoint = "";

waypointSelecting = false;

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

if (m_WaypointBar != null)
m_WaypointBar.SetActive(false);
GenerateWaypoint();

RefreshIcons();

waypointSelecting = false;
}

}
Expand Down

0 comments on commit 6fba9b3

Please sign in to comment.