From 12ed2d25a3addb5bbf37c9694951777ebeb35937 Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Mon, 2 Dec 2024 22:33:13 +0000
Subject: [PATCH] Create MistSkins.js
---
cache/MistSkins.js | 1 +
1 file changed, 1 insertion(+)
create mode 100644 cache/MistSkins.js
diff --git a/cache/MistSkins.js b/cache/MistSkins.js
new file mode 100644
index 0000000..bceb3bc
--- /dev/null
+++ b/cache/MistSkins.js
@@ -0,0 +1 @@
+Scratch.translate.setup({fi:{_Skins:"Ulkoasu","_[ATTRIBUTE] of skin [NAME]":"ulkoasun [NAME] [ATTRIBUTE]","_create SVG skin [SVG] as [NAME]":"luo SVG-ulkoasu [SVG] nimellä [NAME]","_current skin of [TARGET]":"hahmon [TARGET] nykyinen ulkoasu","_delete all skins":"poista kaikki ulkoasut","_delete skin [NAME]":"poista ulkoasu [NAME]",_height:"korkeus","_load skin from URL [URL] as [NAME]":"lataa ulkoasu URL-osoitteesta [URL] nimellä [NAME]","_load skin from [COSTUME] as [NAME]":"lataa ulkoasu asusteesta [COSTUME] nimellä [NAME]","_restore skin of [TARGET]":"palauta hahmon [TARGET] ulkoasu","_restore targets with skin [NAME]":"palauta ulkoasua [NAME] käyttävät hahmot","_set skin of [TARGET] to [NAME]":"aseta hahmon [TARGET] ulkoasuksi [NAME]","_skin [NAME] is loaded?":"onko ulkoasu [NAME] ladattu? ",_width:"leveys"},it:{_Skins:"Altro Costumi Plus ",_height:"altezza",_width:"larghezza"},ja:{_Skins:"スã‚ン",_height:"高ã•",_width:"横幅"},ko:{_Skins:"스킨","_[ATTRIBUTE] of skin [NAME]":"스킨 [NAME]ì˜ [ATTRIBUTE]","_create SVG skin [SVG] as [NAME]":"SVG 스킨 [NAME] 만들기 [SVG] ","_current skin of [TARGET]":"현재 ìŠ¤í‚¨ì˜ [TARGET]","_delete all skins":"ëª¨ë“ ìŠ¤í‚¨ ì‚ì œí•˜ê¸°","_delete skin [NAME]":"스킨 [NAME] ì‚ì œí•˜ê¸°",_height:"높ì´","_load skin from URL [URL] as [NAME]":"스킨 [NAME]ì„(를) URLì—ì„œ 불러오기 [URL]","_load skin from [COSTUME] as [NAME]":"스킨 [NAME]ì„(를) [COSTUME](으)ë¡œ 불러오기","_restore skin of [TARGET]":"[TARGET]ì˜ ìŠ¤í‚¨ 복구하기","_set skin of [TARGET] to [NAME]":"[TARGET]ì˜ ìŠ¤í‚¨ì„ [NAME](으)ë¡œ ì •í•˜ê¸°",_width:"ë„“ì´"},nb:{_Skins:"Skinner",_height:"høyde",_width:"bredde"},nl:{"_[ATTRIBUTE] of skin [NAME]":"[ATTRIBUTE] van skin [NAME]","_create SVG skin [SVG] as [NAME]":"creëer SVG-skin [SVG] als [NAME]","_current skin of [TARGET]":"huidige skin van [TARGET]","_delete all skins":"verwijder alle skins","_delete skin [NAME]":"verwijder skin [NAME]",_height:"hoogte","_load skin from URL [URL] as [NAME]":"laad skin van URL [URL] als [NAME]","_load skin from [COSTUME] as [NAME]":"laad skin van [COSTUME] als [NAME]","_restore skin of [TARGET]":"herstel skin van [TARGET]","_restore targets with skin [NAME]":"herstel alle met skin [NAME]","_set skin of [TARGET] to [NAME]":"maak skin van [TARGET] [NAME]","_skin [NAME] is loaded?":"skin [NAME] is geladen?",_width:"breedte"},pl:{_height:"wysokość",_width:"szerokość"},ru:{_Skins:"Скины","_[ATTRIBUTE] of skin [NAME]":"[ATTRIBUTE] Ñкина [NAME]","_create SVG skin [SVG] as [NAME]":"Ñоздать SVG Ñкин [SVG] как [NAME]","_current skin of [TARGET]":"текущий Ñкин [TARGET]","_delete all skins":"удалить вÑе Ñкины","_delete skin [NAME]":"удалить Ñкин [NAME]",_height:"выÑота","_load skin from URL [URL] as [NAME]":"загрузить Ñкин из URL [URL] как [NAME]","_load skin from [COSTUME] as [NAME]":"загрузить Ñкин из [COSTUME] как [NAME]","_restore skin of [TARGET]":"воÑÑтановить Ñкин [TARGET]","_restore targets with skin [NAME]":"воÑÑтановить цели Ñо Ñкином [NAME]","_set skin of [TARGET] to [NAME]":"задать Ñкин [TARGET] на [NAME]","_skin [NAME] is loaded?":"Ñкин [NAME] загружен?",_width:"ширина"},tr:{_Skins:"Ciltler"},uk:{_Skins:"Скіни",_height:"виÑота",_width:"ширина"},"zh-cn":{_Skins:"纹ç†","_[ATTRIBUTE] of skin [NAME]":"纹ç†[NAME]çš„[ATTRIBUTE]","_create SVG skin [SVG] as [NAME]":"创建SVG纹ç†[SVG]并命å为[NAME]","_current skin of [TARGET]":"[TARGET]的当å‰çº¹ç†","_delete all skins":"åˆ é™¤æ‰€æœ‰çº¹ç†","_delete skin [NAME]":"åˆ é™¤çº¹ç†[NAME]",_height:"高度","_load skin from URL [URL] as [NAME]":"从URL[URL]åŠ è½½çº¹ç†å¹¶å‘½å为[NAME]","_load skin from [COSTUME] as [NAME]":"从[COSTUME]åŠ è½½çº¹ç†å¹¶å‘½å为[NAME]","_restore skin of [TARGET]":"æ¢å¤[TARGET]的纹ç†ä¸ºåŽŸé€ åž‹","_restore targets with skin [NAME]":"æ¢å¤æ‰€æœ‰çº¹ç†ä¸º[NAME]çš„è§’è‰²é€ åž‹","_set skin of [TARGET] to [NAME]":"å°†[TARGET]的纹ç†è®¾ä¸º[NAME]","_skin [NAME] is loaded?":"纹ç†[NAME]å·²åŠ è½½ï¼Ÿ",_width:"宽度"}}),function(e){"use strict";const t=e.vm.runtime,s=t.renderer,n=e.Cast;var r=[],a=[];e.extensions.register(new class{constructor(){t.on("PROJECT_START",(()=>{this._refreshTargets()})),t.on("PROJECT_STOP_ALL",(()=>{this._refreshTargets()}))}getInfo(){return{id:"mistSkins",name:e.translate("Skins"),color1:"#ff69b4",color2:"#ff5cae",color3:"#ff4fa8",docsURI:"https://extensions.turbowarp.org/Lily/Skins",blocks:[{opcode:"registerSVGSkin",blockType:e.BlockType.COMMAND,text:e.translate("create SVG skin [SVG] as [NAME]"),arguments:{SVG:{type:e.ArgumentType.STRING,defaultValue:""},NAME:{type:e.ArgumentType.STRING,defaultValue:"my skin"}}},"---",{opcode:"registerCostumeSkin",blockType:e.BlockType.COMMAND,text:e.translate("load skin from [COSTUME] as [NAME]"),arguments:{COSTUME:{type:e.ArgumentType.COSTUME},NAME:{type:e.ArgumentType.STRING,defaultValue:"my skin"}}},{opcode:"registerURLSkin",blockType:e.BlockType.COMMAND,text:e.translate("load skin from URL [URL] as [NAME]"),arguments:{URL:{type:e.ArgumentType.STRING,defaultValue:"https://extensions.turbowarp.org/dango.png"},NAME:{type:e.ArgumentType.STRING,defaultValue:"my skin"}}},{opcode:"getSkinLoaded",blockType:e.BlockType.BOOLEAN,text:e.translate("skin [NAME] is loaded?"),arguments:{NAME:{type:e.ArgumentType.STRING,defaultValue:"my skin"}}},{opcode:"getSkinLoading",blockType:e.BlockType.BOOLEAN,text:e.translate("skin [NAME] is loading?"),arguments:{NAME:{type:e.ArgumentType.STRING,defaultValue:"my skin"}}},{opcode:"getSkins",blockType:e.BlockType.REPORTER,text:e.translate("get all skins")},"---",{opcode:"setSkin",blockType:e.BlockType.COMMAND,text:e.translate("set skin of [TARGET] to [NAME]"),arguments:{TARGET:{type:e.ArgumentType.STRING,menu:"targetMenu"},NAME:{type:e.ArgumentType.STRING,defaultValue:"my skin"}}},{opcode:"restoreSkin",blockType:e.BlockType.COMMAND,text:e.translate("restore skin of [TARGET]"),arguments:{TARGET:{type:e.ArgumentType.STRING,menu:"targetMenu"}}},{opcode:"restoreTargets",blockType:e.BlockType.COMMAND,text:e.translate("restore targets with skin [NAME]"),arguments:{NAME:{type:e.ArgumentType.STRING,defaultValue:"my skin"}}},"---",{opcode:"getCurrentSkin",blockType:e.BlockType.REPORTER,text:e.translate("current skin of [TARGET]"),arguments:{TARGET:{type:e.ArgumentType.STRING,menu:"targetMenu"}}},{opcode:"getSkinAttribute",blockType:e.BlockType.REPORTER,text:e.translate("[ATTRIBUTE] of skin [NAME]"),arguments:{ATTRIBUTE:{type:e.ArgumentType.STRING,menu:"skinAttributes"},NAME:{type:e.ArgumentType.STRING,defaultValue:"my skin"}}},"---",{opcode:"deleteSkin",blockType:e.BlockType.COMMAND,text:e.translate("delete skin [NAME]"),arguments:{NAME:{type:e.ArgumentType.STRING,defaultValue:"my skin"}}},{opcode:"deleteAllSkins",blockType:e.BlockType.COMMAND,text:e.translate("delete all skins")}],menus:{targetMenu:{acceptReporters:!0,items:"_getTargets"},skinAttributes:{acceptReporters:!0,items:[{text:e.translate("width"),value:"width"},{text:e.translate("height"),value:"height"}]}}}}async registerSVGSkin(e){const t=`lms-${n.toString(e.NAME)}`,a=n.toString(e.SVG);let i=null;r[t]&&(i=r[t]);const o=s.createSVGSkin(a);var l;r[t]=o,await(l=s._allSkins[o],void new Promise((e=>{l._svgImageLoaded?e():(l._svgImage.addEventListener("load",(()=>{e()})),l._svgImage.addEventListener("error",(()=>{e()})))}))),i&&(this._refreshTargetsFromID(i,!1,o),s.destroySkin(i))}async registerCostumeSkin(t,a){if(i="add costume skin",e.vm.runtime.isPackaged&&(alert(`To use the Skins ${i} block, the creator of the packaged project must uncheck "Remove raw asset data after loading to save RAM" under advanced settings in the packager.`),1))return;var i;const o=`lms-${n.toString(t.NAME)}`,l=a.target.getCostumeIndexByName(t.COSTUME);if(-1===l)return;const T=a.target.sprite.costumes[l],k=T.asset.encodeDataURI(),A=T.rotationCenterX,E=T.rotationCenterY;let u=[A,E];A&&E||(u=null);let g=null;r[o]&&(g=r[o]);const c=await this._createURLSkin(k,u);r[o]=c,g&&(this._refreshTargetsFromID(g,!1,c),s.destroySkin(g))}registerURLSkin(e){const t=`lms-${n.toString(e.NAME)}`,i=n.toString(e.URL);let o=null;r[t]&&(o=r[t]),a.push(t),this._createURLSkin(i).then((e=>{a=a.filter((e=>e!==t)),e&&(r[t]=e,o&&(this._refreshTargetsFromID(o,!1,e),s.destroySkin(o)))}))}getSkinLoaded(e){const t=`lms-${n.toString(e.NAME)}`;return!!r[t]}getSkinLoading(e){const t=`lms-${n.toString(e.NAME)}`;return a.includes(t)}getSkins(){return JSON.stringify(Object.keys(r).map((e=>e.replace(/^lms\-/,""))))}setSkin(e,t){const a=`lms-${n.toString(e.NAME)}`;if(!r[a])return;const i=n.toString(e.TARGET),o=this._getTargetFromMenu(i,t);if(!o)return;const l=o.drawableID,T=r[a];s._allDrawables[l].skin=s._allSkins[T]}restoreSkin(e,t){const s=n.toString(e.TARGET),r=this._getTargetFromMenu(s,t);r&&r.updateAllDrawableProperties()}getCurrentSkin(e,t){const r=n.toString(e.TARGET),a=this._getTargetFromMenu(r,t);if(!a)return;const i=a.drawableID,o=s._allDrawables[i].skin._id,l=this._getSkinNameFromID(o);return l?l.replace("lms-",""):""}getSkinAttribute(e){const t=s._allSkins,a=`lms-${n.toString(e.NAME)}`;if(!r[a])return 0;const i=r[a];if(!t[i])return 0;const o=t[i].size;switch(n.toString(e.ATTRIBUTE).toLowerCase()){case"width":return Math.ceil(o[0]);case"height":return Math.ceil(o[1]);default:return 0}}deleteSkin(e){const t=`lms-${n.toString(e.NAME)}`;if(!r[t])return;const a=r[t];this._refreshTargetsFromID(a,!0),s.destroySkin(a),Reflect.deleteProperty(r,t)}deleteAllSkins(){this._refreshTargets();for(const e in r){const t=r[e];s.destroySkin(t),Reflect.deleteProperty(r,e)}a=[],r=[]}restoreTargets(e){const t=`lms-${n.toString(e.NAME)}`;if(!r[t])return;const s=r[t];this._refreshTargetsFromID(s,!0)}_refreshTargetsFromID(e,n,r){const a=s._allDrawables,i=s._allSkins;for(const s of t.targets){const t=s.drawableID;a[t].skin.id===e&&(s.updateAllDrawableProperties(),n||(a[t].skin=r?i[r]:i[e]))}}_refreshTargets(){for(const e of t.targets)e.updateAllDrawableProperties()}_getSkinNameFromID(e){for(const t in r)if(r[t]===e)return t}_getTargetFromMenu(s,n){let r=e.vm.runtime.getSpriteTargetByName(s);return"_myself_"===s&&(r=n.target),"_stage_"===s&&(r=t.getTargetForStage()),r}async _createURLSkin(t,n){let r;if(!await e.canFetch(t))return;r=await e.fetch(t);const a=r.headers.get("Content-Type");if("image/svg+xml"===a)return s.createSVGSkin(await r.text(),n);if("image/png"===a||"image/jpeg"===a||"image/bmp"===a){const e=new Image;return e.src=t,e.crossOrigin="anonymous",await e.decode(),s.createBitmapSkin(e)}}_getTargets(){const t=[{text:"myself",value:"_myself_"},{text:"Stage",value:"_stage_"}],s=e.vm.runtime.targets;for(let e=1;e