美文网首页
【汉化】Swipe Input

【汉化】Swipe Input

作者: 沧笙 | 来源:发表于2017-06-24 16:06 被阅读668次

    Swipe Input

    Swipe Input

    This is a Plugin that allows the developer to check for swipe input on the
    touch screen or on a mouse.

    这个插件可以让开发者检测玩家的滑动信息,例如触屏滑动或者鼠标滑动

    How to Use

    The main purpose of this Plugin is to help make Timed Attacks usable on
    mobile devices. However, this Plugin can allow for other functions.

    这个插件的命令是为了协助即时战斗系统,当然也附带其他很多功能

    In order to use, one must use one of the following code:

    你需要使用下面的命令来激活

    SwipeInput.isTriggered(direction)
    SwipeInput.isPressed(direction)
    

    These are the two main functions that can be used in the Script section
    of a conditional branch, or through some other boolean-releated code.

    这段命令可以检测玩家的滑动方向并触发

    SwipeInput.isTriggered

    The first function is:

    SwipeInput.isTriggered(direction)
    

    This function only returns true on the exact frame a swipe is completed.
    This should be primailty used for code/events that should only occur
    once per swipe.

    第一个命令可以检测某方向滑动是否完成,通常用来执行滑动完的事件等

    It needs at least one Parameter, which is the direction of the swipe that
    is being checked:

    他需要一个方向作为参数

    SwipeInput.isTriggered(‘up’)
    SwipeInput.isTriggered(‘right’)
    SwipeInput.isTriggered(‘left’)
    SwipeInput.isTriggered(‘down’)
    

    However, there are two other optional Parameters:

    当然你还有其他额外的参数可以选择

    SwipeInput.isTriggered(‘direction’, MinimumDistance, MaximumTime)
    

    Minimum Distance is the minimum amount of distance the swipe needs to be
    to be registered as a swipe.

    滑动最小距离

    Maximum Time is the maximum amount of time the swipe can go on for before
    no longer being registered as a swipe command.

    滑动最长时间

    The defaults for both Minimum Distance and Maximum Time can be customized
    in the Parameters of this plugin.

    你可以在插件参数里面设置默认值,或使用下面代码

    Examples:

    SwipeInput.isTriggered(‘up’, 30, 9999)
    SwipeInput.isTriggered(‘down’, 50)
    SwipeInput.isTriggered(‘left’, 100, 500)
    

    SwipeInput.isPressed

    This is the same as SwipeInput.isTriggered, only this will constantly
    return true as long as a swipe has been completed and the touch is still
    being held down.

    这个和上个命令类似,但是将会监测滑动过程

    SwipeInput.isPressed(‘up’)
    SwipeInput.isPressed(‘right’)
    SwipeInput.isPressed(‘left’)
    SwipeInput.isPressed(‘down’)
    

    The first mandatory Parameter is still the same and requires a direction.

    这段命令也必须要存在一个方向作为参数

    SwipeInput.isTriggered(‘direction’, MinimumDistance, MinimumTime)
    

    However, the third Parameter has been changed. As can be seen here, it has
    been switched to Minimum Time. This refers the minimum amount of time a
    touch input has to be pressed before it can start to be registered as a
    swipe input.

    这里也有两个可选参数,最小距离以及最少时间,最少时间指的是滑动持续的最小时间

    Examples:

    SwipeInput.isPressed(‘right’, 50, 0)
    SwipeInput.isPressed(‘left’, 100)
    SwipeInput.isPressed(‘up’, 30, 10)
    

    相关文章

      网友评论

          本文标题:【汉化】Swipe Input

          本文链接:https://www.haomeiwen.com/subject/vmekcxtx.html