DabDaddy6223

cara_int_startup_screen

Aug 4th, 2026 (edited)
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. local ui = require "cara_ui"
  2.  
  3. local StartupScreen = {}
  4. StartupScreen.selectedButton = 1
  5.  
  6. function StartupScreen.incrementSelectedButton()
  7.     if StartupScreen.selectedButton < 3 then
  8.         StartupScreen.selectedButton = StartupScreen.selectedButton + 1
  9.     end
  10. end
  11.  
  12. function StartupScreen.decrementSelectedButton()
  13.     if StartupScreen.selectedButton > 1 then
  14.         StartupScreen.selectedButton = StartupScreen.selectedButton - 1
  15.     end
  16. end
  17.  
  18. function StartupScreen.draw()
  19.     local panelRect = ui.layout.full()
  20.     local contentArea = ui.widgets.panel(panelRect, "CARA Interaction System", "center")
  21.  
  22.     local menu = ui.layout.verticalStack(contentArea, 20, 3, 3, 1)
  23.     ui.widgets.button(menu[1], "Resources", StartupScreen.selectedButton == 1)
  24.     ui.widgets.button(menu[2], "Maintainence", StartupScreen.selectedButton == 2)
  25.     ui.widgets.button(menu[3], "Shutdown", StartupScreen.selectedButton == 3)
  26. end
  27.  
  28. function StartupScreen.key(key)
  29.     if key == keys.up then
  30.         StartupScreen.decrementSelectedButton()
  31.         ui.invalidate()
  32.     elseif key == keys.down then
  33.         StartupScreen.incrementSelectedButton()
  34.         ui.invalidate()
  35.     elseif key == keys.enter then
  36.         if StartupScreen.selectedButton == 1 then
  37.         elseif StartupScreen.selectedButton == 2 then
  38.             return {
  39.                 type = "quit"
  40.             }
  41.         elseif StartupScreen.selectedButton == 3 then
  42.             return {
  43.                 type = "close"
  44.             }
  45.         end
  46.     end
  47.  
  48.     return nil
  49. end
  50.  
  51. function StartupScreen.tick()
  52. end
  53.  
  54. return StartupScreen
Advertisement
Add Comment
Please, Sign In to add comment