提交
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user