On This Page

  • Reference
  • LUA API
  • Classes
  • UI

UI

UI is one of the basic elements in the project and one of the important ways for players to interact with the game.

Functions

get_lua_ui_from_py

Obtain the interface instance of the lua layer through the interface instance of the py layer.

Parameters

VariableTypeDescription
py_uistring

Return

TypeDescription
tableReturns the lua layer skill instance after the lua layer is initialized.
ui.get_lua_ui_from_py (player, py_ui)

create_ui_widget

Create interface controls.

Parameters

VariableTypeDescription
playerstringPlayer.
parent_uistringUi control.
type_namestringUi control.

Return

TypeDescription
tableReturns the lua layer skill instance after the lua layer is initialized.
ui.create_ui_widget (player, parent_ui, type_name)

set_visible

Set the UI control to be visible or hidden.

Parameter

VariableTypeDescription
visiblebooleanShow/hide.
ui:set_visible (visible)

set_image

Set picture.

Parameter

VariableTypeDescription
imgintegerImage ID.
ui:set_image (img)

set_text

Set text.

Parameter

VariableTypeDescription
strstringText.
ui:set_text (str)

set_alpha

Set the transparency of the control.

Parameter

VariableTypeDescription
valuefloatTransparency.
ui:set_alpha (value)

set_is_draggable

Set whether the control can be dragged.

Parameter

VariableTypeDescription
isdragbooleanWhether draggable.
ui:set_is_draggable (isdrag)

set_intercepts_operations

Set whether the control intercepts the operation.

Parameter

VariableTypeDescription
interceptsbooleanWhether to intercept the operation.
ui:set_intercepts_operations (intercepts)

set_z_order

Set control depth.

Parameter

VariableTypeDescription
deepfloatDepth.
ui:set_z_order (deep)

set_max_progress_bar_value

Set the maximum value of the progress bar.

Parameter

VariableTypeDescription
progressfloatMaximum value of the progress bar.
ui:set_max_progress_bar_value (progress)

set_current_progress_bar_value

Set the current value of the progress bar.

Parameters

VariableTypeDescription
progressfloatCurrent value of the progress bar.
timefloatFade time.
ui:set_current_progress_bar_value (progress, time)

set_button_enable

Enable/disable button.

Parameter

VariableTypeDescription
enablebooleanEnable/disable button.
ui:set_button_enable (enable)

set_ui_size

Set control size.

Parameters

VariableTypeDescription
widthfloatWidth.
heightfloatHeight.
ui:set_ui_size (width, height)

set_font_size

Set text font size.

Parameter

VariableTypeDescription
sizefloatFont size.
ui:set_font_size (size)

set_input_field_focus

Let the input box get the focus.

ui:set_input_field_focus ()

set_skill_on_ui_comp

Bind the skill object to the control.

Parameter

VariableTypeDescription
skillabilitySkill object.
ui:set_skill_on_ui_comp (skill)

set_buff_on_ui

Bind the unit to the magic effect display bar component.

Parameter

VariableTypeDescription
unitunitUnit.
ui:set_buff_on_ui (unit)

set_item_on_ui

Bind the item object to the item component.

Parameter

VariableTypeDescription
itemitemItem object.
ui:set_item_on_ui (item)

set_prefab_ui_visible

Set the switch of the default game interface.

Parameter

VariableTypeDescription
visiblebooleanSwitch of the game interface.
ui:set_prefab_ui_visible (visible)

set_ui_model_id

Set the model of the model control.

Parameter

VariableTypeDescription
modelidstringModel ID.
ui:set_ui_model_id (modelid)

change_mini_map_img

Change minimap image.

Parameter

VariableTypeDescription
imgstringImage ID.
ui:change_mini_map_img (img)

set_ui_unit_slot

Set the item component binding unit.

Parameters

VariableTypeDescription
unitunitPicture id.
fieldstringBackpack slot type name.
indexintegerGrid position.
ui:set_ui_unit_slot (unit, field, index)

set_button_shortcut

Set button shortcuts.

Parameter

VariableTypeDescription
keystringShortcut key.
ui:set_button_shortcut (key)

set_btn_meta_key

Set button combination shortcut key.

Parameter

VariableTypeDescription
keystringAuxiliary key.
ui:set_btn_meta_key (key)

set_skill_btn_smart_cast_key

Set smart casting shortcuts.

Parameter

VariableTypeDescription
keystringShortcut key.
ui:set_skill_btn_smart_cast_key (key)

set_skill_btn_func_meta_key

Set shortcut keys for smart casting combinations.

Parameter

VariableTypeDescription
keystringAuxiliary key.
ui:set_skill_btn_func_meta_key (key)

set_skill_btn_action_effect

Play/stop skill button activates animation.

Parameter

VariableTypeDescription
isopenbooleanPlay/stop skill button activate animation.
ui:set_skill_btn_action_effect (isopen)

set_text_color

Set text color.

Parameter

VariableTypeDescription
rfloatRed.
gfloatGreen.
bfloatBlue.
afloatOpacity.
ui:set_text_color (r, g, b, a)

change_showroom_fov

Set the camera field of view of the model control.

Parameter

VariableTypeDescription
fovfloatField of view.
ui:change_showroom_fov (fov)

change_showroom_cposition

Set the camera coordinates of the model control.

Parameters

VariableTypeDescription
xfloatX axis.
yfloatY axis.
zfloatZ axis.
ui:change_showroom_cposition (x, y, z)

change_showroom_crotation

Set the camera rotation of the model control.

Parameters

VariableTypeDescription
xfloatX axis.
yfloatY axis.
zfloatZ axis.
ui:change_showroom_crotation (x, y, z)

create_ui_event

Create interface events.

Parameters

VariableTypeDescription
eventfloatInterface event type.
strstringEvent name.
ui:create_ui_event (event, str)

display_system_information_message

System message prompt.

Parameters

VariableTypeDescription
msgstringMessage.
timefloatDuration.
isSupportLanguagebooleanWhether to support the language environment.
ui:display_system_information_message (msg, time, isSupportLanguage)

set_widget_relative_rotation

Set the relative rotation of the control.

Parameter

VariableTypeDescription
rotfloatAngle.
ui:set_widget_relative_rotation (rot)

set_widget_absolute_coordinates

Set the absolute coordinates of the control.

Parameters

VariableTypeDescription
xfloatX axis.
yfloatY axis.
ui:set_widget_absolute_coordinates (x, y)

set_widget_absolute_rotation

Set absolute rotation of the control.

Parameter

VariableTypeDescription
rotfloatAngle.
ui:set_widget_absolute_rotation (rot)

set_widget_absolute_scale

Set the absolute scaling of the control.

Parameters

VariableTypeDescription
xfloatX axis.
yfloatY axis.
ui:set_widget_absolute_scale (x, y)

set_widget_relative_scale

Set the relative zoom of the control.

Parameters

VariableTypeDescription
xfloatX axis.
yfloatY axis.
ui:set_widget_relative_scale (x, y)

change_minimap_display_mode

Set the minimap display mode.

Parameter

VariableTypeDescription
typestringMinimap display mode.
ui:change_minimap_display_mode (type)

set_slider_value

Set the progress of the slider.

Parameter

VariableTypeDescription
percentfloatProgress of the slider.
ui:set_slider_value (percent)

unbind_widget

Unbind controls.

ui:unbind_widget ()

get_ui_comp_children

Traverse the child nodes of an interface control.

get_ui_comp_children (self.player.base (), self.base ())

play_timeline_animation

Play timeline animation.

Parameters

VariableTypeDescription
animstringAnimation.
speedfloatPlayback speed.
isloopbooleanWhether to loop.
ui:play_timeline_animation (anim, speed, isloop)

set_ui_model_focus_pos

Set model control watchpoint.

Parameters

VariableTypeDescription
xfloatX axis.
yfloatY axis.
zfloatZ axis.
ui:set_ui_model_focus_pos (x, y, z)

bind_unit_attribute_to_player_ui_widget_attribute

Binding unit properties to properties of player interface controls.

Parameters

VariableTypeDescription
uiAttrstringInterface control attribute.
attrstringUnit attribute.
accuracyintegerDecimal precision.
ui:bind_unit_attribute_to_player_ui_widget_attribute (uiAttr, attr, accuracy)

bind_global_variable_to_player_ui_widget_attribute

Binding global variables to properties of player interface controls.

Parameters

VariableTypeDescription
uiAttrstringInterface control attribute.
globalVarstringGlobal attribute.
accuracyintegerDecimal precision.
ui:bind_global_variable_to_player_ui_widget_attribute (uiAttr, globalVar, accuracy)

unbind_ui_widget_attribute

Unbind interface control property binding.

Parameter

VariableTypeDescription
uiAttrstringInterface control attribute.
ui:unbind_ui_widget_attribute (uiAttr)

ui_widget_attribute_bound_to_specified_unit

Interface control property binding specified unit.

Parameter

VariableTypeDescription
unitunitUnit.
ui:ui_widget_attribute_bound_to_specified_unit (unit)

set_disable_image_type

Set disabled pictures (picture type).

Parameter

VariableTypeDescription
imgintegerImage ID.
ui:set_disable_image_type (img)

set_hover_image_type

Set floating picture (picture type).

Parameter

VariableTypeDescription
imgintegerImage ID.
ui:set_hover_image_type (img)

set_press_image_type

Set the pressed picture (picture type).

Parameter

VariableTypeDescription
imgintegerImage ID.
ui:set_press_image_type (img)

bind_player_attribute_to_ui_widget_attribute

Bind player properties to properties of player interface controls.

Parameters

VariableTypeDescription
uiAttrstringInterface control attribute.
playerAttrstringPlayer attribute.
accuracyintegerDecimal precision.
ui:bind_player_attribute_to_ui_widget_attribute (uiAttr, playerAttr, accuracy)

set_alignment_type_for_ui_widget

Set the alignment of interface components.

Parameter

VariableTypeDescription
typestringAlignment.
ui:set_alignment_type_for_ui_widget (type)

enable_drawing_unit_path

Turn on drawing unit path lines.

Parameter

VariableTypeDescription
unitunitUnit.
ui:enable_drawing_unit_path (unit)

disable_drawing_unit_path

Turn off drawing unit path lines.

Parameter

VariableTypeDescription
unitunitUnit.
ui:disable_drawing_unit_path (unit)

remove_ui_comp

Delete interface controls.

ui:remove_ui_comp ()

set_ui_comp_bind_ability_cd

Binding skill cooldown time to the property of the player interface control.

Parameters

VariableTypeDescription
uiAttrstringInterface control attribute.
skillabilitySkill.
ui:set_ui_comp_bind_ability_cd (uiAttr, skill)

set_ui_comp_bind_modifier_cd

A property that binds the magic effect's remaining time to the player interface control.

Parameters

VariableTypeDescription
uiAttrstringInterface control attribute.
magicEffectmodifierMagic effect.
ui:set_ui_comp_bind_modifier_cd (uiAttr, magicEffect)

set_chat_send_enabled

Enable/disable send chat feature.

Parameter

VariableTypeDescription
enablebooleanEnable/disable send chat function.
game_api.set_chat_send_enabled (self.player.base (), self.base (), enable)

set_player_chat_show

Show/hide chat box.

Parameter

VariableTypeDescription
enablebooleanShow/hide chat box.
ui:set_player_chat_show (enable)

clear_player_chat_panel

Clear chat.

ui:clear_player_chat_panel ()

send_chat_to_role

Send private message.

Parameters

VariableTypeDescription
playerplayerPlayer.
msgstringMessage.
game_api.send_chat_to_role (self.player.base (), self.base (), player.base (), msg)

create_floating_text

Create floating text.

Parameters

VariableTypeDescription
pointpointPoint.
harm_type_namestringSkip word type.
strstringText.
player_groupplayer_groupPlayer group.
ui.create_floating_text (point, harm_type_name, str, player_group)

set_window_mode

Set window.

Parameter

VariableTypeDescription
window_modestringWindow type.
ui:set_window_mode (window_mode)

set_graphics_quality

Set quality.

Parameter

VariableTypeDescription
quality_namestringQuality.
ui:set_graphics_quality (quality_name)

set_screen_resolution

Screen Resolution.

Parameters

VariableTypeDescription
xfloatX axis.
yfloatY axis.
ui:set_screen_resolution (x, y)

get_widget_relative_x_coordinate

Get the X of the relative coordinates of the local control.

Return

TypeDescription
floatX relative coordinate.
ui:get_widget_relative_x_coordinate ()

get_widget_relative_y_coordinate

Get the Y of the relative coordinates of the local control.

Return

TypeDescription
floatY coordinate.
ui:get_widget_relative_y_coordinate ()

get_widget_absolute_x_coordinate

Get the X of the absolute coordinates of the local control.

Return

TypeDescription
floatX absolute coordinate.
ui:get_widget_absolute_x_coordinate ()

get_widget_absolute_y_coordinate

Get the Y of the absolute coordinates of the local control.

Return

TypeDescription
floatY absolute coordinate.
ui:get_widget_absolute_y_coordinate ()

get_widget_relative_rotation

Get the relative rotation of the local control.

Return

TypeDescription
floatRelative rotation.
ui:get_widget_relative_rotation ()

get_widget_absolute_rotation

Get the absolute rotation of the local control.

Return

TypeDescription
floatAbsolute rotation.
ui:get_widget_absolute_rotation ()

get_widget_relative_scale_x_coordinate

Get the X of the relative zoom of the local control.

Return

TypeDescription
floatX relative scaling.
ui:get_widget_relative_scale_x_coordinate ()

get_widget_relative_scale_y_coordinate

Get the relative scaled Y of the native control.

Return

TypeDescription
floatY absolute scale.
ui:get_widget_relative_scale_y_coordinate ()

get_widget_absolute_scale_x_coordinate

Get the X of the absolute scaling of the native control.

Return

TypeDescription
floatX absolute scaling.
ui:get_widget_absolute_scale_x_coordinate ()

get_widget_absolute_scale_y_coordinate

Get the Y of the local control's absolute scaling.

Return

TypeDescription
floatY absolute scale.
ui:get_widget_absolute_scale_y_coordinate ()

convert_ui_widget_to_string

Interface controls are converted to strings.

Return

TypeDescription
stringString.
ui:convert_ui_widget_to_string ()

get_slider_current_value

Get the current value of the slider.

Return

TypeDescription
floatCurrent value of the slider.
ui:get_slider_current_value ()

get_ui_widget_name

Get interface control name.

Return

TypeDescription
stringControl name.
ui:get_ui_widget_name ()

get_child_widget_of_specified_name

Get the child control with the specified name.

Return

TypeDescription
uiUi control.
ui:get_child_widget_of_specified_name (name)

get_widget_width

Get the width of the control.

Return

TypeDescription
floatWidth of the control.
ui:get_widget_width ()

get_widget_height

Get control height.

Return

TypeDescription
floatHeight of the control.
ui:get_widget_height ()

get_screen_horizontal_resolution

Get the horizontal resolution of the screen.

Return

TypeDescription
floatHorizontal resolution.
ui:get_screen_horizontal_resolution ()

get_screen_vertical_resolution

Get the vertical resolution of the screen.

Return

TypeDescription
floatVertical resolution.
ui:get_screen_vertical_resolution ()

get_parent_widget_of_ui_widget

Get the parent control of the interface control.

Return

TypeDescription
uiUI control.
ui:get_parent_widget_of_ui_widget ()

get_input_field_content

Get the text content of the player input box.

Return

TypeDescription
stringText content.
ui:get_input_field_content ()

get_ui_comp_visible

Get control visibility.

Return

TypeDescription
booleanControl visibility.
ui:get_ui_comp_visible ()