-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(spanish): spanish version of the documentation (#37)
- Loading branch information
Showing
21 changed files
with
1,112 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { defineConfig, type DefaultTheme } from "vitepress"; | ||
|
||
export const es_ES = defineConfig({ | ||
lang: "es-ES", | ||
description: | ||
"Librería de Node.js para la creación de scripts en Open Multiplayer", | ||
themeConfig: { | ||
nav: nav(), | ||
|
||
sidebar: [ | ||
{ base: "/es-ES/", text: "Comenzar", items: sidebarGuide() }, | ||
{ | ||
base: "/es-ES/essentials/", | ||
text: "Esenciales", | ||
items: sidebarEssentials(), | ||
}, | ||
{ base: "/es-ES/plugins/", text: "Plugins", items: sidebarPlugins() }, | ||
], | ||
|
||
editLink: { | ||
pattern: "https://github.com/dockfries/infernus/edit/main/docs/:path", | ||
text: "Editar esta página en GitHub", | ||
}, | ||
|
||
darkModeSwitchLabel: "Cambiar apariencia", | ||
docFooter: { | ||
next: "Siguiente", | ||
prev: "Anterior", | ||
}, | ||
lastUpdatedText: "Última actualización", | ||
outlineTitle: "Navegación de la página", | ||
returnToTopLabel: "Volver al principio", | ||
sidebarMenuLabel: "Menú", | ||
}, | ||
}); | ||
|
||
function nav(): DefaultTheme.NavItem[] { | ||
return [ | ||
{ text: "Inicio", link: "/es-ES/" }, | ||
{ text: "Open Multiplayer", link: "https://open.mp/es" }, | ||
{ | ||
text: "Plugins", | ||
items: [ | ||
{ | ||
text: "samp-node", | ||
link: "https://github.com/AmyrAhmady/samp-node", | ||
}, | ||
{ | ||
text: "Streamer", | ||
link: "https://github.com/samp-incognito/samp-streamer-plugin", | ||
}, | ||
{ | ||
text: "RakNet", | ||
link: "https://github.com/katursis/Pawn.RakNet", | ||
}, | ||
{ | ||
text: "MapAndreas", | ||
link: "https://github.com/philip1337/samp-plugin-mapandreas", | ||
}, | ||
{ | ||
text: "ColAndreas", | ||
link: "https://github.com/Pottus/ColAndreas", | ||
}, | ||
], | ||
}, | ||
]; | ||
} | ||
|
||
function sidebarGuide(): DefaultTheme.SidebarItem[] { | ||
return [ | ||
{ text: "Introducción", link: "introduction" }, | ||
{ text: "Inicio rápido", link: "quick-start" }, | ||
]; | ||
} | ||
|
||
function sidebarEssentials(): DefaultTheme.SidebarItem[] { | ||
return [ | ||
{ text: "Eventos", link: "events" }, | ||
{ text: "Ciclo de vida", link: "life-cycle" }, | ||
{ text: "Internacionalización", link: "i18n" }, | ||
{ text: "Diálogos", link: "dialogs" }, | ||
{ text: "Características", link: "features" }, | ||
{ text: "Uso", link: "use" }, | ||
]; | ||
} | ||
|
||
function sidebarPlugins(): DefaultTheme.SidebarItem[] { | ||
return [{ text: "Introducción", link: "introduction" }]; | ||
} | ||
|
||
export const search = { | ||
"es-ES": { | ||
translations: { | ||
button: { | ||
buttonText: "Buscar en la documentación", | ||
buttonAriaLabel: "Buscar en la documentación", | ||
}, | ||
modal: { | ||
noResultsText: "No se encontraron resultados", | ||
resetButtonTitle: "Restablecer consulta", | ||
displayDetails: "Ver lista de detalles", | ||
footer: { | ||
selectText: "Seleccionar", | ||
closeText: "Cerrar", | ||
navigateText: "Navegar", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Diálogos | ||
|
||
El diálogo es una función de uso común en el proceso de desarrollo. `Infernus` proporciona soporte orientado a objetos y **async**, para que puedas usarlo de forma más elegante. | ||
|
||
Al mismo tiempo, en términos generales, ya no es necesario seguir el `id` del diálogo de la forma tradicional, y el código se generará aleatoriamente. | ||
|
||
El tradicional evento de callback `PlayerEvent.OnDialogResponse` puede seguir siendo utilizado, pero no es recomendable. | ||
|
||
## Ejemplo | ||
|
||
Con el ejemplo, puede utilizar diálogos de forma elegante y continua para almacenar la lógica relevante en el mismo segmento de código, en lugar de tan complejo como el desarrollo nativo en el pasado. | ||
|
||
### Comprobación de registro | ||
|
||
```ts | ||
import { PlayerEvent, Dialog, DialogStylesEnum } from "@infernus/core"; | ||
|
||
PlayerEvent.onCommandText("registro", async ({ player, next }) => { | ||
const dialog = new Dialog({ | ||
style: DialogStylesEnum.PASSWORD, | ||
caption: "Registro", | ||
info: "Por favor, ingresa la contraseña", | ||
button1: "ok", | ||
}); | ||
|
||
const { inputText: password } = await dialog.show(player); | ||
|
||
// Puede reutilizar una instancia de diálogo existente, modificar su información y volver a utilizarla más adelante. | ||
// Hay muchos setter además de info. | ||
dialog.info = "Por favor, ingresa la contraseña nuevamente"; | ||
|
||
const { inputText: againPassword } = await dialog.show(player); | ||
|
||
if (password !== againPassword) { | ||
player.sendClientMessage( | ||
"#f00", | ||
"La contraseña que ha introducido dos veces no es la misma, inténtelo de nuevo." | ||
); | ||
} | ||
|
||
return next(); | ||
}); | ||
``` | ||
|
||
### Cerrar diálogo | ||
|
||
```ts | ||
import { PlayerEvent, Player, Dialog } from "@infernus/core"; | ||
|
||
PlayerEvent.onCommandText("cerrarDialogo", ({ player, subcommand, next }) => { | ||
const [playerId] = subcommand; | ||
|
||
if (!playerId) { | ||
player.sendClientMessage( | ||
"#f00", | ||
"Introduzca el cuadro de diálogo del jugador que desea cerrar" | ||
); | ||
return next(); | ||
} | ||
|
||
// Los comandos introducidos por el jugador son todos cadenas, por lo que es necesario convertir el tipo a un tipo numérico. | ||
const closePlayer = Player.getInstance(+playerId); | ||
|
||
if (!closePlayer) { | ||
player.sendClientMessage("#f00", "El jugador no está conectado."); | ||
} else { | ||
// Método estático de diálogo | ||
Dialog.close(closePlayer); | ||
player.sendClientMessage("#ff0", "Has cerrado el diálogo del jugador."); | ||
} | ||
|
||
return next(); | ||
}); | ||
``` |
Oops, something went wrong.