Skip to content

Commit

Permalink
Some refactoring and untabifying
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Feb 4, 2020
1 parent 157960d commit e7042b7
Show file tree
Hide file tree
Showing 6 changed files with 292 additions and 304 deletions.
9 changes: 4 additions & 5 deletions Source/CommNetFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
namespace RealSolarSystem
{
[KSPAddon(KSPAddon.Startup.SpaceCentre, true)]

public class RSSCommNetSettings : MonoBehaviour
{
void Start()
public void Start()
{
try
{
Expand All @@ -18,7 +17,7 @@ void Start()
float occlusionMultiplierInAtm = 1.0f;
float occlusionMultiplierInVac = 1.0f;

Debug.Log("[RealSolarSystem]: Checking for custom CommNet settings...");
Debug.Log("[RealSolarSystem] Checking for custom CommNet settings...");

foreach (ConfigNode RSSSettings in GameDatabase.Instance.GetConfigNodes("REALSOLARSYSTEM"))
{
Expand All @@ -32,7 +31,7 @@ void Start()
{
// Set the default CommNet parameters for RealSolarSystem.

Debug.Log("[RealSolarSystem]: Updating the CommNet settings...");
Debug.Log("[RealSolarSystem] Updating the CommNet settings...");

HighLogic.CurrentGame.Parameters.CustomParams<CommNetParams>().enableGroundStations = enableExtraGroundStations;
HighLogic.CurrentGame.Parameters.CustomParams<CommNetParams>().occlusionMultiplierAtm = occlusionMultiplierInAtm;
Expand All @@ -41,7 +40,7 @@ void Start()
}
catch (Exception exceptionStack)
{
Debug.Log("[RealSolarSystem]: RSSCommNetSettings.Start() caught an exception: " + exceptionStack);
Debug.Log("[RealSolarSystem] RSSCommNetSettings.Start() caught an exception: " + exceptionStack);
}
finally
{
Expand Down
17 changes: 6 additions & 11 deletions Source/GUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
namespace RealSolarSystem
{
// From Starwaster.

[KSPAddon(KSPAddon.Startup.Flight, false)]

public class RealSolarSystemEditor : MonoBehaviour
{
static Rect windowPosition = new Rect(64, 64, 320, 640);
Expand Down Expand Up @@ -39,8 +37,6 @@ public void Apply()
{
Camera[] cameras = Camera.allCameras;

float ftmp;

try
{
bool notFound = true;
Expand All @@ -49,7 +45,7 @@ public void Apply()
{
if (camName.Equals(cam.name))
{
if (float.TryParse(depth, out ftmp))
if (float.TryParse(depth, out float ftmp))
cam.depth = ftmp;

if (float.TryParse(farClipPlane, out ftmp))
Expand All @@ -68,12 +64,12 @@ public void Apply()

if (notFound)
{
Debug.Log("[RealSolarSystem]: Could not find camera " + camName + " when applying settings!");
Debug.Log($"[RealSolarSystem] Could not find camera {camName} when applying settings!");
}
}
catch (Exception exceptionStack)
{
Debug.Log("[RealSolarSystem]: Error applying to camera " + camName + ": exception " + exceptionStack.Message);
Debug.Log($"[RealSolarSystem] Error applying to camera {camName}: exception {exceptionStack.Message}");
}
}
}
Expand Down Expand Up @@ -110,7 +106,7 @@ public void Update()
}
catch (Exception exceptionStack)
{
Debug.Log("[RealSolarSystem]: Exception getting camera " + cam.name + "\n" + exceptionStack);
Debug.Log($"[RealSolarSystem] Exception getting camera {cam.name}\n{exceptionStack}");
}
}
}
Expand All @@ -121,8 +117,7 @@ public void Update()
}
}


void OnGUI()
public void OnGUI()
{
if (GUIOpen)
{
Expand All @@ -137,7 +132,7 @@ public void Start()
windowStyle.stretchHeight = true;
}

void ShowGUI(int windowID)
private void ShowGUI(int windowID)
{
GUILayout.BeginVertical();

Expand Down
7 changes: 3 additions & 4 deletions Source/InstallationChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
namespace RealSolarSystem
{
[KSPAddon(KSPAddon.Startup.Instantly, true)]

class RSSInstallationCheck : MonoBehaviour
{
void Start ()
public void Start ()
{
try
{
Expand All @@ -18,7 +17,7 @@ void Start ()

if (!Directory.Exists (szTextureFolderPath))
{
Debug.Log ("[RealSolarSystem]: No texture pack detected!");
Debug.Log ("[RealSolarSystem] No texture pack detected!");

PopupDialog.SpawnPopupDialog
(
Expand Down Expand Up @@ -53,7 +52,7 @@ void Start ()
}
catch (Exception exceptionStack)
{
Debug.Log ("[RealSolarSystem]: RSSInstallationCheck.Start() caught an exception: " + exceptionStack);
Debug.Log("[RealSolarSystem] RSSInstallationCheck.Start() caught an exception: " + exceptionStack);
}
finally
{
Expand Down
Loading

0 comments on commit e7042b7

Please sign in to comment.