controls.gui_script 677 B

1234567891011121314151617
  1. function init(self)
  2. msg.post(".", "acquire_input_focus")
  3. end
  4. function on_input(self, action_id, action)
  5. if action.pressed then
  6. if gui.pick_node(gui.get_node("add_10000"), action.x or 0, action.y or 0) then
  7. msg.post("example", "add", { amount = 10000 })
  8. elseif gui.pick_node(gui.get_node("add_1000"), action.x or 0, action.y or 0) then
  9. msg.post("example", "add", { amount = 1000 })
  10. elseif gui.pick_node(gui.get_node("add_100"), action.x or 0, action.y or 0) then
  11. msg.post("example", "add", { amount = 100 })
  12. elseif gui.pick_node(gui.get_node("remove_100"), action.x or 0, action.y or 0) then
  13. msg.post("example", "remove", { amount = 100 })
  14. end
  15. end
  16. end