pixi-vn-migration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePixi'VN Migration guide
Pixi'VN 迁移指南
Official docs: pixi-vn.com/faq/migration. That page also covers
the separate and packages — this skill only covers the core
package (the section of that page), since that's what this skill set documents.
nqtrpixi-vn-ink@drincs/pixi-vn## pixi-vn官方文档:pixi-vn.com/faq/migration。该页面还涵盖独立的 和 包——本 skill 仅涵盖核心 包(该页面的 部分),因为这正是此 skill 集所记录的内容。
nqtrpixi-vn-ink@drincs/pixi-vn## pixi-vnWhen to use this skill
何时使用此 skill
Use this skill whenever a task is "upgrade this project's from version X to the
latest", or a developer hits an error that looks like a removed/renamed API. Check the currently
installed version first ( dependency, or /
at runtime — see ), then walk forward through only the version sections
below that fall between the installed version and the target — most of these changes don't apply
unless a project is crossing that specific boundary.
@drincs/pixi-vnpackage.jsonPIXIVN_VERSIONGameState.pixivn_versionpixi-vn-getting-started当任务为“将此项目的 从版本 X 升级到最新版本”,或开发者遇到看起来像 API 被移除或重命名的错误时,使用此 skill。先检查当前安装的版本( 依赖,或运行时的 /——参见 ),然后只向前遍历下面那些处于已安装版本与目标版本之间的版本章节——除非项目恰好跨越特定边界,否则大多数变更都不适用。
@drincs/pixi-vnpackage.jsonPIXIVN_VERSIONGameState.pixivn_versionpixi-vn-getting-startedv1.9.3 → v1.9.4 — canvas transitions/effects namespaces, top-level tickers
tickersv1.9.3 → v1.9.4——Canvas 过渡/效果命名空间、顶层 tickers
tickersCanvas transitions and effects namespaces
Canvas 过渡和效果命名空间
Canvas transition helpers and canvas effects are now also grouped under discoverable namespaces:
contains , , , , , ,
, , , and ; contains .
transitionsshowWithDissolveshowWithFademoveInmoveOutzoomInzoomOutpushInpushOutremoveWithDissolveremoveWithFadeeffectsshakeEffectThe previous flat exports remain available in v1.9.4 for compatibility, but are deprecated. Update
imports and calls when migrating:
ts
import { moveIn, shakeEffect, zoomIn } from "@drincs/pixi-vn"; // [!code --]
import { effects, transitions } from "@drincs/pixi-vn"; // [!code ++]
await zoomIn("alice", "alice"); // [!code --]
await transitions.zoomIn("alice", "alice"); // [!code ++]
await moveIn("alice", "alice"); // [!code --]
await transitions.moveIn("alice", "alice"); // [!code ++]
shakeEffect("alice"); // [!code --]
effects.shakeEffect("alice"); // [!code ++]The transition and effect behavior and their options are unchanged. This is an organizational API
change intended to make canvas helpers easier to discover. The existing module entry points remain
valid; the same namespaces are available from .
@drincs/pixi-vn/canvasCanvas 过渡辅助函数和 Canvas 效果现在也被归入易于发现的命名空间:
包含 、、、、、、
、、 和 ; 包含 。
transitionsshowWithDissolveshowWithFademoveInmoveOutzoomInzoomOutpushInpushOutremoveWithDissolveremoveWithFadeeffectsshakeEffect在 v1.9.4 中,之前的扁平导出仍可使用以保持兼容,但已被弃用。迁移时请更新
import 和调用方式:
ts
import { moveIn, shakeEffect, zoomIn } from "@drincs/pixi-vn"; // [!code --]
import { effects, transitions } from "@drincs/pixi-vn"; // [!code ++]
await zoomIn("alice", "alice"); // [!code --]
await transitions.zoomIn("alice", "alice"); // [!code ++]
await moveIn("alice", "alice"); // [!code --]
await transitions.moveIn("alice", "alice"); // [!code ++]
shakeEffect("alice"); // [!code --]
effects.shakeEffect("alice"); // [!code ++]过渡和效果的行为及其选项均未改变。这是一项组织形式的 API 变更,旨在让 Canvas
辅助函数更容易被发现。现有的模块入口仍然有效;同样的命名空间也可从
获得。
@drincs/pixi-vn/canvascanvas.tickers
→ top-level tickers
canvas.tickerstickerscanvas.tickers
→ 顶层 tickers
canvas.tickerstickersTicker management is no longer part of the canvas manager: it's its own singleton,
exported from next to , , etc. still works in
v1.9.4 — it just forwards to — but it's deprecated. The methods and their arguments are
unchanged; only the receiver changes:
tickers@drincs/pixi-vncanvassoundcanvas.tickerstickersts
import { canvas } from "@drincs/pixi-vn"; // [!code --]
import { tickers } from "@drincs/pixi-vn"; // [!code ++]
canvas.tickers.add("alien", new RotateTicker({ speed: 0.2 })); // [!code --]
tickers.add("alien", new RotateTicker({ speed: 0.2 })); // [!code ++]
canvas.tickers.pause({ canvasAlias: "alien" }); // [!code --]
tickers.pause({ canvasAlias: "alien" }); // [!code ++]
await canvas.tickers.forceCompletion(id); // [!code --]
await tickers.forceCompletion(id); // [!code ++]The same applies to every other member (, , , , ,
, , , , , ,
). The type is likewise a deprecated alias of the new
:
addSequencefindremoveremoveAllresumeisPausedunlinkComponenttransfercompleteOnStepEndonCompletecurrentTickerscurrentTickersStepsCanvasTickersInterfaceTickersInterfacets
import type { CanvasTickersInterface } from "@drincs/pixi-vn"; // [!code --]
import type { TickersInterface } from "@drincs/pixi-vn"; // [!code ++]TickerBasetickerDecoratorRegisteredTickersTicker*@drincs/pixi-vnOnly code that reached into canvas internals breaks: the ticker bookkeeping on
(, , ,
, , ,
, , ) moved to the
namespace, where the two former getters are now functions:
CanvasManagerStatic_currentTickers_currentTickersSequence_currentTickersTimeouts_tickersToCompleteOnStepEndcurrentTickersWithoutCreatedByStepscurrentTickersSequencegenerateTickerIdaddTickerTimeoutInforemoveTickerTimeout*TickersManagerStaticts
CanvasManagerStatic._currentTickers; // [!code --]
TickersManagerStatic._currentTickers; // [!code ++]
CanvasManagerStatic.currentTickersSequence; // [!code --]
TickersManagerStatic.currentTickersSequence(); // [!code ++]Prefer the public / over either.
tickers.currentTickerstickers.currentTickersStepsTicker 管理不再属于 Canvas 管理器,而是成为独立的 单例,
从 与 、 等一起导出。在 v1.9.4 中, 仍然可用——
它只会转发到 ——但已被弃用。方法及其参数未改变;只有调用接收者发生了变化:
tickers@drincs/pixi-vncanvassoundcanvas.tickerstickersts
import { canvas } from "@drincs/pixi-vn"; // [!code --]
import { tickers } from "@drincs/pixi-vn"; // [!code ++]
canvas.tickers.add("alien", new RotateTicker({ speed: 0.2 })); // [!code --]
tickers.add("alien", new RotateTicker({ speed: 0.2 })); // [!code ++]
canvas.tickers.pause({ canvasAlias: "alien" }); // [!code --]
tickers.pause({ canvasAlias: "alien" }); // [!code ++]
await canvas.tickers.forceCompletion(id); // [!code --]
await tickers.forceCompletion(id); // [!code ++]同样的变化也适用于所有其他成员(、、、、、
、、、、、、
)。类型 同样是新 的弃用别名:
addSequencefindremoveremoveAllresumeisPausedunlinkComponenttransfercompleteOnStepEndonCompletecurrentTickerscurrentTickersStepsCanvasTickersInterfaceTickersInterfacets
import type { CanvasTickersInterface } from "@drincs/pixi-vn"; // [!code --]
import type { TickersInterface } from "@drincs/pixi-vn"; // [!code ++]TickerBasetickerDecoratorRegisteredTickersTicker*@drincs/pixi-vn只有访问 Canvas 内部实现的代码会受到影响: 上的 Ticker 管理状态
(、、、
、、、
、、)已移至
命名空间,原有两个 getter 现在是函数:
CanvasManagerStatic_currentTickers_currentTickersSequence_currentTickersTimeouts_tickersToCompleteOnStepEndcurrentTickersWithoutCreatedByStepscurrentTickersSequencegenerateTickerIdaddTickerTimeoutInforemoveTickerTimeout*TickersManagerStaticts
CanvasManagerStatic._currentTickers; // [!code --]
TickersManagerStatic._currentTickers; // [!code ++]
CanvasManagerStatic.currentTickersSequence; // [!code --]
TickersManagerStatic.currentTickersSequence(); // [!code ++]优先使用公开的 /,而不是上述任一方式。
tickers.currentTickerstickers.currentTickersStepsv1.8.x → v1.9.0 — long-deprecated APIs removed
v1.8.x → v1.9.0——移除长期弃用的 API
This release removes several APIs that had been marked for a while, with no
replacement other than the one already documented at deprecation time:
@deprecatedRepeatPause(duration)RepeatTypePauseTypecanvas.addTickersSequenceTickerts
canvas.addTickersSequence("alien", [
new RotateTicker({ speed: 0.1, clockwise: true }, 2),
Pause(1), // [!code --]
new RotateTicker({ speed: 0.2, clockwise: false }, 2),
Repeat, // [!code --]
]);See / for the current sequencing API.
is gone from every transition helper (, ,
, ...) and from — use directly, it's no longer
just an alias:
pixi-vn-canvastickers.mdforceCompleteBeforeNextshowWithDissolvemoveInzoomInCommonTickerPropscompleteOnContinuets
await showWithDissolve("alice", "alice", {
forceCompleteBeforeNext: true, // [!code --]
completeOnContinue: true, // [!code ++]
});The deprecated field was removed; use / instead.
lost its overload — pass only , and
configure navigation once via (or ) instead:
AssetMemory.imageAssetMemory.aliasurlGame.restoreGameState(data, navigate)navigatedataGame.onNavigateGame.init({ navigate })ts
Game.restoreGameState(data, navigateTo); // [!code --]
Game.restoreGameState(data); // [!code ++]The singular handler was removed; use /
(already the recommended API since v1.6.0):
Game.onError(...)Game.addOnErrorGame.removeOnErrorts
Game.onError((type, error, { notify, uiTransition }) => { ... }); // [!code --]
Game.addOnError((error, { notify, uiTransition }) => { ... }); // [!code ++]See / for the current tickers/transitions API and
for the current API.
pixi-vn-canvastickers.mdpixi-vn-getting-startedGame此版本删除了多个早已标记为 的 API,且除了弃用时已经记录的替代方案外,
没有其他替代项:
@deprecatedRepeatPause(duration)RepeatTypePauseTypecanvas.addTickersSequenceTickerts
canvas.addTickersSequence("alien", [
new RotateTicker({ speed: 0.1, clockwise: true }, 2),
Pause(1), // [!code --]
new RotateTicker({ speed: 0.2, clockwise: false }, 2),
Repeat, // [!code --]
]);有关当前的排序 API,请参阅 /。
所有过渡辅助函数(、、 等)以及 中的
均已被移除——请直接使用 ,它现在不再只是别名:
pixi-vn-canvastickers.mdshowWithDissolvemoveInzoomInCommonTickerPropsforceCompleteBeforeNextcompleteOnContinuets
await showWithDissolve("alice", "alice", {
forceCompleteBeforeNext: true, // [!code --]
completeOnContinue: true, // [!code ++]
});弃用的 字段已被移除;请改用 /。
移除了 重载——只传入 ,并通过
(或 )统一配置导航:
AssetMemory.imageAssetMemory.aliasurlGame.restoreGameState(data, navigate)navigatedataGame.onNavigateGame.init({ navigate })ts
Game.restoreGameState(data, navigateTo); // [!code --]
Game.restoreGameState(data); // [!code ++]单数形式的 处理器已被移除;请改用 /
(自 v1.6.0 起已是推荐 API):
Game.onError(...)Game.addOnErrorGame.removeOnErrorts
Game.onError((type, error, { notify, uiTransition }) => { ... }); // [!code --]
Game.addOnError((error, { notify, uiTransition }) => { ... }); // [!code ++]有关当前的 Ticker/过渡 API,请参阅 /;
有关当前的 API,请参阅 。
pixi-vn-canvastickers.mdGamepixi-vn-getting-startedManager APIs reorganized into namespaces
Manager API 重组为命名空间
The , , , and managers used to expose dozens of unrelated
methods directly on the manager (ticker methods, layer methods, and HTML-layer methods all mixed
together on , for example). This release groups related operations into namespaced
sub-APIs — //, /,
/, /// — so each manager reads
as a short, discoverable surface instead of a flat list, and related options/overloads live next to
each other. See , , , and
for the current shape of each namespace.
canvassoundstoragenarrationcanvascanvas.tickers.layers.htmlLayerssound.channels.unsavedstorage.temp.flagsnarration.labels.queries.input.choicespixi-vn-canvaspixi-vn-soundpixi-vn-storagepixi-vn-getting-startedAlmost every old flat method still works and just forwards to its namespaced replacement — it's
marked but not removed, so migrate at your own pace. Two members are an exception:
their type changed, so they break immediately rather than just warning.
@deprecatedsound.channelsAudioChannelInterface[].valuests
sound.channels.map((c) => c.alias); // [!code --]
sound.channels.values.map((c) => c.alias); // [!code ++]narration.choicesStoredIndexedChoiceInterface[] | undefined.listnarration.choices = [...].listts
const choices = narration.choices; // [!code --]
const choices = narration.choices.list; // [!code ++]Every other rename below is a non-breaking, forward-compatible deprecation.
canvascanvas.tickerstickerstickers.*ts
canvas.transferTickers("old", "new"); // [!code --]
canvas.tickers.transfer("old", "new"); // [!code ++]ts
canvas.currentTickers; // [!code --]
canvas.tickers.currentTickers; // [!code ++]ts
canvas.currentTickersSteps; // [!code --]
canvas.tickers.currentTickersSteps; // [!code ++]ts
canvas.findTicker("t1"); // [!code --]
canvas.tickers.find("t1"); // [!code ++]ts
canvas.addTicker("alien", new RotateTicker({ speed: 0.2 })); // [!code --]
canvas.tickers.add("alien", new RotateTicker({ speed: 0.2 })); // [!code ++]ts
canvas.addTickersSequence("alien", steps); // [!code --]
canvas.tickers.addSequence("alien", steps); // [!code ++]ts
canvas.unlinkComponentFromTicker("alien", RotateTicker); // [!code --]
canvas.tickers.unlinkComponent("alien", RotateTicker); // [!code ++]ts
canvas.removeAllTickers(); // [!code --]
canvas.tickers.removeAll(); // [!code ++]ts
canvas.removeTicker("t1"); // [!code --]
canvas.tickers.remove("t1"); // [!code ++]ts
canvas.pauseTicker({ canvasAlias: "alien" }); // [!code --]
canvas.tickers.pause({ canvasAlias: "alien" }); // [!code ++]ts
canvas.resumeTicker({ canvasAlias: "alien" }); // [!code --]
canvas.tickers.resume({ canvasAlias: "alien" }); // [!code ++]ts
canvas.isTickerPaused("alien"); // [!code --]
canvas.tickers.isPaused("alien"); // [!code ++]ts
canvas.completeTickerOnStepEnd({ id: "t1" }); // [!code --]
canvas.tickers.completeOnStepEnd({ id: "t1" }); // [!code ++]ts
canvas.forceCompletionOfTicker("t1"); // [!code --]
canvas.tickers.forceCompletion("t1"); // [!code ++]ts
canvas.onTickerComplete("t1", options); // [!code --]
canvas.tickers.onComplete("t1", options); // [!code ++]canvascanvas.layersts
canvas.gameLayer; // [!code --]
canvas.layers.gameLayer; // [!code ++]ts
canvas.addLayer("ui", uiLayer); // [!code --]
canvas.layers.add("ui", uiLayer); // [!code ++]ts
canvas.getLayer("ui"); // [!code --]
canvas.layers.get("ui"); // [!code ++]ts
canvas.removeLayer("ui"); // [!code --]
canvas.layers.remove("ui"); // [!code ++]canvascanvas.htmlLayersts
canvas.addHtmlLayer("ui", root); // [!code --]
canvas.htmlLayers.add("ui", root); // [!code ++]ts
canvas.getHtmlLayer("ui"); // [!code --]
canvas.htmlLayers.get("ui"); // [!code ++]ts
canvas.removeHtmlLayer("ui"); // [!code --]
canvas.htmlLayers.remove("ui"); // [!code ++]soundsound.unsavedts
sound.playTransient("ui-click"); // [!code --]
sound.unsaved.playTransient("ui-click"); // [!code ++]ts
sound.pauseUnsavedAll(); // [!code --]
sound.unsaved.pauseAll(); // [!code ++]ts
sound.resumeUnsavedAll(); // [!code --]
sound.unsaved.resumeAll(); // [!code ++]ts
sound.stopTransientAll(); // [!code --]
sound.unsaved.stopTransientAll(); // [!code ++]soundsound.channels.valuests
sound.addChannel("music"); // [!code --]
sound.channels.add("music"); // [!code ++]ts
sound.findChannel("music"); // [!code --]
sound.channels.find("music"); // [!code ++]storagestorage.tempstorage.temp.deadlinests
storage.setTempVariable("key", "value"); // [!code --]
storage.temp.set("key", "value"); // [!code ++]ts
storage.removeTempVariable("key"); // [!code --]
storage.temp.remove("key"); // [!code ++]storagestorage.flagsts
storage.setFlag("introSeen", true); // [!code --]
storage.flags.set("introSeen", true); // [!code ++]ts
storage.getFlag("introSeen"); // [!code --]
storage.flags.get("introSeen"); // [!code ++]narrationnarration.labelsts
narration.openedLabels; // [!code --]
narration.labels.opened; // [!code ++]ts
narration.currentLabel; // [!code --]
narration.labels.current; // [!code ++]ts
narration.closeCurrentLabel(); // [!code --]
narration.labels.closeCurrent(); // [!code ++]ts
narration.closeAllLabels(); // [!code --]
narration.labels.closeAll(); // [!code ++]narrationnarration.queriests
narration.isLabelAlreadyCompleted(label); // [!code --]
narration.queries.isLabelAlreadyCompleted(label); // [!code ++]ts
narration.alreadyCurrentStepMadeChoices; // [!code --]
narration.queries.alreadyCurrentStepMadeChoices; // [!code ++]ts
narration.isCurrentStepAlreadyOpened; // [!code --]
narration.queries.isCurrentStepAlreadyOpened; // [!code ++]ts
narration.getTimesLabelOpened(label); // [!code --]
narration.queries.timesLabelOpened(label); // [!code ++]ts
narration.getTimesChoiceMade(index); // [!code --]
narration.queries.timesChoiceMade(index); // [!code ++]narrationnarration.inputts
narration.inputValue; // [!code --]
narration.input.value; // [!code ++]ts
narration.isRequiredInput; // [!code --]
narration.input.isRequired; // [!code ++]ts
narration.inputType; // [!code --]
narration.input.type; // [!code ++]ts
narration.requestInput({ type: "number" }); // [!code --]
narration.input.request({ type: "number" }); // [!code ++]ts
narration.removeInputRequest(); // [!code --]
narration.input.removeRequest(); // [!code ++]narrationnarration.choices.listts
narration.selectChoice(choices[0], {}); // [!code --]
narration.choices.select(choices[0], {}); // [!code ++]过去,、、 和 管理器直接在管理器本身上公开了数十个互不相关的
方法(例如,Ticker 方法、图层方法和 HTML 图层方法全都混在 上)。此版本将相关操作归入
带命名空间的子 API——//、/、
/、///——使每个管理器都呈现为
一组简短、易于发现的接口,而不是扁平的方法列表;相关选项和重载也会集中在一起。
有关每个命名空间当前的结构,请参阅 、、
和 。
canvassoundstoragenarrationcanvascanvas.tickers.layers.htmlLayerssound.channels.unsavedstorage.temp.flagsnarration.labels.queries.input.choicespixi-vn-canvaspixi-vn-soundpixi-vn-storagepixi-vn-getting-started几乎所有旧的扁平方法仍然可用,并且只会转发到对应的命名空间替代项——它们被标记为
,但尚未移除,因此你可以按自己的节奏进行迁移。有两个成员例外:
它们的类型发生了变化,因此会立即导致错误,而不只是给出警告。
@deprecatedsound.channelsAudioChannelInterface[].valuests
sound.channels.map((c) => c.alias); // [!code --]
sound.channels.values.map((c) => c.alias); // [!code ++]narration.choicesStoredIndexedChoiceInterface[] | undefined.listnarration.choices = [...].listts
const choices = narration.choices; // [!code --]
const choices = narration.choices.list; // [!code ++]以下所有其他重命名均属于非破坏性、向前兼容的弃用。
canvascanvas.tickerstickerstickers.*ts
canvas.transferTickers("old", "new"); // [!code --]
canvas.tickers.transfer("old", "new"); // [!code ++]ts
canvas.currentTickers; // [!code --]
canvas.tickers.currentTickers; // [!code ++]ts
canvas.currentTickersSteps; // [!code --]
canvas.tickers.currentTickersSteps; // [!code ++]ts
canvas.findTicker("t1"); // [!code --]
canvas.tickers.find("t1"); // [!code ++]ts
canvas.addTicker("alien", new RotateTicker({ speed: 0.2 })); // [!code --]
canvas.tickers.add("alien", new RotateTicker({ speed: 0.2 })); // [!code ++]ts
canvas.addTickersSequence("alien", steps); // [!code --]
canvas.tickers.addSequence("alien", steps); // [!code ++]ts
canvas.unlinkComponentFromTicker("alien", RotateTicker); // [!code --]
canvas.tickers.unlinkComponent("alien", RotateTicker); // [!code ++]ts
canvas.removeAllTickers(); // [!code --]
canvas.tickers.removeAll(); // [!code ++]ts
canvas.removeTicker("t1"); // [!code --]
canvas.tickers.remove("t1"); // [!code ++]ts
canvas.pauseTicker({ canvasAlias: "alien" }); // [!code --]
canvas.tickers.pause({ canvasAlias: "alien" }); // [!code ++]ts
canvas.resumeTicker({ canvasAlias: "alien" }); // [!code --]
canvas.tickers.resume({ canvasAlias: "alien" }); // [!code ++]ts
canvas.isTickerPaused("alien"); // [!code --]
canvas.tickers.isPaused("alien"); // [!code ++]ts
canvas.completeTickerOnStepEnd({ id: "t1" }); // [!code --]
canvas.tickers.completeOnStepEnd({ id: "t1" }); // [!code ++]ts
canvas.forceCompletionOfTicker("t1"); // [!code --]
canvas.tickers.forceCompletion("t1"); // [!code ++]ts
canvas.onTickerComplete("t1", options); // [!code --]
canvas.tickers.onComplete("t1", options); // [!code ++]canvascanvas.layersts
canvas.gameLayer; // [!code --]
canvas.layers.gameLayer; // [!code ++]ts
canvas.addLayer("ui", uiLayer); // [!code --]
canvas.layers.add("ui", uiLayer); // [!code ++]ts
canvas.getLayer("ui"); // [!code --]
canvas.layers.get("ui"); // [!code ++]ts
canvas.removeLayer("ui"); // [!code --]
canvas.layers.remove("ui"); // [!code ++]canvascanvas.htmlLayersts
canvas.addHtmlLayer("ui", root); // [!code --]
canvas.htmlLayers.add("ui", root); // [!code ++]ts
canvas.getHtmlLayer("ui"); // [!code --]
canvas.htmlLayers.get("ui"); // [!code ++]ts
canvas.removeHtmlLayer("ui"); // [!code --]
canvas.htmlLayers.remove("ui"); // [!code ++]soundsound.unsavedts
sound.playTransient("ui-click"); // [!code --]
sound.unsaved.playTransient("ui-click"); // [!code ++]ts
sound.pauseUnsavedAll(); // [!code --]
sound.unsaved.pauseAll(); // [!code ++]ts
sound.resumeUnsavedAll(); // [!code --]
sound.unsaved.resumeAll(); // [!code ++]ts
sound.stopTransientAll(); // [!code --]
sound.unsaved.stopTransientAll(); // [!code ++]soundsound.channels.valuests
sound.addChannel("music"); // [!code --]
sound.channels.add("music"); // [!code ++]ts
sound.findChannel("music"); // [!code --]
sound.channels.find("music"); // [!code ++]storagestorage.tempstorage.temp.deadlinests
storage.setTempVariable("key", "value"); // [!code --]
storage.temp.set("key", "value"); // [!code ++]ts
storage.removeTempVariable("key"); // [!code --]
storage.temp.remove("key"); // [!code ++]storagestorage.flagsts
storage.setFlag("introSeen", true); // [!code --]
storage.flags.set("introSeen", true); // [!code ++]ts
storage.getFlag("introSeen"); // [!code --]
storage.flags.get("introSeen"); // [!code ++]narrationnarration.labelsts
narration.openedLabels; // [!code --]
narration.labels.opened; // [!code ++]ts
narration.currentLabel; // [!code --]
narration.labels.current; // [!code ++]ts
narration.closeCurrentLabel(); // [!code --]
narration.labels.closeCurrent(); // [!code ++]ts
narration.closeAllLabels(); // [!code --]
narration.labels.closeAll(); // [!code ++]narrationnarration.queriests
narration.isLabelAlreadyCompleted(label); // [!code --]
narration.queries.isLabelAlreadyCompleted(label); // [!code ++]ts
narration.alreadyCurrentStepMadeChoices; // [!code --]
narration.queries.alreadyCurrentStepMadeChoices; // [!code ++]ts
narration.isCurrentStepAlreadyOpened; // [!code --]
narration.queries.isCurrentStepAlreadyOpened; // [!code ++]ts
narration.getTimesLabelOpened(label); // [!code --]
narration.queries.timesLabelOpened(label); // [!code ++]ts
narration.getTimesChoiceMade(index); // [!code --]
narration.queries.timesChoiceMade(index); // [!code ++]narrationnarration.inputts
narration.inputValue; // [!code --]
narration.input.value; // [!code ++]ts
narration.isRequiredInput; // [!code --]
narration.input.isRequired; // [!code ++]ts
narration.inputType; // [!code --]
narration.input.type; // [!code ++]ts
narration.requestInput({ type: "number" }); // [!code --]
narration.input.request({ type: "number" }); // [!code ++]ts
narration.removeInputRequest(); // [!code --]
narration.input.removeRequest(); // [!code ++]narrationnarration.choices.listts
narration.selectChoice(choices[0], {}); // [!code --]
narration.choices.select(choices[0], {}); // [!code ++]v1.7.x → v1.8.0 — Tone.js audio engine
v1.7.x → v1.8.0——Tone.js 音频引擎
The audio system moved from to Tone.js (performance, stability, flexibility). Two
consequences (full API in ):
@pixi/soundpixi-vn-sound- A 's
mediais no longer a plain linear number — it's now a Tone.js decibelvolume:Paramtsconst bgmMedia = sound.find("bgm_cheerful"); if (bgmMedia) bgmMedia.volume = 90; // [!code --] if (bgmMedia) bgmMedia.volume.value = 90; // [!code ++] - Editing an already-loaded audio asset directly () is no longer possible — there is no replacement call; re-load/re-play with new options instead.
sound.edit(alias, options)
出于性能、稳定性和灵活性的考虑,音频系统从 迁移到了 Tone.js。由此产生两项
影响(完整 API 见 ):
@pixi/soundpixi-vn-sound- 的
media不再是普通的线性数字——现在它是 Tone.js 的分贝volume:Paramtsconst bgmMedia = sound.find("bgm_cheerful"); if (bgmMedia) bgmMedia.volume = 90; // [!code --] if (bgmMedia) bgmMedia.volume.value = 90; // [!code ++] - 无法再直接编辑已加载的音频素材()——没有对应的替代调用; 请改用新选项重新加载/播放。
sound.edit(alias, options)
v1.6.x → v1.7.0 — template integration cleanup
v1.6.x → v1.7.0——模板集成清理
-
HTML layers () now default to
canvas.addHtmlLayer(prevents accidental text selection during UI interaction). Opt back in per layer if needed:userSelect: "none"tsconst htmlLayer = canvas.addHtmlLayer("ui", root, { userSelect: "auto" }); // [!code ++] -
Navigation is now centralized: useonce instead of passing a navigate function to every call site that needs one (see
Game.onNavigate):pixi-vn-getting-startedtsGame.onNavigate((path) => navigateTo(path)); // [!code ++] Game.restoreGameState(data, navigateTo); // [!code --] Game.restoreGameState(data); // [!code ++] -
Custom UI storage reactivity:lets a UI state store mirror game-storage changes automatically (see
storage.setStorageHandler({ onSetVariable, onRemoveVariable, onClearOldTempVariable })) — new capability, not a breaking change, but worth knowing this version added it.pixi-vn-storage
-
HTML 图层()现在默认使用
canvas.addHtmlLayer(可防止 UI 交互期间意外选中文本)。 如有需要,可按图层重新启用:userSelect: "none"tsconst htmlLayer = canvas.addHtmlLayer("ui", root, { userSelect: "auto" }); // [!code ++] -
导航现已集中管理:请一次性使用,而不是在每个需要导航的调用点传入导航函数 (参见
Game.onNavigate):pixi-vn-getting-startedtsGame.onNavigate((path) => navigateTo(path)); // [!code ++] Game.restoreGameState(data, navigateTo); // [!code --] Game.restoreGameState(data); // [!code ++] -
自定义 UI 存储响应性:可让 UI 状态存储自动映射游戏存储的变化(参见
storage.setStorageHandler({ onSetVariable, onRemoveVariable, onClearOldTempVariable }))——这是新增能力,不是破坏性变更, 但值得了解此版本新增了该功能。pixi-vn-storage
v1.5.x → v1.6.0 — sound module rewrite, Game.start
, storage key convention, addOnError
Game.startaddOnErrorv1.5.x → v1.6.0——Sound 模块重写、Game.start
、存储键约定、addOnError
Game.startaddOnErrorThe sound API was completely redesigned around the /// split (see
for the current shape):
soundchannelsmediaassetspixi-vn-soundts
sound.add("bird", "resources/bird.mp3"); // [!code --]
sound.play("bird", { loop: true }); // [!code ++] (sound.play replaces add()+play())
let s = sound.add("bird", { url: "resources/bird.mp3", loop: true }); // [!code --]
s.play(); // [!code --]
s.pause(); // [!code --]
sound.play("bird", { loop: true }); // [!code ++]
sound.pause("bird"); // [!code ++]Other changes this version:
- was added as the recommended entry point (see
Game.start(label, props)) instead of the previouspixi-vn-getting-started+Game.clear()pair:narration.call(...)tsGame.clear(); // [!code --] narration.call("start", gameProps); // [!code --] Game.start("start", gameProps); // [!code ++] - Storage keys adopted a -separated namespacing convention (e.g.
:) — doesn't break existing saves or the API, just a recommended naming style (seecharacter:alice:friendship).pixi-vn-storage - Error handling moved to (supports multiple stacked handlers) instead of the singular, now-deprecated
Game.addOnError, and dropped theGame.onErrorargument (seetype):pixi-vn-getting-startedtsGame.onError((type, error, { notify, uiTransition }) => { ... }); // [!code --] Game.addOnError((error, { toast, uiTransition }) => { ... }); // [!code ++]
Sound API 已围绕 /// 拆分进行了彻底重新设计
(有关当前结构,请参阅 ):
soundchannelsmediaassetspixi-vn-soundts
sound.add("bird", "resources/bird.mp3"); // [!code --]
sound.play("bird", { loop: true }); // [!code ++] (sound.play replaces add()+play())
let s = sound.add("bird", { url: "resources/bird.mp3", loop: true }); // [!code --]
s.play(); // [!code --]
s.pause(); // [!code --]
sound.play("bird", { loop: true }); // [!code ++]
sound.pause("bird"); // [!code ++]此版本的其他变更:
- 新增 作为推荐入口(参见
Game.start(label, props)), 用于替代之前的pixi-vn-getting-started+Game.clear()组合:narration.call(...)tsGame.clear(); // [!code --] narration.call("start", gameProps); // [!code --] Game.start("start", gameProps); // [!code ++] - 存储键采用以 分隔的命名空间约定(例如
:)—— 这不会破坏现有存档或 API,只是推荐的命名风格(参见character:alice:friendship)。pixi-vn-storage - 错误处理迁移至 (支持叠加多个处理器),不再使用单数形式、现已弃用的
Game.addOnError,同时移除了Game.onError参数(参见type):pixi-vn-getting-startedtsGame.onError((type, error, { notify, uiTransition }) => { ... }); // [!code --] Game.addOnError((error, { toast, uiTransition }) => { ... }); // [!code ++]
v1.4.x → v1.5.0 — pixi.js
external, canvas resize CSS
pixi.jsv1.4.x → v1.5.0——pixi.js
external、Canvas 调整尺寸 CSS
pixi.js- is now marked external for non-CDN builds (Vite, official templates) — needed because
pixi.jsdoesn't support multiple bundled instances; only relevant if something in the build config assumed it was bundled.pixi.js - The canvas resizing logic changed; if upgrading an existing (pre-v1.5.4) template, update the base
CSS to match the current one (see 's exact
pixi-vn-getting-started/index.html).styles.css
- 对于非 CDN 构建(Vite、官方模板),现在被标记为 external——这是必需的, 因为
pixi.js不支持同时打包多个实例;仅当构建配置原先假定它会被打包时才与此相关。pixi.js - Canvas 调整尺寸的逻辑发生了变化;如果升级的是现有的(v1.5.4 之前)模板,
请将基础 CSS 更新为当前版本(参见 中确切的
pixi-vn-getting-started/index.html)。styles.css
v1.3.x → v1.4.0 — stepHistory.back()
takes props, not a navigate function
stepHistory.back()v1.3.x → v1.4.0——stepHistory.back()
接受 props,而不是导航函数
stepHistory.back()To support synchronous multi-step back/continue requests, 's argument changed
from a path-navigation callback to the same -shaped object passed to every step —
the actual navigate function now lives on instead (see /
):
stepHistory.back()StepLabelPropsGame.init()pixi-vn-historypixi-vn-getting-startedts
stepHistory.back((_path) => {
/* navigate in the url path */
}); // [!code --]
const gameProps = {};
stepHistory.back(gameProps); // [!code ++]ts
Game.init(body, {
height: 1080,
width: 1920,
backgroundColor: "#303030",
navigate: (_path) => {
/* navigate in the url path */
}, // [!code ++]
}).then(() => {
/* ... */
});Also removed in this release (all long-deprecated): , ,
(the re-exported namespace), /,
, the /// preset classes,
(now -side), / (now /
), , ///
(now ///).
stepHistory.goBacknarration.goNextPIXIcanvas.canvasWidthcanvas.canvasHeightcanvas.onEndOfTickerFadeAlphaTickerMoveTickerRotateTickerZoomTickernarration.canContinuestepHistorynarration.callLabeljumpLabelcalljumpnarration.choiceMenuOptionsstorage.startingStoragesetVariablegetVariableremoveVariablestorage.defaultsetgetremove为了支持同步的多步后退/继续请求, 的参数已从路径导航回调改为与每个步骤
所接收对象形状相同的 ——实际的导航函数现在位于 中
(参见 /):
stepHistory.back()StepLabelPropsGame.init()pixi-vn-historypixi-vn-getting-startedts
stepHistory.back((_path) => {
/* navigate in the url path */
}); // [!code --]
const gameProps = {};
stepHistory.back(gameProps); // [!code ++]ts
Game.init(body, {
height: 1080,
width: 1920,
backgroundColor: "#303030",
navigate: (_path) => {
/* navigate in the url path */
}, // [!code ++]
}).then(() => {
/* ... */
});此版本还移除了以下长期弃用的内容:、、
(重新导出的命名空间)、/、
、/// 预设类、
(现在位于 一侧)、/
(现在为 /)、、
///
(现在为 ///)。
stepHistory.goBacknarration.goNextPIXIcanvas.canvasWidthcanvas.canvasHeightcanvas.onEndOfTickerFadeAlphaTickerMoveTickerRotateTickerZoomTickernarration.canContinuestepHistorynarration.callLabeljumpLabelcalljumpnarration.choiceMenuOptionsstorage.startingStoragesetVariablegetVariableremoveVariablestorage.defaultsetgetremovev1.2.x → v1.3.0 — canvas.animate
replaces ticker presets
canvas.animatev1.2.x → v1.3.0——canvas.animate
取代 Ticker 预设
canvas.animateCanvas animation was rebuilt around (PixiJS tickers + the library, see
), deprecating the old ticker-preset classes (, ,
, ) in favor of transition helpers (, , ...) and
directly.
canvas.animatemotionpixi-vn-canvasFadeAlphaTickerMoveTickerRotateTickerZoomTickershowWithDissolvemoveIncanvas.animateCanvas 动画已围绕 (PixiJS Ticker + 库,参见
)重新构建。旧的 Ticker 预设类(、、
、)已被弃用,转而使用过渡辅助函数(、 等)
和 。
canvas.animatemotionpixi-vn-canvasFadeAlphaTickerMoveTickerRotateTickerZoomTickershowWithDissolvemoveIncanvas.animatev0.10.x → v1.0 — the modular rewrite
v0.10.x → v1.0——模块化重写
The first stable release split the engine into independent modules (canvas/characters/history/
narration/sound/storage), introduced the namespace as the main entry point, and pulled step
history out into its own module (previously part of ). Renames, all still
relevant if migrating a pre-1.0 project:
GamestepHistorynarrationts
clearAllGameDatas(); // [!code --]
Game.clear(); // [!code ++]
canvas.initialize(body, options).then(...); // [!code --]
Game.init(body, options).then(...); // [!code ++]
getSaveData(); // [!code --]
Game.exportGameState(); // [!code ++]
getSaveJson(); // [!code --]
JSON.stringify(Game.exportGameState()); // [!code ++]
loadSaveData(data, navigate); // [!code --]
Game.restoreGameState(data, navigate); // [!code ++]
jsonToSaveData(json); // [!code --]
JSON.parse(json); // [!code ++]
narration.canGoBack; // [!code --]
stepHistory.canGoBack; // [!code ++]
narration.back(); // [!code --]
stepHistory.back(); // [!code ++]
narration.narrativeHistory; // [!code --]
stepHistory.narrativeHistory; // [!code ++]See for the current API, for , and
for the current / save/load flow.
pixi-vn-getting-startedGamepixi-vn-historystepHistorypixi-vn-savesexportGameStaterestoreGameState首个稳定版本将引擎拆分为独立模块(Canvas/角色/历史/旁白/声音/存储),
引入 命名空间作为主要入口,并将步骤历史提取为独立的 模块
(此前属于 )。以下重命名在迁移 v1.0 之前的项目时仍然适用:
GamestepHistorynarrationts
clearAllGameDatas(); // [!code --]
Game.clear(); // [!code ++]
canvas.initialize(body, options).then(...); // [!code --]
Game.init(body, options).then(...); // [!code ++]
getSaveData(); // [!code --]
Game.exportGameState(); // [!code ++]
getSaveJson(); // [!code --]
JSON.stringify(Game.exportGameState()); // [!code ++]
loadSaveData(data, navigate); // [!code --]
Game.restoreGameState(data, navigate); // [!code ++]
jsonToSaveData(json); // [!code --]
JSON.parse(json); // [!code ++]
narration.canGoBack; // [!code --]
stepHistory.canGoBack; // [!code ++]
narration.back(); // [!code --]
stepHistory.back(); // [!code ++]
narration.narrativeHistory; // [!code --]
stepHistory.narrativeHistory; // [!code ++]有关当前的 API,请参阅 ;有关 ,请参阅
;有关当前的 / 存档/读档流程,
请参阅 。
Gamepixi-vn-getting-startedstepHistorypixi-vn-historyexportGameStaterestoreGameStatepixi-vn-savesRelated skills
相关 skills
- pixi-vn-getting-started — current API, project setup.
Game - pixi-vn-saves — current save/load flow (/
Game.exportGameState).restoreGameState - pixi-vn-history — current API.
stepHistory - pixi-vn-sound — current sound/channel/media API.
- pixi-vn-canvas — current transition/animation API.
- pixi-vn-storage — current storage API and key-naming convention.
- pixi-vn-getting-started——当前的 API、项目设置。
Game - pixi-vn-saves——当前的存档/读档流程(/
Game.exportGameState)。restoreGameState - pixi-vn-history——当前的 API。
stepHistory - pixi-vn-sound——当前的 Sound/频道/媒体 API。
- pixi-vn-canvas——当前的过渡/动画 API。
- pixi-vn-storage——当前的存储 API 和键名约定。