Skip to content

Conversation

@mhawryluk
Copy link
Collaborator

Description

Create and show a popup when earning points.

Checklist

  • FXML configuration
  • Controller class
  • Popup creator class

Copy link
Collaborator

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, good job 🍾 ! After the #6 is merged, we need to adapt these changes to use information provided by configuration files.

Comment on lines +19 to +22
Image someMap = new Image("file:assets/map.png");
Image someMap10x10 = new Image("file:assets/map10x10.png");
Image someDude1 = new Image("file:assets/someDude.png");
Image someDude2 = new Image("file:assets/someDudeButGreen.png");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These paths should be loaded from configuration. I guess its fine for now and we can do this in separate PR after #6 is merged.

public void onKeyTyped(KeyEvent event) {
// TODO: 01.04.2022 Implement key actions

System.out.println(event);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#6 Introduces log4j, we should switch and use one logger in whole project.

Comment on lines 31 to 44
new Thread(() -> {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Platform.runLater(() ->{
displayLayer.showLocation()
.setBackgroundImage(someMap10x10)
.addMapObject(new GameObjectStandIn(new Pair<>(0,0), someDude1))
.addMapObject(new GameObjectStandIn(new Pair<>(0,2), someDude1))
.addMapObject(new GameObjectStandIn(new Pair<>(5,9), someDude2));
});
}).start();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this

locationController = LocationController.load();
}


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

.clear();
}


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

private PointsPopupController controller;
private final Scene popupScene;

