mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-30 07:22:37 -04:00
@@ -1699,6 +1699,8 @@ ensureHooks = function()
|
||||
OnlinePanel._tourClosed = e.text
|
||||
elseif e.scope == "room" and e.reason == "resume_incomplete" then
|
||||
OnlinePanel._roomLost = Strings("Connection lost, left the room.")
|
||||
elseif e.scope == "join" then
|
||||
OnlinePanel._joinError = e.text
|
||||
end
|
||||
end)
|
||||
client.on("tour_over", function(payload)
|
||||
@@ -2832,6 +2834,10 @@ function OnlinePanel.update(imp, dt)
|
||||
OnlinePanel.go(imp, "play")
|
||||
st.status, st.statusOk = notice, false
|
||||
end
|
||||
if OnlinePanel._joinError then
|
||||
st.status, st.statusOk = tostring(OnlinePanel._joinError), false
|
||||
OnlinePanel._joinError = nil
|
||||
end
|
||||
if st.pending and st.pending.done then
|
||||
if st.pending.error then
|
||||
st.status, st.statusOk = tostring(st.pending.error), false
|
||||
|
||||
@@ -56,8 +56,15 @@ function Room.draw(imp, x, y, w, availH, m)
|
||||
local btnH = math.max(m.btnH, Kit.tapMin())
|
||||
|
||||
if not room then
|
||||
local pending = st.pending
|
||||
local line = Strings("You are not in a room.")
|
||||
if pending and not pending.done then
|
||||
line = pending.code
|
||||
and Strings("Joining room %s...", tostring(pending.code))
|
||||
or Strings("Creating the room...")
|
||||
end
|
||||
local cy = y + Ui.header(imp, x, y, w, m, Strings("Room"))
|
||||
Kit.emptyBox(x, cy, w, rowH * 2, Strings("You are not in a room."))
|
||||
Kit.emptyBox(x, cy, w, rowH * 2, line)
|
||||
return (cy - y) + rowH * 2
|
||||
end
|
||||
|
||||
|
||||
@@ -129,12 +129,24 @@ local function remoteTrade(imp, x, y, w, m)
|
||||
cy = cy + Kit.textWrapped("small", OnlinePanel.remoteStageText(stage),
|
||||
x, cy, w, PAL.heading, 2) + tiny
|
||||
local mine, theirs = OnlinePanel.remoteRows(tr.remote)
|
||||
local peer = tr.peerName or Strings("The other trainer")
|
||||
Ui.label(Strings("Your POKeMON"), x, cy)
|
||||
cy = cy + Ui.label(Strings("%s's POKeMON", tostring(peer)),
|
||||
x + colW + gap, cy) + tiny
|
||||
local left = column(imp, x, cy, colW, m, "mine", mine, function(ref)
|
||||
OnlinePanel.remotePick(imp, ref)
|
||||
end)
|
||||
local right = column(imp, x + colW + gap, cy, colW, m, "theirs", theirs,
|
||||
function() end)
|
||||
cy = cy + math.max(left, right)
|
||||
local give, get
|
||||
for _, row in ipairs(mine) do if row.picked then give = row.label end end
|
||||
for _, row in ipairs(theirs) do if row.picked then get = row.label end end
|
||||
if give or get then
|
||||
cy = cy + Kit.textWrapped("small",
|
||||
Strings("You give %s, you get %s", give or "...", get or "..."),
|
||||
x, cy, w, PAL.muted, 2) + tiny
|
||||
end
|
||||
local third = math.floor((w - 2 * gap) / 3)
|
||||
LV().btn(imp, x, cy, third, rowH, "online-trade-yes", Strings("Confirm"),
|
||||
{ kind = "primary", font = "small", enabled = stage == "confirming",
|
||||
@@ -211,19 +223,21 @@ function TradeScreen.draw(imp, x, y, w, availH, m)
|
||||
return cy - y
|
||||
end
|
||||
|
||||
cy = cy + Ui.label(Strings("Trade with"), x, cy) + tiny
|
||||
local half = math.floor((w - gap) / 2)
|
||||
for i, mode in ipairs(MODES) do
|
||||
local id = mode.id
|
||||
if Kit.chip(x + (i - 1) * (half + gap), cy, half, rowH,
|
||||
Strings(mode.title), tr.mode == id, PAL.lineStrong,
|
||||
"online-trade-pick-" .. id) then
|
||||
LV().queueAction(imp, "online-trade-pick-" .. id, function()
|
||||
OnlinePanel.tradeMode(imp, id)
|
||||
end)
|
||||
if not tr.remote then
|
||||
cy = cy + Ui.label(Strings("Trade with"), x, cy) + tiny
|
||||
local half = math.floor((w - gap) / 2)
|
||||
for i, mode in ipairs(MODES) do
|
||||
local id = mode.id
|
||||
if Kit.chip(x + (i - 1) * (half + gap), cy, half, rowH,
|
||||
Strings(mode.title), tr.mode == id, PAL.lineStrong,
|
||||
"online-trade-pick-" .. id) then
|
||||
LV().queueAction(imp, "online-trade-pick-" .. id, function()
|
||||
OnlinePanel.tradeMode(imp, id)
|
||||
end)
|
||||
end
|
||||
end
|
||||
cy = cy + rowH + gap
|
||||
end
|
||||
cy = cy + rowH + gap
|
||||
|
||||
if tr.mode == "remote" then
|
||||
cy = cy + remoteTrade(imp, x, cy, w, m)
|
||||
|
||||
Reference in New Issue
Block a user