@drincs/pixi-vn
Version:
Pixi'VN is a npm package that provides various features for creating visual novels.
1 lines • 6.47 kB
JavaScript
var u=Object.defineProperty;var g=(l,t,i)=>t in l?u(l,t,{enumerable:true,configurable:true,writable:true,value:i}):l[t]=i;var a=(l,t,i)=>g(l,typeof t!="symbol"?t+"":t,i);var n;(m=>(m.log=(o,...s)=>console.log(`[Pixi\u2019VN] ${o}`,...s),m.warn=(o,...s)=>console.warn(`[Pixi\u2019VN] ${o}`,...s),m.error=(o,...s)=>console.error(`[Pixi\u2019VN] ${o}`,...s),m.info=(o,...s)=>console.info(`[Pixi\u2019VN] ${o}`,...s)))(n||(n={}));var r=class extends Error{constructor(i,d,m,o,s){super(`[Pixi\u2019VN] ${d}`);a(this,"code");a(this,"canvasElementInfo");a(this,"parent");this.code=i,m==="canvas"&&(this.canvasElementInfo=o,this.parent=s);}};var e=class e{static init(t){t.navigate&&(e._navigate=t.navigate),e._getStepCounter=t.getStepCounter,e._setStepCounter=t.setStepCounter,e._getCurrentGameStepState=t.getCurrentGameStepState,e._restoreGameStepState=t.restoreGameStepState,e._getOpenedLabels=t.getOpenedLabels,e._processNavigationRequests=t.processNavigationRequests,e._getVariable=t.getVariable,e._setVariable=t.setVariable,e._removeVariable=t.removeVariable,e._getFlag=t.getFlag,e._setFlag=t.setFlag,t.onLabelClosing&&(e._onLabelClosing=t.onLabelClosing),e._addHistoryItem=t.addHistoryItem,e._getCharacter=t.getCharacter,e._animate=t.animate;}static get navigate(){return e._navigate}static set navigate(t){e._navigate=t;}static get stepCounter(){return e._getStepCounter()}static set stepCounter(t){e._setStepCounter(t);}static get currentGameStepState(){return e._getCurrentGameStepState()}static get restoreGameStepState(){return e._restoreGameStepState}static get openedLabels(){return e._getOpenedLabels()}static addOnPreContinue(t){e._onPreContinueHandlers.push(t);}static removeOnPreContinue(t){e._onPreContinueHandlers=e._onPreContinueHandlers.filter(i=>i!==t);}static clearOnPreContinueHandlers(){e._onPreContinueHandlers=[];}static async runOnPreContinue(){let t=e._onPreContinueHandlers.slice();await Promise.all(t.map(i=>i()));}static get onPreContinue(){return e.runOnPreContinue}static get continueRequestsCount(){return e.navigationRequestsCount}static increaseContinueRequest(t=1){e.navigationRequestsCount+=t;}static get backRequestsCount(){return -1*e.navigationRequestsCount}static increaseBackRequest(t=1){e.navigationRequestsCount-=t;}static async processNavigationRequests(t){let i=e._processNavigationRequests(e.navigationRequestsCount,t);return e.navigationRequestsCount=i.newValue,await i.result}static get getVariable(){return e._getVariable}static get setVariable(){return e._setVariable}static get removeVariable(){return e._removeVariable}static get getFlag(){return e._getFlag}static get setFlag(){return e._setFlag}static get onLabelClosing(){return e._onLabelClosing}static get addHistoryItem(){return e._addHistoryItem}static get getCharacter(){return e._getCharacter}static addOnError(t){return e._onErrorHandlers.push(t),()=>e.removeOnError(t)}static removeOnError(t){e._onErrorHandlers=e._onErrorHandlers.filter(i=>i!==t);}static clearOnErrorHandlers(){e._onErrorHandlers.length=0;}static async runOnError(t,i){for(let d of e._onErrorHandlers.slice())try{await d(t,i);}catch(m){n.error("Error in onError handler",m);}}static get animate(){return e._animate}};a(e,"_navigate",()=>{n.warn("Navigate function not initialized. You should add the navigate function in the Game.init() method.");}),a(e,"_getStepCounter",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_setStepCounter",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_getCurrentGameStepState",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_restoreGameStepState",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_getOpenedLabels",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_onPreContinueHandlers",[]),a(e,"navigationRequestsCount",0),a(e,"processNavigationLock",Promise.resolve()),a(e,"_processNavigationRequests",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_getVariable",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_setVariable",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_removeVariable",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_getFlag",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_setFlag",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"_onLabelClosing",()=>{}),a(e,"_addHistoryItem",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")}),a(e,"runningStepsCount",0),a(e,"_getCharacter",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented.")}),a(e,"onEnd"),a(e,"_onErrorHandlers",[]),a(e,"_animate",()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new r("not_implemented","Method not implemented, you should initialize the Game: Game.init()")});var p=e;export{p as GameUnifier,r as PixiError};