@@ -27,6 +27,9 @@ public class CustomGameEditor extends Scene2DPanel {
2727 private final TextButton loadSlot2Btn ;
2828 private final TextButton saveSlot3Btn ;
2929 private final TextButton loadSlot3Btn ;
30+ private final TextButton presetClassicBtn ;
31+ private final TextButton presetCascadeBtn ;
32+ private final TextButton presetStackBtn ;
3033 private final TextButton addPieceBtn ;
3134 private final TextButton duplicatePieceBtn ;
3235 private final TextButton removePieceBtn ;
@@ -107,6 +110,9 @@ public CustomGameEditor(Engine engine) {
107110 loadSlot2Btn = new TextButton ("Load Slot 2" , skin );
108111 saveSlot3Btn = new TextButton ("Save Slot 3" , skin );
109112 loadSlot3Btn = new TextButton ("Load Slot 3" , skin );
113+ presetClassicBtn = new TextButton ("Classic Drop" , skin );
114+ presetCascadeBtn = new TextButton ("Cascade Puzzle" , skin );
115+ presetStackBtn = new TextButton ("Stack Arcade" , skin );
110116 addPieceBtn = new TextButton ("Add Piece Type" , skin );
111117 duplicatePieceBtn = new TextButton ("Duplicate Piece" , skin );
112118 removePieceBtn = new TextButton ("Remove Piece" , skin );
@@ -128,6 +134,12 @@ public CustomGameEditor(Engine engine) {
128134 presetRow .add (saveSlot3Btn );
129135 presetRow .add (loadSlot3Btn );
130136
137+ Table presetQuickRow = new Table ();
138+ presetQuickRow .defaults ().pad (4 );
139+ presetQuickRow .add (presetClassicBtn );
140+ presetQuickRow .add (presetCascadeBtn );
141+ presetQuickRow .add (presetStackBtn );
142+
131143 Table controlsRow1 = new Table ();
132144 controlsRow1 .defaults ().pad (4 );
133145 controlsRow1 .add (addPieceBtn );
@@ -218,6 +230,24 @@ public void clicked(InputEvent event, float x, float y) {
218230 loadPresetSlot (2 );
219231 }
220232 });
233+ presetClassicBtn .addListener (new ClickListener () {
234+ @ Override
235+ public void clicked (InputEvent event , float x , float y ) {
236+ applyPreset ("classic" );
237+ }
238+ });
239+ presetCascadeBtn .addListener (new ClickListener () {
240+ @ Override
241+ public void clicked (InputEvent event , float x , float y ) {
242+ applyPreset ("cascade" );
243+ }
244+ });
245+ presetStackBtn .addListener (new ClickListener () {
246+ @ Override
247+ public void clicked (InputEvent event , float x , float y ) {
248+ applyPreset ("stack" );
249+ }
250+ });
221251
222252 addPieceBtn .addListener (new ClickListener () {
223253 @ Override
@@ -323,6 +353,7 @@ public void clicked(InputEvent event, float x, float y) {
323353 mainTable .add (titleLabel ).left ().row ();
324354 mainTable .add (hintLabel ).width (520 ).left ().row ();
325355 mainTable .add (presetRow ).left ().row ();
356+ mainTable .add (presetQuickRow ).left ().row ();
326357 mainTable .add (controlsRow1 ).left ().row ();
327358 mainTable .add (controlsRow2 ).left ().row ();
328359 mainTable .add (advancedRulesTable ).left ().row ();
@@ -378,6 +409,77 @@ private void savePresetSlot(int slotIndex) {
378409 summaryLabel .setText ("Saved current ruleset to preset slot " + (slotIndex + 1 ));
379410 }
380411
412+ private void applyPreset (String preset ) {
413+ applyRuleCheckboxes ();
414+ if ("classic" .equals (preset )) {
415+ currentGameType .name = "Classic Drop" ;
416+ currentGameType .gameMode = GameType .GameMode .DROP ;
417+ currentGameType .gridWidth = 10 ;
418+ currentGameType .gridHeight = 20 ;
419+ currentGameType .chainRule_AmountPerChain = 4 ;
420+ currentGameType .moveDownAllLinesOverBlankSpacesAtOnce = false ;
421+ currentGameType .gravityRule_onlyMoveDownDisconnectedBlocks = false ;
422+ currentGameType .chainRule_CheckRow = true ;
423+ currentGameType .chainRule_CheckColumn = false ;
424+ currentGameType .chainRule_CheckDiagonal = false ;
425+ currentGameType .chainRule_CheckRecursiveConnections = false ;
426+ currentGameType .nextPieceEnabled = true ;
427+ currentGameType .holdPieceEnabled = true ;
428+ currentGameType .currentPieceRule_getNewPiecesRandomlyOutOfBagWithOneOfEachPieceUntilEmpty = true ;
429+ currentGameType .hardDropPunchThroughToLowestValidGridPosition = false ;
430+ currentGameType .twoSpaceWallKickAllowed = true ;
431+ currentGameType .diagonalWallKickAllowed = true ;
432+ currentGameType .pieceClimbingAllowed = true ;
433+ currentGameType .flip180Allowed = true ;
434+ currentGameType .floorKickAllowed = true ;
435+ } else if ("cascade" .equals (preset )) {
436+ currentGameType .name = "Cascade Puzzle" ;
437+ currentGameType .gameMode = GameType .GameMode .DROP ;
438+ currentGameType .gridWidth = 8 ;
439+ currentGameType .gridHeight = 16 ;
440+ currentGameType .chainRule_AmountPerChain = 3 ;
441+ currentGameType .moveDownAllLinesOverBlankSpacesAtOnce = true ;
442+ currentGameType .gravityRule_onlyMoveDownDisconnectedBlocks = true ;
443+ currentGameType .chainRule_CheckRow = true ;
444+ currentGameType .chainRule_CheckColumn = true ;
445+ currentGameType .chainRule_CheckDiagonal = true ;
446+ currentGameType .chainRule_CheckRecursiveConnections = true ;
447+ currentGameType .nextPieceEnabled = true ;
448+ currentGameType .holdPieceEnabled = false ;
449+ currentGameType .currentPieceRule_getNewPiecesRandomlyOutOfBagWithOneOfEachPieceUntilEmpty = false ;
450+ currentGameType .hardDropPunchThroughToLowestValidGridPosition = false ;
451+ currentGameType .twoSpaceWallKickAllowed = false ;
452+ currentGameType .diagonalWallKickAllowed = false ;
453+ currentGameType .pieceClimbingAllowed = false ;
454+ currentGameType .flip180Allowed = false ;
455+ currentGameType .floorKickAllowed = false ;
456+ } else if ("stack" .equals (preset )) {
457+ currentGameType .name = "Stack Arcade" ;
458+ currentGameType .gameMode = GameType .GameMode .STACK ;
459+ currentGameType .gridWidth = 6 ;
460+ currentGameType .gridHeight = 12 ;
461+ currentGameType .chainRule_AmountPerChain = 3 ;
462+ currentGameType .moveDownAllLinesOverBlankSpacesAtOnce = false ;
463+ currentGameType .gravityRule_onlyMoveDownDisconnectedBlocks = false ;
464+ currentGameType .chainRule_CheckRow = true ;
465+ currentGameType .chainRule_CheckColumn = true ;
466+ currentGameType .chainRule_CheckDiagonal = false ;
467+ currentGameType .chainRule_CheckRecursiveConnections = false ;
468+ currentGameType .nextPieceEnabled = true ;
469+ currentGameType .holdPieceEnabled = false ;
470+ currentGameType .currentPieceRule_getNewPiecesRandomlyOutOfBagWithOneOfEachPieceUntilEmpty = false ;
471+ currentGameType .hardDropPunchThroughToLowestValidGridPosition = false ;
472+ currentGameType .twoSpaceWallKickAllowed = true ;
473+ currentGameType .diagonalWallKickAllowed = false ;
474+ currentGameType .pieceClimbingAllowed = false ;
475+ currentGameType .flip180Allowed = false ;
476+ currentGameType .floorKickAllowed = false ;
477+ }
478+ selectedPieceIndex = currentGameType .pieceTypes .isEmpty () ? -1 : 0 ;
479+ selectedRotationIndex = 0 ;
480+ refreshEditorState ();
481+ }
482+
381483 private void loadPresetSlot (int slotIndex ) {
382484 if (presetSlots [slotIndex ] == null ) {
383485 summaryLabel .setText ("Preset slot " + (slotIndex + 1 ) + " is empty." );
0 commit comments