Skip to content

Commit f257970

Browse files
committed
Fixed issue causing the active CursorType lists to not update correctly.
1 parent cdadeba commit f257970

File tree

10 files changed

+31
-23
lines changed

10 files changed

+31
-23
lines changed

Core/Solution/Hover.Board/Custom/HoverboardInteractionSettings.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public virtual InteractionSettings GetSettings() {
3030
vSettings.HighlightDistanceMax = HighlightDistanceMax;
3131
vSettings.StickyReleaseDistance = StickyReleaseDistance;
3232
vSettings.SelectionMilliseconds = SelectionMilliseconds;
33-
vSettings.Cursors = Cursors;
33+
34+
foreach ( CursorType cursorType in Cursors ) {
35+
vSettings.Cursors.Add(cursorType);
36+
}
3437
}
3538

3639
return vSettings;

Core/Solution/Hover.Board/Custom/InteractionSettings.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ namespace Hover.Board.Custom {
77
/*================================================================================================*/
88
public class InteractionSettings : BaseInteractionSettings {
99

10-
public IList<CursorType> Cursors { get; set; }
10+
public IList<CursorType> Cursors { get; private set; }
11+
12+
13+
////////////////////////////////////////////////////////////////////////////////////////////////
14+
/*--------------------------------------------------------------------------------------------*/
15+
public InteractionSettings() {
16+
Cursors = new List<CursorType>();
17+
}
1118

1219
}
1320

Core/Solution/Hover.Board/HoverboardSetup.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class HoverboardSetup : MonoBehaviour {
2525

2626
private HoverboardState vState;
2727
private UiPanel[] vUiPanels;
28-
private IList<CursorType> vPrevActiveCursorTypes;
28+
private List<CursorType> vPrevActiveCursorTypes;
2929
private IDictionary<CursorType, UiProjection> vProjMap;
3030
private List<CursorType> vHideCursorTypes;
3131
private List<CursorType> vShowCursorTypes;
@@ -60,7 +60,7 @@ public void Awake() {
6060
vState = new HoverboardState(Panels.Select(x => x.GetPanel()).ToArray(), Hovercursor,
6161
InteractionSettings.GetSettings(), gameObject.transform);
6262

63-
vPrevActiveCursorTypes = new CursorType[0];
63+
vPrevActiveCursorTypes = new List<CursorType>();
6464
vProjMap = new Dictionary<CursorType, UiProjection>(EnumIntKeyComparer.CursorType);
6565
vHideCursorTypes = new List<CursorType>();
6666
vShowCursorTypes = new List<CursorType>();
@@ -132,7 +132,8 @@ public void Update() {
132132
vProjMap.Add(cursorType, uiProj);
133133
}
134134

135-
vPrevActiveCursorTypes = activeCursorTypes;
135+
vPrevActiveCursorTypes.Clear();
136+
vPrevActiveCursorTypes.AddRange(activeCursorTypes);
136137
}
137138
}
138139

Core/Solution/Hover.Cast/State/HovercastState.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using System.Collections.ObjectModel;
3-
using System.Linq;
43
using Hover.Cast.Custom;
54
using Hover.Cast.Input;
65
using Hover.Common.Input;

Core/Solution/Hover.Cast/State/MenuState.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using System.Collections.ObjectModel;
3-
using System.Linq;
43
using Hover.Cast.Custom;
54
using Hover.Cast.Input;
65
using Hover.Common.Input;

Core/Solution/Hover.Cursor/HovercursorSetup.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class HovercursorSetup : MonoBehaviour {
1919
public Transform CameraTransform;
2020

2121
private HovercursorState vState;
22-
private ReadOnlyCollection<CursorType> vPrevActiveCursorTypes;
22+
private List<CursorType> vPrevActiveCursorTypes;
2323
private IDictionary<CursorType, UiCursor> vCursorMap;
2424
private List<CursorType> vHideCursorTypes;
2525
private List<CursorType> vShowCursorTypes;
@@ -51,7 +51,7 @@ public void Awake() {
5151
vState = new HovercursorState(gameObject.transform, Input,
5252
DefaultVisualSettings, CameraTransform);
5353

54-
vPrevActiveCursorTypes = new ReadOnlyCollection<CursorType>(new List<CursorType>());
54+
vPrevActiveCursorTypes = new List<CursorType>();
5555
vCursorMap = new Dictionary<CursorType, UiCursor>(EnumIntKeyComparer.CursorType);
5656
vHideCursorTypes = new List<CursorType>();
5757
vShowCursorTypes = new List<CursorType>();
@@ -94,7 +94,8 @@ public void Update() {
9494
vState.SetCursorTransform(type, cursorObj.transform);
9595
}
9696

97-
vPrevActiveCursorTypes = activeTypes;
97+
vPrevActiveCursorTypes.Clear();
98+
vPrevActiveCursorTypes.AddRange(activeTypes);
9899
}
99100

100101
}

Core/Solution/Hover.Cursor/State/HovercursorState.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public HovercursorState(Transform pBaseTx, HovercursorInput pInput,
5050
vActiveCursorPlaneMap = new Dictionary<CursorType, ReadList<PlaneData>>(
5151
EnumIntKeyComparer.CursorType);
5252

53-
ActiveCursorTypes = new ReadOnlyCollection<CursorType>(vActiveCursorTypes);
53+
ActiveCursorTypes = vActiveCursorTypes.AsReadOnly();
5454

5555
vInput.SetPlaneProvider(GetActiveCursorPlanes);
5656
}
@@ -65,7 +65,6 @@ public IHovercursorInput Input {
6565
}
6666

6767

68-
6968
////////////////////////////////////////////////////////////////////////////////////////////////
7069
/*--------------------------------------------------------------------------------------------*/
7170
public ICursorState GetCursorState(CursorType pType) {

Unity/Assets/Hover/Demo/BoardKeys/CastItems/DemoAllowThumbListener.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ protected override void BroadcastInitialValue() {
4343
////////////////////////////////////////////////////////////////////////////////////////////////
4444
/*--------------------------------------------------------------------------------------------*/
4545
private void HandleValueChanged(ISelectableItem<bool> pItem) {
46-
vInteractSett.Cursors = (pItem.Value ? vThumbCursors : vNoThumbCursors);
46+
CursorType[] cursorTypes = (pItem.Value ? vThumbCursors : vNoThumbCursors);
47+
48+
vInteractSett.Cursors.Clear();
49+
50+
foreach ( CursorType cursorType in cursorTypes ) {
51+
vInteractSett.Cursors.Add(cursorType);
52+
}
4753
}
4854
}
4955

Unity/Assets/Hover/Demo/BoardTest/DemoBoardToggle.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ private struct Bundle {
2929

3030
private HoverboardSetup vSetup;
3131
private Bundle[] vBundles;
32-
private List<CursorType> vActiveCursorTypes;
3332

3433

3534
////////////////////////////////////////////////////////////////////////////////////////////////
3635
/*--------------------------------------------------------------------------------------------*/
3736
public void Awake() {
3837
vSetup = gameObject.GetComponent<HoverboardSetup>();
39-
vActiveCursorTypes = new List<CursorType>();
4038
}
4139

4240
/*--------------------------------------------------------------------------------------------*/
@@ -59,17 +57,16 @@ public void Start() {
5957

6058
/*--------------------------------------------------------------------------------------------*/
6159
public void Update() {
62-
vActiveCursorTypes.Clear();
60+
IList<CursorType> cursorTypes = vSetup.InteractionSettings.GetSettings().Cursors;
61+
cursorTypes.Clear();
6362

6463
foreach ( Bundle bundle in vBundles ) {
6564
if ( !bundle.ShowFunc() ) {
6665
continue;
6766
}
6867

69-
vActiveCursorTypes.Add(bundle.CursorType);
68+
cursorTypes.Add(bundle.CursorType);
7069
}
71-
72-
vSetup.InteractionSettings.GetSettings().Cursors = vActiveCursorTypes;
7370
}
7471

7572

Unity/Assets/Plugins/x86/SystemWipeRecognizerDll.ilk.meta

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)