### Creating a Stack Panel with Multiple Elements in JSON Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt Define a stack panel to arrange UI elements vertically or horizontally with automatic layout management. This example demonstrates creating an inventory panel containing a title label and a grid for inventory slots, showcasing layout and control nesting. ```json { "inventory_panel": { "type": "stack_panel", "orientation": "vertical", "size": [200, "100%c"], "anchor_from": "top_left", "anchor_to": "top_left", "offset": [10, 10], "layer": 1, "controls": [ { "title_label": { "type": "label", "text": "Inventory", "color": [1.0, 1.0, 1.0], "font_size": "large", "shadow": true, "size": ["100%", "default"] } }, { "item_grid": { "type": "grid", "grid_dimensions": [9, 3], "size": [162, 54], "grid_item_template": "common.inventory_slot", "collection_name": "inventory_items", "bindings": [ { "binding_name": "#inventory_grid_dimensions", "binding_name_override": "#grid_dimensions", "binding_type": "collection", "binding_collection_name": "inventory_items" } ] } } ] } } ``` -------------------------------- ### VSCode Configuration for Bugrock UI Schemas Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt Configure VSCode to use the provided JSON schemas for validation and autocompletion of Bedrock Edition UI files. This setup ensures that your UI JSON files adhere to the schema definitions, preventing errors and improving development efficiency. ```json { "json.schemas": [ { "url": "https://kalmemarq.github.io/Bugrock-JSON-UI-Schemas/ui.schema.json", "fileMatch": [ "*.ui.json", "*.uidx", "ui/**/*.json", "!_global_variables.json", "!_ui_defs.json", "!/textures/**/*.json" ] }, { "url": "https://kalmemarq.github.io/Bugrock-JSON-UI-Schemas/ui.sprite.schema.json", "fileMatch": [ "textures/**/*.json", "!flame_atlas.texture_set.json", "!flipbook_textures.json", "!item_texture.json", "!terrain_texture.json", "!texture_list.json" ] }, { "url": "https://kalmemarq.github.io/Bugrock-JSON-UI-Schemas/ui_defs.schema.json", "fileMatch": ["ui/_ui_defs.json"] }, { "url": "https://kalmemarq.github.io/Bugrock-JSON-UI-Schemas/global_variables.schema.json", "fileMatch": ["ui/_global_variables.json"] } ] } ``` -------------------------------- ### VSCode Settings for Bugrock UI Schemas Source: https://github.com/fumeko-ts/bugrock-json-ui-schemas-extended/blob/main/README.md Configures VSCode to validate various Bugrock UI JSON schemas. It uses 'url' to point to the schema definitions and 'fileMatch' to associate them with specific file patterns. This setup helps catch errors during development by providing real-time feedback. ```json "json.schemas": [ { "url": "https://kalmemarq.github.io/Bugrock-JSON-UI-Schemas/ui.schema.json", "fileMatch": [ "*.ui.json", "*.uidx", "ui/**/*.json", "!_global_variables.json", "!_ui_defs.json", "!/textures/**/*.json" ] }, { "url": "https://kalmemarq.github.io/Bugrock-JSON-UI-Schemas/ui.sprite.schema.json", "fileMatch": [ "textures/**/*.json", "!flame_atlas.texture_set.json", "!flipbook_textures.json", "!item_texture.json", "!terrain_texture.json", "!texture_list.json" ] }, { "url": "https://kalmemarq.github.io/Bugrock-JSON-UI-Schemas/ui_defs.schema.json", "fileMatch": [ "ui/_ui_defs.json" ] }, { "url": "https://kalmemarq.github.io/Bugrock-JSON-UI-Schemas/global_variables.schema.json", "fileMatch": [ "ui/_global_variables.json" ] } ] ``` -------------------------------- ### Register UI Files in UI Definitions Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt Specifies the order in which custom UI files should be included in the resource pack loading process. This ensures that UI components and definitions are available and correctly parsed by the UI system. The list includes common UI screens and custom screen definitions. ```json { "ui_defs": [ "ui/common.json", "ui/hud_screen.json", "ui/start_screen.json", "ui/pause_screen.json", "ui/inventory_screen.json", "ui/custom/my_custom_screen.json", "ui/custom/my_custom_components.json" ] } ``` -------------------------------- ### Implement Flipbook Animations for Sprites Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt This JSON snippet illustrates how to create an animated sprite using the 'flip_book' animation type. It defines a 'loading_spinner' image and associates it with a 'spin_animation' which is configured for frame-based texture updates. This is useful for creating loading indicators or other animated UI elements. Ensure the 'textures/ui/spinner' texture exists and has the specified frame dimensions. ```json { "loading_spinner": { "type": "image", "texture": "textures/ui/spinner", "size": [32, 32], "anchor_from": "center", "anchor_to": "center", "uv": [0, 0], "uv_size": [32, 32], "anims": ["@spin_animation"], "controls": [] }, "spin_animation@common.base_animation": { "anim_type": "flip_book", "initial_uv": [0, 0], "frame_count": 8, "frame_step": 32, "fps": 10, "looping": true, "activated": true } } ``` -------------------------------- ### Build Toggle Controls with State Management Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt This snippet shows how to create a customizable toggle control, functioning as a checkbox or radio button. It manages 'checked' and 'unchecked' visual states, including hover states, and allows for button mapping for interaction. This is ideal for settings menus or any UI requiring binary user input. Ensure all referenced textures like 'textures/ui/checkbox_unchecked' and 'textures/ui/checkbox_checked' are correctly configured. ```json { "settings_toggle": { "type": "toggle", "size": [150, 20], "radio_toggle_group": false, "toggle_name": "enable_shadows", "toggle_default_state": false, "checked_control": "checked_state", "unchecked_control": "unchecked_state", "checked_hover_control": "checked_hover_state", "unchecked_hover_control": "unchecked_hover_state", "button_mappings": [ { "from_button_id": "button.menu_select", "to_button_id": "button.toggle_shadows", "mapping_type": "pressed" } ], "controls": [ { "unchecked_state": { "type": "panel", "controls": [ { "checkbox_bg": { "type": "image", "texture": "textures/ui/checkbox_unchecked", "size": [20, 20] } }, { "label": { "type": "label", "text": "Enable Shadows", "offset": [25, 0], "color": "white" } } ] } }, { "checked_state": { "type": "panel", "controls": [ { "checkbox_bg": { "type": "image", "texture": "textures/ui/checkbox_checked", "size": [20, 20] } }, { "label": { "type": "label", "text": "Enable Shadows", "offset": [25, 0], "color": "green" } } ] } } ] } } ``` -------------------------------- ### Define Custom Screen Layout with Input Handling Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt Defines a complete screen layout with custom background, input absorption, and button mappings. This schema allows for defining screen-specific properties like rendering behavior, modal status, and input handling priorities. It includes a background image and a content panel with title and close button placeholders. ```json { "namespace": "custom_screen", "main_screen@common.base_screen": { "type": "screen", "render_game_behind": true, "is_modal": true, "absorbs_input": true, "should_steal_mouse": true, "render_only_when_topmost": false, "button_mappings": [ { "from_button_id": "button.menu_cancel", "to_button_id": "button.menu_exit", "mapping_type": "global" } ], "controls": [ { "screen_background": { "type": "image", "texture": "textures/ui/background", "size": ["100%", "100%"], "alpha": 0.5, "layer": -10 } }, { "content_panel@custom_screen.content_panel": {} } ] }, "content_panel": { "type": "panel", "size": [400, 300], "anchor_from": "center", "anchor_to": "center", "controls": [ { "title@custom_screen.title_label": {} }, { "close_button@custom_screen.close_button": {} } ] } } ``` -------------------------------- ### Create Scroll View with Dynamic Content Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt Demonstrates how to create a scrollable content area that renders items dynamically from a collection. It configures the scroll view's size, speed, gesture control, and uses a grid to display items from a specified collection. Dependencies include common UI elements and collection binding configurations. ```json { "server_list_scroll": { "type": "scroll_view", "size": [300, 200], "anchor_from": "center", "anchor_to": "center", "scroll_speed": 5.0, "gesture_control_enabled": true, "scrollbar_track_button": "scrollbar_track", "scrollbar_touch_button": "scrollbar_touch", "$scrollbar_box_control": "scroll_box_content", "controls": [ { "scroll_content@common.stack_panel": { "orientation": "vertical", "size": ["100%", "100%c"], "controls": [ { "server_grid": { "type": "grid", "grid_dimensions": [1, 10], "size": ["100%", "100%cm"], "grid_item_template": "server_list.server_item", "collection_name": "network_world_item", "bindings": [ { "binding_name": "#network_world_item_grid_dimension", "binding_name_override": "#grid_dimensions", "binding_type": "collection", "binding_collection_name": "network_world_item" }, { "binding_name": "#network_world_item_count", "binding_name_override": "#maximum_grid_items", "binding_type": "collection", "binding_collection_name": "network_world_item" } ] } } ] } } ] } } ``` -------------------------------- ### Input Schema Fields Source: https://github.com/fumeko-ts/bugrock-json-ui-schemas-extended/blob/main/README.md Details the various fields available within the input schema for UI elements. ```APIDOC ## Input Schema Details ### Description This section describes the fields available for configuring UI elements through extended JSON schemas. ### Parameters #### Request Body Parameters - **button_mappings** (array of ButtonMappingItem) - Optional - A list of mappings for button interactions. - **modal** (boolean) - Optional - Determines if the UI element should behave as a modal. - **inline_modal** (boolean) - Optional - Determines if the UI element should be an inline modal. - **always_listen_to_input** (boolean) - Optional - Specifies if the element should always listen to input events. - **always_handle_pointer** (boolean) - Optional - Specifies if the element should always handle pointer events. - **always_handle_controller_direction** (boolean) - Optional - Specifies if the element should always handle controller direction. - **hover_enabled** (boolean) - Optional - Enables or disables hover effects for the element. - **prevent_touch_input** (boolean) - Optional - Prevents touch input from interacting with the element. - **consume_event** (boolean) - Optional - Indicates whether input events should be consumed by this element. - **consume_hover_events** (boolean) - Optional - Indicates whether hover events should be consumed by this element. - **gesture_tracking_button** (string) - Optional - Specifies a button used for gesture tracking. ### Request Example ```json { "button_mappings": [ { "action": "confirm", "button": "A" } ], "modal": true, "hover_enabled": true } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating successful processing of the schema. #### Response Example ```json { "message": "UI schema processed successfully." } ``` ``` -------------------------------- ### Define Global Variables for Theming Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt Configures reusable global variables for consistent theming and behavior across the UI. This includes color definitions, dimension constants, font styles, and boolean flags for enabling/disabling features like animations and debug mode. These variables promote maintainability and easier theming. ```json { "$primary_color": [0.2, 0.5, 1.0], "$secondary_color": [1.0, 1.0, 1.0], "$button_width": 200, "$button_height": 20, "$spacing": 5, "$header_font": "large", "$body_font": "normal", "$enable_animations": true, "$debug_mode": false } ``` -------------------------------- ### Create Nineslice Sprites for Scalable UI Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt Defines the parameters for creating nineslice sprites, which are essential for resolution-independent UI elements. It specifies the pixel offsets for the slicing (top, right, bottom, left) and the base size of the texture. This allows UI elements to scale correctly without distortion. ```json { "nineslice_size": [4, 4, 4, 4], "base_size": [32, 32] } ``` -------------------------------- ### Creating a Custom Button Element in JSON Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt Define a custom button UI element with different visual states for default, hover, and pressed interactions. This JSON structure allows for defining button appearance, size, and mapping input actions to specific button events, enhancing user interactivity. ```json { "custom_button@common.button": { "type": "button", "size": [100, 20], "anchor_from": "center", "anchor_to": "center", "offset": [0, 0], "layer": 2, "default_control": "default_state", "hover_control": "hover_state", "pressed_control": "pressed_state", "button_mappings": [ { "from_button_id": "button.menu_select", "to_button_id": "button.custom_action", "mapping_type": "pressed" } ], "controls": [ { "default_state": { "type": "image", "texture": "textures/ui/button_default", "size": ["100%", "100%"] } }, { "hover_state": { "type": "image", "texture": "textures/ui/button_hover", "size": ["100%", "100%"] } }, { "pressed_state": { "type": "image", "texture": "textures/ui/button_pressed", "size": ["100%", "100%"] } } ] } } ``` -------------------------------- ### Bind UI Elements to Game Data with Collection and Global Bindings Source: https://context7.com/fumeko-ts/bugrock-json-ui-schemas-extended/llms.txt This snippet demonstrates how to bind UI elements, such as a player health bar and text, to game data using global bindings. It configures a panel with an image for the health bar and a label for health text, dynamically updating their appearance and content based on game variables. Ensure the 'textures/ui/health_bar' and appropriate game data variables are available. ```json { "player_health_bar": { "type": "panel", "size": [100, 10], "controls": [ { "health_progress": { "type": "image", "texture": "textures/ui/health_bar", "clip_direction": "left", "clip_ratio": 1.0, "bindings": [ { "binding_name": "#player_health_percentage", "binding_name_override": "#clip_ratio", "binding_type": "global", "binding_condition": "always" } ] } }, { "health_text": { "type": "label", "text": "HP: 20/20", "color": "red", "font_size": "normal", "shadow": true, "bindings": [ { "binding_name": "#player_health_text", "binding_name_override": "#text", "binding_type": "global", "binding_condition": "always" } ] } } ] } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.