rave-local.lua
· 475 B · Lua
Raw
local net = require("@rave/net")
local state = require("@rave/state")
local ui = require("@rave/ui")
local ready = state.watch("lobby/ready")
ui.mount(ui.button({
text = ready:map(function(value)
return value and "Ready ✓" or "Ready up"
end),
color = ready:map(function(value)
return value and "#46BE6E" or "#465A78"
end),
align = "bottom-center",
on_press = function()
net.send_server("lobby/toggle-ready")
end,
}))
| 1 | local net = require("@rave/net") |
| 2 | local state = require("@rave/state") |
| 3 | local ui = require("@rave/ui") |
| 4 | |
| 5 | local ready = state.watch("lobby/ready") |
| 6 | |
| 7 | ui.mount(ui.button({ |
| 8 | text = ready:map(function(value) |
| 9 | return value and "Ready ✓" or "Ready up" |
| 10 | end), |
| 11 | |
| 12 | color = ready:map(function(value) |
| 13 | return value and "#46BE6E" or "#465A78" |
| 14 | end), |
| 15 | |
| 16 | align = "bottom-center", |
| 17 | |
| 18 | on_press = function() |
| 19 | net.send_server("lobby/toggle-ready") |
| 20 | end, |
| 21 | })) |