let assetPath = ""; let defaultPolygonPath = "assets/"; let polygonNameHeader = "polygon_"; let polygonName = ""; Editor.Panel.extend({ style: `:host { margin: 5px; } h2 { color: #f90; } .bottom { height: 30px; }`, template: `

Auto Create Spine Prefab


1. 把要輸出的節點拉進來
2. 把要輸入的資料夾拉進來

要輸出的Node

要輸入的資料夾 ui-asset>
Spine大小(選填)

要輸入的範例(選填)

預設動畫名稱(選填)
生成
`, $: { /** Node */ node: "#node", /** 資料夾 */ asset: "#asset", /** Spine大小 */ scale: "#scale", /** 範例 */ example: "#example", /** 預設動畫名稱 */ anim: "#anim", /** 生成按鈕 */ create: "#create", }, ready() { // Editor.Ipc.sendToMain("spineset:panel-load-finish"); this.createBtnClick(); }, /** 保存按鈕點擊事件 */ createBtnClick() { this.$create.addEventListener("confirm", () => { if (!this.$node._value) { Editor.error("請拖曳 Node 到視窗"); return; } else if (!this.$asset._value) { Editor.error("請拖曳 資料夾 到視窗"); return; } Editor.Ipc.sendToMain("spineset:create-click", this.$node, this.$asset, this.$example, this.$scale, this.$anim); // Editor.Ipc.sendToMain("spineset:create-click", this.$asset); }); }, messages: { "setDefault": function (event, ...agrs) { let Data = JSON.parse(agrs[0]); let node_uuid = Data["node_uuid"]; let example_uuid = Data["example_uuid"]; // Editor.log(`agrs: ${agrs[0]}`); // Editor.log(`node_uuid: ${node_uuid}`); // Editor.log(`example_uuid: ${example_uuid}`); if (node_uuid && node_uuid !== "") { this.$node.value = node_uuid; } if (example_uuid && example_uuid !== "") { this.$example.value = example_uuid; } if (event.reply) { //if no error, the first argument should be null event.reply(null, "Fine, thank you!"); } } } });