Merge remote-tracking branch 'refs/remotes/ckcz123/v2.0' into v2.x

This commit is contained in:
YouWei Zhao 2018-07-09 18:40:16 +08:00
commit 5b81962869
23 changed files with 1332 additions and 48 deletions

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
.vscode
*ce5eec52_2fa1_447b_8dad_764e267a7fab*
**/.DS_Store
.DS_Store
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

View File

@ -927,15 +927,16 @@ return code;
*/;
setVolume_s
: '设置音量' Int Newline
: '设置音量' Int '渐变时间' Int? Newline
/* setVolume_s
tooltip : setVolume: 设置音量
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=setvolume%EF%BC%9A%E8%AE%BE%E7%BD%AE%E9%9F%B3%E9%87%8F
default : [90]
default : [90, 500]
colour : this.soundColor
var code = '{"type": "setVolume", "value": '+Int_0+'},\n';
Int_1 = Int_1?(', "time": '+Int_1):""
var code = '{"type": "setVolume", "value": '+Int_0+Int_1+'},\n';
return code;
*/;
@ -1641,7 +1642,7 @@ ActionParser.prototype.parseAction = function() {
break
case "setVolume":
this.next = MotaActionBlocks['setVolume_s'].xmlText([
data.value, this.next]);
data.value, data.time, this.next]);
break
case "setValue":
this.next = MotaActionBlocks['setValue_s'].xmlText([

View File

@ -0,0 +1,402 @@
html{
font-size: 4vw;
}
input, textarea, select, button {
font-size: 1rem;
}
html, body, div, img {
margin: 0;
padding: 0;
}
body {
font-family: Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;;
background-color: #F5F5F5;
}
/* ::-webkit-scrollbar {
width: 5px;
} */
.main {
max-width: 100%;
min-height: 500px;
margin: 0 auto;
}
#left, #mid, #right {
/* border-radius: 2px;
box-sizing: border-box;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12); */
background-color: #F5F5F5;
width: 100vw;
height: 100vw;
}
#left {
position: absolute;
}
#editArea {
position: absolute;
width: 100%;
height: 70%;
left: 0;
top: 0;
/* padding: 10px 5px; */
box-sizing: border-box;
}
#pout {
display: block;
width: 95vw;
height: 62vw;
box-sizing: border-box;
margin-left: 5vw;
margin-top: 23px;
line-height: 5vw;
font-size: 12px;
font-family: 'Lucida Console', Monaco, monospace;
white-space: pre;
border: 1px solid #ddd;
border-radius: 2px;
overflow: auto;
}
#editArea p {
margin: 10px;
display: block;
width: 70%;
line-height: 20px;
text-align: left;
font-size: 14px;
}
#editTip .btn {
float: right;
margin-right: 20px;
margin-top: 5px;
}
#mid {
position: absolute;
}
.map {
position: absolute;
left: 4vw;
top: 4vw;
width: 96vw;
height: 96vw;
}
.map canvas{
width: 96vw;
height: 96vw;
}
#mid .tools {
position: absolute;
width: 425px;
height: 180px;
left: 0;
bottom: 0;
border-top: 1px solid #ccc;
padding: 10px 5px;
margin-left: 8px;;
box-sizing: border-box;
}
#tip {
float: right;
width: 50%;
/* height: 95%; */
min-height: 9rem;
padding: 5px 10px 10px 10px;
margin-right: 0;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 2px;
font-size: 1rem;
line-height: 0.93rem;
}
#tip p{
margin: 0.5rem
}
.files {
width: 50%;
height: 120px;
/* padding: 10px; */
margin-top: 15px;
}
.input {
display: block;
max-width: 150px;
height: 20px;
padding: 6px 12px;
font-size: 14px;
margin-top: 10px;
color: #555;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 3px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
}
#bgSelect {
width: 50%;
height: 100px;
margin-top: 10px;
}
#bgSelect span {
/* display: block; */
font-size: 14px;
line-height: 30px;
}
#printOut {
margin-top: 10px;
height: 20px;
}
.btn {
width: 80px;
border-radius: 2px;
line-height: 30px;
margin: 0;
min-width: 50px;
padding: 0 5px;
display: inline-block;
margin-top: 5px;
font-size: 14px;
font-weight: 400;
/* text-transform: uppercase; */
letter-spacing: 0;
overflow: hidden;
cursor: pointer;
text-decoration: none;
text-align: center;
vertical-align: middle;
border: 0;
background: rgba(158, 158, 158, .2);
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .14), 0 2px 1px -1px rgba(0, 0, 0, .2), 0 1px 3px 0 rgba(0, 0, 0, .12);
color: #fff;
background-color: #26A69A;
}
.btn:hover {
background-color: #009688;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
}
#right {
position: absolute;
/* border: 1px solid rgb(238, 13, 13); */
}
#iconLib {
position: absolute;
width: 100vw;
height: 100vw;
top: 5px;
overflow: auto;
}
.egameCanvas {
position: absolute;
}
.gameCanvas {
position: absolute;
}
#dataSelection, .appendSelection {
position: absolute;
/* top:0;
left:320px; */
z-index: 75;
width: 26px;
height: 26px;
margin: 3px 0 0 3px;
padding: 0;
/* display: none; */
box-sizing: border-box;
background-color: rgba(255, 255, 255, 0.0);
border: 1px solid #000;
box-shadow: 0 0 0 2px #fff,
0 0 0 3px #000;
}
.warnText {
color: #D50000;
font-weight: 700;
font-size: 14px;
line-height: 1.2em;
}
.infoText {
color: #2196F3;
}
.successText {
color: #00897B;
line-height: 1.2em;
}
td {
border: 0.230vw solid #fff;
color: #fff;
cursor: crosshair;
}
table.col {
position: relative;
text-align: center;
border-collapse: collapse;
}
table.col td {
background-color: #4DB6AC;
}
#arrColMark td {
width: 16px;
}
#arrColMark {
top: 2px;
left: 5vw;
width: 95vw;
height: 16px;
font-size: 13px;
}
#mapColMark {
top: 0;
left: 4vw;
width: 96vw;
height: 4vw;
font-size: 3vw;
}
#mapColMark td {
width: 7.15vw;
padding: 0;
border-bottom-width: 0px;
border-top-width: 0px;
}
#mapColMark td:hover .colBlock {
position: absolute;
top: 4vw;
height: 96vw;
width: 7.15vw;
z-index: 100;
background-color: rgba(38, 166, 154, .5);
}
table.row {
position: relative;
text-align: right;
vertical-align: middle;
border-collapse: collapse;
}
table.row td {
background-color: #4C221B;
}
#arrRowMark {
top: 5px;
left: 0;
width: 4vw;
height: 62vw;
font-size: 12px;
}
#mapRowMark {
top: 0;
left: 0;
width: 4vw;
height: 96vw;
font-size: 3vw;
}
#mapRowMark td {
height: 7.15vw;
padding: 0;
border-left-width: 0px;
border-right-width: 0px;
}
#mapRowMark td:hover .rowBlock {
position: absolute;
left: 4vw;
height: 7.15vw;
width: 96vw;
z-index: 100;
background-color: rgba(76, 34, 27, .5);
}
#menuDiv * { margin: 0; padding: 0; }
#midMenu{
background: #fff;
border-color: #ccc #666 #666 #ccc;
border-style: solid;
border-width: 1px;
cursor: default;
font: normal 2.5vw Arial, sans-serif;
margin: 0;
outline: none;
padding: 4px 0;
overflow-y: auto;
overflow-x: hidden;
max-height: 100%;
max-width: 40%;
z-index: 101;
border-radius: 4px;
}
#midMenu .menuitem{
color: #000;
font: normal 2.5vw Arial, sans-serif;
list-style: none;
margin: 0;
padding: 4px 7em 4px 28px;
white-space: nowrap;
/* padding-left: 12px; */
/* padding-right: 20px; */
}
#midMenu .menuitem:hover{
background-color: #d6e9f8;
border-color: #d6e9f8;
border-style: dotted;
border-width: 1px 0;
padding-bottom: 3px;
padding-top: 3px;
}
#midMenu .menuitem-content{
color: #000;
font: normal 2.5vw Arial, sans-serif;
}
/* for vue dom */
[v-cloak] {
display: none !important;
}
#down{
position: absolute;
left:0;
top:100vw;
bottom: 0;
width: 100vw;
}

