Interface IScaleformFunctionRegistrar
- Namespace
- SkyrimForge
- Assembly
- SkyrimForge.dll
Puts a function on a Scaleform movie that ActionScript calls and this plugin implements,
which is the direction ICustomMenuRegistrar and ScaleformValue do not cover: those reach into a movie, and this lets the movie reach back.
public interface IScaleformFunctionRegistrar
Remarks
// _root.getPlayerGold() in the movie's ActionScript reaches the delegate below.
scaleform.Register(movie, root, "getPlayerGold", call => call.RetVal?.SetNumber(player.GetGoldAmount()));
A call arrives on the thread that advances the movie, with the game stopped for it, so a delegate may call the game directly. An exception from a delegate is written to the log of the plugin that registered it, and the movie reads whatever the return value already stored.
A registration lasts for the life of the process, no signal reaching here that a movie has been destroyed, so a plugin registering on every movie accumulates one small record per movie. That is the cost of registering the function on menus that are rebuilt each time they open.
Properties
OnMovieCreated
Raised as the game finishes each movie.
IGameEvent<ScaleformMovieCreatedEventArgs> OnMovieCreated { get; }
Property Value
Remarks
The game builds a menu's movie each time the menu opens, so a function is registered again on each one. A handler runs where the game builds its interface, so it may call the game and may call Register(IGFxMovie, GFxValue, string, Action<Params>) for the movie it was given. A handler that throws is dropped and reported in the log of the plugin that subscribed it.
Exceptions
- InvalidOperationException
The running SKSE has no Scaleform interface.
Methods
Register(IGFxMovie, GFxValue, string, Action<Params>)
Puts a function named name on target.
void Register(IGFxMovie movie, GFxValue target, string name, Action<GFxFunctionHandler.Params> handler)
Parameters
movieIGFxMovieThe movie that creates the function, which is
UiMovieon the menu being extended.targetGFxValueThe ActionScript object that takes the function as a member, usually the movie's
_root.namestringThe name ActionScript uses for it.
handlerAction<GFxFunctionHandler.Params>The delegate that runs for each call.
Args.Get()returns the arguments the movie passed, and writing intoRetValsends a value back. LeavingRetValalone returns undefined.
Exceptions
- ArgumentNullException
nameorhandlerisnull.- ArgumentException
nameis empty.- InvalidOperationException
The handler could not be allocated, or setting the member on the object returned false.