EffectTools/index.html
2020-08-21 09:42:54 +08:00

243 lines
10 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<script>
if(typeof window.require==="function"){
// 重命名 Electron 提供的 require
window.nodeRequire = require;
delete window.require;
delete window.exports;
delete window.module;
}
</script>
<meta charset="utf-8">
<title>特效查看及修改TOOL</title>
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<style>
html, body {
-ms-touch-action: none;
background: #FFFFFF;
padding: 0;
border: 0;
margin: 0;
height: 100%;
}
</style>
<link rel="stylesheet" type="text/css" href="libs/easyui/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="libs/easyui/themes/icon.css" />
<script src="libs/jquery.min.js"></script>
<script src="libs/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<script>
var loadScript = function (list, callback) {
var loaded = 0;
var loadNext = function () {
loadSingleScript(list[loaded], function () {
loaded++;
if (loaded >= list.length) {
callback();
}
else {
loadNext();
}
})
};
loadNext();
};
var loadSingleScript = function (src, callback) {
var s = document.createElement('script');
s.async = false;
s.src = src;
s.addEventListener('load', function () {
s.parentNode.removeChild(s);
s.removeEventListener('load', arguments.callee, false);
callback();
}, false);
document.body.appendChild(s);
};
var xhr = new XMLHttpRequest();
xhr.open('GET', './manifest.json?v=' + Math.random(), true);
xhr.addEventListener("load", function () {
var manifest = JSON.parse(xhr.response);
var list = manifest.initial.concat(manifest.game);
loadScript(list, function () {
/**
* {
* "renderMode":, //Engine rendering mode, "canvas" or "webgl"
* "audioType": 0 //Use the audio type, 0: default, 2: web audio, 3: audio
* "antialias": //Whether the anti-aliasing is enabled in WebGL mode, true: on, false: off, defaults to false
* "calculateCanvasScaleFactor": //a function return canvas scale factor
* }
**/
egret.runEgret({ renderMode: "webgl", audioType: 0, calculateCanvasScaleFactor:function(context) {
var backingStore = context.backingStorePixelRatio ||
context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio || 1;
return (window.devicePixelRatio || 1) / backingStore;
}});
});
});
xhr.send(null);
</script>
<div style="margin: auto;width: 50%;height: 100%;" class="egret-player"
data-entry-class="Main"
data-orientation="auto"
data-scale-mode="noScale"
data-frame-rate="30"
data-content-width="400"
data-content-height="1136"
data-multi-fingered="2"
data-show-fps="false" data-show-log="false"
data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
</div>
<div style="margin: auto;width: 50%;height: 100%;float:right;background:#fcfcfc">
<table id="dg" class="easyui-datagrid" title="编辑特效" style="width:700px;height:auto" data-options="
iconCls: 'icon-edit',
singleSelect: true,
toolbar: '#tb',
method: 'get',
onClickCell: onClickCell,
onEndEdit: onEndEdit
">
<thead>
<tr>
<th data-options="field:'a',width:80">动作</th>
<th data-options="field:'d',width:80">方向</th>
<th data-options="field:'f',width:80,align:'right',editor:{type:'numberbox'}"></th>
<th data-options="field:'t',width:140,align:'right',editor:{type:'numberbox'}">执行时间(单位:毫秒)</th>
<th data-options="field:'e',width:250,editor:'textbox'">事件</th>
</tr>
</thead>
</table>
<div id="tb" style="height:auto">
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="append()">添加</a>
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="removeit()">移除</a>
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true" onclick="accept()">应用改动</a>
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-undo',plain:true" onclick="reject()">还原改动</a>
</div>
<script type="text/javascript">
saveCallback = null;
var editIndex = undefined;
function endEditing() {
if (editIndex == undefined) {
return true
}
if ($('#dg').datagrid('validateRow', editIndex)) {
$('#dg').datagrid('endEdit', editIndex);
editIndex = undefined;
return true;
} else {
return false;
}
}
function onClickCell(index, field) {
if (editIndex != index) {
if (endEditing()) {
$('#dg').datagrid('selectRow', index)
.datagrid('beginEdit', index);
var ed = $('#dg').datagrid('getEditor', {
index: index,
field: field
});
if (ed) {
($(ed.target).data('textbox') ? $(ed.target).textbox('textbox') : $(ed.target)).focus();
}
editIndex = index;
} else {
setTimeout(function() {
$('#dg').datagrid('selectRow', editIndex);
}, 0);
}
}
}
function onEndEdit(index, row) {
var ed = $(this).datagrid('getEditor', {
index: index,
field: 'e'
});
var tb = $(ed.target);
var value = tb.textbox("getValue") || "";
tb.textbox("setValue",value.trim());
}
function append() {
if (endEditing()) {
var row = $('#dg').datagrid('getSelected');
var idx = -1;
if (row) {
idx = $('#dg').datagrid("getRowIndex", row);
}
if (idx > -1) {
$('#dg').datagrid("insertRow", {
index: idx,
row: {
a: 0,
d: -1
}
});
editIndex = idx;
} else {
$('#dg').datagrid('appendRow', {
a: 0,
d: -1
});
editIndex = $('#dg').datagrid('getRows').length - 1;
}
$('#dg').datagrid('selectRow', editIndex)
.datagrid('beginEdit', editIndex);
}
}
function removeit() {
if (editIndex == undefined) {
return
}
$('#dg').datagrid('cancelEdit', editIndex)
.datagrid('deleteRow', editIndex);
editIndex = undefined;
}
function accept() {
if (endEditing()) {
$('#dg').datagrid('acceptChanges');
}
}
function reject() {
$('#dg').datagrid('rejectChanges');
editIndex = undefined;
}
</script>
<div style="float:left">
<input type="checkbox" id="chkCircle" disabled="disabled" /> 是否为循环动画 <br/>
x偏移: <input id="ox" class="easyui-numberspinner" style="width:80px;" value="0" data-options="min:-1000,max:1000,editable:true"><br/>
y偏移: <input id="oy" class="easyui-numberspinner" style="width:80px;" value="0" data-options="min:-1000,max:1000,editable:true"><br/>
<a id="btnSaveOffset" href="#" class="easyui-linkbutton">保存偏移</a> <a id="btnCancelOffset" href="#" class="easyui-linkbutton">撤销偏移</a><br/>
<br/>
<a id="btnSave" href="#" data-options="iconCls:'icon-save'" class="easyui-linkbutton">保存数据到文件</a>
</div>
</div>
</body>
</html>