if menu and menu.currentMenu then drawText( "current: " .. tostring(menu.currentMenu[1]) .. " parent: " .. tostring(menu.currentMenu[2]), 20, 20, 1, 1, -- scaleX, scaleY 255,255,255,255 -- RGBA 纯白不透明 ) end printConsole("launchFight(): not enough P2 characters, skipping execution") -------------------------------------------------- -- UI 长按加速 + 手柄统一输入(全局工具) -------------------------------------------------- -- ===== 可调参数 ===== START_DELAY = 12 -- 起始速度(帧) END_DELAY = 2 -- 最快速度(帧) ACCEL_TIME = 100 -- 加速到最快所需时间(帧) -------------------------------------------------- -- 任意 1~8 号手柄输入检测 -------------------------------------------------- function anyJoystickKey(key) for i = 0, 7 do if getJoystickKey(i) == key then return true end end return false end -------------------------------------------------- -- 长按递增加速执行器(第一帧立即触发) -------------------------------------------------- options = options or {} options.hold = options.hold or {} options.timer = options.timer or {} function acceleratedAdjust(id, pressed, callback) options.hold[id] = options.hold[id] or 0 options.timer[id] = options.timer[id] or 0 if pressed then options.hold[id] = options.hold[id] + 1 -- 第一帧立即响应 if options.hold[id] == 1 then callback() return end local progress = options.hold[id] / ACCEL_TIME if progress > 1 then progress = 1 end local delay = math.floor( START_DELAY - (START_DELAY - END_DELAY) * progress ) options.timer[id] = options.timer[id] + 1 if options.timer[id] >= delay then options.timer[id] = 0 callback() end else options.hold[id] = 0 options.timer[id] = 0 end end -------------------------------------------------- -- 固定速度长按执行器(第一帧立即触发) -------------------------------------------------- LIST_REPEAT_DELAY = 4 options.listRepeat = options.listRepeat or {} function repeatAdjust(id, pressed, callback) if not pressed then options.listRepeat[id] = LIST_REPEAT_DELAY return end options.listRepeat[id] = options.listRepeat[id] or LIST_REPEAT_DELAY -- 第一帧必触发 if options.listRepeat[id] >= LIST_REPEAT_DELAY then callback() options.listRepeat[id] = 0 else options.listRepeat[id] = options.listRepeat[id] + 1 end end