UNPKG

@drincs/pixi-vn

Version:

Pixi'VN is a npm package that provides various features for creating visual novels.

1 lines 1.9 kB
import {b}from'./chunk-HACUDOYJ.mjs';import {a}from'./chunk-ZW3MIPMS.mjs';import {n}from'./chunk-IWAXXFXE.mjs';import {j,d as d$1}from'./chunk-D45QSSXG.mjs';var l="@",i=class extends b{constructor(e,r=""){super(n.CHARACTER_CATEGORY_KEY,e+(r?l+r:""));d$1(this,"sourceId");this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var u=class extends i{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);d$1(this,"defaultName");d$1(this,"defaultSurname");d$1(this,"defaultAge");d$1(this,"_icon");d$1(this,"_color");this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this._icon=r.icon,this._color=r.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}get icon(){return this._icon}get color(){return this._color}};var s=new a({cacheSize:10}),d;(C=>{function f(t){try{let n=s.get(t);if(!n){j.warn(`Character "${t}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return n}catch(n){j.error(`Error while getting Character "${t}"`,n);return}}C.get=f;function g(t){if(Array.isArray(t)){t.forEach(n=>g(n));return}s.get(t.id)&&j.info(`Character id "${t.id}" already exists, it will be overwritten`),s.set(t.id,t);}C.add=g;function e(){return Array.from(s.values())}C.values=e;function r(t){return s.has(t)}C.has=r;function S(){return Array.from(s.keys())}C.keys=S;})(d||(d={}));var p=d;export{u as CharacterBaseModel,i as CharacterStoredClass,p as RegisteredCharacters};