Merge pull request #169 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2018-07-08 02:17:44 +08:00 committed by GitHub
commit d5b8ee8a72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 130 additions and 67 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

@ -63,14 +63,6 @@ body {
overflow: auto;
}
#editTip {
position: absolute;
width: 100%;
margin-bottom: 120px;
bottom: 0;
left: 10px;
}
#editArea p {
margin: 10px;
display: block;
@ -117,14 +109,19 @@ body {
#tip {
float: right;
width: 50%;
height: 95%;
/* 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: 15px;
line-height: 14px;
font-size: 1rem;
line-height: 0.93rem;
}
#tip p{
margin: 0.5rem
}
.files {
@ -251,8 +248,8 @@ body {
line-height: 1.2em;
}
table, td {
border: 1px solid #fff;
td {
border: 0.230vmin solid #fff;
color: #fff;
cursor: crosshair;
}
@ -290,14 +287,17 @@ table.col td {
#mapColMark td {
width: 29px;
width: 7.15vmin;
padding: 0;
border-bottom-width: 0px;
border-top-width: 0px;
}
#mapColMark td:hover .colBlock {
position: absolute;
top: 4vmin;
height: 96vmin;
width: 7.38vmin;
width: 7.15vmin;
z-index: 100;
background-color: rgba(38, 166, 154, .5);
}
@ -330,13 +330,16 @@ table.row td {
}
#mapRowMark td {
height: 29px;
height: 7.15vmin;
padding: 0;
border-left-width: 0px;
border-right-width: 0px;
}
#mapRowMark td:hover .rowBlock {
position: absolute;
left: 4vmin;
height: 7.38vmin;
height: 7.15vmin;
width: 96vmin;
z-index: 100;
background-color: rgba(76, 34, 27, .5);

View File

@ -59,15 +59,15 @@
overflow: hidden;
}
#left6 h3{
font-size: 3vmax;
margin: 2vmax 0;
font-size: 3.5vh;
margin: 1vh 0;
}
#left6 #blocklyArea {
width: 100vmin;
height: 55vmax;
height: 60vh;
}
#left6 #blocklyDiv {
@ -77,7 +77,7 @@
#left6 .CodeMirror {
border: 1px solid #eee;
height: 27vmax;
height: 21vh;
width: 100%;
}

View File

@ -122,9 +122,9 @@ editor_mode = function (editor) {
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;
}
// thisTr.onclick = function(){
// editor.lastClickId=guid;
// }
});
}
return {"HTML": outstr.join(''), "guids": guids, "listen": listen};

View File

@ -1,9 +1,21 @@
// vue 相关处理
document.body.onmousedown = function (e) {
//console.log(e);
var clickpath = [];
e.path.forEach(function (node) {
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_) {
@ -32,7 +44,7 @@ document.body.onmousedown = function (e) {
if (e.button!=2 && !editor.isMobile){
editor.hideMidMenu();
}
if (clickpath.indexOf('down') !== -1 && editor.isMobile){
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]}

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作为结局传入。

View File

@ -22,13 +22,13 @@
<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">
<div id="editTip" style="position: absolute;width: 100%;margin-bottom: 20%;bottom: 0;left: 10px;">
<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: 90px">
<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"/>
@ -221,7 +221,7 @@
</div>
</div>
<div id="down">
<div style="margin:1rem">
<div style="margin:0.5rem">
<div class="tools">
<div id="tip" v-cloak>
<div v-if="isSelectedBlock">
@ -245,6 +245,15 @@
<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>
@ -257,21 +266,11 @@
<br>
<select id="selectFloor"></select>
<input type="button" value="保存地图" id='saveFloor'/>
<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>
<span id='mobileeditdata' style="display:none">
<input type="button" value="编辑"/>
<input type="button" value="显示完整名称"/>
<input type="button" value="显示完整注释"/>
</span>
<input type="button" value="取消素材区的选中" id='cancelright'/>
<!-- -->
<div id="bgSelect" v-cloak style="display:none">
<span>当前地板: </span>
@ -453,7 +452,6 @@ var editor_mobile_listen=function(){
var mid=document.getElementById('mid');
var right=document.getElementById('right');
var mobileeditdata=document.getElementById('mobileeditdata');
var cancelright=document.getElementById('cancelright');
mobileview.children[0].onclick=function(){
mid.style='z-index:-1;opacity: 0;';
@ -500,10 +498,27 @@ var editor_mobile_listen=function(){
printf(info[0].children[1].getAttribute('title'))
}
cancelright.onclick=function(){
selectBox.isSelected = false;
editor.info = {};
}
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;

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];

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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