Topic Leader
A topic leader is a message panel that can be made to appear front/centre on-screen, and will then animate away towards a point on the screen. It's intended usage is to draw the player's attention towards an area of the screen, mainly during tutorial content.
Loaded in Campaign | |
Loaded in Battle | |
Loaded in Frontend |
-
topic_leader:new(
namestring
,
text keystring
, [
text statestring
], [
unlocalisedboolean
])
-
Creates and returns a new topic leader object.
Parameters:
1
Names for this topic leader. The topic leader uicomponent will be named after this.
2
Localisation key (or unlocalised text) to use for the first data entry in the topic leader. This should be supplied in the full [table]_[field]_[key] localisation format, or just as a plain unlocalised string if the fourth argument is set to
true
.3
optional, default value=nil
Component state for the first text entry on the topic leader. If
nil
is supplied then the default state is used.4
optional, default value=false
Use the
string
supplied as the second argument to this function for display directly, instead of using it to look up a localised key. This can be useful for debugging, but shouldn't be used for released content.Returns:
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 56
Once created, functions on the topic leader be called in the form showed below.
Example - Specification:
<topic_leader_object>:<function_name>(<args>)
Example - Creation and Usage:
local tl = topic_leader:new("new_objective", "random_localisation_strings_string_new_objective");
tl:set_shrink_target_uicomponent(get_objectives_manager():get_uicomponent(), 20, 20);
tl:set_hold_duration(2000);
tl:start();
-
topic_leader:add_content(
text keystring
, [
text statestring
], [
unlocalisedboolean
])
-
Adds a new line of content to the topic leader.
Parameters:
1
Localisation key (or unlocalised text) to display. This should be supplied in the full [table]_[field]_[key] localisation format, or just as a plain unlocalised string if the third argument is set to
true
.2
optional, default value=nil
Component state for the text entry. If
nil
is supplied then the default state is used.3
optional, default value=false
Use the
string
supplied as the first argument to this function for display directly, instead of using it to look up a localised key. This can be useful for debugging, but shouldn't be used for released content.Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 120
-
topic_leader:set_text_state(
statestring
)
-
Sets the uicomponent state of the text uicomponent of the topic leader. Use this to customise how the text is displayed.
Parameters:
1
state
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 146
-
topic_leader:set_hold_duration(
hold duration in msnumber
)
-
Sets the duration for which the leader uicomponent should hold in place before beginning to animate off-screen. This duration is set in milliseconds, in all game modes. The default value is 2000ms.
Parameters:
1
hold duration in ms
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 159
-
topic_leader:set_shrink_target(
xnumber
,
ynumber
)
-
Sets a screen position to which the topic leader should shrink to when playing its shrink animation.
Parameters:
1
x co-ordinate in pixels.
2
y co-ordinate in pixels.
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 172
-
topic_leader:set_shrink_target_uicomponent(
uicomponentuicomponent
, [
xnumber
], [
ynumber
])
-
Sets a uicomponent target to which the topic leader should shrink to when playing its shrink animation. This sets the topic leader to shrink to the top-left of the uicomponent, offset by the optionally-supplied offset co-ordinates. The position of the uicomponent is computed when
topic_leader:start
is called.Parameters:
1
UIComponent to which the topic leader should shrink towards when its shrink animation is played.
2
optional, default value=nil
x offset co-ordinate in pixels.
3
optional, default value=nil
y offset co-ordinate in pixels.
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 193
-
topic_leader:add_shrink_callback(
callbackfunction
)
-
Adds a shrink callback for the topic leader. This function will be called
topic_leader:shrink
is called, immediately prior to the topic leader beginning its shrink animation. This functionality may be used to set up the shrink target, amongst other things. Multiple shrink callbacks may be added to one topic leader.Parameters:
1
callback
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 221
-
topic_leader:start()
-
Creates the topic leader uicomponent and starts its animated sequence.
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 263
-
topic_leader:shrink()
-
Forces the topic leader to start playing its shrink animation. Once the topic leader is displayed the shrink animation will play automatically after the hold duration has elapsed, but this function can be called to force it to play early.
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 357
-
topic_leader:hide()
-
Immediately hides the topic leader, if it's showing, and destroys all running processes and listeners started by it.
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_topic_leader.lua, line 453