uuidconvert/panel/index.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-04-05 10:40:31 +00:00
const PACKAGE_NAME = "uuidconvert";
const fs = require("fs");
2022-03-31 00:57:26 +00:00
Editor.Panel.extend({
2022-04-05 10:40:31 +00:00
style: fs.readFileSync(Editor.url(`packages://${PACKAGE_NAME}/static/style/default/index.css`), 'utf-8')
.concat(fs.readFileSync(Editor.url(`packages://${PACKAGE_NAME}/static/style/default/bootstrap.min.css`), 'utf-8')),
template: fs.readFileSync(
2022-04-14 04:22:08 +00:00
Editor.url(`packages://${PACKAGE_NAME}/index.html`), 'utf-8'),
2022-04-05 10:40:31 +00:00
$: {
2022-04-14 04:22:08 +00:00
run: '#run',
uuid: '#uuid',
asset: '#asset',
2022-04-05 10:40:31 +00:00
},
ready() {
2022-04-14 04:22:08 +00:00
this.$run.addEventListener("confirm", this.methods.run.bind(this));
2022-04-05 10:40:31 +00:00
},
methods: {
2022-04-14 04:22:08 +00:00
run() {
let uuid = "";
// Editor.log(`$asset: ${this.$asset.value}`);
if (!this.$uuid.value) {
if (!this.$asset.value) {
Editor.error("請輸入要轉換的UUID");
return;
} else {
uuid = this.$asset.value;
}
} else {
uuid = this.$uuid.value;
}
Editor.Ipc.sendToMain("uuidconvert:run-click", uuid);
},
2022-04-05 10:40:31 +00:00
},
messages: {
2022-03-31 00:57:26 +00:00
}
});