File tree Expand file tree Collapse file tree
src/CodeBreaker.Blazor.Client/Components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ private void SelectColor(string color)
135135 else
136136 {
137137 // If no field is selected, find the first field that is not set
138- fieldIndex = Array . FindIndex ( _currentMove , f => f . Color is null && f . Shape is null ) ;
138+ fieldIndex = Array . FindIndex ( _currentMove , f => f . Color is null ) ;
139139
140140 // If all fields are set, do not set the color
141141 if ( fieldIndex == - 1 )
@@ -148,8 +148,26 @@ private void SelectColor(string color)
148148
149149 private void SelectShape ( string shape )
150150 {
151- _currentMove [ _selectedField ] . Selected = true ;
152- _currentMove [ _selectedField ] . Shape = shape ;
151+ //_currentMove[_selectedField].Selected = true;
152+ //_currentMove[_selectedField].Shape = shape;
153+
154+ int fieldIndex ;
155+
156+ // If a field is selected, use the selected field
157+ if ( _selectedField != - 1 )
158+ fieldIndex = _selectedField ;
159+ else
160+ {
161+ // If no field is selected, find the first field that is not set
162+ fieldIndex = Array . FindIndex ( _currentMove , f => f . Shape is null ) ;
163+
164+ // If all fields are set, do not set the color
165+ if ( fieldIndex == - 1 )
166+ return ;
167+ }
168+
169+ _currentMove [ fieldIndex ] . Selected = true ;
170+ _currentMove [ fieldIndex ] . Shape = shape ;
153171 }
154172 #endregion
155173
Original file line number Diff line number Diff line change 121121 height : calc (var (--game-field-height ) - 4px );
122122 }
123123
124- .game-container .game-move div {
125- margin : 0 auto;
126- }
127-
128124 .game-container .game-row .selectable .can-drop ,
129125 .game-container .game-row .selectable .can-drop ,
130126 .colors div : hover {
You can’t perform that action at this time.
0 commit comments