webgal-engine 4.6.3 → 4.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,4 +1,4 @@
1
- import{C as De,O as Ae,A as Be,P as ke,M as ft,T as Re,E as kt,u as Rt,a as bt}from"./index-EZxLQxgv.js";var W=Math.pow,I=(s,t,e)=>new Promise((i,r)=>{var a=l=>{try{o(e.next(l))}catch(h){r(h)}},n=l=>{try{o(e.throw(l))}catch(h){r(h)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,n);o((e=e.apply(s,t)).next())});const Zt=2,Kt=2;var ct;(s=>{s.supportMoreMaskDivisions=!0,s.setOpacityFromMotion=!1})(ct||(ct={}));var w;(s=>{s.LOG_LEVEL_VERBOSE=0,s.LOG_LEVEL_WARNING=1,s.LOG_LEVEL_ERROR=2,s.LOG_LEVEL_NONE=999,s.logLevel=s.LOG_LEVEL_WARNING,s.sound=!0,s.motionSync=!0,s.motionFadingDuration=500,s.idleMotionFadingDuration=2e3,s.expressionFadingDuration=500,s.preserveExpressionOnMotion=!0,s.cubism4=ct,s.legacyExpressionBlendMode=!1})(w||(w={}));const C={log(s,...t){w.logLevel<=w.LOG_LEVEL_VERBOSE&&console.log(`[${s}]`,...t)},warn(s,...t){w.logLevel<=w.LOG_LEVEL_WARNING&&console.warn(`[${s}]`,...t)},error(s,...t){w.logLevel<=w.LOG_LEVEL_ERROR&&console.error(`[${s}]`,...t)}};function yt(s,t,e){return s<t?t:s>e?e:s}function Oe(s,t){return Math.random()*(t-s)+s}function rt(s,t,e,i,r){const a=t[i];a!==null&&typeof a===s&&(e[r]=a)}function at(s,t,e,i,r){const a=t[i];Array.isArray(a)&&(e[r]=a.filter(n=>n!==null&&typeof n===s))}function me(s,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(i=>{i!=="constructor"&&Object.defineProperty(s.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))})})}function Ue(s){let t=s.lastIndexOf("/");return t!=-1&&(s=s.slice(0,t)),t=s.lastIndexOf("/"),t!==-1&&(s=s.slice(t+1)),s}function Ve(s,t){const e=s.indexOf(t);e!==-1&&s.splice(e,1)}class Ot extends kt{constructor(t,e){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=t,this.tag=`ExpressionManager(${t.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(t){return I(this,null,function*(){if(!this.definitions[t]){C.warn(this.tag,`Undefined expression at [${t}]`);return}if(this.expressions[t]===null){C.warn(this.tag,`Cannot set expression at [${t}] because it's already failed in loading.`);return}if(this.expressions[t])return this.expressions[t];const e=yield this._loadExpression(t);return this.expressions[t]=e,e})}_loadExpression(t){throw new Error("Not implemented.")}setRandomExpression(){return I(this,null,function*(){if(this.definitions.length){const t=[];for(let e=0;e<this.definitions.length;e++)this.expressions[e]!==null&&this.expressions[e]!==this.currentExpression&&e!==this.reserveExpressionIndex&&t.push(e);if(t.length){const e=Math.floor(Math.random()*t.length);return this.setExpression(e)}}return!1})}resetExpression(){this._setExpression(this.defaultExpression)}restoreExpression(){this._setExpression(this.currentExpression)}setExpression(t){return I(this,null,function*(){if(typeof t!="number"&&(t=this.getExpressionIndex(t)),!(t>-1&&t<this.definitions.length)||t===this.expressions.indexOf(this.currentExpression))return!1;this.reserveExpressionIndex=t;const e=yield this.loadExpression(t);return!e||this.reserveExpressionIndex!==t?!1:(this.reserveExpressionIndex=-1,this.currentExpression=e,this._setExpression(e),!0)})}update(t,e){return this.isFinished()?!1:this.updateParameters(t,e)}destroy(){this.destroyed=!0,this.emit("destroy");const t=this;t.definitions=void 0,t.expressions=void 0}}const Qt=.01,Ne=40/7.5,Ge=1/(.15*1e3);class ze{constructor(){this.targetX=0,this.targetY=0,this.x=0,this.y=0,this.vx=0,this.vy=0}focus(t,e,i=!1){this.targetX=yt(t,-1,1),this.targetY=yt(e,-1,1),i&&(this.x=this.targetX,this.y=this.targetY)}update(t){const e=this.targetX-this.x,i=this.targetY-this.y;if(Math.abs(e)<Qt&&Math.abs(i)<Qt)return;const r=Math.sqrt(W(e,2)+W(i,2)),a=Ne/(1e3/t);let n=a*(e/r)-this.vx,o=a*(i/r)-this.vy;const l=Math.sqrt(W(n,2)+W(o,2)),h=a*Ge*t;l>h&&(n*=h/l,o*=h/l),this.vx+=n,this.vy+=o;const u=Math.sqrt(W(this.vx,2)+W(this.vy,2)),c=.5*(Math.sqrt(W(h,2)+8*h*r)-h);u>c&&(this.vx*=c/u,this.vy*=c/u),this.x+=this.vx,this.y+=this.vy}}class vt{constructor(t){this.json=t;let e=t.url;if(typeof e!="string")throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=e,this.name=Ue(this.url)}resolveURL(t){return Rt.resolve(this.url,t)}replaceFiles(t){this.moc=t(this.moc,"moc"),this.pose!==void 0&&(this.pose=t(this.pose,"pose")),this.physics!==void 0&&(this.physics=t(this.physics,"physics"));for(let e=0;e<this.textures.length;e++)this.textures[e]=t(this.textures[e],`textures[${e}]`)}getDefinedFiles(){const t=[];return this.replaceFiles(e=>(t.push(e),e)),t}validateFiles(t){const e=(a,n)=>{const o=this.resolveURL(a);if(!t.includes(o)){if(n)throw new Error(`File "${a}" is defined in settings, but doesn't exist in given files`);return!1}return!0};return[this.moc,...this.textures].forEach(a=>e(a,!0)),this.getDefinedFiles().filter(a=>e(a,!1))}}var Et=(s=>(s[s.NONE=0]="NONE",s[s.IDLE=1]="IDLE",s[s.NORMAL=2]="NORMAL",s[s.FORCE=3]="FORCE",s))(Et||{});class Xe{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(t,e,i){if(i<=0)return C.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(t===this.currentGroup&&e===this.currentIndex)return C.log(this.tag,"Motion is already playing.",this.dump(t,e)),!1;if(t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex)return C.log(this.tag,"Motion is already reserved.",this.dump(t,e)),!1;if(i===1){if(this.currentPriority!==0)return C.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,e)),!1;if(this.reservedIdleGroup!==void 0)return C.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(t,e)),!1;this.setReservedIdle(t,e)}else{if(i<3){if(i<=this.currentPriority)return C.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(t,e)),!1;if(i<=this.reservePriority)return C.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(t,e)),!1}this.setReserved(t,e,i)}return!0}start(t,e,i,r){if(r===1){if(this.setReservedIdle(void 0,void 0),this.currentPriority!==0)return C.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,i)),!1}else{if(e!==this.reservedGroup||i!==this.reservedIndex)return C.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(e,i)),!1;this.setReserved(void 0,void 0,0)}return t?(this.setCurrent(e,i,r),!0):!1}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(t,e,i){this.currentPriority=i,this.currentGroup=t,this.currentIndex=e}setReserved(t,e,i){this.reservePriority=i,this.reservedGroup=t,this.reservedIndex=e}setReservedIdle(t,e){this.reservedIdleGroup=t,this.reservedIdleIndex=e}isActive(t,e){return t===this.currentGroup&&e===this.currentIndex||t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return this.currentGroup===void 0&&this.reservedIdleGroup===void 0}shouldOverrideExpression(){return!w.preserveExpressionOnMotion&&this.currentPriority>1}dump(t,e){if(this.debug){const i=["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"];return`
1
+ import{C as De,O as Ae,A as Be,P as ke,M as ft,T as Re,E as kt,u as Rt,a as bt}from"./index-R1tKotR6.js";var W=Math.pow,I=(s,t,e)=>new Promise((i,r)=>{var a=l=>{try{o(e.next(l))}catch(h){r(h)}},n=l=>{try{o(e.throw(l))}catch(h){r(h)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,n);o((e=e.apply(s,t)).next())});const Zt=2,Kt=2;var ct;(s=>{s.supportMoreMaskDivisions=!0,s.setOpacityFromMotion=!1})(ct||(ct={}));var w;(s=>{s.LOG_LEVEL_VERBOSE=0,s.LOG_LEVEL_WARNING=1,s.LOG_LEVEL_ERROR=2,s.LOG_LEVEL_NONE=999,s.logLevel=s.LOG_LEVEL_WARNING,s.sound=!0,s.motionSync=!0,s.motionFadingDuration=500,s.idleMotionFadingDuration=2e3,s.expressionFadingDuration=500,s.preserveExpressionOnMotion=!0,s.cubism4=ct,s.legacyExpressionBlendMode=!1})(w||(w={}));const C={log(s,...t){w.logLevel<=w.LOG_LEVEL_VERBOSE&&console.log(`[${s}]`,...t)},warn(s,...t){w.logLevel<=w.LOG_LEVEL_WARNING&&console.warn(`[${s}]`,...t)},error(s,...t){w.logLevel<=w.LOG_LEVEL_ERROR&&console.error(`[${s}]`,...t)}};function yt(s,t,e){return s<t?t:s>e?e:s}function Oe(s,t){return Math.random()*(t-s)+s}function rt(s,t,e,i,r){const a=t[i];a!==null&&typeof a===s&&(e[r]=a)}function at(s,t,e,i,r){const a=t[i];Array.isArray(a)&&(e[r]=a.filter(n=>n!==null&&typeof n===s))}function me(s,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(i=>{i!=="constructor"&&Object.defineProperty(s.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))})})}function Ue(s){let t=s.lastIndexOf("/");return t!=-1&&(s=s.slice(0,t)),t=s.lastIndexOf("/"),t!==-1&&(s=s.slice(t+1)),s}function Ve(s,t){const e=s.indexOf(t);e!==-1&&s.splice(e,1)}class Ot extends kt{constructor(t,e){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=t,this.tag=`ExpressionManager(${t.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(t){return I(this,null,function*(){if(!this.definitions[t]){C.warn(this.tag,`Undefined expression at [${t}]`);return}if(this.expressions[t]===null){C.warn(this.tag,`Cannot set expression at [${t}] because it's already failed in loading.`);return}if(this.expressions[t])return this.expressions[t];const e=yield this._loadExpression(t);return this.expressions[t]=e,e})}_loadExpression(t){throw new Error("Not implemented.")}setRandomExpression(){return I(this,null,function*(){if(this.definitions.length){const t=[];for(let e=0;e<this.definitions.length;e++)this.expressions[e]!==null&&this.expressions[e]!==this.currentExpression&&e!==this.reserveExpressionIndex&&t.push(e);if(t.length){const e=Math.floor(Math.random()*t.length);return this.setExpression(e)}}return!1})}resetExpression(){this._setExpression(this.defaultExpression)}restoreExpression(){this._setExpression(this.currentExpression)}setExpression(t){return I(this,null,function*(){if(typeof t!="number"&&(t=this.getExpressionIndex(t)),!(t>-1&&t<this.definitions.length)||t===this.expressions.indexOf(this.currentExpression))return!1;this.reserveExpressionIndex=t;const e=yield this.loadExpression(t);return!e||this.reserveExpressionIndex!==t?!1:(this.reserveExpressionIndex=-1,this.currentExpression=e,this._setExpression(e),!0)})}update(t,e){return this.isFinished()?!1:this.updateParameters(t,e)}destroy(){this.destroyed=!0,this.emit("destroy");const t=this;t.definitions=void 0,t.expressions=void 0}}const Qt=.01,Ne=40/7.5,Ge=1/(.15*1e3);class ze{constructor(){this.targetX=0,this.targetY=0,this.x=0,this.y=0,this.vx=0,this.vy=0}focus(t,e,i=!1){this.targetX=yt(t,-1,1),this.targetY=yt(e,-1,1),i&&(this.x=this.targetX,this.y=this.targetY)}update(t){const e=this.targetX-this.x,i=this.targetY-this.y;if(Math.abs(e)<Qt&&Math.abs(i)<Qt)return;const r=Math.sqrt(W(e,2)+W(i,2)),a=Ne/(1e3/t);let n=a*(e/r)-this.vx,o=a*(i/r)-this.vy;const l=Math.sqrt(W(n,2)+W(o,2)),h=a*Ge*t;l>h&&(n*=h/l,o*=h/l),this.vx+=n,this.vy+=o;const u=Math.sqrt(W(this.vx,2)+W(this.vy,2)),c=.5*(Math.sqrt(W(h,2)+8*h*r)-h);u>c&&(this.vx*=c/u,this.vy*=c/u),this.x+=this.vx,this.y+=this.vy}}class vt{constructor(t){this.json=t;let e=t.url;if(typeof e!="string")throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=e,this.name=Ue(this.url)}resolveURL(t){return Rt.resolve(this.url,t)}replaceFiles(t){this.moc=t(this.moc,"moc"),this.pose!==void 0&&(this.pose=t(this.pose,"pose")),this.physics!==void 0&&(this.physics=t(this.physics,"physics"));for(let e=0;e<this.textures.length;e++)this.textures[e]=t(this.textures[e],`textures[${e}]`)}getDefinedFiles(){const t=[];return this.replaceFiles(e=>(t.push(e),e)),t}validateFiles(t){const e=(a,n)=>{const o=this.resolveURL(a);if(!t.includes(o)){if(n)throw new Error(`File "${a}" is defined in settings, but doesn't exist in given files`);return!1}return!0};return[this.moc,...this.textures].forEach(a=>e(a,!0)),this.getDefinedFiles().filter(a=>e(a,!1))}}var Et=(s=>(s[s.NONE=0]="NONE",s[s.IDLE=1]="IDLE",s[s.NORMAL=2]="NORMAL",s[s.FORCE=3]="FORCE",s))(Et||{});class Xe{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(t,e,i){if(i<=0)return C.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(t===this.currentGroup&&e===this.currentIndex)return C.log(this.tag,"Motion is already playing.",this.dump(t,e)),!1;if(t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex)return C.log(this.tag,"Motion is already reserved.",this.dump(t,e)),!1;if(i===1){if(this.currentPriority!==0)return C.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,e)),!1;if(this.reservedIdleGroup!==void 0)return C.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(t,e)),!1;this.setReservedIdle(t,e)}else{if(i<3){if(i<=this.currentPriority)return C.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(t,e)),!1;if(i<=this.reservePriority)return C.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(t,e)),!1}this.setReserved(t,e,i)}return!0}start(t,e,i,r){if(r===1){if(this.setReservedIdle(void 0,void 0),this.currentPriority!==0)return C.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,i)),!1}else{if(e!==this.reservedGroup||i!==this.reservedIndex)return C.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(e,i)),!1;this.setReserved(void 0,void 0,0)}return t?(this.setCurrent(e,i,r),!0):!1}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(t,e,i){this.currentPriority=i,this.currentGroup=t,this.currentIndex=e}setReserved(t,e,i){this.reservePriority=i,this.reservedGroup=t,this.reservedIndex=e}setReservedIdle(t,e){this.reservedIdleGroup=t,this.reservedIdleIndex=e}isActive(t,e){return t===this.currentGroup&&e===this.currentIndex||t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return this.currentGroup===void 0&&this.reservedIdleGroup===void 0}shouldOverrideExpression(){return!w.preserveExpressionOnMotion&&this.currentPriority>1}dump(t,e){if(this.debug){const i=["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"];return`
2
2
  <Requested> group = "${t}", index = ${e}
3
3
  `+i.map(r=>"["+r+"] "+this[r]).join(`
4
4
  `)}return""}}const je="SoundManager",We=.5;class Z{static get volume(){return this._volume}static set volume(t){this._volume=(t>1?1:t<0?0:t)||0,this.audios.forEach(e=>e.volume=this._volume)}static add(t,e,i){const r=new Audio(t);return r.volume=this._volume,r.preload="auto",r.addEventListener("ended",()=>{this.dispose(r),e==null||e()}),r.addEventListener("error",a=>{this.dispose(r),C.warn(je,`Error occurred on "${t}"`,a.error),i==null||i(a.error)}),this.audios.push(r),r}static play(t){return new Promise((e,i)=>{var r;(r=t.play())==null||r.catch(a=>{t.dispatchEvent(new ErrorEvent("error",{error:a})),i(a)}),t.readyState===t.HAVE_ENOUGH_DATA?e():t.addEventListener("canplaythrough",e)})}static dispose(t){t.pause(),t.removeAttribute("src"),Ve(this.audios,t)}static destroy(){for(let t=this.audios.length-1;t>=0;t--)this.dispose(this.audios[t])}}Z.audios=[];Z._volume=We;class Mt extends kt{constructor(t,e){super(),this.motionGroups={},this.state=new Xe,this.playing=!1,this.destroyed=!1,this.settings=t,this.tag=`MotionManager(${t.name})`,this.state.tag=this.tag}init(t){t!=null&&t.idleMotionGroup&&(this.groups.idle=t.idleMotionGroup),this.setupMotions(t),this.stopAllMotions()}setupMotions(t){for(const i of Object.keys(this.definitions))this.motionGroups[i]=[];let e;switch(t==null?void 0:t.motionPreload){case"NONE":return;case"ALL":e=Object.keys(this.definitions);break;case"IDLE":default:e=[this.groups.idle];break}for(const i of e)if(this.definitions[i])for(let r=0;r<this.definitions[i].length;r++)this.loadMotion(i,r).then()}loadMotion(t,e){return I(this,null,function*(){var i;if(!((i=this.definitions[t])!=null&&i[e])){C.warn(this.tag,`Undefined motion at "${t}"[${e}]`);return}if(this.motionGroups[t][e]===null){C.warn(this.tag,`Cannot start motion at "${t}"[${e}] because it's already failed in loading.`);return}if(this.motionGroups[t][e])return this.motionGroups[t][e];const r=yield this._loadMotion(t,e);if(!this.destroyed)return this.motionGroups[t][e]=r??null,r})}_loadMotion(t,e){throw new Error("Not implemented.")}startMotion(t,e){return I(this,arguments,function*(i,r,a=Et.NORMAL){var n;if(!this.state.reserve(i,r,a))return!1;const o=(n=this.definitions[i])==null?void 0:n[r];if(!o)return!1;this.currentAudio&&Z.dispose(this.currentAudio);let l;if(w.sound){const u=this.getSoundFile(o);if(u)try{l=Z.add(this.settings.resolveURL(u),()=>this.currentAudio=void 0,()=>this.currentAudio=void 0),this.currentAudio=l}catch(c){C.warn(this.tag,"Failed to create audio",u,c)}}const h=yield this.loadMotion(i,r);if(l){const u=Z.play(l).catch(c=>C.warn(this.tag,"Failed to play audio",l.src,c));w.motionSync&&(yield u)}return this.state.start(h,i,r,a)?(C.log(this.tag,"Start motion:",this.getMotionName(o)),this.emit("motionStart",i,r,l),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(h),!0):(l&&(Z.dispose(l),this.currentAudio=void 0),!1)})}startRandomMotion(t,e){return I(this,null,function*(){const i=this.definitions[t];if(i!=null&&i.length){const r=[];for(let a=0;a<i.length;a++)this.motionGroups[t][a]!==null&&!this.state.isActive(t,a)&&r.push(a);if(r.length){const a=Math.floor(Math.random()*r.length);return this.startMotion(t,r[a],e)}}return!1})}stopAllMotions(){this._stopAllMotions(),this.state.reset(),this.currentAudio&&(Z.dispose(this.currentAudio),this.currentAudio=void 0)}update(t,e){var i;return this.isFinished()&&(this.playing&&(this.playing=!1,this.emit("motionFinish")),this.state.shouldOverrideExpression()&&((i=this.expressionManager)==null||i.restoreExpression()),this.state.complete(),this.state.shouldRequestIdleMotion()&&this.startRandomMotion(this.groups.idle,Et.IDLE)),this.updateParameters(t,e)}destroy(){var t;this.destroyed=!0,this.emit("destroy"),this.stopAllMotions(),(t=this.expressionManager)==null||t.destroy();const e=this;e.definitions=void 0,e.motionGroups=void 0}}const pe={blinkInterval:24*60*60*1e3,blinkIntervalRandom:1e3,closingDuration:100,closedDuration:50,openingDuration:150},Ye={x:0,y:0,width:0,height:0};class _e extends kt{constructor(){super(...arguments),this.focusController=new ze,this.originalWidth=0,this.originalHeight=0,this.width=0,this.height=0,this.localTransform=new ft,this.drawingMatrix=new ft,this.hitAreas={},this.textureFlipY=!1,this.viewport=[0,0,0,0],this.destroyed=!1}init(){this.setupLayout(),this.setupHitAreas()}setupLayout(){const t=this,e=this.getSize();t.originalWidth=e[0],t.originalHeight=e[1];const i=Object.assign({width:Zt,height:Kt},this.getLayout());this.localTransform.scale(i.width/Zt,i.height/Kt),t.width=this.originalWidth*this.localTransform.a,t.height=this.originalHeight*this.localTransform.d;const r=i.x!==void 0&&i.x-i.width/2||i.centerX!==void 0&&i.centerX||i.left!==void 0&&i.left-i.width/2||i.right!==void 0&&i.right+i.width/2||0,a=i.y!==void 0&&i.y-i.height/2||i.centerY!==void 0&&i.centerY||i.top!==void 0&&i.top-i.height/2||i.bottom!==void 0&&i.bottom+i.height/2||0;this.localTransform.translate(this.width*r,-this.height*a)}setupHitAreas(){const t=this.getHitAreaDefs().filter(e=>e.index>=0);for(const e of t)this.hitAreas[e.name]=e}hitTest(t,e){return Object.keys(this.hitAreas).filter(i=>this.isHit(i,t,e))}isHit(t,e,i){if(!this.hitAreas[t])return!1;const r=this.hitAreas[t].index,a=this.getDrawableBounds(r,Ye);return a.x<=e&&e<=a.x+a.width&&a.y<=i&&i<=a.y+a.height}getDrawableBounds(t,e){const i=this.getDrawableVertices(t);let r=i[0],a=i[0],n=i[1],o=i[1];for(let l=0;l<i.length;l+=2){const h=i[l],u=i[l+1];r=Math.min(h,r),a=Math.max(h,a),n=Math.min(u,n),o=Math.max(u,o)}return e??(e={}),e.x=r,e.y=n,e.width=a-r,e.height=o-n,e}updateTransform(t){this.drawingMatrix.copyFrom(t).append(this.localTransform)}update(t,e){this.focusController.update(t)}destroy(){this.destroyed=!0,this.emit("destroy"),this.motionManager.destroy(),this.motionManager=void 0}}const He="XHRLoader";class te extends Error{constructor(t,e,i,r=!1){super(t),this.url=e,this.status=i,this.aborted=r}}const E=class{static createXHR(s,t,e,i,r){const a=new XMLHttpRequest;if(E.allXhrSet.add(a),s){let n=E.xhrMap.get(s);n?n.add(a):(n=new Set([a]),E.xhrMap.set(s,n)),s.listeners("destroy").includes(E.cancelXHRs)||s.once("destroy",E.cancelXHRs)}return a.open("GET",t),a.responseType=e,a.onload=()=>{(a.status===200||a.status===0)&&a.response?i(a.response):a.onerror()},a.onerror=()=>{C.warn(He,`Failed to load resource as ${a.responseType} (Status ${a.status}): ${t}`),r(new te("Network error.",t,a.status))},a.onabort=()=>r(new te("Aborted.",t,a.status,!0)),a.onloadend=()=>{var n;E.allXhrSet.delete(a),s&&((n=E.xhrMap.get(s))==null||n.delete(a))},a}static cancelXHRs(){var s;(s=E.xhrMap.get(this))==null||s.forEach(t=>{t.abort(),E.allXhrSet.delete(t)}),E.xhrMap.delete(this)}static release(){E.allXhrSet.forEach(s=>s.abort()),E.allXhrSet.clear(),E.xhrMap=new WeakMap}};let Pt=E;Pt.xhrMap=new WeakMap;Pt.allXhrSet=new Set;Pt.loader=(s,t)=>new Promise((e,i)=>{E.createXHR(s.target,s.settings?s.settings.resolveURL(s.url):s.url,s.type,a=>{s.result=a,e()},i).send()});function fe(s,t){let e=-1;return i(0);function i(r,a){if(a)return Promise.reject(a);if(r<=e)return Promise.reject(new Error("next() called multiple times"));e=r;const n=s[r];if(!n)return Promise.resolve();try{return Promise.resolve(n(t,i.bind(null,r+1)))}catch(o){return Promise.reject(o)}}}class j{static load(t){return fe(this.middlewares,t).then(()=>t.result)}}j.middlewares=[Pt.loader];function qe(s,t={}){var e;const i={resourceOptions:{crossorigin:t.crossOrigin}};if(bt.fromURL)return bt.fromURL(s,i).catch(n=>{if(n instanceof Error)throw n;const o=new Error("Texture loading error");throw o.event=n,o});i.resourceOptions.autoLoad=!1;const r=bt.from(s,i);if(r.baseTexture.valid)return Promise.resolve(r);const a=r.baseTexture.resource;return(e=a._live2d_load)!=null||(a._live2d_load=new Promise((n,o)=>{const l=h=>{a.source.removeEventListener("error",l);const u=new Error("Texture loading error");u.event=h,o(u)};a.source.addEventListener("error",l),a.load().then(()=>n(r)).catch(l)})),a._live2d_load}const ee="Live2DFactory",ye=(s,t)=>I(void 0,null,function*(){if(typeof s.source=="string"){const e=yield j.load({url:s.source,type:"json",target:s.live2dModel});e.url=s.source,s.source=e,s.live2dModel.emit("settingsJSONLoaded",e)}return t()}),xe=(s,t)=>I(void 0,null,function*(){if(s.source instanceof vt)return s.settings=s.source,t();if(typeof s.source=="object"){const e=b.findRuntime(s.source);if(e){const i=e.createModelSettings(s.source);return s.settings=i,s.live2dModel.emit("settingsLoaded",i),t()}}throw new TypeError("Unknown settings format.")}),ve=(s,t)=>{if(s.settings){const e=b.findRuntime(s.settings);if(e)return e.ready().then(t)}return t()},Me=(s,t)=>I(void 0,null,function*(){yield t();const e=s.internalModel;if(e){const i=s.settings,r=b.findRuntime(i);if(r){const a=[];i.pose&&a.push(j.load({settings:i,url:i.pose,type:"json",target:e}).then(n=>{e.pose=r.createPose(e.coreModel,n),s.live2dModel.emit("poseLoaded",e.pose)}).catch(n=>{s.live2dModel.emit("poseLoadError",n),C.warn(ee,"Failed to load pose.",n)})),i.physics&&a.push(j.load({settings:i,url:i.physics,type:"json",target:e}).then(n=>{e.physics=r.createPhysics(e.coreModel,n),s.live2dModel.emit("physicsLoaded",e.physics)}).catch(n=>{s.live2dModel.emit("physicsLoadError",n),C.warn(ee,"Failed to load physics.",n)})),a.length&&(yield Promise.all(a))}}}),Pe=(s,t)=>I(void 0,null,function*(){if(s.settings){const e=s.live2dModel,i=s.settings.textures.map(r=>{const a=s.settings.resolveURL(r);return qe(a,{crossOrigin:s.options.crossOrigin})});if(yield t(),s.internalModel)e.internalModel=s.internalModel,e.emit("modelLoaded",s.internalModel);else throw new TypeError("Missing internal model.");e.textures=yield Promise.all(i),e.emit("textureLoaded",e.textures)}else throw new TypeError("Missing settings.")}),Ce=(s,t)=>I(void 0,null,function*(){const e=s.settings;if(e instanceof vt){const i=b.findRuntime(e);if(!i)throw new TypeError("Unknown model settings.");const r=yield j.load({settings:e,url:e.moc,type:"arraybuffer",target:s.live2dModel});if(!i.isValidMoc(r))throw new Error("Invalid moc data");const a=i.createCoreModel(r);return s.internalModel=i.createInternalModel(a,e,s.options),t()}throw new TypeError("Missing settings.")}),L=class{static registerRuntime(s){L.runtimes.push(s),L.runtimes.sort((t,e)=>e.version-t.version)}static findRuntime(s){for(const t of L.runtimes)if(t.test(s))return t}static setupLive2DModel(s,t,e){return I(this,null,function*(){const i=new Promise(n=>s.once("textureLoaded",n)),r=new Promise(n=>s.once("modelLoaded",n)),a=Promise.all([i,r]).then(()=>s.emit("ready"));yield fe(L.live2DModelMiddlewares,{live2dModel:s,source:t,options:e||{}}),yield a,s.emit("load")})}static loadMotion(s,t,e){var i,r;const a=n=>s.emit("motionLoadError",t,e,n);try{const n=(i=s.definitions[t])==null?void 0:i[e];if(!n)return Promise.resolve(void 0);s.listeners("destroy").includes(L.releaseTasks)||s.once("destroy",L.releaseTasks);let o=L.motionTasksMap.get(s);o||(o={},L.motionTasksMap.set(s,o));let l=o[t];l||(l=[],o[t]=l);const h=s.getMotionFile(n);return(r=l[e])!=null||(l[e]=j.load({url:h,settings:s.settings,type:s.motionDataType,target:s}).then(u=>{var c;const d=(c=L.motionTasksMap.get(s))==null?void 0:c[t];d&&delete d[e];const _=s.createMotion(u,t,n);return s.emit("motionLoaded",t,e,_),_}).catch(u=>{C.warn(s.tag,`Failed to load motion: ${h}
@@ -1 +1 @@
1
- import{r as F,W as U,C as _,b as z,a as D,S as L,c as E,B as J,R as Q}from"./index-EZxLQxgv.js";const X=""+new URL("cherryBlossoms-DzBBkOW8.webp",import.meta.url).href,G=(x,P,w,k,T,M,m)=>{const v=U.gameplay.pixiStage,S=P==="foreground"?v.foregroundEffectsContainer:v.backgroundEffectsContainer,p=E.width,a=E.height,c=new _;c.angle=m;const b=c.rotation,C=Math.abs(Math.cos(b)),h=Math.abs(Math.sin(b)),i=p*C+a*h,u=p*h+a*C;c.width=i,c.height=u,c.pivot.set(i/2,u/2),c.position.set(p/2,a/2),S.addChild(c);const r=new z(T,{scale:!0,position:!0,rotation:!0,uvs:!1,alpha:!0});c.addChild(r);const g=[],R=D.from(X),y=(d,l)=>d+Math.random()*(l-d);for(let d=0;d<T;d++){const l=Math.random()*Math.PI*2,n=L.from(R);n.anchor.set(.5),n.x=Math.random()*i,n.y=Math.random()*u,n.rotation=Math.random()*Math.PI*2,n.scale.set(Math.cos(l)*M,Math.sin(l)*M),n.speed=(y(.5,2)+y(.1,1))*w,n.rotationSpeed=Math.random()*.015*(Math.random()<.5?1:-1),n.positionPhase=Math.random()*Math.PI*2,n.scalePhase=l,g.push(n),r.addChild(n)}function I(d){const l=Date.now()/1e3;for(const n of g){const W=Math.sin(l+n.positionPhase)*k;n.x+=W*d,n.y+=n.speed*d,n.rotation+=n.rotationSpeed*d;const A=Math.cos(l+n.scalePhase)*M,B=Math.sin(l+n.scalePhase)*M;n.scale.set(A,B);const t=Math.abs(n.width*M),e=Math.abs(n.height*M);n.x+t/2<-i?n.x=i+t/2:n.x-t/2>i&&(n.x=-i-t/2),n.y-e/2>u&&(n.x=Math.random()*i,n.y=-Math.random()*50-e,n.positionPhase=Math.random()*Math.PI*2,n.scalePhase=Math.random()*Math.PI*2,n.speed=(y(.5,2)+y(.1,1))*w,n.rotationSpeed=Math.random()*.015*(Math.random()<.5?1:-1))}}return v.registerAnimation({setStartState:()=>{},setEndState:()=>{},tickerFunc:I},x),{container:c,tickerKey:x}};F("cherryBlossoms",{fg:()=>G("cherry-blossoms-foreground-ticker","foreground",2,3,100,.05,0),bg:()=>G("cherry-blossoms-background-ticker","background",1,2,300,.025,0)});const N=""+new URL("rain-Bd8ZRQ7x.png",import.meta.url).href,O=(x,P,w,k,T,M)=>{const m=U.gameplay.pixiStage;m.currentApp;const v=P==="foreground"?m.foregroundEffectsContainer:m.backgroundEffectsContainer,S=E.width,p=E.height,a=new _;a.angle=M;const c=a.rotation,b=Math.abs(Math.cos(c)),C=Math.abs(Math.sin(c)),h=S*b+p*C,i=S*C+p*b;a.width=h,a.height=i,a.pivot.set(h/2,i/2),a.position.set(S/2,p/2),v.addChild(a);const u=new z(k,{scale:!0,position:!0,rotation:!0,alpha:!0,uvs:!1});a.addChild(u);const r=[],g=[],R=128,y=640,I=5,d=[10,5,2,2,1],l=t=>{if(!t||t.length===0)return 0;const e=t.reduce((o,f)=>o+f,0);if(e<=0)return Math.floor(Math.random()*t.length);let s=Math.random()*e;for(let o=0;o<t.length;o++){if(s<t[o])return o;s-=t[o]}return t.length-1},n=(t,e=!1)=>{const s=Math.random()*.5+.5;t.scale.set(T*s),t.anchor.set(.5),e?(t.x=Math.random()*h,t.y=Math.random()*i):(t.x=Math.random()*h,t.y=-Math.random()*50-t.height),t.alpha=Math.random()*.5+.5,t.vy=(Math.random()*.4+.8)*w},W=()=>{let t;r.length===I?t=l(d):t=Math.floor(Math.random()*r.length),t=Math.max(0,Math.min(t,r.length-1));const e=new L(r[t]);return n(e,!0),e},A=t=>{for(const e of g)e.y+=e.vy*t,(e.y-e.height/2>i||e.x<-e.width||e.x>h+e.width)&&n(e,!1)};return(()=>{for(r.length=0;g.length>0;)g.pop();u.removeChildren();const t=J.from(N),e=()=>{var s;if(t.valid)for(let o=0;o<I;o++){const f=new Q(o*R,0,R,y);r.push(new D(t,f))}if(r.length===0){console.error("Failed to create any raindrop textures. Cannot create sprites.");return}(s=r[0])!=null&&s.valid||console.warn("First raindrop texture is invalid after creation. Sprites might not render correctly.");for(let o=0;o<k;o++){const f=W();u.addChild(f),g.push(f)}m.registerAnimation({setStartState:()=>{},setEndState:()=>{},tickerFunc:A},x)};t.valid?e():(t.once("loaded",()=>{e()}),t.once("error",s=>{console.error(`Error loading base texture ${N}:`,s),e()}))})(),{container:a,tickerKey:x}};F("rain",{fg:()=>O("rain-foreground-ticker","foreground",30,50,.4,1),bg:()=>O("rain-background-ticker","background",20,150,.3,1)});const $=""+new URL("snow-CJh9m2KR.png",import.meta.url).href,H=(x,P,w,k,T,M)=>{const m=U.gameplay.pixiStage;m.currentApp;const v=P==="foreground"?m.foregroundEffectsContainer:m.backgroundEffectsContainer,S=E.width,p=E.height,a=new _;a.angle=M;const c=a.rotation,b=Math.abs(Math.cos(c)),C=Math.abs(Math.sin(c)),h=S*b+p*C,i=S*C+p*b;a.width=h,a.height=i,a.pivot.set(h/2,i/2),a.position.set(S/2,p/2),v.addChild(a);const u=new z(k,{scale:!0,position:!0,rotation:!0,alpha:!0,uvs:!1});a.addChild(u);const r=[],g=[],R=128,y=128,I=10,d=[10,2,2,2,1,1,1,2,2,2],l=t=>{if(!t||t.length===0)return 0;const e=t.reduce((o,f)=>o+f,0);if(e<=0)return Math.floor(Math.random()*t.length);let s=Math.random()*e;for(let o=0;o<t.length;o++){if(s<t[o])return o;s-=t[o]}return t.length-1},n=(t,e=!1)=>{const s=Math.random()*.5+.5;t.scale.set(T*s),t.anchor.set(.5),e?(t.x=Math.random()*h,t.y=Math.random()*i):(t.x=Math.random()*h,t.y=-Math.random()*50-t.height),t.alpha=Math.random()*.2+.8,t.vy=(Math.random()*.4+.8)*w,t.vx=(Math.random()-.5)*.25*w,t.rotationSpeed=(Math.random()-.5)*.005},W=()=>{let t;r.length===I?t=l(d):t=Math.floor(Math.random()*r.length),t=Math.max(0,Math.min(t,r.length-1));const e=new L(r[t]);return n(e,!0),e},A=t=>{for(const e of g)e.y+=e.vy*t,e.x+=e.vx*t,e.rotation+=e.rotationSpeed*t,(e.y-e.height/2>i||e.x<-e.width||e.x>h+e.width)&&n(e,!1)};return(()=>{for(r.length=0;g.length>0;)g.pop();u.removeChildren();const t=J.from($),e=()=>{var s;if(t.valid)for(let o=0;o<I;o++){const f=new Q(o*R,0,R,y);r.push(new D(t,f))}if(r.length===0){console.error("Failed to create any snowflake textures. Cannot create sprites.");return}(s=r[0])!=null&&s.valid||console.warn("First snowflake texture is invalid after creation. Sprites might not render correctly.");for(let o=0;o<k;o++){const f=W();u.addChild(f),g.push(f)}m.registerAnimation({setStartState:()=>{},setEndState:()=>{},tickerFunc:A},x)};t.valid?e():(t.once("loaded",()=>{e()}),t.once("error",s=>{console.error(`Error loading base texture ${$}:`,s),e()}))})(),{container:a,tickerKey:x}};F("snow",{fg:()=>H("snow-foreground-ticker","foreground",3,250,.4,0),bg:()=>H("snow-background-ticker","background",1,750,.2,0)});F("heavySnow",{fg:()=>H("heavy-snow-foreground-ticker","foreground",20,1e3,.6,-75),bg:()=>H("heavy-snow-background-ticker","background",10,2e3,.3,-80)});
1
+ import{r as F,W as U,C as _,b as z,a as D,S as L,c as E,B as J,R as Q}from"./index-R1tKotR6.js";const X=""+new URL("cherryBlossoms-DzBBkOW8.webp",import.meta.url).href,G=(x,P,w,k,T,M,m)=>{const v=U.gameplay.pixiStage,S=P==="foreground"?v.foregroundEffectsContainer:v.backgroundEffectsContainer,p=E.width,a=E.height,c=new _;c.angle=m;const b=c.rotation,C=Math.abs(Math.cos(b)),h=Math.abs(Math.sin(b)),i=p*C+a*h,u=p*h+a*C;c.width=i,c.height=u,c.pivot.set(i/2,u/2),c.position.set(p/2,a/2),S.addChild(c);const r=new z(T,{scale:!0,position:!0,rotation:!0,uvs:!1,alpha:!0});c.addChild(r);const g=[],R=D.from(X),y=(d,l)=>d+Math.random()*(l-d);for(let d=0;d<T;d++){const l=Math.random()*Math.PI*2,n=L.from(R);n.anchor.set(.5),n.x=Math.random()*i,n.y=Math.random()*u,n.rotation=Math.random()*Math.PI*2,n.scale.set(Math.cos(l)*M,Math.sin(l)*M),n.speed=(y(.5,2)+y(.1,1))*w,n.rotationSpeed=Math.random()*.015*(Math.random()<.5?1:-1),n.positionPhase=Math.random()*Math.PI*2,n.scalePhase=l,g.push(n),r.addChild(n)}function I(d){const l=Date.now()/1e3;for(const n of g){const W=Math.sin(l+n.positionPhase)*k;n.x+=W*d,n.y+=n.speed*d,n.rotation+=n.rotationSpeed*d;const A=Math.cos(l+n.scalePhase)*M,B=Math.sin(l+n.scalePhase)*M;n.scale.set(A,B);const t=Math.abs(n.width*M),e=Math.abs(n.height*M);n.x+t/2<-i?n.x=i+t/2:n.x-t/2>i&&(n.x=-i-t/2),n.y-e/2>u&&(n.x=Math.random()*i,n.y=-Math.random()*50-e,n.positionPhase=Math.random()*Math.PI*2,n.scalePhase=Math.random()*Math.PI*2,n.speed=(y(.5,2)+y(.1,1))*w,n.rotationSpeed=Math.random()*.015*(Math.random()<.5?1:-1))}}return v.registerAnimation({setStartState:()=>{},setEndState:()=>{},tickerFunc:I},x),{container:c,tickerKey:x}};F("cherryBlossoms",{fg:()=>G("cherry-blossoms-foreground-ticker","foreground",2,3,100,.05,0),bg:()=>G("cherry-blossoms-background-ticker","background",1,2,300,.025,0)});const N=""+new URL("rain-Bd8ZRQ7x.png",import.meta.url).href,O=(x,P,w,k,T,M)=>{const m=U.gameplay.pixiStage;m.currentApp;const v=P==="foreground"?m.foregroundEffectsContainer:m.backgroundEffectsContainer,S=E.width,p=E.height,a=new _;a.angle=M;const c=a.rotation,b=Math.abs(Math.cos(c)),C=Math.abs(Math.sin(c)),h=S*b+p*C,i=S*C+p*b;a.width=h,a.height=i,a.pivot.set(h/2,i/2),a.position.set(S/2,p/2),v.addChild(a);const u=new z(k,{scale:!0,position:!0,rotation:!0,alpha:!0,uvs:!1});a.addChild(u);const r=[],g=[],R=128,y=640,I=5,d=[10,5,2,2,1],l=t=>{if(!t||t.length===0)return 0;const e=t.reduce((o,f)=>o+f,0);if(e<=0)return Math.floor(Math.random()*t.length);let s=Math.random()*e;for(let o=0;o<t.length;o++){if(s<t[o])return o;s-=t[o]}return t.length-1},n=(t,e=!1)=>{const s=Math.random()*.5+.5;t.scale.set(T*s),t.anchor.set(.5),e?(t.x=Math.random()*h,t.y=Math.random()*i):(t.x=Math.random()*h,t.y=-Math.random()*50-t.height),t.alpha=Math.random()*.5+.5,t.vy=(Math.random()*.4+.8)*w},W=()=>{let t;r.length===I?t=l(d):t=Math.floor(Math.random()*r.length),t=Math.max(0,Math.min(t,r.length-1));const e=new L(r[t]);return n(e,!0),e},A=t=>{for(const e of g)e.y+=e.vy*t,(e.y-e.height/2>i||e.x<-e.width||e.x>h+e.width)&&n(e,!1)};return(()=>{for(r.length=0;g.length>0;)g.pop();u.removeChildren();const t=J.from(N),e=()=>{var s;if(t.valid)for(let o=0;o<I;o++){const f=new Q(o*R,0,R,y);r.push(new D(t,f))}if(r.length===0){console.error("Failed to create any raindrop textures. Cannot create sprites.");return}(s=r[0])!=null&&s.valid||console.warn("First raindrop texture is invalid after creation. Sprites might not render correctly.");for(let o=0;o<k;o++){const f=W();u.addChild(f),g.push(f)}m.registerAnimation({setStartState:()=>{},setEndState:()=>{},tickerFunc:A},x)};t.valid?e():(t.once("loaded",()=>{e()}),t.once("error",s=>{console.error(`Error loading base texture ${N}:`,s),e()}))})(),{container:a,tickerKey:x}};F("rain",{fg:()=>O("rain-foreground-ticker","foreground",30,50,.4,1),bg:()=>O("rain-background-ticker","background",20,150,.3,1)});const $=""+new URL("snow-CJh9m2KR.png",import.meta.url).href,H=(x,P,w,k,T,M)=>{const m=U.gameplay.pixiStage;m.currentApp;const v=P==="foreground"?m.foregroundEffectsContainer:m.backgroundEffectsContainer,S=E.width,p=E.height,a=new _;a.angle=M;const c=a.rotation,b=Math.abs(Math.cos(c)),C=Math.abs(Math.sin(c)),h=S*b+p*C,i=S*C+p*b;a.width=h,a.height=i,a.pivot.set(h/2,i/2),a.position.set(S/2,p/2),v.addChild(a);const u=new z(k,{scale:!0,position:!0,rotation:!0,alpha:!0,uvs:!1});a.addChild(u);const r=[],g=[],R=128,y=128,I=10,d=[10,2,2,2,1,1,1,2,2,2],l=t=>{if(!t||t.length===0)return 0;const e=t.reduce((o,f)=>o+f,0);if(e<=0)return Math.floor(Math.random()*t.length);let s=Math.random()*e;for(let o=0;o<t.length;o++){if(s<t[o])return o;s-=t[o]}return t.length-1},n=(t,e=!1)=>{const s=Math.random()*.5+.5;t.scale.set(T*s),t.anchor.set(.5),e?(t.x=Math.random()*h,t.y=Math.random()*i):(t.x=Math.random()*h,t.y=-Math.random()*50-t.height),t.alpha=Math.random()*.2+.8,t.vy=(Math.random()*.4+.8)*w,t.vx=(Math.random()-.5)*.25*w,t.rotationSpeed=(Math.random()-.5)*.005},W=()=>{let t;r.length===I?t=l(d):t=Math.floor(Math.random()*r.length),t=Math.max(0,Math.min(t,r.length-1));const e=new L(r[t]);return n(e,!0),e},A=t=>{for(const e of g)e.y+=e.vy*t,e.x+=e.vx*t,e.rotation+=e.rotationSpeed*t,(e.y-e.height/2>i||e.x<-e.width||e.x>h+e.width)&&n(e,!1)};return(()=>{for(r.length=0;g.length>0;)g.pop();u.removeChildren();const t=J.from($),e=()=>{var s;if(t.valid)for(let o=0;o<I;o++){const f=new Q(o*R,0,R,y);r.push(new D(t,f))}if(r.length===0){console.error("Failed to create any snowflake textures. Cannot create sprites.");return}(s=r[0])!=null&&s.valid||console.warn("First snowflake texture is invalid after creation. Sprites might not render correctly.");for(let o=0;o<k;o++){const f=W();u.addChild(f),g.push(f)}m.registerAnimation({setStartState:()=>{},setEndState:()=>{},tickerFunc:A},x)};t.valid?e():(t.once("loaded",()=>{e()}),t.once("error",s=>{console.error(`Error loading base texture ${$}:`,s),e()}))})(),{container:a,tickerKey:x}};F("snow",{fg:()=>H("snow-foreground-ticker","foreground",3,250,.4,0),bg:()=>H("snow-background-ticker","background",1,750,.2,0)});F("heavySnow",{fg:()=>H("heavy-snow-foreground-ticker","foreground",20,1e3,.6,-75),bg:()=>H("heavy-snow-background-ticker","background",10,2e3,.3,-80)});
package/dist/index.html CHANGED
@@ -136,7 +136,7 @@
136
136
  }
137
137
 
138
138
  </style>
139
- <script type="module" crossorigin src="./assets/index-EZxLQxgv.js"></script>
139
+ <script type="module" crossorigin src="./assets/index-R1tKotR6.js"></script>
140
140
  <link rel="stylesheet" crossorigin href="./assets/index-Dch1g2w9.css">
141
141
  </head>
142
142
  <body>
@@ -2,9 +2,9 @@
2
2
  "schemaVersion": "1.0.0",
3
3
  "id": "open-webgal.webgal",
4
4
  "name": "WebGAL",
5
- "version": "4.6.3",
5
+ "version": "4.6.4",
6
6
  "type": "official",
7
- "webgalVersion": "4.6.3",
7
+ "webgalVersion": "4.6.4",
8
8
  "description": "界面美观、功能强大、易于开发的全新网页端视觉小说引擎",
9
9
  "descriptions": {
10
10
  "en": "A brand new web Visual Novel engine with a beautiful interface, powerful features, and easy development",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webgal-engine",
3
- "version": "4.6.3",
3
+ "version": "4.6.4",
4
4
  "scripts": {
5
5
  "dev": "vite --host --port 3000",
6
6
  "build": "node scripts/update-engine-version.js && cross-env NODE_ENV=production tsc && vite build --base=./",
Binary file
Binary file