options.gui_script 882 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. local script_url = "/new#set_color"
  2. function init(self)
  3. msg.post(".", "acquire_input_focus")
  4. self.is_on = false
  5. self.io_text = gui.get_node("text")
  6. self.on_off = gui.get_node("io")
  7. self.oColor = gui.get_node("OutlineColor")
  8. self.fluid = gui.get_node("Fluid")
  9. end
  10. function on_input(self, action_id, action)
  11. if action_id == hash("touch") and action.pressed then
  12. if gui.pick_node(self.on_off, action.x, action.y) then
  13. msg.post(script_url, "outline_io")
  14. if self.is_on then
  15. gui.set_text(self.io_text,"Outline (Off)")
  16. self.is_on = not self.is_on
  17. else
  18. gui.set_text(self.io_text,"Outline (On)")
  19. self.is_on = not self.is_on
  20. end
  21. elseif gui.pick_node(self.oColor, action.x, action.y) then
  22. msg.post(script_url, "outline_color")
  23. elseif gui.pick_node(self.fluid, action.x, action.y) then
  24. msg.post(script_url, "fluid_color")
  25. end
  26. end
  27. end