
// Copyright (c) Microsoft Corporation.  All rights reserved.

{
  "namespace": "update_dimensions",

  //--------------------------------------------------------------------------------

  "update_dimensions_update_and_play_button@popup_dialog.popup_dialog_button": {
    "size": "$button_size",
    "$pressed_button_name": "button.update_and_play",
    "$button_text": "options.updateAndPlay"
  },

  "update_dimensions_description": {
    "type": "label",
    "size": [ "100%", "100%" ],
    "color": "$body_text_color",
    "anchor_from": "center",
    "anchor_to": "center",
    "text": "options.updateWorldHeight.message"
  },

  "update_dimensions_label_panel@common.scrolling_panel": {
    "$scrolling_pane_size": [ "100% - 12px", "100%" ],
    "$scrolling_content": "update_dimensions.update_dimensions_description",
    "$scroll_size": [ 5, "100% - 4px" ],
    "$show_background": false,
    "layer": 0,
    "anchor_from": "left_middle",
    "anchor_to": "left_middle",
    "$always_handle_scrolling": true
  },

  "make_backup_checkbox@common.checkbox": {
    "size": [ "100%", "100%" ],
    "anchor_from": "center",
    "anchor_to": "center",
    "$toggle_name": "update_dimensions_make_backup",
    "$toggle_state_binding_name": "#update_dimensions_make_backup",
    "$toggle_label_text|default": "options.makeBackup",

    "tts_control_type_order_priority": 100,
    "tts_value_order_priority": 101,
    "$toggle_enabled_binding_type": "global",

    "controls": [
      {
        "header_description_stack_panel": {
          "type": "stack_panel",
          "orientation": "horizontal",
          "size": [ "100%", "100%" ],
          "anchor_from": "left_middle",
          "anchor_to": "left_middle",

          "controls": [
            {
              "checkbox_visuals@common.toggle_visuals": {
                "size": [ 30, "100%" ],
                "anchor_from": "right_middle",
                "anchor_to": "right_middle"
              }
            },
            {
              "buffer_panel": {
                "type": "panel",
                "layer": 3,
                "size": [ "fill", "100%" ],
                "controls": [
                  {
                    "label": {
                      "type": "label",
                      "color": "$light_button_default_text_color",
                      "text": "$toggle_label_text",
                      "size": [ "default", "default" ],
                      "anchor_from": "center",
                      "anchor_to": "center"
                    }
                  }
                ]
              }
            },
            {
              "another_panel": {
                "type": "panel",
                "size": [ 30, "100%" ]
              }
            }
          ]
        }
      }
    ]
  },

  "world_upgrade_animation": {
    "anim_type": "flip_book",
    "initial_uv": [ 0, 0 ],
    "frame_count": 32,
    "frame_step": 130,
    "fps": 9,
    "reversible": false,
    "easing": "linear"
  },

  "world_upgrade": {
    "type": "image",
    "layer": 5,
    "texture": "textures/ui/world_upgrade",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "offset": [ 10, 25 ],
    "size": [ 130, 127 ],
    "uv_size": [ 130, 127 ],
    "uv": "@update_dimensions.world_upgrade_animation",
    "disable_anim_fast_forward": true
  },

  "update_dimensions_dialog@common_dialogs.main_panel_three_buttons": {
    "size": [ 300, 230 ],
    "$fill_alpha": 1,

    "layer": 101,
    "$text_name": "options.updateWorldHeight",
    "$description_text": "options.updateWorldHeight.message",
    "$button_size": [ "100%", 30 ],

    "$show_close_button": true,
    "$child_control": "update_dimensions.update_dimensions_label_panel",
    "$top_button_panel": "update_dimensions.make_backup_checkbox",
    "$bottom_button_panel": "update_dimensions.update_dimensions_update_and_play_button",
    "controls": [
      {
        "common_panel@common.common_panel": { "$dialog_background": "dialog_background_hollow_1" }
      },
      {
        "title_label@common_dialogs.title_label": {}
      },
      {
        "panel_indent": {
          "type": "panel",
          "size": [ "50%", "40%" ],
          "offset": [ "50%", "-10%" ],
          "anchor_from": "left_middle",
          "anchor_to": "left_middle",
          "controls": [
            { "inside_header_panel@$child_control": {} }
          ]
        }
      },
      {
        "top_button_panel@$top_button_panel": {
          "size": [ "100%", 30 ],
          "offset": [ 0, -43 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle"
        }
      },
      {
        "bottom_button_panel@$bottom_button_panel": {
          "size": [ "65%", 30 ],
          "offset": [ 0, -10 ],
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle"
        }
      },
      {
        "world_upgrade_image@update_dimensions.world_upgrade": {}
      }
    ]
  },

  //--------------------------------------------------------------------------------

  "gamepad_helpers": {
    "type": "panel",
    "size": [ 100, 10 ],
    "offset": [ 0, "45%" ],
    "controls": [
      {
        "gamepad_helper_a@common.gamepad_helper_a": {
          "anchor_from": "center",
          "anchor_to": "center"
        }
      }
    ]
  },

  //---------------------------------------------------------------------------
  // Screens
  //---------------------------------------------------------------------------
  "update_dimensions_screen@common.base_screen": {
    "force_render_below": false,
    "$screen_animations": [
      "@common.screen_exit_animation_push_fade",
      "@common.screen_exit_animation_pop_fade"
    ],

    "button_mappings": [
      {
        "from_button_id": "button.menu_cancel",
        "to_button_id": "button.menu_exit",
        "mapping_type": "global"
      }
    ],

    "$screen_content": "update_dimensions.update_dimensions_screen_content"
  },

  "update_dimensions_screen_content": {
    "type": "panel",
    "variables": [
      {
        "requires": "$desktop_screen",
        "$button_state_default_base": "common.button_state_default",
        "$button_state_hover_base": "common.button_state_hover",
        "$button_state_pressed_base": "common.button_state_pressed"
      },
      {
        "requires": "$pocket_screen",
        "$button_state_default_base": "common-classic.button_state_default",
        "$button_state_hover_base": "common-classic.button_state_hover",
        "$button_state_pressed_base": "common-classic.button_state_pressed"
      }
    ],
    "controls": [
      { "update_dimensions_dialog@update_dimensions.update_dimensions_dialog": {} },
      { "gamepad_helpers@update_dimensions.gamepad_helpers": {} }
    ]
  }
}
