mirror of
https://github.com/Mojang/bedrock-samples.git
synced 2024-11-27 03:28:56 +00:00
555 lines
16 KiB
JSON
555 lines
16 KiB
JSON
{
|
|
"namespace": "trade",
|
|
|
|
//---------------------------------------------------------------------------
|
|
// Common Controls
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Buttons //
|
|
|
|
"cycle_recipe_button@common_buttons.light_content_button": {
|
|
"$button_content": "common_store.direction_button_panel",
|
|
"bindings": [
|
|
{
|
|
"binding_type": "global",
|
|
"binding_condition": "visible",
|
|
"binding_name": "$cycle_binding_name",
|
|
"binding_name_override": "#enabled"
|
|
},
|
|
{
|
|
"binding_name": "(not #is_using_gamepad)",
|
|
"binding_name_override": "#focus_enabled"
|
|
}
|
|
]
|
|
},
|
|
|
|
"cycle_recipe_left_button@trade.cycle_recipe_button": {
|
|
"anchor_from": "left_middle",
|
|
"anchor_to": "left_middle",
|
|
"$cycle_binding_name": "#left_button_enabled",
|
|
"$chevron_image_name": "textures/ui/chevron_left",
|
|
"$pressed_button_name": "button.cycle_recipe_left",
|
|
"$direction_gamepad_button_helper": "gamepad_helper@common.gamepad_helper_left_bumper",
|
|
"button_mappings": [
|
|
{
|
|
"from_button_id": "button.menu_tab_left",
|
|
"to_button_id": "button.cycle_recipe_left",
|
|
"mapping_type": "global"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_select",
|
|
"to_button_id": "button.cycle_recipe_left",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_ok",
|
|
"to_button_id": "button.cycle_recipe_left",
|
|
"mapping_type": "pressed"
|
|
}
|
|
]
|
|
},
|
|
|
|
"cycle_recipe_right_button@trade.cycle_recipe_button": {
|
|
"anchor_from": "right_middle",
|
|
"anchor_to": "right_middle",
|
|
"$cycle_binding_name": "#right_button_enabled",
|
|
"$chevron_image_name": "textures/ui/chevron_right",
|
|
"$pressed_button_name": "button.cycle_recipe_right",
|
|
"$direction_gamepad_button_helper": "gamepad_helper@common.gamepad_helper_right_bumper",
|
|
"button_mappings": [
|
|
{
|
|
"from_button_id": "button.menu_tab_right",
|
|
"to_button_id": "button.cycle_recipe_right",
|
|
"mapping_type": "global"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_select",
|
|
"to_button_id": "button.cycle_recipe_right",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_ok",
|
|
"to_button_id": "button.cycle_recipe_right",
|
|
"mapping_type": "pressed"
|
|
}
|
|
]
|
|
},
|
|
|
|
// Images //
|
|
"arrow_image": {
|
|
"type": "image",
|
|
"texture": "textures/ui/arrow_large",
|
|
"layer": 1,
|
|
"size": [ 22, 15 ],
|
|
"color": [ 0.5, 0.5, 0.5, 1.0 ]
|
|
},
|
|
|
|
"cross_out_icon": {
|
|
"type": "image",
|
|
"texture": "textures/ui/crossout",
|
|
"layer": 1,
|
|
"size": [ 15, 15 ],
|
|
"bindings": [
|
|
{
|
|
"binding_name": "#cross_out_icon",
|
|
"binding_name_override": "#visible"
|
|
}
|
|
]
|
|
},
|
|
|
|
"highlight_slot_panel": {
|
|
"type": "panel",
|
|
"layer": 3,
|
|
"controls": [
|
|
{
|
|
"hover_text@common.hover_text": {
|
|
"bindings": [
|
|
{
|
|
"binding_name": "#hover_text",
|
|
"binding_condition": "visible",
|
|
"binding_type": "collection",
|
|
"binding_collection_name": "$item_collection_name"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
|
|
"recipe_button": {
|
|
"type": "button",
|
|
"default_focus_precedence": 1,
|
|
"hover_control": "hover",
|
|
"layer": 1,
|
|
"button_mappings": [
|
|
{
|
|
"to_button_id": "button.container_slot_hovered",
|
|
"mapping_type": "pressed"
|
|
}
|
|
],
|
|
"controls": [
|
|
{ "hover@trade.highlight_slot_panel": {} }
|
|
]
|
|
},
|
|
|
|
"recipe_item_panel": {
|
|
"type": "panel",
|
|
"size": [ 26, 26 ],
|
|
"$item_collection_name": "$recipe_collection",
|
|
"$stack_count_required|default": true,
|
|
"controls": [
|
|
{
|
|
"item_renderer@common.item_renderer": {
|
|
"size": [ 16, 16 ],
|
|
"layer": 1,
|
|
"bindings": [
|
|
{
|
|
"binding_name": "#item_id_aux",
|
|
"binding_condition": "visible",
|
|
"binding_type": "collection",
|
|
"binding_collection_name": "$item_collection_name"
|
|
}
|
|
],
|
|
"controls": [
|
|
{
|
|
"stack_count_label@common.stack_count_label": {
|
|
"layer": 2,
|
|
"bindings": [
|
|
{
|
|
"binding_name": "#item_stack_count",
|
|
"binding_name_override": "#inventory_stack_count",
|
|
"binding_condition": "visible",
|
|
"binding_type": "collection",
|
|
"binding_collection_name": "$item_collection_name"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"recipe_button@recipe_button": {
|
|
"ignored": "$pocket_screen"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
|
|
"trade_item_slot": {
|
|
"type": "panel",
|
|
"size": [ 26, 26 ],
|
|
"$item_collection_name": "$trade_ingredient_collection",
|
|
"controls": [
|
|
{
|
|
"container_item@common.container_item": {
|
|
"anchor_to": "center",
|
|
"anchor_from": "center",
|
|
"$focus_binding_name_left|default": "#trade_item_focus_override_left",
|
|
"$focus_binding_type_left|default": "none",
|
|
"$focus_binding_name_right|default": "#trade_item_focus_override_right",
|
|
"$focus_binding_type_right|default": "none",
|
|
"bindings": [
|
|
{
|
|
"binding_type": "$focus_binding_type_left",
|
|
"binding_collection_name": "$trade_ingredient_collection",
|
|
"binding_name": "$focus_binding_name_left",
|
|
"binding_name_override": "#focus_change_left"
|
|
},
|
|
{
|
|
"binding_type": "$focus_binding_type_right",
|
|
"binding_collection_name": "$trade_ingredient_collection",
|
|
"binding_name": "$focus_binding_name_right",
|
|
"binding_name_override": "#focus_change_right"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
|
|
"trade_item_slotB@trade_item_slot": {
|
|
"bindings": [
|
|
{
|
|
"binding_name": "#show_second_trade_slot",
|
|
"binding_name_override": "#visible",
|
|
"binding_type": "global"
|
|
}
|
|
]
|
|
},
|
|
|
|
"trade_item_slot_result_button@common.container_slot_button_prototype": {
|
|
"button_mappings": [
|
|
{
|
|
"from_button_id": "button.menu_select",
|
|
"to_button_id": "button.trade_take_all_place_all",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_ok",
|
|
"to_button_id": "button.trade_take_all_place_all",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.controller_back",
|
|
"to_button_id": "button.trade_take_all_place_all",
|
|
"mapping_type": "pressed",
|
|
"ignored": "(not $is_ps4)"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_secondary_select",
|
|
"to_button_id": "button.trade_take_half_place_one",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.controller_select",
|
|
"to_button_id": "button.trade_take_half_place_one",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_auto_place",
|
|
"to_button_id": "button.container_auto_place",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.controller_secondary_select",
|
|
"to_button_id": "button.container_auto_place",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_inventory_drop",
|
|
"to_button_id": "button.drop_one",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_inventory_drop_all",
|
|
"to_button_id": "button.drop_all",
|
|
"mapping_type": "pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_select",
|
|
"to_button_id": "button.trade_coalesce_stack",
|
|
"mapping_type": "double_pressed"
|
|
},
|
|
{
|
|
"from_button_id": "button.menu_ok",
|
|
"to_button_id": "button.trade_coalesce_stack",
|
|
"mapping_type": "double_pressed"
|
|
},
|
|
{
|
|
"to_button_id": "button.container_slot_hovered",
|
|
"mapping_type": "pressed"
|
|
}
|
|
]
|
|
},
|
|
|
|
"trade_item_slot_result@trade_item_slot": {
|
|
"$button_ref": "trade.trade_item_slot_result_button"
|
|
},
|
|
|
|
//---------------------------------------------------------------------------
|
|
// Panels
|
|
//---------------------------------------------------------------------------
|
|
|
|
"arrow": {
|
|
"type": "panel",
|
|
"$item_collection_name": "arrow_text",
|
|
"layer": 2,
|
|
"size": [ 26, 26 ],
|
|
"controls": [
|
|
{ "arrow_image@trade.arrow_image": {} },
|
|
{ "cross_out_icon@trade.cross_out_icon": { "layer": 2 } },
|
|
{ "recipe_button@trade.recipe_button": { "ignored": "$pocket_screen" } }
|
|
]
|
|
},
|
|
|
|
"purchase_grid_item": {
|
|
"type": "stack_panel",
|
|
"orientation": "vertical",
|
|
"$padding|default": [ 0, 8 ],
|
|
"controls": [
|
|
{ "top_item@$top_item": {} },
|
|
{
|
|
"padding": {
|
|
"type": "panel",
|
|
"size": "$padding"
|
|
}
|
|
},
|
|
{ "bottom_item@$bottom_item": {} }
|
|
]
|
|
},
|
|
|
|
"purchase_grid": {
|
|
"type": "grid",
|
|
"size": [ "84%", "90%" ],
|
|
"anchor_from": "center",
|
|
"anchor_to": "center",
|
|
"grid_dimensions": [ 4, 1 ],
|
|
"controls": [
|
|
{
|
|
"grid_slot1@trade.purchase_grid_item": {
|
|
"grid_position": [ 0, 0 ],
|
|
"$top_item": "trade.recipe_item_panel",
|
|
"$bottom_item": "trade.trade_item_slot",
|
|
"$recipe_collection": "trade_item_A",
|
|
"$trade_ingredient_collection": "trade_ingredient1_items",
|
|
"$focus_id": "trade_item_A_button_focus_id",
|
|
"$focus_override_left": "trade_item_A_button_focus_id",
|
|
"$focus_override_up": "trade_item_A_button_focus_id",
|
|
"$focus_binding_type_right": "collection"
|
|
}
|
|
},
|
|
{
|
|
"grid_slot2@trade.purchase_grid_item": {
|
|
"grid_position": [ 1, 0 ],
|
|
"$top_item": "trade.recipe_item_panel",
|
|
"$bottom_item": "trade.trade_item_slotB",
|
|
"$recipe_collection": "trade_item_B",
|
|
"$trade_ingredient_collection": "trade_ingredient2_items",
|
|
"$focus_id": "trade_item_B_button_focus_id",
|
|
"$focus_override_left": "trade_item_A_button_focus_id",
|
|
"$focus_override_right": "sell_item_button_focus_id",
|
|
"$focus_override_up": "trade_item_B_button_focus_id"
|
|
}
|
|
},
|
|
{
|
|
"arrow@trade.purchase_grid_item": {
|
|
"grid_position": [ 2, 0 ],
|
|
"$top_item": "trade.arrow",
|
|
"$bottom_item": "trade.arrow"
|
|
}
|
|
},
|
|
{
|
|
"result_item_slot@trade.purchase_grid_item": {
|
|
"grid_position": [ 3, 0 ],
|
|
"$cell_image_size": [ 26, 26 ],
|
|
"$cell_overlay_ref": "trade.greyed_item_panel",
|
|
"$top_item": "trade.recipe_item_panel",
|
|
"$bottom_item": "trade.trade_item_slot_result",
|
|
"$recipe_collection": "sell_item",
|
|
"$trade_ingredient_collection": "trade_result_item",
|
|
"$focus_id": "sell_item_button_focus_id",
|
|
"$focus_override_right": "sell_item_button_focus_id",
|
|
"$focus_override_up": "sell_item_button_focus_id",
|
|
"$focus_binding_type_left": "collection"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
|
|
"greyed_item_panel": {
|
|
"type": "panel",
|
|
"size": [ 26, 26 ],
|
|
"$item_collection_name": "$recipe_collection",
|
|
"controls": [
|
|
{
|
|
"item_renderer@common.item_renderer": {
|
|
"size": [ 16, 16 ],
|
|
"layer": 4,
|
|
"bindings": [
|
|
{
|
|
"binding_name": "#item_id_aux",
|
|
"binding_type": "collection",
|
|
"binding_collection_name": "$item_collection_name"
|
|
},
|
|
{
|
|
"binding_name": "#item_grayed_out",
|
|
"binding_name_override": "#disabled_filter_visible",
|
|
"binding_type": "collection",
|
|
"binding_collection_name": "$item_collection_name"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
|
|
"cycle_panel_keyboard": {
|
|
"type": "panel",
|
|
"size": [ "80%", "30%" ],
|
|
"offset": [ 0, -12 ],
|
|
"controls": [
|
|
{
|
|
"left@trade.cycle_recipe_left_button": {
|
|
"size": [ 11, 21 ]
|
|
}
|
|
},
|
|
{
|
|
"right@trade.cycle_recipe_right_button": {
|
|
"size": [ 11, 21 ]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
|
|
"cycle_panel_gamepad": {
|
|
"type": "panel",
|
|
"size": [ "94%", "30%" ],
|
|
"offset": [ 0, -12 ],
|
|
"controls": [
|
|
{
|
|
"left@trade.cycle_recipe_left_button": {
|
|
"size": [ 23, 21 ]
|
|
}
|
|
},
|
|
{
|
|
"right@trade.cycle_recipe_right_button": {
|
|
"size": [ 23, 21 ]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
|
|
"cycle_panel": {
|
|
"type": "panel",
|
|
"size": [ "100%", "100%" ],
|
|
"anchor_from": "top_left",
|
|
"anchor_to": "top_left",
|
|
"controls": [
|
|
{
|
|
"keyboard@trade.cycle_panel_keyboard": {
|
|
"bindings": [
|
|
{
|
|
"binding_name": "(not #gamepad_helper_visible)",
|
|
"binding_name_override": "#visible"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"gamepad@trade.cycle_panel_gamepad": {
|
|
"bindings": [
|
|
{
|
|
"binding_name": "#gamepad_helper_visible",
|
|
"binding_name_override": "#visible"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
|
|
"merchant_purchase_panel": {
|
|
"type": "panel",
|
|
"anchor_from": "top_middle",
|
|
"anchor_to": "top_middle",
|
|
"size": [ "80%", "100%" ],
|
|
"offset": [ 0, 12 ],
|
|
"controls": [
|
|
{ "purchase_grid@trade.purchase_grid": {} }
|
|
]
|
|
},
|
|
|
|
"top_half_panel": {
|
|
"type": "panel",
|
|
"anchor_from": "top_left",
|
|
"anchor_to": "top_left",
|
|
"size": [ "100%", "50%" ],
|
|
"layer": 1,
|
|
"controls": [
|
|
{
|
|
"villager_name_label@common.section_heading_label": {
|
|
"text": "$villager_name",
|
|
"anchor_from": "top_middle",
|
|
"anchor_to": "top_middle",
|
|
"offset": [ 0, 5 ]
|
|
}
|
|
},
|
|
{ "cycle_panel@trade.cycle_panel": {} },
|
|
{ "merchant_purchase_panel@trade.merchant_purchase_panel": {} }
|
|
]
|
|
},
|
|
|
|
//---------------------------------------------------------------------------
|
|
// Screens
|
|
//---------------------------------------------------------------------------
|
|
|
|
"trade_panel": {
|
|
"type": "panel",
|
|
"controls": [
|
|
{ "gamepad_helpers@common.container_gamepad_helpers": {} },
|
|
{ "selected_item_details_factory@common.selected_item_details_factory": {} },
|
|
{ "item_lock_notification_factory@common.item_lock_notification_factory": {} },
|
|
{
|
|
"root_panel@common.root_panel": {
|
|
"layer": 1,
|
|
"controls": [
|
|
{ "common_panel@common.common_panel": {} },
|
|
{
|
|
"trade_inventory": {
|
|
"type": "panel",
|
|
"controls": [
|
|
{ "top_half_panel@trade.top_half_panel": {} },
|
|
{ "inventory_panel_bottom_half_with_label@common.inventory_panel_bottom_half_with_label": {} },
|
|
{ "hotbar_grid_template@common.hotbar_grid_template": {} },
|
|
{ "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
|
|
{ "gamepad_cursor@common.gamepad_cursor_button": {} }
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{ "flying_item_renderer@common.flying_item_renderer": { "layer": 21 } },
|
|
{ "bundle_touch_tooltip@gameplay.bundle_touch_tooltip": {} }
|
|
]
|
|
},
|
|
|
|
"trade_screen@common.inventory_screen_common": {
|
|
"$screen_bg_content": "common.screen_background",
|
|
"$screen_background_alpha": 0.4,
|
|
"$close_on_player_hurt|default": true,
|
|
"close_on_player_hurt": "$close_on_player_hurt",
|
|
"variables": [
|
|
{
|
|
"requires": "$desktop_screen",
|
|
"$screen_content": "trade.trade_panel"
|
|
},
|
|
{
|
|
"requires": "$pocket_screen",
|
|
"$screen_content": "trade_pocket.trade_panel"
|
|
}
|
|
]
|
|
}
|
|
}
|