12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- @tool
- @icon("res://addons/input_prompts/joypad_button_prompt/icon.svg")
- class_name JoypadButtonPrompt
- extends "res://addons/input_prompts/input_prompt.gd"
- var button := 0:
- set = _set_button
- var icon: int = Icons.AUTOMATIC:
- set = _set_icon
- func _ready():
- _update_icon()
- func _set_button(index: int):
- button = index
- var event := InputEventJoypadButton.new()
- event.button_index = button
- events = [event]
- _update_icon()
- func _set_icon(new_icon):
- icon = new_icon
- _update_icon()
- func _update_icon():
- var textures := PromptManager.get_joypad_button_textures(icon)
- texture = textures.get_texture(events[0])
- queue_redraw()
- func _get_property_list():
- var properties = []
- properties.append(
- {
- name = "JoypadButtonPrompt",
- type = TYPE_NIL,
- usage = PROPERTY_USAGE_CATEGORY | PROPERTY_USAGE_SCRIPT_VARIABLE
- }
- )
- properties.append(
- {name = "button", type = TYPE_INT, hint = PROPERTY_HINT_RANGE, hint_string = "0,22"}
- )
- properties.append(
- {
- name = "icon",
- type = TYPE_INT,
- hint = PROPERTY_HINT_ENUM,
- hint_string = "Automatic,Xbox,Sony,Nintendo"
- }
- )
- return properties
|