Skip to content

Commit c730c1f

Browse files
committed
fix: Rename slide input to touch input:
1 parent 82a9de4 commit c730c1f

File tree

8 files changed

+25
-25
lines changed

8 files changed

+25
-25
lines changed

Assets/JCSUnity/Scripts/GameObject/2D/2DCamera/JCS_2DCamera.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ protected virtual void FixedUpdate()
204204
// to here...
205205
mWheelDegree = Input.GetAxis("Mouse ScrollWheel");
206206
#elif (UNITY_ANDROID || UNITY_IPHIONE || UNITY_IOS)
207-
var slideInput = JCS_SlideInput.instance;
207+
var slideInput = JCS_TouchInput.instance;
208208
mWheelDegree = slideInput.TouchDistanceDelta;
209209
#endif
210210
ZoomCamera(mWheelDegree);

Assets/JCSUnity/Scripts/GameObject/2D/2DCamera/JCS_2DSlideScreenCamera.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -357,15 +357,15 @@ private bool CalculatePage(JCS_2D8Direction direction)
357357
/// </summary>
358358
private void DoMobileSwipe()
359359
{
360-
var si = JCS_SlideInput.instance;
361-
if (si == null)
360+
var ti = JCS_TouchInput.instance;
361+
if (ti == null)
362362
return;
363363

364364
bool enableSlidePanel = true;
365365

366-
if (mInteractableSwipe && si.Touched)
366+
if (mInteractableSwipe && ti.Touched)
367367
{
368-
Vector3 deltaPos = si.DeltaPos;
368+
Vector3 deltaPos = ti.DeltaPos;
369369

370370
bool cancelX = false;
371371
bool cancelY = false;
@@ -402,19 +402,19 @@ private void DoMobileSwipe()
402402

403403
if (mInteractableSwipe && JCS_Input.GetMouseButtonUp(JCS_MouseButton.LEFT))
404404
{
405-
Vector3 posDiff = si.DragDistance;
405+
Vector3 posDiff = ti.DragDistance;
406406
JCS_ScreenSizef vs = JCS_ScreenSettings.instance.VisibleScreenSize();
407407
var target_vs = new JCS_ScreenSizef(vs.width * mSwipeArea.x, vs.height * mSwipeArea.y);
408408

409-
var speedX = si.DragDistance.x / si.TouchTime;
410-
var speedY = si.DragDistance.y / si.TouchTime;
409+
var speedX = ti.DragDistance.x / ti.TouchTime;
410+
var speedY = ti.DragDistance.y / ti.TouchTime;
411411

412412
bool reachedX = posDiff.x > target_vs.width; // distance
413413
bool speedExceedX = speedX > mSwipeSpeedX; // speed
414414

415415
if (!mFreezeX && (reachedX || speedExceedX))
416416
{
417-
if (JCS_Mathf.IsPositive(si.DragDisplacement.x))
417+
if (JCS_Mathf.IsPositive(ti.DragDisplacement.x))
418418
SwitchScene(JCS_2D4Direction.LEFT);
419419
else
420420
SwitchScene(JCS_2D4Direction.RIGHT);
@@ -428,7 +428,7 @@ private void DoMobileSwipe()
428428

429429
if (!mFreezeY && (reachedY || speedExceedY))
430430
{
431-
if (JCS_Mathf.IsPositive(si.DragDisplacement.y))
431+
if (JCS_Mathf.IsPositive(ti.DragDisplacement.y))
432432
SwitchScene(JCS_2D4Direction.BOTTOM);
433433
else
434434
SwitchScene(JCS_2D4Direction.TOP);

Assets/JCSUnity/Scripts/GameObject/3D/JCS_3DCamera.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ protected override void LateUpdate()
227227
// to here...
228228
mWheelDegree = Input.GetAxis("Mouse ScrollWheel");
229229
#elif (UNITY_ANDROID || UNITY_IPHIONE || UNITY_IOS)
230-
var slideInput = JCS_SlideInput.instance;
230+
var slideInput = JCS_TouchInput.instance;
231231
mWheelDegree = slideInput.TouchDistanceDelta;
232232
#endif
233233
ZoomCamera(mWheelDegree);

Assets/JCSUnity/Scripts/Input/JCS_MobileMouseEvent.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ private void Handle_EnterExit()
146146
private void Handle_UpOver()
147147
{
148148
var im = JCS_InputManager.instance;
149-
var slideInput = JCS_SlideInput.instance;
149+
var ti = JCS_TouchInput.instance;
150150

151-
if (slideInput == null)
151+
if (ti == null)
152152
return;
153153

154154
foreach (RaycastHit hit in mHits)
@@ -163,7 +163,7 @@ private void Handle_UpOver()
163163

164164
if (im.Support_OnMouseUp)
165165
{
166-
if (mTouchedLastFrame && !slideInput.Touched)
166+
if (mTouchedLastFrame && !ti.Touched)
167167
_SendMessage(obj, "OnMouseUp");
168168
}
169169

@@ -179,9 +179,9 @@ private void Handle_UpOver()
179179
private void Handle_DownDrag()
180180
{
181181
var im = JCS_InputManager.instance;
182-
var slideInput = JCS_SlideInput.instance;
182+
var ti = JCS_TouchInput.instance;
183183

184-
if (!slideInput.Touched)
184+
if (!ti.Touched)
185185
{
186186
this.mTouchedLastFrame = false;
187187
return;
@@ -200,7 +200,7 @@ private void Handle_DownDrag()
200200

201201
GameObject obj = hit.transform.gameObject;
202202

203-
if (slideInput.Touched)
203+
if (ti.Touched)
204204
{
205205
if (im.Support_OnMouseDown)
206206
{
@@ -210,7 +210,7 @@ private void Handle_DownDrag()
210210

211211
if (im.Support_OnMouseDrag)
212212
{
213-
if (slideInput.DeltaPos != Vector2.zero)
213+
if (ti.DeltaPos != Vector2.zero)
214214
_SendMessage(obj, "OnMouseDrag");
215215
}
216216
}

Assets/JCSUnity/Scripts/Input/JCS_SlideInput.cs renamed to Assets/JCSUnity/Scripts/Input/JCS_TouchInput.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* $File: JCS_SlideInput.cs $
2+
* $File: JCS_TouchInput.cs $
33
* $Date: $
44
* $Revision: $
55
* $Creator: Jen-Chieh Shen $
@@ -14,13 +14,13 @@ namespace JCSUnity
1414
/// <summary>
1515
/// Use this to receive the slide input from the device buffer.
1616
/// </summary>
17-
public class JCS_SlideInput : JCS_Instance<JCS_SlideInput>
17+
public class JCS_TouchInput : JCS_Instance<JCS_TouchInput>
1818
{
1919
/* Variables */
2020

2121
private Vector2 mDragStartPosition = Vector2.zero;
2222

23-
[Separator("Check Variables (JCS_SlideInput)")]
23+
[Separator("Check Variables (JCS_TouchInput)")]
2424

2525
#if (UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL)
2626
[Tooltip("Previous position.")]
@@ -82,15 +82,15 @@ public class JCS_SlideInput : JCS_Instance<JCS_SlideInput>
8282
#endif
8383

8484
#if (UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL)
85-
[Separator("Runtime Variables (JCS_SlideInput)")]
85+
[Separator("Runtime Variables (JCS_TouchInput)")]
8686

8787
[Tooltip("Mouse event type of identify the touch event.")]
8888
[SerializeField]
8989
private JCS_MouseButton mMouseType = JCS_MouseButton.LEFT;
9090
#endif
9191

9292
#if (UNITY_ANDROID || UNITY_IPHIONE || UNITY_IOS)
93-
[Separator("Runtime Variables (JCS_SlideInput)")]
93+
[Separator("Runtime Variables (JCS_TouchInput)")]
9494

9595
[Tooltip("Touch count that will detect as touched.")]
9696
[SerializeField]
File renamed without changes.

docs/Manual/Execution Order List.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ in order to have JCSUnity work correctly in Unity Engine.
1919
- `JCS_PlayerManager`
2020
- `JCS_Player`
2121
- `JCS_2DCamera`
22-
- `JCS_SlideInput`
22+
- `JCS_TouchInput`
2323
- `JCS_MobileMouseEvent`
2424
- `JCS_2DPlatform`
2525
- `JCS_Logo`

docs/ScriptReference/Input/JCS_SlideInput.md renamed to docs/ScriptReference/Input/JCS_TouchInput.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# JCS_SlideInput
1+
# JCS_TouchInput
22

33
Use this to receive the slide input from the device buffer.
44

0 commit comments

Comments
 (0)