41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Roy;
|
|
using UnityEngine;
|
|
|
|
public class AndroidVibration : SingletonMonoBehaviour<AndroidVibration>
|
|
{
|
|
AndroidJavaClass VibratorTool = null;
|
|
AndroidJavaClass ToastTool = null;
|
|
void Awake()
|
|
{
|
|
VibratorTool = new AndroidJavaClass("com.tools.common.VibratorTool");
|
|
ToastTool = new AndroidJavaClass("com.tools.common.ToastTool");
|
|
ToastTool.CallStatic("SetShowToast", false);//关闭测试toast
|
|
//smsDialog.CallStatic<AndroidJavaObject>("getInstance").Call("init", getContext());
|
|
}
|
|
|
|
public void CVibrate(int milliseconds)
|
|
{
|
|
// Debug.LogError("---- 调用震动");
|
|
VibratorTool.CallStatic("CVibrate", milliseconds);
|
|
}
|
|
|
|
public void CVibrateShort()
|
|
{
|
|
// Debug.LogError("---- 调用震动 -- 短");
|
|
VibratorTool.CallStatic("CVibrateShort");
|
|
}
|
|
|
|
public void CVibrateLong()
|
|
{
|
|
// Debug.LogError("---- 调用震动 -- 长");
|
|
VibratorTool.CallStatic("CVibrateLong");
|
|
}
|
|
|
|
public void CCannelVibrate()
|
|
{
|
|
// Debug.LogError("---- 调用震动 -- 取消");
|
|
VibratorTool.CallStatic("CCancelVibrate");
|
|
}
|
|
} |