Browse Source

Allow additional arguments to be passed from debug UI, giving me a few more testing options

console
Nico de Poel 5 years ago
parent
commit
ebfce9863b
  1. 13
      Assets/Scripts/Bootstrap.cs
  2. 4
      Assets/Scripts/UniQuake.cs

13
Assets/Scripts/Bootstrap.cs

@ -5,7 +5,7 @@ using UnityEngine;
public class Bootstrap : MonoBehaviour
{
private string mod;
private string mod, args;
private float speed = 1.0f;
private UniQuake uq;
@ -22,6 +22,7 @@ public class Bootstrap : MonoBehaviour
uq = gameObject.AddComponent<UniQuake>();
uq.BaseGame = MissionPack.Quake;
uq.ModDirectory = mod;
uq.AdditionalArguments = ParseArgs();
}
if (GUILayout.Button("Start Scourge of Armagon!"))
@ -29,6 +30,7 @@ public class Bootstrap : MonoBehaviour
uq = gameObject.AddComponent<UniQuake>();
uq.BaseGame = MissionPack.Hipnotic;
uq.ModDirectory = mod;
uq.AdditionalArguments = ParseArgs();
}
if (GUILayout.Button("Start Dissolution of Eternity!"))
@ -36,10 +38,14 @@ public class Bootstrap : MonoBehaviour
uq = gameObject.AddComponent<UniQuake>();
uq.BaseGame = MissionPack.Rogue;
uq.ModDirectory = mod;
uq.AdditionalArguments = ParseArgs();
}
GUILayout.Label("Mod directory:");
mod = GUILayout.TextField(mod);
GUILayout.Label("Additional arguments:");
args = GUILayout.TextField(args);
GUILayout.Label("Time scale:");
speed = GUILayout.HorizontalSlider(speed, 0.1f, 5.0f, GUILayout.Width(250));
@ -55,4 +61,9 @@ public class Bootstrap : MonoBehaviour
uq = null;
}
}
private string[] ParseArgs()
{
return args.Split(new[] {' ', '\t', '\r', '\n'}, StringSplitOptions.RemoveEmptyEntries);
}
}

4
Assets/Scripts/UniQuake.cs

@ -18,6 +18,7 @@ public partial class UniQuake: MonoBehaviour
public MissionPack BaseGame { get; set; }
public string ModDirectory { get; set; }
public string[] AdditionalArguments { get; set; }
/// <summary>
/// Time since startup for this particular instance of Quake
@ -63,6 +64,9 @@ public partial class UniQuake: MonoBehaviour
{
arguments.AddRange(new[] { "+developer", "1" });
}
if (AdditionalArguments != null)
arguments.AddRange(AdditionalArguments);
quakeParms = new QuakeParms
{

Loading…
Cancel
Save