GE Lua Documentation

Press F to search!

onScenarioFlashMessage

Definition


-- @/lua/ge/extensions/ui/gameplayAppContainers.lua:190

-- Automatic flash message visibility control
local function onScenarioFlashMessage(data)
  -- Show flashMessage app when flash messages are triggered
  if data and #data > 0 then
    showApp('gameplayApps', 'flashMessage')
  end

  -- Detect scenario countdown sequences and control countdown app from backend
  local isCountdown = false
  local goTtl = nil
  if type(data) == 'table' then
    for i = 1, #data do
      local head = data[i] and data[i][1]
      if type(head) == 'number' or head == 'ui.scenarios.go' then
        isCountdown = true
      end
      if head == 'ui.scenarios.go' then
        goTtl = (data[i][2] or 1)
      end
    end
  end

  if isCountdown then
    showApp('gameplayApps', 'countdown')
    if goTtl then
      M._countdownHideTimer = goTtl
    end
  end
end

Callers