动画重置

This commit is contained in:
草莓 2025-04-11 10:48:42 +08:00
parent de4db36455
commit c585876d90
11 changed files with 511 additions and 1508 deletions

View File

@ -873,11 +873,10 @@ action
| disableShop_s
| follow_s
| unfollow_s
| setanimate_s
| deleteanimate_s
| playanimate_s
| clearanimate_s
| animate_s
| animateResize_s
| pauseAnimate_s
| remuseAnimate_s
| animate_1_s
| stopAnimate_s
| vibrate_s
@ -964,7 +963,6 @@ action
| addPop_s
| setq_s
| setcgs_s
| animationDrawable_s
| over_s
| overlist_s
| cgtextList_s
@ -2272,138 +2270,6 @@ var code = '{"type": "vibrate", "direction": "'+Vibrate_List_0+'", "time": '+Int
return code;
*/;
setanimate_s
: '新建 帧动画/特效' '名称' EvalString '参照点偏移像素x' IntString? 'y' IntString? '动画大小 宽' IntString '高' IntString '总帧数' IntString BGNL?Newline
'图片序列同一帧后面覆盖先前的默认起始帧为0结束帧为最后一帧)'BGNL?Newline
'(剪裁区域不填写为全图,绘制区域不填写为全画面)'BGNL?Newline
'(不透明度100为不透明默认为不透明结束透明度默认与开始不透明度相同'BGNL?Newline
animateDrawableimage+? Newline
'音频序列(到达对应帧进行播放)'BGNL?Newline
animateDrawablesound+? Newline
/* setanimate_s
tooltip : setanimate:设置帧动画/特效(此项仅储存,不播放)
helpUrl : /_docs/#/instruction
default : ["sword","","",192,192,60]
colour : this.imageColor
IntString_0 = IntString_0 ? (', "px": '+IntString_0+'') : '';
IntString_1 = IntString_1 ? (', "py": '+IntString_1+'') : '';
var imageList=animateDrawableimage_0?',"imageList": [\n'+animateDrawableimage_0.slice(0,-1)+'\n]':''
var soundList=animateDrawablesound_0?',"soundList": [\n'+animateDrawablesound_0.slice(0,-1)+'\n]':''
var code = '{"type": "setanimate", "name": "'+EvalString_0+'"'+IntString_0+IntString_1+' ,"width": '+IntString_2+', "height": '+IntString_3+', "allFarme": '+IntString_4+imageList+soundList+'},\n';
return code;
*/;
animateDrawableList
: animateDrawableimage
| animateDrawablesound
| animateDrawabletextEmpty;
animateDrawableimage
: '图片' EvalString? '起始帧' IntString? '起始不透明度' IntString? BGNL? Newline
'剪裁坐标cx' IntString? 'cy' IntString? '宽' IntString? '高' IntString? '绘制坐标x'IntString? 'y' IntString? '宽' IntString? '高' IntString?'旋转角度'IntString? BGNL? Newline
'结束帧' IntString? '结束不透明度' IntString? '剪裁坐标cx' IntString? 'cy' IntString? '宽' IntString? '高' IntString? '绘制坐标x'IntString? 'y' IntString? '宽' IntString? '高' IntString?'旋转角度'IntString? Newline
/* animateDrawableimage
tooltip : 帧动画图片列表
helpUrl : /_docs/#/instruction
default : ["","","","","","","","","","","","","","","","","","","","","","",""]
colour : this.subColor
allImages : ['EvalString_0']
if (IntString_1&&(IntString_1 < 0||IntString_1>100)) throw new Error('不透明度范围为0-100,0为透明,100为不透明,不填默认为不透明')
if (IntString_12&&(IntString_12 < 0||IntString_12>100)) throw new Error('不透明度范围为0-100,0为透明,100为不透明,不填默认为不透明')
IntString_0 = IntString_0 ? (', "beforefarme": '+IntString_0+'') : '';
IntString_1 = IntString_1 ? (', "globalAlpha": '+IntString_1+'') : '';
IntString_2 = IntString_2 ? (', "cx": '+IntString_2+'') : '';
IntString_3 = IntString_3 ? (', "cy": '+IntString_3+'') : '';
IntString_4 = IntString_4 ? (', "cw": '+IntString_4+'') : '';
IntString_5 = IntString_5 ? (', "ch": '+IntString_5+'') : '';
IntString_6 = IntString_6 ? (', "x": '+IntString_6+'') : '';
IntString_7 = IntString_7 ? (', "y": '+IntString_7+'') : '';
IntString_8 = IntString_8 ? (', "w": '+IntString_8+'') : '';
IntString_9 = IntString_9 ? (', "h": '+IntString_9+'') : '';
IntString_10 = IntString_10 ? (', "angle": '+IntString_10+'') : '';
IntString_11 = IntString_11 ? (', "afterfarme": '+IntString_11+'') : '';
IntString_12 = IntString_12 ? (', "aglobalAlpha": '+IntString_12+'') : '';
IntString_13 = IntString_13 ? (', "acx": '+IntString_13+'') : '';
IntString_14 = IntString_14 ? (', "acy": '+IntString_14+'') : '';
IntString_15 = IntString_15? (', "acw": '+IntString_15+'') : '';
IntString_16 = IntString_16 ? (', "ach": '+IntString_16+'') : '';
IntString_17 = IntString_17 ? (', "ax": '+IntString_17+'') : '';
IntString_18 = IntString_18 ? (', "ay": '+IntString_18+'') : '';
IntString_19 = IntString_19 ? (', "aw": '+IntString_19+'') : '';
IntString_20 = IntString_20 ? (', "ah": '+IntString_20+'') : '';
IntString_21 = IntString_21 ? (', "aangle": '+IntString_21+'') : '';
return '{ "image":"'+EvalString_0+'"'+IntString_0+IntString_1+IntString_2+IntString_3+IntString_4+IntString_5+IntString_6+IntString_7+IntString_8+IntString_9+IntString_10+IntString_11+IntString_12+IntString_13+IntString_14+IntString_15+IntString_16+IntString_17+IntString_18+IntString_19+IntString_20+IntString_21+'},'
*/;
animateDrawablesound
: '音效' EvalString? '起始帧' IntString '是否停止其他音效'Bool Newline
/* animateDrawablesound
tooltip : 帧动画配音
helpUrl : /_docs/#/instruction
default : ["",0,false]
colour : this.subColor
allSounds : ['EvalString_0']
return '{ "sound":"'+EvalString_0+'","startfarme":'+IntString_0+',"stopbefore":'+Bool_0+'},'
*/;
animateDrawabletextEmpty
: Newline
/* animateDrawabletextEmpty
var code = [];
return code;
*/;
deleteanimate_s
: '删除 帧动画/特效' '名称' EvalString Newline
/* deleteanimate_s
tooltip : deleteanimate:删除储存的帧动画
helpUrl : /_docs/#/instruction
default : ["zone"]
colour : this.imageColor
var code = '{"type": "deleteanimate", "name": "'+EvalString_0+'"},\n';
return code;
*/;
playanimate_s
: '播放 帧动画/特效' '名称' EvalString '像素x' IntString? 'y' IntString? '跟随勇士' Bool 'x方向缩放' EvalString? 'y方向缩放'EvalString? Newline
/* playanimate_s
tooltip : playanimate:播放帧动画选择跟随勇士后x、y将失效改为勇士中心坐标
helpUrl : /_docs/#/instruction
default : ["zone","","",false,"",""]
colour : this.imageColor
IntString_0 = IntString_0 ? (', "x": '+IntString_0+'') : '';
IntString_1 = IntString_1 ? (', "y": '+IntString_1+'') : '';
if(EvalString_1&&!/^(0|([1-9][0-9]*))(\.[\d]+)?$/.test(EvalString_1))throw new Error("此项仅能填写小数、整数或不填");
if(EvalString_2&&!/^(0|([1-9][0-9]*))(\.[\d]+)?$/.test(EvalString_2))throw new Error("此项仅能填写小数、整数或不填");
EvalString_1 = EvalString_1 ? (', "scalex": '+EvalString_1+'') : '';
EvalString_2 = EvalString_2 ? (', "scaley": '+EvalString_2+'') : '';
var code = '{"type": "playanimate", "name": "'+EvalString_0+'"'+IntString_0+IntString_1+',"hero":'+Bool_0+EvalString_1+EvalString_2+'},\n';
return code;
*/;
clearanimate_s
: '清空正在播放的帧动画/特效'
/* clearanimate_s
tooltip : clearanimate:清空正在播放的帧动画
helpUrl : /_docs/#/instruction
colour : this.imageColor
var code = '{"type": "clearanimate"},\n';
return code;
*/;
animate_s
: '显示动画' EvalString '位置' 'x' PosString? 'y' PosString? '相对窗口坐标' Bool '不等待执行完毕' Bool Newline
@ -2439,16 +2305,71 @@ var code = '{"type": "animate", "name": "'+EvalString_0+'", "loc": "hero"'+Bool_
return code;
*/;
animateResize_s
: '显示动画60Fps' EvalString '编号'PosString? '中心像素' 'x' PosString? 'y' PosString?'以勇士为中心' Bool'倒放' Bool'循环'Bool'不等待执行完毕' Bool Newline
/* animateResize_s
tooltip : animateResize显示动画并选择是否以勇士为中心及倒放以勇士为中心时中心像素坐标无效
helpUrl : /_docs/#/instruction
default : ["zone","","","",false,false,false,false]
allAnimates : ['EvalString_0']
previewBlock : true
material : ["./project/animates/", "EvalString_0"]
colour : this.soundColor
PosString_0 = PosString_0?', "id":'+PosString_0:'';
Bool_0 = Bool_0?', "hero": true':'';
if(!Bool_0){
if(PosString_1===""||PosString_2==="")throw new Error("中心像素坐标或以勇士为中心必须填写一项");
Bool_0=',"centerX":'+PosString_1+', "centerY":'+PosString_2
}
if(Bool_2&&!Bool_3 )throw new Error("循环必须与不等待执行完毕同时开启,否则将陷入死循环")
Bool_1 = Bool_1?', "reverse": true':'';
Bool_2 = Bool_2?', "loop": true':'';
Bool_3 = Bool_3?', "async": true':'';
var code = '{"type": "animateResize", "name": "'+EvalString_0+'"'+PosString_0+Bool_0+Bool_1+Bool_2+Bool_3+'},\n';
return code;
*/;
pauseAnimate_s
: '暂停动画编号'PosString?'(不填写编号为暂停所有)' Newline
/* pauseAnimate_s
tooltip : pauseAnimate暂停动画不填写编号为暂停所有
helpUrl : /_docs/#/instruction
default : ['']
colour : this.soundColor
PosString_0 = PosString_0?', "id":'+PosString_0:'';
var code = '{"type": "pauseAnimate"'+PosString_0+'},\n';
return code;
*/;
remuseAnimate_s
: '继续动画编号'PosString?'(不填写编号为继续所有)' Newline
/* remuseAnimate_s
tooltip : remuseAnimate继续动画不填写编号为继续所有
helpUrl : /_docs/#/instruction
default : ['']
colour : this.soundColor
PosString_0 = PosString_0?', "id":'+PosString_0:'';
var code = '{"type": "remuseAnimate"'+PosString_0+'},\n';
return code;
*/;
stopAnimate_s
: '停止所有动画' '执行动画回调' Bool Newline
: '停止动画编号'PosString?'(不填写编号为继续所有)' '执行动画回调' Bool Newline
/* stopAnimate_s
tooltip : stopAnimate停止所有动画
tooltip : stopAnimate停止动画(不填写编号为继续所有)
helpUrl : /_docs/#/instruction
default : [false]
default : ["",false]
colour : this.soundColor
PosString_0 = PosString_0?', "id":'+PosString_0:'';
Bool_0 = Bool_0?', "doCallback": true':'';
var code = '{"type": "stopAnimate"'+Bool_0+'},\n';
var code = '{"type": "stopAnimate"'+PosString_0+Bool_0+'},\n';
return code;
*/;
@ -2720,95 +2641,6 @@ return code;
*/;
animationDrawable_s
: '帧动画' '总显示帧数' IntString '底色' ColorString? Colour '底色不透明度' IntString? BGNL?Newline
'图片序列同一帧后面覆盖先前的默认起始帧为0结束帧为最后一帧)'BGNL?Newline
'(剪裁区域不填写为全图,绘制区域不填写为全画面)'BGNL?Newline
'(不透明度100为不透明默认为不透明结束不透明度默认与开始透明度相同'BGNL?Newline
animationDrawableimage+? Newline
'音频序列(到达对应帧进行播放)'BGNL?Newline
animationDrawablesound+? Newline
/* animationDrawable_s
tooltip : animationDrawable帧动画图片叠加
helpUrl : /_docs/#/instruction
default : [30,"0, 0, 0",'rgb(0, 0, 0)',""]
allImages : ['EvalString_0']
colour : this.imageColor
if (IntString_1&&(IntString_1 < 0||IntString_1>100)) throw new Error('透明度范围为0-100,0为透明100为不透明,不填默认为不透明')
ColorString_0 = ColorString_0 ? (', "color": ['+ColorString_0+']') : '';
IntString_1 = IntString_1 ? (', "globalAlpha": '+IntString_1+'') : '';
var imageList=animationDrawableimage_0?',"imageList": [\n'+animationDrawableimage_0.slice(0,-1)+'\n]':''
var soundList=animationDrawablesound_0?',"soundList": [\n'+animationDrawablesound_0.slice(0,-1)+'\n]':''
var code = '{"type": "animationDrawable", "allFarme": '+IntString_0+ColorString_0+IntString_1+imageList+soundList+'},\n';
return code;
*/;
animationDrawableList
: animationDrawableimage
| animationDrawablesound
| animationDrawabletextEmpty;
animationDrawableimage
: '图片' EvalString? '起始帧' IntString? '起始不透明度' IntString? BGNL? Newline
'剪裁坐标cx' IntString? 'cy' IntString? '宽' IntString? '高' IntString? '绘制坐标x'IntString? 'y' IntString? '宽' IntString? '高' IntString? BGNL? Newline
'结束帧' IntString? '结束不透明度' IntString? '剪裁坐标cx' IntString? 'cy' IntString? '宽' IntString? '高' IntString? '绘制坐标x'IntString? 'y' IntString? '宽' IntString? '高' IntString? Newline
/* animationDrawableimage
tooltip : 帧动画图片列表
helpUrl : /_docs/#/instruction
default : ["","","","","","","","","","","","","","","","","","","","",""]
colour : this.subColor
allImages : ['EvalString_0']
if (IntString_1&&(IntString_1 < 0||IntString_1>100)) throw new Error('不透明度范围为0-100,0为透明,100为不透明,不填默认为不透明')
if (IntString_11&&(IntString_11 < 0||IntString_11>100)) throw new Error('不透明度范围为0-100,0为透明,100为不透明,不填默认为不透明')
IntString_0 = IntString_0 ? (', "beforefarme": '+IntString_0+'') : '';
IntString_1 = IntString_1 ? (', "globalAlpha": '+IntString_1+'') : '';
IntString_2 = IntString_2 ? (', "cx": '+IntString_2+'') : '';
IntString_3 = IntString_3 ? (', "cy": '+IntString_3+'') : '';
IntString_4 = IntString_4 ? (', "cw": '+IntString_4+'') : '';
IntString_5 = IntString_5 ? (', "ch": '+IntString_5+'') : '';
IntString_6 = IntString_6 ? (', "x": '+IntString_6+'') : '';
IntString_7 = IntString_7 ? (', "y": '+IntString_7+'') : '';
IntString_8 = IntString_8 ? (', "w": '+IntString_8+'') : '';
IntString_9 = IntString_9 ? (', "h": '+IntString_9+'') : '';
IntString_10 = IntString_10 ? (', "afterfarme": '+IntString_10+'') : '';
IntString_11 = IntString_11 ? (', "aglobalAlpha": '+IntString_11+'') : '';
IntString_12 = IntString_12 ? (', "acx": '+IntString_12+'') : '';
IntString_13 = IntString_13 ? (', "acy": '+IntString_13+'') : '';
IntString_14 = IntString_14 ? (', "acw": '+IntString_14+'') : '';
IntString_15 = IntString_15 ? (', "ach": '+IntString_15+'') : '';
IntString_16 = IntString_16 ? (', "ax": '+IntString_16+'') : '';
IntString_17 = IntString_17 ? (', "ay": '+IntString_17+'') : '';
IntString_18 = IntString_18 ? (', "aw": '+IntString_18+'') : '';
IntString_19 = IntString_19 ? (', "ah": '+IntString_19+'') : '';
return '{ "image":"'+EvalString_0+'"'+IntString_0+IntString_1+IntString_2+IntString_3+IntString_4+IntString_5+IntString_6+IntString_7+IntString_8+IntString_9+IntString_10+IntString_11+IntString_12+IntString_13+IntString_14+IntString_15+IntString_16+IntString_17+IntString_18+IntString_19+'},'
*/;
animationDrawablesound
: '音效' EvalString? '起始帧' IntString '是否停止其他音效'Bool? Newline
/* animationDrawablesound
tooltip : 帧动画配音
helpUrl : /_docs/#/instruction
default : ["",0,false]
colour : this.subColor
allSounds : ['EvalString_0']
return '{ "sound":"'+EvalString_0+'","startfarme":'+IntString_0+',"stopbefore":'+Bool_0+'},'
*/;
animationDrawabletextEmpty
: Newline
/* animationDrawabletextEmpty
var code = [];
return code;
*/;
setCurtain_0_s
: '更改画面色调' ColorString Colour '动画时间' IntString? BGNL? Newline '渐变方式' MoveMode_List '持续到下一个本事件' Bool '不等待执行完毕' Bool Newline

