NPC选单制作完成
This commit is contained in:
parent
e5b71f0a7e
commit
ebcc389379
@ -953,6 +953,7 @@ action
|
|||||||
| input_s
|
| input_s
|
||||||
| input2_s
|
| input2_s
|
||||||
| choices_s
|
| choices_s
|
||||||
|
| menu_s
|
||||||
| confirm_s
|
| confirm_s
|
||||||
| callBook_s
|
| callBook_s
|
||||||
| callSave_s
|
| callSave_s
|
||||||
@ -3526,6 +3527,63 @@ var code = ['{"type": "choices"',EvalString_Multi_0,Int_0,IntString_0,
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
menu_s
|
||||||
|
: 'NPC名字' ':' EvalString_Multi BGNL? Newline choicesList+ BEND Newline
|
||||||
|
|
||||||
|
|
||||||
|
/* menu_s
|
||||||
|
tooltip : menu: 给NPC提供选项
|
||||||
|
helpUrl : /_docs/#/instruction
|
||||||
|
previewBlock : true
|
||||||
|
colour : this.taskColor
|
||||||
|
default : ["流浪者"]
|
||||||
|
EvalString_Multi_0 = ', "text": "'+EvalString_Multi_0+'"';
|
||||||
|
var code = ['{"type": "menu"',EvalString_Multi_0,
|
||||||
|
block.isCollapsed()?', "_collapsed": true':'',
|
||||||
|
block.isEnabled()?'':', "_disabled": true',
|
||||||
|
', "choices": [\n',
|
||||||
|
choicesList_0,
|
||||||
|
']},\n'].join('');
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
choicesList
|
||||||
|
: chooseContext
|
||||||
|
| taskContext;
|
||||||
|
|
||||||
|
chooseContext
|
||||||
|
: '子选项' EvalString '启用条件' EvalString? '出现条件' EvalString? BGNL? Newline action+
|
||||||
|
|
||||||
|
|
||||||
|
/* chooseContext
|
||||||
|
tooltip : 选项的选择
|
||||||
|
helpUrl : /_docs/#/instruction
|
||||||
|
default : ["对话","",""]
|
||||||
|
colour : this.subColor
|
||||||
|
EvalString_1 = EvalString_1 && (', "need": "'+EvalString_1+'"');
|
||||||
|
EvalString_2 = EvalString_2 && (', "condition": "'+EvalString_2+'"');
|
||||||
|
var collapsed=block.isCollapsed()?', "_collapsed": true':'';
|
||||||
|
var disabled=block.isEnabled()?'':', "_disabled": true';
|
||||||
|
var code = '{"type":"context","text": "'+EvalString_0+'"'+EvalString_1+EvalString_2+collapsed+disabled+', "action": [\n'+action_0+']},\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
|
taskContext
|
||||||
|
: '可接取任务名'EvalString? Newline
|
||||||
|
'可提交任务名' EvalString? BGNL? Newline action+
|
||||||
|
|
||||||
|
|
||||||
|
/* taskContext
|
||||||
|
tooltip : 选项的选择
|
||||||
|
helpUrl : /_docs/#/instruction
|
||||||
|
default : ["新手任务","task1,task2"]
|
||||||
|
colour : this.subColor
|
||||||
|
var condition = ', "condition": "\''+EvalString_0+'\'.split(\',\').some(v=>core.plugin.可接取任务.includes(v))||\''+EvalString_1+'\'.split(\',\').some(v=>core.taskSystem.tasksInfo.find(a => a.name ===v.name))"';
|
||||||
|
var collapsed=block.isCollapsed()?', "_collapsed": true':'';
|
||||||
|
var disabled=block.isEnabled()?'':', "_disabled": true';
|
||||||
|
var code = '{"type":"taskContext","text":"任务","text1": "'+EvalString_0+'","text2":"'+EvalString_1+'"'+condition+collapsed+disabled+', "action": [\n'+action_0+']},\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
choicesContext
|
choicesContext
|
||||||
: '子选项' EvalString '图标' IdString? '颜色' ColorString? Colour '启用条件' EvalString? '出现条件' EvalString? BGNL? Newline action+
|
: '子选项' EvalString '图标' IdString? '颜色' ColorString? Colour '启用条件' EvalString? '出现条件' EvalString? BGNL? Newline action+
|
||||||
|
|
||||||
|
@ -2025,6 +2025,44 @@ MotaActionParser = function () {
|
|||||||
/*disabled*/ data._disabled
|
/*disabled*/ data._disabled
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case "menu": // 提供NPC菜单
|
||||||
|
var that = this;
|
||||||
|
var bulidmenuList = function(obj) {
|
||||||
|
var res = null;
|
||||||
|
for (var ii = obj.length - 1, one; (one = obj[ii]); ii--) {
|
||||||
|
if(one.type==="context"){
|
||||||
|
res = MotaActionBlocks["chooseContext"].xmlText([
|
||||||
|
one.text||"",
|
||||||
|
one.need || "",
|
||||||
|
one.condition || "",
|
||||||
|
that.insertActionList(one.action),
|
||||||
|
res,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
else if(one.type==="taskContext"){
|
||||||
|
res = MotaActionBlocks["taskContext"].xmlText([
|
||||||
|
one.text1||"",
|
||||||
|
one.text2||"",
|
||||||
|
that.insertActionList(one.action),
|
||||||
|
res,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
this.next = MotaActionFunctions.xmlText(
|
||||||
|
"menu_s",
|
||||||
|
[
|
||||||
|
data.text,
|
||||||
|
bulidmenuList(data.choices),
|
||||||
|
this.next,
|
||||||
|
],
|
||||||
|
/* isShadow */ false,
|
||||||
|
/*comment*/ null,
|
||||||
|
/*collapsed*/ data._collapsed,
|
||||||
|
/*disabled*/ data._disabled
|
||||||
|
);
|
||||||
|
break;
|
||||||
case "choices": // 提供选项
|
case "choices": // 提供选项
|
||||||
var text_choices = null;
|
var text_choices = null;
|
||||||
for (
|
for (
|
||||||
|
2608
libs/actions.js
2608
libs/actions.js
File diff suppressed because it is too large
Load Diff
@ -11767,6 +11767,91 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"action": []
|
"action": []
|
||||||
|
},
|
||||||
|
"task1": {
|
||||||
|
"type": "taskEvent",
|
||||||
|
"text": "任务描述",
|
||||||
|
"n": 1,
|
||||||
|
"info": [
|
||||||
|
{
|
||||||
|
"type": "checkItem",
|
||||||
|
"checkItem": "yellowKey",
|
||||||
|
"operator": ">=",
|
||||||
|
"count": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkStatus",
|
||||||
|
"checkStatus": "atk",
|
||||||
|
"operator": ">=",
|
||||||
|
"count": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkFlag",
|
||||||
|
"checkFlag": "flag1",
|
||||||
|
"operator": "=",
|
||||||
|
"count": "\"value\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkBlock",
|
||||||
|
"checkBlock": "bat",
|
||||||
|
"floorId": [
|
||||||
|
"MT1",
|
||||||
|
"MT2"
|
||||||
|
],
|
||||||
|
"operator": "<=",
|
||||||
|
"count": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "kill",
|
||||||
|
"operator": ">=",
|
||||||
|
"count": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "killLocs",
|
||||||
|
"loc": [
|
||||||
|
[
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"floorId": "MT1",
|
||||||
|
"operator": ">=",
|
||||||
|
"count": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "killSpecial",
|
||||||
|
"killSpecial": "61",
|
||||||
|
"floorId": [
|
||||||
|
"61"
|
||||||
|
],
|
||||||
|
"operator": ">=",
|
||||||
|
"count": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "killAll",
|
||||||
|
"floorId": [
|
||||||
|
"MT1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "specialBlock",
|
||||||
|
"floorId": [
|
||||||
|
"MT1"
|
||||||
|
],
|
||||||
|
"specialBlock": "血网伤害",
|
||||||
|
"operator": "<",
|
||||||
|
"count": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "gosthFloor",
|
||||||
|
"floorId": [
|
||||||
|
"MT1"
|
||||||
|
],
|
||||||
|
"operator": "<",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"action": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -236,6 +236,31 @@ main.floors.jiaocheng01=
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"5,11": [
|
||||||
|
{
|
||||||
|
"type": "menu",
|
||||||
|
"text": "流浪者",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "context",
|
||||||
|
"text": "对话",
|
||||||
|
"action": [
|
||||||
|
"\t[流浪者]你好啊"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "taskContext",
|
||||||
|
"text": "任务",
|
||||||
|
"text1": "新手任务",
|
||||||
|
"text2": "task1,task2",
|
||||||
|
"condition": "'新手任务'.split(',').some(v=>core.plugin.可接取任务.includes(v))||'task1,task2'.split(',').some(v=>core.taskSystem.tasksInfo.find(a => a.name ===v.name))",
|
||||||
|
"action": [
|
||||||
|
"这个东西还没做"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"changeFloor": {
|
"changeFloor": {
|
||||||
@ -266,7 +291,7 @@ main.floors.jiaocheng01=
|
|||||||
[ 0, 0, 0, 1, 21, 1, 1, 1, 0, 1, 0, 0, 0],
|
[ 0, 0, 0, 1, 21, 1, 1, 1, 0, 1, 0, 0, 0],
|
||||||
[403, 0,404, 1, 23, 1, 21, 1, 0, 1, 34, 0, 33],
|
[403, 0,404, 1, 23, 1, 21, 1, 0, 1, 34, 0, 33],
|
||||||
[ 1, 1, 1, 1, 1, 1, 0, 1, 81, 1, 1, 1, 1],
|
[ 1, 1, 1, 1, 1, 1, 0, 1, 81, 1, 1, 1, 1],
|
||||||
[129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,129],
|
[129, 0, 0, 0, 0,121, 0, 0, 0, 0, 0, 0,129],
|
||||||
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1]
|
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1]
|
||||||
],
|
],
|
||||||
"areas": "教程",
|
"areas": "教程",
|
||||||
|
@ -3028,6 +3028,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
core.overupdate()
|
core.overupdate()
|
||||||
if (main.dom.saveLoad && main.dom.saveLoad.style.display === "block")
|
if (main.dom.saveLoad && main.dom.saveLoad.style.display === "block")
|
||||||
core.saveLoad.update();
|
core.saveLoad.update();
|
||||||
|
if (core.status.event.data?.type == "menu") core.menu.update()
|
||||||
};
|
};
|
||||||
|
|
||||||
class StatusBar {
|
class StatusBar {
|
||||||
@ -11909,20 +11910,33 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
],
|
],
|
||||||
"event"
|
"event"
|
||||||
),
|
),
|
||||||
MotaActionFunctions.actionParser.parse({"type":"taskEvent","text": "任务描述","n":1,"info":[
|
MotaActionFunctions.actionParser.parse({
|
||||||
{"type":"checkItem","checkItem":"yellowKey","operator":">=","count":0},
|
"type": "taskEvent",
|
||||||
{"type":"checkStatus","checkStatus":"atk","operator":">=","count":10},
|
"text": "任务描述",
|
||||||
{"type":"checkFlag","checkFlag":"flag1","operator":"=","count":"\"value\""},
|
"n": 1,
|
||||||
{"type":"checkBlock","checkBlock":"bat","floorId":["MT1","MT2"],"operator":"<=","count":0},
|
"info": [
|
||||||
{"type":"kill","operator":">=","count":0},
|
{ "type": "checkItem", "checkItem": "yellowKey", "operator": ">=", "count": 0 },
|
||||||
{"type":"killLocs", "loc": [[1,1]],"floorId":"MT1","operator":">=","count":1},
|
{ "type": "checkStatus", "checkStatus": "atk", "operator": ">=", "count": 10 },
|
||||||
{"type":"killSpecial","killSpecial":"61","floorId":["61"],"operator":">=","count":1},
|
{ "type": "checkFlag", "checkFlag": "flag1", "operator": "=", "count": "\"value\"" },
|
||||||
{"type":"killAll","floorId":["MT1"]},
|
{ "type": "checkBlock", "checkBlock": "bat", "floorId": ["MT1", "MT2"], "operator": "<=", "count": 0 },
|
||||||
{"type":"specialBlock","floorId":["MT1"],"specialBlock":"血网伤害","operator":"<","count":1},
|
{ "type": "kill", "operator": ">=", "count": 0 },
|
||||||
{"type":"gosthFloor","floorId":["MT1"],"operator":"<","count":1},
|
{
|
||||||
{"type":"arrival","floorId":"MT1"},
|
"type": "killLocs",
|
||||||
], "action": [
|
"loc": [
|
||||||
]},
|
[1, 1]
|
||||||
|
],
|
||||||
|
"floorId": "MT1",
|
||||||
|
"operator": ">=",
|
||||||
|
"count": 1
|
||||||
|
},
|
||||||
|
{ "type": "killSpecial", "killSpecial": "61", "floorId": ["61"], "operator": ">=", "count": 1 },
|
||||||
|
{ "type": "killAll", "floorId": ["MT1"] },
|
||||||
|
{ "type": "specialBlock", "floorId": ["MT1"], "specialBlock": "血网伤害", "operator": "<", "count": 1 },
|
||||||
|
{ "type": "gosthFloor", "floorId": ["MT1"], "operator": "<", "count": 1 },
|
||||||
|
{ "type": "arrival", "floorId": "MT1" },
|
||||||
|
],
|
||||||
|
"action": []
|
||||||
|
},
|
||||||
"taskEvent"
|
"taskEvent"
|
||||||
),
|
),
|
||||||
MotaActionFunctions.actionParser.parse({
|
MotaActionFunctions.actionParser.parse({
|
||||||
@ -12327,6 +12341,29 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
MotaActionBlocks["setBgmSpeed_s"].xmlText(),
|
MotaActionBlocks["setBgmSpeed_s"].xmlText(),
|
||||||
],
|
],
|
||||||
任务相关: [
|
任务相关: [
|
||||||
|
MotaActionFunctions.actionParser.parseList({
|
||||||
|
"type": "menu",
|
||||||
|
"text": "流浪者",
|
||||||
|
"choices": [{
|
||||||
|
"type": "context",
|
||||||
|
"text": "对话",
|
||||||
|
"action": [
|
||||||
|
"\t[流浪者]你好啊",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "taskContext",
|
||||||
|
"text": "任务",
|
||||||
|
"text1": "新手任务",
|
||||||
|
"text2": "task1,task2",
|
||||||
|
"condition": "'新手任务'.split(',').some(v=>core.plugin.可接取任务.includes(v))||'task1,task2,'.split(',').some(v=>core.taskSystem.tasksInfo.findIndex(a => a.name ===v.name))",
|
||||||
|
"action": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
}),
|
||||||
MotaActionBlocks['setTask_s'].xmlText(),
|
MotaActionBlocks['setTask_s'].xmlText(),
|
||||||
MotaActionBlocks['removeTask_s'].xmlText(),
|
MotaActionBlocks['removeTask_s'].xmlText(),
|
||||||
MotaActionBlocks['removeTaskByName_s'].xmlText(),
|
MotaActionBlocks['removeTaskByName_s'].xmlText(),
|
||||||
@ -28211,7 +28248,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
// 在此增加新插件
|
// 在此增加新插件
|
||||||
//详细的任务信息及要求存放在core.events.task,供TaskSystem使用
|
//详细的任务信息及要求存放在core.events.task,供TaskSystem使用
|
||||||
//以下均为任务名构成的数组,在任务接取或提交时转换
|
//以下均为任务名构成的数组,在任务接取或提交时转换
|
||||||
this.可接取任务 = []
|
this.可接取任务 = ["新手任务"]
|
||||||
this.已提交任务 = []
|
this.已提交任务 = []
|
||||||
//当前任务及任务状态在TaskSystem内部,无需数组
|
//当前任务及任务状态在TaskSystem内部,无需数组
|
||||||
class TaskSystem {
|
class TaskSystem {
|
||||||
@ -28226,6 +28263,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkTask(index) {
|
checkTask(index) {
|
||||||
|
if (index < 0 || index > this.tasksInfo.length - 1) return false
|
||||||
if (this.tasksInfo[index].success) return true
|
if (this.tasksInfo[index].success) return true
|
||||||
else return this.tasksInfo[index].tasks.reduce((a, b) => a + Number(b.check()), 0) >= this.tasksInfo[index].n
|
else return this.tasksInfo[index].tasks.reduce((a, b) => a + Number(b.check()), 0) >= this.tasksInfo[index].n
|
||||||
}
|
}
|
||||||
@ -28234,6 +28272,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
removeTask(index)
|
removeTask(index)
|
||||||
}
|
}
|
||||||
removeTask(index) {
|
removeTask(index) {
|
||||||
|
if (index < 0 || index > this.tasksInfo.length - 1) return
|
||||||
this.tasksInfo.splice(index, 1)
|
this.tasksInfo.splice(index, 1)
|
||||||
}
|
}
|
||||||
clearTesk() {
|
clearTesk() {
|
||||||
@ -28251,7 +28290,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
this.clearTesk()
|
this.clearTesk()
|
||||||
}
|
}
|
||||||
trymitTask(index) {
|
trymitTask(index) {
|
||||||
|
if (index < 0 || index > this.tasksInfo.length - 1) return
|
||||||
if (this.checkTask(index)) {
|
if (this.checkTask(index)) {
|
||||||
if (this.tasksInfo[i].action) core.insertAction(this.tasksInfo[i].action)
|
if (this.tasksInfo[i].action) core.insertAction(this.tasksInfo[i].action)
|
||||||
core.plugin.已提交任务.push(this.tasksInfo[i].name)
|
core.plugin.已提交任务.push(this.tasksInfo[i].name)
|
||||||
@ -28261,6 +28300,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
}
|
}
|
||||||
trymitTaskByName(name) {
|
trymitTaskByName(name) {
|
||||||
const index = this.tasksInfo.findIndex(v => v.name === name)
|
const index = this.tasksInfo.findIndex(v => v.name === name)
|
||||||
|
if (index < 0 || index > this.tasksInfo.length - 1) return
|
||||||
if (this.checkTask(index)) {
|
if (this.checkTask(index)) {
|
||||||
if (this.tasksInfo[i].action) core.insertAction(this.tasksInfo[i].action)
|
if (this.tasksInfo[i].action) core.insertAction(this.tasksInfo[i].action)
|
||||||
core.plugin.已提交任务.push(name)
|
core.plugin.已提交任务.push(name)
|
||||||
@ -28269,12 +28309,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
|
|
||||||
}
|
}
|
||||||
successTesk(index) {
|
successTesk(index) {
|
||||||
|
if (index < 0 || index > this.tasksInfo.length - 1) return
|
||||||
this.tasksInfo[index].success = true
|
this.tasksInfo[index].success = true
|
||||||
this.tasksInfo[index].complter = true
|
this.tasksInfo[index].complter = true
|
||||||
}
|
}
|
||||||
successTeskByName(name) {
|
successTeskByName(name) {
|
||||||
const index = this.tasksInfo.findIndex(v => v.name === name)
|
const index = this.tasksInfo.findIndex(v => v.name === name)
|
||||||
this.tsuccessTesk(index)
|
if (index < 0 || index > this.tasksInfo.length - 1) return
|
||||||
|
this.successTesk(index)
|
||||||
}
|
}
|
||||||
save() {
|
save() {
|
||||||
return this.tasksInfo.map(v => {
|
return this.tasksInfo.map(v => {
|
||||||
@ -28489,7 +28531,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
"NPC菜单": function () {
|
"NPC菜单": function () {
|
||||||
// 在此增加新插件
|
// 在此增加新插件
|
||||||
|
|
||||||
const menu = {
|
class menu {
|
||||||
|
|
||||||
setcanvas(list, x, y) {
|
setcanvas(list, x, y) {
|
||||||
let textmax = ""
|
let textmax = ""
|
||||||
@ -28509,19 +28551,33 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
this.y = py
|
this.y = py
|
||||||
this.w = length + 32
|
this.w = length + 32
|
||||||
this.h = list.length * 32
|
this.h = list.length * 32
|
||||||
|
this.list = list
|
||||||
core.clearMap(this.canvas)
|
core.clearMap(this.canvas)
|
||||||
core.fillRect(this.canvas, 0, 0, this.w, this.h, "rgba(0,0,0,0.7)")
|
core.fillRect(this.canvas, 0, 0, this.w, this.h, "rgba(0,0,0,0.7)")
|
||||||
core.fillRect(this.canvas, 0, 0, this.w, 32, "rgba(0,0,0,0.7)")
|
core.fillRect(this.canvas, 0, 0, this.w, 32, "rgba(0,0,0,0.7)")
|
||||||
core.setTextAlign(this.canvas, "center")
|
core.setTextAlign(this.canvas, "center")
|
||||||
let dy = 0
|
let dy = 0
|
||||||
list.forEach(v => {
|
this.list.forEach(v => {
|
||||||
core.fillText(this.canvas, v, this.w / 2, 22 + dy, "#FFFFFF")
|
core.fillText(this.canvas, v, this.w / 2, 22 + dy, "#FFFFFF")
|
||||||
dy += 32
|
dy += 32
|
||||||
})
|
})
|
||||||
this.selection = 0
|
this.selection = 0
|
||||||
core.strokeRoundRect(this.canvas, 2, 34 + this.selection * 32, this.w - 4, 28, 4, "#FFFF00", 2)
|
core.strokeRoundRect(this.canvas, 2, 34 + this.selection * 32, this.w - 4, 28, 4, "#FFFF00", 2)
|
||||||
}
|
}
|
||||||
|
update() {
|
||||||
|
core.clearMap(this.canvas)
|
||||||
|
core.fillRect(this.canvas, 0, 0, this.w, this.h, "rgba(0,0,0,0.7)")
|
||||||
|
core.fillRect(this.canvas, 0, 0, this.w, 32, "rgba(0,0,0,0.7)")
|
||||||
|
core.setTextAlign(this.canvas, "center")
|
||||||
|
let dy = 0
|
||||||
|
this.list.forEach(v => {
|
||||||
|
core.fillText(this.canvas, v, this.w / 2, 22 + dy, "#FFFFFF")
|
||||||
|
dy += 32
|
||||||
|
})
|
||||||
|
core.strokeRoundRect(this.canvas, 2, 34 + this.selection * 32, this.w - 4, 28, 4, "#FFFF00", 2)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
core.menu = new menu()
|
||||||
|
|
||||||
function action_menu(data, x, y, prefix) {
|
function action_menu(data, x, y, prefix) {
|
||||||
data.choices = data.choices.filter(function (x) {
|
data.choices = data.choices.filter(function (x) {
|
||||||
@ -28534,6 +28590,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (data.choices.length == 0) return core.doAction()
|
if (data.choices.length == 0) return core.doAction()
|
||||||
|
let list = []
|
||||||
|
list.push(core.replaceText(data.text, prefix))
|
||||||
|
for (var i = 0; i < data.choices.length; i++) {
|
||||||
|
if (typeof data.choices[i] === "string")
|
||||||
|
data.choices[i] = { text: data.choices[i] };
|
||||||
|
data.choices[i].text = core.replaceText(data.choices[i].text, prefix);
|
||||||
|
list.push(data.choices[i].text)
|
||||||
|
}
|
||||||
|
core.menu.setcanvas(list, x, y)
|
||||||
if (core.isReplaying()) {
|
if (core.isReplaying()) {
|
||||||
var action = core.status.replay.toReplay.shift();
|
var action = core.status.replay.toReplay.shift();
|
||||||
if (
|
if (
|
||||||
@ -28573,27 +28638,22 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let list = []
|
|
||||||
list.push(core.replaceText(data.text, prefix))
|
|
||||||
for (var i = 0; i < data.choices.length; i++) {
|
|
||||||
if (typeof data.choices[i] === "string")
|
|
||||||
data.choices[i] = { text: data.choices[i] };
|
|
||||||
data.choices[i].text = core.replaceText(data.choices[i].text, prefix);
|
|
||||||
list.push(data.choices[i].text)
|
|
||||||
}
|
|
||||||
menu.setcanvas(list, x, y)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function menu_replaying(data, index) {
|
function menu_replaying(data, index) {
|
||||||
var selection = index;
|
var selection = index;
|
||||||
|
|
||||||
if (index != "none") {
|
if (index != "none") {
|
||||||
selection = parseInt(index);
|
selection = parseInt(index);
|
||||||
if (Number.isNaN(selection)) return false;
|
if (Number.isNaN(selection)) return false;
|
||||||
if (selection < 0) selection += data.choices.length;
|
if (selection < 0) selection += data.choices.length;
|
||||||
if (selection < 0) return false;
|
if (selection < 0) return false;
|
||||||
if (selection % 100 > data.choices.length) return false;
|
if (selection % 100 > data.choices.length) return false;
|
||||||
|
core.menu.selection = index
|
||||||
}
|
}
|
||||||
core.status.event.selection = selection;
|
core.status.event.selection = selection;
|
||||||
|
|
||||||
setTimeout(
|
setTimeout(
|
||||||
function () {
|
function () {
|
||||||
core.status.route.push("choices:" + index);
|
core.status.route.push("choices:" + index);
|
||||||
@ -28611,7 +28671,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
} else {
|
} else {
|
||||||
core.insertAction(choice.action);
|
core.insertAction(choice.action);
|
||||||
}
|
}
|
||||||
} else core.clearMap(menu.canvas)
|
}
|
||||||
|
core.clearMap(core.menu.canvas)
|
||||||
core.doAction();
|
core.doAction();
|
||||||
},
|
},
|
||||||
core.status.replay.speed == 24 ?
|
core.status.replay.speed == 24 ?
|
||||||
@ -28619,7 +28680,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
750 / Math.max(1, core.status.replay.speed)
|
750 / Math.max(1, core.status.replay.speed)
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
|
core.registerEvent("menu", function (data, x, y, prefix) {
|
||||||
|
|
||||||
|
action_menu(data, x, y, prefix)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
"任务栏": function () {
|
"任务栏": function () {
|
||||||
// 在此增加新插件
|
// 在此增加新插件
|
||||||
|
@ -11,6 +11,12 @@ var task_comment = {
|
|||||||
"_event": "taskEvent",
|
"_event": "taskEvent",
|
||||||
"_data": "开局就有"
|
"_data": "开局就有"
|
||||||
},
|
},
|
||||||
|
"task1": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "event",
|
||||||
|
"_event": "taskEvent",
|
||||||
|
"_data": "新"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if (obj[key]) return obj[key];
|
if (obj[key]) return obj[key];
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user