Merge remote-tracking branch 'refs/remotes/ckcz123/master'
This commit is contained in:
commit
9f0082b243
@ -608,7 +608,7 @@
|
||||
}
|
||||
filestr+='],\n'
|
||||
}
|
||||
printf('<pre>'+filestr+'\n</pre><p>已复制到剪贴板</p>'+'<textarea cols="1" rows="1" id="poutTmp" style="display: none;">'+filestr+'\n</textarea><br><br><br>');
|
||||
printf('<pre>'+filestr+'\n</pre><p>已复制到剪贴板</p>'+'<textarea cols="1" rows="1" id="poutTmp" style="opacity: 0;">'+filestr+'\n</textarea><br><br><br>');
|
||||
poutTmp.select();
|
||||
document.execCommand("Copy");
|
||||
}
|
||||
|
||||
197
libs/core.js
197
libs/core.js
@ -597,7 +597,7 @@ core.prototype.onup = function () {
|
||||
core.canvas.ui.clearRect(0, 0, 416,416);
|
||||
core.canvas.ui.restore();
|
||||
core.onclick(posx,posy,stepPostfix);
|
||||
//posx,posy是之前寻路的目标点,stepPostfix是后续的移动
|
||||
//posx,posy是寻路的目标点,stepPostfix是后续的移动
|
||||
}
|
||||
}
|
||||
|
||||
@ -626,7 +626,7 @@ core.prototype.getClickLoc = function (x, y) {
|
||||
}
|
||||
|
||||
core.prototype.onclick = function (x, y, stepPostfix) {
|
||||
// console.log("Click: (" + x + "," + y + ")");
|
||||
console.log("Click: (" + x + "," + y + ")");
|
||||
|
||||
// 非游戏屏幕内
|
||||
if (x<0 || y<0 || x>12 || y>12) return;
|
||||
@ -735,10 +735,26 @@ core.prototype.onclick = function (x, y, stepPostfix) {
|
||||
}
|
||||
|
||||
core.prototype.onmousewheel = function (direct) {
|
||||
// 向下滚动是 -1 ,向上是 1
|
||||
|
||||
// 楼层飞行器
|
||||
if (core.status.lockControl && core.status.event.id == 'fly') {
|
||||
if (direct==-1) core.ui.drawFly(core.status.event.data-1);
|
||||
if (direct==1) core.ui.drawFly(core.status.event.data+1);
|
||||
if (direct==-1) core.ui.drawFly(core.status.event.data-1);
|
||||
return;
|
||||
}
|
||||
|
||||
// 怪物手册
|
||||
if (core.status.event.id == 'book') {
|
||||
if (direct==1) core.ui.drawEnemyBook(core.status.event.data - 1);
|
||||
if (direct==-1) core.ui.drawEnemyBook(core.status.event.data + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
// 存读档
|
||||
if (core.status.event.id == 'save' || core.status.event.id == 'load') {
|
||||
if (direct==1) core.ui.drawSLPanel(core.status.event.data - 1);
|
||||
if (direct==-1) core.ui.drawSLPanel(core.status.event.data + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1049,86 +1065,29 @@ core.prototype.setHeroMoveInterval = function (direction, x, y, callback) {
|
||||
}
|
||||
core.status.heroMoving = true;
|
||||
var moveStep = 0;
|
||||
var scan = {
|
||||
'up': {'x': 0, 'y': -1},
|
||||
'left': {'x': -1, 'y': 0},
|
||||
'down': {'x': 0, 'y': 1},
|
||||
'right': {'x': 1, 'y': 0}
|
||||
};
|
||||
core.interval.heroMoveInterval = window.setInterval(function () {
|
||||
switch (direction) {
|
||||
case 'up':
|
||||
moveStep -= 4;
|
||||
if (moveStep == -4 || moveStep == -8 || moveStep == -12 || moveStep == -16) {
|
||||
core.drawHero(direction, x, y, 'leftFoot', 0, moveStep);
|
||||
}
|
||||
else if (moveStep == -20 || moveStep == -24 || moveStep == -28 || moveStep == -32) {
|
||||
core.drawHero(direction, x, y, 'rightFoot', 0, moveStep);
|
||||
}
|
||||
if (moveStep == -32) {
|
||||
core.setHeroLoc('y', '--');
|
||||
core.moveOneStep();
|
||||
if (core.status.heroStop) {
|
||||
core.drawHero(direction, x, y - 1, 'stop');
|
||||
}
|
||||
if (core.isset(callback)) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'left':
|
||||
moveStep -= 4;
|
||||
if (moveStep == -4 || moveStep == -8 || moveStep == -12 || moveStep == -16) {
|
||||
core.drawHero(direction, x, y, 'leftFoot', moveStep);
|
||||
}
|
||||
else if (moveStep == -20 || moveStep == -24 || moveStep == -28 || moveStep == -32) {
|
||||
core.drawHero(direction, x, y, 'rightFoot', moveStep);
|
||||
}
|
||||
if (moveStep == -32) {
|
||||
core.setHeroLoc('x', '--');
|
||||
core.moveOneStep();
|
||||
if (core.status.heroStop) {
|
||||
core.drawHero(direction, x - 1, y, 'stop');
|
||||
}
|
||||
if (core.isset(callback)) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'down':
|
||||
moveStep+=4;
|
||||
if(moveStep == 4 || moveStep == 8 || moveStep == 12 || moveStep == 16) {
|
||||
core.drawHero(direction, x, y, 'leftFoot', 0, moveStep);
|
||||
}
|
||||
else if(moveStep == 20 || moveStep == 24 ||moveStep == 28 || moveStep == 32) {
|
||||
core.drawHero(direction, x, y, 'rightFoot', 0, moveStep);
|
||||
}
|
||||
if (moveStep == 32) {
|
||||
core.setHeroLoc('y', '++');
|
||||
core.moveOneStep();
|
||||
if (core.status.heroStop) {
|
||||
core.drawHero(direction, x, y + 1, 'stop');
|
||||
}
|
||||
if (core.isset(callback)) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'right':
|
||||
moveStep+=4;
|
||||
if(moveStep == 4 || moveStep == 8 || moveStep == 12 || moveStep == 16) {
|
||||
core.drawHero(direction, x, y, 'leftFoot', moveStep);
|
||||
}
|
||||
else if(moveStep == 20 || moveStep == 24 ||moveStep == 28 || moveStep == 32) {
|
||||
core.drawHero(direction, x, y, 'rightFoot', moveStep);
|
||||
}
|
||||
if (moveStep == 32) {
|
||||
core.setHeroLoc('x', '++');
|
||||
core.moveOneStep();
|
||||
if (core.status.heroStop) {
|
||||
core.drawHero(direction, x + 1, y, 'stop');
|
||||
}
|
||||
if (core.isset(callback)) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
break;
|
||||
moveStep++;
|
||||
if (moveStep<=4) {
|
||||
core.drawHero(direction, x, y, 'leftFoot', 4*moveStep*scan[direction].x, 4*moveStep*scan[direction].y);
|
||||
}
|
||||
}, 10);
|
||||
else if (moveStep<=8) {
|
||||
core.drawHero(direction, x, y, 'rightFoot', 4*moveStep*scan[direction].x, 4*moveStep*scan[direction].y);
|
||||
}
|
||||
if (moveStep==8) {
|
||||
core.setHeroLoc('x', x+scan[direction].x);
|
||||
core.setHeroLoc('y', y+scan[direction].y);
|
||||
core.moveOneStep();
|
||||
if (core.status.heroStop)
|
||||
core.drawHero(direction, core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
}, 12.5);
|
||||
}
|
||||
|
||||
core.prototype.setHeroMoveTriggerInterval = function () {
|
||||
@ -1242,6 +1201,66 @@ core.prototype.moveHero = function (direction) {
|
||||
core.status.heroStop = false;
|
||||
}
|
||||
|
||||
core.prototype.eventMoveHero = function(steps, time, callback) {
|
||||
|
||||
time = time || 100;
|
||||
|
||||
core.clearMap('ui', 0, 0, 416, 416);
|
||||
core.setAlpha('ui', 1.0);
|
||||
|
||||
// 要运行的轨迹:将steps展开
|
||||
var moveSteps=[];
|
||||
steps.forEach(function (e) {
|
||||
if (typeof e=="string") {
|
||||
moveSteps.push(e);
|
||||
}
|
||||
else {
|
||||
if (!core.isset(e.value)) {
|
||||
moveSteps.push(e.direction)
|
||||
}
|
||||
else {
|
||||
for (var i=0;i<e.value;i++) {
|
||||
moveSteps.push(e.direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var step=0;
|
||||
var scan = {
|
||||
'up': {'x': 0, 'y': -1},
|
||||
'left': {'x': -1, 'y': 0},
|
||||
'down': {'x': 0, 'y': 1},
|
||||
'right': {'x': 1, 'y': 0}
|
||||
};
|
||||
|
||||
var animate=window.setInterval(function() {
|
||||
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y');
|
||||
if (moveSteps.length==0) {
|
||||
clearInterval(animate);
|
||||
core.drawHero(core.getHeroLoc('direction'), x, y, 'stop');
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
else {
|
||||
var direction = moveSteps[0];
|
||||
core.setHeroLoc('direction', direction);
|
||||
step++;
|
||||
if (step <= 4) {
|
||||
core.drawHero(direction, x, y, 'leftFoot', 4 * step * scan[direction].x, 4 * step * scan[direction].y);
|
||||
}
|
||||
else if (step <= 8) {
|
||||
core.drawHero(direction, x, y, 'rightFoot', 4 * step * scan[direction].x, 4 * step * scan[direction].y);
|
||||
}
|
||||
if (step == 8) {
|
||||
step = 0;
|
||||
core.setHeroLoc('x', x + scan[direction].x);
|
||||
core.setHeroLoc('y', y + scan[direction].y);
|
||||
moveSteps.shift();
|
||||
}
|
||||
}
|
||||
}, time/8);
|
||||
}
|
||||
|
||||
core.prototype.moveOneStep = function() {
|
||||
// 中毒状态
|
||||
if (core.hasFlag('poison')) {
|
||||
@ -1877,14 +1896,26 @@ core.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) {
|
||||
'right': {'x': 1, 'y': 0}
|
||||
};
|
||||
|
||||
var animateValue = block.event.animate || 1;
|
||||
var animateCurrent = 0;
|
||||
var animateTime = 0;
|
||||
|
||||
var animate=window.setInterval(function() {
|
||||
|
||||
animateTime += time / 16;
|
||||
if (animateTime >= core.values.animateSpeed * 2 / animateValue) {
|
||||
animateCurrent++;
|
||||
animateTime = 0;
|
||||
if (animateCurrent>=animateValue) animateCurrent=0;
|
||||
}
|
||||
|
||||
// 已经移动完毕,消失
|
||||
if (moveSteps.length==0) {
|
||||
if (immediateHide) opacityVal=0;
|
||||
else opacityVal -= 0.06;
|
||||
core.setOpacity('data', opacityVal);
|
||||
core.clearMap('data', nowX, nowY, 32, 32);
|
||||
core.canvas.data.drawImage(blockImage, 0, blockIcon * 32, 32, 32, nowX, nowY, 32, 32);
|
||||
core.canvas.data.drawImage(blockImage, animateCurrent * 32, blockIcon * 32, 32, 32, nowX, nowY, 32, 32);
|
||||
if (opacityVal<=0) {
|
||||
clearInterval(animate);
|
||||
core.loadCanvas('data');
|
||||
@ -1900,7 +1931,7 @@ core.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) {
|
||||
nowY+=scan[moveSteps[0]].y*2;
|
||||
core.clearMap('data', nowX-32, nowY-32, 96, 96);
|
||||
// 绘制
|
||||
core.canvas.data.drawImage(blockImage, 0, blockIcon * 32, 32, 32, nowX, nowY, 32, 32);
|
||||
core.canvas.data.drawImage(blockImage, animateCurrent * 32, blockIcon * 32, 32, 32, nowX, nowY, 32, 32);
|
||||
if (step==16) {
|
||||
// 该移动完毕,继续
|
||||
step=0;
|
||||
|
||||
@ -76,7 +76,7 @@ enemys.prototype.getEnemys = function (enemyId) {
|
||||
}
|
||||
|
||||
enemys.prototype.hasSpecial = function (special, test) {
|
||||
return parseInt(special/1000) == test || special % 1000 == test;
|
||||
return special!=0 && (special%100 == test || this.hasSpecial(parseInt(special/100), test));
|
||||
}
|
||||
|
||||
enemys.prototype.getSpecialText = function (enemyId) {
|
||||
|
||||
@ -239,10 +239,19 @@ events.prototype.doAction = function() {
|
||||
else this.doAction();
|
||||
break;
|
||||
case "move": // 移动事件
|
||||
if (core.isset(data.loc)) {
|
||||
x=data.loc[0];
|
||||
y=data.loc[1];
|
||||
}
|
||||
core.moveBlock(x,y,data.steps,data.time,data.immediateHide,function() {
|
||||
core.events.doAction();
|
||||
})
|
||||
break;
|
||||
case "moveHero":
|
||||
core.eventMoveHero(data.steps,data.time,function() {
|
||||
core.events.doAction();
|
||||
});
|
||||
break;
|
||||
case "changeFloor": // 楼层转换
|
||||
var heroLoc = {"x": data.loc[0], "y": data.loc[1]};
|
||||
if (core.isset(data.direction)) heroLoc.direction=data.direction;
|
||||
|
||||
@ -31,7 +31,7 @@ main.floors.sample1 = {
|
||||
"\t[样板提示]本层楼将会对各类事件进行介绍。",
|
||||
"左边是一个仿50层的陷阱做法,上方是商店、快捷商店的使用方法,右上是一个典型的杀怪开门的例子,右下是各类可能的NPC事件。",
|
||||
"本样板目前支持的事件列表大致有:\ntext: 显示一段文字(比如你现在正在看到的)\nshow: 使一个事件有效(可见、可被交互)\nhide: 使一个事件失效(不可见、不可被交互)\ntrigger: 触发另一个地点的事件\nbattle: 强制和某怪物战斗\nopenDoor: 无需钥匙开门(例如机关门、暗墙)\nopenShop: 打开一个全局商店\ndisableShop: 禁用一个全局商店\nchangeFloor: 传送勇士到某层某位置\nchangePos: 传送勇士到当层某位置;转向\nsetFg: 更改画面色调",
|
||||
"move: 移动事件效果\nplaySound: 播放某个音频\nif: 条件判断\nchoices: 提供选项\nsetValue: 设置勇士属性道具,或某个变量/flag\nupdate: 更新状态栏和地图显伤\nwin: 获得胜利(游戏通关)\nlose: 游戏失败\nsleep: 等待多少毫秒\nexit: 立刻结束当前事件\nrevisit: 立刻结束事件并重新触发\nfunction: 自定义JS脚本\n更多支持的事件还在编写中,欢迎您宝贵的意见。",
|
||||
"move: 移动事件效果\nmoveHero: 移动勇士效果\nplaySound: 播放某个音频\nif: 条件判断\nchoices: 提供选项\nsetValue: 设置勇士属性道具,或某个变量/flag\nupdate: 更新状态栏和地图显伤\nwin: 获得胜利(游戏通关)\nlose: 游戏失败\nsleep: 等待多少毫秒\nexit: 立刻结束当前事件\nrevisit: 立刻结束事件并重新触发\nfunction: 自定义JS脚本\n更多支持的事件还在编写中,欢迎您宝贵的意见。",
|
||||
"有关各事件的样例,可参见本层一些NPC的写法。\n所有事件样例本层都有介绍。\n\n一个自定义事件处理完后,需要调用{\"type\": \"hide\"}该事件才不会再次出现。",
|
||||
{"type": "hide"}
|
||||
],
|
||||
|
||||
@ -425,6 +425,8 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
core.fillRect('ui', left, top, right, bottom, '#000000');
|
||||
core.setAlpha('ui', 1);
|
||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||
core.setAlpha('data', 1);
|
||||
core.setOpacity('data', 1);
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.setBoxAnimate();
|
||||
|
||||
|
||||
4
main.js
4
main.js
@ -224,6 +224,10 @@ document.ontouchstart = function() {
|
||||
main.dom.data.onmousedown = function (e) {
|
||||
try {
|
||||
e.stopPropagation();
|
||||
if(e.button==1){// 把鼠标中键绑定为ESC
|
||||
core.keyUp(27);
|
||||
return;
|
||||
}
|
||||
var loc = main.core.getClickLoc(e.clientX, e.clientY);
|
||||
if (loc == null) return;
|
||||
var x = parseInt(loc.x / loc.size), y = parseInt(loc.y / loc.size);
|
||||
|
||||
BIN
常用工具/便捷PS工具.exe
Normal file
BIN
常用工具/便捷PS工具.exe
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user