Game Scene Split up
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
#if UNITY_EDITOR
|
||||
using ProjectM.Simulation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ProjectM.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// EDITOR-ONLY in-game dev-tools overlay (IMGUI, mirrors <c>ConnectionUI</c>). Buttons enqueue
|
||||
/// <see cref="DebugCommandRequest"/> RPCs through <see cref="DebugCommandSendSystem"/>, so they drive the REAL
|
||||
/// server-authoritative paths (and work over a live connection too, not just in-editor). Drop it on a
|
||||
/// GameObject in the DevSandbox (or Game) scene. While open it forces the OS cursor visible
|
||||
/// (<see cref="AimPresentation.ForceCursorVisible"/>) so its buttons stay clickable even while aiming.
|
||||
/// Stripped from player builds (#if UNITY_EDITOR).
|
||||
/// </summary>
|
||||
public class DebugOverlay : MonoBehaviour
|
||||
{
|
||||
bool _open = true;
|
||||
int _siegeSize = 5;
|
||||
int _grantAmount = 50;
|
||||
|
||||
void OnDisable() => AimPresentation.ForceCursorVisible = false;
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
if (GUI.Button(new Rect(Screen.width - 96, 10, 86, 24), _open ? "DEV ▲" : "DEV ▼"))
|
||||
_open = !_open;
|
||||
|
||||
AimPresentation.ForceCursorVisible = _open;
|
||||
if (!_open)
|
||||
return;
|
||||
|
||||
GUILayout.BeginArea(new Rect(Screen.width - 232, 40, 222, 540), GUI.skin.box);
|
||||
GUILayout.Label("DEV TOOLS");
|
||||
|
||||
GUILayout.Label("- World -");
|
||||
_siegeSize = IntField("Siege size", _siegeSize);
|
||||
if (GUILayout.Button("Spawn Wave / Force Siege")) DebugCommandSendSystem.SpawnWave(_siegeSize);
|
||||
if (GUILayout.Button("End Siege")) DebugCommandSendSystem.EndSiege();
|
||||
if (GUILayout.Button("Clear Enemies")) DebugCommandSendSystem.ClearEnemies();
|
||||
if (GUILayout.Button("Force Calm")) DebugCommandSendSystem.SetCalm();
|
||||
if (GUILayout.Button("Advance Goal +1")) DebugCommandSendSystem.AdvanceGoal(1);
|
||||
|
||||
GUILayout.Space(6);
|
||||
GUILayout.Label("- Resources -");
|
||||
_grantAmount = IntField("Amount", _grantAmount);
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Aether")) DebugCommandSendSystem.GrantResource(ResourceId.Aether, _grantAmount);
|
||||
if (GUILayout.Button("Ore")) DebugCommandSendSystem.GrantResource(ResourceId.Ore, _grantAmount);
|
||||
if (GUILayout.Button("Bio")) DebugCommandSendSystem.GrantResource(ResourceId.Biomass, _grantAmount);
|
||||
GUILayout.EndHorizontal();
|
||||
if (GUILayout.Button("Grant Damage Upgrade")) DebugCommandSendSystem.GrantUpgrade();
|
||||
|
||||
GUILayout.Space(6);
|
||||
GUILayout.Label("- Player -");
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Heal")) DebugCommandSendSystem.Heal();
|
||||
if (GUILayout.Button("Kill")) DebugCommandSendSystem.Kill();
|
||||
if (GUILayout.Button("God")) DebugCommandSendSystem.ToggleGod();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Go Base")) DebugCommandSendSystem.Teleport(RegionId.Base);
|
||||
if (GUILayout.Button("Go Expedition")) DebugCommandSendSystem.Teleport(RegionId.Expedition);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.EndArea();
|
||||
}
|
||||
|
||||
static int IntField(string label, int value)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label(label, GUILayout.Width(70));
|
||||
string s = GUILayout.TextField(value.ToString(), GUILayout.Width(60));
|
||||
GUILayout.EndHorizontal();
|
||||
return int.TryParse(s, out var v) ? v : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user