create-pixi-vn 1.5.0 → 1.5.2
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.
- package/package.json +1 -1
- package/template-game-engine/package.json +4 -4
- package/template-game-engine/src/index.ts +11 -3
- package/template-story-react-vite-muijoy/README.md +3 -4
- package/template-story-react-vite-muijoy-ink/.vscode/extensions.json +2 -1
- package/template-story-react-vite-muijoy-ink/README.md +38 -1
- package/template-story-react-vite-muijoy-ink/package.json +1 -0
- package/template-story-react-vite-muijoy-ink/src/App.tsx +2 -1
- package/template-story-react-vite-muijoy-ink/src/Home.tsx +2 -0
- package/template-story-react-vite-muijoy-ink/src/assets/manifest.ts +2 -3
- package/template-story-react-vite-muijoy-ink/src/hooks/useInkInitialization.tsx +13 -0
- package/template-story-react-vite-muijoy-ink/src/i18n.ts +12 -0
- package/template-story-react-vite-muijoy-ink/src/ink/start.ink +764 -0
- package/template-story-react-vite-muijoy-ink/src/ink.d.ts +4 -0
- package/template-story-react-vite-muijoy-ink/src/labels/index.ts +1 -0
- package/template-story-react-vite-muijoy-ink/src/main-ink.ink +2 -0
- package/template-story-react-vite-muijoy-ink/src/main.tsx +1 -1
- package/template-story-react-vite-muijoy-ink/src/screens/MainMenu.tsx +1 -2
- package/template-story-react-vite-muijoy-ink/src/utils/ink-utility.ts +35 -0
- package/template-story-react-vite-muijoy-ink/vite.config.ts +1 -0
- package/template-story-react-vite-muijoy-ink-tauri/.vscode/extensions.json +5 -1
- package/template-story-react-vite-muijoy-ink-tauri/.vscode/launch.json +30 -2
- package/template-story-react-vite-muijoy-ink-tauri/.vscode/tasks.json +29 -0
- package/template-story-react-vite-muijoy-ink-tauri/README.md +203 -113
- package/template-story-react-vite-muijoy-ink-tauri/_github/workflows/tauri.yml +129 -0
- package/template-story-react-vite-muijoy-ink-tauri/_gitignore +1 -0
- package/template-story-react-vite-muijoy-ink-tauri/package.json +6 -1
- package/template-story-react-vite-muijoy-ink-tauri/src/App.tsx +2 -1
- package/template-story-react-vite-muijoy-ink-tauri/src/Home.tsx +2 -0
- package/template-story-react-vite-muijoy-ink-tauri/src/assets/manifest.ts +2 -3
- package/template-story-react-vite-muijoy-ink-tauri/src/hooks/useInkInitialization.tsx +13 -0
- package/template-story-react-vite-muijoy-ink-tauri/src/i18n.ts +12 -0
- package/template-story-react-vite-muijoy-ink-tauri/src/ink/start.ink +764 -0
- package/template-story-react-vite-muijoy-ink-tauri/src/ink.d.ts +4 -0
- package/template-story-react-vite-muijoy-ink-tauri/src/labels/index.ts +1 -0
- package/template-story-react-vite-muijoy-ink-tauri/src/main-ink.ink +2 -0
- package/template-story-react-vite-muijoy-ink-tauri/src/main.tsx +1 -1
- package/template-story-react-vite-muijoy-ink-tauri/src/screens/MainMenu.tsx +1 -2
- package/template-story-react-vite-muijoy-ink-tauri/src/screens/settings/FullScreenSettings.tsx +6 -1
- package/template-story-react-vite-muijoy-ink-tauri/src/use_query/useQueryIsFullModeScreen.ts +7 -1
- package/template-story-react-vite-muijoy-ink-tauri/src/utils/ink-utility.ts +35 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/Cargo.toml +25 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/build.rs +3 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/capabilities/default.json +11 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/128x128.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/128x128@2x.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/32x32.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/Square107x107Logo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/Square142x142Logo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/Square150x150Logo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/Square284x284Logo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/Square30x30Logo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/Square310x310Logo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/Square44x44Logo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/Square71x71Logo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/Square89x89Logo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/StoreLogo.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/icon.icns +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/icon.ico +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/icons/icon.png +0 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/src/lib.rs +14 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/src/main.rs +6 -0
- package/template-story-react-vite-muijoy-ink-tauri/src-tauri/tauri.conf.json +37 -0
- package/template-story-react-vite-muijoy-ink-tauri/vite.config.ts +25 -0
- package/template-story-react-vite-muijoy-tauri/.vscode/extensions.json +4 -1
- package/template-story-react-vite-muijoy-tauri/.vscode/launch.json +30 -2
- package/template-story-react-vite-muijoy-tauri/.vscode/tasks.json +29 -0
- package/template-story-react-vite-muijoy-tauri/README.md +166 -113
- package/template-story-react-vite-muijoy-tauri/_github/workflows/tauri.yml +129 -0
- package/template-story-react-vite-muijoy-tauri/_gitignore +1 -0
- package/template-story-react-vite-muijoy-tauri/package.json +5 -1
- package/template-story-react-vite-muijoy-tauri/src/screens/settings/FullScreenSettings.tsx +6 -1
- package/template-story-react-vite-muijoy-tauri/src/use_query/useQueryIsFullModeScreen.ts +7 -1
- package/template-story-react-vite-muijoy-tauri/src-tauri/Cargo.toml +25 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/build.rs +3 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/capabilities/default.json +11 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/128x128.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/128x128@2x.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/32x32.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/Square107x107Logo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/Square142x142Logo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/Square150x150Logo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/Square284x284Logo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/Square30x30Logo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/Square310x310Logo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/Square44x44Logo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/Square71x71Logo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/Square89x89Logo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/StoreLogo.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/icon.icns +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/icon.ico +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/icons/icon.png +0 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/src/lib.rs +14 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/src/main.rs +6 -0
- package/template-story-react-vite-muijoy-tauri/src-tauri/tauri.conf.json +37 -0
- package/template-story-react-vite-muijoy-tauri/vite.config.ts +24 -0
- package/template-story-react-vite-muijoy-ink/src/labels/startLabel.ts +0 -1414
- package/template-story-react-vite-muijoy-ink-tauri/src/labels/startLabel.ts +0 -1414
package/package.json
CHANGED
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@pixi/devtools": "^2.0.1",
|
|
18
18
|
"@pixi/sound": "^6.0.1",
|
|
19
|
-
"pixi.js": "^8.
|
|
19
|
+
"pixi.js": "^8.10.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@drincs/pixi-vn": "^1.
|
|
22
|
+
"@drincs/pixi-vn": "^1.2.15",
|
|
23
23
|
"@types/crypto-js": "^4.2.2",
|
|
24
24
|
"crypto-js": "^4.2.0",
|
|
25
25
|
"ts-node": "^10.9.2",
|
|
26
|
-
"tsup": "^8.
|
|
26
|
+
"tsup": "^8.5.0",
|
|
27
27
|
"typescript": "^5.8.3",
|
|
28
|
-
"vitest": "^3.
|
|
28
|
+
"vitest": "^3.2.2"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
31
31
|
"engine",
|
|
@@ -5,6 +5,7 @@ import PIXIVN, {
|
|
|
5
5
|
HistoryManagerStatic,
|
|
6
6
|
narration,
|
|
7
7
|
NarrationManagerStatic,
|
|
8
|
+
RegisteredCharacters,
|
|
8
9
|
sound,
|
|
9
10
|
stepHistory,
|
|
10
11
|
storage,
|
|
@@ -71,10 +72,13 @@ export namespace Game {
|
|
|
71
72
|
NarrationManagerStatic._stepCounter = value;
|
|
72
73
|
},
|
|
73
74
|
getOpenedLabels: () => narration.openedLabels.length,
|
|
74
|
-
addHistoryItem: (historyInfo,
|
|
75
|
-
return stepHistory.add(historyInfo,
|
|
75
|
+
addHistoryItem: (historyInfo, options) => {
|
|
76
|
+
return stepHistory.add(historyInfo, options);
|
|
76
77
|
},
|
|
77
78
|
getCurrentStepsRunningNumber: () => NarrationManagerStatic.stepsRunning,
|
|
79
|
+
getCharacter: (id: string) => {
|
|
80
|
+
return RegisteredCharacters.get(id);
|
|
81
|
+
},
|
|
78
82
|
// canvas
|
|
79
83
|
onGoNextEnd: async () => {
|
|
80
84
|
CanvasManagerStatic._tickersToCompleteOnStepEnd.tikersIds.forEach(({ id }) => {
|
|
@@ -130,7 +134,11 @@ export namespace Game {
|
|
|
130
134
|
*/
|
|
131
135
|
export async function restoreGameState(data: GameState, navigate: (path: string) => void) {
|
|
132
136
|
stepHistory.restore(data.historyData);
|
|
133
|
-
|
|
137
|
+
const lastHistoryKey = stepHistory.lastKey;
|
|
138
|
+
if (typeof lastHistoryKey === "number") {
|
|
139
|
+
const historyItem = stepHistory.stepsInfoMap.get(lastHistoryKey) || null;
|
|
140
|
+
await narration.restore(data.stepData, historyItem);
|
|
141
|
+
}
|
|
134
142
|
storage.restore(data.storageData);
|
|
135
143
|
await canvas.restore(data.canvasData);
|
|
136
144
|
sound.restore(data.soundData);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
# Pixi’VN template
|
|
1
|
+
# Pixi’VN template - Text-based Story - React
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
This is a template for creating
|
|
6
|
-
This Template contains basic functionality inspired by the widespread Visual Noval engine Ren'Py.
|
|
5
|
+
This is a template for creating text-based stories in React. It uses the Pixi’VN library and Vite as a build tool.
|
|
7
6
|
|
|
8
7
|
## Overview
|
|
9
8
|
|
|
10
|
-
For testing purposes we will recreate the visual novel [Breakdown](https://joshpowlison.itch.io/breakdown) with Pixi’VN in this guide.
|
|
9
|
+
For testing purposes we will recreate the visual novel [Breakdown](https://joshpowlison.itch.io/breakdown) with Pixi’VN in this guide. Josh Powlison, the creator of Breakdown, has given us permission to use his narration for educational purposes❤️.
|
|
11
10
|
|
|
12
11
|
The first page that appears is the main menu. From there, you can start the game, load a saved game, or go to the settings.
|
|
13
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Pixi’VN template (React + Vite + MUI joy)
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
5
|
This is a template for creating visual novels in React. It uses the Pixi’VN library and Vite as a build tool.
|
|
6
6
|
This Template contains basic functionality inspired by the widespread Visual Noval engine Ren'Py.
|
|
@@ -37,6 +37,7 @@ This template uses the following libraries:
|
|
|
37
37
|
Core libraries:
|
|
38
38
|
|
|
39
39
|
* [Pixi’VN](https://www.npmjs.com/package/@drincs/pixi-vn): A visual novel library.
|
|
40
|
+
* [Pixi’VN - *ink* Integration](https://www.npmjs.com/package/@drincs/pixi-vn-ink): A library that provides integration with the *ink* language.
|
|
40
41
|
* [Vite](https://vitejs.dev/): A build tool that aims to provide a faster and leaner development experience for modern web projects.
|
|
41
42
|
* [Vite Checker](https://www.npmjs.com/package/vite-plugin-checker): A Vite plugin that checks TypeScript types and ESLint on each build.
|
|
42
43
|
* [PWA Vite Plugin](https://vite-pwa-org.netlify.app): A Vite plugin that provides PWA support. This allows the possibility of installing the game as a Progressive Web App.
|
|
@@ -71,11 +72,47 @@ Before starting, you need to have Node.js installed on your computer. If you don
|
|
|
71
72
|
* [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint): Integrates ESLint into VS Code.
|
|
72
73
|
* [vscode-color-picker](https://marketplace.visualstudio.com/items?itemName=antiantisepticeye.vscode-color-picker): A color picker for Visual Studio Code.
|
|
73
74
|
* [Version Lens](https://marketplace.visualstudio.com/items?itemName=pflannery.vscode-versionlens): Shows the latest version for each package using code lens.
|
|
75
|
+
* [ink - Pixi'VN](https://marketplace.visualstudio.com/items?itemName=drincs-productions.pixi-vn-ink-vscode): Syntax highlighting for the Ink language.
|
|
74
76
|
|
|
75
77
|
### Change the icon
|
|
76
78
|
|
|
77
79
|
You can change the icon of the game by replacing the images in the `public` folder.
|
|
78
80
|
|
|
81
|
+
## *ink* - Custom hashtag scripts
|
|
82
|
+
|
|
83
|
+
By using the [onInkHashtagScript](https://pixi-vn.web.app/ink/ink-hashtag.html) function, in this template the following features have been added.
|
|
84
|
+
|
|
85
|
+
**Moving between screens**: This feature allows you to navigate between different screens. The syntax is as follows:
|
|
86
|
+
|
|
87
|
+
`#` + `navigate` + `[route]`
|
|
88
|
+
|
|
89
|
+
`route`: The route/path to navigate to. Read more about routes in the [Router documentation](https://pixi-vn.web.app/start/interface-navigate.html).
|
|
90
|
+
|
|
91
|
+
```ink
|
|
92
|
+
#navigate /narration
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Rename the character**: This feature allows you to change the name of the character speaking. The syntax is as follows:
|
|
96
|
+
|
|
97
|
+
`#` + `rename` + `[character id]` + `[new name]`
|
|
98
|
+
|
|
99
|
+
### *ink* - ink files in the project
|
|
100
|
+
|
|
101
|
+
The `ink` folder contains the *ink* files that will be used in the game. In this project, all files `.ink`, that are in the `ink` folder, will be included automatically in the project. You can change this behavior by modifying the `src/utils/ink-utility.ts` file.
|
|
102
|
+
|
|
103
|
+
### *ink* - Writing/testing the narrative with Inky
|
|
104
|
+
|
|
105
|
+
To write and test the narrative, you can use the **Inky editor**. Inky is a tool for writing interactive fiction using the Ink language. Of course, the special features introduced by pixi-vn will not be ignored by Inky. You can download it [here](https://www.inklestudios.com/ink/).
|
|
106
|
+
|
|
107
|
+
To use Inky with this template, you can open the `src/main.ink` file in Inky.
|
|
108
|
+
|
|
109
|
+
```ink
|
|
110
|
+
// main.ink
|
|
111
|
+
INCLUDE ink/start.ink
|
|
112
|
+
INCLUDE ink/second.ink
|
|
113
|
+
-> start
|
|
114
|
+
```
|
|
115
|
+
|
|
79
116
|
## Installation
|
|
80
117
|
|
|
81
118
|
First, is necessary install the dependencies. To do this, open a terminal in the root folder of the project and run the following command:
|
|
@@ -4,9 +4,10 @@ import { useI18n } from "./i18n";
|
|
|
4
4
|
import LoadingScreen from "./screens/LoadingScreen";
|
|
5
5
|
import { defineAssets } from "./utils/assets-utility";
|
|
6
6
|
import { initializeIndexedDB } from "./utils/indexedDB-utility";
|
|
7
|
+
import { importAllInkLabels } from "./utils/ink-utility";
|
|
7
8
|
|
|
8
9
|
const Home = lazy(async () => {
|
|
9
|
-
await Promise.all([initializeIndexedDB(), defineAssets(), useI18n()]);
|
|
10
|
+
await Promise.all([initializeIndexedDB(), defineAssets(), useI18n(), importAllInkLabels()]);
|
|
10
11
|
return import("./Home");
|
|
11
12
|
});
|
|
12
13
|
|
|
@@ -2,6 +2,7 @@ import { Box } from "@mui/joy";
|
|
|
2
2
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
3
3
|
import Routes from "./AppRoutes";
|
|
4
4
|
import useClosePageDetector from "./hooks/useClosePageDetector";
|
|
5
|
+
import useInkInitialization from "./hooks/useInkInitialization";
|
|
5
6
|
import useKeyboardDetector from "./hooks/useKeyboardDetector";
|
|
6
7
|
import useEventListener from "./hooks/useKeyDetector";
|
|
7
8
|
import Imports from "./Imports";
|
|
@@ -13,6 +14,7 @@ import Settings from "./screens/Settings";
|
|
|
13
14
|
function HomeChild() {
|
|
14
15
|
useKeyboardDetector();
|
|
15
16
|
useClosePageDetector();
|
|
17
|
+
useInkInitialization();
|
|
16
18
|
// Prevent the user from going back to the previous page
|
|
17
19
|
useEventListener({
|
|
18
20
|
type: "popstate",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AssetsManifest } from "@drincs/pixi-vn";
|
|
2
2
|
import { MAIN_MENU_ROUTE } from "../constans";
|
|
3
|
-
import startLabel, { secondPart } from "../labels/startLabel";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Manifest for the assets used in the game.
|
|
@@ -20,7 +19,7 @@ const manifest: AssetsManifest = {
|
|
|
20
19
|
},
|
|
21
20
|
// labels
|
|
22
21
|
{
|
|
23
|
-
name:
|
|
22
|
+
name: "start",
|
|
24
23
|
assets: [
|
|
25
24
|
{
|
|
26
25
|
alias: "bg01-hallway",
|
|
@@ -29,7 +28,7 @@ const manifest: AssetsManifest = {
|
|
|
29
28
|
],
|
|
30
29
|
},
|
|
31
30
|
{
|
|
32
|
-
name:
|
|
31
|
+
name: "second_part",
|
|
33
32
|
assets: [
|
|
34
33
|
{
|
|
35
34
|
alias: "bg02-dorm",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { initializeInk } from "../utils/ink-utility";
|
|
3
|
+
import useMyNavigate from "./useMyNavigate";
|
|
4
|
+
|
|
5
|
+
export default function useInkInitialization() {
|
|
6
|
+
const navigate = useMyNavigate();
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
initializeInk({ navigate });
|
|
10
|
+
}, []);
|
|
11
|
+
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getCharacterById } from "@drincs/pixi-vn";
|
|
1
2
|
import i18n from "i18next";
|
|
2
3
|
import Backend from "i18next-chained-backend";
|
|
3
4
|
import resourcesToBackend from "i18next-resources-to-backend";
|
|
@@ -28,6 +29,17 @@ export const useI18n = () => {
|
|
|
28
29
|
}),
|
|
29
30
|
],
|
|
30
31
|
},
|
|
32
|
+
missingInterpolationHandler(_text, value, _options) {
|
|
33
|
+
let key = value[1];
|
|
34
|
+
if (key === "steph_fullname") {
|
|
35
|
+
return "Stephanie";
|
|
36
|
+
}
|
|
37
|
+
let character = getCharacterById(key);
|
|
38
|
+
if (character) {
|
|
39
|
+
return character.name;
|
|
40
|
+
}
|
|
41
|
+
return `[${key}]`;
|
|
42
|
+
},
|
|
31
43
|
});
|
|
32
44
|
}
|
|
33
45
|
};
|