Skip to content

Commit

Permalink
New settings option to hide resources with 0 conc for a given planet
Browse files Browse the repository at this point in the history
  • Loading branch information
DMagic1 committed Aug 15, 2020
1 parent 857ad17 commit 3fea0b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SCANsat.Unity/Interfaces/ISCAN_Settings.cs
Expand Up @@ -99,6 +99,8 @@ public interface ISCAN_Settings

bool StockThreshold { get; set; }

bool HideZeroResources { get; set; }

bool GreyScale { get; set; }

bool ExportCSV { get; set; }
Expand Down
13 changes: 13 additions & 0 deletions SCANsat.Unity/Unity/SCAN_SettingsResource.cs
Expand Up @@ -35,6 +35,8 @@ public class SCAN_SettingsResource : SettingsPage
[SerializeField]
private SCAN_Toggle m_StockThresholdToggle = null;
[SerializeField]
private SCAN_Toggle m_HideZeroResourcesToggle = null;
[SerializeField]
private TextHandler m_StockThresholdValue = null;
[SerializeField]
private InputHandler m_ThresholdInput = null;
Expand Down Expand Up @@ -96,6 +98,9 @@ public void setup(ISCAN_Settings set)
if (m_StockThresholdValue != null)
m_StockThresholdValue.OnTextUpdate.Invoke("Stock Scan Threshold: " + set.StockThresholdValue.ToString("P0"));

if (m_HideZeroResourcesToggle != null)
m_HideZeroResourcesToggle.isOn = set.HideZeroResources;

if (set.DisableStock)
{
if (m_InstantScanToggle != null)
Expand Down Expand Up @@ -268,6 +273,14 @@ public void SetThreshold()
}
}

public void HideZeroResources(bool isOn)
{
if (!loaded || settings == null)
return;

settings.HideZeroResources = isOn;
}

public void OnInputClick(BaseEventData eventData)
{
if (!(eventData is PointerEventData) || settings == null)
Expand Down
2 changes: 2 additions & 0 deletions SCANsat/SCAN_Settings_Config.cs
Expand Up @@ -63,6 +63,8 @@ public class SCAN_Settings_Config : MonoBehaviour
[Persistent]
public float StockTreshold = 0.9f;
[Persistent]
public bool HideZeroResources = true;
[Persistent]
public int Interpolation = 8;
[Persistent]
public int ResourceMapHeight = 256;
Expand Down

0 comments on commit 3fea0b4

Please sign in to comment.