Control.gd 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. extends Control
  2. func _ready():
  3. pass
  4. func _process(delta):
  5. fade_btns(delta)
  6. var iTime=0.0
  7. var last_mtime=0.0
  8. var mouse_in=false
  9. func fade_btns(delta):
  10. iTime+=delta
  11. if(mouse_in):last_mtime=iTime
  12. var alph=smoothstep(4,0,iTime-last_mtime)
  13. if(get_node("Control").visible):alph=1
  14. get_node("options").get("custom_styles/hover").bg_color.a=alph
  15. get_node("options").get("custom_styles/pressed").bg_color.a=alph
  16. get_node("options").get("custom_styles/focus").bg_color.a=alph
  17. get_node("options").get("custom_styles/disabled").bg_color.a=alph
  18. get_node("options").get("custom_styles/normal").bg_color.a=alph
  19. get_node("options").set("custom_colors/font_color_disabled",Color(1,1,1,alph))
  20. get_node("options").set("custom_colors/font_color",Color(1,1,1,alph))
  21. get_node("options").set("custom_colors/font_color_hover",Color(1,1,1,alph))
  22. get_node("options").set("custom_colors/font_color_pressed",Color(1,1,1,alph))
  23. func _on_options_pressed():
  24. get_node("Control").visible=!get_node("Control").visible
  25. func _on_Control_mouse_entered():
  26. mouse_in=true
  27. func _on_Control_mouse_exited():
  28. mouse_in=false
  29. func _on_CheckBox_pressed():
  30. get_node("../").opt_portals=!get_node("../").opt_portals
  31. if(!get_node("../").opt_portals):
  32. get_node("../p1").set("render_target_update_mode",Viewport.UPDATE_WHEN_VISIBLE)
  33. get_node("../p2").set("render_target_update_mode",Viewport.UPDATE_WHEN_VISIBLE)
  34. get_node("../p3").set("render_target_update_mode",Viewport.UPDATE_WHEN_VISIBLE)
  35. get_node("../p4").set("render_target_update_mode",Viewport.UPDATE_WHEN_VISIBLE)
  36. get_node("../p5").set("render_target_update_mode",Viewport.UPDATE_WHEN_VISIBLE)