View File

@ -729,140 +729,6 @@ MotaActionParser = function () {
this.next,
]);
break;
case "setanimate":
var buildanimateDrawableimage = function (obj) {
obj = MotaActionFunctions.processanimateDrawableimage(obj || []);
var res = null;
for (var ii = obj.length - 1, one; (one = obj[ii]); ii--) {
res = MotaActionBlocks["animateDrawableimage"].xmlText([
one[0],
one[1],
one[2],
one[3],
one[4],
one[5],
one[6],
one[7],
one[8],
one[9],
one[10],
one[11],
one[12],
one[13],
one[14],
one[15],
one[16],
one[17],
one[18],
one[19],
one[20],
one[21],
one[22],
res,
]);
}
return res;
};
var buildanimateDrawablesound = function (obj) {
obj = MotaActionFunctions.processanimateDrawablesound(obj || []);
var res = null;
for (var ii = obj.length - 1, one; (one = obj[ii]); ii--) {
res = MotaActionBlocks["animateDrawablesound"].xmlText([
one[0],
one[1],
one[2],
res,
]);
}
return res;
};
this.next = MotaActionBlocks["setanimate_s"].xmlText([
data.name,
data.px,
data.py,
data.width,
data.height,
data.allFarme,
buildanimateDrawableimage(data.imageList),
buildanimateDrawablesound(data.soundList),
this.next,
]);
break;
case "clearanimate":
this.next = MotaActionBlocks["clearanimate_s"].xmlText([this.next]);
break;
case "deleteanimate":
this.next = MotaActionBlocks["deleteanimate_s"].xmlText([
data.name,
this.next,
]);
break;
case "playanimate":
this.next = MotaActionBlocks["playanimate_s"].xmlText([
data.name,
data.x,
data.y,
data.hero,
data.scalex,
data.scaley,
this.next,
]);
break;
case "animationDrawable":
var buildanimationDrawableimage = function (obj) {
obj = MotaActionFunctions.processanimationDrawableimage(obj || []);
var res = null;
for (var ii = obj.length - 1, one; (one = obj[ii]); ii--) {
res = MotaActionBlocks["animationDrawableimage"].xmlText([
one[0],
one[1],
one[2],
one[3],
one[4],
one[5],
one[6],
one[7],
one[8],
one[9],
one[10],
one[11],
one[12],
one[13],
one[14],
one[15],
one[16],
one[17],
one[18],
one[19],
one[20],
res,
]);
}
return res;
};
var buildanimationDrawablesound = function (obj) {
obj = MotaActionFunctions.processanimationDrawablesound(obj || []);
var res = null;
for (var ii = obj.length - 1, one; (one = obj[ii]); ii--) {
res = MotaActionBlocks["animationDrawablesound"].xmlText([
one[0],
one[1],
one[2],
res,
]);
}
return res;
};
this.next = MotaActionBlocks["animationDrawable_s"].xmlText([
data.allFarme,
data.color,
"rgba(" + data.color + ")",
data.globalAlpha,
buildanimationDrawableimage(data.imageList),
buildanimationDrawablesound(data.soundList),
this.next,
]);
break;
case "tip":
this.next = MotaActionBlocks["tip_s"].xmlText([
@ -1235,8 +1101,34 @@ MotaActionParser = function () {
]);
}
break;
case "animateResize": // 停止所有动画
this.next = MotaActionBlocks["animateResize_s"].xmlText([
data.name,
data.id||"",
data.centerX||"",
data.centerY||"",
data.hero||false,
data.reverse||false,
data.loop||false,
data.async || false,
this.next,
]);
break;
case "pauseAnimate": // 暂停所有动画
this.next = MotaActionBlocks["pauseAnimate_s"].xmlText([
data.id||"",
this.next,
]);
break;
case "remuseAnimate": // 继续所有动画
this.next = MotaActionBlocks["remuseAnimate_s"].xmlText([
data.id||"",
this.next,
]);
break;
case "stopAnimate": // 停止所有动画
this.next = MotaActionBlocks["stopAnimate_s"].xmlText([
data.id||"",
data.doCallback || false,
this.next,
]);
@ -2938,80 +2830,7 @@ MotaActionParser = function () {
});
return list;
};
MotaActionFunctions.processanimationDrawableimage = function (overList) {
var list = [];
overList.forEach(function (one) {
list.push([
one.image,
one.beforefarme,
one.globalAlpha,
one.cx,
one.cy,
one.cw,
one.ch,
one.x,
one.y,
one.w,
one.h,
one.afterfarme,
one.aglobalAlpha,
one.acx,
one.acy,
one.acw,
one.ach,
one.ax,
one.ay,
one.aw,
one.ah,
]);
});
return list;
};
MotaActionFunctions.processanimationDrawablesound = function (overList) {
var list = [];
overList.forEach(function (one) {
list.push([one.sound, one.startfarme, one.stopbefore]);
});
return list;
};
MotaActionFunctions.processanimateDrawableimage = function (overList) {
var list = [];
overList.forEach(function (one) {
list.push([
one.image,
one.beforefarme,
one.globalAlpha,
one.cx,
one.cy,
one.cw,
one.ch,
one.x,
one.y,
one.w,
one.h,
one.angle,
one.afterfarme,
one.aglobalAlpha,
one.acx,
one.acy,
one.acw,
one.ach,
one.ax,
one.ay,
one.aw,
one.ah,
one.aangle,
]);
});
return list;
};
MotaActionFunctions.processanimateDrawablesound = function (overList) {
var list = [];
overList.forEach(function (one) {
list.push([one.sound, one.startfarme, one.stopbefore]);
});
return list;
};
MotaActionFunctions.processMultiLoc = function (EvalString_0, EvalString_1) {
var floorstr = "";
if (EvalString_0 && EvalString_1) {

View File

@ -354,6 +354,11 @@ editor_blockly = function () {
editor.uievent.previewUI([{ type: "drawImage", image: obj.name, x: obj.loc[0], y: obj.loc[1] }]);
}
break;
case 'animateResize_s': // 显示动画
if (obj.name && obj.centerX&&obj.centerY) {
editor.uievent.previewUI([{ type: "fillRect", x:obj.centerX-5, y: obj.centerY-5, width:10, height: 10, style:"#FF0000"}]);
}
break;
case 'setCurtain_0_s': // 更改色调
if (obj.color) {
editor.uievent.previewUI([{ type: "fillRect", x: 0, y: 0, width: core.__PIXELS__, height: core.__PIXELS__, style: obj.color }]);

View File

@ -1809,7 +1809,7 @@ events.prototype._action_animate = function (data, x, y, prefix) {
};
events.prototype._action_stopAnimate = function (data, x, y, prefix) {
core.stopAnimate(null, data.doCallback);
core.stopAnimate(data.id, data.doCallback);
core.doAction();
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -911,6 +911,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"animates": [
"hand",
"jianji",
"jianji2",
"sword",
"thunder",
"yongchang",
@ -1939,10 +1940,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"type": "function",
"function": "function(){\ncore.getItem('book', 1);\ncore.getItem('fly', 1);\ncore.getItem('postman', 1);\ncore.getItem('I369', 1);\n}"
},
{
"type": "insert",
"name": "战斗动画特效注册"
},
{
"type": "insert",
"name": "强制横屏"

View File

@ -7737,648 +7737,6 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
]
}
],
"战斗动画特效注册": [
{
"type": "setanimate",
"name": "sword",
"px": 48,
"py": 48,
"width": 192,
"height": 192,
"allFarme": 15,
"imageList": [
{
"image": "jianji.webp",
"beforefarme": 0,
"globalAlpha": 100,
"cx": 192,
"cy": 2112,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 3,
"acx": 192,
"acy": 2112,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "jianji.webp",
"beforefarme": 4,
"globalAlpha": 100,
"cx": 384,
"cy": 2112,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 6,
"acx": 384,
"acy": 2112,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "jianji.webp",
"beforefarme": 7,
"globalAlpha": 100,
"cx": 576,
"cy": 2112,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 9,
"acx": 576,
"acy": 2112,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "jianji.webp",
"beforefarme": 10,
"globalAlpha": 100,
"cx": 768,
"cy": 2112,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 12,
"acx": 768,
"acy": 2112,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "jianji.webp",
"beforefarme": 13,
"globalAlpha": 100,
"cx": 0,
"cy": 2304,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 15,
"acx": 0,
"acy": 2304,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
}
],
"soundList": [
{
"sound": "",
"startfarme": 0,
"stopbefore": false
}
]
},
{
"type": "setanimate",
"name": "Fire01",
"px": 48,
"py": 48,
"width": 192,
"height": 192,
"allFarme": 15,
"imageList": [
{
"image": "015-Fire01.webp",
"beforefarme": 0,
"globalAlpha": 100,
"cx": 192,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 3,
"acx": 192,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "015-Fire01.webp",
"beforefarme": 4,
"globalAlpha": 100,
"cx": 384,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 6,
"acx": 384,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "015-Fire01.webp",
"beforefarme": 7,
"globalAlpha": 100,
"cx": 576,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 9,
"acx": 576,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "015-Fire01.webp",
"beforefarme": 10,
"globalAlpha": 100,
"cx": 768,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 12,
"acx": 768,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "015-Fire01.webp",
"beforefarme": 13,
"globalAlpha": 100,
"cx": 960,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 15,
"acx": 960,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
}
],
"soundList": [
{
"sound": "",
"startfarme": 0,
"stopbefore": false
}
]
},
{
"type": "setanimate",
"name": "Fire02",
"px": 48,
"py": 48,
"width": 192,
"height": 192,
"allFarme": 15,
"imageList": [
{
"image": "015-Fire01.webp",
"beforefarme": 0,
"globalAlpha": 100,
"cx": 192,
"cy": 192,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 3,
"acx": 192,
"acy": 192,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "015-Fire01.webp",
"beforefarme": 4,
"globalAlpha": 100,
"cx": 384,
"cy": 192,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 6,
"acx": 384,
"acy": 192,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "015-Fire01.webp",
"beforefarme": 7,
"globalAlpha": 100,
"cx": 576,
"cy": 192,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 9,
"acx": 576,
"acy": 192,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "015-Fire01.webp",
"beforefarme": 10,
"globalAlpha": 100,
"cx": 768,
"cy": 192,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 12,
"acx": 768,
"acy": 192,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "015-Fire01.webp",
"beforefarme": 13,
"globalAlpha": 100,
"cx": 960,
"cy": 192,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 15,
"acx": 960,
"acy": 192,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
}
],
"soundList": [
{
"sound": "",
"startfarme": 0,
"stopbefore": false
}
]
},
{
"type": "setanimate",
"name": "005-Attack03",
"px": 48,
"py": 48,
"width": 192,
"height": 192,
"allFarme": 15,
"imageList": [
{
"image": "005-Attack03.webp",
"beforefarme": 0,
"globalAlpha": 100,
"cx": 0,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 3,
"acx": 0,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "005-Attack03.webp",
"beforefarme": 4,
"globalAlpha": 100,
"cx": 192,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 6,
"acx": 192,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "005-Attack03.webp",
"beforefarme": 7,
"globalAlpha": 100,
"cx": 384,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 9,
"acx": 384,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "005-Attack03.webp",
"beforefarme": 10,
"globalAlpha": 100,
"cx": 576,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 12,
"acx": 576,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "005-Attack03.webp",
"beforefarme": 13,
"globalAlpha": 100,
"cx": 768,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 15,
"acx": 768,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
}
],
"soundList": [
{
"sound": "",
"startfarme": 0,
"stopbefore": false
}
]
},
{
"type": "setanimate",
"name": "012-Heal01",
"px": 48,
"py": 48,
"width": 192,
"height": 192,
"allFarme": 15,
"imageList": [
{
"image": "012-Heal01.webp",
"beforefarme": 0,
"globalAlpha": 100,
"cx": 0,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 3,
"acx": 0,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "012-Heal01.webp",
"beforefarme": 4,
"globalAlpha": 100,
"cx": 192,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 6,
"acx": 192,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "012-Heal01.webp",
"beforefarme": 7,
"globalAlpha": 100,
"cx": 384,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 9,
"acx": 384,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "012-Heal01.webp",
"beforefarme": 10,
"globalAlpha": 100,
"cx": 576,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 12,
"acx": 576,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
},
{
"image": "012-Heal01.webp",
"beforefarme": 13,
"globalAlpha": 100,
"cx": 768,
"cy": 0,
"cw": 192,
"ch": 192,
"x": 0,
"y": 0,
"w": 96,
"h": 96,
"afterfarme": 15,
"acx": 768,
"acy": 0,
"acw": 192,
"ach": 192,
"ax": 0,
"ay": 0,
"aw": 96,
"ah": 96
}
],
"soundList": [
{
"sound": "",
"startfarme": 0,
"stopbefore": false
}
]
}
],
"chapter06": null,
"chapter07": null,
"chapter000001": [

View File

@ -285,8 +285,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
},
"afterBattle": async function (enemyId, x, y) {
// 战斗结束后触发的事件
var enemy = core.getEnemyInfo(enemyId, hero, x, y)
var special = enemy.special;
var enemy = core.material.enemys[enemyId]
var special = core.getEnemyValue(enemy, "special", x, y);
// 播放战斗音效和动画
// 默认播放的动画;你也可以使用
var animate = 'hand'; // 默认动画
@ -1077,9 +1077,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} else {
hero_damage += per_damage + per_mdamage
}
let animate = core.plugin.enemyanimate[enemy.id] ?? "sword"
let animate = core.plugin.enemyanimate[enemy.id] ?? "jianji2"
//这里可通过if更改默认的怪物攻击特效
hero_animate.push(animate) //勇士身上绘制sword动画
hero_animate.push(animate) //勇士身上绘制jianji2动画
if (heroinfo.mhp + (hero_diff.mhp ?? 0) - hero_damage >= 0) {
hero_diff.mhp = (hero_diff.mhp ?? 0) - hero_damage
hero_damage = 0
@ -1102,7 +1102,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
let mon_damage = 0
let hero_damage = 0
//这里写生效装备的技能效果同时对双方属性的修改计入diff(不要在此直接修改heroinfo和enemyinfo)
let animate = core.plugin.equipanimate[v.id] ?? "sword"
let animate = core.plugin.equipanimate[v.id] ?? "jianji2"
//这里可通过if更改默认的道具特效
enemy_animate.push(animate) //勇士身上绘制动画
@ -1144,7 +1144,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
let per_mdamage = Math.max(Math.floor(heroinfo.matk * (100 - enemyinfo.mdef) / 100), 0)
mon_damage = per_damage + per_mdamage
//这里记录伤害触发后的属性变化和动画同时计入diff(不要在此直接修改heroinfo和enemyinfo)
let animate = core.plugin.heroanimate[equip0] ?? "sword"
let animate = core.plugin.heroanimate[equip0] ?? "jianji2"
//这里可通过if更改默认的武器攻击特效
enemy_animate.push(animate)
@ -1170,7 +1170,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} else {
hero_damage += per_damage + per_mdamage
}
let animate = core.plugin.enemyanimate[enemy.id] ?? "sword"
let animate = core.plugin.enemyanimate[enemy.id] ?? "jianji2"
//这里可通过if更改默认的怪物攻击特效
hero_animate.push(animate) //勇士身上绘制sword动画
if (heroinfo.mhp + (hero_diff.mhp ?? 0) - hero_damage >= 0) {
@ -1194,7 +1194,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
let mon_damage = 0
let hero_damage = 0
//这里写生效装备的技能效果同时对双方属性的修改计入diff(不要在此直接修改heroinfo和enemyinfo)
let animate = core.plugin.equipanimate[v.id] ?? "sword"
let animate = core.plugin.equipanimate[v.id] ?? "jianji2"
//这里可通过if更改默认的道具特效
enemy_animate.push(animate) //怪物身上绘制动画
@ -1653,7 +1653,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
core.drawbackground(core.ui.cgText.image, core.ui.cgText.memory)
}
core.plugin.playing.clear();
// 切换到对应的楼层
core.changeFloor(data.floorId, null, data.hero.loc, 0, function () {
// TODO可以在这里设置读档后播放BGM

View File

@ -29,6 +29,19 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.removeMouse(data.div);
core.doAction();
});
core.registerEvent("animationDrawable", function (data) {
if (!main.replayChecking && !core.isReplaying()) {
core.animationDrawable(
data.allFarme,
data.color,
data.globalAlpha,
data.imageList,
data.soundList
);
} else {
core.doAction();
}
});
core.registerEvent("drawbackground", function (data) {
if (!main.replayChecking && !core.isReplaying()) {
core.drawbackground(data.image, data.memory);
@ -38,6 +51,19 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
core.doAction();
});
core.registerEvent("animateResize", function (data, x, y, prefix) {
core.events._action_animateResize(data, x, y, prefix)
});
core.registerEvent("pauseAnimate", function (data, x, y, prefix) {
core.maps.pauseAnimate(data.id)
core.doAction();
});
core.registerEvent("remuseAnimate", function (data, x, y, prefix) {
core.maps.remuseAnimate(data.id)
core.doAction();
});
core.registerEvent("clearbackground", function (data) {
if (!main.replayChecking && !core.isReplaying()) {
core.clearbackground();
@ -154,62 +180,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.doAction();
}
});
core.registerEvent("animationDrawable", function (data) {
if (!main.replayChecking && !core.isReplaying()) {
core.animationDrawable(
data.allFarme,
data.color,
data.globalAlpha,
data.imageList,
data.soundList
);
} else {
core.doAction();
}
});
core.registerEvent("setanimate", function (data) {
data.px = data.px ?? 0;
data.py = data.py ?? 0;
core.setanimate(
data.name,
data.px,
data.py,
data.width,
data.height,
data.allFarme,
data.imageList,
data.soundList
);
core.doAction();
});
core.registerEvent("clearanimate", function (data) {
core.plugin.playing.clear();
core.doAction();
});
core.registerEvent("deleteanimate", function (data) {
core.deleteanimate(data.name);
core.doAction();
});
core.registerEvent("playanimate", function (data) {
if (!main.replayChecking && !core.isReplaying()) {
data.x = data.x ?? 0;
data.y = data.y ?? 0;
data.scalex = data.scalex ?? 1;
data.scaley = data.scaley ?? 1;
core.playanimate(
data.name,
data.x,
data.y,
data.hero,
data.scalex,
data.scaley
);
core.doAction();
} else {
core.doAction();
}
});
core.registerEvent("cgtextList", function (data) {
core.ui.cgText.textList = data.textList;
core.doAction();
@ -12427,6 +12398,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
MotaActionBlocks["vibrate_s"].xmlText(),
MotaActionBlocks["animate_s"].xmlText(),
MotaActionBlocks["animate_1_s"].xmlText(),
MotaActionBlocks["animateResize_s"].xmlText(),
MotaActionBlocks["pauseAnimate_s"].xmlText(),
MotaActionBlocks["remuseAnimate_s"].xmlText(),
MotaActionBlocks["stopAnimate_s"].xmlText(),
MotaActionBlocks["setViewport_s"].xmlText(),
MotaActionBlocks["setViewport_1_s"].xmlText(),
@ -12447,10 +12421,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
音像处理: [
MotaActionBlocks["animationDrawable_s"].xmlText(),
MotaActionBlocks["introAndLoop_s"].xmlText(),
MotaActionBlocks["setanimate_s"].xmlText(),
MotaActionBlocks["deleteanimate_s"].xmlText(),
MotaActionBlocks["playanimate_s"].xmlText(),
MotaActionBlocks["clearanimate_s"].xmlText(),
MotaActionBlocks["showImage_s"].xmlText(),
MotaActionBlocks["showImage_1_s"].xmlText(),
MotaActionBlocks["hideImage_s"].xmlText(),
@ -19627,10 +19597,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
let farme = 0;
let now = 0;
let start = 0
core.registerAnimationFrame(
"animationDrawable",
true,
function (timestamp) {
let frametime = timestamp - now
now = timestamp;
if (!imageList || imageList.length == 0) return;
if (start === 0) start = now
if (timestamp - now > 1000 / 60) {
now = timestamp;
if (core.domStyle.isVertical) {
@ -19643,7 +19619,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
over.width = 2028;
over.height = 1248;
}
farme = Math.floor((now - start) / (1000 / 60))
core.clearMap(ctx)
ctx.globalAlpha = (globalAlpha ?? 100) / 100;
core.fillRect(ctx, 0, 0, 2028, 1248, color);
@ -19717,7 +19694,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.playSound(one.sound);
}
});
farme++;
ctx.globalAlpha = 1;
ctx.restore();
@ -20944,208 +20920,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.towebp(image);
});
};
},
"帧动画特效(游戏界面)": function () {
// 在此增加新插件
const animate2 = document.createElement("canvas"); //画布设置
animate2.style.zIndex = 91;
animate2.id = "animate2";
animate2.classList.add("gameCanvas", "anti-aliasing");
animate2.style.display = "block";
animate2.width = 416;
animate2.height = 416;
animate2.style.width = core.__PIXELS__ * core.domStyle.scale + "px";
animate2.style.height = core.__PIXELS__ * core.domStyle.scale + "px";
main.dom.animate2 = animate2;
const anctx = animate2.getContext("2d");
main.dom.gameDraw.appendChild(animate2);
core.plugin.playing = new Set();
this.setanimate = function (
name,
px,
py,
width,
height,
allFarme,
imageList,
soundList
) {
const data = {
px: px,
py: py,
width: width,
height: height,
allFarme: allFarme,
imageList: imageList,
soundList: soundList,
};
core.setFlag("animate_" + name, data);
};
this.deleteanimate = function (name) {
core.setFlag("animate_" + name);
};
let thistime = 0;
this.playanimate = function (name, x, y, hero, scalex, scaley, callback) {
const data = {
name: name,
x: x,
y: y,
hero: hero,
scalex: scalex,
scaley: scaley,
farme: 0,
callback,
};
core.plugin.playing.add(data);
};
core.registerAnimationFrame("animateonmap", true, function (timestamp) {
if (timestamp - thistime > 1000 / 30) {
thistime = timestamp;
core.clearMap(anctx);
core.plugin.playing.forEach((one) => {
const data = flags["animate_" + one.name];
if (!data) {
core.plugin.playing.delete(one);
} else {
data.imageList.forEach(function (image) {
if (
one.farme >= (image.beforefarme ?? 0) &&
one.farme <= (image.afterfarme ?? data.allFarme)
) {
const img = core.material.images.images?.[image.image];
if (img) {
const gla = image.globalAlpha ?? 100;
const agla = image.aglobalAlpha ?? gla,
beforefarme = image.beforefarme ?? 0;
const afterfarme = image.afterfarme ?? data.allFarme;
anctx.globalAlpha =
(gla +
((agla - gla) * (one.farme - beforefarme)) /
(afterfarme - beforefarme || 1)) /
100;
const cx =
(image.cx ?? 0) +
(((image.acx ?? 0) - (image.cx ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
cy =
(image.cy ?? 0) +
(((image.acy ?? 0) - (image.cy ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
cw =
(image.cw ?? img.width) +
(((image.acw ?? img.width) - (image.cw ?? img.width)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
ch =
(image.ch ?? img.height) +
(((image.acw ?? img.height) - (image.cw ?? img.height)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
x =
(image.x ?? 0) +
(((image.ax ?? 0) - (image.x ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
y =
(image.y ?? 0) +
(((image.ay ?? 0) - (image.y ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
w =
(image.w ?? one.width) +
(((image.aw ?? one.width) - (image.w ?? one.width)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
h =
(image.h ?? one.height) +
(((image.aw ?? one.height) - (image.w ?? one.height)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
angle =
(Math.PI *
((image.image.angle ?? 0) +
(((image.aangle ?? 0) - (image.image.angle ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1))) /
180;
if (one.hero) {
let sx, sy;
if (core.status.heroMoving < 0) {
sx = 0;
sy = 0;
} else {
sx =
core.utils.scan[core.status.hero.loc.direction].x *
4 *
core.status.heroMoving;
sy =
core.utils.scan[core.status.hero.loc.direction].y *
4 *
core.status.heroMoving;
}
const herox = core.status.hero.loc.x * 32 + 16 + sx;
const heroy = core.status.hero.loc.y * 32 + 16 + sy;
core.drawImage(
anctx,
img,
cx,
cy,
cw,
ch,
herox + (x - data.px) * one.scalex,
heroy + (y - data.py) * one.scaley,
w * one.scalex,
h * one.scaley,
angle
);
} else {
core.drawImage(
anctx,
img,
cx,
cy,
cw,
ch,
one.x + (x - data.px) * one.scalex,
one.y + (y - data.py) * one.scaley,
w * one.scalex,
h * one.scaley,
angle
);
}
}
}
});
data.soundList.forEach(function (sound) {
const lisen =
sound.sound &&
core.sounds[sound.sound] &&
core.musicStatus.soundStatus;
if (one.farme == sound.startfarme && lisen) {
if (sound.stopbefore) core.stopSound();
core.playSound(sound.sound);
}
});
one.farme++;
if (one.farme > data.allFarme) {
core.plugin.playing.delete(one);
if (one.callback) {
one.callback();
}
}
}
});
}
});
},
"intro&loop": function () {
// 在此增加新插件
@ -21503,164 +21277,117 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
animateAttack.style.height = core.__PIXELS__ * core.domStyle.scale + "px";
main.dom.animateAttack = animateAttack;
const ctx = animateAttack.getContext("2d");
core.plugin.playingattack = new Set();
const ctx6 = main.dom.animate2.getContext("2d");
const changeY = -30
let easy = false;
const { imagelighter } = core.plugin.utils;
main.dom.gameDraw.appendChild(animateAttack);
const { lcm, gcd } = core.plugin.utils;
const animate2 = document.createElement("canvas"); //画布设置
animate2.style.zIndex = 91;
animate2.id = "animate2";
animate2.classList.add("gameCanvas", "anti-aliasing");
animate2.style.display = "block";
animate2.width = 416;
animate2.height = 416;
animate2.style.width = core.__PIXELS__ * core.domStyle.scale + "px";
animate2.style.height = core.__PIXELS__ * core.domStyle.scale + "px";
main.dom.animate2 = animate2;
const anctx = animate2.getContext("2d");
function playanimate(name, x, y, scalex = 1, scaley = 1) {
const data = {
name: name,
x: x,
y: y,
scalex: scalex,
scaley: scaley,
farme: 0,
};
core.plugin.playingattack.add(data);
main.dom.gameDraw.appendChild(animate2);
let a = []
function drawAnimate(name, centerX, centerY) {
name = core.getMappedName(name);
// 正在播放录像:不显示动画
if (core.isReplaying() || !core.material.animates[name] || centerX == null || centerY == null) {
return -1;
}
// 开始绘制
var animate = core.material.animates[name];
animate.se = animate.se || {};
if (typeof animate.se == 'string') animate.se = { 1: animate.se };
var id = setTimeout(null);
a.push({
"name": name,
"id": id,
"animate": animate,
"centerX": centerX,
"centerY": centerY,
"start": 0,
"pause": false,
"pausetime": 0,
"index": 0,
});
return id;
}
function playinganimate() {
let time = 0;
if (core.plugin.playingattack.size === 0) return Promise.resolve();
return new Promise((resolve) => {
core.registerAnimationFrame("animateenemyattack", true, (timestamp) => {
if (timestamp - time > 1000 / 60) {
time = timestamp;
core.clearMap(ctx6);
function animationFrame(callback1) {
let time = 0
core.registerAnimationFrame("animate2", true, function (timestamp) {
let frametime = timestamp - time
time = timestamp;
if (
!a ||
a.length == 0
)
return;
core.clearMap(anctx);
// 更新帧
core.plugin.playingattack.forEach((one) => {
const data = flags["animate_" + one.name];
for (var i = 0; i < a.length; i++) {
var obj = a[i];
if (obj.start === 0) obj.start = time
obj.index = Math.floor((time - obj.start) / (1000 / 60))
if (obj.index >= obj.animate.frames.length) {
(function (callback) {
setTimeout(function () {
if (callback) callback();
});
})(obj.callback);
}
}
a = a.filter(function (obj) {
return obj.index < obj.animate.frames.length;
});
if (!data) {
core.plugin.playingattack.delete(one);
if (core.plugin.playingattack.size === 0) {
core.unregisterAnimationFrame("animateenemyattack");
resolve();
}
} else {
data.imageList.forEach(function (image) {
if (
one.farme >= (image.beforefarme ?? 0) &&
one.farme <= (image.afterfarme ?? data.allFarme)
) {
const img = core.material.images.images?.[image.image];
if (img) {
const gla = image.globalAlpha ?? 100;
const agla = image.aglobalAlpha ?? gla,
beforefarme = image.beforefarme ?? 0;
const afterfarme = image.afterfarme ?? data.allFarme;
ctx6.globalAlpha =
(gla +
((agla - gla) * (one.farme - beforefarme)) /
(afterfarme - beforefarme || 1)) /
100;
const cx =
(image.cx ?? 0) +
(((image.acx ?? 0) - (image.cx ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
cy =
(image.cy ?? 0) +
(((image.acy ?? 0) - (image.cy ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
cw =
(image.cw ?? img.width) +
(((image.acw ?? img.width) -
(image.cw ?? img.width)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
ch =
(image.ch ?? img.height) +
(((image.acw ?? img.height) -
(image.cw ?? img.height)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
x =
(image.x ?? 0) +
(((image.ax ?? 0) - (image.x ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
y =
(image.y ?? 0) +
(((image.ay ?? 0) - (image.y ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
w =
(image.w ?? one.width) +
(((image.aw ?? one.width) - (image.w ?? one.width)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
h =
(image.h ?? one.height) +
(((image.aw ?? one.height) -
(image.w ?? one.height)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1),
angle =
(Math.PI *
((image.image.angle ?? 0) +
(((image.aangle ?? 0) -
(image.image.angle ?? 0)) *
(one.farme - beforefarme)) /
(afterfarme - beforefarme || 1))) /
180;
core.drawImage(
ctx6,
img,
cx,
cy,
cw,
ch,
one.x + (x - data.px) * one.scalex,
one.y + (y - data.py) * one.scaley,
w * one.scalex,
h * one.scaley,
angle
);
}
}
});
data.soundList.forEach(function (sound) {
const lisen =
sound.sound &&
core.sounds[sound.sound] &&
core.musicStatus.soundStatus;
if (one.farme == sound.startfarme && lisen) {
if (sound.stopbefore) core.stopSound();
core.playSound(sound.sound);
}
});
one.farme++;
ctx6.restore();
if (one.farme > data.allFarme) {
core.clearMap(ctx6);
core.plugin.playingattack.delete(one);
if (core.plugin.playingattack.size === 0) {
core.unregisterAnimationFrame("animateenemyattack");
resolve();
}
}
}
});
if (a.length === 0) {
core.clearMap(anctx);
core.unregisterAnimationFrame("animate2")
callback1()
}
a.forEach(function (obj) {
if (obj.hero) {
core.maps._drawAnimateFrame(
anctx,
obj.animate,
core.status.heroCenter.px,
core.status.heroCenter.py,
obj.index
);
} else {
core.maps._drawAnimateFrame(
anctx,
obj.animate,
obj.centerX,
obj.centerY,
obj.index
);
}
});
core.animateFrame.animateTime = timestamp;
});
}
main.dom.gameDraw.appendChild(animateAttack);
const { lcm, gcd } = core.plugin.utils;
function animateonAttack(name, onenemy) {
function animateonAttack(name, onenemy, callback) {
if (onenemy) {
playanimate(name, 290, 180 + changeY);
drawAnimate(name, 290, 180 + changeY);
} else {
playanimate(name, 130, 180 + changeY);
drawAnimate(name, 130, 180 + changeY);
}
}
@ -22385,7 +22112,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (heroInfo.hp < 0) heroInfo.hp = 0;
if (enemyInfo.hp < 0) enemyInfo.hp = 0;
await Promise.all([
await playinganimate(),
await new Promise((resolve) => animationFrame(resolve)),
new Promise((resolve) => {
if (heroInfo.isAttack) {
heroInfo.now = 0;
@ -23352,19 +23080,19 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// 在此增加新插件
this.equip = {
//所有回合中的装备及速度
sword1: { id: "sword1", speed: 10 },
sword1: { id: "jianji", speed: 10 },
};
this.heroanimate = {
//勇士武器对应的动画(key为主手武器IDvalue为帧动画名)
sword1: "sword",
sword1: "jianji2",
};
this.enemyanimate = {
//怪物对应的动画(key为怪物IDvalue为帧动画名)
bat: "sword",
bat: "jianji2",
};
this.equipanimate = {
//勇士周期性装备对应的动画(key为装备Idvalue为帧动画名)
shield0: "sword",
shield0: "jianji2",
};
},
"勇士法抗乘算叠加": function () {
@ -25809,5 +25537,269 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
//#endregion
},
"动画": function () {
// 在此增加新插件
control.prototype._animationFrame_animate = function (timestamp) {
let frametime = timestamp - core.animateFrame.animateTime
core.animateFrame.animateTime = timestamp;
if (!core.status.animateObjs || core.status.animateObjs.length == 0) return;
core.clearMap('animate');
// 更新帧
for (var i = 0; i < core.status.animateObjs.length; i++) {
var obj = core.status.animateObjs[i];
if (obj.pause) obj.pausetime += frametime
if (obj.start === 0) obj.start = core.animateFrame.animateTime
obj.index = Math.floor((core.animateFrame.animateTime - obj.start - obj.pausetime) / (1000 / 60))
if (obj.reverse) obj.index = obj.animate.frames.length - obj.index
if ((!obj.reverse && obj.index >= obj.animate.frames.length) || (obj.reverse && obj.index <= 0)) {
if (obj.loop) {
if (obj.reverse) {
obj.index = obj.animate.frames.length
obj.start = core.animateFrame.animateTime
obj.pausetime = 0
} else {
obj.start = core.animateFrame.animateTime
obj.index = 0
obj.pausetime = 0
}
} else
(function (callback) {
setTimeout(function () {
if (callback) callback();
});
})(obj.callback);
}
}
core.status.animateObjs = core.status.animateObjs.filter(function (obj) {
return (!obj.reverse && obj.index < obj.animate.frames.length) || (obj.reverse && obj.index > 0);
});
let sx, sy;
if (core.status.heroMoving < 0) {
sx = 0;
sy = 0;
} else {
sx =
core.utils.scan[core.status.hero.loc.direction].x *
4 *
core.status.heroMoving;
sy =
core.utils.scan[core.status.hero.loc.direction].y *
4 *
core.status.heroMoving;
}
const herox = core.status.hero.loc.x * 32 + 16 + sx;
const heroy = core.status.hero.loc.y * 32 + 32 + sy - core.material.icons.hero.height / 2;
core.status.animateObjs.forEach(function (obj) {
if (obj.hero) {
core.maps._drawAnimateFrame('animate', obj.animate, herox, heroy, obj.index);
} else {
core.maps._drawAnimateFrame('animate', obj.animate, obj.centerX, obj.centerY, obj.index);
}
});
}
core.registerAnimationFrame("animate", true, core.control._animationFrame_animate);
////// 绘制动画 //////
maps.prototype.drawAnimate = function (name, x, y, alignWindow, callback) {
name = core.getMappedName(name);
// 正在播放录像:不显示动画
if (core.isReplaying() || !core.material.animates[name] || x == null || y == null) {
if (callback) callback();
return -1;
}
// 开始绘制
var animate = core.material.animates[name],
centerX = 32 * x + 16,
centerY = 32 * y + 16;
if (alignWindow) {
centerX += core.bigmap.offsetX;
centerY += core.bigmap.offsetY;
}
animate.se = animate.se || {};
if (typeof animate.se == 'string') animate.se = { 1: animate.se };
var id = setTimeout(null);
core.status.animateObjs.push({
"name": name,
"id": id,
"animate": animate,
"centerX": centerX,
"centerY": centerY,
"start": 0,
"pause": false,
"pausetime": 0,
"index": 0,
"callback": callback
});
return id;
}
////// 绘制反转动画 //////
maps.prototype.drawResizeAnimate = function (name, id, centerX, centerY, hero, reverse, loop, callback) {
name = core.getMappedName(name);
// 正在播放录像:不显示动画
if (core.isReplaying() || !core.material.animates[name]) {
if (callback) callback();
return -1;
}
// 开始绘制
var animate = core.material.animates[name],
centerX = core.calValue(centerX)
centerY = core.calValue(centerY)
animate.se = animate.se || {};
if (typeof animate.se == 'string') animate.se = { 1: animate.se };
var id = id || setTimeout(null);
if (hero) core.status.animateObjs.push({
"name": name,
"id": id,
"animate": animate,
"hero": true,
"reverse": reverse,
"start": 0,
"pause": false,
"loop": loop,
"pausetime": 0,
"index": 0,
"callback": callback
})
else core.status.animateObjs.push({
"name": name,
"id": id,
"animate": animate,
"centerX": centerX,
"centerY": centerY,
"reverse": reverse,
"start": 0,
"pause": false,
"loop": loop,
"pausetime": 0,
"index": 0,
"callback": callback
});
return id;
}
events.prototype._action_animateResize = function (data, x, y, prefix) {
core.events.__action_doAsyncFunc(data.async, core.maps.drawResizeAnimate, data.name, data.id, data.centerX, data.centerY, data.hero, data.reverse, data.loop);
};
////// 绘制一个跟随勇士的动画 //////
maps.prototype.drawHeroAnimate = function (name, callback) {
name = core.getMappedName(name);
// 正在播放录像或动画不存在:不显示动画
if (core.isReplaying() || !core.material.animates[name]) {
if (callback) callback();
return -1;
}
// 开始绘制
var animate = core.material.animates[name];
animate.se = animate.se || {};
if (typeof animate.se == 'string') animate.se = { 1: animate.se };
var id = setTimeout(null);
core.status.animateObjs.push({
"name": name,
"id": id,
"animate": animate,
"hero": true,
"start": 0,
"pause": false,
"pausetime": 0,
"index": 0,
"callback": callback
});
return id;
}
////// 获得当前正在播放的所有指定动画的id列表 //////
maps.prototype.getPlayingAnimates = function (name) {
return (core.status.animateObjs || []).filter(function (one) {
return name == null || one.name == name;
}).map(function (one) { return one.id });
}
////// 绘制动画的某一帧 //////
maps.prototype._drawAnimateFrame = function (name, animate, centerX, centerY, index) {
var ctx = core.getContextByName(name);
if (!ctx) return;
var frame = animate.frames[index % animate.frame];
core.playSound((animate.se || {})[index % animate.frame + 1], (animate.pitch || {})[index % animate.frame + 1]);
var ratio = animate.ratio;
frame.forEach(function (t) {
var image = animate.images[t.index];
if (!image) return;
var realWidth = image.width * ratio * t.zoom / 100;
var realHeight = image.height * ratio * t.zoom / 100;
core.setAlpha(ctx, t.opacity / 255);
var cx = centerX + t.x,
cy = centerY + t.y;
var ix = cx - realWidth / 2 - core.bigmap.offsetX,
iy = cy - realHeight / 2 - core.bigmap.offsetY;
var mirror = t.mirror ? 'x' : null;
var angle = t.angle ? -t.angle * Math.PI / 180 : null;
core.drawImage(ctx, image, ix, iy, realWidth, realHeight, null, null, null, null, angle, mirror);
core.setAlpha(ctx, 1);
})
}
////// 暂停动画 //////
maps.prototype.pauseAnimate = function (id) {
for (var i = 0; i < core.status.animateObjs.length; i++) {
var obj = core.status.animateObjs[i];
if (id == null || obj.id == id) {
obj.pause = true
}
}
}
////// 继续动画 //////
maps.prototype.remuseAnimate = function (id) {
for (var i = 0; i < core.status.animateObjs.length; i++) {
var obj = core.status.animateObjs[i];
if (id == null || obj.id == id) {
obj.pause = false
}
}
}
////// 停止动画 //////
maps.prototype.stopAnimate = function (id, doCallback) {
for (var i = 0; i < core.status.animateObjs.length; i++) {
var obj = core.status.animateObjs[i];
if (id == null || obj.id == id) {
if (doCallback) {
(function (callback) {
setTimeout(function () {
if (callback) callback();
});
})(obj.callback);
}
}
}
core.status.animateObjs = core.status.animateObjs.filter(function (x) { return id != null && x.id != id });
if (core.status.animateObjs.length == 0)
core.clearMap('animate');
}
}
}