|
@@ -136,13 +136,13 @@ class Console extends h2d.Sprite {
|
|
public function isActive() {
|
|
public function isActive() {
|
|
return bg.visible;
|
|
return bg.visible;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public function hide() {
|
|
public function hide() {
|
|
bg.visible = false;
|
|
bg.visible = false;
|
|
tf.text = "";
|
|
tf.text = "";
|
|
cursorPos = 0;
|
|
cursorPos = 0;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public function show() {
|
|
public function show() {
|
|
bg.visible = true;
|
|
bg.visible = true;
|
|
logIndex = -1;
|
|
logIndex = -1;
|
|
@@ -226,7 +226,7 @@ class Console extends h2d.Sprite {
|
|
}
|
|
}
|
|
logs.push(command);
|
|
logs.push(command);
|
|
logIndex = -1;
|
|
logIndex = -1;
|
|
-
|
|
|
|
|
|
+
|
|
var errorColor = 0xC00000;
|
|
var errorColor = 0xC00000;
|
|
|
|
|
|
var args = [];
|
|
var args = [];
|
|
@@ -235,7 +235,7 @@ class Console extends h2d.Sprite {
|
|
|
|
|
|
function readString(endChar:String) {
|
|
function readString(endChar:String) {
|
|
var string = '';
|
|
var string = '';
|
|
-
|
|
|
|
|
|
+
|
|
while (i < command.length) {
|
|
while (i < command.length) {
|
|
c = command.charAt(++i);
|
|
c = command.charAt(++i);
|
|
if (c == endChar) {
|
|
if (c == endChar) {
|
|
@@ -244,10 +244,10 @@ class Console extends h2d.Sprite {
|
|
}
|
|
}
|
|
string += c;
|
|
string += c;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
inline function skipSpace() {
|
|
inline function skipSpace() {
|
|
c = command.charAt(i);
|
|
c = command.charAt(i);
|
|
while (c == ' ' || c == '\t') {
|
|
while (c == ' ' || c == '\t') {
|
|
@@ -255,7 +255,7 @@ class Console extends h2d.Sprite {
|
|
}
|
|
}
|
|
--i;
|
|
--i;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
var last = '';
|
|
var last = '';
|
|
while (i < command.length) {
|
|
while (i < command.length) {
|
|
c = command.charAt(i);
|
|
c = command.charAt(i);
|
|
@@ -263,7 +263,7 @@ class Console extends h2d.Sprite {
|
|
switch (c) {
|
|
switch (c) {
|
|
case ' ' | '\t':
|
|
case ' ' | '\t':
|
|
skipSpace();
|
|
skipSpace();
|
|
-
|
|
|
|
|
|
+
|
|
args.push(last);
|
|
args.push(last);
|
|
last = '';
|
|
last = '';
|
|
case "'" | '"':
|
|
case "'" | '"':
|
|
@@ -272,19 +272,19 @@ class Console extends h2d.Sprite {
|
|
log('Bad formated string', errorColor);
|
|
log('Bad formated string', errorColor);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
args.push(string);
|
|
args.push(string);
|
|
last = '';
|
|
last = '';
|
|
-
|
|
|
|
|
|
+
|
|
skipSpace();
|
|
skipSpace();
|
|
default:
|
|
default:
|
|
last += c;
|
|
last += c;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
++i;
|
|
++i;
|
|
}
|
|
}
|
|
args.push(last);
|
|
args.push(last);
|
|
-
|
|
|
|
|
|
+
|
|
var cmdName = args[0];
|
|
var cmdName = args[0];
|
|
if( aliases.exists(cmdName) ) cmdName = aliases.get(cmdName);
|
|
if( aliases.exists(cmdName) ) cmdName = aliases.get(cmdName);
|
|
var cmd = commands.get(cmdName);
|
|
var cmd = commands.get(cmdName);
|