public PointsEarnedPopup(){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public PointsEarnedPopup(){
public PointsEarnedPopup() {

popupScene = new Scene(root, Color.TRANSPARENT);
}

public Stage getPopup(int pointsCount, Scene scene){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public Stage getPopup(int pointsCount, Scene scene){
public Stage getPopup(int pointsCount, Scene scene) {

label.setText("Earned " + pointsCount + " points!");
}

protected Pair<Double, Double> setBackgroundImage(String url){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
protected Pair<Double, Double> setBackgroundImage(String url){
protected Pair<Double, Double> setBackgroundImage(String url) {

background.setBackground(new Background(backgroundImg));
return new Pair<>(background.getPrefWidth(), background.getPrefHeight());
}
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

return position;
}

public Image getImage(){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public Image getImage(){
public Image getImage() {

@kkafar kkafar merged commit dbb5dd2 into master Apr 7, 2022
@kkafar kkafar deleted the @mhawryluk/RPG-82-points-earned-popup branch April 7, 2022 16:11
kkafar added a commit that referenced this pull request Apr 7, 2022
* chore: Init gui

* feat: now location is centered

* feat: Add popup creation class for point earning

* feat: Read popup layout from FXML and set pointCount via controller

* refactor: Move popup classes into popups package

* chore: Add background image and improve styling of points popup

* fix: Add background image to assets

* refactor: Add comments to popup class

* refactor: Make showPopup method not static

* refactor: Change position to be represented as a vector

* add game class

* moving player

* measuring frame time duration

* improved player control

* modified player class

* RPG-79 Model proposal & configuration loading (#6)

* chore: Add dependency on Gson

This library is required, as our configuration files will be based on
json

* chore: Add dependency on jetbrains.annotations

* fix: Change package name in module-info.java

* chore: Push out commit

* feat: Extend class schema

* refract: Rename DialogicGameObject -> DialogGameObject

* feat: Add Position record

* feat: Initial GameObject implementation

* refract: Make GameWorld class final

* feat: Add empty Location class

* docs: Add docs dir & empty configuration description

* chore: Add ConfigConstants class with static data members

* refract: Resign from m prefix in private member var names

* chore: Add dependency on log4j

* fix: Fix module-info: export io.rpg

* feat: Setup logging in application entry point

* chore: Package structure

* refract: Empty line at the end of build.gradle

* feat: Initlial configuration structure

* refract: Code cleanup

* refract: Change ROOT file name to root.json

* refract: Change String paths to java.nio classes

* chore: Add logging to ConfigLoader

* feat: Handle FNF config dir & root file

* chore: Exclude bin directory from repo

* feat: Update configuration structure

* feat: LocationConfig

* feat: GameWorldConfig

* fix: Open io.rpg.model module to gson

* TO REVERT: modify app entry class due to some issues with sdk

* chore: Add mock top level class of application

* feat: Initial ConfigLoader impl

* feat: toString method for GameWorldConfig

* feat: Log GameWorldConfig after deserialization

* chore: Add mock game configuration for unit-testing

* chore: Expose model classes to Gson

* Fix: Adjustments to make Gson work

* feat: ConfigLoader#loadLocation

* test: Add initial tests for ConfigLoader

* test: Add ConfigLoaderTest#LocationConfigIsLoadedProperly test

* chore: Update MockTest

* chore: Update configuration files

* chore: Remove not-up-to-date test

* chore: Improve ConfigLoader#load method

* chore: Improve model classes

* refract: Fix typos

Co-authored-by: adam <adam.przywieczerski@gmail.com>

* @co012/RPG-93 widac lokacje w okienku (#8)

* chore: Init gui

* feat: now location is centered

* RPG-79 Model proposal & configuration loading (#6)

* chore: Add dependency on Gson

This library is required, as our configuration files will be based on
json

* chore: Add dependency on jetbrains.annotations

* fix: Change package name in module-info.java

* chore: Push out commit

* feat: Extend class schema

* refract: Rename DialogicGameObject -> DialogGameObject

* feat: Add Position record

* feat: Initial GameObject implementation

* refract: Make GameWorld class final

* feat: Add empty Location class

* docs: Add docs dir & empty configuration description

* chore: Add ConfigConstants class with static data members

* refract: Resign from m prefix in private member var names

* chore: Add dependency on log4j

* fix: Fix module-info: export io.rpg

* feat: Setup logging in application entry point

* chore: Package structure

* refract: Empty line at the end of build.gradle

* feat: Initlial configuration structure

* refract: Code cleanup

* refract: Change ROOT file name to root.json

* refract: Change String paths to java.nio classes

* chore: Add logging to ConfigLoader

* feat: Handle FNF config dir & root file

* chore: Exclude bin directory from repo

* feat: Update configuration structure

* feat: LocationConfig

* feat: GameWorldConfig

* fix: Open io.rpg.model module to gson

* TO REVERT: modify app entry class due to some issues with sdk

* chore: Add mock top level class of application

* feat: Initial ConfigLoader impl

* feat: toString method for GameWorldConfig

* feat: Log GameWorldConfig after deserialization

* chore: Add mock game configuration for unit-testing

* chore: Expose model classes to Gson

* Fix: Adjustments to make Gson work

* feat: ConfigLoader#loadLocation

* test: Add initial tests for ConfigLoader

* test: Add ConfigLoaderTest#LocationConfigIsLoadedProperly test

* chore: Update MockTest

* chore: Update configuration files

* chore: Remove not-up-to-date test

* chore: Improve ConfigLoader#load method

* chore: Improve model classes

* refract: Fix typos

Co-authored-by: adam <adam.przywieczerski@gmail.com>

Co-authored-by: Kacper Kafara <kacperkafara@gmail.com>
Co-authored-by: adam <adam.przywieczerski@gmail.com>

* @mhawryluk/rpg 82 points earned popup (#9)

* chore: Init gui

* feat: now location is centered

* feat: Add popup creation class for point earning

* feat: Read popup layout from FXML and set pointCount via controller

* refactor: Move popup classes into popups package

* chore: Add background image and improve styling of points popup

* fix: Add background image to assets

* refactor: Add comments to popup class

* refactor: Make showPopup method not static

* refactor: Turn showPopup into getPopup, make it return Stage

* test: Add test for hiding a popup when no focus

* fix: Quick fix

* fix: Remove tests for now

* fix: module-info

Co-authored-by: co012 <co123@interia.eu>
Co-authored-by: Kacper Kafara <kacperkafara@gmail.com>

Co-authored-by: co012 <co123@interia.eu>
Co-authored-by: mhawryluk <marcinhawrylukxx@gmail.com>
Co-authored-by: Kacper Kafara <kacperkafara@gmail.com>
Co-authored-by: adam <adam.przywieczerski@gmail.com>
Co-authored-by: Marcin Hawryluk <70582973+mhawryluk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants