Skip to content

Commit 6fc363a

Browse files
committed
Initial commit.
0 parents  commit 6fc363a

24 files changed

+463
-0
lines changed

CandyCoded.HapticFeedback.asmdef

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "CandyCoded.HapticFeedback",
3+
"references": [
4+
"CandyCoded.HapticFeedback.Android",
5+
"CandyCoded.HapticFeedback.iOS"
6+
],
7+
"includePlatforms": [
8+
"Android",
9+
"Editor",
10+
"iOS"
11+
],
12+
"excludePlatforms": [],
13+
"allowUnsafeCode": false,
14+
"overrideReferences": false,
15+
"precompiledReferences": [],
16+
"autoReferenced": true,
17+
"defineConstraints": [],
18+
"versionDefines": [],
19+
"noEngineReferences": false
20+
}

CandyCoded.HapticFeedback.asmdef.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins/Android.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "CandyCoded.HapticFeedback.Android",
3+
"references": [],
4+
"includePlatforms": [
5+
"Android",
6+
"Editor"
7+
],
8+
"excludePlatforms": [],
9+
"allowUnsafeCode": false,
10+
"overrideReferences": false,
11+
"precompiledReferences": [],
12+
"autoReferenced": true,
13+
"defineConstraints": [],
14+
"versionDefines": [],
15+
"noEngineReferences": false
16+
}

Plugins/Android/CandyCoded.HapticFeedback.Android.asmdef.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins/Android/HapticFeedback.cs

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Copyright (c) Scott Doxey. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.
2+
3+
using UnityEngine;
4+
5+
namespace CandyCoded.HapticFeedback.Android
6+
{
7+
8+
public enum HapticFeedbackConstants
9+
{
10+
11+
LONG_PRESS = 0,
12+
13+
VIRTUAL_KEY = 1,
14+
15+
KEYBOARD_TAP = 3,
16+
17+
CLOCK_TICK = 4,
18+
19+
CALENDAR_DATE = 5,
20+
21+
CONTEXT_CLICK = 6,
22+
23+
KEYBOARD_PRESS = KEYBOARD_TAP,
24+
25+
KEYBOARD_RELEASE = 7,
26+
27+
VIRTUAL_KEY_RELEASE = 8,
28+
29+
TEXT_HANDLE_MOVE = 9,
30+
31+
ENTRY_BUMP = 10,
32+
33+
DRAG_CROSSING = 11,
34+
35+
GESTURE_START = 12,
36+
37+
GESTURE_END = 13,
38+
39+
EDGE_SQUEEZE = 14,
40+
41+
EDGE_RELEASE = 15,
42+
43+
CONFIRM = 16,
44+
45+
REJECT = 17
46+
47+
}
48+
49+
public static class HapticFeedback
50+
{
51+
52+
private static AndroidJavaObject _androidPlugin;
53+
54+
private static AndroidJavaObject androidPlugin
55+
{
56+
get
57+
{
58+
if (_androidPlugin != null)
59+
{
60+
return _androidPlugin;
61+
}
62+
63+
var javaUnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
64+
65+
var currentActivity = javaUnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
66+
67+
_androidPlugin =
68+
new AndroidJavaObject("com.candycoded.hapticfeedbacklibrary.AndroidPlugin", currentActivity);
69+
70+
return _androidPlugin;
71+
}
72+
}
73+
74+
public static void PerformHapticFeedback(HapticFeedbackConstants hapticFeedbackConstants)
75+
{
76+
androidPlugin.Call("PerformHapticFeedback", (int)hapticFeedbackConstants);
77+
}
78+
79+
}
80+
81+
}

Plugins/Android/HapticFeedback.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.85 KB
Binary file not shown.

Plugins/Android/hapticfeedbacklibrary-release.aar.meta

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)