按钮精灵中常用函数记录,屏幕滑动,延时,随机等功能

来源:赵克立博客 分类: 其它 标签:--发布时间:2017-08-20 16:41:46最后更新:2017-08-20 16:41:46浏览:2686
版权声明:
本文为博主原创文章,转载请声明原文链接...谢谢。o_0。
更新时间:
2017-08-20 16:41:46
温馨提示:
学无止境,技术类文章有它的时效性,请留意文章更新时间,如发现内容有误请留言指出,防止别人"踩坑",我会及时更新文章

在写手机脚本时常用到的一些函数记录下

Import "ShanHai.lua"
//弹出一个信息
Function _msg(str)
    ShowMessage str
    Delay 500
End Function

//调试日志输出
Function _log(str)
    TracePrint str
End Function

//随机延时
Function suijiYanshi(a, b)
    Dim num=suijishu(a,b)
    Delay  num* 1000
End Function
Import "DateTime.lua"

//返回一个随机数
Function suijishu(a, b)
    Dim tmp
    tmp = Fix(Rnd() * (b - a + 1) + a)
    _log "随机数为:"&tmp
    suijishu=tmp
End Function


//模拟滑动
//参数1 1代表向上 2 代表向下 3向左  4向右  
//参数2 代表幅度  
//参数3 代表滑动几次
Function screenSliding(direction,range,times)
Dim sw,sh,i
sw = GetScreenX()
sh = GetScreenY()
i = suijishu(10, 30)
    If direction = 1 Then
        For times
            TouchDownEvent sw - i, sh/2 + i
            Delay 200
            TouchMoveEvent sw - i,sh  - range
            TouchUpEvent
        Next
    ElseIf direction=2 Then
        For times
            TouchDownEvent sw - i, sh/2 - i
            Delay 200
            TouchMoveEvent sw - i,sh  + range
            TouchUpEvent
        Next
    ElseIf direction=3 Then
        For times
            TouchDownEvent sw - i, sh/2 + i
            Delay 200
            TouchMoveEvent sw - range,sh/2  - i
            TouchUpEvent
        Next
    ElseIf direction=4 Then
        For times
            TouchDownEvent i, sh/2 - i
            Delay 200
            TouchMoveEvent  i+range,sh/2+i
            TouchUpEvent
        Next
    End If
End Function



微信号:kelicom QQ群:215861553 紧急求助须知
Win32/PHP/JS/Android/Python