View File

@ -0,0 +1,242 @@
.leftTab {
/* border-radius: 2px;
box-sizing: border-box;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12); */
background-color: #F5F5F5;
width: 100vw;
height: 100vw;
}
.leftTab {
overflow: auto;
position: absolute;
height: 100vw;
}
.leftTab > * {
margin: 2.5px 5px;
}
.leftTab > :first-child {
margin-top: 5px;
}
.leftTab > :last-child {
margin-bottom: 5px;
}
.leftTab {
left: 0;
top: 0;
width: 100vw;
}
.leftTab .leftTabHeader {
position: fixed;
top: 15px;
left: 15px;
}
.leftTab .leftTabContent {
padding-top: 50px;
}
#appendPicSelection span {
position: absolute;
font-size: 11px;
-webkit-text-stroke: 1px red;
text-shadow: black 1px 0, black 0 1px, black -1px 0, black 0 -1px;
}
#left6 {
left: 0;
top: 0;
z-index: 200;
position: fixed;
background-color: rgb(245, 245, 245);
width: 100%;
height: 100%;
overflow: hidden;
}
#left6 h3{
font-size: 6vw;
margin: 1.77vw 0;
}
#left6 #blocklyArea {
width: 100vw;
height: 100vw;
}
#left6 #blocklyDiv {
position: relative;
}
#left6 .CodeMirror {
border: 1px solid #eee;
height: 38vw;
width: 100%;
}
#left6 #codeArea {
width: 99.5%;
height: 15.4em;
overflow: y; /* resize:none; */
}
#left6 #blocklyDiv .blocklyToolboxDiv{
width:6vw;
}
#left6 #blocklyDiv .blocklyTreeLabel{
margin-left:-4vw;
}
#left7 {
/* height: 440px; width: 375px;float:left; */
left: 0;
top: 0;
z-index: 200;
position: fixed;
background-color: rgb(245, 245, 245);
width: 100%;
height: 100%;
}
#left7 .CodeMirror {
/* border-top: 1px solid black;
border-bottom: 1px solid black; */
border: 1px solid #eee;
font-size: 14px;
height: 95%;
width: 95%;
}
.etable table,
.etable table td {
color: #000;
cursor: auto;
}
/* copy from github-css https://github.com/sindresorhus/github-markdown-css */
.etable table {
border-spacing: 0;
border-collapse: collapse;
}
.etable table {
margin-top: 0;
margin-bottom: 16px;
}
.etable table {
display: block;
width: 100%;
overflow: auto;
}
.etable table th {
font-weight: 600;
}
.etable table th,
.etable table td {
padding: 6px 13px;
border: 1px solid #dfe2e5;
}
.etable table tr {
background-color: #fff;
border-top: 1px solid #c6cbd1;
}
.etable table tr:nth-child(2n) {
background-color: #f6f8fa;
}
/* copy end --------------------------------------------- */
.etable tr {
width: 100%
}
.etable tr > :nth-child(1) {
width: 20%
}
.etable tr > :nth-child(2) {
width: 20%
}
.etable tr > :nth-child(3) {
width: 60%
}
.etable table {
overflow: visible;
}
.etable tr:not(:first-child) > :last-child:hover {
border: 1px solid rgb(87, 198, 232);
box-shadow: 0px 0px 3px rgb(87, 198, 232);
}
.etable tr:not(:first-child) > :nth-child(2):hover,
.etable tr:not(:first-child) > :nth-child(1):hover {
border: 1px solid rgb(87, 232, 198);
box-shadow: 0px 0px 3px rgb(87, 232, 198);
}
.etable tr:not(:first-child) > :last-child {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
position: relative;
}
div.etableInputDiv {
position: absolute;
padding: 5px 0 0 5px;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.etableInputDiv > * {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
background-color: rgba(255, 255, 255, 0);
border: none;
}
.etableInputDiv input[type="text"] {
}
.etableInputDiv input[type="checkbox"] {
width: 16px;
height: 16px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -8px;
margin-top: -8px;
}
.etableInputDiv select {
}
.etableInputDiv textarea {
resize: none;
}
.etableInputDiv textarea:hover {
margin: -5px;
}

View File

@ -402,7 +402,7 @@ editor.prototype.listen = function () {
editor.loc = {
'x': scrollLeft + e.clientX - mid.offsetLeft - mapEdit.offsetLeft,
'y': scrollTop + e.clientY - mid.offsetTop - mapEdit.offsetTop,
'size': 32
'size': editor.isMobile?(32*innerWidth*0.96/416):32
};
return editor.loc;
}//返回可用的组件内坐标
@ -444,8 +444,10 @@ editor.prototype.listen = function () {
editor_mode.onmode('loc');
//editor_mode.loc();
//tip.whichShow = 1;
if(editor.isMobile)editor.showMidMenu(e.clientX,e.clientY);
return;
}
holdingPath = 1;
mouseOutCheck = 2;
@ -674,23 +676,32 @@ editor.prototype.listen = function () {
var locStr='('+editor.lastRightButtonPos[1].x+','+editor.lastRightButtonPos[1].y+')';
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
chooseThis.children[0].innerHTML='选中此点'+'('+editor.pos.x+','+editor.pos.y+')'
copyLoc.children[0].innerHTML='复制事件'+locStr+'到此处';
moveLoc.children[0].innerHTML='交换事件'+locStr+'与此事件的位置';
midMenu.style='top:'+(y+scrollTop)+'px;left:'+(x+scrollLeft)+'px;';
}
editor.hideMidMenu=function(){midMenu.style='display:none';}
editor.hideMidMenu=function(){
if(editor.isMobile){
setTimeout(function(){
midMenu.style='display:none';
},200)
} else {
midMenu.style='display:none';
}
}
var chooseThis = document.getElementById('chooseThis');
chooseThis.onmousedown = function(e){
editor.hideMidMenu();
e.stopPropagation();
selectBox.isSelected = false;
var loc = eToLoc(e);
var pos = locToPos(loc);
editor_mode.onmode('nextChange');
editor_mode.onmode('loc');
//editor_mode.loc();
//tip.whichShow = 1;
if(editor.isMobile)editor.showdataarea(false);
}
var chooseInRight = document.getElementById('chooseInRight');

View File

@ -5,9 +5,13 @@ editor_blockly = function () {
initscript = String.raw`
(function(){
var getCategory = function(name){
for(var node of document.getElementById('toolbox').children) {
if(node.getAttribute('name')==name) return node;
}
for(var node of document.getElementById('toolbox').children) {
if(node.getAttribute('name')==name) return node;
}
var node = document.createElement('category');
node.setAttribute('name',name);
document.getElementById('toolbox').appendChild(node);
return node;
}
var toolboxObj = {
@ -244,10 +248,11 @@ var workspace = Blockly.inject(blocklyDiv,{
var onresize = function(e) {
blocklyDiv.style.width = blocklyArea.offsetWidth + 'px';
blocklyDiv.style.height = blocklyArea.offsetHeight + 'px';
Blockly.svgResize(workspace);
};
window.addEventListener('resize', onresize, false);
if(typeof editor !== "undefined" && !editor.isMobile)window.addEventListener('resize', onresize, false);
onresize();
Blockly.svgResize(workspace);
//Blockly.svgResize(workspace);
//Blockly.bindEventWithChecks_(workspace.svgGroup_,"wheel",workspace,function(e){});
document.getElementById('blocklyDiv').onmousewheel = function(e){

View File

@ -121,8 +121,10 @@ editor_mode = function (editor) {
input.ondblclick = function () {
if (cobj._type === 'event') editor_blockly.import(guid, {type: cobj._event});
if (cobj._type === 'textarea') editor_multi.import(guid, {lint: cobj._lint, string: cobj._string});
}
// thisTr.onclick = function(){
// editor.lastClickId=guid;
// }
});
}
return {"HTML": outstr.join(''), "guids": guids, "listen": listen};
@ -630,6 +632,7 @@ editor_mode = function (editor) {
editModeSelect.onchange = function () {
editor_mode.onmode('nextChange');
editor_mode.onmode(editModeSelect.value);
if(editor.isMobile)editor.showdataarea(false);
}
if (Boolean(callback)) callback();

View File

@ -1,19 +1,31 @@
// vue 相关处理
document.body.onmousedown = function (e) {
//console.log(e);
var eid = [];
e.path.forEach(function (node) {
var clickpath = [];
var getpath=function(e) {
var path = [];
var currentElem = e.target;
while (currentElem) {
path.push(currentElem);
currentElem = currentElem.parentElement;
}
if (path.indexOf(window) === -1 && path.indexOf(document) === -1)
path.push(document);
if (path.indexOf(window) === -1)
path.push(window);
return path;
}
getpath(e).forEach(function (node) {
if (!node.getAttribute) return;
var id_ = node.getAttribute('id');
if (id_) {
if (['left', 'left1', 'left2', 'left3', 'left4', 'left5', 'left8'].indexOf(id_) !== -1) eid.push('edit');
eid.push(id_);
if (['left', 'left1', 'left2', 'left3', 'left4', 'left5', 'left8', 'mobileview'].indexOf(id_) !== -1) clickpath.push('edit');
clickpath.push(id_);
}
});
//console.log(eid);
if (eid.indexOf('edit') === -1) {
if (eid.indexOf('tip') === -1) {
if (clickpath.indexOf('edit') === -1 && clickpath.indexOf('tip') === -1) {
if (clickpath.indexOf('eui') === -1) {
if (selectBox.isSelected) {
editor_mode.onmode('');
editor.file.saveFloorFile(function (err) {
@ -25,13 +37,17 @@ document.body.onmousedown = function (e) {
});
}
selectBox.isSelected = false;
editor.info = {};
}
}
//editor.mode.onmode('');
editor.info = {};
if (e.button!=2){
if (e.button!=2 && !editor.isMobile){
editor.hideMidMenu();
}
if (clickpath.indexOf('down') !== -1 && editor.isMobile && clickpath.indexOf('midMenu') === -1){
editor.hideMidMenu();
}
if(clickpath.length>=2 && clickpath[0].indexOf('id_')===0){editor.lastClickId=clickpath[0]}
}
iconLib.onmousedown = function (e) {
e.stopPropagation();

View File

@ -193,6 +193,8 @@ floorId指定的是目标楼层的唯一标识符ID
导出动画时可能会进行一些压缩以节省流量,因此清晰度可能不如原版。
从2.3.2开始,动画可以同时导出所用的音效。**如果导出音效,请确保将所用到的音效复制到了`sounds`目录下,并且在全塔属性中注册过。**
动画播放时是按照每秒20帧的速度即50ms/帧)。
定义完毕后,我们可以调用`animate`事件来播放该动画,有关事件的详细介绍请参见[事件](event)。

View File

@ -939,10 +939,12 @@ time选项为该跳跃所需要用到的时间。
使用setVolume可以设置音量大小。
使用方法: `{"type": "setVolume", "value": 90}`
使用方法: `{"type": "setVolume", "value": 90, "time": 500}`
value为音量大小在0到100之间默认为100。设置后BGM和SE都将使用该音量进行播放。
可以设置time为音量渐变时间。
### win获得胜利
`{"type": "win", "reason": "xxx"}` 将会直接调用events.js中的win函数并将reason作为结局传入。

567
editor-mobile.html Normal file
View File

@ -0,0 +1,567 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1,initial-scale=1,user-scalable=no" />
<link href="_server/css/editor_mobile.css" rel="stylesheet">
<link href="_server/CodeMirror/codemirror.css" rel="stylesheet">
<link href="_server/css/editor_mode_mobile.css" rel="stylesheet">
</head>
<body>
<script>
if(innerWidth>innerHeight){ //pic:1242*2208 | chrome info:1340*2380
confirm('宽大于高的设备请使用正常版本的editor, 点击确定跳转')?(window.location='./editor.html'):'';
}
</script>
<div class="main">
<div id="left" style="z-index:-1;opacity: 0;"><!-- map -->
<div id="arrEditor">
<table class="col" id='arrColMark'></table>
<table class="row" id='arrRowMark'></table>
<div id="editArea" v-cloak>
<textarea cols="10" rows="10" id="pout" v-model="mapArr"></textarea>
<p class="warnText" v-if="error">{{ errors[error-1] }}</p>
</div>
<div id="editTip" style="position: absolute; width: 95vw;margin-bottom: 10%;bottom: 0;left: 4vw;">
<input type="button" value="新建空白地图" id='newMap'/>
<input id='newFileName' placeholder="输入新楼层id" style="width: 120px"/>
<input type="checkbox" id='newMapStatus' checked='checked' style='vertical-align: bottom'/>
<span style='vertical-align: bottom; margin-left: -4px'>保留楼层属性</span>
</div>
<div style="position: absolute;left: 10px;bottom:0; margin-bottom: 0%">
<input type="button" value="导出地图" id="exportMap" v-on:click="exportMap"/>
<input type="button" value="复制地图" id="copyMap" v-on:click="copyMap"/>
<input type="button" value="清除地图" id='clearMap' v-on:click="clearMap"/>
<input type="button" value="删除地图" id="deleteMap" v-on:click="deleteMap"/>
</div>
</div>
<div id="objDataEditor">
</div>
<div id="eventEditor">
</div>
</div>
<div id="left1" class='leftTab' style="z-index:-1;opacity: 0;"><!-- appendpic -->
<h3 class="leftTabHeader">追加素材</h3>
<div class="leftTabContent">
<p>
<input id="selectFileBtn" type="button" value="导入文件到画板"/>
<select id="selectAppend"></select>
<!-- ["terrains", "animates", "enemys", "enemy48", "items", "npcs", "npc48"] -->
<input id="appendConfirm" type="button" value="追加"/>
</p>
<div id="appendPicCanvas" style="position:relative;overflow: auto;height:470px;">
<canvas style="position:absolute"></canvas><!-- 用于画出灰白相间背景 -->
<canvas style="position:absolute"></canvas><!-- 用于画出选中文件 -->
<canvas style="position:absolute;z-index:100"></canvas><!-- 用于响应鼠标点击 -->
<canvas style="position:absolute;display:none;"></canvas><!-- 画出追加后的sprite用于储存 -->
<div id="appendPicSelection">
<div class="appendSelection"><span style="top: 0; left: 2px;">1</span></div>
<div class="appendSelection"><span style="top: 0; left: 14px;">2</span></div>
<div class="appendSelection"><span style="top: 12px; left: 2px;">3</span></div>
<div class="appendSelection"><span style="top: 12px; left: 14px;">4</span></div>
</div>
</div>
</div>
</div>
<div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><!-- loc -->
<h3 class="leftTabHeader">地图选点&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>
</h3>
<div class="leftTabContent">
<p id='pos_a6771a78_a099_417c_828f_0a24851ebfce' style="margin-left: 15px">0,0</p>
<div class='etable'>
<table>
<tbody id='table_3d846fc4_7644_44d1_aa04_433d266a73df'>
<tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- emenyitem -->
<h3 class="leftTabHeader">图块属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>
</h3>
<div class="leftTabContent">
<div id='newIdIdnum'><!-- id and idnum -->
<input placeholder="新id唯一标识符"/>
<input placeholder="新idnum1000以内数字"/>
<button>save</button>
<br/>
<button style="margin-top: 10px">自动注册</button>
</div>
<div id="enemyItemTable"><!-- enemy and item -->
<div class='etable'>
<table>
<tbody id='table_a3f03d4c_55b8_4ef6_b362_b345783acd72'>
<tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor -->
<h3 class="leftTabHeader">楼层属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>
</h3>
<div class="leftTabContent">
<div class='etable'>
<table>
<tbody id='table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74'>
<tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower -->
<h3 class="leftTabHeader">全塔属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>
</h3>
<div class="leftTabContent">
<div class='etable'>
<table>
<tbody id='table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5'>
<tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="left6" class='leftTab' style="z-index:-1;opacity: 0;">
<div style="position: relative; height: 95%"><!-- eventsEditor -->
<h3>事件编辑器 &nbsp;&nbsp;
<!--
<button onclick="editor_blockly.showXML()">Show XML</button>
<button onclick="editor_blockly.runCode()">console.log(obj=code)</button>
-->
<select id="entryType" disabled="disabled" style="display: none">
<option value="event">event</option>
<option value="changeFloor">changeFloor</option>
<option value="point">point</option>
<option value="shop">shop</option>
<option value="afterBattle">afterBattle</option>
<option value="afterGetItem">afterGetItem</option>
<option value="afterOpenDoor">afterOpenDoor</option>
<option value="firstArrive">firstArrive</option>
</select>
<button onclick="editor_blockly.confirm()">确认</button>
<button onclick="editor_blockly.parse()">解析</button>
<button onclick="editor_blockly.cancel()">取消</button>
<xml id="toolbox" style="display:none">
</xml>
</h3>
<div style="position: relative;height: 100%">
<div id="blocklyArea">
<div id="blocklyDiv"></div>
</div>
<textarea id="codeArea" spellcheck="false"></textarea>
</div>
</div>
</div>
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
<button onclick="editor_multi.confirm()">确认</button>
<button onclick="editor_multi.cancel()">取消</button>
<input type="checkbox" onclick="editor_multi.toggerLint()" id="lintCheckbox"
style="vertical-align: bottom;margin-left:6px"/>
<span style="vertical-align: bottom; margin-left: -3px">语法检查</span>
<textarea id="multiLineCode" name="multiLineCode"></textarea>
</div>
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><!-- functions -->
<h3 class="leftTabHeader">脚本编辑&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">保存</button>
</h3>
<div class="leftTabContent">
<div class='etable'>
<table>
<tbody id='table_e260a2be_5690_476a_b04e_dacddede78b3'>
<tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="mid">
<table class="col" id='mapColMark'></table>
<table class="row" id='mapRowMark'></table>
<div class="map" id="mapEdit">
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='event2' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='efg' width='416' height='416'></canvas>
<canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
</div>
</div>
<div id="right" style="z-index:-1;opacity: 0;">
<div id="iconLib">
<canvas class='egameCanvas' id='edata' width='416' height='416' style='z-index:0'></canvas>
<div id="selectBox">
<div id='dataSelection' v-show="isSelected" v-cloak></div>
</div>
</div>
</div>
<div id="down">
<div style="margin:0.5rem">
<div class="tools">
<div id="tip" v-cloak>
<div v-if="isSelectedBlock">
<p v-if="isClearBlock" class="infoText">当前选择为清除块,可擦除地图上块</p>
<div v-else>
<p v-if="hasId">图块编号:<span class="infoText">{{ infos['idnum'] }}</span></p>
<p v-if="hasId">图块ID<span class="infoText">{{ infos['id'] }}</span></p>
<p v-else class="warnText">该图块无对应的数字或ID存在请先前往icons.js和maps.js中进行定义</p>
<p>图块所在素材:<span class="infoText">{{ infos['images'] + (isAutotile ? '( '+infos['id']+' )' : '') }}</span>
</p>
<p>图块索引:<span class="infoText">{{ infos['y'] }}</span></p>
</div>
</div>
<div v-else>
<p v-if="whichShow" v-bind:class="[ (whichShow%2) ? 'warnText' : 'successText']">{{ mapMsg }}</p>
</div>
</div>
<span id='mobileview'>
<input type="button" value="数据区"/>
<input type="button" value="地图区"/>
<input type="button" value="素材库"/>
</span>
<div id="menuDiv">
<div id="midMenu" style="display:none">
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
</div>
</div>
<select id="editModeSelect">
<option value="map">地图编辑</option>
<option value="loc">地图选点</option>
<option value="emenyitem">图块属性</option>
<option value="floor">楼层属性</option>
<option value="tower">全塔属性</option>
<option value="functions">脚本编辑</option>
<option value="appendpic">追加素材</option>
</select>
<br>
<select id="selectFloor"></select>
<input type="button" value="保存地图" id='saveFloor'/>
<span id='mobileeditdata' style="display:none">
<input type="button" value="编辑"/>
<input type="button" value="显示完整名称"/>
<input type="button" value="显示完整注释"/>
</span>
<input type="button" value="前往游戏" onclick="window.location='./index.html'"/>
<!-- -->
<div id="bgSelect" v-cloak style="display:none">
<span>当前地板: </span>
<select v-model="selectedBg">
<option disabled value="">请选择地板</option>
<option v-for="bg in bgs" v-bind:value="bg">
{{ bg }}
</option>
</select>
<div class="selectpng">
<input class='input' id='pin' v-model="imgname" placeholder="请输入自定义背景文件名"/>
<input class='btn' type="button" value="确定" v-on:click="updatebg"/>
</div>
</div>
<!-- -->
</div>
</div>
</div>
</div>
<!-- <script>/* -->
<div id='gameGroup' style='display:none'>
<p id='mainTips'>请稍后...</p>
<div id='startPanel'>
<div id='startTop'>
<div id='startTopProgressBar'>
<div id='startTopProgress'></div>
</div>
<p id='startTopLoadTips'>资源即将开始加载</p>
</div>
<img id='startBackground'>
<p id='startLogo'></p>
<div id='startButtonGroup'>
<div id='startButtons'>
<span class='startButton' id='playGame'>开始游戏</span>
<span class='startButton' id='loadGame'>载入游戏</span>
<span class='startButton' id='replayGame'>录像回放</span>
</div>
<div id='levelChooseButtons'></div>
</div>
</div>
<div id='floorMsgGroup'>
<p id='logoLabel'></p>
<p id='versionLabel'></p>
<p id='floorNameLabel'></p>
</div>
<div id='statusBar' class="clearfix">
<div class="status" id="floorCol">
<img id="img-floor">
<p class='statusLabel' id='floor'></p>
</div>
<div class="status" id="lvCol">
<img id="img-lv">
<p class='statusLabel' id='lv'></p>
</div>
<div class="status" id='hpmaxCol'>
<img id="img-hpmax">
<p class='statusLabel' id='hpmax'></p>
</div>
<div class="status">
<img id="img-hp">
<p class='statusLabel' id='hp'></p>
</div>
<div class="status">
<img id="img-atk">
<p class='statusLabel' id='atk'></p>
</div>
<div class="status">
<img id="img-def">
<p class='statusLabel' id='def'></p>
</div>
<div class="status" id="mdefCol">
<img id="img-mdef">
<p class='statusLabel' id='mdef'></p>
</div>
<div class="status" id="moneyCol">
<img id="img-money">
<p class='statusLabel' id='money'></p>
</div>
<div class="status" id="expCol">
<img id="img-experience">
<p class='statusLabel' id='experience'></p>
</div>
<div class="status" id="upCol">
<img id="img-up">
<p class='statusLabel' id='up'></p>
</div>
<div class="status">
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
</div>
<div class="status" id="debuffCol">
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
<span class='statusLabel' id='curse' style="color: #C2F4E7;"></span>
</div>
</div>
<div id="toolBar" class="clearfix">
<img class="tools" id='img-book'>
<img class="tools" id='img-fly'>
<img class="tools" id='img-toolbox'>
<img class="tools" id='img-shop'>
<img class="tools" id='img-save'>
<img class="tools" id='img-load'>
<img class="tools" id='img-settings'>
<p class="statusLabel tools" id="hard"></p>
</div>
<div id="gif"></div>
<div id="gif2"></div>
<div id="curtain"></div>
<!-- <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas> -->
<!-- <canvas class='gameCanvas' id='event' width='416' height='416'></canvas> -->
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
<!-- <canvas class='gameCanvas' id='event2' width='416' height='416'></canvas> -->
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='animate' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
</div>
<!-- */</script> -->
<script>
// 生成定位编号
(function () {
var colNum = ' ';
for (var i = 0; i < 13; i++) {
var tpl = '<td>' + (' '+i).slice(-2).replace(' ','&nbsp;') + '<div class="colBlock" style="left:' + (i * 96/13 ) + 'vmin;"></div></td>';
colNum += tpl;
}
arrColMark.innerHTML = '<tr>' + colNum + '</tr>';
mapColMark.innerHTML = '<tr>' + colNum + '</tr>';
var rowNum = ' ';
for (var i = 0; i < 13; i++) {
var tpl = '<tr><td>' + (' '+i).slice(-2).replace(' ','&nbsp;') + '<div class="rowBlock" style="top:' + (i * 96/13 ) + 'vmin;"></div></td></tr>';
rowNum += tpl;
}
arrRowMark.innerHTML = rowNum;
mapRowMark.innerHTML = rowNum;
})();
</script>
<!-- =========================================================== -->
<script>
if (location.protocol.indexOf("http")!=0) {
alert("请在启动服务中打开本编辑器!不然包括编辑在内的绝大多数功能都无法使用。");
}
</script>
<script src='_server/vendor/vue.min.js'></script>
<!-- <script src="https://cdn.bootcss.com/vue/2.5.13/vue.js"></script> -->
<script src='_server/vendor/polyfill.min.js'></script>
<script src='_server/fs.js'></script>
<script src='_server/editor_file.js'></script>
<script src='_server/editor_mode.js'></script>
<script src='_server/vm.js'></script>
<script src='libs/thirdparty/lz-string.min.js'></script>
<script id='mainScript' src='main.js'></script>
<script>
//所有全局量
__all__ = ['Vue', 'fs', 'editor_file', 'editor_mode', 'main', 'core', 'hasOwnProp', 'printf', 'printe', 'editor', 'converter', 'ActionParser', 'MotaActionFunctions', 'MotaActionBlocks'];
__id__ = ['editArea', 'arrRowMark', 'mapRowMark', 'data', 'bg', 'dataSelection', 'blocklyDiv', 'codeAreaHL', 'entryType'];
__Vue__ = ['editArea', 'exportMap', 'copyMap', 'clearMap', 'deleteMap', 'tip', 'selectBox'];
//var event = document.getElementById('event');
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwnProp(obj, key) {
return hasOwnProperty.call(obj, key)
}
</script>
<script src='_server/editor.js'></script>
<script>
editor.isMobile=true
var editor_mobile_listen=function(){
var mobileview=document.getElementById('mobileview');
var editModeSelect=document.getElementById('editModeSelect');
var mid=document.getElementById('mid');
var right=document.getElementById('right');
var mobileeditdata=document.getElementById('mobileeditdata');
editor.showdataarea=function(callShowMode){
mid.style='z-index:-1;opacity: 0;';
right.style='z-index:-1;opacity: 0;';
mobileeditdata.style='';
if(callShowMode)editor.mode.showMode(editModeSelect.value);
editor.hideMidMenu();
}
mobileview.children[0].onclick=function(){
editor.showdataarea(true)
}
mobileview.children[1].onclick=function(){
mid.style='';
right.style='z-index:-1;opacity: 0;';
mobileeditdata.style='z-index:-1;opacity: 0;';
editor.lastClickId='';
}
mobileview.children[2].onclick=function(){
mid.style='z-index:-1;opacity: 0;';
right.style='';
mobileeditdata.style='z-index:-1;opacity: 0;';
editor.lastClickId='';
}
var gettrbyid=function(){
if(!editor.lastClickId)return false;
thisTr = document.getElementById(editor.lastClickId);
input = thisTr.children[2].children[0].children[0];
field = thisTr.children[0].getAttribute('title');
cobj = JSON.parse(thisTr.children[1].getAttribute('cobj'));
return [thisTr,input,field,cobj];
}
mobileeditdata.children[0].onclick=function(){
var info = gettrbyid()
if(!info)return;
info[1].ondblclick()
}
mobileeditdata.children[1].onclick=function(){
var info = gettrbyid()
if(!info)return;
printf(info[2])
}
mobileeditdata.children[2].onclick=function(){
var info = gettrbyid()
if(!info)return;
printf(info[0].children[1].getAttribute('title'))
}
document.body.ontouchstart=document.body.onmousedown;
document.body.onmousedown=null;
//=====
var chooseThis = document.getElementById('chooseThis');
chooseThis.ontouchstart=chooseThis.onmousedown
chooseThis.onmousedown=null
var chooseInRight = document.getElementById('chooseInRight');
chooseInRight.ontouchstart=chooseInRight.onmousedown
chooseInRight.onmousedown=null
var copyLoc = document.getElementById('copyLoc');
copyLoc.ontouchstart=copyLoc.onmousedown
copyLoc.onmousedown=null
var moveLoc = document.getElementById('moveLoc');
moveLoc.ontouchstart=moveLoc.onmousedown
moveLoc.onmousedown=null
var clearLoc = document.getElementById('clearLoc');
clearLoc.ontouchstart=clearLoc.onmousedown
clearLoc.onmousedown=null
}
var useCompress = main.useCompress;
main.useCompress = false;
main.init('editor', function () {
editor.init(function () {
editor.pos = {x: 0, y: 0};
editor.mode.loc();
editor.info = editor.ids[editor.indexs[201]];
editor.mode.emenyitem();
editor.mode.floor();
editor.mode.tower();
editor.mode.functions();
editor.mode.showMode('floor');
editor.mode.listen();
editor_multi = editor_multi();
editor_blockly = editor_blockly();
editor.useCompress = useCompress;
delete(useCompress);
editor_mobile_listen();
});
});
//main.listen();
</script>
<!-- hightlight textarea -->
<script src='_server/editor_multi.js'></script>
<!-- blockly -->
<script src="_server/blockly/Converter.bundle.min.js"></script>
<script src="_server/blockly/blockly_compressed.min.js"></script>
<script src="_server/blockly/blockly_config.min.js"></script>
<script src='_server/editor_blockly.js'></script>
<!-- codemirror -->
<script src="_server/CodeMirror/codeMirror.bundle.min.js"></script>
<script src="_server/CodeMirror/jshint.min.js"></script>
<script src="_server/CodeMirror/codeMirror.plugin.min.js"></script>
</body>
</html>

View File

@ -7,6 +7,11 @@
<link href="_server/css/editor_mode.css" rel="stylesheet">
</head>
<body>
<script>
if(innerWidth<innerHeight){ //pic:1242*2208 | chrome info:1340*2380
confirm('高大于宽的设备请使用移动版本的editor, 点击确定跳转')?(window.location='./editor-mobile.html'):'';
}
</script>
<div class="main">
<div id="left" style="z-index:-1;opacity: 0;"><!-- map -->
<div id="arrEditor">
@ -159,10 +164,6 @@
<button onclick="editor_blockly.parse()">解析</button>
<button onclick="editor_blockly.cancel()">取消</button>
<xml id="toolbox" style="display:none">
<category name="入口方块"></category>
<category name="语句块"></category>
<category name="值块"></category>
<category name="常见事件模板"></category>
</xml>
</h3>
<div style="position: relative;height: 100%">

View File

@ -243,7 +243,7 @@ control.prototype.clearStatus = function() {
}
////// 重置游戏状态和初始数据 //////
control.prototype.resetStatus = function(hero, hard, floorId, route, maps, values, flags) {
control.prototype.resetStatus = function(hero, hard, floorId, route, maps, values) {
var totalTime=0;
if (core.isset(core.status) && core.isset(core.status.hero)
@ -292,9 +292,7 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
core.values = core.clone(values);
else core.values = core.clone(core.data.values);
if (core.isset(flags))
core.flags = core.clone(flags);
else core.flags = core.clone(core.data.flags);
core.flags = core.clone(core.data.flags);
core.events.initGame();
@ -2269,7 +2267,6 @@ control.prototype.saveData = function() {
'maps': core.maps.save(core.status.maps),
'route': core.encodeRoute(core.status.route),
'values': core.clone(core.values),
'flags': core.clone(core.flags),
'shops': {},
'version': core.firstData.version,
"time": new Date().getTime()
@ -2290,7 +2287,7 @@ control.prototype.saveData = function() {
control.prototype.loadData = function (data, callback) {
core.resetStatus(data.hero, data.hard, data.floorId, core.decodeRoute(data.route), core.maps.load(data.maps),
data.values, data.flags);
data.values);
// load shop times
for (var shop in core.status.shops) {

View File

@ -304,13 +304,13 @@ core.prototype.clearStatus = function() {
}
////// 重置游戏状态和初始数据 //////
core.prototype.resetStatus = function(hero, hard, floorId, route, maps, values, flags) {
core.control.resetStatus(hero, hard, floorId, route, maps, values, flags);
core.prototype.resetStatus = function(hero, hard, floorId, route, maps, values) {
core.control.resetStatus(hero, hard, floorId, route, maps, values);
}
////// 开始游戏 //////
core.prototype.startGame = function (hard, callback) {
core.control.startGame(hard, callback);
core.control.startGame(hard, callback);huo
}
////// 重新开始游戏;此函数将回到标题页面 //////

View File

@ -654,14 +654,11 @@ events.prototype.doAction = function() {
break
case "setVolume":
data.value = parseInt(data.value||0);
if (data.value<0) data.value=0;
if (data.value>100) data.value=100;
data.value = data.value / 100;
core.musicStatus.volume = data.value;
if (core.isset(core.musicStatus.playingBgm)) {
core.material.bgms[core.musicStatus.playingBgm].volume = data.value;
}
core.musicStatus.gainNode.gain.value = data.value;
this.doAction();
this.setVolume(data.value/100, data.time, function() {
core.doAction();
});
break;
case "setValue":
try {
@ -740,6 +737,7 @@ events.prototype.doAction = function() {
}
else {
var action = core.status.replay.toReplay.shift(), index;
if (action == 'turn') action = core.status.replay.toReplay.shift();
if (action.indexOf("choices:")==0 && ((index=parseInt(action.substring(8)))>=0) && index<data.choices.length) {
core.status.event.selection=index;
setTimeout(function () {
@ -1272,6 +1270,38 @@ events.prototype.moveImage = function (image, from, to, time, callback) {
}, time / 64);
}
////// 淡入淡出音乐 //////
events.prototype.setVolume = function (value, time, callback) {
var set = function (value) {
core.musicStatus.volume = value;
if (core.isset(core.musicStatus.playingBgm)) {
core.material.bgms[core.musicStatus.playingBgm].volume = value;
}
core.musicStatus.gainNode.gain.value = value;
}
if (!core.isset(time) || time<100) {
set(value);
if (core.isset(callback)) callback();
return;
}
core.status.replay.animate=true;
var currVolume = core.musicStatus.volume;
var step = 0;
var fade = setInterval(function () {
step++;
var nowVolume = currVolume+(value-currVolume)*step/32;
set(nowVolume);
if (step>=32) {
clearInterval(fade);
core.status.replay.animate=false;
if (core.isset(callback))
callback();
}
}, time / 32);
}
////// 打开一个全局商店 //////
events.prototype.openShop = function(shopId, needVisited) {
var shop = core.status.shops[shopId];

View File

@ -108,6 +108,7 @@ loader.prototype.loadAnimates = function () {
content = JSON.parse(content);
var data = {};
data.ratio = content.ratio;
data.se = content.se;
data.images = [];
data.images_rev = [];
content.bitmaps.forEach(function (t2) {

View File

@ -974,6 +974,9 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
var centerX = 32*x+16, centerY = 32*y+16;
var index=0;
// 播放音效
core.playSound(animate.se);
var draw = function (index) {
core.clearMap('animate', 0, 0, 416, 416);

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"bg.jpg"
],
"animates" : [
"hand", "sword", "zone",
"hand", "sword", "zone"
],
"bgms" : [
'bgm.mp3'

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,6 +3,7 @@
启动服务的多开版本 √
跟随效果 √
怪物数据导出器
RM动画导出器也能导出音效 √
gif播放可随着分辨率自动放缩 √
状态栏可随文字长度自动调整放缩 √
也可以用status:exp来代替经验值的写法 √