Scaleform StudioでUIを作って表示する
プロジェクト作成
適当なディレクトリにAssetBrowserからScaleform Studio Projectを作成
ボタンを一個配置する
boot.packageに登録する
content/UI/TestUI.s2dの場合以下のように登録する
s2d = [
"content/UI/TestUI"
]
マウスカーソルを表示する設定を仕込む
script/lua/project.lua の Project.on_level_load_pre_flow関数に以下のコードを追記。
stingray.Window.set_mouse_focus(true)
stingray.Window.set_clip_cursor(true)
stingray.Window.set_show_cursor(true)
TestUI.s2d/ButtonWidgets/Button_handler.luaを編集する 22行目からのコードを以下のように修正
clicked = function()
print(actorName .. " button clicked")
-- The code below gives an example of how to dispatch a custom event from this event handler function.
local evt = { eventId = scaleform.EventTypes.Custom,
name = "TestButtonClicked",
data = "osaretayo" }
scaleform.Stage.dispatch_event(evt)
end
LevelFlowに表示コードを仕込んでみる
以下の画像は
content/UI/TestUI.s2d
content/UI/TestUI.s2d/TestUI.s2dproj
の場合の例。
実行してボタンを押すと、"osaretayo"とログに表示されるはず。
画像の通り、イベントが発行されたかどうか自分で確認するロジックにする必要があるようだ。
今回の参考記事
マウスカーソル表示の方法
forums.autodesk.com
公式ドキュメント
http://help.autodesk.com/view/Stingray/ENU/?guid=__stingray_help_creating_uis_using_flow_html