mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
update: packages,lua,lobby (3 files)
This commit is contained in:
70
packages/arcade_lobby/scripts/game_browser.lua
Normal file
70
packages/arcade_lobby/scripts/game_browser.lua
Normal file
@@ -0,0 +1,70 @@
|
||||
-- arcade_lobby: Game Browser Component
|
||||
-- Browse available games and tournaments
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.render(context)
|
||||
local games = context.games or {
|
||||
{ id = 1, name = "Space Shooter", players = 12, difficulty = "Medium", image = "space.png" },
|
||||
{ id = 2, name = "Puzzle Quest", players = 5, difficulty = "Easy", image = "puzzle.png" },
|
||||
{ id = 3, name = "Battle Arena", players = 24, difficulty = "Hard", image = "battle.png" },
|
||||
{ id = 4, name = "Racing Circuit", players = 8, difficulty = "Medium", image = "racing.png" }
|
||||
}
|
||||
|
||||
local gameCards = {}
|
||||
for _, game in ipairs(games) do
|
||||
table.insert(gameCards, {
|
||||
type = "div",
|
||||
className = "card arcade_lobby_game_card",
|
||||
children = {
|
||||
{
|
||||
type = "h3",
|
||||
className = "arcade_lobby_game_title",
|
||||
text = game.name
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "arcade_lobby_game_info",
|
||||
children = {
|
||||
{
|
||||
type = "span",
|
||||
className = "arcade_lobby_players",
|
||||
text = "👥 " .. game.players .. " online"
|
||||
},
|
||||
{
|
||||
type = "span",
|
||||
className = "arcade_lobby_difficulty",
|
||||
text = "⭐ " .. game.difficulty
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "button",
|
||||
className = "button arcade_lobby_button",
|
||||
text = "Play Now",
|
||||
action = "arcade.play",
|
||||
data = { gameId = game.id }
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
type = "div",
|
||||
className = "arcade_lobby_browser",
|
||||
children = {
|
||||
{
|
||||
type = "h2",
|
||||
className = "arcade_lobby_heading",
|
||||
text = "🎮 Arcade Games"
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "arcade_lobby_game_grid",
|
||||
children = gameCards
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
99
packages/arcade_lobby/scripts/party_queue.lua
Normal file
99
packages/arcade_lobby/scripts/party_queue.lua
Normal file
@@ -0,0 +1,99 @@
|
||||
-- arcade_lobby: Party Queue Component
|
||||
-- Create and join party queues for multiplayer games
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.render(context)
|
||||
local party = context.party or {
|
||||
members = {},
|
||||
maxSize = 4,
|
||||
status = "open"
|
||||
}
|
||||
|
||||
local memberList = {}
|
||||
for i, member in ipairs(party.members) do
|
||||
table.insert(memberList, {
|
||||
type = "div",
|
||||
className = "arcade_lobby_party_member",
|
||||
children = {
|
||||
{
|
||||
type = "span",
|
||||
text = "👤 " .. member
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- Add empty slots
|
||||
for i = #party.members + 1, party.maxSize do
|
||||
table.insert(memberList, {
|
||||
type = "div",
|
||||
className = "arcade_lobby_party_slot_empty",
|
||||
children = {
|
||||
{
|
||||
type = "span",
|
||||
text = "⭕ Empty slot"
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
type = "div",
|
||||
className = "arcade_lobby_party",
|
||||
children = {
|
||||
{
|
||||
type = "div",
|
||||
className = "card",
|
||||
children = {
|
||||
{
|
||||
type = "h2",
|
||||
className = "arcade_lobby_heading",
|
||||
text = "Party Queue"
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "arcade_lobby_party_info",
|
||||
children = {
|
||||
{
|
||||
type = "span",
|
||||
text = #party.members .. " / " .. party.maxSize .. " players"
|
||||
},
|
||||
{
|
||||
type = "span",
|
||||
className = "arcade_lobby_status",
|
||||
text = "Status: " .. party.status
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "arcade_lobby_party_members",
|
||||
children = memberList
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "arcade_lobby_actions",
|
||||
children = {
|
||||
{
|
||||
type = "button",
|
||||
className = "button arcade_lobby_button",
|
||||
text = "Invite Friends",
|
||||
action = "arcade.party.invite"
|
||||
},
|
||||
{
|
||||
type = "button",
|
||||
className = "button arcade_lobby_button",
|
||||
text = "Start Queue",
|
||||
action = "arcade.party.queue",
|
||||
disabled = #party.members < 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
96
packages/arcade_lobby/scripts/tournament_list.lua
Normal file
96
packages/arcade_lobby/scripts/tournament_list.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
-- arcade_lobby: Tournament List Component
|
||||
-- View and join active tournaments
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.render(context)
|
||||
local user = context.user or {}
|
||||
local canCreateTournament = user.level and user.level >= 3
|
||||
|
||||
local tournaments = context.tournaments or {
|
||||
{ id = 1, name = "Weekend Warriors", game = "Space Shooter", participants = 16, maxParticipants = 32, prize = "100 tokens", status = "open" },
|
||||
{ id = 2, name = "Speed Run Challenge", game = "Puzzle Quest", participants = 8, maxParticipants = 16, prize = "50 tokens", status = "open" },
|
||||
{ id = 3, name = "Battle Royale", game = "Battle Arena", participants = 32, maxParticipants = 32, prize = "200 tokens", status = "in_progress" },
|
||||
{ id = 4, name = "Racing League", game = "Racing Circuit", participants = 12, maxParticipants = 24, prize = "75 tokens", status = "open" }
|
||||
}
|
||||
|
||||
local tournamentCards = {}
|
||||
for _, tournament in ipairs(tournaments) do
|
||||
local statusClass = "arcade_lobby_status_" .. tournament.status
|
||||
local canJoin = tournament.status == "open" and tournament.participants < tournament.maxParticipants
|
||||
|
||||
table.insert(tournamentCards, {
|
||||
type = "div",
|
||||
className = "card arcade_lobby_tournament",
|
||||
children = {
|
||||
{
|
||||
type = "h3",
|
||||
className = "arcade_lobby_tournament_name",
|
||||
text = "🏆 " .. tournament.name
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "arcade_lobby_tournament_info",
|
||||
children = {
|
||||
{
|
||||
type = "span",
|
||||
text = "Game: " .. tournament.game
|
||||
},
|
||||
{
|
||||
type = "span",
|
||||
text = "Players: " .. tournament.participants .. "/" .. tournament.maxParticipants
|
||||
},
|
||||
{
|
||||
type = "span",
|
||||
text = "Prize: " .. tournament.prize
|
||||
},
|
||||
{
|
||||
type = "span",
|
||||
className = statusClass,
|
||||
text = "Status: " .. tournament.status
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "button",
|
||||
className = "button arcade_lobby_button",
|
||||
text = canJoin and "Join Tournament" or "View Details",
|
||||
action = canJoin and "arcade.tournament.join" or "arcade.tournament.view",
|
||||
data = { tournamentId = tournament.id },
|
||||
disabled = not canJoin and tournament.status ~= "in_progress"
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local children = {
|
||||
{
|
||||
type = "h2",
|
||||
className = "arcade_lobby_heading",
|
||||
text = "Active Tournaments"
|
||||
}
|
||||
}
|
||||
|
||||
if canCreateTournament then
|
||||
table.insert(children, {
|
||||
type = "button",
|
||||
className = "button arcade_lobby_button_primary",
|
||||
text = "+ Create Tournament",
|
||||
action = "arcade.tournament.create"
|
||||
})
|
||||
end
|
||||
|
||||
table.insert(children, {
|
||||
type = "div",
|
||||
className = "arcade_lobby_tournament_list",
|
||||
children = tournamentCards
|
||||
})
|
||||
|
||||
return {
|
||||
type = "div",
|
||||
className = "arcade_lobby_tournaments",
|
||||
children = children
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user