iw6-lui/lui/mp_menus/mpscreenshotviewer.dec.lua
2024-09-12 17:25:45 +02:00

141 lines
3.1 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function ExitViewer( f1_arg0, f1_arg1 )
local f1_local0 = OnlineVault.AbortScreenshotDownload
local f1_local1 = f1_arg0.controller
if not f1_local1 then
f1_local1 = Engine.GetFirstActiveController()
end
f1_local0( f1_local1 )
LUI.FlowManager.RequestLeaveMenu( f1_arg0 )
end
function menu_screenshot()
return {
type = "UIElement",
id = "menu_screenshot_root",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
},
children = {
{
type = "UIImage",
id = "menu_screenshot_background_id",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = 0,
green = 0,
blue = 0,
alpha = 0.5
}
}
},
{
type = "UIImage",
id = "menu_screenshot_border_id",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 200,
right = -200,
top = 120,
bottom = -80,
red = Colors.window_border_color.r,
green = Colors.window_border_color.g,
blue = Colors.window_border_color.b
}
},
children = {
{
type = "UIBindText",
id = "menu_screenshot_download_percent_id",
properties = {
dataSource = "DownloadProgress",
textFormat = Engine.Localize( "@LUA_MENU_ONLINEVAULT_DOWNLOADING_PERCENT" )
},
states = {
default = {
width = 400,
height = CoD.TextSettings.ExtraBigFont.Height,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Center
}
}
},
{
type = "UIScreenshotViewer",
id = "menu_screenshot_screenshot_id",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 2,
right = -2,
top = 2,
bottom = -40
}
}
},
{
type = "UIText",
id = "menu_screenshot_back_button_id",
properties = {
text = Engine.Localize( ButtonMap.button_secondary.string ) .. " " .. Engine.Localize( "@LUA_MENU_BACK" )
},
states = {
default = {
leftAnchor = false,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
right = -5,
bottom = -5,
width = 80,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right
}
}
}
}
},
{
type = "UIBindButton",
id = "menu_screenshot_bind_button_id",
handlers = {
button_secondary = ExitViewer
}
}
}
}
end
LUI.MenuBuilder.registerDef( "menu_screenshot", menu_screenshot )
LockTable( _M )