Module:GameUITemplates

local Array2DParser = require("Module:Array2DParser")

local Button = require("Module:GameUIBuilder").GameUIButton local Label = require("Module:GameUIBuilder").GameUILabel local Menu = require("Module:GameUIBuilder").GameUIMenu

-- BUTTONS -- local function GameUIEditButton(edit_url) local tooltip_content = "Edit this template" return Button({ "game-ui-edit-button", "game-ui-tooltip" }, nil, nil, { edit_url }):attr("title", tooltip_content) :node(mw.html.create("span"):addClass("hover-content"):wikitext(tooltip_content)) end

-- These two work together local function GameUIShowStatsButton(group_name, stats_table) return Button({ "game-ui-showstats-button", "game-ui-info-button" }, nil, nil, { group_name, Array2DParser.encodeFromLua(stats_table) }) end local function GameUIHideStatsButton return Button({ "game-ui-hidestats-button", "game-ui-back-button" }, nil, nil, { "" }) end

-- These two work together local function GameUIShowModifiersButton(title, description, modifiers_table) return Button({ "game-ui-showmodifiers-button", "game-ui-info-button" }, nil, nil, { title, description, Array2DParser.encodeFromLua(modifiers_table) }) end local function GameUIHideModifiersButton return Button({ "game-ui-hidemodifiers-button", "game-ui-back-button" }, nil, nil, { "" }) end

-- These two work together local function GameUIShowAbilityButton(title, description, status_fullpagename) return Button({ "game-ui-showability-button", "game-ui-info-button" }, nil, nil, { title, description, status_fullpagename }) end local function GameUIHideAbilityButton return Button({ "game-ui-hideability-button", "game-ui-back-button" }, nil, nil, { "" }) end

local function GameUIToggleLayerButton(current_layer, is_disabled) if current_layer == nil then return Button({ "game-ui-stack-button-disabled" }, nil, nil, nil) else return Button({ "game-ui-togglelayer-button", "game-ui-stack-button" }, nil, nil, { current_layer }) end end

-- INFOBOX IMAGE -- local function GameUIInfoboxImage(file) return Label({ "game-ui-image" }, nil, string.format("", file)) end

-- INFOBOX DESCRIPTION -- local function GameUIInfoboxDescription(description) return Label({ "game-ui-description" }, nil, description) end

-- SIDEBAR INFOBOX -- local function GameUISidebarInfobox(title, rightButton) return Menu({ "game-ui-infobox-sidebar" }, nil, title, nil, rightButton) end

-- BLOCK INFOBOX -- local function GameUIBlockInfobox(title, leftButton, rightButton) return Menu({ "game-ui-infobox-block" }, nil, title, leftButton, rightButton) end

-- DIALOG MENU -- local function GameUIDialogMenu(title, leftButtonn) return Menu({ "game-ui-dialog-menu" }, nil, title, leftButton, nil) end

return { GameUIEditButton = GameUIEditButton, GameUIShowStatsButton = GameUIShowStatsButton, GameUIHideStatsButton = GameUIHideStatsButton, GameUIShowModifiersButton = GameUIShowModifiersButton, GameUIHideModifiersButton = GameUIHideModifiersButton, GameUIShowAbilityButton = GameUIShowAbilityButton, GameUIHideAbilityButton = GameUIHideAbilityButton, GameUIInfoboxImage = GameUIInfoboxImage, GameUIInfoboxDescription = GameUIInfoboxDescription, GameUIBlockInfobox = GameUIBlockInfobox, GameUISidebarInfobox = GameUISidebarInfobox, GameUIDialogMenu = GameUIDialogMenu, }