Skip to content

Commit c793910

Browse files
committed
Additional public -> serialized private fields
This round is only fields that were already lowercase, to match style
1 parent 8345755 commit c793910

File tree

18 files changed

+170
-124
lines changed

18 files changed

+170
-124
lines changed

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/BaseClasses/PanZoomBase_RectTransf.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ public class PanZoomBase_RectTransf : PanZoomBase
1515
internal RectTransform viewportRectTransf = null;
1616
internal bool isScrollText = false;
1717

18-
private bool IsValid
19-
{
20-
get { return (navRectTransf != null); }
21-
}
18+
private bool IsValid => navRectTransf != null;
2219

2320
public override void Initialize()
2421
{

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/BaseClasses/PanZoomBase_Texture.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Microsoft.MixedReality.Toolkit.Examples.Demos.EyeTracking
1111
/// </summary>
1212
public class PanZoomBase_Texture : PanZoomBase
1313
{
14-
protected Renderer textureRederer = null;
14+
protected Renderer textureRenderer = null;
1515

1616
private const string DefaultTextureShaderProperty = "_MainTex";
1717
private int textureTargetID = Shader.PropertyToID(DefaultTextureShaderProperty);
@@ -28,12 +28,10 @@ public string TextureShaderProperty
2828

2929
[SerializeField]
3030
private float DefaultAspectRatio = 1.0f;
31+
3132
private float aspectRatio = -1;
3233

33-
private bool IsValid
34-
{
35-
get { return ((textureRederer != null) && (textureRederer.enabled)); }
36-
}
34+
private bool IsValid => (textureRenderer != null) && textureRenderer.enabled;
3735

3836
public override void Initialize()
3937
{
@@ -55,13 +53,13 @@ public void Initialize(float newAspectRatio)
5553

5654
//# Compute and set new scale
5755
ZoomStop();
58-
scale = new Vector2(textureRederer.transform.localScale.x / aspectRatio, 1f);
59-
textureRederer.materials[0].SetTextureScale(textureTargetID, scale);
56+
scale = new Vector2(textureRenderer.transform.localScale.x / aspectRatio, 1f);
57+
textureRenderer.materials[0].SetTextureScale(textureTargetID, scale);
6058

6159
//# Update new values for original ratio
6260
originalRatio = new Vector3(scale.x, scale.y);
6361

64-
BoxCollider bcoll = textureRederer.gameObject.GetComponent<BoxCollider>();
62+
BoxCollider bcoll = textureRenderer.gameObject.GetComponent<BoxCollider>();
6563
if (bcoll != null)
6664
{
6765
origColliderSize = bcoll.size;
@@ -126,8 +124,8 @@ public override void UpdatePanZoom()
126124
}
127125

128126
// Assign new values
129-
textureRederer.materials[0].SetTextureOffset(textureTargetID, offset); // Pan
130-
textureRederer.materials[0].SetTextureScale(textureTargetID, scale); // Zoom
127+
textureRenderer.materials[0].SetTextureOffset(textureTargetID, offset); // Pan
128+
textureRenderer.materials[0].SetTextureScale(textureTargetID, scale); // Zoom
131129
}
132130
}
133131

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/PanZoom_Texture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class PanZoom_Texture : PanZoomBase_Texture
7171
protected override void Start()
7272
{
7373
// Assigning values to base PanZoom class
74-
textureRederer = RendererOfTextureToBeNavigated;
74+
textureRenderer = RendererOfTextureToBeNavigated;
7575

7676
ZoomAcceleration = Zoom_Acceleration;
7777
ZoomSpeedMax = Zoom_SpeedMax;
@@ -91,7 +91,7 @@ protected override void Start()
9191

9292
protected override void Update()
9393
{
94-
UpdateValues(ref textureRederer, RendererOfTextureToBeNavigated);
94+
UpdateValues(ref textureRenderer, RendererOfTextureToBeNavigated);
9595

9696
UpdateValues(ref ZoomAcceleration, Zoom_Acceleration);
9797
UpdateValues(ref ZoomSpeedMax, Zoom_SpeedMax);

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/Scroll_Texture.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected override void Start()
5454
PanSpeedLeftRight = ScrollSpeed_x;
5555
MinDistFromCenterForAutoPan = MinDistFromCenterForAutoScroll;
5656
customColliderSizeOnLookAt = OnLookAt_ColliderSize;
57-
textureRederer = TextureRendererToBeScrolled;
57+
textureRenderer = TextureRendererToBeScrolled;
5858
useSkimProof = UseSkimProofing;
5959

6060
base.Start();
@@ -69,7 +69,7 @@ protected override void Update()
6969
UpdateValues(ref MinDistFromCenterForAutoPan, MinDistFromCenterForAutoScroll);
7070
UpdateValues(ref MinDistFromCenterForAutoPan, MinDistFromCenterForAutoScroll);
7171
UpdateValues(ref customColliderSizeOnLookAt, OnLookAt_ColliderSize);
72-
UpdateValues(ref textureRederer, TextureRendererToBeScrolled);
72+
UpdateValues(ref textureRenderer, TextureRendererToBeScrolled);
7373
UpdateValues(ref useSkimProof, UseSkimProofing);
7474

7575
if (UpdateValues(ref skimproof_UpdateSpeedFromUser, SkimProofUpdateSpeed))
@@ -79,6 +79,5 @@ protected override void Update()
7979

8080
base.Update();
8181
}
82-
8382
}
8483
}

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_ScrollPanZoom/Scripts/Target_MoveToCamera.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@ namespace Microsoft.MixedReality.Toolkit.Examples.Demos.EyeTracking
1111
public class Target_MoveToCamera : BaseEyeFocusHandler
1212
{
1313
public static Target_MoveToCamera currentlyFocusedTarget;
14+
1415
public MonoBehaviour[] ActivateBehaviorsWhenInFront;
1516

1617
public float DistanceToCamera = 6f;
17-
public float speed = 1f;
18-
public bool isEnabled = false;
1918

20-
public float minDistToStopTransition = 1f;
21-
public float minIncr = 0.01f;
22-
public bool setToAutoRotateIfFocused = true;
19+
[SerializeField]
20+
private float speed = 1f;
21+
22+
[SerializeField]
23+
private bool isEnabled = false;
24+
25+
[SerializeField]
26+
private float minDistToStopTransition = 1f;
27+
28+
[SerializeField]
29+
private bool setToAutoRotateIfFocused = true;
2330

2431
private Vector3 originalPosition;
2532
private bool inTransition = false;

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_TargetPositioning/Scripts/MoveObjByEyeGaze.cs

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@ public class MoveObjByEyeGaze : MonoBehaviour,
6666
private float previewPlacemDistThresh = 0.05f;
6767

6868
[Header("Constrained Movement")]
69-
public bool freezeX = false;
70-
public bool freezeY = false;
71-
public bool freezeZ = false;
69+
[SerializeField]
70+
private bool freezeX = false;
71+
72+
[SerializeField]
73+
private bool freezeY = false;
74+
75+
[SerializeField]
76+
private bool freezeZ = false;
7277

7378
public Vector2 LocalMinMax_X = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
7479
public Vector2 LocalMinMax_Y = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
@@ -108,12 +113,12 @@ public class MoveObjByEyeGaze : MonoBehaviour,
108113
#endregion
109114

110115
#region Private variables
111-
private GameObject pPreviewGameObj;
116+
private GameObject previewGameObject;
112117
private bool onlyEyeWarpOnRelease = true; // Only warp the currently grabbed target to the current look at location once the user releases the pinch gesture.
113118

114119
private float originalTransparency = -1;
115-
private bool original_UseGravity = false;
116-
private float original_Drag = 1;
120+
private bool originalUseGravity = false;
121+
private float originalDrag = 1;
117122

118123
private bool onlyTransitionToPlausibleDestinations = true;
119124
private Vector3? plausibleLocation;
@@ -127,7 +132,7 @@ public class MoveObjByEyeGaze : MonoBehaviour,
127132
private Vector3 handPos_absolute;
128133
private Vector3 handPos_relative;
129134
private Vector3 initialHandPos;
130-
private static bool hand_isPinching = false;
135+
private static bool handIsPinching = false;
131136
private Handedness currEngagedHand = Handedness.None;
132137
private bool objIsGrabbed = false;
133138

@@ -199,19 +204,19 @@ private void Update()
199204
// Update preview position
200205
if (placePreviewAtHitPoint)
201206
{
202-
pPreviewGameObj.transform.position = plausibleLocation.Value; // EyeInputManager.Instance.HitPosition;
207+
previewGameObject.transform.position = plausibleLocation.Value; // EyeInputManager.Instance.HitPosition;
203208
}
204209
else
205210
{
206211
if (PlacementSurface == PlacementSurfaces.Horizontal)
207212
{
208-
pPreviewGameObj.transform.position = plausibleLocation.Value + pPreviewGameObj.transform.localScale.y * new Vector3(0, 1, 0) / 2; //EyeInputManager.Instance.HitPosition + pPreviewGameObj.transform.localScale.y * new Vector3(0, 1, 0);
213+
previewGameObject.transform.position = plausibleLocation.Value + previewGameObject.transform.localScale.y * new Vector3(0, 1, 0) / 2; //EyeInputManager.Instance.HitPosition + pPreviewGameObj.transform.localScale.y * new Vector3(0, 1, 0);
209214
}
210215
else
211216
{
212-
pPreviewGameObj.transform.position = plausibleLocation.Value; //EyeInputManager.Instance.HitPosition;
217+
previewGameObject.transform.position = plausibleLocation.Value; //EyeInputManager.Instance.HitPosition;
213218
}
214-
prevPreviewPos = pPreviewGameObj.transform.position;
219+
prevPreviewPos = previewGameObject.transform.position;
215220
}
216221
}
217222
else
@@ -265,7 +270,7 @@ void IMixedRealityHandJointHandler.OnHandJointsUpdated(InputEventData<IDictionar
265270
handPos_relative = new Vector3(oldHandPos.x - pose.Position.x, oldHandPos.y - pose.Position.y, oldHandPos.z - pose.Position.z);
266271
handPos_absolute = pose.Position;
267272

268-
if (hand_isPinching)
273+
if (handIsPinching)
269274
{
270275
RelativeMoveUpdate(handPos_relative);
271276
}
@@ -342,7 +347,7 @@ private void HandDrag_Start()
342347
if ((handInputEnabled) && (!isManipulatingUsing_Hands) && (!isManipulatingUsing_Voice))
343348
{
344349
isManipulatingUsing_Hands = true;
345-
hand_isPinching = true;
350+
handIsPinching = true;
346351
handPos_relative = Vector3.zero;
347352
handPos_absolute = Vector3.zero;
348353
DragAndDrop_Start();
@@ -358,7 +363,7 @@ private void HandDrag_Stop()
358363
if (isManipulatingUsing_Hands)
359364
{
360365
isManipulatingUsing_Hands = false;
361-
hand_isPinching = false;
366+
handIsPinching = false;
362367
handPos_relative = Vector3.zero;
363368
DragAndDrop_Finish();
364369
MixedRealityToolkit.InputSystem.PopModalInputHandler();
@@ -414,13 +419,13 @@ private bool IsLookingAwayFromPreview()
414419
}
415420

416421
// Check if the target is still hit by the eye gaze cursor
417-
if (EyeTrackingProvider.GazeTarget == pPreviewGameObj)
422+
if (EyeTrackingProvider.GazeTarget == previewGameObject)
418423
{
419424
return false;
420425
}
421426

422427
// Check whether the user is still looking within the proximity of the target
423-
float distanceBetweenTargetAndCurrHitPos = Angle_ToCurrHitTarget(pPreviewGameObj);
428+
float distanceBetweenTargetAndCurrHitPos = Angle_ToCurrHitTarget(previewGameObject);
424429
if (distanceBetweenTargetAndCurrHitPos > minLookAwayDistToEnableEyeWarp)
425430
{
426431
return true;
@@ -477,27 +482,27 @@ private Vector3 GetValidPlacemLocation(GameObject hitobj)
477482
/// </summary>
478483
private void ActivatePreview()
479484
{
480-
if (pPreviewGameObj == null)
485+
if (previewGameObject == null)
481486
{
482-
pPreviewGameObj = Instantiate(gameObject);
483-
pPreviewGameObj.GetComponent<Collider>().enabled = false;
484-
EyeTrackingDemoUtils.GameObject_ChangeTransparency(pPreviewGameObj, transparency_preview);
487+
previewGameObject = Instantiate(gameObject);
488+
previewGameObject.GetComponent<Collider>().enabled = false;
489+
EyeTrackingDemoUtils.GameObject_ChangeTransparency(previewGameObject, transparency_preview);
485490
placePreviewAtHitPoint = false;
486491
}
487492

488-
pPreviewGameObj.SetActive(true);
493+
previewGameObject.SetActive(true);
489494
}
490495

491496
/// <summary>
492497
/// Turn off the preview of the to-be-placed target.
493498
/// </summary>
494499
private void DeactivatePreview()
495500
{
496-
if (pPreviewGameObj != null)
501+
if (previewGameObject != null)
497502
{
498-
pPreviewGameObj.SetActive(false);
499-
Destroy(pPreviewGameObj);
500-
pPreviewGameObj = null;
503+
previewGameObject.SetActive(false);
504+
Destroy(previewGameObject);
505+
previewGameObject = null;
501506
}
502507
}
503508

@@ -521,8 +526,8 @@ public void DragAndDrop_Start()
521526
Rigidbody rbody = GetComponent<Rigidbody>();
522527
if (rbody != null)
523528
{
524-
original_UseGravity = rbody.useGravity;
525-
original_Drag = rbody.drag;
529+
originalUseGravity = rbody.useGravity;
530+
originalDrag = rbody.drag;
526531

527532
rbody.useGravity = false;
528533
rbody.drag = float.PositiveInfinity;
@@ -560,8 +565,8 @@ public void DragAndDrop_Finish()
560565
Rigidbody rbody = GetComponent<Rigidbody>();
561566
if (rbody != null)
562567
{
563-
rbody.useGravity = original_UseGravity;
564-
rbody.drag = original_Drag;
568+
rbody.useGravity = originalUseGravity;
569+
rbody.drag = originalDrag;
565570
}
566571

567572
if (useAsSlider)
@@ -766,7 +771,7 @@ public void MoveTargetTo(Vector3 destination)
766771

767772
private bool ShouldObjBeWarped(float deltaHand, float distTargetAndHitPos, bool headIsInMotion)
768773
{
769-
if ((manualTargetManip && (pPreviewGameObj != null) && (pPreviewGameObj.activeSelf)) ||
774+
if ((manualTargetManip && (previewGameObject != null) && (previewGameObject.activeSelf)) ||
770775
((!onlyEyeWarpOnRelease) &&
771776
// If manipulated via hands, head and eyes:
772777
(deltaHand > deltaHandMovemThresh) && // 1. Check that *hand* moved sufficiently to indicate the user's intent to move the target

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_TargetSelections/Scripts/HitBehavior_DestroyOnSelect.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ public class HitBehavior_DestroyOnSelect : MonoBehaviour
2828
[SerializeField]
2929
private bool is_a_valid_target = true;
3030

31-
/// <summary>
32-
/// Associated TargetGridIterator to check whether the currently selected target is the correct one.
33-
/// </summary>
31+
[Tooltip("Associated TargetGridIterator to check whether the currently selected target is the correct one.")]
3432
[SerializeField]
3533
private TargetGroupIterator targetIterator = null;
3634

@@ -41,14 +39,7 @@ public class HitBehavior_DestroyOnSelect : MonoBehaviour
4139

4240
private void SetUpAudio()
4341
{
44-
if (audioSource == null)
45-
{
46-
audioSource = gameObject.AddComponent<AudioSource>();
47-
}
48-
else
49-
{
50-
audioSource = gameObject.GetComponent<AudioSource>();
51-
}
42+
audioSource = gameObject.EnsureComponent<AudioSource>();
5243

5344
audioSource.playOnAwake = false;
5445
audioSource.enabled = true;

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_TargetSelections/Scripts/ToggleGameObject.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ namespace Microsoft.MixedReality.Toolkit.Examples.Demos.EyeTracking
77
{
88
public class ToggleGameObject : MonoBehaviour
99
{
10-
public GameObject objToShowHide;
10+
[SerializeField]
11+
private GameObject objToShowHide = null;
1112

1213
public void ShowIt()
1314
{

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_Visualizer/Scripts/BasicInputLogger.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ public void SetUserName(string name)
2222
Debug.Log("New user name: " + name);
2323
}
2424

25-
//[LEAPConsoleMethod("Set session name (e.g., Session00, Session01)")]
2625
public void SetSessionDescr(string descr)
2726
{
2827
sessionDescr = descr;
2928
Debug.Log("New session name: " + descr);
3029
}
3130

3231
public string UserName = "tester";
33-
public string sessionDescr = "Session00";
32+
33+
[SerializeField]
34+
protected string sessionDescr = "Session00";
35+
3436
public string LogDirectory
3537
{
3638
get
@@ -43,9 +45,9 @@ public string LogDirectory
4345
public abstract string GetHeader();
4446

4547
#if WINDOWS_UWP
46-
private StorageFile logFile;
47-
private StorageFolder logRootFolder = KnownFolders.MusicLibrary;
48-
private StorageFolder sessionFolder;
48+
private StorageFile logFile;
49+
private StorageFolder logRootFolder = KnownFolders.MusicLibrary;
50+
private StorageFolder sessionFolder;
4951
#endif
5052

5153
internal bool isLogging = false;

0 commit comments

Comments
 (0)