Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Light Up puzzle editor fix #629

Merged
merged 8 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/main/java/edu/rpi/legup/puzzle/lightup/LightUpCell.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package edu.rpi.legup.puzzle.lightup;

import edu.rpi.legup.model.elements.Element;
import edu.rpi.legup.model.gameboard.GridCell;

import java.awt.*;
import java.awt.event.MouseEvent;

public class LightUpCell extends GridCell<Integer> {
private boolean isLite;
Expand All @@ -12,6 +14,41 @@ public LightUpCell(int valueInt, Point location) {
this.isLite = false;
}

@Override
public void setType(Element e, MouseEvent m) {
switch (e.getElementID()) {
case "LTUP-PLAC-0001":
this.data = -4;
break;
case "LTUP-UNPL-0002":
this.data = -1;
break;
case "LTUP-UNPL-0003":
this.data = -2;
break;
case "LTUP-UNPL-0001":
switch (m.getButton()){
case MouseEvent.BUTTON1:
if (this.data < 0 || this.data > 3) {
this.data = 0;
}
else {
this.data = this.data + 1;
}
break;
case MouseEvent.BUTTON3:
if (this.data > 0) {
this.data = this.data - 1;
}
else {
this.data = 4;
}
break;
}
break;
}
}

public LightUpCellType getType() {
switch (data) {
case -4:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package edu.rpi.legup.puzzle.lightup.elements;

import edu.rpi.legup.model.elements.PlaceableElement;
import edu.rpi.legup.model.elements.NonPlaceableElement;

public class BlackTile extends PlaceableElement {
public class BlackTile extends NonPlaceableElement {
public BlackTile() {
super("LTUP-PLAC-0002", "Black Tile", "The black tile", "edu/rpi/legup/images/lightup/black.gif");
super("LTUP-UNPL-0002", "Black Tile", "The black tile", "edu/rpi/legup/images/lightup/black.gif");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package edu.rpi.legup.puzzle.lightup.elements;

import edu.rpi.legup.model.elements.NonPlaceableElement;

public class UnknownTile extends NonPlaceableElement {
public UnknownTile() {
super("LTUP-UNPL-0003", "Unknown Tile", "A blank tile", "edu/rpi/legup/images/lightup/UnknownTile.png");
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading