-
Notifications
You must be signed in to change notification settings - Fork 84
Use the g_language
command to switch the language. You can add a setting to the menu and switch the language before the level is loaded. Switching only affects texts. Fonts, sounds, etc. - are not changed. Languages are specified here:
[string_table]
language = rus, ukr, eng
talk.xml
:
<action_sounds>
<snd_open>interface\inv_open2</snd_open>
<snd_close>interface\inv_open2</snd_close>
<snd_say>interface\inv_page2</snd_say>
</action_sounds>
carbody_new.xml
:
<action_sounds>
<snd_open>interface\inv_open</snd_open>
<snd_close>interface\inv_close</snd_close>
<snd_properties>interface\inv_properties</snd_properties>
<snd_drop_item>interface\inv_drop</snd_drop_item>
<snd_detach_addon>interface\inv_detach_addon</snd_detach_addon>
<snd_item_use>interface\inv_slot</snd_item_use>
</action_sounds>
- Revamped font system and text parser for correct
UTF-8
support. Fonts withUTF-8
support can be generated using Fonts_generator. Backward compatibility withANSI
characters,UTF-8 BOM
detection and other nuances are taken into account. - Added shadows for fonts. In the future it will be necessary to think how to customize them better.
-
- Fonts size adjustment is added to the menu - it will be especially useful for owners of monitors with ultra-high resolutions. The width and height of fonts can be adjusted with
g_font_scale_x
,g_font_scale_y
commands.
- Fonts size adjustment is added to the menu - it will be especially useful for owners of monitors with ultra-high resolutions. The width and height of fonts can be adjusted with
- Added support for using any font sections for UI via xml & lua without having to edit the engine. For example, create
[letterica18_small]
font somewhere infont.ltx
, and use in xml:<text font=“letterica18_small” r=“127” g=“127” b=“127”/>
. - Added export to scripts for all name fonts that are in the engine.
- Fixed the
width_correction
parameter of fonts, and therefore renamed it tofont_width_correction
- In order not to create a bunch of font textures for different text sizes, you can create one texture of large size and reduce through config to the desired size, for example:
[ui_font_bender]
shader = font
texture = ui\ui_font_bender ;Texture of the generated font of large size
scale_x = 0.5 ;Halve the height
scale_y = 0.5 ;Halve the width
interval = 1, 0.75 ;You can adjust the spacing between the letters on the top and side.
- Added
skip_prefix = true
for font sections. The engine will not require addingfont_prefix
(from[string_table]
) to the texture name of such a font:
[ui_font_digital_16]
skip_prefix = true
shader = font
texture = ui\fonts\Digital52
scale_x = 0.30
scale_y = 0.30
You can enable this in features
section by parameter show_inv_item_condition
. You need to add this into inventory_new.xml
to work:
<condition_progess_bar x="3" y="1" width="29" height="4" horz="1" min="0" max="100" pos="1">
<background x="0" y="0" width="30" height="5">
<texture r="196" g="18" b="18" a="200">ui_mg_progress_efficiency_full</texture>
</background>
<progress>
<texture>ui_mg_progress_efficiency_full</texture>
</progress>
<min_color r="107" g="207" b="119"/>
<middle_color r="255" g="255" b="118"/>
<max_color r="107" g="207" b="119"/>
</condition_progess_bar>
<cell_item_text x="0" y="0" width="35" height="16" stretch="1">
<text x="0" y="0" width="35" height="16" font="letterica16" color="white" align="l" vert_align="t"/>
</cell_item_text>
condition_progess_bar
is static status bar.
cell_item_text
is a number static, items count.
Attribute width
in condition_progess_bar
is not important. If it is not present, the bar length will be calculated automatically, based on the cell width.
Next, for dragdrop elements you need to add the attribute condition_progress_bar="1"
which will enable the display of status bars. By default, the status of weapons and armor will be shown. To show the state of other items, you need to add this into their sections:
inv_show_condition = true
Additionally added cell_sp_x
and cell_sp_y
attributes for dragdrop items. They set the horizontal and vertical indents after the item icon. It doesn't make sense to use them for dragdrop_bag, because the result will be somewhat unexpected for items that occupy more than one cell in any direction. The indentation is calculated for one cell and if there are more cells, the indentation will be larger. That is, if the object is three cells high, then the vertical indentation will be tripled. But for a belt, for example, you can use it.
Item status progress bars are animated. When you open the inventory, they smoothly increase to their values. You can disable animations via the animated=“0”
attribute.
Examples of how to use all of this can be seen here.
- Added a pause after loading a safe in the style of CoP, but, unlike CoP, made entirely in the engine. It is enabled by console command
keypress_on_start
. - Added support for tips when game is loading in new style.
- Ability to split
ui_icon_equipment.dds
into different canvases. Theicon_group
parameter, in the item section, specifies which canvas to take the icon from. If the value of the parameter is0
, which is the default, then the standard textureui_icon_equipment.dds
is used. If the value is greater than zero, for example
icon_group = 1
ui_icon_equipment_1.dds
will be used, i.e. the name of the standard texture is appended with _number
.
- Support for
icon_name
in item section. For example:
[vodka]
icon_name = ui_icon_vodka
In this case the vodka icon will not be taken from the canvas at coordinates inv_grid_x
and inv_grid_y
, but will use the texture ui_icon_vodka
, which should be described in one of the xml texture descriptions, like this, for example:
<ui_texture>
<file_name>ui\ui_icons_items</file_name>
<texture id="ui_icon_vodka" x="0" y="200" width="500" height="200" />
...
</ui_texture>
You need to add into these files:
gamedata/config/ui/inventory_new.xml
gamedata/config/ui/inventory_new_16.xml
into section outfit_info
new nodes:
<static_health_restore_speed x="0" y="0" width="180" height="19" complex_mode="1">
<texture>ui_inv_icon_health_restore_speed</texture>
<text font="letterica16" x="17" y="0" color="ui_clr_1"/>
</static_health_restore_speed>
<static_satiety_restore_speed x="0" y="0" width="180" height="19" complex_mode="1">
<texture>ui_inv_icon_satiety_restore_speed</texture>
<text font="letterica16" x="17" y="0" color="ui_clr_1"/>
</static_satiety_restore_speed>
<static_power_restore_speed x="0" y="0" width="180" height="19" complex_mode="1">
<texture>ui_inv_icon_power_restore_speed</texture>
<text font="letterica16" x="17" y="0" color="ui_clr_1"/>
</static_power_restore_speed>
<static_bleeding_restore_speed x="0" y="0" width="180" height="19" complex_mode="1">
<texture>ui_inv_icon_bleeding_restore_speed</texture>
<text font="letterica16" x="17" y="0" color="ui_clr_1"/>
</static_bleeding_restore_speed>
<static_radiation_restore_speed x="0" y="0" width="180" height="19" complex_mode="1">
<texture>ui_inv_icon_radiation_restore_speed</texture>
<text font="letterica16" x="17" y="0" color="ui_clr_1"/>
</static_radiation_restore_speed>
<static_psy_health_restore_speed x="0" y="0" width="180" height="19" complex_mode="1">
<texture>ui_inv_icon_telepatic_immunity</texture>
<text font="letterica16" x="17" y="0" color="ui_clr_1"/>
</static_psy_health_restore_speed>
You can find examples in these files:
gamedata/config/ui/af_params.xml
gamedata/config/ui/af_params_16.xml
Parameters are exactly the same as for CUIEditBox
(XML and Lua). But it is possible to specify a height greater than one line, then the text will be automatically moved to a new line.
Example: https://www.youtube.com/watch?v=HNksw-86L_8
To create a CUIEditBoxEx
, exactly the same code as for a regular CUIEditBox
is suitable. But the texture for the carpet pad must be in the format for dialogs or frames. That is, there should be 8 parts for the frame + the carpet pad itself. Example of texture from vanilla game: ui_stroketextbox
.
Creating:
By Lua:
local edit_box1 = CUIEditBoxEx()
edit_box1:SetAutoDelete(true)
edit_box1:Init(120, 200, 43, 90) -- 90 - height, preferably a multiple of the font height
edit_box1:InitTexture("ui_stroketextbox")
edit_box1:SetFont(GetFontLetterica18Russian())
self:AttachChild(edit_box1)
By XML:
<edit_box x="120" y="200" width="43" height="90">
<texture>ui_stroketextbox</texture>
<text font="letterica18" a="255" r="200" g="255" b="200"/>
</edit_box>
Lua part:
local edit_box = xml:InitEditBoxEx("main_dialog:edit_box", dialog)
For demonstration purposes, multi-line text input has been added to the custom labels window in the DA.
- Added tools to customize UI in pixels on end-user monitor, not in 1024x768 coordinate system. This is to avoid stretched UI on wide monitors, see ( #378 ).
By enabling the
as_is=“1”
attribute in the config, GUI elements will read coordinates in pixels of the final monitor, not in a 1024x768 grid as it was in vanilla. Therefore, the sizes and coordinates in GUI-configs will have to be corrected to look normal and fit into the screen. Most likely will have to experiment. But when you manage to get a good result by editing configs, this result will be as good for all monitors. - The
as_is
attribute has been added for drag-drop items so that the inventory icons will keep the correct proportions at any screen aspect ratio. - Also added
autocalc
attribute (0 or 1) for drag-drop items to control the auto-calculation of the size and number of cells. Inventory icons are auto-scaled downward if necessary to fit the number of cells in the drag-drop list as specified in its config. The dragdrop sheet is pre-filled with additional cells in width or height, until it is completely filled, if there is still free space after applying the above manipulations. The size of cells is regulated by the new attributecell_size
(default 50), the old attributescell_width
,cell_height
are not used.
- **Added ability for scripts to get
CUIButton
fromCUIWindow
** Allows to do like this:
-- In this case, an accelerator is assigned to the button to exit the inventory.
local wnd = level.get_inventory_wnd()
local btn_exit = wnd:FindChild( "exit_button" )
if btn_exit then
local btn = btn_exit:GetButton()
if btn then
btn:SetAccelerator( k_inv_open )
end
end
- Added
level_changer_action
callback for actor. Called before the dialog to confirm the transition to another location is shown. Can be used to change this dialog. For example:
-- Here the name of the location we are moving to is added to the confirmation.
function actor_binder:level_changer_action( obj, wnd )
local sobj = obj:get_alife_object()
local lc = sobj:get_level_changer()
local dest_vertex = lc.dest_game_vertex_id
local dest_lname = alife():level_name(
game_graph():vertex( dest_vertex ):level_id()
)
local msg_text_wnd = wnd:FindChild( "message_box_change_level:message_text" )
msg_text_wnd:GetCUIStatic():SetText(
game.translate_string( dest_lname ) .. ": "
.. game.translate_string( "level_changer_invitation" )
)
end
- Fixed memory leak in
m_callbacks
. When a window is destroyed, all callbacks to it will also be cleared. Previously this did not happen, which caused a memory leak. You can also clear them by yourself by usingClearCallbacks()
function. - Added CoP format support for
texture_desc
texture description files. They are more convenient because you can describe a lot of textures in one file. Also autoload descriptions in the pathui\textures_descr\*.xml
. - Added smooth scroll in ui.
- Added support for rounded minimap and clock on it. Example of customization:
<minimap rounded="1" alpha="220">
<level_frame x="75" y="670" width="172" height="172" stretch="1" alignment="c"/>
<background width="350" height="380" stretch="1" alignment="c">
<texture></texture>
<dist_text x="75" y="3" width="100" height="20">
<text align="r" font="letterica16" color="ui_clr_1" />
</dist_text>
</background>
<clock_wnd x="18" y="170" width="39" height="16" alignment="c">
<text x="0" y="0" font="letterica16" color="ui_clr_1" align="c" vert_align="c" />
</clock_wnd>
<compass x="75" y="670" width="192" height="192" stretch="1" heading="1" alignment="c">
<texture></texture>
</compass>
<center width="4" height="4" alignment="c" stretch="1" heading="1">>
<texture></texture>
</center>
</minimap>
- Hiding/showing HUD keys can now be customized in options, as the standard
NUM+
/NUM-
keys are not available on every keyboard. - Hiding the HUD will now hide the entire UI, including the news window and cursor, to make it easier to take screenshots.