Diseñar UIs
Las pantallas de EventUI se definen como archivos .yml en plugins/EventUI/uis/. Cada archivo describe una pantalla completa con elementos, posiciones, sonidos y transiciones.
Estructura de una pantalla
id: "mi-pantalla"
title: ""
screen_width: 1366 # escala automáticamente a la resolución del cliente
screen_height: 720
screen_properties:
pause_game: "false"
blur: false # booleano sin comillas
transition_in: "scale_up"
transition_out: "none"
transition_duration: "300" # milisegundos
transition_easing: "ease_in_out_quad"
open_sound: "minecraft:ui.toast.in" # vacío = sin sonido
open_sound_volume: "1.0"
open_sound_pitch: "1.0"
close_sound: ""
close_sound_volume: "0.5"
elements:
- id: "mi-elemento"
type: IMAGE
x: 0
y: 0
width: 200
height: 200
properties:
texture: "eventui:textures/ui/fondo.png"
screen_properties disponibles
| Propiedad | Tipo | Descripción |
|---|---|---|
pause_game | "true" / "false" | Si la pantalla pausa el juego al abrirse. |
blur | true / false | Blur del mundo de fondo. Sin comillas. |
transition_in | String | Animación de entrada: scale_up, slide_left, slide_right, fade, none. |
transition_out | String | Animación de salida. Mismos valores. |
transition_duration | "300" | Duración de la transición en milisegundos. |
transition_easing | String | linear, ease_in, ease_out, ease_in_out, ease_in_out_quad. |
open_sound | String | Sonido al abrir la pantalla. Vacío = sin sonido. |
open_sound_volume | "1.0" | Volumen de apertura (0.0 – 2.0). |
open_sound_pitch | "1.0" | Tono de apertura. |
close_sound | String | Sonido al cerrar. |
close_sound_volume | "0.5" | Volumen de cierre. |
Campos comunes de todos los elementos
| Campo | Obligatorio | Descripción |
|---|---|---|
id | ✅ Sí | Identificador único dentro del archivo. |
type | ✅ Sí | Tipo en mayúsculas: IMAGE, IMAGE_BUTTON, BUTTON, TEXT, PROGRESS_BAR, ENTITY_RENDER, TOOLTIP, ITEM_RENDER, BLOCK_RENDER, PANEL, ICON. |
x | ✅ Sí | Posición X. Con anchor activo funciona como offset adicional. |
y | ✅ Sí | Posición Y. |
width | No | Ancho. Default: 100. |
height | No | Alto. Default: 20. |
z_index | No | Orden de capas — mayor = encima. Default: 0. |
visible | No | Visibilidad estática. Default: true. |
properties | Varía | Propiedades específicas del tipo. |
children | No | Elementos hijos: tooltips, sub-botones, renders de entidades. |
Sistema de anclas
Con anchor en properties, el elemento se posiciona relativo a un punto de la pantalla. Los campos x e y pasan a ser offsets desde ese punto, y anchor_offset_x / anchor_offset_y dan un desplazamiento adicional.
- id: "btn-volver"
type: IMAGE_BUTTON
x: 0
y: 0
width: 65
height: 65
properties:
anchor: "bottom_center"
anchor_offset_x: 0
anchor_offset_y: -50 # 50px hacia arriba desde el borde inferior
texture: "eventui:textures/ui/logo/logo.png"
action: "open:main-menu"
| Valor | Posición |
|---|---|
top_left | Esquina superior izquierda |
top_center | Centro superior |
top_right | Esquina superior derecha |
center_left | Centro izquierdo |
center | Centro de la pantalla |
center_right | Centro derecho |
bottom_left | Esquina inferior izquierda |
bottom_center | Centro inferior |
bottom_right | Esquina inferior derecha |
Visibilidad condicional — visible_if
Muestra u oculta un elemento según el valor de una variable de estado del servidor. Perfecto para mostrar contenido bloqueado o desbloqueado según el progreso del jugador.
# Solo visible si zombie_card_unlocked NO es "true"
- id: "carta-bloqueada"
type: IMAGE_BUTTON
x: 0
y: 0
width: 250
height: 250
properties:
anchor: "center_left"
anchor_offset_x: 0
anchor_offset_y: -125
visible_if: "zombie_card_unlocked != true"
texture: "eventui:textures/ui/widgets/tarjeta_bloqueada.png"
hover_animation: "zoom_in"
hover_animation_intensity: "1.03"
hover_hitbox: "texture_alpha"
action: ""
# Solo visible si zombie_card_unlocked ES "true"
- id: "carta-desbloqueada"
type: IMAGE_BUTTON
x: 0
y: 0
width: 250
height: 250
properties:
anchor: "center_left"
anchor_offset_x: 0
anchor_offset_y: -125
visible_if: "zombie_card_unlocked == true"
texture: "eventui:textures/ui/widgets/tarjeta_desbloqueada.png"
hover_animation: "zoom_in"
hover_animation_intensity: "1.03"
hover_hitbox: "texture_alpha"
action: ""
children:
- id: "render-zombie"
type: ENTITY_RENDER
x: 100
y: 100
width: 50
height: 50
properties:
entity: "minecraft:zombie"
scale: "35"
rotation_mode: "spin"
spin_speed: "0.5"
y_offset: "0"
Las variables se establecen desde el servidor con /eventui setuivar <jugador> <clave> <valor>. Los operadores disponibles son ==, != y = (igualdad simple).
Tipos de elementos
IMAGE
- id: "fondo"
type: IMAGE
x: 0
y: 0
width: 500
height: 350
properties:
texture: "eventui:textures/ui/fondo.png"
IMAGE_BUTTON
- id: "btn-iniciar"
type: IMAGE_BUTTON
x: 100
y: 200
width: 120
height: 40
properties:
texture: "eventui:textures/ui/btn.png"
hover_texture: "eventui:textures/ui/btn_hover.png"
action: "start_event:mision"
BUTTON
- id: "btn-cerrar"
type: BUTTON
x: 150
y: 260
width: 100
height: 22
properties:
text: "§7← Cerrar"
action: "close"
TEXT
- id: "titulo"
type: TEXT
x: 50
y: 50
width: 300
height: 20
properties:
content: "§eMi Título"
align: "center"
shadow: "true"
PROGRESS_BAR
- id: "barra"
type: PROGRESS_BAR
x: 68
y: 190
width: 128
height: 8
properties:
event_id: "matar-zombies"
objective_id: "kill-zombies"
color: "5cb85c"
PANEL
- id: "panel"
type: PANEL
x: 50
y: 100
width: 200
height: 80
properties:
color: "1a1a1a"
alpha: "180"
ICON
- id: "icono"
type: ICON
x: 100
y: 50
width: 16
height: 16
properties:
item: "minecraft:diamond"
TOOLTIP
children:
- id: "tooltip"
type: TOOLTIP
x: 0
y: 0
width: 0
height: 0
properties:
render_type: "standard"
content: "§eInformación\n§7Descripción aquí"
ENTITY_RENDER
- id: "render-zombie"
type: ENTITY_RENDER
x: 100
y: 100
width: 50
height: 50
properties:
entity: "minecraft:zombie"
scale: "35"
rotation_mode: "spin"
ITEM_RENDER
- id: "render-espada"
type: ITEM_RENDER
x: 120
y: 80
width: 32
height: 32
properties:
item: "minecraft:diamond_sword"
scale: "2.0"
BLOCK_RENDER
- id: "render-bloque"
type: BLOCK_RENDER
x: 150
y: 100
width: 48
height: 48
properties:
block: "minecraft:diamond_block"
scale: "1.5"
SKILL_TREE
- id: "skill-tree-ui"
type: SKILL_TREE
x: 0
y: 0
width: 500
height: 350
properties:
skill_tree_id: "combate"
point_type: "combat_points"
Acciones de botones
Los elementos BUTTON e IMAGE_BUTTON ejecutan una acción al hacer clic:
| Acción | Descripción |
|---|---|
open:<id> | Abre otra pantalla por su id. Agrega la actual a la pila de navegación. |
close | Cierra la pantalla actual. |
back | Vuelve a la pantalla anterior en la pila de navegación. |
start_event:<id> | Inicia el evento indicado en el servidor. |
abandon_event:<id> | Abandona el evento. Pide confirmación si no es repetible. |
none o vacío | Sin acción — el botón es decorativo. |