sourcecheck/panel/index.js
2022-03-31 08:59:10 +08:00

62 lines
1.8 KiB
JavaScript

Editor.Panel.extend({
style: `
:host { margin: 5px; }
h2 { color: #f90; }
.bottom {
height: 30px;
}
`,
template: `
<h2 style="text-align:center">Source Check</h2>
<hr />
<div>
<!-- 1. 把要檢查的資料夾拉進來<br> -->
1. 填入要檢查的資料夾(從assets開始算)<br>
2. 執行<br>
PS. 目前只有檢查png、jpg、anim、fnt
</div>
<hr />
<div>
要檢查的資料夾 db://asstes/
<ui-input placeholder="UIScenes/Backpack" id="filepath"></ui-input>
<!-- <ui-asset class="flex-1" type="native-asset" droppable="asset" id="node"></ui-asset> -->
</div>
<hr />
<hr />
<div style="text-align:right">
<ui-button id="run" class="blue">執行</ui-button>
</div>
`,
$: {
/** filepath */
filepath: "#filepath",
/** 生成按鈕 */
run: "#run",
},
ready() {
// Editor.Ipc.sendToMain("sourcecheck:panel-load-finish");
this.onClickRun();
},
/** 保存按鈕點擊事件 */
onClickRun() {
this.$run.addEventListener("confirm", () => {
if (!this.$filepath._value) {
Editor.error("請輸入要檢查的資料夾");
return;
}
Editor.Ipc.sendToMain("sourcecheck:run-click", this.$filepath);
});
},
messages: {
// "setDefault": function (event, ...agrs) {
// if (event.reply) {
// //if no error, the first argument should be null
// event.reply(null, "Fine, thank you!");
// }
// }
}
});