from uexplore_interfaces import Event from uexplore_interfaces import Joypad from uexplore_interfaces import Device from uexplore_interfaces import Color from uexplore_interfaces import Utils _E6_88_91_E7_9A_84_E5_8F_98_E9_87_8F = 0 R = 0 G = 0 B = 0 def on_start_event(): pass Event.register_start(on_start_event) def on_joystick_keys_click_event(): global R,G,B Device.show_light_rgb([], Color.create_color_rgb(Utils.parseToNumber(R),Utils.parseToNumber(G),Utils.parseToNumber(B))) Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.X]) def on_joystick_keys_click_event(): global R,B,G Device.show_light_rgb([], Color.create_color_rgb(Utils.parseToNumber(R),Utils.parseToNumber(G),Utils.parseToNumber(B))) Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.Y]) def on_joystick_keys_click_event(): Device.turn_off_lights() Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.B]) def on_joystick_keys_click_event(): Device.show_light_animations([]) Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.A]) def on_joystick_keys_click_event(): Device.show_light_effect(Color.create_color_hsv(0,0,100),Device.Light.Effect.TURN_ON) Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.L1]) def on_joystick_keys_click_event(): Device.show_light_effect(Color.create_color_hsv(0,7,100),Device.Light.Effect.TURN_OFF) Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.L2]) def on_joystick_keys_click_event(): Device.show_light_effect(Color.create_color_hsv(16,77,85),Device.Light.Effect.FLASHING) Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.R2]) def on_joystick_keys_click_event(): Device.show_light_effect(Color.create_color_hsv(16,77,85),Device.Light.Effect.BREATHING) Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.R1]) def on_joystick_keys_click_event(): global R value = Utils.toNumber(R) R = value + 10 Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.UP]) def on_joystick_keys_click_event(): global R value = Utils.toNumber(R) R = value + -10 Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.DOWN]) G = value + Joypad.get_joypad_coordinate(Joypad.JoystickCoordinate.LY) pass value = Utils.toNumber(G) B = value + Joypad.get_joypad_coordinate(Joypad.JoystickCoordinate.RY) pass value = Utils.toNumber(B) def on_joystick_keys_click_event(): global R,G,B R = '0' G = '0' B = '0' Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.LEFT]) def on_joystick_keys_click_event(): global R,G,B R = '255' G = '255' B = '255' Event.register_joypad_button(on_joystick_keys_click_event,[Joypad.Button.RIGHT])
标签:控制,Joypad,ugot,灯光,keys,event,joypad,joystick,click From: https://www.cnblogs.com/flyingsir/p/17909959.html