11using Unity . AppUI . Redux ;
2+ using UnityEngine ;
23using Utils . Types ;
34
45namespace Models . Settings
56{
67 public static class SettingsReducers
78 {
89 public static SettingsState SetTabIndexReducer ( SettingsState state , IAction < int > action )
9- {
10- // Ignore if the payload is negative (invalid tab index).
11- if ( action . payload < 0 )
12- return state ;
10+ {
11+ // Ignore if the payload is negative (invalid tab index).
12+ if ( action . payload < 0 )
13+ return state ;
1314 return state with { TabIndex = action . payload } ;
1415 }
1516
1617 public static SettingsState SetInPlaneZoomReducer ( SettingsState state , IAction < int > action )
1718 {
18- return state with { inPlaneZoom = action . payload } ;
19- }
19+ return state with { inPlaneZoom = action . payload } ;
20+ }
2021
2122 #region Probe Settings
2223
2324 public static SettingsState SetDetectCollisionsReducer (
24- SettingsState state ,
25- IAction < bool > action
25+ SettingsState state ,
26+ IAction < bool > action
2627 )
2728 {
28- return state with { DetectCollisions = action . payload } ;
29+ return state with { DetectCollisions = action . payload } ;
30+ }
31+
32+ public static SettingsState SetConvertAPML2ProbeReducer (
33+ SettingsState state ,
34+ IAction < bool > action
35+ )
36+ {
37+ return state with { ConvertAPML2Probe = action . payload } ;
2938 }
3039
31- public static SettingsState SetConvertAPML2ProbeReducer (
40+ #endregion
41+
42+ #region Graphics Settings
43+
44+ public static SettingsState SetBackgroundReducer (
45+ SettingsState state ,
46+ IAction < Color > action
47+ )
48+ {
49+ return state with { Background = action . payload } ;
50+ }
51+
52+ public static SettingsState SetShowSurfaceCoordinateReducer (
53+ SettingsState state ,
54+ IAction < bool > action
55+ )
56+ {
57+ return state with { ShowSurfaceCoordinate = action . payload } ;
58+ }
59+
60+ public static SettingsState SetShowBregmaAxisReducer (
3261 SettingsState state ,
33- IAction < bool > action
62+ IAction < bool > action
3463 )
3564 {
36- return state with { ConvertAPML2Probe = action . payload } ;
65+ return state with { ShowBregmaAxis = action . payload } ;
66+ }
67+
68+ public static SettingsState SetGhostInactiveProbesReducer (
69+ SettingsState state ,
70+ IAction < bool > action
71+ )
72+ {
73+ return state with { GhostInactiveProbes = action . payload } ;
3774 }
3875
3976 #endregion
4077
4178 #region Ephys Link
4279
4380 public static SettingsState SetSelectedEphysLinkPlatformTypeReducer (
44- SettingsState state ,
81+ SettingsState state ,
4582 IAction < EphysLinkPlatformType > action
4683 )
4784 {
48- return state with { SelectedEphysLinkPlatformType = action . payload } ;
85+ return state with { SelectedEphysLinkPlatformType = action . payload } ;
4986 }
5087
5188 public static SettingsState SetNewScalePathfinderMpmPortReducer (
5289 SettingsState state ,
5390 IAction < int > action
54- )
55- {
56- return state with { NewScalePathfinderMpmPort = action . payload } ;
57- }
91+ )
92+ {
93+ return state with { NewScalePathfinderMpmPort = action . payload } ;
94+ }
5895
59- public static SettingsState SetCustomServerIpAddressReducer (
96+ public static SettingsState SetCustomServerIpAddressReducer (
6097 SettingsState state ,
61- IAction < string > action
62- )
98+ IAction < string > action
99+ )
63100 {
64101 return state with { CustomServerIpAddress = action . payload } ;
65- }
102+ }
66103
67104 public static SettingsState SetCustomServerPortReducer (
68- SettingsState state ,
69- IAction < int > action
70- )
71- {
105+ SettingsState state ,
106+ IAction < int > action
107+ )
108+ {
72109 return state with { CustomServerPort = action . payload } ;
73110 }
74111
75112 public static SettingsState SetEphysLinkConnectionStateReducer (
76- SettingsState state ,
113+ SettingsState state ,
77114 IAction < ( EphysLinkConnectionState ConnectionState , string ConnectionSocketId ) > action
78115 )
79- {
116+ {
80117 return state with { EphysLinkConnectionState = action . payload . ConnectionState } ;
81118 }
82119
@@ -89,37 +126,53 @@ public static class SettingsActions
89126 $ "{ SliceNames . SETTINGS_SLICE } /SetTabIndex";
90127
91128 public static readonly ActionCreator < int > SET_IN_PLANE_ZOOM =
92- $ "{ SliceNames . SETTINGS_SLICE } /SetInPlaneZoom";
129+ $ "{ SliceNames . SETTINGS_SLICE } /SetInPlaneZoom";
93130
94- #region Probe Settings
131+ #region Probe Settings
95132
96- public static readonly ActionCreator < bool > SET_DETECT_COLLISIONS =
133+ public static readonly ActionCreator < bool > SET_DETECT_COLLISIONS =
97134 $ "{ SliceNames . SETTINGS_SLICE } /SetDetectCollisions";
98135
99136 public static readonly ActionCreator < bool > SET_CONVERT_APML2PROBE =
100- $ "{ SliceNames . SETTINGS_SLICE } /SetConvertAPML2Probe";
137+ $ "{ SliceNames . SETTINGS_SLICE } /SetConvertAPML2Probe";
138+
139+ #endregion
140+
141+ #region Graphics Settings
142+
143+ public static readonly ActionCreator < Color > SET_BACKGROUND =
144+ $ "{ SliceNames . SETTINGS_SLICE } /SetBackground";
145+
146+ public static readonly ActionCreator < bool > SET_SHOW_SURFACE_COORDINATE =
147+ $ "{ SliceNames . SETTINGS_SLICE } /SetShowSurfaceCoordinate";
148+
149+ public static readonly ActionCreator < bool > SET_SHOW_BREGMA_AXIS =
150+ $ "{ SliceNames . SETTINGS_SLICE } /SetShowBregmaAxis";
151+
152+ public static readonly ActionCreator < bool > SET_GHOST_INACTIVE_PROBES =
153+ $ "{ SliceNames . SETTINGS_SLICE } /SetGhostInactiveProbes";
101154
102155 #endregion
103156
104157 #region Ephys Link
105158
106- public static readonly ActionCreator < EphysLinkPlatformType > SET_SELECTED_EPHYS_LINK_PLATFORM_TYPE =
107- $ "{ SliceNames . SETTINGS_SLICE } /SetSelectedEphysLinkPlatformType";
159+ public static readonly ActionCreator < EphysLinkPlatformType > SET_SELECTED_EPHYS_LINK_PLATFORM_TYPE =
160+ $ "{ SliceNames . SETTINGS_SLICE } /SetSelectedEphysLinkPlatformType";
108161
109- public static readonly ActionCreator < int > SET_NEW_SCALE_PATHFINDER_MPM_PORT =
110- $ "{ SliceNames . SETTINGS_SLICE } /SetNewScalePathfinderMpmPort";
162+ public static readonly ActionCreator < int > SET_NEW_SCALE_PATHFINDER_MPM_PORT =
163+ $ "{ SliceNames . SETTINGS_SLICE } /SetNewScalePathfinderMpmPort";
111164
112- public static readonly ActionCreator < string > SET_CUSTOM_SERVER_IP_ADDRESS =
165+ public static readonly ActionCreator < string > SET_CUSTOM_SERVER_IP_ADDRESS =
113166 $ "{ SliceNames . SETTINGS_SLICE } /SetCustomServerIpAddress";
114167
115- public static readonly ActionCreator < int > SET_CUSTOM_SERVER_PORT =
116- $ "{ SliceNames . SETTINGS_SLICE } /SetCustomServerPort";
168+ public static readonly ActionCreator < int > SET_CUSTOM_SERVER_PORT =
169+ $ "{ SliceNames . SETTINGS_SLICE } /SetCustomServerPort";
117170
118- public static readonly ActionCreator < (
119- EphysLinkConnectionState ConnectionState ,
120- string ConnectionSocketId
171+ public static readonly ActionCreator < (
172+ EphysLinkConnectionState ConnectionState ,
173+ string ConnectionSocketId
121174 ) > SET_EPHYS_LINK_CONNECTION_STATE = $ "{ SliceNames . SETTINGS_SLICE } /SetEphysLinkConnectionState";
122175
123- #endregion
176+ #endregion
124177 }
125178}
0 commit comments