Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e22a98c08 | ||
|
|
8a7a1295ca | ||
|
|
9644b2a849 | ||
|
|
b257076d07 |
No files matched your search
@@ -12,6 +12,7 @@ obj/
|
||||
gen/
|
||||
obj/
|
||||
bin/
|
||||
art_sources/
|
||||
|
||||
*.tres~
|
||||
*.tscn~
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
+88
@@ -0,0 +1,88 @@
|
||||
# Interactive Base — things to click in a scene
|
||||
|
||||
Interactive Base puts clickable objects into a picture scene: a thing lying on the ground, a door, a spot "behind the crypt". An object can have its own picture drawn over the background, it can glow when the mouse is over it, and a click starts a scenario. Scenarios add and remove objects as the story goes on.
|
||||
|
||||
It is used by Cthangover's prologue. Tile maps of RPG World use their own events instead.
|
||||
|
||||
## In the game
|
||||
|
||||
At the start of Cthangover a red cloth lies by the bicycle in the alley. It is not part of the background: it is an interactive object with its own picture.
|
||||
|
||||

|
||||
|
||||
When the mouse is over the cloth, the pointer becomes a hand and the cloth takes on a faint gold tint:
|
||||
|
||||

|
||||
|
||||
A click starts the cloth's scenario: Marao picks it up, and the scenario removes the object from the scene.
|
||||
|
||||

