Fixed issue with select_layer

This commit is contained in:
Devine Lu Linvega 2017-03-25 11:58:27 -07:00
parent 1bd42e15c8
commit 061b832851
3 changed files with 28 additions and 23 deletions

View File

@ -15,7 +15,7 @@ function Module(rune)
this.context = function() this.context = function()
{ {
return this.select_layer().context(); return this._layer().context();
} }
this.create_layer = function() this.create_layer = function()
@ -25,7 +25,7 @@ function Module(rune)
ronin.surface.add_layer(this.layer); ronin.surface.add_layer(this.layer);
} }
this.select_layer = function() this._layer = function()
{ {
if(!this.layer){ this.create_layer(); } if(!this.layer){ this.create_layer(); }
return this.layer; return this.layer;

View File

@ -50,9 +50,9 @@ function Surface(rune)
{ {
var layer_name = params[0]; var layer_name = params[0];
if(!ronin.surface.layers[layer_name]){ if(!ronin.surface.layers[layer_name]){
this.add_layer(new Layer(name)); this.add_layer(new Layer(layer_name));
} }
this.select_layer(this.layers[name]); this.select_layer(this.layers[layer_name]);
} }
this.select_layer = function(layer) this.select_layer = function(layer)

View File

@ -76,6 +76,7 @@ function Terminal(rune)
{ {
if(!ronin.terminal.queue[0]){ console.log("Finished queue"); return; } if(!ronin.terminal.queue[0]){ console.log("Finished queue"); return; }
console.info(ronin.terminal.queue[0]);
active(ronin.terminal.queue[0].trim()); active(ronin.terminal.queue[0].trim());
ronin.terminal.queue.shift(); ronin.terminal.queue.shift();
@ -100,25 +101,6 @@ function Terminal(rune)
} }
} }
//
this.logs = [];
this.log = function(log)
{
this.logs.push(log);
}
this.update_log = function()
{
if(ronin.terminal.logs[0]){
ronin.terminal.logs_element.appendChild(ronin.terminal.logs[0].element);
ronin.terminal.logs.shift();
}
setTimeout(function(){ ronin.terminal.update_log(); }, 200);
}
// Hint // Hint
this.update_hint = function(content = this.input_element.value) this.update_hint = function(content = this.input_element.value)
@ -178,13 +160,36 @@ function Terminal(rune)
} }
return "<span style='color:#000'>"+s+"</span>"; return "<span style='color:#000'>"+s+"</span>";
} }
//
this.logs = [];
this.log = function(log)
{
this.logs.push(log);
}
this.update_log = function()
{
if(ronin.terminal.logs[0]){
ronin.terminal.logs_element.appendChild(ronin.terminal.logs[0].element);
ronin.terminal.logs.shift();
}
setTimeout(function(){ ronin.terminal.update_log(); }, 200);
}
} }
// Log // Log
function Log(host,message,type = "default") function Log(host,message,type = "default")
{ {
this.host = host;
this.message = message;
this.type = type;
this.element = document.createElement("log"); this.element = document.createElement("log");
this.element.setAttribute("class",type); this.element.setAttribute("class",type);
this.element.innerHTML = "<span class='rune'>"+host.rune+"</span> "+message; this.element.innerHTML = "<span class='rune'>"+host.rune+"</span> "+message;
console.log(this.host.constructor.name,this.message)
} }