diff --git a/Assets/PostProcessingProfiles/DefaultPP.asset b/Assets/PostProcessingProfiles/DefaultPP.asset
index 6d2d084..53d294b 100644
--- a/Assets/PostProcessingProfiles/DefaultPP.asset
+++ b/Assets/PostProcessingProfiles/DefaultPP.asset
@@ -42,10 +42,10 @@ MonoBehaviour:
ambientOcclusion:
m_Enabled: 1
m_Settings:
- intensity: 0.65
- radius: 0.25
- sampleCount: 10
- downsampling: 1
+ intensity: 1
+ radius: 0.1
+ sampleCount: 16
+ downsampling: 0
forceForwardCompatibility: 0
ambientOnly: 0
highPrecision: 0
diff --git a/Assets/Scenes/TestMap.unity b/Assets/Scenes/TestMap.unity
index c5d12a2..1176640 100644
--- a/Assets/Scenes/TestMap.unity
+++ b/Assets/Scenes/TestMap.unity
@@ -456,7 +456,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 0, y: 1000}
+ m_SizeDelta: {x: 0, y: 300}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &566501562
MonoBehaviour:
@@ -756,7 +756,7 @@ MonoBehaviour:
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
- m_UiScaleMode: 0
+ m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
@@ -1328,7 +1328,10 @@ MonoBehaviour:
Panel: {fileID: 2000206069}
InputField: {fileID: 270758323}
TextField: {fileID: 1815899005}
- Visible: 0
+ Visible: 1
+ RowLength: 80
+ MaxLinesUntilCleanup: 30
+ LineCountSavedFromCleanup: 15
--- !u!4 &1463006272
Transform:
m_ObjectHideFlags: 0
@@ -1602,6 +1605,7 @@ MonoBehaviour:
ID: 0
Mesh: {fileID: 1229079791}
BlinkLength: 1
+ BlinkBrightness: 1.5
BlinkColor: {r: 1, g: 0.6, b: 0, a: 1}
--- !u!65 &1988211394
BoxCollider:
diff --git a/Assets/Scripts/Console/DebugConsole.cs b/Assets/Scripts/Console/DebugConsole.cs
index 176851e..5c2874c 100644
--- a/Assets/Scripts/Console/DebugConsole.cs
+++ b/Assets/Scripts/Console/DebugConsole.cs
@@ -35,7 +35,27 @@ namespace Cyber.Console {
///
public bool Visible = false;
+ ///
+ /// The length of a row in the console in characters.
+ ///
+ public int RowLength = 80;
+
+ ///
+ /// The linecount threshold when the is cleaned
+ /// up so it has lines left.
+ ///
+ public int MaxLinesUntilCleanup = 48;
+
+ ///
+ /// See .
+ ///
+ public int LineCountSavedFromCleanup = 24;
+
private Dictionary Actions = new Dictionary();
+ private List Lines = new List();
+ private List Commands = new List();
+ private int LastCommandIndex = 0;
+ private string LastUnexecutedCommand = "";
///
/// Creates a new , and sets the 's singleton.
@@ -51,7 +71,11 @@ namespace Cyber.Console {
if (InputField.text.Length == 0) {
return;
}
+ // Log this command
Println(InputField.text);
+ Commands.Add(InputField.text);
+ LastCommandIndex = Commands.Count;
+
List Arguments = new List();
MatchCollection Matches = CommandPartRegex.Matches(InputField.text + " ");
for (int i = 0; i < Matches.Count; i++) {
@@ -65,6 +89,8 @@ namespace Cyber.Console {
break;
}
}
+
+ // Clear the input field
InputField.text = "";
InputField.ActivateInputField();
}
@@ -93,12 +119,40 @@ namespace Cyber.Console {
}
///
- /// Prints text into the Console.
+ /// Prints text into the Console. Wraps text at .
///
+ ///
+ /// If the linecount exceeds , the
+ /// console is cleared to the point that it only has
+ /// lines.
+ ///
/// Text.
- /// \todo Handle removing history when it gets very long. Very long console logs might cause problems when displaying new prints.
public void Print(string text) {
- TextField.text += text;
+
+ // Wrap lines and log them to Lines
+ int Index = 0;
+ int EscapeIndex = 0;
+ do {
+ int NewLineIndex = text.IndexOf("\n", Index) + 1;
+ if (NewLineIndex == 0 || NewLineIndex > Index + RowLength) {
+ NewLineIndex = Index + Mathf.Min(text.Length - Index, RowLength);
+ }
+ string Line = text.Substring(Index, NewLineIndex - Index).Replace("\n", "");
+ Index = NewLineIndex;
+ Lines.Add(Line);
+ TextField.text += Line + "\n";
+ EscapeIndex++;
+ } while (Index < text.Length && EscapeIndex < 10);
+ if (Lines.Count > MaxLinesUntilCleanup) {
+ // The print history is too long, clear up until there are only
+ // a small amount left (so the user doesn't notice the cleanup)
+ string NewLog = "";
+ Lines.RemoveRange(0, Lines.Count - LineCountSavedFromCleanup);
+ foreach (string Line in Lines) {
+ NewLog += Line;
+ }
+ TextField.text = NewLog;
+ }
}
private void Start() {
@@ -135,6 +189,18 @@ namespace Cyber.Console {
AddCommand("shutdown", "Shuts the game down.", (args) => {
Application.Quit();
});
+
+ // Set an accurate row length (if the panel is set)
+ if (Panel != null && Panel.GetComponent() != null) {
+ CharacterInfo CharInfo;
+ TextField.font.RequestCharactersInTexture("W", TextField.fontSize,
+ TextField.fontStyle);
+ TextField.font.GetCharacterInfo('W', out CharInfo,
+ TextField.fontSize, TextField.fontStyle);
+ float CharacterWidth = CharInfo.glyphWidth - 1;
+ float PanelWidth = Panel.GetComponent().rect.width;
+ RowLength = (int) (PanelWidth / CharacterWidth);
+ }
}
private void Update() {
@@ -145,6 +211,24 @@ namespace Cyber.Console {
if (Input.GetButtonDown("Enter Command")) {
CallCommand();
}
+ if (Input.GetButtonDown("Previous Command")) {
+ if (LastCommandIndex - 1 >= 0) {
+ if (LastCommandIndex == Commands.Count) {
+ // The last command is the last one that was executed
+ // Save the currently written command so it can be returned to
+ LastUnexecutedCommand = InputField.text;
+ }
+ InputField.text = Commands[--LastCommandIndex];
+ }
+ }
+ if (Input.GetButtonDown("Next Command")) {
+ if (LastCommandIndex + 1 < Commands.Count) {
+ InputField.text = Commands[++LastCommandIndex];
+ } else if (LastCommandIndex + 1 == Commands.Count) {
+ LastCommandIndex++;
+ InputField.text = LastUnexecutedCommand;
+ }
+ }
// Slide up/down animation
RectTransform Rect = Panel.GetComponent();
diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset
index 1486ea0..e32e17b 100644
--- a/ProjectSettings/InputManager.asset
+++ b/ProjectSettings/InputManager.asset
@@ -133,6 +133,38 @@ InputManager:
type: 0
axis: 0
joyNum: 0
+ - serializedVersion: 3
+ m_Name: Previous Command
+ descriptiveName:
+ descriptiveNegativeName:
+ negativeButton:
+ positiveButton: up
+ altNegativeButton:
+ altPositiveButton:
+ gravity: 1000
+ dead: 0.001
+ sensitivity: 1000
+ snap: 0
+ invert: 0
+ type: 0
+ axis: 0
+ joyNum: 0
+ - serializedVersion: 3
+ m_Name: Next Command
+ descriptiveName:
+ descriptiveNegativeName:
+ negativeButton:
+ positiveButton: down
+ altNegativeButton:
+ altPositiveButton:
+ gravity: 1000
+ dead: 0.001
+ sensitivity: 1000
+ snap: 0
+ invert: 0
+ type: 0
+ axis: 0
+ joyNum: 0
- serializedVersion: 3
m_Name: Mouse X
descriptiveName: