自绘标题界面居中插件

This commit is contained in:
ckcz123 committed 2021-07-19 16:36:32 +08:00
1 parent ea9d47df63
commit bc7df1fe9b
4 files changed
+382 -66

No files matched your search

+285 -61
View File
@@ -146,86 +146,258 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"text": "也可以直接切换到其他楼层(比如某个开始剧情楼层)进行操作。"
},
{
"type": "showImage",
"code": 1,
"image": "bg.jpg",
"loc": [
0,
0
],
"opacity": 1,
"time": 0
"type": "previewUI",
"action": [
{
"type": "fillRect",
"x": 0,
"y": 0,
"width": "core.__PIXELS__",
"height": "core.__PIXELS__",
"style": [
82,
82,
82,
1
]
},
{
"type": "setAttribute",
"align": "center"
},
{
"type": "fillBoldText",
"x": "core.__PIXELS__ / 2",
"y": 80,
"style": [
255,
255,
255,
1
],
"strokeStyle": [
0,
0,
0,
1
],
"font": "bold 40px Verdana",
"text": "${core.firstData.title}"
}
]
},
{
"type": "setValue",
"name": "flag:selection",
"value": "0"
},
{
"type": "comment",
"text": "在右下方自绘一个对话框进行显示选择项"
},
{
"type": "previewUI",
"action": [
{
"type": "fillRect",
"x": 230,
"y": 250,
"width": 150,
"height": 142,
"radius": 10,
"style": [
50,
54,
159,
0.85
]
},
{
"type": "strokeRect",
"x": 230,
"y": 250,
"width": 150,
"height": 142,
"radius": 10,
"style": [
255,
255,
255,
1
],
"lineWidth": 2
},
{
"type": "fillBoldText",
"x": 305,
"y": 290,
"style": [
255,
255,
255,
1
],
"font": "bold 25px Verdana",
"text": "开始游戏"
},
{
"type": "fillBoldText",
"x": 305,
"y": 330,
"font": "bold 25px Verdana",
"text": "读取存档"
},
{
"type": "fillBoldText",
"x": 305,
"y": 370,
"font": "bold 25px Verdana",
"text": "回放录像"
}
]
},
{
"type": "while",
"condition": "1",
"data": [
{
"type": "comment",
"text": "给用户提供选择项,这里简单的使用了choices事件"
"type": "drawSelector",
"image": "winskin.png",
"code": 1,
"x": 245,
"y": "261 + 40*flag:selection",
"width": 120,
"height": 40
},
{
"type": "comment",
"text": "也可以贴按钮图然后使用等待操作来完成"
},
{
"type": "choices",
"choices": [
"type": "wait",
"data": [
{
"text": "开始游戏",
"case": "keyboard",
"keycode": "13,32",
"break": true,
"action": [
{
"type": "comment",
"text": "检查bgm状态,下同"
},
{
"type": "function",
"function": "function(){\ncore.control.checkBgm()\n}"
},
{
"type": "if",
"condition": "main.levelChoose.length == 0",
"true": [
"type": "switch",
"condition": "flag:selection",
"caseList": [
{
"type": "comment",
"text": "直接开始游戏"
}
],
"false": [
{
"type": "comment",
"text": "动态生成难度选择项"
"case": "0",
"action": [
{
"type": "comment",
"text": "在“开始游戏”确定"
},
{
"type": "break",
"n": 1
}
]
},
{
"type": "function",
"function": "function(){\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\n\t\t\"text\": one.title || '',\n\t\t\"action\": [\n\t\t\t{ \"type\": \"function\", \"function\": \"function() { core.status.hard = '\" + (one.name || '') + \"'; }\" }\n\t\t]\n\t});\n})\ncore.insertAction({ \"type\": \"choices\", \"choices\": choices });\n}"
"case": "1",
"action": [
{
"type": "comment",
"text": "在“读取存档”确定"
},
{
"type": "callLoad"
}
]
},
{
"case": "2",
"action": [
{
"type": "comment",
"text": "在“回放录像”确定"
},
{
"type": "if",
"condition": "(!core.isReplaying())",
"true": [
{
"type": "function",
"function": "function(){\ncore.chooseReplayFile()\n}"
}
]
}
]
}
]
},
{
"type": "hideImage",
"code": 1,
"time": 0
},
{
"type": "comment",
"text": "成功选择难度"
},
{
"type": "break"
}
]
},
{
"text": "读取存档",
"case": "keyboard",
"keycode": "38",
"break": true,
"action": [
{
"type": "function",
"function": "function(){\ncore.control.checkBgm()\n}"
"type": "comment",
"text": "光标上键"
},
{
"type": "setValue",
"name": "flag:selection",
"value": "(flag:selection + 2) % 3"
}
]
},
{
"case": "keyboard",
"keycode": "40",
"break": true,
"action": [
{
"type": "comment",
"text": "简单的使用“呼出读档界面”来处理"
"text": "光标下键"
},
{
"type": "setValue",
"name": "flag:selection",
"value": "(flag:selection + 1) % 3"
}
]
},
{
"case": "mouse",
"px": [
245,
365
],
"py": [
261,
300
],
"break": true,
"action": [
{
"type": "comment",
"text": "点击“开始游戏”"
},
{
"type": "break",
"n": 1
}
]
},
{
"case": "mouse",
"px": [
245,
365
],
"py": [
301,
340
],
"break": true,
"action": [
{
"type": "comment",
"text": "点击“读取存档”"
},
{
"type": "callLoad"
@@ -233,15 +405,20 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
]
},
{
"text": "回放录像",
"case": "mouse",
"px": [
245,
365
],
"py": [
341,
380
],
"break": true,
"action": [
{
"type": "function",
"function": "function(){\ncore.control.checkBgm()\n}"
},
{
"type": "comment",
"text": "这段代码会弹框选择录像文件"
"text": "点击“播放录像”"
},
{
"type": "if",
@@ -259,9 +436,56 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
}
]
},
{
"type": "setValue",
"name": "flag:selection",
"value": "null"
},
{
"type": "drawSelector",
"code": 1
},
{
"type": "clearMap"
},
{
"type": "function",
"function": "function(){\ncore.control.checkBgm()\n}"
},
{
"type": "if",
"condition": "(main.levelChoose.length == 0)",
"true": [
{
"type": "comment",
"text": "没有难度选择:直接开始游戏"
}
],
"false": [
{
"type": "comment",
"text": "难度选择:作为样例,这里只提供了一个显示选择项。"
},
{
"type": "function",
"function": "function(){\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\n\t\t\"text\": one.title || '',\n\t\t\"action\": [\n\t\t\t{ \"type\": \"function\", \"function\": \"function() { core.status.hard = '\" + (one.name || '') + \"'; }\" }\n\t\t]\n\t});\n})\ncore.insertAction({ \"type\": \"choices\", \"choices\": choices });\n}"
},
{
"type": "comment",
"text": "你也可以仿照上面的样例进行自己创建等待用户操作来处理不同的难度分歧。\n如需自己处理,请设置 core.status.hard \n(例如,自定义js脚本:core.status.hard = 'Easy' )"
}
]
},
{
"type": "clearMap"
},
{
"type": "comment",
"text": "接下来会执行startText中的事件"
},
{
"type": "comment",
"text": "状态栏默认处于隐藏状态;可以使用“显示状态栏”事件进行显示。"
}
],
"startText": [