main = require "main" world = require "world" color = require "color" bp = require "broadphase" ui = require "ui" import World from world mod = ... mod.node = am.group! mod.node\append(am.sprite("data/join.png")) default_text = "..." mod.load = () -> mod.loaded = true print("Loading join_party_menu") main.root("screen")\append(mod.node) mod.buttons = ui.create_join_input(mod.node) mod.node\append(am.translate(0,-135)^ am.text(default_text, color.fg, "center","top")\tag("join_id")) touch_indicator = am.group! touch_cursor = am.sprite("data/cursor.png",vec4(1,1,1,1),"left","top") backspace = ui.create_any_button(mod.node,2,2,150,-25) backspace.node\append(am.translate(164,-41)^ am.scale(2)^ am.text("<-", color.fg, "left","top")) touch_loc = am.translate(0,0)^ touch_cursor touch_indicator\append(touch_loc) mod.node\append(touch_indicator) print("char selector:",char_selector) mod.node\action(coroutine.create(() -> while true if #main.win\active_touches! > 0 touch = main.win\touch_position(1) touch_cursor.color = vec4(1,1,1,1) touch_loc.x = touch.x touch_loc.y = touch.y col_but = bp.check(touch.x, touch.y + 40) n = mod.node("join_id") if #col_but > 0 touch_cursor.color = vec4(0.5,0.5,0.5,0.5) if main.win\touch_began(1) for _, button in pairs(mod.buttons) if col_but[1] == button if n.text == default_text n.text = "" print("Found pressed button",button) n.text = n.text .. button.text if col_but[1] == backspace n.text = n.text\sub(1,string.len(n.text)-1) if #n.text > 5 print("Time to join!") lobby = require("lobby_menu") table.insert(main.action_queue,{lobby.load,{n.text}}) mod.unload! coroutine.yield! )) mod.unload = () -> main.root("screen")\remove(mod.node) for _, button in pairs(mod.buttons) bp.remove(button) mod