|
||||
|
||||
## An interactive object
|
||||
|
||||
Objects are JSON files in a mod's `interactives/` folder. This is the cloth from the pictures (from Cthangover), with its outline shortened:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"id": "cloak_ground",
|
||||
"texture": "cloak_ground",
|
||||
"layer": "foreground",
|
||||
"zIndex": 5,
|
||||
"cursor": "PointingHand",
|
||||
"hitArea": {
|
||||
"type": "polygon",
|
||||
"vertices": [
|
||||
{ "x": 0.2796, "y": 0.7318 }, { "x": 0.3207, "y": 0.7167 },
|
||||
{ "x": 0.3456, "y": 0.8434 }, { "x": 0.3387, "y": 0.8872 }
|
||||
]
|
||||
},
|
||||
"highlight": { "color": "#FFD70044", "scale": 1, "duration": 0.12 },
|
||||
"actions": {
|
||||
"onClick": { "scenario": "scenarios/prolog/morning_cloak.scenario" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `texture` — a picture the size of the whole screen, transparent except for the object, so it lines up with the background by itself. Leave it out for an invisible spot.
|
||||
- `hitArea` — where the object can be clicked, in fractions of the screen (0–1): `rect` with `x`, `y`, `width`, `height`; `circle` with `x`, `y`, `radius`; or `polygon` with `vertices`.
|
||||
- `layer` — `background` or `foreground`; both are part of the picture and stay under the dialog box, the toolbar and the panels. `ui` is drawn above everything.
|
||||
- `zIndex` — order among objects of the same layer: a higher number is drawn on top.
|
||||
- `cursor` — the mouse pointer over the object, for example `PointingHand`.
|
||||
- `highlight` — the tint while the mouse is over it: `color` (with transparency), `scale`, `duration` of the fade in seconds.
|
||||
- `enabled`, `visible` — whether it reacts and whether it is drawn at first.
|
||||
- `actions` — `onClick` runs a `scenario` file or inline `commands`; `onHoverEnter` and `onHoverLeave` run scenario commands.
|
||||
|
||||
## Putting objects into a scene
|
||||
|
||||
A definition alone does not appear anywhere. A scenario of the scene adds it, and the click's scenario usually removes it:
|
||||
|
||||
```scenario
|
||||
interactive_add cloak_ground
|
||||
interactive_remove cloak_ground
|
||||
```
|
||||
|
||||
Objects are cleared when the scene changes, so Cthangover adds them again on every entry with a scene scenario that checks the story:
|
||||
|
||||
```scenario
|
||||
scene: prolog_alley
|
||||
priority: 15
|
||||
condition: AwakeningQuest.notHasTag("cloak_taken") && AwakeningQuest.notHasTag("book_taken")
|
||||
---
|
||||
interactive_add cloak_ground
|
||||
interactive_add book_ground
|
||||
end
|
||||
```
|
||||
|
||||
Adding an object that is already there does nothing, so this is safe to repeat.
|
||||
|
||||
Objects can also be placed and their click areas drawn in the interactive editor of Editor Tools.
|
||||
|
||||
## If something goes wrong
|
||||
|
||||
1. **Nothing happens on click.** The object was never added in this scene, it is not `enabled`, or the click is outside its `hitArea`.
|
||||
2. **The picture is in the wrong place.** The texture must be a full-screen picture matching the background, not a small cut-out.
|
||||
3. **The object comes back after it was taken.** The scenario that adds it must check the same tag or flag that the click's scenario sets.
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
# Interactive Base — objetos clicables dentro de la escena
|
||||
|
||||
Interactive Base coloca objetos clicables en las escenas de imagen: un objeto tirado en el suelo, una puerta, un punto «detrás de la cripta». Un objeto puede llevar su propia imagen dibujada sobre el fondo, puede brillar cuando el ratón pasa por encima, y un clic lanza un escenario. Los escenarios añaden y quitan objetos a medida que avanza la historia.
|
||||
|
||||
Lo usa el prólogo de Cthangover. Los mapas de tiles de RPG World funcionan en cambio con sus propios eventos.
|
||||
|
||||
## En el juego
|
||||
|
||||
Al principio de Cthangover, un paño rojo descansa junto a la bicicleta, en el callejón. No es parte del fondo: es un objeto interactivo con su propia imagen.
|
||||
|
||||

|
||||
|
||||
Cuando el ratón pasa sobre el paño, el puntero se convierte en una mano y el paño toma un leve tinte dorado:
|
||||
|
||||

|
||||
|
||||
Un clic inicia el escenario del paño: Marao lo recoge, y el escenario retira el objeto de la escena.
|
||||
|
||||

|
||||
|
||||
## Un objeto interactivo
|
||||
|
||||
Los objetos son archivos JSON en la carpeta `interactives/` de un mod. Este es el paño de las imágenes (de Cthangover), con su contorno acortado:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"id": "cloak_ground",
|
||||
"texture": "cloak_ground",
|
||||
"layer": "foreground",
|
||||
"zIndex": 5,
|
||||
"cursor": "PointingHand",
|
||||
"hitArea": {
|
||||
"type": "polygon",
|
||||
"vertices": [
|
||||
{ "x": 0.2796, "y": 0.7318 }, { "x": 0.3207, "y": 0.7167 },
|
||||
{ "x": 0.3456, "y": 0.8434 }, { "x": 0.3387, "y": 0.8872 }
|
||||
]
|
||||
},
|
||||
"highlight": { "color": "#FFD70044", "scale": 1, "duration": 0.12 },
|
||||
"actions": {
|
||||
"onClick": { "scenario": "scenarios/prolog/morning_cloak.scenario" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `texture` — una imagen del tamaño de toda la pantalla, transparente salvo por el objeto, de modo que encaja sola con el fondo. Omítela para un punto invisible.
|
||||
- `hitArea` — dónde se puede hacer clic en el objeto, en fracciones de la pantalla (0–1): `rect` con `x`, `y`, `width`, `height`; `circle` con `x`, `y`, `radius`; o `polygon` con `vertices`.
|
||||
- `layer` — `background` o `foreground`; ambos son parte de la imagen y quedan bajo la caja de diálogo, la barra de herramientas y los paneles. `ui` se dibuja sobre todo lo demás.
|
||||
- `zIndex` — el orden entre los objetos de una misma capa: el número mayor se dibuja encima.
|
||||
- `cursor` — el puntero del ratón sobre el objeto, por ejemplo `PointingHand`.
|
||||
- `highlight` — el tinte mientras el ratón está encima: `color` (con transparencia), `scale` y `duration` del fundido en segundos.
|
||||
- `enabled`, `visible` — si reacciona y si se dibuja al principio.
|
||||
- `actions` — `onClick` ejecuta un archivo `scenario` o `commands` en línea; `onHoverEnter` y `onHoverLeave` ejecutan órdenes de escenario.
|
||||
|
||||
## Cómo se colocan los objetos en una escena
|
||||
|
||||
Una definición por sí sola no aparece en ninguna parte. La añade un escenario de la escena, y normalmente la retira el escenario del clic:
|
||||
|
||||
```scenario
|
||||
interactive_add cloak_ground
|
||||
interactive_remove cloak_ground
|
||||
```
|
||||
|
||||
Los objetos se limpian al cambiar de escena, así que Cthangover los vuelve a añadir en cada entrada con un escenario de escena que consulta la historia:
|
||||
|
||||
```scenario
|
||||
scene: prolog_alley
|
||||
priority: 15
|
||||
condition: AwakeningQuest.notHasTag("cloak_taken") && AwakeningQuest.notHasTag("book_taken")
|
||||
---
|
||||
interactive_add cloak_ground
|
||||
interactive_add book_ground
|
||||
end
|
||||
```
|
||||
|
||||
Añadir un objeto que ya está no hace nada, así que se puede repetir sin miedo.
|
||||
|
||||
También se pueden colocar los objetos y dibujar sus áreas de clic en el editor de interactivos de Editor Tools.
|
||||
|
||||
## Si algo falla
|
||||
|
||||
1. **El clic no hace nada.** El objeto nunca se añadió en esta escena, no está `enabled`, o el clic cayó fuera de su `hitArea`.
|
||||
2. **La imagen está en un lugar equivocado.** La textura debe ser una imagen a pantalla completa que encaje con el fondo, no un pequeño recorte.
|
||||
3. **El objeto reaparece después de recogerlo.** El escenario que lo añade debe comprobar la misma etiqueta o marcador que activa el escenario del clic.
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
# Interactive Base — シーンの中でクリックできるもの
|
||||
|
||||
Interactive Base は、画像シーンにクリックできるオブジェクトを置きます。地面に落ちている物、扉、"墓の裏"の一点などです。オブジェクトには背景の上に重ねる独自の画像を持たせられ、マウスカーソルを重ねると光らせられ、クリックでシナリオを開始できます。シナリオは物語の進行に合わせてオブジェクトを追加・削除します。
|
||||
|
||||
Cthangover のプロローグがこれを使います。RPG World のタイルマップは、代わりに独自のイベントを使います。
|
||||
|
||||
## ゲームの中で
|
||||
|
||||
Cthangover の冒頭、路地では自転車のそばに赤い布が置かれています。これは背景の一部ではなく、独自の画像を持つインタラクティブオブジェクトです。
|
||||
|
||||

|
||||
|
||||
マウスを布に重ねると、ポインターは手の形に変わり、布はかすかな金色を帯びます。
|
||||
|
||||

|
||||
|
||||
クリックすると布のシナリオが始まります。Marao がそれを拾うと、シナリオはオブジェクトをシーンから取り除きます。
|
||||
|
||||

|
||||
|
||||
## インタラクティブオブジェクト
|
||||
|
||||
オブジェクトは、mod の `interactives/` フォルダーに入る JSON ファイルです。こちらは画像の布(Cthangover のもの)で、輪郭の頂点は短くしてあります。
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"id": "cloak_ground",
|
||||
"texture": "cloak_ground",
|
||||
"layer": "foreground",
|
||||
"zIndex": 5,
|
||||
"cursor": "PointingHand",
|
||||
"hitArea": {
|
||||
"type": "polygon",
|
||||
"vertices": [
|
||||
{ "x": 0.2796, "y": 0.7318 }, { "x": 0.3207, "y": 0.7167 },
|
||||
{ "x": 0.3456, "y": 0.8434 }, { "x": 0.3387, "y": 0.8872 }
|
||||
]
|
||||
},
|
||||
"highlight": { "color": "#FFD70044", "scale": 1, "duration": 0.12 },
|
||||
"actions": {
|
||||
"onClick": { "scenario": "scenarios/prolog/morning_cloak.scenario" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `texture` — 画面全体と同じ大きさの画像で、オブジェクト以外は透明なので、背景に自然と重なります。見えない地点にするなら省きます。
|
||||
- `hitArea` — オブジェクトをクリックできる範囲を、画面に対する割合(0–1)で示します。`rect` は `x`、`y`、`width`、`height`、`circle` は `x`、`y`、`radius`、`polygon` は `vertices` を使います。
|
||||
- `layer` — `background` か `foreground`。どちらも絵の一部で、ダイアログボックス・ツールバー・パネルの下に置かれます。`ui` は何よりも上に描かれます。
|
||||
- `zIndex` — 同じレイヤーのオブジェクト同士の順序。数値が大きいほど上に描かれます。
|
||||
- `cursor` — オブジェクト上でのマウスポインター。例は `PointingHand`。
|
||||
- `highlight` — マウスが乗っている間の色づけ。`color`(透明度つき)、`scale`、フェードの `duration`(秒)です。
|
||||
- `enabled`、`visible` — 反応するか、最初に描画されるか。
|
||||
- `actions` — `onClick` は `scenario` ファイルかインラインの `commands` を実行し、`onHoverEnter` と `onHoverLeave` はシナリオコマンドを実行します。
|
||||
|
||||
## オブジェクトをシーンに置く
|
||||
|
||||
定義だけでは何も表示されません。追加するのはシーンのシナリオで、通常はクリック先のシナリオが取り除きます。
|
||||
|
||||
```scenario
|
||||
interactive_add cloak_ground
|
||||
interactive_remove cloak_ground
|
||||
```
|
||||
|
||||
シーンが変わるとオブジェクトは消えるため、Cthangover は入るたびに、物語の状態を確かめるシーンのシナリオで改めて追加します。
|
||||
|
||||
```scenario
|
||||
scene: prolog_alley
|
||||
priority: 15
|
||||
condition: AwakeningQuest.notHasTag("cloak_taken") && AwakeningQuest.notHasTag("book_taken")
|
||||
---
|
||||
interactive_add cloak_ground
|
||||
interactive_add book_ground
|
||||
end
|
||||
```
|
||||
|
||||
すでに存在するオブジェクトを追加しても何も起きないので、繰り返しても安全です。
|
||||
|
||||
オブジェクトの配置とクリック領域の描画は、Editor Tools のインタラクティブエディターでも行えます。
|
||||
|
||||
## うまく動かないとき
|
||||
|
||||
1. **クリックしても何も起きない。** このシーンにオブジェクトが追加されていないか、`enabled` がオフか、クリックが `hitArea` の外だったかです。
|
||||
2. **画像がずれている。** テクスチャーは背景と重なる画面全体の画像である必要があり、小さな切り抜きではいけません。
|
||||
3. **取ったはずのオブジェクトが戻ってくる。** 追加する側のシナリオは、クリック先のシナリオが立てるのと同じタグやフラグを確認しなければなりません。
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
# Interactive Base — 장면 안에서 클릭할 수 있는 것들
|
||||
|
||||
Interactive Base는 그림 장면에 클릭할 수 있는 오브젝트를 넣습니다. 땅에 놓인 물건, 문, "납골당 뒤"의 한 지점 같은 것입니다. 오브젝트는 배경 위에 그려지는 자체 이미지를 가질 수 있고, 마우스를 올리면 빛나며, 클릭하면 시나리오가 시작됩니다. 시나리오는 이야기가 진행됨에 따라 오브젝트를 추가하거나 제거합니다.
|
||||
|
||||
Cthangover의 프롤로그가 이를 사용합니다. RPG World의 타일 맵은 대신 자체 이벤트를 사용합니다.
|
||||
|
||||
## 게임 속에서
|
||||
|
||||
Cthangover 시작 부분에서 골목의 자전거 옆에는 붉은 천이 놓여 있습니다. 배경의 일부가 아니라 자체 이미지를 가진 인터랙티브 오브젝트입니다.
|
||||
|
||||

|
||||
|
||||
마우스를 천 위에 올리면 포인터가 손 모양으로 바뀌고, 천은 은은한 금빛으로 물듭니다.
|
||||
|
||||

|
||||
|
||||
클릭하면 천의 시나리오가 시작됩니다. Marao가 그것을 주우면, 시나리오는 오브젝트를 장면에서 제거합니다.
|
||||
|
||||

|
||||
|
||||
## 인터랙티브 오브젝트
|
||||
|
||||
오브젝트는 mod의 `interactives/` 폴더에 들어 있는 JSON 파일입니다. 사진 속 천(Cthangover 것)이며, 외곽선 정점은 축약했습니다.
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"id": "cloak_ground",
|
||||
"texture": "cloak_ground",
|
||||
"layer": "foreground",
|
||||
"zIndex": 5,
|
||||
"cursor": "PointingHand",
|
||||
"hitArea": {
|
||||
"type": "polygon",
|
||||
"vertices": [
|
||||
{ "x": 0.2796, "y": 0.7318 }, { "x": 0.3207, "y": 0.7167 },
|
||||
{ "x": 0.3456, "y": 0.8434 }, { "x": 0.3387, "y": 0.8872 }
|
||||
]
|
||||
},
|
||||
"highlight": { "color": "#FFD70044", "scale": 1, "duration": 0.12 },
|
||||
"actions": {
|
||||
"onClick": { "scenario": "scenarios/prolog/morning_cloak.scenario" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `texture` — 화면 전체 크기의 그림으로, 오브젝트 외에는 투명하므로 배경과 저절로 맞춰집니다. 보이지 않는 지점으로 만들려면 생략합니다.
|
||||
- `hitArea` — 오브젝트를 클릭할 수 있는 위치로, 화면 비율(0–1)로 나타냅니다. `rect`는 `x`, `y`, `width`, `height`, `circle`은 `x`, `y`, `radius`, `polygon`은 `vertices`를 씁니다.
|
||||
- `layer` — `background` 또는 `foreground`. 둘 다 그림의 일부로 대화 상자, 툴바, 패널 아래에 머뭅니다. `ui`는 모든 것 위에 그려집니다.
|
||||
- `zIndex` — 같은 레이어 오브젝트 사이의 순서: 숫자가 클수록 위에 그려집니다.
|
||||
- `cursor` — 오브젝트 위의 마우스 포인터, 예를 들어 `PointingHand`.
|
||||
- `highlight` — 마우스가 올라와 있는 동안의 색조: `color`(투명도 포함), `scale`, 페이드 시간 `duration`(초).
|
||||
- `enabled`, `visible` — 반응하는지, 처음에 그려지는지.
|
||||
- `actions` — `onClick`은 `scenario` 파일이나 인라인 `commands`를 실행하고, `onHoverEnter`와 `onHoverLeave`는 시나리오 커맨드를 실행합니다.
|
||||
|
||||
## 오브젝트를 장면에 넣기
|
||||
|
||||
정의만으로는 어디에도 나타나지 않습니다. 장면의 시나리오가 오브젝트를 추가하고, 보통 클릭의 시나리오가 제거합니다.
|
||||
|
||||
```scenario
|
||||
interactive_add cloak_ground
|
||||
interactive_remove cloak_ground
|
||||
```
|
||||
|
||||
장면이 바뀌면 오브젝트는 지워지므로, Cthangover는 들어올 때마다 이야기를 확인하는 장면 시나리오로 다시 추가합니다.
|
||||
|
||||
```scenario
|
||||
scene: prolog_alley
|
||||
priority: 15
|
||||
condition: AwakeningQuest.notHasTag("cloak_taken") && AwakeningQuest.notHasTag("book_taken")
|
||||
---
|
||||
interactive_add cloak_ground
|
||||
interactive_add book_ground
|
||||
end
|
||||
```
|
||||
|
||||
이미 있는 오브젝트를 추가해도 아무 일도 일어나지 않으므로, 반복해도 안전합니다.
|
||||
|
||||
오브젝트 배치와 클릭 영역 그리기는 Editor Tools의 인터랙티브 편집기에서도 할 수 있습니다.
|
||||
|
||||
## 문제가 생겼을 때
|
||||
|
||||
1. **클릭해도 아무 일도 없습니다.** 오브젝트가 이 장면에 추가된 적이 없거나, `enabled`가 꺼져 있거나, 클릭이 `hitArea` 밖에 있었던 경우입니다.
|
||||
2. **그림이 엉뚱한 곳에 있습니다.** 텍스처는 배경과 맞는 화면 전체 크기의 그림이어야 하며, 잘라낸 작은 조각이면 안 됩니다.
|
||||
3. **가져간 오브젝트가 다시 나타납니다.** 추가하는 시나리오는 클릭의 시나리오가 설정하는 것과 같은 태그나 플래그를 확인해야 합니다.
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
# Interactive Base — то, по чему можно щёлкнуть в сцене
|
||||
|
||||
Interactive Base добавляет в картинки-сцены кликабельные объекты: вещь, лежащую на земле, дверь, место «за склепом». У объекта может быть своя картинка поверх фона, он может подсвечиваться под курсором, а клик по нему запускает сценарий. Сценарии добавляют и убирают объекты по ходу истории.
|
||||
|
||||
Interactive Base использует пролог Cthangover. Тайловые карты RPG World вместо этого работают со своими событиями.
|
||||
|
||||
## В игре
|
||||
|
||||
В начале Cthangover в переулке у велосипеда лежит красная тряпка. Она — не часть фона: это интерактивный объект со своей картинкой.
|
||||
|
||||

|
||||
|
||||
Когда курсор оказывается над тряпкой, он превращается в руку, а тряпка приобретает лёгкий золотистый оттенок:
|
||||
|
||||

|
||||
|
||||
Клик запускает сценарий тряпки: Марао поднимает её, а сценарий убирает объект со сцены.
|
||||
|
||||

|
||||
|
||||
## Интерактивный объект
|
||||
|
||||
Объекты — это JSON-файлы в папке `interactives/` мода. Вот тряпка с картинок (из Cthangover), контур в ней сокращён:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"id": "cloak_ground",
|
||||
"texture": "cloak_ground",
|
||||
"layer": "foreground",
|
||||
"zIndex": 5,
|
||||
"cursor": "PointingHand",
|
||||
"hitArea": {
|
||||
"type": "polygon",
|
||||
"vertices": [
|
||||
{ "x": 0.2796, "y": 0.7318 }, { "x": 0.3207, "y": 0.7167 },
|
||||
{ "x": 0.3456, "y": 0.8434 }, { "x": 0.3387, "y": 0.8872 }
|
||||
]
|
||||
},
|
||||
"highlight": { "color": "#FFD70044", "scale": 1, "duration": 0.12 },
|
||||
"actions": {
|
||||
"onClick": { "scenario": "scenarios/prolog/morning_cloak.scenario" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `texture` — картинка размером во весь экран, прозрачная везде, кроме самого объекта, поэтому с фоном она совмещается сама. Уберите её, если нужен невидимый участок.
|
||||
- `hitArea` — где объект можно щёлкать, в долях экрана (0–1): `rect` с `x`, `y`, `width`, `height`; `circle` с `x`, `y`, `radius`; или `polygon` с `vertices`.
|
||||
- `layer` — `background` или `foreground`; оба — часть картинки и остаются под окном диалога, панелью инструментов и панелями. `ui` рисуется поверх всего.
|
||||
- `zIndex` — порядок среди объектов одного слоя: большее число рисуется сверху.
|
||||
- `cursor` — курсор мыши над объектом, например `PointingHand`.
|
||||
- `highlight` — подсветка, пока курсор над объектом: `color` (с прозрачностью), `scale` и `duration` появления в секундах.
|
||||
- `enabled`, `visible` — реагирует ли объект и рисуется ли он поначалу.
|
||||
- `actions` — `onClick` запускает файл `scenario` или `commands` прямо в строке; `onHoverEnter` и `onHoverLeave` выполняют сценарные команды.
|
||||
|
||||
## Как объекты попадают в сцену
|
||||
|
||||
Само по себе описание нигде не появляется. Объект добавляет сценарий сцены, а убирает обычно сценарий клика:
|
||||
|
||||
```scenario
|
||||
interactive_add cloak_ground
|
||||
interactive_remove cloak_ground
|
||||
```
|
||||
|
||||
При смене сцены объекты очищаются, поэтому Cthangover добавляет их заново при каждом входе — сценарием сцены, который проверяет сюжет:
|
||||
|
||||
```scenario
|
||||
scene: prolog_alley
|
||||
priority: 15
|
||||
condition: AwakeningQuest.notHasTag("cloak_taken") && AwakeningQuest.notHasTag("book_taken")
|
||||
---
|
||||
interactive_add cloak_ground
|
||||
interactive_add book_ground
|
||||
end
|
||||
```
|
||||
|
||||
Добавление объекта, который уже есть, ничего не делает, поэтому повторять это безопасно.
|
||||
|
||||
Расставить объекты и нарисовать их области клика можно и в интерактивном редакторе Editor Tools.
|
||||
|
||||
## Если что-то пошло не так
|
||||
|
||||
1. **Клик ни к чему не приводит.** Объект ни разу не добавлялся в этой сцене, у него выключен `enabled`, либо клик пришёлся мимо `hitArea`.
|
||||
2. **Картинка стоит не на месте.** Текстура должна быть картинкой во весь экран, совпадающей с фоном, а не маленькой вырезкой.
|
||||
3. **Объект возвращается после того, как его взяли.** Сценарий, который его добавляет, должен проверять тот же тег или флаг, который ставит сценарий клика.
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
# Interactive Base — những thứ có thể nhấp trong cảnh
|
||||
|
||||
Interactive Base đưa các đối tượng có thể nhấp vào cảnh bằng hình ảnh: một vật nằm trên đất, một cánh cửa, một điểm "sau ngôi mộ đá". Đối tượng có thể có ảnh riêng vẽ đè lên nền, có thể sáng lên khi rê chuột, và một cú nhấp khởi chạy kịch bản. Kịch bản thêm và gỡ đối tượng theo tiến triển của câu chuyện.
|
||||
|
||||
Prologue của Cthangover dùng mod này. Bản đồ tile của RPG World dùng sự kiện riêng của mình thay thế.
|
||||
|
||||
## Trong game
|
||||
|
||||
Mở đầu Cthangover, trong con hẻm có một mảnh vải đỏ nằm cạnh chiếc xe đạp. Nó không phải một phần của nền: đó là một đối tượng tương tác có ảnh riêng.
|
||||
|
||||

|
||||
|
||||
Khi rê chuột lên mảnh vải, con trỏ biến thành hình bàn tay và mảnh vải ánh lên một sắc vàng nhạt:
|
||||
|
||||

|
||||
|
||||
Một cú nhấp khởi chạy kịch bản của mảnh vải: Marao nhặt nó lên, và kịch bản gỡ đối tượng khỏi cảnh.
|
||||
|
||||

|
||||
|
||||
## Một đối tượng tương tác
|
||||
|
||||
Các đối tượng là tệp JSON trong thư mục `interactives/` của mod. Đây chính là mảnh vải trong các hình trên (thuộc Cthangover), với phần viền đỉnh rút gọn:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"id": "cloak_ground",
|
||||
"texture": "cloak_ground",
|
||||
"layer": "foreground",
|
||||
"zIndex": 5,
|
||||
"cursor": "PointingHand",
|
||||
"hitArea": {
|
||||
"type": "polygon",
|
||||
"vertices": [
|
||||
{ "x": 0.2796, "y": 0.7318 }, { "x": 0.3207, "y": 0.7167 },
|
||||
{ "x": 0.3456, "y": 0.8434 }, { "x": 0.3387, "y": 0.8872 }
|
||||
]
|
||||
},
|
||||
"highlight": { "color": "#FFD70044", "scale": 1, "duration": 0.12 },
|
||||
"actions": {
|
||||
"onClick": { "scenario": "scenarios/prolog/morning_cloak.scenario" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `texture` — một ảnh cỡ toàn màn hình, trong suốt trừ phần đối tượng, nên tự khớp với nền. Bỏ trống nếu muốn một điểm vô hình.
|
||||
- `hitArea` — vùng có thể nhấp vào đối tượng, theo tỉ lệ màn hình (0–1): `rect` với `x`, `y`, `width`, `height`; `circle` với `x`, `y`, `radius`; hoặc `polygon` với `vertices`.
|
||||
- `layer` — `background` hoặc `foreground`; cả hai đều thuộc phần tranh và nằm dưới hộp hội thoại, thanh công cụ và các bảng. `ui` được vẽ trên tất cả.
|
||||
- `zIndex` — thứ tự giữa các đối tượng cùng lớp: số lớn hơn được vẽ đè lên.
|
||||
- `cursor` — con trỏ chuột khi rê trên đối tượng, ví dụ `PointingHand`.
|
||||
- `highlight` — sắc màu khi chuột rê lên: `color` (kèm độ trong suốt), `scale` và `duration` của hiệu ứng mờ dần tính bằng giây.
|
||||
- `enabled`, `visible` — có phản ứng hay không và có được vẽ ngay từ đầu hay không.
|
||||
- `actions` — `onClick` chạy một tệp `scenario` hoặc `commands` viết ngay tại chỗ; `onHoverEnter` và `onHoverLeave` chạy các lệnh kịch bản.
|
||||
|
||||
## Đưa đối tượng vào cảnh
|
||||
|
||||
Một định nghĩa đơn lẻ không hiện ra ở đâu cả. Kịch bản của cảnh sẽ thêm nó vào, còn kịch bản của cú nhấp thường gỡ nó ra:
|
||||
|
||||
```scenario
|
||||
interactive_add cloak_ground
|
||||
interactive_remove cloak_ground
|
||||
```
|
||||
|
||||
Khi đổi cảnh, các đối tượng bị dọn sạch, nên Cthangover thêm lại chúng vào mỗi lần người chơi bước vào, bằng một kịch bản cảnh có kiểm tra cốt truyện:
|
||||
|
||||
```scenario
|
||||
scene: prolog_alley
|
||||
priority: 15
|
||||
condition: AwakeningQuest.notHasTag("cloak_taken") && AwakeningQuest.notHasTag("book_taken")
|
||||
---
|
||||
interactive_add cloak_ground
|
||||
interactive_add book_ground
|
||||
end
|
||||
```
|
||||
|
||||
Thêm một đối tượng đã có sẵn không gây gì cả, nên việc lặp lại là an toàn.
|
||||
|
||||
Bạn cũng có thể đặt đối tượng và vẽ vùng nhấp của chúng trong trình soạn thảo tương tác của Editor Tools.
|
||||
|
||||
## Khi có trục trặc
|
||||
|
||||
1. **Nhấp không có gì xảy ra.** Đối tượng chưa từng được thêm vào cảnh này, `enabled` chưa bật, hoặc cú nhấp rơi ngoài `hitArea`.
|
||||
2. **Ảnh nằm sai chỗ.** Texture phải là ảnh cỡ toàn màn hình khớp với nền, chứ không phải một mảnh cắt nhỏ.
|
||||
3. **Đối tượng trở lại sau khi đã bị lấy đi.** Kịch bản thêm nó vào phải kiểm tra cùng một thẻ hay cờ mà kịch bản của cú nhấp đã đặt.
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
# Interactive Base — 场景中可点击的对象
|
||||
|
||||
Interactive Base 为图像场景加入可点击的对象:地上的东西、一扇门、"墓穴后面"的某个位置。对象可以有一张叠在背景之上的图片,鼠标悬停时可以发光,点击则启动一段剧本。剧本会随着故事推进添加和移除对象。
|
||||
|
||||
Cthangover 的序章使用了它。RPG World 的图块地图则使用自己的事件。
|
||||
|
||||
## 在游戏中
|
||||
|
||||
Cthangover 开场时,小巷的自行车旁放着一块红布。它不是背景的一部分,而是一个带有独立图片的交互物。
|
||||
|
||||

|
||||
|
||||
当鼠标移到红布上时,指针变成手形,红布泛起一层淡淡的金色:
|
||||
|
||||

|
||||
|
||||
点击后启动红布的剧本:Marao 把它捡起来,剧本随即将这个对象从场景中移除。
|
||||
|
||||

|
||||
|
||||
## 交互对象
|
||||
|
||||
对象是 mod 的 `interactives/` 文件夹里的 JSON 文件。下面就是截图中的红布(来自 Cthangover),轮廓顶点做了精简:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"id": "cloak_ground",
|
||||
"texture": "cloak_ground",
|
||||
"layer": "foreground",
|
||||
"zIndex": 5,
|
||||
"cursor": "PointingHand",
|
||||
"hitArea": {
|
||||
"type": "polygon",
|
||||
"vertices": [
|
||||
{ "x": 0.2796, "y": 0.7318 }, { "x": 0.3207, "y": 0.7167 },
|
||||
{ "x": 0.3456, "y": 0.8434 }, { "x": 0.3387, "y": 0.8872 }
|
||||
]
|
||||
},
|
||||
"highlight": { "color": "#FFD70044", "scale": 1, "duration": 0.12 },
|
||||
"actions": {
|
||||
"onClick": { "scenario": "scenarios/prolog/morning_cloak.scenario" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `texture` — 一张覆盖整个屏幕的图片,除对象本身外全部透明,因此能自动与背景对齐。想要看不见的点击区就省略它。
|
||||
- `hitArea` — 对象可以被点击的范围,以屏幕比例(0–1)表示:`rect` 用 `x`、`y`、`width`、`height`;`circle` 用 `x`、`y`、`radius`;或 `polygon` 用 `vertices`。
|
||||
- `layer` — `background` 或 `foreground`;两者都属于画面本身,位于对话框、工具栏和各面板之下。`ui` 则画在一切之上。
|
||||
- `zIndex` — 同一图层内对象之间的先后顺序:数值越大越靠上绘制。
|
||||
- `cursor` — 鼠标悬停在对象上时的指针样式,例如 `PointingHand`。
|
||||
- `highlight` — 鼠标悬停时的染色效果:`color`(带透明度)、`scale`,以及淡入时长 `duration`(秒)。
|
||||
- `enabled`、`visible` — 对象是否响应点击,以及最初是否绘制。
|
||||
- `actions` — `onClick` 运行一个 `scenario` 文件或内联的 `commands`;`onHoverEnter` 和 `onHoverLeave` 执行剧本命令。
|
||||
|
||||
## 把对象放进场景
|
||||
|
||||
仅有定义不会出现在任何地方。场景的剧本负责添加它,而点击触发的剧本通常会移除它:
|
||||
|
||||
```scenario
|
||||
interactive_add cloak_ground
|
||||
interactive_remove cloak_ground
|
||||
```
|
||||
|
||||
切换场景时对象会被清空,因此 Cthangover 每次进入都用一段会检查剧情的场景剧本来重新添加它们:
|
||||
|
||||
```scenario
|
||||
scene: prolog_alley
|
||||
priority: 15
|
||||
condition: AwakeningQuest.notHasTag("cloak_taken") && AwakeningQuest.notHasTag("book_taken")
|
||||
---
|
||||
interactive_add cloak_ground
|
||||
interactive_add book_ground
|
||||
end
|
||||
```
|
||||
|
||||
添加已存在的对象不会有任何效果,所以重复执行是安全的。
|
||||
|
||||
也可以在 Editor Tools 的交互编辑器里摆放对象并绘制点击区域。
|
||||
|
||||
## 出问题时
|
||||
|
||||
1. **点击没有反应。** 对象从未在这个场景里添加过、`enabled` 未开启,或点击落在 `hitArea` 之外。
|
||||
2. **图片位置不对。** 贴图必须是与背景对齐的全屏图片,而不是一小块裁剪图。
|
||||
3. **对象被拿走后又出现了。** 添加它的剧本必须检查与点击剧本所设置的相同标签或标记。
|
||||
@@ -1,2 +1,2 @@
|
||||
mod_interactive_base_name = Interactive Base
|
||||
mod_interactive_base_desc = Interactive objects subsystem: JSON-driven scene interactives (hover/click hit areas, highlight effects) with DSL/scenario click actions, the InteractiveManager and the interactive editor data plane.
|
||||
mod_interactive_base_desc = Clickable objects for picture scenes: a picture of its own over the background, a glow under the mouse, and a click that starts a scenario.
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base_name = Base interactiva
|
||||
mod_interactive_base_desc = Objetos clicables para escenas de imagen: una imagen propia sobre el fondo, un brillo bajo el ratón y un clic que lanza un escenario.
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base_name = インタラクティブ基盤
|
||||
mod_interactive_base_desc = 画像シーンのためのクリック可能なオブジェクト: 背景の上に重ねる専用の画像、マウスカーソルでのハイライト、そしてシナリオを始めるクリック。
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base_name = 상호작용 기반
|
||||
mod_interactive_base_desc = 그림 장면을 위한 클릭 가능한 오브젝트: 배경 위에 얹는 자체 이미지, 마우스를 올릴 때의 하이라이트, 클릭으로 시작되는 시나리오.
|
||||
@@ -1,2 +1,2 @@
|
||||
mod_interactive_base_name = Интерактивные объекты
|
||||
mod_interactive_base_desc = Подсистема интерактивных объектов: JSON-описания зон наведения и клика с подсветкой и сценарными действиями, InteractiveManager и данные редактора интерактива.
|
||||
mod_interactive_base_desc = Кликабельные объекты для картинок-сцен: собственная картинка поверх фона, подсветка под курсором и клик, запускающий сценарий.
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base_name = Nền tảng tương tác
|
||||
mod_interactive_base_desc = Các đối tượng có thể nhấp cho cảnh bằng hình ảnh: một hình riêng đặt đè lên nền, ánh sáng nổi khi rê chuột và một cú nhấp khởi chạy kịch bản.
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base_name = 交互基础
|
||||
mod_interactive_base_desc = 为图像场景提供可点击对象:叠在背景之上的独立图片、鼠标悬停时的微光,以及点击即可启动的剧本。
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"name": "Interactive Base",
|
||||
"version": "1.0.0",
|
||||
"author": "ct",
|
||||
"description": "Interactive objects subsystem: JSON-driven scene interactives (hover/click hit areas, highlight effects) with DSL/scenario click actions. Owns InteractiveManager, the interactive definition resolver/factory and the InteractiveEditor data plane.",
|
||||
"description": "Clickable objects for picture scenes: a picture of its own over the background, a glow under the mouse, and a click that starts a scenario.",
|
||||
"category": "engine, library",
|
||||
"depends": ["shell2d_base>=1", "ui_base>=1"],
|
||||
"sources": [ "src/**/*.cs" ],
|
||||
|
||||
@@ -41,6 +41,13 @@ namespace Cthangover.Core.Interactive
|
||||
/// <summary>Invoked on click with the definition id (wired by <see cref="InteractiveManager"/>).</summary>
|
||||
internal Action<string> OnClickCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Drawing order inside the layer (the definition's <c>zIndex</c>). It is a
|
||||
/// place among the layer's children, not a Godot z index: a z index is global
|
||||
/// to the canvas and would lift the object over the dialog box and the panels.
|
||||
/// </summary>
|
||||
public int Order { get; private set; }
|
||||
|
||||
private TextureRect _visual;
|
||||
private ShaderMaterial _highlightMaterial;
|
||||
private Tween _highlightTween;
|
||||
@@ -98,7 +105,7 @@ namespace Cthangover.Core.Interactive
|
||||
AnchorRight = 1f;
|
||||
AnchorBottom = 1f;
|
||||
|
||||
ZIndex = def.ZIndex;
|
||||
PlaceByOrder(def.ZIndex);
|
||||
Visible = def.Visible;
|
||||
IsEnabled = def.Enabled;
|
||||
|
||||
@@ -170,6 +177,24 @@ namespace Cthangover.Core.Interactive
|
||||
/// scene transition and by <c>InteractiveManager.Remove</c> for targeted
|
||||
/// cleanup, ensuring no dangling references survive scene teardown.
|
||||
/// </summary>
|
||||
private void PlaceByOrder(int order)
|
||||
{
|
||||
Order = order;
|
||||
var parent = GetParent();
|
||||
if (parent == null)
|
||||
return;
|
||||
var index = parent.GetChildCount() - 1;
|
||||
foreach (var child in parent.GetChildren())
|
||||
{
|
||||
if (child != this && child is InteractiveObject other && other.Order > order)
|
||||
{
|
||||
index = other.GetIndex();
|
||||
break;
|
||||
}
|
||||
}
|
||||
parent.MoveChild(this, index > GetIndex() ? index - 1 : index);
|
||||
}
|
||||
|
||||
public void Destruct()
|
||||
{
|
||||
SceneContextNode.Instance?.RemoveEventObject(ID);
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base__interactives_name = Interactivos de prueba
|
||||
mod_interactive_base__interactives_desc = Prueba de integración del sistema de objetos interactivos: una lámpara clicable en la escena con resaltado.
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base__interactives_name = テスト用インタラクティブ
|
||||
mod_interactive_base__interactives_desc = インタラクティブオブジェクトの仕組みの統合テスト——シーン上のハイライト付きのクリックできるランプ。
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base__interactives_name = 테스트 상호작용
|
||||
mod_interactive_base__interactives_desc = 상호작용 오브젝트 시스템의 통합 테스트 — 장면 위의 강조 효과가 있는 클릭 가능한 램프.
|
||||
@@ -0,0 +1 @@
|
||||
test_interactive/click = ¡Has hecho clic en la lámpara! El objeto interactivo funciona.
|
||||
@@ -0,0 +1 @@
|
||||
test_interactive/click = ランプをクリックしました!インタラクティブオブジェクトは動いています。
|
||||
@@ -0,0 +1 @@
|
||||
test_interactive/click = 램프를 클릭했습니다! 상호작용 오브젝트가 작동합니다.
|
||||
@@ -0,0 +1 @@
|
||||
test_interactive/click = Bạn đã nhấp vào chiếc đèn! Đối tượng tương tác hoạt động.
|
||||
@@ -0,0 +1 @@
|
||||
test_interactive/click = 你点击了灯!交互对象工作正常。
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base__interactives_name = Tương tác thử nghiệm
|
||||
mod_interactive_base__interactives_desc = Kiểm thử tích hợp hệ thống đối tượng tương tác — một chiếc đèn có thể nhấp trong cảnh, có làm nổi bật.
|
||||
@@ -0,0 +1,2 @@
|
||||
mod_interactive_base__interactives_name = 测试交互物
|
||||
mod_interactive_base__interactives_desc = 交互对象系统的集成测试——场景中一盏可点击并带高亮的灯。
|
||||
@@ -29,7 +29,7 @@ namespace Mods.InteractiveBase.Tests
|
||||
return;
|
||||
queued = true;
|
||||
GameLogger.Log("TEST", "InteractivesTest: activating");
|
||||
(Godot.Engine.GetMainLoop() as SceneTree)?.Root?.CallDeferred("add_child", new InteractivesTestDriverNode());
|
||||
ModRoot.AddDeferred(new InteractivesTestDriverNode());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user