using System.Runtime.InteropServices;

public static class ShakeHelp
{
    public delegate void lpFunMoveCallBack(int value);
    [DllImport("MYZ_USBDevice")]
    static extern void SendToDevice_Shake(byte cbSendData, float DurationTime);
    [DllImport("MYZ_USBDevice")]
    static extern bool CreateMYZConnect(bool bKeyEvent, lpFunMoveCallBack OnMoveFoward, lpFunMoveCallBack OnMoveRight);
    [DllImport("MYZ_USBDevice")]
    static extern void CloseMYZConnect();


    public static void CloseConnect()
    {
        CloseMYZConnect();
    }

    public static void SendShake(byte cbSendData, float DurationTime)
    {
        SendToDevice_Shake(cbSendData, DurationTime);
    }
    public static bool CreateConnect()
    {
        return CreateMYZConnect(false, MoveForwardCallback, MoveRightCallback);
    }
    // 用于测试的回调函数
    public static void MoveForwardCallback(int nMoveParameter)
    {
        UnityEngine.Debug.Log("前：" + nMoveParameter);
    }

    public static void MoveRightCallback(int nMoveParameter)
    {
        UnityEngine.Debug.Log("后：" + nMoveParameter);
    }
}