Replay use full name
This commit is contained in:
parent
882446c442
commit
c9ba70fa9c
@ -185,8 +185,8 @@ actions.prototype.keyDown = function(keyCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 根据放开键的code来执行一系列操作 //////
|
////// 根据放开键的code来执行一系列操作 //////
|
||||||
actions.prototype.keyUp = function(keyCode) {
|
actions.prototype.keyUp = function(keyCode, fromReplay) {
|
||||||
if (core.isset(core.status.replay)&&core.status.replay.replaying) return;
|
if (!fromReplay&&core.isset(core.status.replay)&&core.status.replay.replaying) return;
|
||||||
|
|
||||||
if (core.status.lockControl) {
|
if (core.status.lockControl) {
|
||||||
core.status.holdingKeys = [];
|
core.status.holdingKeys = [];
|
||||||
|
|||||||
@ -1485,7 +1485,7 @@ control.prototype.replay = function () {
|
|||||||
|
|
||||||
core.events.openShop(shopId, false);
|
core.events.openShop(shopId, false);
|
||||||
var shopInterval = setInterval(function () {
|
var shopInterval = setInterval(function () {
|
||||||
if (!core.events.clickShop(6, topIndex+core.status.event.selection)) {
|
if (!core.actions.clickShop(6, topIndex+core.status.event.selection)) {
|
||||||
clearInterval(shopInterval);
|
clearInterval(shopInterval);
|
||||||
core.stopReplay();
|
core.stopReplay();
|
||||||
core.drawTip("录像文件出错");
|
core.drawTip("录像文件出错");
|
||||||
@ -1493,7 +1493,7 @@ control.prototype.replay = function () {
|
|||||||
}
|
}
|
||||||
if (selections.length==0) {
|
if (selections.length==0) {
|
||||||
clearInterval(shopInterval);
|
clearInterval(shopInterval);
|
||||||
core.events.clickShop(6, topIndex+choices.length);
|
core.actions.clickShop(6, topIndex+choices.length);
|
||||||
core.replay();
|
core.replay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1535,6 +1535,11 @@ control.prototype.replay = function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (action.indexOf('key:')==0) {
|
||||||
|
core.actions.keyUp(parseInt(action.substring(4)), true);
|
||||||
|
core.replay();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
core.stopReplay();
|
core.stopReplay();
|
||||||
core.insertAction("录像文件出错");
|
core.insertAction("录像文件出错");
|
||||||
|
|||||||
@ -224,9 +224,10 @@ events.prototype.doAction = function() {
|
|||||||
|
|
||||||
// 事件处理完毕
|
// 事件处理完毕
|
||||||
if (core.status.event.data.list.length==0) {
|
if (core.status.event.data.list.length==0) {
|
||||||
|
var callback = core.status.event.data.callback;
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
if (core.isset(core.status.event.data.callback))
|
if (core.isset(callback))
|
||||||
core.status.event.data.callback();
|
callback();
|
||||||
core.replay();
|
core.replay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -158,8 +158,6 @@ utils.prototype.encodeRoute = function (route) {
|
|||||||
var ans="";
|
var ans="";
|
||||||
var lastMove = "", cnt=0;
|
var lastMove = "", cnt=0;
|
||||||
|
|
||||||
var items=Object.keys(core.material.items).sort();
|
|
||||||
var shops=Object.keys(core.initStatus.shops).sort();
|
|
||||||
route.forEach(function (t) {
|
route.forEach(function (t) {
|
||||||
if (t=='up' || t=='down' || t=='left' || t=='right') {
|
if (t=='up' || t=='down' || t=='left' || t=='right') {
|
||||||
if (t!=lastMove && cnt>0) {
|
if (t!=lastMove && cnt>0) {
|
||||||
@ -177,15 +175,13 @@ utils.prototype.encodeRoute = function (route) {
|
|||||||
cnt=0;
|
cnt=0;
|
||||||
}
|
}
|
||||||
if (t.indexOf('item:')==0)
|
if (t.indexOf('item:')==0)
|
||||||
ans+="I"+items.indexOf(t.substring(5));
|
ans+="I"+t.substring(5)+":";
|
||||||
else if (t.indexOf('fly:')==0)
|
else if (t.indexOf('fly:')==0)
|
||||||
ans+="F"+core.floorIds.indexOf(t.substring(4));
|
ans+="F"+t.substring(4)+":";
|
||||||
else if (t.indexOf('choices:')==0)
|
else if (t.indexOf('choices:')==0)
|
||||||
ans+="C"+t.substring(8);
|
ans+="C"+t.substring(8);
|
||||||
else if (t.indexOf('shop:')==0) {
|
else if (t.indexOf('shop:')==0)
|
||||||
var sp=t.substring(5).split(":");
|
ans+="S"+t.substring(5);
|
||||||
ans+="S"+shops.indexOf(sp[0])+":"+sp[1];
|
|
||||||
}
|
|
||||||
else if (t=='turn')
|
else if (t=='turn')
|
||||||
ans+='T';
|
ans+='T';
|
||||||
else if (t=='getNext')
|
else if (t=='getNext')
|
||||||
@ -194,9 +190,10 @@ utils.prototype.encodeRoute = function (route) {
|
|||||||
ans+="P"+t.substring(6);
|
ans+="P"+t.substring(6);
|
||||||
else if (t=='no')
|
else if (t=='no')
|
||||||
ans+='N';
|
ans+='N';
|
||||||
else if (t.indexOf('move:')==0) {
|
else if (t.indexOf('move:')==0)
|
||||||
ans+="M"+t.substring(5);
|
ans+="M"+t.substring(5);
|
||||||
}
|
else if (t=='key:')
|
||||||
|
ans+='K'+t.substring(4);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (cnt>0) {
|
if (cnt>0) {
|
||||||
@ -221,27 +218,33 @@ utils.prototype.decodeRoute = function (route) {
|
|||||||
if (num.length==0) num="1";
|
if (num.length==0) num="1";
|
||||||
return core.isset(noparse)?num:parseInt(num);
|
return core.isset(noparse)?num:parseInt(num);
|
||||||
}
|
}
|
||||||
|
var getString = function () {
|
||||||
|
var str="";
|
||||||
|
while (index<route.length && /\w/.test(route.charAt(index))) {
|
||||||
|
str+=route.charAt(index++);
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
var items=Object.keys(core.material.items).sort();
|
|
||||||
var shops=Object.keys(core.initStatus.shops).sort();
|
|
||||||
while (index<route.length) {
|
while (index<route.length) {
|
||||||
var c=route.charAt(index++);
|
var c=route.charAt(index++);
|
||||||
var number=getNumber();
|
var nxt=(c=='I'||c=='F'||c=='S')?getString():getNumber();
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case "U": for (var i=0;i<number;i++) ans.push("up"); break;
|
case "U": for (var i=0;i<nxt;i++) ans.push("up"); break;
|
||||||
case "D": for (var i=0;i<number;i++) ans.push("down"); break;
|
case "D": for (var i=0;i<nxt;i++) ans.push("down"); break;
|
||||||
case "L": for (var i=0;i<number;i++) ans.push("left"); break;
|
case "L": for (var i=0;i<nxt;i++) ans.push("left"); break;
|
||||||
case "R": for (var i=0;i<number;i++) ans.push("right"); break;
|
case "R": for (var i=0;i<nxt;i++) ans.push("right"); break;
|
||||||
case "I": ans.push("item:"+items[number]); break;
|
case "I": ++index; ans.push("item:"+nxt); break;
|
||||||
case "F": ans.push("fly:"+core.floorIds[number]); break;
|
case "F": ++index; ans.push("fly:"+nxt); break;
|
||||||
case "C": ans.push("choices:"+number); break;
|
case "C": ans.push("choices:"+nxt); break;
|
||||||
case "S": ++index; ans.push("shop:"+shops[number]+":"+getNumber(true)); break;
|
case "S": ++index; ans.push("shop:"+nxt+":"+getNumber(true)); break;
|
||||||
case "T": ans.push("turn"); break;
|
case "T": ans.push("turn"); break;
|
||||||
case "G": ans.push("getNext"); break;
|
case "G": ans.push("getNext"); break;
|
||||||
case "P": ans.push("input:"+number); break;
|
case "P": ans.push("input:"+nxt); break;
|
||||||
case "N": ans.push("no"); break;
|
case "N": ans.push("no"); break;
|
||||||
case "M": ++index; ans.push("move:"+number+":"+getNumber()); break;
|
case "M": ++index; ans.push("move:"+nxt+":"+getNumber()); break;
|
||||||
|
case "K": ans.push("key:"+nxt); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ans;
|
return ans;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user