3 Commits

Author SHA1 Message Date
Bas Antonius de Jong
b3e29a3262 Demo 7 (#314)
* Changed pom to be correct.
Fixed SnowflakeGenerator not making unique ids.
Changed naming for event implementation.
Automated id getter for events.
Added Error-Prone to all modules.
Added parents to all modules.
Added processors module.

* SoundEffectManager now generic

* Removed ResourceManager from AudioManagers

* Added linelistener to SoundEffectAsset

* commit

* commit ofzo

* Tests for SoundEffectManager

* getLegalMoves logic seems fixed //todo write better tests

* Tests toegevoegd

* punk toegevoegd

* Added shuffling on user request

* Reworked NetworkingClientManager into SRP model.

* Forgot to remove

* Improved API for dependency injection

* Some better docs.

* gui refactor

* fixed merge conflicts

* Added exceptions. Added reconnect attempts and changeable address

* Fixed event bug

* add: reversi game

* add: server chat box

* visual update

* Refactor to make Events easier to work with.

* Quick fix for closing connection.

* Documentation

* Correct client creation and user polling

* begin van audio display

* Polling music event, fires every 1 second

* Updated test.

* Updated timings

* Nuke everything on close.

* Basis Audio Display toegevoegd + standaard CSS toegevoegd

Kan nu zien hoe lang de song duurt, hoe lang ie al bezig is met draaien en de titel (-.mp3)

* Clips now also return positional information

* Skip Button

* Skip Button

* Fixes for garbage code by Omar

* Tiny fix when natural skip

* Small event fix

* Faster event schedule for PlayingMusic event

* test fix

* added method for sorting the flipped pieces by distance to Move.position

* new reversi test (both players no legal moves)

* connect4 with minimax AI

* Toegevoegd:

-Play Button + CSS + Events
-Previous Button + CSS + Events
-Changed interface for AudioResource to include a pause button which works really well with mediaplayer, however now SoundEffectAsset has an unnessescary pause

* Made it so that it indicates with the play/pause button if its paused or played

* add simple flip animations and fixed(?) server somewhat

* fixed tests

* can start game from playerlist screen

* tourney ready

* spam minder

* fixed setgamelabels

* spam minder v2

* canvas changes

* moved score out of game

* can now go to last using previous and being at the first song

* mainview false for sendchallengeview

* moved score out of game

* kleine ui fix

* updated music ma,es

* started working on the widget system

* iets met timing verkeerd temporary fix

* Fixes for garbage code by Omar

* Added replace to reduce boiler plate code

* Manually fallback to the fallback locale when a ResourceBundle is missing a resource key. Fallsback to "MISSING RESOUREC" if it's not present in the fallback.

* Removed unused import and unused parameter

* cool onhover effect for reversi

* Made the GameState enum it's own file and fixed imports

* Removed unused import

* Turned abstract methods into an interface

* Moved the Move record into it's own file, seperated from Game

* Removed unused imports

* Renamed Interface Playtable to IPlayable

* Turned Abstract Method for AI into interface

* Refactored Game to follow encapsulation principle

* Removed unused imports

* Applied encapsulation principle to TurnBasedBame.java

* Privated methods that didn't have to be public

* Reversi: made method private

* Changed checkForEarlyDraw so it doesn't need a game as input.

* Fixed warning "Warning:(27, 12) Copy constructor does not copy field 'mostRecentlyFlippedPieces'", removed unused field

* Made connect4 public method private

* half done with the widget system

* added some comments and made some methods a bit more readable

* widget system almost complete

* Functional code, is now object orientated

* Removed no more needed comments

* started a basis for the tutorials, tic tac toe is almost done with some general stuff still to do.

* rest van de tutorials toegevoegd

* resizable true

* fixed turn skip bug
fixed end score bug
now only shows legal and highlight moves when human

* Squashed commit of the following:

commit a517f2f302baa89f8ef59946a31c7bb59c56770f
Author: Stef <stbuwalda@gmail.com>
Date:   Thu Nov 27 15:43:43 2025 +0100

    Make it so the game shows "Waiting on ... to make their move". Styling isn't done but it is easier to see who's turn it is. There is a lot of structuring to do in the previous code...

* merge widgets with development

* readd previous game thread code

* Revert "readd previous game thread code"

This reverts commit d24feef73e.

* Revert "Merge remote-tracking branch 'origin/Development' into Development"

This reverts commit 59d46cb73c, reversing
changes made to 38681c5db0.

* Revert "merge widgets with development"

This reverts commit 38681c5db0.

* Fixed compilation errors

* Changed the way turns are being stored in TurnBasedGame.

* Removed views

* Added function input for enabling/disabling localization p/text

* Fix eventbus problems (#265)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Debugs for EventBus and fixed unsubscribe all (#266)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Fix music display not working (#267)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Added LoadingWidget.java for server feedback

* Replace deprecated with correct function

* Removed loading widget from Server.java

* Fixed old new EventFlow().listen() missing false as third param

* Tutorials to Dev (#264)

* Fixed garbage code

* added a pop button

* Tutorial images now use ImageAsset.java

* Added button to continue and start game. Refactors

* Refactored nextScreen runnable

* Removed unused imports

* Refactored switch statement

* Added documentation

* Removed space

* Added translations

* Added function input for enabling/disabling localization p/text

---------

Co-authored-by: ramollia <>

* Merge new framework into development (#269)

* Created a somewhat generic TurnBasedGame thread. Temporary UI that only works for TicTacToe rn. Added a LocalPlayer with the intent to add more players

* (RANDOM COMMIT) Hope it works

* Changes by bas

* Fixed dependency issues

* Fixed major issue in game deepcopy

* Merge conflict fix

* Removed unused import

* Update GTBGT branch from dev branch (#263)

* started a basis for the tutorials, tic tac toe is almost done with some general stuff still to do.

* rest van de tutorials toegevoegd

* Removed views

* Merge conflict fix

* Removed unused import

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>
Co-authored-by: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com>

* Revert "Update GTBGT branch from dev branch (#263)"

This reverts commit 9134d7e343.

* Fixed frontend not using GameController because of spaghetti code.

* Removed unused imports

* GameCanvas not implements a DrawPlayerMove that can be overridden for specific implementations

* Created an event that will request the controller to refresh the UI.

* ADDED DEPENDENCY. Renamed GameControllers to GameManagers, gameThread is not game controller.

* Attempt at adding an online player. I think it doesn't work because of unsubscriben after success not working

* Multiplayer is functional through OnlineThreadBehaviour. Empty slots are currently represented by -1 in the GUI.

* Removed sout spam, added logger than I can't get to work.

* Idek what these changes are

* Te lang geen commit, sorry

* Multiplayer seems to work pretty well now, hopefully I can add the other games soon.

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Inbetween commit of adding Reversi. This is a lot of spaghetti.

* Fixed stress tests

* Fixed typo in NetworkingGameClientHandler that prevented losses from being received

* Missed 2nd typo. Fixed

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Works now with updated EventFlow(). Unsubscribing works. ReversiAIR has an issue where a forced move returns -1 and local play back button doesn't work properly. To be fixed

* Fixed ReversiR issue that caused skip turn desync

* Fixed color mismatch with server and online main player is now correct.

* Added a bunch of java doc and small changes

* Small changes

* Added a new Thread Behaviour to test framework.

* Fixed human error I made in TicTacToeR logic...

* Fixed broken event and wrong player being presented as winner.

* Idk changes

* Fixed PR conflicts

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com>

* added back button sounds because SOMEONE fucked it up.....

* 231 connecting to server feedback (#275)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Added LoadingWidget.java for server feedback

* Imports

* fixed loadingwidget

* Workable LoadingWidget and trying to connect to server

* Removed output

* Small bug temp fix

---------

Co-authored-by: ramollia <>

* Double loading call fix, LoadingWidget docs

* Main menu loader (#277)

* LoadingWidget main menu

* fixed garbage code

* Fixed garbage code 2

* LoadWidget fix, added loading to starting the game. Removed unnecessary console output

---------

Co-authored-by: ramollia <>

* Fixed systems starting, before assets being loaded (I am retarded)

* Added infinite boolean, fixed loading behaviour at startup

* 272 remake game framework interfaces to properly represent vmc (#278)

* Cleaned up a lot of old files and renamed/remade interfaces to better suit the framework

* Broken commit

* Fixed online play

* Better file structure and closer to MVC

* Best fix for white screen at start

* Making threads verbose regarding exceptions

* Loading circle, better loading colors.

* Event bus now testable, improved UI (#284)

* turn updates

* smalle fixes aan turn updates

* better human/ai selector with bot selection and depth on TicTacToeAIR

* depth + thinktime back to AIs, along with a a specific TicTacToeAIRSleep

* fixed overlapping back and disconnect buttons

* Changed to debug instead of info

* changed the transitionNextCustom to be easier to use

* added getAllWidgets to WidgetContainer

* Correct back view

* added replacePrevious in ViewWidget

* added removeIndexFromPreviousChain

* fixed incorrect index counting

* Fixt wrong view order

* Removed todo

* Challenge popups "Fixed"

* Popups now remove themselves

* localize the ChallengePopup text

* made the game text a header instead

* fixed getAllWidgets

* Escape popup

* fixed redundant container

* Escape remove popup

* Working escape menu

* Added find functionality

* Tutorials moved to escape menu

* Escape can't be opened in mainview now

* Can now test the event bus, created testable interfaces

* Logging errors

* Made events and handlers more generic

* Suppress

* Managers now have changeable eventbus

* Tutorials fixed

* Removed import

* Single threaded eventbus

* Fixed wrong eventbus

* Removed get

* Removed old code

* Renaming

* Optimization

* Removed useless comment

* Removed unnecessary imports

* Rename

* Renaming, refactor and type safety

* Rename

* Removed import

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>

* initSystems now uses latch instead of timer. Moved single threads to Executor

* Safety

* Deleted unnecessary imports

* Code cleanup

* changed "fullscreen exit key combination" from esc to F11

* shitty fix for player selector spacing issue

* shitty fix for player selector spacing issue v2

* fixed reversi colors being switched, causing multiple issues

* Merge bitboards into development (#285)

* added new classes for the games that use bitboards instead. also combined game with turnbasedgame

* (DOES NOT COMPILE) In-between commit

* turn updates

* smalle fixes aan turn updates

* Bitboard implemented with scuffed TicTacToe translation done by game. This should be done by the view.

* Almost done with implementing bitboards. Reversi is broken and artifical players don't work yet.

* better human/ai selector with bot selection and depth on TicTacToeAIR

* fixed getLegalMoves

* depth + thinktime back to AIs, along with a a specific TicTacToeAIRSleep

* fixed overlapping back and disconnect buttons

* Changed to debug instead of info

* changed the transitionNextCustom to be easier to use

* added getAllWidgets to WidgetContainer

* Correct back view

* added replacePrevious in ViewWidget

* added removeIndexFromPreviousChain

* fixed incorrect index counting

* Fixt wrong view order

* fixed? getLegalMoves

* Everything is broken

* Removed todo

* fixed getLegalMoves & getFlips

* Challenge popups "Fixed"

* Fixed local and online play for both games

* Popups now remove themselves

* Removed souts for debugging

* localize the ChallengePopup text

* made the game text a header instead

* made more classes deepClonable.

* fixed getAllWidgets

* Added comment

* Escape popup

* fixed redundant container

* Made all network events async again

* Escape remove popup

* Working escape menu

* Removed old AI and old files. Added a new generic random AI. game no longer deals with translation.

* Drawing of board on canvas is now done from bitboards rather than translating.

* Added a method getWinner() to game interface.Controller now tells gameThreads how to deal with drawing UI and sending a move to server.

* Added find functionality

* Added a ChatGPT generated MiniMaxAI based on the old MiniMaxAI but with alpha-beta pruning and heuristics for Reversi

* Removed System-Outs to clean up console

* Update BitGameCanvas.java

* Merge fixes

* Removed unused imports

---------

Co-authored-by: ramollia <>
Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: lieght <49651652+BAFGdeJong@users.noreply.github.com>

* Better limits to generic acceptance

* Will fix tests etc later

* Merge 292 into development (#293)

Applied template method pattern to abstract player

* Added documentation to player classes and improved method names (#295)

* Init server code

* Moves

* Testing code

* Removed Generics, pray nothing breaks.

* Code cleanup

* Tests and better instantiation

* Init challenges

* Working challenges

* Fixed bugs, easy to use host button

* Fixed tic tac toe naming

* Fixes

* Removed Generics, pray nothing breaks.

* Added ability to take ServerPlayer from user

* Added pairs

* Using pairs now in server.java

* Removed space in naming

* Werkt nog niet

* Fixed hasArgs

* Closable server

* Making moves works. Game notifies when game has ended.

* Partial server refactor

* Refactor done, added ability to subscribe

* Working subscription, button only subs to reversi right now

* Small improvements to usability, auto disconnect when server closes connection

* Missed a boolean

* Quick fix so more than one game can be played in succession

* Removed user from subscription if in a game

* UI fixes after game end

* TableWidget

* mcts v1

* Moved subscriptions to store

* bitboard optimization

* Collapsed interfaces from model portion

* Fixed runtime error I forgot to fix.

* Collapsed interfaces in Controller section

* Collapsed interfaces in View section

* Code readability

* bitboard fix & mcts v2 & mcts v3. v3 still in progress and v4 coming soon

* main

* 289 server demo ready (#306)

* Server update with new dev changes (#305)

* merge widgets with development

* readd previous game thread code

* Revert "readd previous game thread code"

This reverts commit d24feef73e.

* Revert "Merge remote-tracking branch 'origin/Development' into Development"

This reverts commit 59d46cb73c, reversing
changes made to 38681c5db0.

* Revert "merge widgets with development"

This reverts commit 38681c5db0.

* Merge 292 into development (#293)

Applied template method pattern to abstract player

* Added documentation to player classes and improved method names (#295)

* mcts v1

* bitboard optimization

* bitboard fix & mcts v2 & mcts v3. v3 still in progress and v4 coming soon

* main

* Hotfix for stuff

* Logging and fixed user input getting stuck

* Fixed merge mistakes

* Revert "Merge remote-tracking branch 'refs/remotes/origin/main' into Development"

This reverts commit e2132b549d, reversing
changes made to 9aefcb9b7b.

* Turn information

* legal move highlight and onhover effect added back

* 289 server (#308) Incremental server update, with working tournament and player input timeout

* Server update with new dev changes (#305)

* merge widgets with development

* readd previous game thread code

* Revert "readd previous game thread code"

This reverts commit d24feef73e.

* Revert "Merge remote-tracking branch 'origin/Development' into Development"

This reverts commit 59d46cb73c, reversing
changes made to 38681c5db0.

* Revert "merge widgets with development"

This reverts commit 38681c5db0.

* Merge 292 into development (#293)

Applied template method pattern to abstract player

* Added documentation to player classes and improved method names (#295)

* mcts v1

* bitboard optimization

* bitboard fix & mcts v2 & mcts v3. v3 still in progress and v4 coming soon

* main

---------

Co-authored-by: ramollia <>
Co-authored-by: Stef <stbuwalda@gmail.com>
Co-authored-by: Stef <48526421+StefBuwalda@users.noreply.github.com>

* Hotfix for stuff

* Logging and fixed user input getting stuck

* Fixed merge mistakes

* Working tournament

* GlobalEventBus is now async instead

* Shuffle now changeable, host can now switch tournament gametype

* Tournament results are now send back to the clients connected to the server

* Tournament now returns result to clients

* Refactored tournament to use interfaces and builders

* Removed unnecessary imports

* Tournament refactor for better naming and easier to understand code

* Starting a tournament now requires to be admin

* Request admin list

* Added admins to games

* Tournament is now without admins

* Added result comeback with a draw

* Async tournament runner

* Added back ability to shuffle matchmaker

* Moved scoring calculation into scoring system

* Tournament now uses propper builder pattern

* Null handling

* Removed input mistake, removed print

* Refactored Tournament to use matchExecutor and ResultBroadcaster. Added turnTime and players are now added through Tournament creation instead of on MatchMaker/ScoreSystem creation

* Added shuffle to builder

* Removed unnecessary throw

* More adaptable scoring system

* Moved async runner to virtual thread

* Timeout added

* AI player given time change

---------

Co-authored-by: Stef <stbuwalda@gmail.com>
Co-authored-by: Stef <48526421+StefBuwalda@users.noreply.github.com>

* update mcts, incremental merge (#311)

* mcts v1, v2, v3, v4 done. v5 wip

* update mcts

* mcts v1, v2, v3, v4 done. v5 wip

* update mcts

* Merge changes on dev

* update mcts

---------

Co-authored-by: ramollia <>

* Research Experiment Data generator

* added visual score to reversi

* New CSV structure thats cleaner, the code in AITest is also cleaner

* implement solved

* fixed things

* saving games data to games.csv

* readded the exploration constant

* changed the way multithreading worked

* Better data collection for overnight run

* Infinite game collection

* Correct time data visualization effect on timetable lookup for data collection purposes

* Back to 10ms

* m4 nu 8 threads

* AI data now correct

* Data collection fixes

* name fixes

* AI wait fixes

* Added thread test

* Small thread count fix

* Fixes

* name fixes

* fixed extra wait time for threads

* readded threads argument

* Parameters added to tests

* Moved back in threads

* AI Thread fixes

---------

Co-authored-by: Ticho Hidding <tichohidding@gmail.com>
Co-authored-by: Stef <stbuwalda@gmail.com>
Co-authored-by: michiel <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <@>
Co-authored-by: ramollia <>
Co-authored-by: tichohidding <58555714+tichohidding@users.noreply.github.com>
Co-authored-by: Stef <48526421+StefBuwalda@users.noreply.github.com>
2026-01-25 12:13:21 +01:00
Bas Antonius de Jong
429e5bc90b Demo 6
* Server update with new dev changes (#305)

* merge widgets with development

* readd previous game thread code

* Revert "readd previous game thread code"

This reverts commit d24feef73e.

* Revert "Merge remote-tracking branch 'origin/Development' into Development"

This reverts commit 59d46cb73c, reversing
changes made to 38681c5db0.

* Revert "merge widgets with development"

This reverts commit 38681c5db0.

* Merge 292 into development (#293)

Applied template method pattern to abstract player

* Added documentation to player classes and improved method names (#295)

* mcts v1

* bitboard optimization

* bitboard fix & mcts v2 & mcts v3. v3 still in progress and v4 coming soon

* main

* Hotfix for stuff

* Logging and fixed user input getting stuck

* Fixed merge mistakes (#307)

* fast server connection

* Fixed bugs and oversights

* Renamed asset folder to resource, made resourceLoader more robust. Completed some TODO's, formatting

* AppSettings now also get loaded into the assetmanager

* start to reversi logic

* legal moves now get highlighted in red

* Moves flip dots. all tests pass. can play reversi local.

* Working state. Split AudioManager into 3 different branches for easier testing and srp

* Reworked to now use better defined generics and easier to use API. Added AudioResource to be used in changing volume

* Made all of the updated classes more generic for better flexibility in unittesting

* Added more flexible dependency injection to MusicManager for unittesting. Moved to event driven design for less complex code and lower runtime complexity.

* Split SoundEffectManager from AudioManager. (#171)

Clips no longer create a new clip instance each time they are played.  A singular clip is made for each resource and is opened/closed when loaded/unloaded. When a clip is played that is already playing it'll stop playback and start again. Clip volume handling isn't done very well.

* Unit tests for MusicManager.java

* Hotfix for loading clip volume issue (#174)

* Fixed AudioVolumemanager, all volumes calculations are now made in VolumeTypes enum

* Added ability to remove a manager from VolumeTypes

* Removed file no longer in use

* Fixed grammer and spelling mistakes

* Renamed VOLUME to MASTERVOLUME for better naming

* Minor changes in API design

* Renamed VolumeTypes to VolumeControl. Made it thread safe. Added docs to VolumeControl and co.
removed .updateAllVolumes() in favor of auto updating inside enum instead

* Added ErrorProne for potential bugs. Fixed potential bugs.

* Small fixes.

* Removed no more needed code.

* Finished todo's

* Moved restrictedAPI to future release

* Finished todo's

* Moved restrictedAPI to future release

* Changed pom to be correct.
Fixed SnowflakeGenerator not making unique ids.
Changed naming for event implementation.
Automated id getter for events.
Added Error-Prone to all modules.
Added parents to all modules.
Added processors module.

* SoundEffectManager now generic

* Removed ResourceManager from AudioManagers

* Added linelistener to SoundEffectAsset

* commit

* commit ofzo

* Tests for SoundEffectManager

* getLegalMoves logic seems fixed //todo write better tests

* Tests toegevoegd

* punk toegevoegd

* Added shuffling on user request

* Reworked NetworkingClientManager into SRP model.

* Forgot to remove

* Improved API for dependency injection

* Some better docs.

* gui refactor

* fixed merge conflicts

* Added exceptions. Added reconnect attempts and changeable address

* Fixed event bug

* add: reversi game

* add: server chat box

* visual update

* Refactor to make Events easier to work with.

* Quick fix for closing connection.

* Documentation

* Correct client creation and user polling

* begin van audio display

* Polling music event, fires every 1 second

* Updated test.

* Updated timings

* Nuke everything on close.

* Basis Audio Display toegevoegd + standaard CSS toegevoegd

Kan nu zien hoe lang de song duurt, hoe lang ie al bezig is met draaien en de titel (-.mp3)

* Clips now also return positional information

* Skip Button

* Skip Button

* Fixes for garbage code by Omar

* Tiny fix when natural skip

* Small event fix

* Faster event schedule for PlayingMusic event

* test fix

* added method for sorting the flipped pieces by distance to Move.position

* new reversi test (both players no legal moves)

* connect4 with minimax AI

* Toegevoegd:

-Play Button + CSS + Events
-Previous Button + CSS + Events
-Changed interface for AudioResource to include a pause button which works really well with mediaplayer, however now SoundEffectAsset has an unnessescary pause

* Made it so that it indicates with the play/pause button if its paused or played

* add simple flip animations and fixed(?) server somewhat

* fixed tests

* can start game from playerlist screen

* tourney ready

* spam minder

* fixed setgamelabels

* spam minder v2

* canvas changes

* moved score out of game

* can now go to last using previous and being at the first song

* mainview false for sendchallengeview

* moved score out of game

* kleine ui fix

* updated music ma,es

* started working on the widget system

* iets met timing verkeerd temporary fix

* Fixes for garbage code by Omar

* Added replace to reduce boiler plate code

* Manually fallback to the fallback locale when a ResourceBundle is missing a resource key. Fallsback to "MISSING RESOUREC" if it's not present in the fallback.

* Removed unused import and unused parameter

* cool onhover effect for reversi

* Made the GameState enum it's own file and fixed imports

* Removed unused import

* Turned abstract methods into an interface

* Moved the Move record into it's own file, seperated from Game

* Removed unused imports

* Renamed Interface Playtable to IPlayable

* Turned Abstract Method for AI into interface

* Refactored Game to follow encapsulation principle

* Removed unused imports

* Applied encapsulation principle to TurnBasedBame.java

* Privated methods that didn't have to be public

* Reversi: made method private

* Changed checkForEarlyDraw so it doesn't need a game as input.

* Fixed warning "Warning:(27, 12) Copy constructor does not copy field 'mostRecentlyFlippedPieces'", removed unused field

* Made connect4 public method private

* half done with the widget system

* added some comments and made some methods a bit more readable

* widget system almost complete

* Functional code, is now object orientated

* Removed no more needed comments

* started a basis for the tutorials, tic tac toe is almost done with some general stuff still to do.

* rest van de tutorials toegevoegd

* resizable true

* fixed turn skip bug
fixed end score bug
now only shows legal and highlight moves when human

* Squashed commit of the following:

commit a517f2f302baa89f8ef59946a31c7bb59c56770f
Author: Stef <stbuwalda@gmail.com>
Date:   Thu Nov 27 15:43:43 2025 +0100

    Make it so the game shows "Waiting on ... to make their move". Styling isn't done but it is easier to see who's turn it is. There is a lot of structuring to do in the previous code...

* merge widgets with development

* readd previous game thread code

* Revert "readd previous game thread code"

This reverts commit d24feef73e.

* Revert "Merge remote-tracking branch 'origin/Development' into Development"

This reverts commit 59d46cb73c, reversing
changes made to 38681c5db0.

* Revert "merge widgets with development"

This reverts commit 38681c5db0.

* Fixed compilation errors

* Changed the way turns are being stored in TurnBasedGame.

* Removed views

* Added function input for enabling/disabling localization p/text

* Fix eventbus problems (#265)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Debugs for EventBus and fixed unsubscribe all (#266)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Fix music display not working (#267)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Added LoadingWidget.java for server feedback

* Replace deprecated with correct function

* Removed loading widget from Server.java

* Fixed old new EventFlow().listen() missing false as third param

* Tutorials to Dev (#264)

* Fixed garbage code

* added a pop button

* Tutorial images now use ImageAsset.java

* Added button to continue and start game. Refactors

* Refactored nextScreen runnable

* Removed unused imports

* Refactored switch statement

* Added documentation

* Removed space

* Added translations

* Added function input for enabling/disabling localization p/text

---------

Co-authored-by: ramollia <>

* Merge new framework into development (#269)

* Created a somewhat generic TurnBasedGame thread. Temporary UI that only works for TicTacToe rn. Added a LocalPlayer with the intent to add more players

* (RANDOM COMMIT) Hope it works

* Changes by bas

* Fixed dependency issues

* Fixed major issue in game deepcopy

* Merge conflict fix

* Removed unused import

* Update GTBGT branch from dev branch (#263)

* started a basis for the tutorials, tic tac toe is almost done with some general stuff still to do.

* rest van de tutorials toegevoegd

* Removed views

* Merge conflict fix

* Removed unused import

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>
Co-authored-by: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com>

* Revert "Update GTBGT branch from dev branch (#263)"

This reverts commit 9134d7e343.

* Fixed frontend not using GameController because of spaghetti code.

* Removed unused imports

* GameCanvas not implements a DrawPlayerMove that can be overridden for specific implementations

* Created an event that will request the controller to refresh the UI.

* ADDED DEPENDENCY. Renamed GameControllers to GameManagers, gameThread is not game controller.

* Attempt at adding an online player. I think it doesn't work because of unsubscriben after success not working

* Multiplayer is functional through OnlineThreadBehaviour. Empty slots are currently represented by -1 in the GUI.

* Removed sout spam, added logger than I can't get to work.

* Idek what these changes are

* Te lang geen commit, sorry

* Multiplayer seems to work pretty well now, hopefully I can add the other games soon.

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Inbetween commit of adding Reversi. This is a lot of spaghetti.

* Fixed stress tests

* Fixed typo in NetworkingGameClientHandler that prevented losses from being received

* Missed 2nd typo. Fixed

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Works now with updated EventFlow(). Unsubscribing works. ReversiAIR has an issue where a forced move returns -1 and local play back button doesn't work properly. To be fixed

* Fixed ReversiR issue that caused skip turn desync

* Fixed color mismatch with server and online main player is now correct.

* Added a bunch of java doc and small changes

* Small changes

* Added a new Thread Behaviour to test framework.

* Fixed human error I made in TicTacToeR logic...

* Fixed broken event and wrong player being presented as winner.

* Idk changes

* Fixed PR conflicts

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com>

* added back button sounds because SOMEONE fucked it up.....

* 231 connecting to server feedback (#275)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Added LoadingWidget.java for server feedback

* Imports

* fixed loadingwidget

* Workable LoadingWidget and trying to connect to server

* Removed output

* Small bug temp fix

---------

Co-authored-by: ramollia <>

* Double loading call fix, LoadingWidget docs

* Main menu loader (#277)

* LoadingWidget main menu

* fixed garbage code

* Fixed garbage code 2

* LoadWidget fix, added loading to starting the game. Removed unnecessary console output

---------

Co-authored-by: ramollia <>

* Fixed systems starting, before assets being loaded (I am retarded)

* Added infinite boolean, fixed loading behaviour at startup

* 272 remake game framework interfaces to properly represent vmc (#278)

* Cleaned up a lot of old files and renamed/remade interfaces to better suit the framework

* Broken commit

* Fixed online play

* Better file structure and closer to MVC

* Best fix for white screen at start

* Making threads verbose regarding exceptions

* Loading circle, better loading colors.

* Event bus now testable, improved UI (#284)

* turn updates

* smalle fixes aan turn updates

* better human/ai selector with bot selection and depth on TicTacToeAIR

* depth + thinktime back to AIs, along with a a specific TicTacToeAIRSleep

* fixed overlapping back and disconnect buttons

* Changed to debug instead of info

* changed the transitionNextCustom to be easier to use

* added getAllWidgets to WidgetContainer

* Correct back view

* added replacePrevious in ViewWidget

* added removeIndexFromPreviousChain

* fixed incorrect index counting

* Fixt wrong view order

* Removed todo

* Challenge popups "Fixed"

* Popups now remove themselves

* localize the ChallengePopup text

* made the game text a header instead

* fixed getAllWidgets

* Escape popup

* fixed redundant container

* Escape remove popup

* Working escape menu

* Added find functionality

* Tutorials moved to escape menu

* Escape can't be opened in mainview now

* Can now test the event bus, created testable interfaces

* Logging errors

* Made events and handlers more generic

* Suppress

* Managers now have changeable eventbus

* Tutorials fixed

* Removed import

* Single threaded eventbus

* Fixed wrong eventbus

* Removed get

* Removed old code

* Renaming

* Optimization

* Removed useless comment

* Removed unnecessary imports

* Rename

* Renaming, refactor and type safety

* Rename

* Removed import

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>

* initSystems now uses latch instead of timer. Moved single threads to Executor

* Safety

* Deleted unnecessary imports

* Code cleanup

* changed "fullscreen exit key combination" from esc to F11

* shitty fix for player selector spacing issue

* shitty fix for player selector spacing issue v2

* fixed reversi colors being switched, causing multiple issues

* Merge bitboards into development (#285)

* added new classes for the games that use bitboards instead. also combined game with turnbasedgame

* (DOES NOT COMPILE) In-between commit

* turn updates

* smalle fixes aan turn updates

* Bitboard implemented with scuffed TicTacToe translation done by game. This should be done by the view.

* Almost done with implementing bitboards. Reversi is broken and artifical players don't work yet.

* better human/ai selector with bot selection and depth on TicTacToeAIR

* fixed getLegalMoves

* depth + thinktime back to AIs, along with a a specific TicTacToeAIRSleep

* fixed overlapping back and disconnect buttons

* Changed to debug instead of info

* changed the transitionNextCustom to be easier to use

* added getAllWidgets to WidgetContainer

* Correct back view

* added replacePrevious in ViewWidget

* added removeIndexFromPreviousChain

* fixed incorrect index counting

* Fixt wrong view order

* fixed? getLegalMoves

* Everything is broken

* Removed todo

* fixed getLegalMoves & getFlips

* Challenge popups "Fixed"

* Fixed local and online play for both games

* Popups now remove themselves

* Removed souts for debugging

* localize the ChallengePopup text

* made the game text a header instead

* made more classes deepClonable.

* fixed getAllWidgets

* Added comment

* Escape popup

* fixed redundant container

* Made all network events async again

* Escape remove popup

* Working escape menu

* Removed old AI and old files. Added a new generic random AI. game no longer deals with translation.

* Drawing of board on canvas is now done from bitboards rather than translating.

* Added a method getWinner() to game interface.Controller now tells gameThreads how to deal with drawing UI and sending a move to server.

* Added find functionality

* Added a ChatGPT generated MiniMaxAI based on the old MiniMaxAI but with alpha-beta pruning and heuristics for Reversi

* Removed System-Outs to clean up console

* Update BitGameCanvas.java

* Merge fixes

* Removed unused imports

---------

Co-authored-by: ramollia <>
Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: lieght <49651652+BAFGdeJong@users.noreply.github.com>

* Better limits to generic acceptance

* Will fix tests etc later

* Merge 292 into development (#293)

Applied template method pattern to abstract player

* Added documentation to player classes and improved method names (#295)

* Init server code

* Moves

* Testing code

* Removed Generics, pray nothing breaks.

* Code cleanup

* Tests and better instantiation

* Init challenges

* Working challenges

* Fixed bugs, easy to use host button

* Fixed tic tac toe naming

* Fixes

* Removed Generics, pray nothing breaks.

* Added ability to take ServerPlayer from user

* Added pairs

* Using pairs now in server.java

* Removed space in naming

* Werkt nog niet

* Fixed hasArgs

* Closable server

* Making moves works. Game notifies when game has ended.

* Partial server refactor

* Refactor done, added ability to subscribe

* Working subscription, button only subs to reversi right now

* Small improvements to usability, auto disconnect when server closes connection

* Missed a boolean

* Quick fix so more than one game can be played in succession

* Removed user from subscription if in a game

* UI fixes after game end

* TableWidget

* mcts v1

* Moved subscriptions to store

* bitboard optimization

* Collapsed interfaces from model portion

* Fixed runtime error I forgot to fix.

* Collapsed interfaces in Controller section

* Collapsed interfaces in View section

* Code readability

* bitboard fix & mcts v2 & mcts v3. v3 still in progress and v4 coming soon

* main

* 289 server demo ready (#306)

* Server update with new dev changes (#305)

* merge widgets with development

* readd previous game thread code

* Revert "readd previous game thread code"

This reverts commit d24feef73e.

* Revert "Merge remote-tracking branch 'origin/Development' into Development"

This reverts commit 59d46cb73c, reversing
changes made to 38681c5db0.

* Revert "merge widgets with development"

This reverts commit 38681c5db0.

* Merge 292 into development (#293)

Applied template method pattern to abstract player

* Added documentation to player classes and improved method names (#295)

* mcts v1

* bitboard optimization

* bitboard fix & mcts v2 & mcts v3. v3 still in progress and v4 coming soon

* main

* Hotfix for stuff

* Logging and fixed user input getting stuck

* Fixed merge mistakes

* Revert "Merge remote-tracking branch 'refs/remotes/origin/main' into Development"

This reverts commit e2132b549d, reversing
changes made to 9aefcb9b7b.

---------

Co-authored-by: ramollia <@>
Co-authored-by: Ticho Hidding <tichohidding@gmail.com>
Co-authored-by: Stef <48526421+StefBuwalda@users.noreply.github.com>
Co-authored-by: Stef <stbuwalda@gmail.com>
Co-authored-by: michiel <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>
Co-authored-by: tichohidding <58555714+tichohidding@users.noreply.github.com>
2026-01-09 19:30:49 +01:00
Bas Antonius de Jong
8146be16ed Demo 5
* fast server connection

* Fixed bugs and oversights

* Renamed asset folder to resource, made resourceLoader more robust. Completed some TODO's, formatting

* AppSettings now also get loaded into the assetmanager

* start to reversi logic

* legal moves now get highlighted in red

* Moves flip dots. all tests pass. can play reversi local.

* Working state. Split AudioManager into 3 different branches for easier testing and srp

* Reworked to now use better defined generics and easier to use API. Added AudioResource to be used in changing volume

* Made all of the updated classes more generic for better flexibility in unittesting

* Added more flexible dependency injection to MusicManager for unittesting. Moved to event driven design for less complex code and lower runtime complexity.

* Split SoundEffectManager from AudioManager. (#171)

Clips no longer create a new clip instance each time they are played.  A singular clip is made for each resource and is opened/closed when loaded/unloaded. When a clip is played that is already playing it'll stop playback and start again. Clip volume handling isn't done very well.

* Unit tests for MusicManager.java

* Hotfix for loading clip volume issue (#174)

* Fixed AudioVolumemanager, all volumes calculations are now made in VolumeTypes enum

* Added ability to remove a manager from VolumeTypes

* Removed file no longer in use

* Fixed grammer and spelling mistakes

* Renamed VOLUME to MASTERVOLUME for better naming

* Minor changes in API design

* Renamed VolumeTypes to VolumeControl. Made it thread safe. Added docs to VolumeControl and co.
removed .updateAllVolumes() in favor of auto updating inside enum instead

* Added ErrorProne for potential bugs. Fixed potential bugs.

* Small fixes.

* Removed no more needed code.

* Finished todo's

* Moved restrictedAPI to future release

* Finished todo's

* Moved restrictedAPI to future release

* Changed pom to be correct.
Fixed SnowflakeGenerator not making unique ids.
Changed naming for event implementation.
Automated id getter for events.
Added Error-Prone to all modules.
Added parents to all modules.
Added processors module.

* SoundEffectManager now generic

* Removed ResourceManager from AudioManagers

* Added linelistener to SoundEffectAsset

* commit

* commit ofzo

* Tests for SoundEffectManager

* getLegalMoves logic seems fixed //todo write better tests

* Tests toegevoegd

* punk toegevoegd

* Added shuffling on user request

* Reworked NetworkingClientManager into SRP model.

* Forgot to remove

* Improved API for dependency injection

* Some better docs.

* gui refactor

* fixed merge conflicts

* Added exceptions. Added reconnect attempts and changeable address

* Fixed event bug

* add: reversi game

* add: server chat box

* visual update

* Refactor to make Events easier to work with.

* Quick fix for closing connection.

* Documentation

* Correct client creation and user polling

* begin van audio display

* Polling music event, fires every 1 second

* Updated test.

* Updated timings

* Nuke everything on close.

* Basis Audio Display toegevoegd + standaard CSS toegevoegd

Kan nu zien hoe lang de song duurt, hoe lang ie al bezig is met draaien en de titel (-.mp3)

* Clips now also return positional information

* Skip Button

* Skip Button

* Fixes for garbage code by Omar

* Tiny fix when natural skip

* Small event fix

* Faster event schedule for PlayingMusic event

* test fix

* added method for sorting the flipped pieces by distance to Move.position

* new reversi test (both players no legal moves)

* connect4 with minimax AI

* Toegevoegd:

-Play Button + CSS + Events
-Previous Button + CSS + Events
-Changed interface for AudioResource to include a pause button which works really well with mediaplayer, however now SoundEffectAsset has an unnessescary pause

* Made it so that it indicates with the play/pause button if its paused or played

* add simple flip animations and fixed(?) server somewhat

* fixed tests

* can start game from playerlist screen

* tourney ready

* spam minder

* fixed setgamelabels

* spam minder v2

* canvas changes

* moved score out of game

* can now go to last using previous and being at the first song

* mainview false for sendchallengeview

* moved score out of game

* kleine ui fix

* updated music ma,es

* started working on the widget system

* iets met timing verkeerd temporary fix

* Fixes for garbage code by Omar

* Added replace to reduce boiler plate code

* Manually fallback to the fallback locale when a ResourceBundle is missing a resource key. Fallsback to "MISSING RESOUREC" if it's not present in the fallback.

* Removed unused import and unused parameter

* cool onhover effect for reversi

* Made the GameState enum it's own file and fixed imports

* Removed unused import

* Turned abstract methods into an interface

* Moved the Move record into it's own file, seperated from Game

* Removed unused imports

* Renamed Interface Playtable to IPlayable

* Turned Abstract Method for AI into interface

* Refactored Game to follow encapsulation principle

* Removed unused imports

* Applied encapsulation principle to TurnBasedBame.java

* Privated methods that didn't have to be public

* Reversi: made method private

* Changed checkForEarlyDraw so it doesn't need a game as input.

* Fixed warning "Warning:(27, 12) Copy constructor does not copy field 'mostRecentlyFlippedPieces'", removed unused field

* Made connect4 public method private

* half done with the widget system

* added some comments and made some methods a bit more readable

* widget system almost complete

* Functional code, is now object orientated

* Removed no more needed comments

* started a basis for the tutorials, tic tac toe is almost done with some general stuff still to do.

* rest van de tutorials toegevoegd

* resizable true

* fixed turn skip bug
fixed end score bug
now only shows legal and highlight moves when human

* Squashed commit of the following:

commit a517f2f302baa89f8ef59946a31c7bb59c56770f
Author: Stef <stbuwalda@gmail.com>
Date:   Thu Nov 27 15:43:43 2025 +0100

    Make it so the game shows "Waiting on ... to make their move". Styling isn't done but it is easier to see who's turn it is. There is a lot of structuring to do in the previous code...

* Fixed compilation errors

* Changed the way turns are being stored in TurnBasedGame.

* Removed views

* Added function input for enabling/disabling localization p/text

* Fix eventbus problems (#265)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Debugs for EventBus and fixed unsubscribe all (#266)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Fix music display not working (#267)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Added LoadingWidget.java for server feedback

* Replace deprecated with correct function

* Removed loading widget from Server.java

* Fixed old new EventFlow().listen() missing false as third param

* Tutorials to Dev (#264)

* Fixed garbage code

* added a pop button

* Tutorial images now use ImageAsset.java

* Added button to continue and start game. Refactors

* Refactored nextScreen runnable

* Removed unused imports

* Refactored switch statement

* Added documentation

* Removed space

* Added translations

* Added function input for enabling/disabling localization p/text

---------

Co-authored-by: ramollia <>

* Merge new framework into development (#269)

* Created a somewhat generic TurnBasedGame thread. Temporary UI that only works for TicTacToe rn. Added a LocalPlayer with the intent to add more players

* (RANDOM COMMIT) Hope it works

* Changes by bas

* Fixed dependency issues

* Fixed major issue in game deepcopy

* Merge conflict fix

* Removed unused import

* Update GTBGT branch from dev branch (#263)

* started a basis for the tutorials, tic tac toe is almost done with some general stuff still to do.

* rest van de tutorials toegevoegd

* Removed views

* Merge conflict fix

* Removed unused import

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>
Co-authored-by: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com>

* Revert "Update GTBGT branch from dev branch (#263)"

This reverts commit 9134d7e343.

* Fixed frontend not using GameController because of spaghetti code.

* Removed unused imports

* GameCanvas not implements a DrawPlayerMove that can be overridden for specific implementations

* Created an event that will request the controller to refresh the UI.

* ADDED DEPENDENCY. Renamed GameControllers to GameManagers, gameThread is not game controller.

* Attempt at adding an online player. I think it doesn't work because of unsubscriben after success not working

* Multiplayer is functional through OnlineThreadBehaviour. Empty slots are currently represented by -1 in the GUI.

* Removed sout spam, added logger than I can't get to work.

* Idek what these changes are

* Te lang geen commit, sorry

* Multiplayer seems to work pretty well now, hopefully I can add the other games soon.

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Inbetween commit of adding Reversi. This is a lot of spaghetti.

* Fixed stress tests

* Fixed typo in NetworkingGameClientHandler that prevented losses from being received

* Missed 2nd typo. Fixed

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Works now with updated EventFlow(). Unsubscribing works. ReversiAIR has an issue where a forced move returns -1 and local play back button doesn't work properly. To be fixed

* Fixed ReversiR issue that caused skip turn desync

* Fixed color mismatch with server and online main player is now correct.

* Added a bunch of java doc and small changes

* Small changes

* Added a new Thread Behaviour to test framework.

* Fixed human error I made in TicTacToeR logic...

* Fixed broken event and wrong player being presented as winner.

* Idk changes

* Fixed PR conflicts

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com>

* added back button sounds because SOMEONE fucked it up.....

* 231 connecting to server feedback (#275)

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Added LoadingWidget.java for server feedback

* Imports

* fixed loadingwidget

* Workable LoadingWidget and trying to connect to server

* Removed output

* Small bug temp fix

---------

Co-authored-by: ramollia <>

* Double loading call fix, LoadingWidget docs

* Main menu loader (#277)

* LoadingWidget main menu

* fixed garbage code

* Fixed garbage code 2

* LoadWidget fix, added loading to starting the game. Removed unnecessary console output

---------

Co-authored-by: ramollia <>

* Fixed systems starting, before assets being loaded (I am retarded)

* Added infinite boolean, fixed loading behaviour at startup

* 272 remake game framework interfaces to properly represent vmc (#278)

* Cleaned up a lot of old files and renamed/remade interfaces to better suit the framework

* Broken commit

* Fixed online play

* Better file structure and closer to MVC

* Best fix for white screen at start

* Making threads verbose regarding exceptions

* Loading circle, better loading colors.

* Event bus now testable, improved UI (#284)

* turn updates

* smalle fixes aan turn updates

* better human/ai selector with bot selection and depth on TicTacToeAIR

* depth + thinktime back to AIs, along with a a specific TicTacToeAIRSleep

* fixed overlapping back and disconnect buttons

* Changed to debug instead of info

* changed the transitionNextCustom to be easier to use

* added getAllWidgets to WidgetContainer

* Correct back view

* added replacePrevious in ViewWidget

* added removeIndexFromPreviousChain

* fixed incorrect index counting

* Fixt wrong view order

* Removed todo

* Challenge popups "Fixed"

* Popups now remove themselves

* localize the ChallengePopup text

* made the game text a header instead

* fixed getAllWidgets

* Escape popup

* fixed redundant container

* Escape remove popup

* Working escape menu

* Added find functionality

* Tutorials moved to escape menu

* Escape can't be opened in mainview now

* Can now test the event bus, created testable interfaces

* Logging errors

* Made events and handlers more generic

* Suppress

* Managers now have changeable eventbus

* Tutorials fixed

* Removed import

* Single threaded eventbus

* Fixed wrong eventbus

* Removed get

* Removed old code

* Renaming

* Optimization

* Removed useless comment

* Removed unnecessary imports

* Rename

* Renaming, refactor and type safety

* Rename

* Removed import

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>

* initSystems now uses latch instead of timer. Moved single threads to Executor

* Safety

* Deleted unnecessary imports

* Code cleanup

* changed "fullscreen exit key combination" from esc to F11

* shitty fix for player selector spacing issue

* shitty fix for player selector spacing issue v2

* fixed reversi colors being switched, causing multiple issues

* Merge bitboards into development (#285)

* added new classes for the games that use bitboards instead. also combined game with turnbasedgame

* (DOES NOT COMPILE) In-between commit

* turn updates

* smalle fixes aan turn updates

* Bitboard implemented with scuffed TicTacToe translation done by game. This should be done by the view.

* Almost done with implementing bitboards. Reversi is broken and artifical players don't work yet.

* better human/ai selector with bot selection and depth on TicTacToeAIR

* fixed getLegalMoves

* depth + thinktime back to AIs, along with a a specific TicTacToeAIRSleep

* fixed overlapping back and disconnect buttons

* Changed to debug instead of info

* changed the transitionNextCustom to be easier to use

* added getAllWidgets to WidgetContainer

* Correct back view

* added replacePrevious in ViewWidget

* added removeIndexFromPreviousChain

* fixed incorrect index counting

* Fixt wrong view order

* fixed? getLegalMoves

* Everything is broken

* Removed todo

* fixed getLegalMoves & getFlips

* Challenge popups "Fixed"

* Fixed local and online play for both games

* Popups now remove themselves

* Removed souts for debugging

* localize the ChallengePopup text

* made the game text a header instead

* made more classes deepClonable.

* fixed getAllWidgets

* Added comment

* Escape popup

* fixed redundant container

* Made all network events async again

* Escape remove popup

* Working escape menu

* Removed old AI and old files. Added a new generic random AI. game no longer deals with translation.

* Drawing of board on canvas is now done from bitboards rather than translating.

* Added a method getWinner() to game interface.Controller now tells gameThreads how to deal with drawing UI and sending a move to server.

* Added find functionality

* Added a ChatGPT generated MiniMaxAI based on the old MiniMaxAI but with alpha-beta pruning and heuristics for Reversi

* Removed System-Outs to clean up console

* Update BitGameCanvas.java

* Merge fixes

* Removed unused imports

---------

Co-authored-by: ramollia <>
Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: lieght <49651652+BAFGdeJong@users.noreply.github.com>

* Better limits to generic acceptance

* Will fix tests etc later

---------

Co-authored-by: ramollia <@>
Co-authored-by: Ticho Hidding <tichohidding@gmail.com>
Co-authored-by: Stef <48526421+StefBuwalda@users.noreply.github.com>
Co-authored-by: Stef <stbuwalda@gmail.com>
Co-authored-by: michiel <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>
Co-authored-by: tichohidding <58555714+tichohidding@users.noreply.github.com>
2025-12-09 21:28:45 +01:00
323 changed files with 16323 additions and 6745 deletions

View File

@@ -1,42 +1,42 @@
name: Checks
#name: Checks
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
#on:
# push:
# branches:
# - 'main'
# pull_request:
# branches:
# - 'main'
#
#jobs:
# formatting-check:
# name: Follow Google Formatting Guidelines
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v5
# with:
# fetch-depth: 0 # Fix for incremental formatting
# - uses: actions/setup-java@v5
# with:
# java-version: '25'
# distribution: 'temurin'
# cache: maven
# - name: Run Format Check
# run: mvn spotless:check
jobs:
formatting-check:
name: Follow Google Formatting Guidelines
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fix for incremental formatting
- uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
cache: maven
- name: Run Format Check
run: mvn spotless:check
tests:
name: Unittests
runs-on: ${{ matrix.os }}
needs: formatting-check
strategy:
matrix:
os: [ubuntu-latest] #windows-latest, macos-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
cache: maven
- name: Run Unittests
run: mvn -B test
# tests:
# name: Unittests
# runs-on: ${{ matrix.os }}
# needs: formatting-check
# strategy:
# matrix:
# os: [ubuntu-latest] #windows-latest, macos-latest
# steps:
# - uses: actions/checkout@v5
# - uses: actions/setup-java@v5
# with:
# java-version: '25'
# distribution: 'temurin'
# cache: maven
# - name: Run Unittests
# run: mvn -B test

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@@ -5,14 +5,17 @@
<w>clid</w>
<w>dcompile</w>
<w>errorprone</w>
<w>español</w>
<w>flushnl</w>
<w>gaaf</w>
<w>gamelist</w>
<w>pism</w>
<w>playerlist</w>
<w>tictactoe</w>
<w>toop</w>
<w>vmoptions</w>
<w>xplugin</w>
<w>yourturn</w>
</words>
</dictionary>
</component>

4
.idea/encodings.xml generated
View File

@@ -1,12 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$APPLICATION_HOME_DIR$/bin/src/main/java" charset="UTF-8" />
<file url="file://$APPLICATION_HOME_DIR$/bin/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/app/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/app/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/framework/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/framework/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/game/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/game/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/processors/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/processors/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>

View File

@@ -2,7 +2,8 @@
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,org.toop.framework.audio.AudioPlayer,play" />
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,org.toop.framework.audio.AudioPlayer,play,java.util.Map,remove,java.util.concurrent.Executors,newSingleThreadScheduledExecutor|newFixedThreadPool|newSingleThreadExecutor" />
</inspection_tool>
<inspection_tool class="WriteOnlyObject" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ResourceBundleManager">
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_ar.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_de.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_en.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_es.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_fr.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_hi.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_it.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_ja.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_ko.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_nl.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_ru.properties" />
<file url="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_zh.properties" />
<custom-resource-bundle>
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/Localization_de.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/Localization_es.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/Localization_fr.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/Localization_it.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/Localization_nl.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/Localization_zh.properties" />
<base-name>localization</base-name>
</custom-resource-bundle>
<custom-resource-bundle>
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_ar.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_de.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_en.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_es.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_fr.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_hi.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_it.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_ja.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_ko.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_nl.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_ru.properties" />
<file value="file://$PROJECT_DIR$/app/src/main/resources/assets/localization/localization_zh.properties" />
<base-name>localization</base-name>
</custom-resource-bundle>
</component>
</project>

View File

@@ -1,8 +1,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.toop</groupId>
<artifactId>pism_app</artifactId>
<parent>
<groupId>org.toop</groupId>
<artifactId>pism</artifactId>
<version>0.1</version>
</parent>
<artifactId>app</artifactId>
<version>0.1</version>
<properties>
@@ -24,24 +29,36 @@
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.toop</groupId>
<artifactId>pism_framework</artifactId>
<version>0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.toop</groupId>
<artifactId>pism_game</artifactId>
<version>0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>25</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.42.0</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.42.0</version>
</dependency>
<dependency>
<groupId>org.toop</groupId>
<artifactId>framework</artifactId>
<version>0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.toop</groupId>
<artifactId>game</artifactId>
<version>0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
@@ -112,14 +129,56 @@
</java>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>25</source>
<target>25</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<showWarnings>true</showWarnings>
<fork>true</fork>
<executable>${java.home}/bin/javac</executable>
<source>25</source>
<target>25</target>
<release>25</release>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
<arg>
-Xplugin:ErrorProne \
</arg>
<!-- TODO-->
<!-- -Xep:RestrictedApi:ERROR \-->
<!-- -XepOpt:RestrictedApi:annotation=org.toop.annotations.TestsOnly \-->
<!-- -XepOpt:RestrictedApi:allowlistRegex=(?s).*/src/test/java/.*|.*test\.java \-->
<!-- -XepOpt:RestrictedApi:message=This API is marked @TestsOnly and shouldn't be normally used.-->
<arg>-XDcompilePolicy=simple</arg>
<arg>--should-stop=ifError=FLOW</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.42.0</version>
</path>
</annotationProcessorPaths>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.42.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,21 +1,9 @@
package org.toop;
import org.toop.app.App;
import org.toop.framework.asset.ResourceLoader;
import org.toop.framework.asset.ResourceManager;
import org.toop.framework.audio.SoundManager;
import org.toop.framework.networking.NetworkingClientManager;
import org.toop.framework.networking.NetworkingInitializationException;
public final class Main {
public static void main(String[] args) {
initSystems();
static void main(String[] args) {
App.run(args);
}
private static void initSystems() throws NetworkingInitializationException {
ResourceManager.loadAssets(new ResourceLoader("app/src/main/resources/assets"));
new Thread(NetworkingClientManager::new).start();
new Thread(SoundManager::new).start();
}
}

View File

@@ -1,167 +1,276 @@
package org.toop.app;
import java.util.Stack;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.toop.app.layer.Layer;
import org.toop.app.layer.layers.MainLayer;
import org.toop.app.layer.layers.QuitPopup;
import org.toop.framework.asset.ResourceManager;
import org.toop.framework.asset.resources.CssAsset;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.WidgetContainer;
import org.toop.app.widget.complex.LoadingWidget;
import org.toop.app.widget.display.SongDisplay;
import org.toop.app.widget.popup.EscapePopup;
import org.toop.app.widget.popup.QuitPopup;
import org.toop.app.widget.view.MainView;
import org.toop.framework.audio.*;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.eventbus.GlobalEventBus;
import org.toop.framework.networking.connection.NetworkingClientEventListener;
import org.toop.framework.networking.connection.NetworkingClientManager;
import org.toop.framework.resource.ResourceLoader;
import org.toop.framework.resource.ResourceManager;
import org.toop.framework.resource.events.AssetLoaderEvents;
import org.toop.framework.resource.resources.CssAsset;
import org.toop.framework.resource.resources.MusicAsset;
import org.toop.framework.resource.resources.SoundEffectAsset;
import org.toop.local.AppContext;
import org.toop.local.AppSettings;
public final class App extends Application {
private static Stage stage;
private static Scene scene;
private static StackPane root;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public final class App extends Application {
private static Stage stage;
private static Scene scene;
private static Stack<Layer> stack;
private static int height;
private static int width;
private static boolean isQuitting;
public static void run(String[] args) {
launch(args);
}
public static void run(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
// Start loading localization
ResourceManager.loadAssets(new ResourceLoader("app/src/main/resources/localization"));
ResourceManager.loadAssets(new ResourceLoader("app/src/main/resources/style"));
@Override
public void start(Stage stage) throws Exception {
final StackPane root = new StackPane();
final Scene scene = new Scene(root);
final StackPane root = WidgetContainer.setup();
final Scene scene = new Scene(root);
stage.setTitle(AppContext.getString("appTitle"));
stage.setWidth(1080);
stage.setHeight(720);
stage.setOpacity(0.0);
stage.setOnCloseRequest(
event -> {
event.consume();
stage.setTitle(AppContext.getString("app-title"));
stage.titleProperty().bind(AppContext.bindToKey("app-title"));
if (!isQuitting) {
quitPopup();
}
});
stage.setWidth(0);
stage.setHeight(0);
stage.setScene(scene);
stage.setResizable(false);
scene.getRoot();
stage.show();
stage.setMinWidth(1200);
stage.setMinHeight(800);
stage.setOnCloseRequest(event -> {
event.consume();
quit();
});
App.stage = stage;
App.scene = scene;
App.root = root;
stage.setScene(scene);
stage.setResizable(true);
App.stack = new Stack<>();
App.stage = stage;
App.scene = scene;
App.width = (int) stage.getWidth();
App.height = (int) stage.getHeight();
App.width = (int)stage.getWidth();
App.height = (int)stage.getHeight();
App.isQuitting = false;
AppSettings.applySettings();
final AppSettings settings = new AppSettings();
settings.applySettings();
setKeybinds(root);
new EventFlow().addPostEvent(new AudioEvents.StartBackgroundMusic()).asyncPostEvent();
activate(new MainLayer());
}
LoadingWidget loading = new LoadingWidget(Primitive.text(
"Loading...", false), 0, 0, Integer.MAX_VALUE, false, false // Just set a high default
);
public static void activate(Layer layer) {
Platform.runLater(
() -> {
popAll();
push(layer);
});
}
WidgetContainer.setCurrentView(loading);
public static void push(Layer layer) {
Platform.runLater(
() -> {
root.getChildren().addLast(layer.getLayer());
stack.push(layer);
});
}
setOnLoadingSuccess(loading);
public static void pop() {
Platform.runLater(
() -> {
root.getChildren().removeLast();
stack.pop();
EventFlow loadingFlow = new EventFlow();
isQuitting = false;
});
}
final boolean[] hasRun = {false};
loadingFlow
.listen(AssetLoaderEvents.LoadingProgressUpdate.class, e -> {
if (!hasRun[0]) {
hasRun[0] = true;
try {
Thread.sleep(100);
} catch (InterruptedException ex) {
throw new RuntimeException(ex);
}
Platform.runLater(() -> stage.setOpacity(1.0));
}
public static void popAll() {
Platform.runLater(
() -> {
final int childrenCount = root.getChildren().size();
for (int i = 0; i < childrenCount; i++) {
try {
root.getChildren().removeLast();
} catch (Exception e) {
IO.println(e);
Platform.runLater(() -> {
loading.setMaxAmount(e.isLoadingAmount());
try {
loading.setAmount(e.hasLoadedAmount());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
if (e.hasLoadedAmount() >= e.isLoadingAmount()-1) {
Platform.runLater(loading::triggerSuccess);
loadingFlow.unsubscribe("init_loading");
}
}
});
stack.removeAllElements();
});
}, false, "init_loading");
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
executor.submit(
() -> ResourceManager.loadAssets(new ResourceLoader("app/src/main/resources/assets")
));
} finally {
executor.shutdown();
}
stage.show();
}
public static void quitPopup() {
Platform.runLater(
() -> {
push(new QuitPopup());
isQuitting = true;
});
private void setKeybinds(StackPane root) {
root.addEventHandler(KeyEvent.KEY_PRESSED,event -> {
if (event.getCode() == KeyCode.ESCAPE) {
escapePopup();
}
});
stage.setFullScreenExitKeyCombination(
new KeyCodeCombination(
KeyCode.F11
)
);
}
public void escapePopup() {
if ( WidgetContainer.getCurrentView() == null
|| WidgetContainer.getCurrentView() instanceof MainView) {
return;
}
if (!Objects.requireNonNull(
WidgetContainer.find(widget -> widget instanceof QuitPopup || widget instanceof EscapePopup)
).isEmpty()) {
WidgetContainer.removeFirst(QuitPopup.class);
WidgetContainer.removeFirst(EscapePopup.class);
return;
}
EscapePopup escPopup = new EscapePopup();
escPopup.show(Pos.CENTER);
}
private void setOnLoadingSuccess(LoadingWidget loading) {
loading.setOnSuccess(() -> {
try {
initSystems();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
AppSettings.applyMusicVolumeSettings();
new EventFlow().addPostEvent(new AudioEvents.StartBackgroundMusic()).postEvent();
loading.hide();
WidgetContainer.add(Pos.CENTER, new MainView());
WidgetContainer.add(Pos.BOTTOM_RIGHT, new SongDisplay());
stage.setOnCloseRequest(event -> {
event.consume();
if (WidgetContainer.getAllWidgets().stream().anyMatch(e -> e instanceof QuitPopup)) return;
QuitPopup a = new QuitPopup();
a.show(Pos.CENTER);
});
});
}
private void initSystems() throws InterruptedException { // TODO Move to better place
final int THREAD_COUNT = 2;
CountDownLatch latch = new CountDownLatch(THREAD_COUNT);
@SuppressWarnings("resource")
ExecutorService threads = Executors.newFixedThreadPool(THREAD_COUNT);
try {
threads.submit(() -> {
new NetworkingClientEventListener(
GlobalEventBus.get(),
new NetworkingClientManager(GlobalEventBus.get()));
latch.countDown();
});
threads.submit(() -> {
MusicManager<MusicAsset> musicManager =
new MusicManager<>(
GlobalEventBus.get(),
ResourceManager.getAllOfTypeAndRemoveWrapper(MusicAsset.class),
true
);
SoundEffectManager<SoundEffectAsset> soundEffectManager =
new SoundEffectManager<>(ResourceManager.getAllOfType(SoundEffectAsset.class));
AudioVolumeManager audioVolumeManager = new AudioVolumeManager()
.registerManager(VolumeControl.MASTERVOLUME, musicManager)
.registerManager(VolumeControl.MASTERVOLUME, soundEffectManager)
.registerManager(VolumeControl.FX, soundEffectManager)
.registerManager(VolumeControl.MUSIC, musicManager);
new AudioEventListener<>(
GlobalEventBus.get(),
musicManager,
soundEffectManager,
audioVolumeManager
).initListeners("medium-button-click.wav");
latch.countDown();
});
} finally {
latch.await();
threads.shutdown();
}
}
public static void quit() {
stage.close();
}
public static void quit() {
stage.close();
System.exit(0); // TODO: This is like dropping a nuke
}
public static void reloadAll() {
stage.setTitle(AppContext.getString("appTitle"));
public static void setFullscreen(boolean fullscreen) {
stage.setFullScreen(fullscreen);
for (final Layer layer : stack) {
layer.reload();
}
}
width = (int)stage.getWidth();
height = (int)stage.getHeight();
}
public static void setFullscreen(boolean fullscreen) {
stage.setFullScreen(fullscreen);
public static void setStyle(String theme, String layoutSize) {
scene.getStylesheets().clear();
width = (int) stage.getWidth();
height = (int) stage.getHeight();
scene.getStylesheets().add(ResourceManager.<CssAsset>get("general.css").getUrl());
scene.getStylesheets().add(ResourceManager.<CssAsset>get(theme + ".css").getUrl());
scene.getStylesheets().add(ResourceManager.<CssAsset>get(layoutSize + ".css").getUrl());
}
reloadAll();
}
public static int getWidth() {
return width;
}
public static void setStyle(String theme, String layoutSize) {
final int stylesCount = scene.getStylesheets().size();
for (int i = 0; i < stylesCount; i++) {
scene.getStylesheets().removeLast();
}
scene.getStylesheets().add(ResourceManager.<CssAsset>get(theme + ".css").getUrl());
scene.getStylesheets().add(ResourceManager.<CssAsset>get(layoutSize + ".css").getUrl());
reloadAll();
}
public static int getWidth() {
return width;
}
public static int getHeight() {
return height;
}
}
public static int getHeight() {
return height;
}
}

View File

@@ -1,10 +1,54 @@
package org.toop.app;
public record GameInformation(
String[] playerName,
boolean[] isPlayerHuman,
int[] computerDifficulty,
int[] computerThinkTime,
boolean isConnectionLocal,
String serverIP,
String serverPort) {}
public class GameInformation {
public enum Type {
TICTACTOE(2, 5),
REVERSI(2, 10);
private final int playerCount;
private final int maxDepth;
Type(int playerCount, int maxDepth) {
this.playerCount = playerCount;
this.maxDepth = maxDepth;
}
public int getPlayerCount() {
return playerCount;
}
public int getMaxDepth() {
return maxDepth;
}
public String getTypeToString() {
String name = this.name();
return switch (name) {
case "TICTACTOE" -> "TicTacToe";
case "REVERSI" -> "Reversi";
case "CONNECT4" -> "Connect4";
case "BATTLESHIP" -> "Battleship";
default -> name;
};
}
}
public static class Player {
public String name = "";
public boolean isHuman = true;
public int computerDifficulty = 1;
public int computerThinkTime = 1;
}
public final Type type;
public final Player[] players;
public GameInformation(Type type) {
this.type = type;
players = new Player[type.getPlayerCount()];
for (int i = 0; i < players.length; i++) {
players[i] = new Player();
}
}
}

View File

@@ -0,0 +1,376 @@
package org.toop.app;
import javafx.application.Platform;
import javafx.geometry.Pos;
import org.toop.app.gameControllers.*;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.WidgetContainer;
import org.toop.app.widget.complex.LoadingWidget;
import org.toop.app.widget.popup.ChallengePopup;
import org.toop.app.widget.popup.ErrorPopup;
import org.toop.app.widget.popup.SendChallengePopup;
import org.toop.app.widget.view.ServerView;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.game.players.ArtificialPlayer;
import org.toop.framework.game.players.OnlinePlayer;
import org.toop.framework.gameFramework.controller.GameController;
import org.toop.framework.eventbus.GlobalEventBus;
import org.toop.framework.gameFramework.model.player.Player;
import org.toop.framework.networking.connection.clients.TournamentNetworkingClient;
import org.toop.framework.networking.connection.events.NetworkEvents;
import org.toop.framework.networking.connection.types.NetworkingConnector;
import org.toop.framework.networking.server.gateway.NettyGatewayServer;
import org.toop.game.players.ai.mcts.MCTSAI3;
import org.toop.local.AppContext;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public final class Server {
private NettyGatewayServer nettyGatewayServer;
private String user = "";
private long clientId = -1;
private final List<String> onlinePlayers = new CopyOnWriteArrayList<>();
private final List<String> gameList = new CopyOnWriteArrayList<>();
private ServerView primary;
private boolean isPolling = true;
private GameController gameController;
private final AtomicBoolean isSingleGame = new AtomicBoolean(false);
private ScheduledExecutorService scheduler;
private EventFlow connectFlow;
public static GameInformation.Type gameToType(String game) {
if (game.equalsIgnoreCase("tic-tac-toe")) {
return GameInformation.Type.TICTACTOE;
} else if (game.equalsIgnoreCase("reversi")) {
return GameInformation.Type.REVERSI;
}
return null;
}
public Server(String ip, String port, String user) {
this(ip, port, user, null);
}
// Server has to deal with ALL network related listen events. This "server" can then interact with the manager to make stuff happen.
// This prevents data races where events get sent to the game manager but the manager isn't ready yet.
public Server(String ip, String port, String user, NettyGatewayServer nettyGatewayServer) {
if (ip.split("\\.").length < 4) {
new ErrorPopup("\"" + ip + "\" " + AppContext.getString("is-not-a-valid-ip-address"));
return;
}
int parsedPort;
try {
parsedPort = Integer.parseInt(port);
} catch (NumberFormatException _) {
new ErrorPopup("\"" + port + "\" " + AppContext.getString("is-not-a-valid-port"));
return;
}
if (user.isEmpty() || user.matches("^[0-9].*")) {
new ErrorPopup(AppContext.getString("invalid-username"));
return;
}
this.nettyGatewayServer = nettyGatewayServer;
final int reconnectAttempts = 10;
LoadingWidget loading = new LoadingWidget(
Primitive.text("connecting"), 0, 0, reconnectAttempts, true, true
);
WidgetContainer.getCurrentView().transitionNextCustom(loading, "disconnect", this::disconnect);
var a = new EventFlow()
.addPostEvent(NetworkEvents.StartClient.class,
new TournamentNetworkingClient(GlobalEventBus.get()),
new NetworkingConnector(ip, parsedPort, reconnectAttempts, 1, TimeUnit.SECONDS)
);
loading.setOnFailure(() -> {
if (WidgetContainer.getCurrentView() == loading) WidgetContainer.getCurrentView().transitionPrevious();
a.unsubscribeAll();
WidgetContainer.add(
Pos.CENTER,
new ErrorPopup(AppContext.getString("connecting-failed") + " " + ip + ":" + port)
);
});
a.onResponse(NetworkEvents.CreatedIdForClient.class, e -> clientId = e.clientId(), true);
a.onResponse(NetworkEvents.StartClientResponse.class, e -> {
if (!e.successful()) {
return;
}
primary = new ServerView(user, this::sendChallenge, user, clientId);
WidgetContainer.getCurrentView().transitionNextCustom(primary, "disconnect", this::disconnect);
a.unsubscribe("connecting");
a.unsubscribe("startclient");
this.user = user;
new EventFlow().addPostEvent(new NetworkEvents.SendLogin(clientId, user)).postEvent();
startPopulateScheduler();
populateGameList();
primary.removeViewFromPreviousChain(loading);
}, false, "startclient")
.listen(
NetworkEvents.ConnectTry.class,
e -> {
if (clientId != e.clientId()) return;
Platform.runLater(
() -> {
try {
loading.setAmount(e.amount());
if (e.amount() >= loading.getMaxAmount()) {
loading.triggerFailure();
}
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
);
},
false, "connecting"
)
.postEvent();
a.listen(NetworkEvents.ChallengeResponse.class, this::handleReceivedChallenge, false, "challenge")
.listen(NetworkEvents.GameMatchResponse.class, this::handleMatchResponse, false, "match-response")
.listen(NetworkEvents.GameResultResponse.class, this::handleGameResult, false, "game-result")
.listen(NetworkEvents.GameMoveResponse.class, this::handleReceivedMove, false, "game-move")
.listen(NetworkEvents.YourTurnResponse.class, this::handleYourTurn, false, "your-turn")
.listen(NetworkEvents.ClosedConnection.class, this::closedConnection, false, "closed-connection")
.listen(NetworkEvents.TournamentResultResponse.class, this::handleTournamentResult, false, "tournament-result");
connectFlow = a;
}
private void sendChallenge(String opponent) {
if (!isPolling) return;
var a = new SendChallengePopup(this, opponent, (playerInformation, gameType) -> {
new EventFlow().addPostEvent(new NetworkEvents.SendChallenge(clientId, opponent, gameType)).postEvent();
isSingleGame.set(true);
});
a.show(Pos.CENTER);
}
private void handleMatchResponse(NetworkEvents.GameMatchResponse response) {
// TODO: Redo all of this mess
if (gameController != null) {
gameController.stop();
}
gameController = null;
// if (!isPolling) return;
String gameType = extractQuotedValue(response.gameType());
if (response.clientId() == clientId) {
isPolling = false;
onlinePlayers.clear();
final GameInformation.Type type = gameToType(gameType);
if (type == null) {
new ErrorPopup("Unsupported game type: " + gameType);
return;
}
final String startingPlayer = response.playerToMove();
final int userStartingTurn = startingPlayer.equalsIgnoreCase(user) ? 0 : 1;
final int opponentStartingTurn = 1 - userStartingTurn;
final GameInformation information = new GameInformation(type);
information.players[userStartingTurn].name = user;
information.players[opponentStartingTurn].name = response.opponent();
Player[] players = new Player[2];
players[userStartingTurn] = new ArtificialPlayer(new MCTSAI3(1000, 8), user);
players[opponentStartingTurn] = new OnlinePlayer(response.opponent());
switch (type) {
case TICTACTOE -> gameController = new TicTacToeBitController(players);
case REVERSI -> gameController = new ReversiBitController(players);
default -> new ErrorPopup("Unsupported game type.");
}
if (gameController != null) {
primary.reEnableButton(); // Re enable subscribe button
gameController.start();
isPolling = true; // Fixes server getting stuck
}
}
}
private void handleYourTurn(NetworkEvents.YourTurnResponse response) {
if (gameController == null) {
return;
}
gameController.onYourTurn(response);
}
private void handleGameResult(NetworkEvents.GameResultResponse response) {
if (gameController == null) {
return;
}
gameController.gameFinished(response);
}
private void handleTournamentResult(NetworkEvents.TournamentResultResponse response) {
IO.println(response.gameType());
IO.println(Arrays.toString(response.names()));
IO.println(Arrays.toString(response.scoreTypes()));
IO.println(Arrays.toString(response.scores().toArray()));
}
private void handleReceivedMove(NetworkEvents.GameMoveResponse response) {
if (gameController == null) {
return;
}
gameController.onMoveReceived(response);
}
private void handleReceivedChallenge(NetworkEvents.ChallengeResponse response) {
if (!isPolling) return;
String challengerName = extractQuotedValue(response.challengerName());
String gameType = extractQuotedValue(response.gameType());
final String finalGameType = gameType;
var a = new ChallengePopup(challengerName, gameType, (playerInformation) -> {
final long challengeId = Long.parseLong(response.challengeId().replaceAll("\\D", ""));
new EventFlow().addPostEvent(new NetworkEvents.SendAcceptChallenge(clientId, challengeId)).postEvent();
isSingleGame.set(true);
});
a.show(Pos.CENTER);
}
private void sendMessage(String message) {
new EventFlow().addPostEvent(new NetworkEvents.SendMessage(clientId, message)).postEvent();
}
private void disconnect() {
new EventFlow().addPostEvent(new NetworkEvents.CloseClient(clientId)).postEvent();
isPolling = false;
stopScheduler();
connectFlow.unsubscribeAll();
if (nettyGatewayServer != null) {
nettyGatewayServer.stop();
}
WidgetContainer.getCurrentView().transitionPrevious();
}
private void closedConnection(NetworkEvents.ClosedConnection e) {
new EventFlow().addPostEvent(new NetworkEvents.CloseClient(clientId)).postEvent();
isPolling = false;
stopScheduler();
connectFlow.unsubscribeAll();
if (nettyGatewayServer != null) {
nettyGatewayServer.stop();
}
WidgetContainer.getCurrentView().transitionPrevious();
WidgetContainer.add(Pos.CENTER, new ErrorPopup("Server closed connection."));
}
private void forfeitGame() {
new EventFlow().addPostEvent(new NetworkEvents.SendForfeit(clientId)).postEvent();
}
private void exitGame() {
forfeitGame();
startPopulateScheduler();
}
private void gameOver(){
startPopulateScheduler();
}
private void startPopulateScheduler() {
isPolling = true;
isSingleGame.set(false);
stopScheduler();
new EventFlow()
.listen(NetworkEvents.PlayerlistResponse.class, e -> {
if (e.clientId() == clientId) {
onlinePlayers.clear();
onlinePlayers.addAll(List.of(e.playerlist()));
onlinePlayers.removeIf(name -> name.equalsIgnoreCase(user));
primary.update(onlinePlayers);
}
}, false);
scheduler = Executors.newSingleThreadScheduledExecutor();
scheduler.scheduleAtFixedRate(() -> {
if (isPolling) {
new EventFlow().addPostEvent(new NetworkEvents.SendGetPlayerlist(clientId)).postEvent();
} else {
stopScheduler();
}
}, 0, 1, TimeUnit.SECONDS);
}
private void stopScheduler() {
if (scheduler != null && !scheduler.isShutdown()) {
scheduler.shutdownNow();
}
}
private void gamesListFromServerHandler(NetworkEvents.GamelistResponse event) {
gameList.clear();
var gl = new java.util.ArrayList<>(List.of(event.gamelist()));
gl.sort(String::compareTo);
gameList.addAll(gl);
primary.updateGameList(gl);
}
public void populateGameList() {
new EventFlow().addPostEvent(new NetworkEvents.SendGetGamelist(clientId))
.listen(NetworkEvents.GamelistResponse.class, this::gamesListFromServerHandler, true)
.postEvent();
}
public List<String> getGameList() {
return gameList;
}
private String extractQuotedValue(String s) {
int first = s.indexOf('"');
int last = s.lastIndexOf('"');
if (first >= 0 && last > first) {
return s.substring(first + 1, last);
}
return s;
}
}

View File

@@ -0,0 +1,245 @@
package org.toop.app.canvas;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.input.MouseButton;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.util.Duration;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
import org.toop.framework.gameFramework.view.GUIEvents;
import java.util.function.Consumer;
public abstract class BitGameCanvas implements GameCanvas {
protected record Cell(float x, float y, float width, float height) {
public boolean isInside(double x, double y) {
return x >= this.x && x <= this.x + width &&
y >= this.y && y <= this.y + height;
}
}
protected final Canvas canvas;
protected final GraphicsContext graphics;
protected final Color color;
protected final Color backgroundColor;
protected final int width;
protected final int height;
protected final int rowSize;
protected final int columnSize;
protected final int gapSize;
protected final boolean edges;
protected final Cell[] cells;
private Consumer<Long> onCellCLicked;
public void setOnCellClicked(Consumer<Long> onClick) {
this.onCellCLicked = onClick;
}
protected BitGameCanvas(Color color, Color backgroundColor, int width, int height, int rowSize, int columnSize, int gapSize, boolean edges) {
canvas = new Canvas(width, height);
graphics = canvas.getGraphicsContext2D();
this.onCellCLicked = (c) -> new EventFlow().addPostEvent(GUIEvents.PlayerAttemptedMove.class, c).postEvent();
this.color = color;
this.backgroundColor = backgroundColor;
this.width = width;
this.height = height;
this.rowSize = rowSize;
this.columnSize = columnSize;
this.gapSize = gapSize;
this.edges = edges;
cells = new Cell[rowSize * columnSize];
final float cellWidth = ((float) width - gapSize * rowSize - gapSize) / rowSize;
final float cellHeight = ((float) height - gapSize * columnSize - gapSize) / columnSize;
for (int y = 0; y < columnSize; y++) {
final float startY = y * cellHeight + y * gapSize + gapSize;
for (int x = 0; x < rowSize; x++) {
final float startX = x * cellWidth + x * gapSize + gapSize;
cells[x + y * rowSize] = new Cell(startX, startY, cellWidth, cellHeight);
}
}
canvas.setOnMouseClicked(event -> {
if (event.getButton() != MouseButton.PRIMARY) {
return;
}
final int column = (int) ((event.getX() / this.width) * rowSize);
final int row = (int) ((event.getY() / this.height) * columnSize);
final Cell cell = cells[column + row * rowSize];
if (cell.isInside(event.getX(), event.getY())) {
event.consume();
this.onCellCLicked.accept(1L << (column + row * rowSize));
}
});
render();
}
public void loopOverBoard(long bb, Consumer<Integer> onCell){
while (bb != 0) {
int idx = Long.numberOfTrailingZeros(bb); // index of least-significant 1-bit
onCell.accept(idx);
bb &= bb - 1; // clear LSB 1-bit
}
}
private void render() {
graphics.setFill(backgroundColor);
graphics.fillRect(0, 0, width, height);
graphics.setFill(color);
for (int x = 0; x < rowSize - 1; x++) {
final float start = cells[x].x + cells[x].width;
graphics.fillRect(start, gapSize, gapSize, height - gapSize * 2);
}
for (int y = 0; y < columnSize - 1; y++) {
final float start = cells[y * rowSize].y + cells[y * rowSize].height;
graphics.fillRect(gapSize, start, width - gapSize * 2, gapSize);
}
if (edges) {
graphics.fillRect(0, 0, width, gapSize);
graphics.fillRect(0, 0, gapSize, height);
graphics.fillRect(width - gapSize, 0, gapSize, height);
graphics.fillRect(0, height - gapSize, width, gapSize);
}
}
public void fill(Color color, int cell) {
final float x = cells[cell].x();
final float y = cells[cell].y();
final float width = cells[cell].width();
final float height = cells[cell].height();
graphics.setFill(color);
graphics.fillRect(x, y, width, height);
}
public void clear(int cell) {
final float x = cells[cell].x();
final float y = cells[cell].y();
final float width = cells[cell].width();
final float height = cells[cell].height();
graphics.clearRect(x, y, width, height);
graphics.setFill(backgroundColor);
graphics.fillRect(x, y, width, height);
}
public void clearAll() {
for (int i = 0; i < cells.length; i++) {
clear(i);
}
}
public void drawPlayerMove(int player, int move) {
final float x = cells[move].x() + gapSize;
final float y = cells[move].y() + gapSize;
final float width = cells[move].width() - gapSize * 2;
final float height = cells[move].height() - gapSize * 2;
graphics.setFill(color);
graphics.setFont(Font.font("Arial", 40)); // TODO different font and size
graphics.fillText(String.valueOf(player), x + width, y + height);
}
public void drawDot(Color color, int cell) {
final float x = cells[cell].x() + gapSize;
final float y = cells[cell].y() + gapSize;
final float width = cells[cell].width() - gapSize * 2;
final float height = cells[cell].height() - gapSize * 2;
graphics.setFill(color);
graphics.fillOval(x, y, width, height);
}
public void drawInnerDot(Color color, int cell, boolean slightlyBigger) {
final float x = cells[cell].x() + gapSize;
final float y = cells[cell].y() + gapSize;
float multiplier = slightlyBigger?1.4f:1.5f;
final float width = (cells[cell].width() - gapSize * 2)/multiplier;
final float height = (cells[cell].height() - gapSize * 2)/multiplier;
float offset = slightlyBigger?5f:4f;
graphics.setFill(color);
graphics.fillOval(x + width/offset, y + height/offset, width, height);
}
private void drawDotScaled(Color color, int cell, double scale) {
final float cx = cells[cell].x() + gapSize;
final float cy = cells[cell].y() + gapSize;
final float fullWidth = cells[cell].width() - gapSize * 2;
final float height = cells[cell].height() - gapSize * 2;
final float scaledWidth = (float)(fullWidth * scale);
final float offsetX = (fullWidth - scaledWidth) / 2;
graphics.setFill(color);
graphics.fillOval(cx + offsetX, cy, scaledWidth, height);
}
public Timeline flipDot(Color fromColor, Color toColor, int cell) {
final int steps = 60;
final long duration = 250;
final double interval = duration / (double) steps;
final Timeline timeline = new Timeline();
for (int i = 0; i <= steps; i++) {
final double t = i / (double) steps;
final KeyFrame keyFrame = new KeyFrame(Duration.millis(i * interval),
_ -> {
clear(cell);
final double scale = t <= 0.5 ? 1 - 2 * t : 2 * t - 1;
final Color currentColor = t < 0.5 ? fromColor : toColor;
drawDotScaled(currentColor, cell, scale);
}
);
timeline.getKeyFrames().add(keyFrame);
}
return timeline;
}
public Canvas getCanvas() {
return canvas;
}
}

View File

@@ -0,0 +1,7 @@
package org.toop.app.canvas;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
public interface DrawPlayerHover {
void drawPlayerHover(int player, int move, TurnBasedGame game);
}

View File

@@ -0,0 +1,5 @@
package org.toop.app.canvas;
public interface DrawPlayerMove {
void drawPlayerMove(int player, int move);
}

View File

@@ -1,130 +1,9 @@
package org.toop.app.canvas;
import java.util.function.Consumer;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.input.MouseButton;
import javafx.scene.paint.Color;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
public abstract class GameCanvas {
protected record Cell(float x, float y, float width, float height) {}
protected final Canvas canvas;
protected final GraphicsContext graphics;
protected final Color color;
protected int width;
protected int height;
protected final int rows;
protected final int columns;
protected final int gapSize;
protected final boolean edges;
protected final Cell[] cells;
protected GameCanvas(
Color color,
int width,
int height,
int rows,
int columns,
int gapSize,
boolean edges,
Consumer<Integer> onCellClicked) {
canvas = new Canvas(width, height);
graphics = canvas.getGraphicsContext2D();
this.color = color;
this.width = width;
this.height = height;
this.rows = rows;
this.columns = columns;
this.gapSize = gapSize;
this.edges = edges;
cells = new Cell[rows * columns];
final float cellWidth = ((float) width - (rows - 1) * gapSize) / rows;
final float cellHeight = ((float) height - (columns - 1) * gapSize) / columns;
for (int y = 0; y < columns; y++) {
final float startY = y * cellHeight + y * gapSize;
for (int x = 0; x < rows; x++) {
final float startX = x * cellWidth + x * gapSize;
cells[y * rows + x] = new Cell(startX, startY, cellWidth, cellHeight);
}
}
canvas.setOnMouseClicked(
event -> {
if (event.getButton() != MouseButton.PRIMARY) {
return;
}
final int column = (int) ((event.getX() / width) * rows);
final int row = (int) ((event.getY() / height) * columns);
event.consume();
onCellClicked.accept(row * rows + column);
});
render();
}
public void clear() {
graphics.clearRect(0, 0, width, height);
}
public void render() {
graphics.setFill(color);
for (int x = 1; x < rows; x++) {
graphics.fillRect(cells[x].x() - gapSize, 0, gapSize, height);
}
for (int y = 1; y < columns; y++) {
graphics.fillRect(0, cells[y * rows].y() - gapSize, width, gapSize);
}
if (edges) {
graphics.fillRect(-gapSize, 0, gapSize, height);
graphics.fillRect(0, -gapSize, width, gapSize);
graphics.fillRect(width - gapSize, 0, gapSize, height);
graphics.fillRect(0, height - gapSize, width, gapSize);
}
}
public void draw(Color color, int cell) {
final float x = cells[cell].x() + gapSize;
final float y = cells[cell].y() + gapSize;
final float width = cells[cell].width() - gapSize * 2;
final float height = cells[cell].height() - gapSize * 2;
graphics.setFill(color);
graphics.fillRect(x, y, width, height);
}
public void resize(int width, int height) {
canvas.setWidth(width);
canvas.setHeight(height);
this.width = width;
this.height = height;
clear();
render();
}
public Canvas getCanvas() {
return canvas;
}
public interface GameCanvas {
Canvas getCanvas();
void redraw(TurnBasedGame gameCopy);
}

View File

@@ -0,0 +1,68 @@
package org.toop.app.canvas;
import javafx.scene.paint.Color;
import org.toop.app.App;
import org.toop.framework.game.games.reversi.BitboardReversi;
import org.toop.framework.game.players.LocalPlayer;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
public class ReversiBitCanvas extends BitGameCanvas {
private TurnBasedGame gameCopy;
private int previousCell;
public ReversiBitCanvas() {
super(Color.GRAY, new Color(0f, 0.4f, 0.2f, 1f), (App.getHeight() / 4) * 3, (App.getHeight() / 4) * 3, 8, 8, 5, true);
canvas.setOnMouseMoved(event -> {
double mouseX = event.getX();
double mouseY = event.getY();
int cellId = -1;
BitGameCanvas.Cell hovered = null;
for (BitGameCanvas.Cell cell : cells) {
if (cell.isInside(mouseX, mouseY)) {
hovered = cell;
cellId = turnCoordsIntoCellId(mouseX, mouseY);
break;
}
}
if (hovered != null) {
checkHoverDots(hovered, cellId);
}
});
}
private int turnCoordsIntoCellId(double x, double y) {
final int column = (int) ((x / this.width) * rowSize);
final int row = (int) ((y / this.height) * columnSize);
return column + row * rowSize;
}
@Override
public void redraw(TurnBasedGame gameCopy) {
this.gameCopy = gameCopy;
clearAll();
long[] board = gameCopy.getBoard();
loopOverBoard(board[0], (i) -> drawDot(Color.WHITE, i));
loopOverBoard(board[1], (i) -> drawDot(Color.BLACK, i));
}
public void drawLegalDots(TurnBasedGame gameCopy){
long legal = gameCopy.getLegalMoves();
loopOverBoard(legal, (i) -> drawInnerDot(gameCopy.getCurrentTurn()==0?new Color(1f,1f,1f,0.65f) :new Color(0f,0f,0f,0.65f), i,false));
}
private void checkHoverDots(BitGameCanvas.Cell hovered, int cellId){
if (previousCell == cellId){
return;
}
long backflips = ((BitboardReversi)gameCopy).getFlips(1L << previousCell);
loopOverBoard(backflips, (i) -> drawInnerDot(gameCopy.getCurrentTurn()==1?Color.WHITE:Color.BLACK, i,true));
previousCell = cellId;
if (gameCopy.getPlayer(gameCopy.getCurrentTurn()) instanceof LocalPlayer) {
long legal = gameCopy.getLegalMoves();
if ((legal & (1L << cellId)) != 0) {
long flips = ((BitboardReversi) gameCopy).getFlips(1L << cellId);
loopOverBoard(flips, (i) -> drawInnerDot(gameCopy.getCurrentTurn() == 0 ? Color.WHITE : Color.BLACK, i, false));
}
}
}
}

View File

@@ -1,13 +1,36 @@
package org.toop.app.canvas;
import java.util.function.Consumer;
import javafx.scene.paint.Color;
import org.toop.app.App;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
public class TicTacToeCanvas extends GameCanvas {
public TicTacToeCanvas(Color color, int width, int height, Consumer<Integer> onCellClicked) {
super(color, width, height, 3, 3, 10, false, onCellClicked);
public class TicTacToeBitCanvas extends BitGameCanvas{
public TicTacToeBitCanvas() {
super(
Color.GRAY,
Color.TRANSPARENT,
(App.getHeight() / 4) * 3,
(App.getHeight() / 4) * 3,
3,
3,
30,
false
);
}
@Override
public void redraw(TurnBasedGame gameCopy) {
clearAll();
drawMoves(gameCopy.getBoard());
}
private void drawMoves(long[] gameBoard){
loopOverBoard(gameBoard[0], (i) -> drawX(Color.RED, i));
loopOverBoard(gameBoard[1], (i) -> drawO(Color.BLUE, i));
}
public void drawX(Color color, int cell) {
graphics.setStroke(color);
graphics.setLineWidth(gapSize);

View File

@@ -0,0 +1,172 @@
package org.toop.app.gameControllers;
import javafx.application.Platform;
import javafx.geometry.Pos;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.toop.app.canvas.GameCanvas;
import org.toop.app.canvas.ReversiBitCanvas;
import org.toop.app.widget.WidgetContainer;
import org.toop.app.widget.view.GameView;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.eventbus.GlobalEventBus;
import org.toop.framework.game.games.reversi.BitboardReversi;
import org.toop.framework.gameFramework.controller.GameController;
import org.toop.framework.gameFramework.model.game.threadBehaviour.SupportsOnlinePlay;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
import org.toop.framework.gameFramework.model.game.threadBehaviour.ThreadBehaviour;
import org.toop.framework.gameFramework.model.player.Player;
import org.toop.framework.gameFramework.view.GUIEvents;
import org.toop.framework.networking.connection.events.NetworkEvents;
import org.toop.framework.game.players.LocalPlayer;
public class GenericGameController implements GameController {
protected final EventFlow eventFlow = new EventFlow();
// Logger for logging
protected final Logger logger = LogManager.getLogger(this.getClass());
// Reference to gameView view
protected final GameView gameView;
// Reference to game canvas
protected final GameCanvas canvas;
protected final TurnBasedGame game; // Reference to game instance
private final ThreadBehaviour gameThreadBehaviour;
// TODO: Change gameType to automatically happen with either dependency injection or something else.
public GenericGameController(GameCanvas canvas, TurnBasedGame game, ThreadBehaviour gameThreadBehaviour, String gameType) {
logger.info("Creating: {}", this.getClass());
this.canvas = canvas;
this.game = game;
this.gameThreadBehaviour = gameThreadBehaviour;
// Tell thread how to send moves
this.gameThreadBehaviour.setOnSendMove(
(id, m) -> GlobalEventBus.get().post(new NetworkEvents.SendMove(id, (short)translateMove(m)))
);
// Tell thread how to update UI
this.gameThreadBehaviour.setOnUpdateUI(() -> Platform.runLater(this::updateUI));
// Change scene to game view
gameView = new GameView(null, null, null, gameType);
gameView.add(Pos.CENTER, canvas.getCanvas());
WidgetContainer.getCurrentView().transitionNext(gameView, true);
// Listen to updates
logger.info("Game controller started listening");
eventFlow
.listen(GUIEvents.GameEnded.class, this::onGameFinish, false)
.listen(GUIEvents.PlayerAttemptedMove.class, event -> {
logger.info("User attempting move {}", event.move());
logger.info("Current player's turn {}", getCurrentPlayer().getName());
logger.info("First player {}", game.getPlayer(0).getName());
logger.info("Username {}", getCurrentPlayer().getName());
logger.info("User is class {}, {}", getCurrentPlayer().getClass(), getCurrentPlayer() instanceof LocalPlayer);
if (getCurrentPlayer() instanceof LocalPlayer lp) {
try {
lp.setLastMove(event.move());
} catch (Exception e) {
IO.println(e);
}
}
}, false);
}
public void start(){
logger.info("Starting GameManager");
updateUI();
gameThreadBehaviour.start();
logger.info("GameManager started");
}
public void stop(){
logger.info("Stopping GameManager");
removeListeners();
gameThreadBehaviour.stop();
logger.info("GameManager stopped");
}
public Player getCurrentPlayer(){
return game.getPlayer(getCurrentPlayerIndex());
}
public int getCurrentPlayerIndex(){
return game.getCurrentTurn();
}
protected long translateMove(int move){
return 1L << move;
}
protected int translateMove(long move){
return Long.numberOfTrailingZeros(move);
}
private void removeListeners(){
eventFlow.unsubscribeAll();
}
private void onGameFinish(GUIEvents.GameEnded event){
logger.info("OnlineTurnBasedGame Finished");
String name = event.winner() == -1 ? null : getPlayer(event.winner()).getName();
gameView.gameOver(event.winOrTie(), name);
stop();
}
public Player getPlayer(int player){
if (player < 0 || player > game.getPlayerCount()-1){ // TODO: Make game turn player count
logger.error("Invalid player index");
throw new IllegalArgumentException("player out of range");
}
return game.getPlayer(player);
}
private boolean isOnline(){
return this.gameThreadBehaviour instanceof SupportsOnlinePlay;
}
public void onYourTurn(NetworkEvents.YourTurnResponse event){
if (isOnline()){
((SupportsOnlinePlay) this.gameThreadBehaviour).onYourTurn(event.clientId());
}
}
public void onMoveReceived(NetworkEvents.GameMoveResponse event){
if (isOnline()){
((SupportsOnlinePlay) this.gameThreadBehaviour).onMoveReceived(
translateMove(Integer.parseInt(event.move())));
}
}
public void gameFinished(NetworkEvents.GameResultResponse event){
if (isOnline()){
((SupportsOnlinePlay) this.gameThreadBehaviour).gameFinished(event.condition());
}
}
@Override
public void sendMove(long clientId, long move) {
new EventFlow().addPostEvent(NetworkEvents.SendMove.class, clientId, (short) Long.numberOfTrailingZeros(move)).asyncPostEvent();
}
@Override
public void updateUI() {
TurnBasedGame gameCopy = game.deepCopy();
canvas.redraw(gameCopy);
String gameType = game.getClass().getSimpleName().replace("Bitboard","");
gameView.nextPlayer(true, getCurrentPlayer().getName(), game.getPlayer(1-getCurrentPlayerIndex()).getName(),gameType);
if (gameType.equals("Reversi")) {
BitboardReversi reversiGame = (BitboardReversi) game;
BitboardReversi.Score reversiScore = reversiGame.getScore();
gameView.setPlayer1Score(reversiScore.black());
gameView.setPlayer2Score(reversiScore.white());
if (getCurrentPlayer() instanceof LocalPlayer) {
((ReversiBitCanvas)canvas).drawLegalDots(gameCopy);
}
}
}
}

View File

@@ -0,0 +1,29 @@
package org.toop.app.gameControllers;
import org.toop.app.canvas.ReversiBitCanvas;
import org.toop.framework.gameFramework.model.game.threadBehaviour.ThreadBehaviour;
import org.toop.framework.gameFramework.model.player.Player;
import org.toop.framework.game.gameThreads.LocalThreadBehaviour;
import org.toop.framework.game.gameThreads.OnlineThreadBehaviour;
import org.toop.framework.game.games.reversi.BitboardReversi;
import org.toop.framework.game.players.OnlinePlayer;
import java.util.Arrays;
public class ReversiBitController extends GenericGameController {
private BitboardReversi game;
public ReversiBitController(Player[] players) {
BitboardReversi game = new BitboardReversi();
game.init(players);
ThreadBehaviour thread = Arrays.stream(players).anyMatch(e -> e instanceof OnlinePlayer) ?
new OnlineThreadBehaviour(game) : new LocalThreadBehaviour(game);
super(new ReversiBitCanvas(), game, thread, "Reversi");
}
public BitboardReversi.Score getScore() {
return game.getScore();
}
}

View File

@@ -0,0 +1,23 @@
package org.toop.app.gameControllers;
import org.toop.app.canvas.TicTacToeBitCanvas;
import org.toop.framework.gameFramework.model.game.threadBehaviour.ThreadBehaviour;
import org.toop.framework.gameFramework.model.player.Player;
import org.toop.framework.game.gameThreads.LocalThreadBehaviour;
import org.toop.framework.game.gameThreads.OnlineThreadBehaviour;
import org.toop.framework.game.games.tictactoe.BitboardTicTacToe;
import org.toop.framework.game.players.OnlinePlayer;
import java.util.Arrays;
public class TicTacToeBitController extends GenericGameController {
public TicTacToeBitController(Player[] players) {
BitboardTicTacToe game = new BitboardTicTacToe();
game.init(players);
ThreadBehaviour thread = Arrays.stream(players).anyMatch(e -> e instanceof OnlinePlayer) ?
new OnlineThreadBehaviour(game) : new LocalThreadBehaviour(game);
super(new TicTacToeBitCanvas(), game, thread, "TicTacToe");
}
}

View File

@@ -1,12 +0,0 @@
package org.toop.app.layer;
import javafx.scene.Node;
import javafx.scene.layout.Region;
public abstract class Container {
public abstract Region getContainer();
public abstract void addNodes(Node... nodes);
public abstract void addContainer(Container container, boolean fill);
}

View File

@@ -1,86 +0,0 @@
package org.toop.app.layer;
import javafx.geometry.Pos;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import org.toop.app.App;
import org.toop.app.canvas.GameCanvas;
public abstract class Layer {
protected StackPane layer;
protected Region background;
protected Layer(String... backgroundStyles) {
layer = new StackPane();
background = new Region();
background.getStyleClass().addAll(backgroundStyles);
background.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE);
layer.getChildren().addLast(background);
}
protected void addContainer(
Container container,
Pos position,
int xOffset,
int yOffset,
int widthPercent,
int heightPercent) {
StackPane.setAlignment(container.getContainer(), position);
final double widthUnit = App.getWidth() / 100.0;
final double heightUnit = App.getHeight() / 100.0;
if (widthPercent > 0) {
container.getContainer().setMaxWidth(widthPercent * widthUnit);
} else {
container.getContainer().setMaxWidth(Region.USE_PREF_SIZE);
}
if (heightPercent > 0) {
container.getContainer().setMaxHeight(heightPercent * heightUnit);
} else {
container.getContainer().setMaxHeight(Region.USE_PREF_SIZE);
}
container.getContainer().setTranslateX(xOffset * widthUnit);
container.getContainer().setTranslateY(yOffset * heightUnit);
layer.getChildren().addLast(container.getContainer());
}
protected void addGameCanvas(GameCanvas canvas, Pos position, int xOffset, int yOffset) {
StackPane.setAlignment(canvas.getCanvas(), position);
final double widthUnit = App.getWidth() / 100.0;
final double heightUnit = App.getHeight() / 100.0;
canvas.getCanvas().setTranslateX(xOffset * widthUnit);
canvas.getCanvas().setTranslateY(yOffset * heightUnit);
layer.getChildren().addLast(canvas.getCanvas());
}
protected void pop() {
if (layer.getChildren().size() <= 1) {
return;
}
layer.getChildren().removeLast();
}
protected void popAll() {
final int containers = layer.getChildren().size();
for (int i = 1; i < containers; i++) {
layer.getChildren().removeLast();
}
}
public StackPane getLayer() {
return layer;
}
public abstract void reload();
}

View File

@@ -1,140 +0,0 @@
package org.toop.app.layer;
import java.util.function.Consumer;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.geometry.Orientation;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.text.Text;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
public final class NodeBuilder {
public static void addCss(Node node, String... cssClasses) {
node.getStyleClass().addAll(cssClasses);
}
public static void setCss(Node node, String... cssClasses) {
node.getStyleClass().removeAll();
node.getStyleClass().addAll(cssClasses);
}
public static Text header(String x) {
final Text element = new Text(x);
setCss(element, "text-primary", "text-header");
return element;
}
public static Text text(String x) {
final Text element = new Text(x);
setCss(element, "text-secondary", "text-normal");
return element;
}
public static Label button(String x, Runnable runnable) {
final Label element = new Label(x);
setCss(element, "button", "text-normal");
element.setOnMouseClicked(
_ -> {
new EventFlow().addPostEvent(new AudioEvents.ClickButton()).asyncPostEvent();
runnable.run();
});
return element;
}
public static Label toggle(String x1, String x2, boolean toggled, Consumer<Boolean> consumer) {
final Label element = new Label(toggled ? x2 : x1);
setCss(element, "toggle", "text-normal");
final BooleanProperty checked = new SimpleBooleanProperty(toggled);
element.setOnMouseClicked(
_ -> {
new EventFlow().addPostEvent(new AudioEvents.ClickButton()).asyncPostEvent();
checked.set(!checked.get());
if (checked.get()) {
element.setText(x1);
} else {
element.setText(x2);
}
consumer.accept(checked.get());
});
return element;
}
public static Slider slider(int max, int initial, Consumer<Integer> consumer) {
final Slider element = new Slider(0, max, initial);
setCss(element, "bg-slider-track");
element.setMinorTickCount(0);
element.setMajorTickUnit(1);
element.setBlockIncrement(1);
element.setSnapToTicks(true);
element.setShowTickLabels(true);
element.setOnMouseClicked(
_ -> {
new EventFlow().addPostEvent(new AudioEvents.ClickButton()).asyncPostEvent();
});
element.valueProperty()
.addListener(
(_, _, newValue) -> {
consumer.accept(newValue.intValue());
});
return element;
}
public static TextField input(String x, Consumer<String> consumer) {
final TextField element = new TextField(x);
setCss(element, "input", "text-normal");
element.setOnMouseClicked(
_ -> {
new EventFlow().addPostEvent(new AudioEvents.ClickButton()).asyncPostEvent();
});
element.textProperty()
.addListener(
(_, _, newValue) -> {
consumer.accept(newValue);
});
return element;
}
public static <T> ChoiceBox<T> choiceBox(Consumer<T> consumer) {
final ChoiceBox<T> element = new ChoiceBox<>();
setCss(element, "choice-box", "text-normal");
element.setOnMouseClicked(
_ -> {
new EventFlow().addPostEvent(new AudioEvents.ClickButton()).asyncPostEvent();
});
element.valueProperty()
.addListener(
(_, _, newValue) -> {
consumer.accept(newValue);
});
return element;
}
public static Separator separator() {
final Separator element = new Separator(Orientation.HORIZONTAL);
setCss(element, "separator");
return element;
}
}

View File

@@ -1,20 +0,0 @@
package org.toop.app.layer;
import org.toop.app.App;
public abstract class Popup extends Layer {
protected Popup(boolean popOnBackground, String... backgroundStyles) {
super(backgroundStyles);
if (popOnBackground) {
background.setOnMouseClicked(
_ -> {
App.pop();
});
}
}
protected Popup(boolean popOnBackground) {
this(popOnBackground, "bg-popup");
}
}

View File

@@ -1,59 +0,0 @@
package org.toop.app.layer.containers;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import org.toop.app.layer.Container;
public final class HorizontalContainer extends Container {
private final HBox container;
public HorizontalContainer(int spacing, String... cssClasses) {
container = new HBox(spacing);
container.getStyleClass().addAll(cssClasses);
}
public HorizontalContainer(int spacing) {
this(spacing, "container");
}
@Override
public Region getContainer() {
return container;
}
@Override
public void addNodes(Node... nodes) {
container.getChildren().addAll(nodes);
}
@Override
public void addContainer(Container container, boolean fill) {
if (fill) {
container.getContainer().setMinSize(0, 0);
container.getContainer().setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
HBox.setHgrow(container.getContainer(), Priority.ALWAYS);
} else {
container.getContainer().setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
}
this.container.getChildren().add(container.getContainer());
if (fill) {
balanceChildWidths();
}
}
private void balanceChildWidths() {
final ObservableList<Node> children = container.getChildren();
final double widthPerChild = container.getWidth() / children.size();
for (final Node child : children) {
if (child instanceof Region) {
((Region) child).setPrefWidth(widthPerChild);
}
}
}
}

View File

@@ -1,59 +0,0 @@
package org.toop.app.layer.containers;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import org.toop.app.layer.Container;
public final class VerticalContainer extends Container {
private final VBox container;
public VerticalContainer(int spacing, String... cssClasses) {
container = new VBox(spacing);
container.getStyleClass().addAll(cssClasses);
}
public VerticalContainer(int spacing) {
this(spacing, "container");
}
@Override
public Region getContainer() {
return container;
}
@Override
public void addNodes(Node... nodes) {
container.getChildren().addAll(nodes);
}
@Override
public void addContainer(Container container, boolean fill) {
if (fill) {
container.getContainer().setMinSize(0, 0);
container.getContainer().setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
VBox.setVgrow(container.getContainer(), Priority.ALWAYS);
} else {
container.getContainer().setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
}
this.container.getChildren().add(container.getContainer());
if (fill) {
balanceChildHeights();
}
}
private void balanceChildHeights() {
final ObservableList<Node> children = container.getChildren();
final double heightPerChild = container.getHeight() / children.size();
for (final Node child : children) {
if (child instanceof Region) {
((Region) child).setPrefHeight(heightPerChild);
}
}
}
}

View File

@@ -1,235 +0,0 @@
package org.toop.app.layer.layers;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import org.toop.app.App;
import org.toop.app.GameInformation;
import org.toop.app.layer.Container;
import org.toop.app.layer.Layer;
import org.toop.app.layer.NodeBuilder;
import org.toop.app.layer.Popup;
import org.toop.app.layer.containers.HorizontalContainer;
import org.toop.app.layer.containers.VerticalContainer;
import org.toop.app.layer.layers.game.TicTacToeLayer;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.networking.events.NetworkEvents;
import org.toop.local.AppContext;
public final class ConnectedLayer extends Layer {
private static Timer pollTimer = new Timer();
private static class ChallengePopup extends Popup {
private final GameInformation information;
private final String challenger;
private final String game;
private final long clientID;
private final int challengeID;
public ChallengePopup(
GameInformation information,
String challenger,
String game,
long clientID,
String challengeID) {
super(false, "bg-popup");
this.information = information;
this.challenger = challenger;
this.game = game;
this.clientID = clientID;
this.challengeID =
Integer.parseInt(challengeID.substring(18, challengeID.length() - 2));
reload();
}
@Override
public void reload() {
popAll();
final var challengeText = NodeBuilder.header(AppContext.getString("challengeText"));
final var challengerNameText = NodeBuilder.header(challenger);
final var gameText = NodeBuilder.text(AppContext.getString("gameIsText"));
final var gameNameText = NodeBuilder.text(game);
final var acceptButton =
NodeBuilder.button(
AppContext.getString("accept"),
() -> {
pollTimer.cancel();
new EventFlow()
.addPostEvent(
new NetworkEvents.SendAcceptChallenge(
clientID, challengeID))
.postEvent();
App.activate(new TicTacToeLayer(information, clientID));
});
final var denyButton =
NodeBuilder.button(
AppContext.getString("deny"),
() -> {
App.pop();
});
final Container controlContainer = new HorizontalContainer(30);
controlContainer.addNodes(acceptButton, denyButton);
final Container mainContainer = new VerticalContainer(30);
mainContainer.addNodes(challengeText, challengerNameText);
mainContainer.addNodes(gameText, gameNameText);
mainContainer.addContainer(controlContainer, false);
addContainer(mainContainer, Pos.CENTER, 0, 0, 30, 30);
}
}
GameInformation information;
long clientId;
String user;
List<String> onlinePlayers = new CopyOnWriteArrayList<>();
public ConnectedLayer(GameInformation information) {
super("bg-primary");
this.information = information;
new EventFlow()
.addPostEvent(
NetworkEvents.StartClient.class,
information.serverIP(),
Integer.parseInt(information.serverPort()))
.onResponse(
NetworkEvents.StartClientResponse.class,
e -> {
clientId = e.clientId();
user = information.playerName()[0].replaceAll("\\s+", "");
new EventFlow()
.addPostEvent(
new NetworkEvents.SendLogin(this.clientId, this.user))
.postEvent();
Thread popThread = new Thread(this::populatePlayerList);
popThread.setDaemon(false);
popThread.start();
})
.postEvent();
new EventFlow().listen(this::handleReceivedChallenge);
reload();
}
private void populatePlayerList() {
EventFlow sendGetPlayerList =
new EventFlow().addPostEvent(new NetworkEvents.SendGetPlayerlist(this.clientId));
new EventFlow()
.listen(
NetworkEvents.PlayerlistResponse.class,
e -> {
if (e.clientId() == this.clientId) {
List<String> playerList =
new java.util.ArrayList<>(
List.of(e.playerlist())); // TODO: Garbage,
// but works
playerList.removeIf(name -> name.equalsIgnoreCase(user));
if (this.onlinePlayers != playerList) {
this.onlinePlayers.clear();
this.onlinePlayers.addAll(playerList);
}
}
});
TimerTask task =
new TimerTask() {
public void run() {
sendGetPlayerList.postEvent();
Platform.runLater(() -> reload());
}
};
pollTimer.schedule(task, 0L, 5000L); // TODO: Block app exit, fix later
}
private void sendChallenge(String oppUsername, String gameType) {
final AtomicInteger challengeId = new AtomicInteger(-1);
if (onlinePlayers.contains(oppUsername)) {
new EventFlow()
.addPostEvent(
new NetworkEvents.SendChallenge(this.clientId, oppUsername, gameType))
.listen(
NetworkEvents.ChallengeResponse.class,
e -> {
challengeId.set(
Integer.parseInt(
e.challengeId()
.substring(
18, e.challengeId().length() - 2)));
})
.listen(
NetworkEvents.GameMatchResponse.class,
e -> {
if (e.clientId() == this.clientId) {
pollTimer.cancel();
App.activate(new TicTacToeLayer(information, this.clientId));
}
},
false)
.postEvent();
// ^
// |
// |
// |
}
}
private void handleReceivedChallenge(NetworkEvents.ChallengeResponse response) {
App.push(
new ChallengePopup(
information,
response.challengerName(),
response.gameType(),
clientId,
response.challengeId()));
}
@Override
public void reload() {
popAll();
ListView<Label> players = new ListView<>();
for (int i = 0; i < onlinePlayers.size(); i++) {
int finalI = i;
players.getItems()
.add(
NodeBuilder.button(
onlinePlayers.get(i),
() -> {
String clickedPlayer = onlinePlayers.get(finalI);
sendChallenge(clickedPlayer, "tic-tac-toe");
}));
}
final Container playersContainer = new VerticalContainer(10);
playersContainer.addNodes(players);
addContainer(playersContainer, Pos.CENTER, 0, 0, 0, 0);
}
}

View File

@@ -1,73 +0,0 @@
package org.toop.app.layer.layers;
import javafx.animation.PauseTransition;
import javafx.animation.TranslateTransition;
import javafx.geometry.Pos;
import javafx.scene.text.Text;
import javafx.util.Duration;
import org.toop.app.App;
import org.toop.app.layer.Container;
import org.toop.app.layer.NodeBuilder;
import org.toop.app.layer.Popup;
import org.toop.app.layer.containers.HorizontalContainer;
import org.toop.app.layer.containers.VerticalContainer;
import org.toop.local.AppContext;
public final class CreditsPopup extends Popup {
private final int lineHeight = 100;
public CreditsPopup() {
super(true, "bg-primary");
reload();
}
@Override
public void reload() {
popAll();
final String[] credits = {
AppContext.getString("scrumMaster") + ": Stef",
AppContext.getString("productOwner") + ": Omar",
AppContext.getString("mergeCommander") + ": Bas",
AppContext.getString("localization") + ": Ticho",
AppContext.getString("ai") + ": Michiel",
AppContext.getString("developers") + ": Michiel, Bas, Stef, Omar, Ticho",
AppContext.getString("moralSupport") + ": Wesley",
AppContext.getString("opengl") + ": Omar"
};
final Text[] creditsHeaders = new Text[credits.length];
for (int i = 0; i < credits.length; i++) {
creditsHeaders[i] = NodeBuilder.header(credits[i]);
}
final Container creditsContainer = new HorizontalContainer(0);
final Container animatedContainer = new VerticalContainer(lineHeight);
creditsContainer.addContainer(animatedContainer, true);
animatedContainer.addNodes(creditsHeaders);
addContainer(creditsContainer, Pos.CENTER, 0, 0, 50, 100);
playCredits(animatedContainer, App.getHeight());
}
private void playCredits(Container container, double sceneLength) {
container.getContainer().setTranslateY(-sceneLength);
final TranslateTransition scrollCredits =
new TranslateTransition(Duration.seconds(20), container.getContainer());
scrollCredits.setFromY(-sceneLength - lineHeight);
scrollCredits.setToY(sceneLength + lineHeight);
scrollCredits.setOnFinished(
_ -> {
final PauseTransition pauseCredits = new PauseTransition(Duration.seconds(3));
pauseCredits.setOnFinished(_ -> playCredits(container, sceneLength));
pauseCredits.play();
});
scrollCredits.play();
}
}

View File

@@ -1,65 +0,0 @@
package org.toop.app.layer.layers;
import javafx.geometry.Pos;
import org.toop.app.App;
import org.toop.app.layer.Container;
import org.toop.app.layer.Layer;
import org.toop.app.layer.NodeBuilder;
import org.toop.app.layer.containers.VerticalContainer;
import org.toop.local.AppContext;
public final class MainLayer extends Layer {
public MainLayer() {
super("bg-primary");
reload();
}
@Override
public void reload() {
popAll();
final var tictactoeButton =
NodeBuilder.button(
AppContext.getString("tictactoe"),
() -> {
App.activate(new MultiplayerLayer());
});
final var othelloButton =
NodeBuilder.button(
AppContext.getString("othello"),
() -> {
App.activate(new MultiplayerLayer());
});
final var creditsButton =
NodeBuilder.button(
AppContext.getString("credits"),
() -> {
App.push(new CreditsPopup());
});
final var optionsButton =
NodeBuilder.button(
AppContext.getString("options"),
() -> {
App.push(new OptionsPopup());
});
final var quitButton =
NodeBuilder.button(
AppContext.getString("quit"),
() -> {
App.quitPopup();
});
final Container gamesContainer = new VerticalContainer(5);
gamesContainer.addNodes(tictactoeButton, othelloButton);
final Container controlContainer = new VerticalContainer(5);
controlContainer.addNodes(creditsButton, optionsButton, quitButton);
addContainer(gamesContainer, Pos.TOP_LEFT, 2, 2, 20, 0);
addContainer(controlContainer, Pos.BOTTOM_LEFT, 2, -2, 20, 0);
}
}

View File

@@ -1,241 +0,0 @@
package org.toop.app.layer.layers;
import java.time.LocalDateTime;
import javafx.geometry.Pos;
import org.toop.app.App;
import org.toop.app.GameInformation;
import org.toop.app.layer.Container;
import org.toop.app.layer.Layer;
import org.toop.app.layer.NodeBuilder;
import org.toop.app.layer.containers.HorizontalContainer;
import org.toop.app.layer.containers.VerticalContainer;
import org.toop.app.layer.layers.game.TicTacToeLayer;
import org.toop.local.AppContext;
public final class MultiplayerLayer extends Layer {
private boolean isConnectionLocal = true;
private boolean isPlayer1Human = true;
private String player1Name = "";
private int computer1Difficulty = 0;
private int computer1ThinkTime = 0;
private boolean isPlayer2Human = true;
private String player2Name = "";
private int computer2Difficulty = 0;
private int computer2ThinkTime = 0;
private String serverIP = "";
private String serverPort = "";
public MultiplayerLayer() {
super("bg-primary");
reload();
}
@Override
public void reload() {
popAll();
final Container player1Container = new VerticalContainer(20);
final Container player2Container = new VerticalContainer(20);
final var isPlayer1HumanToggle =
NodeBuilder.toggle(
AppContext.getString("human"),
AppContext.getString("computer"),
!isPlayer1Human,
(computer) -> {
isPlayer1Human = !computer;
reload();
});
player1Container.addNodes(isPlayer1HumanToggle);
if (isPlayer1Human) {
final var playerNameText = NodeBuilder.text(AppContext.getString("playerName"));
final var playerNameInput =
NodeBuilder.input(
player1Name,
(name) -> {
player1Name = name;
});
player1Container.addNodes(playerNameText, playerNameInput);
} else {
player1Name = "Pism Bot V" + LocalDateTime.now().getSecond();
final var computerNameText = NodeBuilder.text(player1Name);
final var computerNameSeparator = NodeBuilder.separator();
final var computerDifficultyText =
NodeBuilder.text(AppContext.getString("computerDifficulty"));
final var computerDifficultySeparator = NodeBuilder.separator();
final var computerDifficultySlider =
NodeBuilder.slider(
10,
computer1Difficulty,
(difficulty) -> computer1Difficulty = difficulty);
final var computerThinkTimeText =
NodeBuilder.text(AppContext.getString("computerThinkTime"));
final var computerThinkTimeSlider =
NodeBuilder.slider(
5, computer1ThinkTime, (thinkTime) -> computer1ThinkTime = thinkTime);
player1Container.addNodes(
computerNameText,
computerNameSeparator,
computerDifficultyText,
computerDifficultySlider,
computerDifficultySeparator,
computerThinkTimeText,
computerThinkTimeSlider);
}
if (isConnectionLocal) {
final var isPlayer2HumanToggle =
NodeBuilder.toggle(
AppContext.getString("human"),
AppContext.getString("computer"),
!isPlayer2Human,
(computer) -> {
isPlayer2Human = !computer;
reload();
});
player2Container.addNodes(isPlayer2HumanToggle);
if (isPlayer2Human) {
final var playerNameText = NodeBuilder.text(AppContext.getString("playerName"));
final var playerNameInput =
NodeBuilder.input(
player2Name,
(name) -> {
player2Name = name;
});
player2Container.addNodes(playerNameText, playerNameInput);
} else {
player2Name = "Pism Bot V" + LocalDateTime.now().getSecond();
final var computerNameText = NodeBuilder.text(player2Name);
final var computerNameSeparator = NodeBuilder.separator();
final var computerDifficultyText =
NodeBuilder.text(AppContext.getString("computerDifficulty"));
final var computerDifficultySeparator = NodeBuilder.separator();
final var computerDifficultySlider =
NodeBuilder.slider(
10,
computer2Difficulty,
(difficulty) -> computer2Difficulty = difficulty);
final var computerThinkTimeText =
NodeBuilder.text(AppContext.getString("computerThinkTime"));
final var computerThinkTimeSlider =
NodeBuilder.slider(
5,
computer2ThinkTime,
(thinkTime) -> computer2ThinkTime = thinkTime);
player2Container.addNodes(
computerNameText,
computerNameSeparator,
computerDifficultyText,
computerDifficultySlider,
computerDifficultySeparator,
computerThinkTimeText,
computerThinkTimeSlider);
}
} else {
final var serverIPText = NodeBuilder.text(AppContext.getString("serverIP"));
final var serverIPSeparator = NodeBuilder.separator();
final var serverIPInput =
NodeBuilder.input(
serverIP,
(ip) -> {
serverIP = ip;
});
final var serverPortText = NodeBuilder.text(AppContext.getString("serverPort"));
final var serverPortInput =
NodeBuilder.input(
serverPort,
(port) -> {
serverPort = port;
});
player2Container.addNodes(
serverIPText,
serverIPInput,
serverIPSeparator,
serverPortText,
serverPortInput);
}
final var versusText = NodeBuilder.header("VS");
final var connectionTypeText =
NodeBuilder.text(AppContext.getString("connectionType") + ":");
final var connectionTypeToggle =
NodeBuilder.toggle(
AppContext.getString("local"),
AppContext.getString("server"),
!isConnectionLocal,
(server) -> {
isConnectionLocal = !server;
reload();
});
final var playButton =
NodeBuilder.button(
isConnectionLocal
? AppContext.getString("start")
: AppContext.getString("connect"),
() -> {
final var information =
new GameInformation(
new String[] {player1Name, player2Name},
new boolean[] {isPlayer1Human, isPlayer2Human},
new int[] {computer1Difficulty, computer2Difficulty},
new int[] {computer1ThinkTime, computer2ThinkTime},
isConnectionLocal,
serverIP,
serverPort);
if (isConnectionLocal) {
App.activate(new TicTacToeLayer(information));
} else {
App.activate(new ConnectedLayer(information));
}
});
final Container mainContainer = new VerticalContainer(10);
final Container playersContainer = new HorizontalContainer(5);
final Container connectionTypeContainer = new HorizontalContainer(10);
mainContainer.addContainer(playersContainer, true);
mainContainer.addContainer(connectionTypeContainer, false);
mainContainer.addNodes(playButton);
connectionTypeContainer.addNodes(connectionTypeText, connectionTypeToggle);
playersContainer.addContainer(player1Container, true);
playersContainer.addNodes(versusText);
playersContainer.addContainer(player2Container, true);
final var backButton =
NodeBuilder.button(
AppContext.getString("back"),
() -> {
App.activate(new MainLayer());
});
final Container controlContainer = new VerticalContainer(0);
controlContainer.addNodes(backButton);
addContainer(mainContainer, Pos.CENTER, 0, 0, 75, 75);
addContainer(controlContainer, Pos.BOTTOM_LEFT, 2, -2, 0, 0);
}
}

View File

@@ -1,222 +0,0 @@
package org.toop.app.layer.layers;
import java.util.Locale;
import javafx.geometry.Pos;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.Slider;
import org.toop.app.App;
import org.toop.app.layer.Container;
import org.toop.app.layer.NodeBuilder;
import org.toop.app.layer.Popup;
import org.toop.app.layer.containers.VerticalContainer;
import org.toop.framework.asset.resources.SettingsAsset;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.local.AppContext;
import org.toop.local.AppSettings;
public final class OptionsPopup extends Popup {
AppSettings appSettings = new AppSettings();
SettingsAsset settings = appSettings.getPath();
private boolean isWindowed = !(settings.getFullscreen());
public OptionsPopup() {
super(true, "bg-primary");
reload();
}
@Override
public void reload() {
popAll();
final var languageHeader = NodeBuilder.header(AppContext.getString("language"));
final var languageSeparator = NodeBuilder.separator();
final var volumeHeader = NodeBuilder.header(AppContext.getString("volume"));
final var volumeSeparator = NodeBuilder.separator();
final var fxVolumeHeader = NodeBuilder.header(AppContext.getString("effectsVolume"));
final var fxVolumeSeparator = NodeBuilder.separator();
final var musicVolumeHeader = NodeBuilder.header(AppContext.getString("musicVolume"));
final var musicVolumeSeparator = NodeBuilder.separator();
final var themeHeader = NodeBuilder.header(AppContext.getString("theme"));
final var themeSeparator = NodeBuilder.separator();
final var layoutSizeHeader = NodeBuilder.header(AppContext.getString("layoutSize"));
final var layoutSizeSeparator = NodeBuilder.separator();
final var optionsContainer = new VerticalContainer(5);
optionsContainer.addNodes(languageHeader, languageChoiceBox(), languageSeparator);
optionsContainer.addNodes(volumeHeader, volumeSlider(), volumeSeparator);
optionsContainer.addNodes(fxVolumeHeader, fxVolumeSlider(), fxVolumeSeparator);
optionsContainer.addNodes(musicVolumeHeader, musicVolumeSlider(), musicVolumeSeparator);
optionsContainer.addNodes(themeHeader, themeChoiceBox(), themeSeparator);
optionsContainer.addNodes(layoutSizeHeader, layoutSizeChoiceBox(), layoutSizeSeparator);
optionsContainer.addNodes(fullscreenToggle());
final Container mainContainer = new VerticalContainer(50, "");
mainContainer.addContainer(optionsContainer, true);
final var backButton =
NodeBuilder.button(
AppContext.getString("back"),
() -> {
App.pop();
});
final Container controlContainer = new VerticalContainer(5);
controlContainer.addNodes(backButton);
addContainer(mainContainer, Pos.CENTER, 0, 0, 0, 0);
addContainer(controlContainer, Pos.BOTTOM_LEFT, 2, -2, 0, 0);
}
private ChoiceBox<Locale> languageChoiceBox() {
assert AppContext.getLocalization() != null;
final ChoiceBox<Locale> languageChoiceBox =
NodeBuilder.choiceBox(
(locale) -> {
if (locale == AppContext.getLocale()) {
return;
}
settings.setLocale(locale.toString());
AppContext.setLocale(locale);
App.reloadAll();
});
languageChoiceBox.setConverter(
new javafx.util.StringConverter<>() {
@Override
public String toString(Locale locale) {
return AppContext.getString(locale.getDisplayName().toLowerCase());
}
@Override
public Locale fromString(String string) {
return null;
}
});
languageChoiceBox.getItems().addAll(AppContext.getLocalization().getAvailableLocales());
languageChoiceBox.setValue(AppContext.getLocale());
return languageChoiceBox;
}
private Slider volumeSlider() {
return NodeBuilder.slider(
100,
settings.getVolume(),
(volume) -> {
settings.setVolume(volume);
new EventFlow()
.addPostEvent(new AudioEvents.ChangeVolume(volume.doubleValue()))
.asyncPostEvent();
});
}
private Slider fxVolumeSlider() {
return NodeBuilder.slider(
100,
settings.getFxVolume(),
(volume) -> {
settings.setFxVolume(volume);
new EventFlow()
.addPostEvent(new AudioEvents.ChangeFxVolume(volume.doubleValue()))
.asyncPostEvent();
});
}
private Slider musicVolumeSlider() {
return NodeBuilder.slider(
100,
settings.getMusicVolume(),
(volume) -> {
settings.setMusicVolume(volume);
new EventFlow()
.addPostEvent(new AudioEvents.ChangeMusicVolume(volume.doubleValue()))
.asyncPostEvent();
});
}
private Label fullscreenToggle() {
return NodeBuilder.toggle(
AppContext.getString("windowed"),
AppContext.getString("fullscreen"),
!isWindowed,
(fullscreen) -> {
isWindowed = !fullscreen;
settings.setFullscreen(fullscreen);
App.setFullscreen(fullscreen);
});
}
private ChoiceBox<String> themeChoiceBox() {
final ChoiceBox<String> themeChoiceBox =
NodeBuilder.choiceBox(
(theme) -> {
if (theme.equalsIgnoreCase(settings.getTheme())) {
return;
}
settings.setTheme(theme);
App.setStyle(theme, settings.getLayoutSize());
});
themeChoiceBox.setConverter(
new javafx.util.StringConverter<>() {
@Override
public String toString(String theme) {
return AppContext.getString(theme);
}
@Override
public String fromString(String string) {
return null;
}
});
themeChoiceBox.getItems().addAll("dark", "light", "dark-hc", "light-hc");
themeChoiceBox.setValue(settings.getTheme());
return themeChoiceBox;
}
private ChoiceBox<String> layoutSizeChoiceBox() {
final ChoiceBox<String> layoutSizeChoiceBox =
NodeBuilder.choiceBox(
(layoutSize) -> {
if (layoutSize.equalsIgnoreCase(settings.getLayoutSize())) {
return;
}
settings.setLayoutSize(layoutSize);
App.setStyle(settings.getTheme(), layoutSize);
});
layoutSizeChoiceBox.setConverter(
new javafx.util.StringConverter<>() {
@Override
public String toString(String layoutSize) {
return AppContext.getString(layoutSize);
}
@Override
public String fromString(String string) {
return null;
}
});
layoutSizeChoiceBox.getItems().addAll("small", "medium", "large");
layoutSizeChoiceBox.setValue(settings.getLayoutSize());
return layoutSizeChoiceBox;
}
}

View File

@@ -1,47 +0,0 @@
package org.toop.app.layer.layers;
import javafx.geometry.Pos;
import org.toop.app.App;
import org.toop.app.layer.Container;
import org.toop.app.layer.NodeBuilder;
import org.toop.app.layer.Popup;
import org.toop.app.layer.containers.HorizontalContainer;
import org.toop.app.layer.containers.VerticalContainer;
import org.toop.local.AppContext;
public final class QuitPopup extends Popup {
public QuitPopup() {
super(true);
reload();
}
@Override
public void reload() {
popAll();
final var sureText = NodeBuilder.header(AppContext.getString("quitSure"));
final var yesButton =
NodeBuilder.button(
AppContext.getString("yes"),
() -> {
App.quit();
});
final var noButton =
NodeBuilder.button(
AppContext.getString("no"),
() -> {
App.pop();
});
final Container controlContainer = new HorizontalContainer(30);
controlContainer.addNodes(yesButton, noButton);
final Container mainContainer = new VerticalContainer(30);
mainContainer.addNodes(sureText);
mainContainer.addContainer(controlContainer, false);
addContainer(mainContainer, Pos.CENTER, 0, 0, 30, 30);
}
}

View File

@@ -1,55 +0,0 @@
package org.toop.app.layer.layers.game;
import javafx.geometry.Pos;
import org.toop.app.App;
import org.toop.app.layer.Container;
import org.toop.app.layer.NodeBuilder;
import org.toop.app.layer.Popup;
import org.toop.app.layer.containers.VerticalContainer;
import org.toop.app.layer.layers.MainLayer;
import org.toop.local.AppContext;
public class GameFinishedPopup extends Popup {
private final boolean isDraw;
private final String winner;
public GameFinishedPopup(boolean isDraw, String winner) {
super(true, "bg-popup");
this.isDraw = isDraw;
this.winner = winner;
reload();
}
@Override
public void reload() {
popAll();
final Container mainContainer = new VerticalContainer(30);
if (isDraw) {
final var drawHeader = NodeBuilder.header(AppContext.getString("drawText"));
final var goodGameText = NodeBuilder.text(AppContext.getString("goodGameText"));
mainContainer.addNodes(drawHeader, goodGameText);
} else {
final var winHeader =
NodeBuilder.header(AppContext.getString("congratulations") + ": " + winner);
final var goodGameText = NodeBuilder.text(AppContext.getString("goodGameText"));
mainContainer.addNodes(winHeader, goodGameText);
}
final var backToMainMenuButton =
NodeBuilder.button(
AppContext.getString("backToMainMenu"),
() -> {
App.activate(new MainLayer());
});
mainContainer.addNodes(backToMainMenuButton);
addContainer(mainContainer, Pos.CENTER, 0, 0, 30, 30);
}
}

View File

@@ -1,329 +0,0 @@
package org.toop.app.layer.layers.game;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import javafx.geometry.Pos;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import org.toop.app.App;
import org.toop.app.GameInformation;
import org.toop.app.canvas.TicTacToeCanvas;
import org.toop.app.layer.Container;
import org.toop.app.layer.Layer;
import org.toop.app.layer.NodeBuilder;
import org.toop.app.layer.containers.HorizontalContainer;
import org.toop.app.layer.containers.VerticalContainer;
import org.toop.app.layer.layers.MainLayer;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.networking.events.NetworkEvents;
import org.toop.game.Game;
import org.toop.game.tictactoe.TicTacToe;
import org.toop.game.tictactoe.TicTacToeAI;
import org.toop.local.AppContext;
public final class TicTacToeLayer extends Layer {
private TicTacToeCanvas canvas;
private AtomicReference<TicTacToe> ticTacToe;
private TicTacToeAI ticTacToeAI;
private GameInformation information;
private final Text currentPlayerNameText;
private final Text currentPlayerMoveText;
private final BlockingQueue<Game.Move> playerMoveQueue = new LinkedBlockingQueue<>();
// Todo: set these from the server
private char currentPlayerMove = Game.EMPTY;
private String player2Name = "";
final AtomicBoolean firstPlayerIsMe = new AtomicBoolean(true);
public TicTacToeLayer(GameInformation information) {
super("bg-primary");
canvas =
new TicTacToeCanvas(
Color.LIME,
(App.getHeight() / 100) * 75,
(App.getHeight() / 100) * 75,
(cell) -> {
try {
if (information.isConnectionLocal()) {
if (ticTacToe.get().getCurrentTurn() == 0) {
playerMoveQueue.put(new Game.Move(cell, 'X'));
} else {
playerMoveQueue.put(new Game.Move(cell, 'O'));
}
} else {
if (information.isPlayerHuman()[0]
&& currentPlayerMove != Game.EMPTY) {
playerMoveQueue.put(
new Game.Move(
cell, firstPlayerIsMe.get() ? 'X' : 'O'));
}
}
} catch (InterruptedException _) {
}
});
ticTacToe = new AtomicReference<>(new TicTacToe());
ticTacToeAI = new TicTacToeAI();
this.information = information;
if (information.isConnectionLocal()) {
new Thread(this::localGameThread).start();
}
currentPlayerNameText = NodeBuilder.header("");
currentPlayerMoveText = NodeBuilder.header("");
reload();
}
public TicTacToeLayer(GameInformation information, long clientID) {
this(information);
Thread a = new Thread(this::serverGameThread);
a.setDaemon(false);
a.start();
reload();
}
@Override
public void reload() {
popAll();
canvas.resize((App.getHeight() / 100) * 75, (App.getHeight() / 100) * 75);
for (int i = 0; i < ticTacToe.get().board.length; i++) {
final char value = ticTacToe.get().board[i];
if (value == 'X') {
canvas.drawX(Color.RED, i);
} else if (value == 'O') {
canvas.drawO(Color.BLUE, i);
}
}
final var backButton =
NodeBuilder.button(
AppContext.getString("back"),
() -> {
App.activate(new MainLayer());
});
final Container controlContainer = new VerticalContainer(5);
controlContainer.addNodes(backButton);
final Container informationContainer = new HorizontalContainer(15);
informationContainer.addNodes(currentPlayerNameText, currentPlayerMoveText);
addContainer(controlContainer, Pos.BOTTOM_LEFT, 2, -2, 0, 0);
addContainer(informationContainer, Pos.TOP_LEFT, 2, 2, 0, 0);
addGameCanvas(canvas, Pos.CENTER, 0, 0);
}
private int compurterDifficultyToDepth(int maxDifficulty, int difficulty) {
return (int) (((float) maxDifficulty / difficulty) * 9);
}
private void localGameThread() {
boolean running = true;
while (running) {
final int currentPlayer = ticTacToe.get().getCurrentTurn();
currentPlayerNameText.setText(information.playerName()[currentPlayer]);
currentPlayerMoveText.setText(ticTacToe.get().getCurrentTurn() == 0 ? "X" : "O");
Game.Move move = null;
if (information.isPlayerHuman()[currentPlayer]) {
try {
final Game.Move wants = playerMoveQueue.take();
final Game.Move[] legalMoves = ticTacToe.get().getLegalMoves();
for (final Game.Move legalMove : legalMoves) {
if (legalMove.position() == wants.position()
&& legalMove.value() == wants.value()) {
move = wants;
}
}
} catch (InterruptedException _) {
}
} else {
final long start = System.currentTimeMillis();
move =
ticTacToeAI.findBestMove(
ticTacToe.get(),
compurterDifficultyToDepth(
10, information.computerDifficulty()[currentPlayer]));
if (information.computerThinkTime()[currentPlayer] > 0) {
final long elapsedTime = System.currentTimeMillis() - start;
final long sleepTime =
information.computerThinkTime()[currentPlayer] * 1000L - elapsedTime;
try {
Thread.sleep(sleepTime);
} catch (InterruptedException _) {
}
}
}
if (move == null) {
continue;
}
final Game.State state = ticTacToe.get().play(move);
if (move.value() == 'X') {
canvas.drawX(Color.RED, move.position());
} else if (move.value() == 'O') {
canvas.drawO(Color.BLUE, move.position());
}
if (state != Game.State.NORMAL) {
if (state == Game.State.WIN) {
App.push(
new GameFinishedPopup(
false,
information.playerName()[ticTacToe.get().getCurrentTurn()]));
} else if (state == Game.State.DRAW) {
App.push(new GameFinishedPopup(true, ""));
}
running = false;
}
}
}
private void serverGameThread() {
new EventFlow()
.listen(this::handleServerGameStart) // <-----------
.listen(this::yourTurnResponse)
.listen(this::onMoveResponse)
.listen(this::handleReceivedMessage);
}
private void handleServerGameStart(NetworkEvents.GameMatchResponse resp) {
// Meneer Bas de Jong. Dit functie wordt niet aangeroepen als je de challenger bent.
// Ik heb veel dingen geprobeert. FUCKING veel dingen. Hij doet het niet.
// Ik heb zelfs in jou code gekeken en unsubscribeAfterSuccess op false gezet. (zie
// ConnectedLayer).
// Alle andere functies worden wel gecalt. Behalve dit.
// Ben jij gehandicapt of ik? Want het moet 1 van de 2 zijn. Ik ben dit al 2 uur aan het
// debuggen.
// Ik ga nu slapen (04:46).
// ⠀⠀⠀⠀⠀⠀⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⢀⣴⣿⣿⠿⣟⢷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⢸⣏⡏⠀⠀⠀⢣⢻⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⢸⣟⠧⠤⠤⠔⠋⠀⢿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⣿⡆⠀⠀⠀⠀⠀⠸⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠘⣿⡀⢀⣶⠤⠒⠀⢻⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠈⢿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⣿⡆⠀⠀⠀⠀⠀⠈⢿⣆⣠⣤⣤⣤⣤⣴⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⢀⣾⢿⢿⠀⠀⠀⢀⣀⣀⠘⣿⠋⠁⠀⠙⢇⠀⠀⠙⢿⣦⡀⠀⠀⠀⠀⠀
// ⠀⠀⠀⢀⣾⢇⡞⠘⣧⠀⢖⡭⠞⢛⡄⠘⣆⠀⠀⠀⠈⢧⠀⠀⠀⠙⢿⣄⠀⠀⠀⠀
// ⠀⠀⣠⣿⣛⣥⠤⠤⢿⡄⠀⠀⠈⠉⠀⠀⠹⡄⠀⠀⠀⠈⢧⠀⠀⠀⠈⠻⣦⠀⠀⠀
// ⠀⣼⡟⡱⠛⠙⠀⠀⠘⢷⡀⠀⠀⠀⠀⠀⠀⠹⡀⠀⠀⠀⠈⣧⠀⠀⠀⠀⠹⣧⡀⠀
// ⢸⡏⢠⠃⠀⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠘⣧⠀⠀⠀⠀⠸⣷⡀
// ⠸⣧⠘⡇⠀⠀⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⢣⠀⠀⠀⠀⢹⡇⠀⠀⠀⠀⣿⠇
// ⠀⣿⡄⢳⠀⠀⠀⠀⠀⠀⠀⠈⣷⠀⠀⠀⠀⠀⠀⠈⠆⠀⠀⠀⠀⠀⠀⠀⠀⣼⡟⠀
// ⠀⢹⡇⠘⣇⠀⠀⠀⠀⠀⠀⠰⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠀⣼⡟⠀⠀
// ⠀⢸⡇⠀⢹⡆⠀⠀⠀⠀⠀⠀⠙⠁⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⢳⣼⠟⠀⠀⠀
// ⠀⠸⣧⣀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⡄⠀⠀⠀⠀⠀⠀⠀⢃⠀⢀⣴⡿⠁⠀⠀⠀⠀
// ⠀⠀⠈⠙⢷⣄⢳⡀⠀⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⣠⡿⠟⠛⠉⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠈⠻⢿⣷⣦⣄⣀⣀⣠⣤⠾⠷⣦⣤⣤⡶⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
player2Name = resp.opponent();
System.out.println(player2Name);
currentPlayerMoveText.setText("X");
if (!resp.playerToMove().equalsIgnoreCase(resp.opponent())) {
currentPlayerNameText.setText(information.playerName()[0]);
firstPlayerIsMe.set(true);
System.out.printf("I am starting: My client id is %d\n", resp.clientId());
} else {
currentPlayerNameText.setText(player2Name);
firstPlayerIsMe.set(false);
System.out.printf("I am NOT starting: My client id is %d\n", resp.clientId());
}
}
private void onMoveResponse(NetworkEvents.GameMoveResponse resp) {
char playerChar;
if (!resp.player().equalsIgnoreCase(player2Name)) {
playerChar = firstPlayerIsMe.get() ? 'X' : 'O';
} else {
playerChar = firstPlayerIsMe.get() ? 'O' : 'X';
}
final Game.Move move = new Game.Move(Integer.parseInt(resp.move()), playerChar);
final Game.State state = ticTacToe.get().play(move);
if (state
!= Game.State.NORMAL) { // todo differentiate between future draw guaranteed and is
// currently a draw
if (state == Game.State.WIN) {
App.push(
new GameFinishedPopup(
false, information.playerName()[ticTacToe.get().getCurrentTurn()]));
} else if (state == Game.State.DRAW) {
App.push(new GameFinishedPopup(true, ""));
}
}
if (move.value() == 'X') {
canvas.drawX(Color.RED, move.position());
} else if (move.value() == 'O') {
canvas.drawO(Color.BLUE, move.position());
}
currentPlayerNameText.setText(
ticTacToe.get().getCurrentTurn() == (firstPlayerIsMe.get() ? 0 : 1)
? information.playerName()[0]
: player2Name);
currentPlayerMoveText.setText(ticTacToe.get().getCurrentTurn() == 0 ? "X" : "O");
}
private void yourTurnResponse(NetworkEvents.YourTurnResponse response) {
int position = -1;
if (information.isPlayerHuman()[0]) {
try {
position = playerMoveQueue.take().position();
} catch (InterruptedException _) {
}
} else {
final Game.Move move =
ticTacToeAI.findBestMove(
ticTacToe.get(),
compurterDifficultyToDepth(10, information.computerDifficulty()[0]));
position = move.position();
}
new EventFlow()
.addPostEvent(new NetworkEvents.SendMove(response.clientId(), (short) position))
.postEvent();
}
private void handleReceivedMessage(NetworkEvents.ReceivedMessage msg) {
System.out.println("Received Message: " + msg.message()); // todo add chat window
}
}

View File

@@ -0,0 +1,209 @@
package org.toop.app.widget;
import javafx.scene.image.ImageView;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.resource.resources.ImageAsset;
import org.toop.local.AppContext;
import java.util.function.Consumer;
import javafx.collections.FXCollections;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Separator;
import javafx.scene.control.Slider;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.util.StringConverter;
public final class Primitive {
public static Text header(String key, boolean localize) {
var header = new Text();
header.getStyleClass().add("header");
if (!key.isEmpty()) {
if (localize) header.setText(AppContext.getString(key)); else header.setText(key);
header.textProperty().bind(AppContext.bindToKey(key, localize));
}
return header;
}
public static Text header(String key) {
return header(key, true);
}
public static Text text(String key, boolean localize) {
var text = new Text();
text.getStyleClass().add("text");
if (!key.isEmpty()) {
if (localize) text.setText(AppContext.getString(key)); else text.setText(key);
text.textProperty().bind(AppContext.bindToKey(key, localize));
}
return text;
}
public static Text text(String key) {
return text(key, true);
}
public static ImageView image(ImageAsset imageAsset) {
ImageView imageView = new ImageView(imageAsset.getImage());
imageView.getStyleClass().add("image");
imageView.setPreserveRatio(true);
imageView.setFitWidth(400);
imageView.setFitHeight(400);
return imageView;
}
public static Button button(String key, Runnable onAction, boolean localize, boolean disableOnClick) {
var button = new Button();
button.getStyleClass().add("button");
if (!key.isEmpty()) {
if (localize) button.setText(AppContext.getString(key)); else button.setText(key);
button.textProperty().bind(AppContext.bindToKey(key, localize));
}
if (onAction != null) {
button.setOnAction(_ -> {
if (disableOnClick) button.setDisable(true);
onAction.run();
playButtonSound();
});
}
return button;
}
public static Button button(String key, Runnable onAction, boolean disableOnClick) {
return button(key, onAction, true, disableOnClick);
}
public static TextField input(String promptKey, String text, Consumer<String> onValueChanged, boolean localize) {
var input = new TextField();
input.getStyleClass().add("input");
if (!promptKey.isEmpty()) {
if (localize) input.setPromptText(AppContext.getString(promptKey)); else input.setPromptText(promptKey);
input.promptTextProperty().bind(AppContext.bindToKey(promptKey, localize));
}
input.setText(text);
if (onValueChanged != null) {
input.textProperty().addListener((_, _, newValue) ->
onValueChanged.accept(newValue));
}
return input;
}
public static TextField input(String promptKey, String text, Consumer<String> onValueChanged) {
return input(promptKey, text, onValueChanged, true);
}
public static Slider slider(int min, int max, int value, Consumer<Integer> onValueChanged) {
var slider = new Slider();
slider.getStyleClass().add("slider");
slider.setMin(min);
slider.setMax(max);
slider.setValue(value);
if (onValueChanged != null) {
slider.valueProperty().addListener((_, _, newValue) -> {
onValueChanged.accept(newValue.intValue());
});
}
slider.setOnMouseReleased(event -> {
playButtonSound();
});
return slider;
}
@SafeVarargs
public static <T> ComboBox<T> choice(StringConverter<T> converter, T value, Consumer<T> onValueChanged, T... items) {
var choice = new ComboBox<T>();
choice.getStyleClass().add("choice");
if (converter != null) {
choice.setConverter(converter);
}
if (value != null) {
choice.setValue(value);
}
if (onValueChanged != null) {
choice.valueProperty().addListener((_, _, newValue) -> {
onValueChanged.accept(newValue);
playButtonSound();
});
}
choice.setItems(FXCollections.observableArrayList(items));
return choice;
}
public static ScrollPane scroll(Node content) {
var scroll = new ScrollPane();
scroll.getStyleClass().add("scroll");
scroll.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
scroll.setFitToWidth(true);
scroll.setContent(content);
return scroll;
}
public static Separator separator() {
var separator = new Separator();
separator.getStyleClass().add("separator");
return separator;
}
public static HBox hbox(Node... nodes) {
var hbox = new HBox();
hbox.getStyleClass().add("container");
hbox.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
for (var node : nodes) {
if (node != null) {
hbox.getChildren().add(node);
}
}
return hbox;
}
public static VBox vbox(Node... nodes) {
var vbox = new VBox();
vbox.getStyleClass().add("container");
vbox.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
for (var node : nodes) {
if (node != null) {
vbox.getChildren().add(node);
}
}
return vbox;
}
private static void playButtonSound() {
new EventFlow().addPostEvent(new AudioEvents.ClickButton()).postEvent();
}
}

View File

@@ -0,0 +1,5 @@
package org.toop.app.widget;
public interface Updatable {
void update();
}

View File

@@ -0,0 +1,29 @@
package org.toop.app.widget;
import javafx.geometry.Pos;
import javafx.scene.Node;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public interface Widget {
Logger logger = LogManager.getLogger(Widget.class);
Node getNode();
default void show(Pos position) {
logger.debug("Showing Widget: {} at position: {}", this.getNode(), position.toString());
WidgetContainer.add(position, this);
}
default void hide() {
logger.debug("Hiding Widget: {}", this.getNode());
WidgetContainer.remove(this);
}
default void replace(Pos position, Widget widget) {
logger.debug("Replacing Widget: {}, with widget: {}, to position: {}",
this.getNode(), widget.getNode(), position.toString());
widget.show(position);
hide();
}
}

View File

@@ -0,0 +1,148 @@
package org.toop.app.widget;
import javafx.scene.Node;
import org.toop.app.widget.complex.PopupWidget;
import org.toop.app.widget.complex.ViewWidget;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.layout.StackPane;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
public final class WidgetContainer {
private static StackPane root;
private static ViewWidget currentView;
public static synchronized StackPane setup() {
if (root != null) {
return root;
}
root = new StackPane();
root.getStyleClass().add("bg-view");
return root;
}
public static void add(Pos position, Widget widget) {
if (root == null || widget == null) {
return;
}
Platform.runLater(() -> {
if (root.getChildren().contains(widget.getNode())) {
return;
}
StackPane.setAlignment(widget.getNode(), position);
if (widget instanceof ViewWidget view) {
root.getChildren().addFirst(view.getNode());
currentView = view;
} else if (widget instanceof PopupWidget popup) {
currentView.add(Pos.CENTER, (Widget) popup);
} else {
root.getChildren().add(widget.getNode());
}
});
}
public static void remove(Widget widget) {
if (root == null || widget == null) {
return;
}
Platform.runLater(() -> {
if (widget instanceof PopupWidget popup) {
currentView.remove((Widget) popup);
} else {
root.getChildren().remove(widget.getNode());
}
});
}
public static void remove(Class<? extends Widget> widgetClass) {
if (root == null || currentView == null) return;
Platform.runLater(() ->
currentView.getChildren().removeIf(widget -> widget.getClass().isAssignableFrom(widgetClass))
);
}
public static void removeFirst(Class<? extends Widget> widgetClass) {
if (root == null || currentView == null) return;
Platform.runLater(() -> {
for (Node widget : currentView.getChildren()) {
if (widgetClass.isAssignableFrom(widget.getClass())) {
currentView.getChildren().remove(widget);
break;
}
}
});
}
public static List<Widget> find(Class<? extends Widget> widgetClass) {
if (root == null || currentView == null) return null;
return getAllWidgets()
.stream()
.filter(widget -> widget.getClass().isAssignableFrom(widgetClass))
.toList();
}
public static List<Widget> find(Predicate<Widget> predicate) {
if (root == null || currentView == null) return null;
return getAllWidgets()
.stream()
.filter(predicate)
.toList();
}
public static Widget findFirst(Class<? extends Widget> widgetClass) {
if (root == null || currentView == null) return null;
return getAllWidgets()
.stream()
.filter(widget -> widget.getClass().isAssignableFrom(widgetClass))
.findFirst().orElse(null);
}
public static ViewWidget getCurrentView() {
return currentView;
}
public static void setCurrentView(ViewWidget view) {
if (root == null || view == null) {
return;
}
Platform.runLater(() -> {
root.getChildren().clear();
root.getChildren().add(view.getNode());
currentView = view;
});
}
public static List<Widget> getAllWidgets() {
final List<Widget> children = new ArrayList<>();
for (var child : root.getChildren()) {
if (child instanceof Widget widget) {
children.add(widget);
}
}
for (var child : currentView.getNode().getChildren()) {
if (child instanceof Widget widget) {
children.add(widget);
}
}
return children;
}
}

View File

@@ -0,0 +1,38 @@
package org.toop.app.widget.complex;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.Widget;
import javafx.application.Platform;
import javafx.scene.Node;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
public class ConfirmWidget implements Widget {
private final HBox buttonsContainer;
private final Text messageText;
private final VBox container;
public ConfirmWidget(String confirm) {
buttonsContainer = Primitive.hbox();
messageText = Primitive.text("");
container = Primitive.vbox(Primitive.header(confirm), messageText, Primitive.separator(), buttonsContainer);
}
public void setMessage(String message) {
messageText.setText(message);
}
public void addButton(String key, Runnable onClick) {
Platform.runLater(() -> {
var button = Primitive.button(key, onClick, false);
buttonsContainer.getChildren().add(button);
});
}
@Override
public Node getNode() {
return container;
}
}

View File

@@ -0,0 +1,42 @@
package org.toop.app.widget.complex;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.Widget;
import java.util.function.Consumer;
import javafx.scene.Node;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.VBox;
import javafx.util.StringConverter;
public class LabeledChoiceWidget<T> implements Widget {
private final ComboBox<T> comboBox;
private final VBox container;
@SafeVarargs
public LabeledChoiceWidget(
String key,
StringConverter<T> converter,
T initialValue,
Consumer<T> onValueChanged,
T... items
) {
var label = Primitive.text(key);
comboBox = Primitive.choice(converter, initialValue, onValueChanged, items);
container = Primitive.vbox(label, comboBox);
}
public T getValue() {
return comboBox.getValue();
}
public void setValue(T value) {
comboBox.setValue(value);
}
@Override
public Node getNode() {
return container;
}
}

View File

@@ -0,0 +1,34 @@
package org.toop.app.widget.complex;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.Widget;
import java.util.function.Consumer;
import javafx.scene.Node;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
public class LabeledInputWidget implements Widget {
private final TextField input;
private final VBox container;
public LabeledInputWidget(String key, String promptKey, String initialText, Consumer<String> onValueChanged) {
var label = Primitive.text(key);
input = Primitive.input(promptKey, initialText, onValueChanged);
container = Primitive.vbox(label, input);
}
public String getValue() {
return input.getText();
}
public void setValue(String text) {
input.setText(text);
}
@Override
public Node getNode() {
return container;
}
}

View File

@@ -0,0 +1,49 @@
package org.toop.app.widget.complex;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.Widget;
import java.util.function.Consumer;
import javafx.scene.Node;
import javafx.scene.control.Slider;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
public class LabeledSliderWidget implements Widget {
private final Slider slider;
private final Text labelValue;
private final VBox container;
public LabeledSliderWidget(String key, int min, int max, int value, Consumer<Integer> onValueChanged) {
var label = Primitive.text(key);
labelValue = new Text(String.valueOf(value));
labelValue.getStyleClass().add("text");
slider = Primitive.slider(min, max, value, newValue -> {
labelValue.setText(String.valueOf(newValue));
if (onValueChanged != null) {
onValueChanged.accept(newValue);
}
});
var sliderRow = Primitive.hbox(slider, labelValue);
container = Primitive.vbox(label, sliderRow);
}
public int getValue() {
return (int)slider.getValue();
}
public void setValue(int newValue) {
slider.setValue(newValue);
labelValue.setText(String.valueOf(newValue));
}
@Override
public Node getNode() {
return container;
}
}

View File

@@ -0,0 +1,162 @@
package org.toop.app.widget.complex;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import org.toop.app.widget.Primitive;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
public class LoadingWidget extends ViewWidget implements Update { // TODO make of widget type
private final Text loadingText; // TODO Make changeable
private final ProgressIndicator progressBar;
private final AtomicBoolean successTriggered = new AtomicBoolean(false);
private final AtomicBoolean failureTriggered = new AtomicBoolean(false);
private Runnable success = () -> {};
private Runnable failure = () -> {};
private int maxAmount;
private int minAmount;
private int amount;
private Callable<Boolean> successTrigger = () -> (amount >= maxAmount);
private Callable<Boolean> failureTrigger = () -> (amount < minAmount);
private float percentage = 0.0f;
private boolean isInfinite = false;
/**
*
* Widget that shows a loading bar.
*
* @param loadingText Text above the loading bar.
* @param minAmount The minimum amount.
* @param startAmount The starting amount.
* @param maxAmount The max amount.
*/
public LoadingWidget(Text loadingText, int minAmount, int startAmount, int maxAmount, boolean infinite, boolean circle) {
isInfinite = infinite;
this.maxAmount = maxAmount;
this.minAmount = minAmount;
amount = startAmount;
this.loadingText = loadingText;
progressBar = circle ? new ProgressIndicator() : new ProgressBar();
VBox box = Primitive.vbox(this.loadingText, progressBar);
progressBar.getStyleClass().add("loading-progress-bar");
add(Pos.CENTER, box);
}
public void setMaxAmount(int maxAmount) {
this.maxAmount = maxAmount;
}
public void setAmount(int amount) throws Exception {
this.amount = amount;
update();
}
public int getMaxAmount() {
return maxAmount;
}
public int getAmount() {
return amount;
}
public float getPercentage() {
return percentage;
}
public boolean isTriggered() {
return (failureTriggered.get() || successTriggered.get());
}
public ProgressIndicator getProgressBar() {
return progressBar;
}
/**
* What to do when success is triggered.
* @param onSuccess The lambda that gets run on success.
*/
public void setOnSuccess(Runnable onSuccess) {
success = onSuccess;
}
/**
* What to do when failure is triggered.
* @param onFailure The lambda that gets run on failure.
*/
public void setOnFailure(Runnable onFailure) {
failure = onFailure;
}
/**
* The trigger to activate onSuccess.
* @param trigger The lambda that triggers onSuccess.
*/
public void setSuccessTrigger(Callable<Boolean> trigger) {
successTrigger = trigger;
}
/**
* The trigger to activate onFailure.
* @param trigger The lambda that triggers onFailure.
*/
public void setFailureTrigger(Callable<Boolean> trigger) {
failureTrigger = trigger;
}
/**
* Forcefully trigger success.
*/
public void triggerSuccess() {
if (successTriggered.compareAndSet(false, true)) {
Platform.runLater(() -> {
if (success != null) success.run();
});
}
}
/**
* Forcefully trigger failure.
*/
public void triggerFailure() {
if (failureTriggered.compareAndSet(false, true)) {
Platform.runLater(() -> {
if (failure != null) failure.run();
});
}
}
@Override
public void update() throws Exception { // TODO Better exception
if (successTriggered.get() || failureTriggered.get()) { // If already triggered, throw exception.
throw new RuntimeException();
}
if (successTrigger.call()) {
triggerSuccess();
this.remove((Node) this);
return;
} else if (failureTrigger.call()) {
triggerFailure();
this.remove((Node) this);
return;
}
if (maxAmount != 0) {
percentage = (float) amount / maxAmount;
}
if (!isInfinite) {
progressBar.setProgress(percentage);
}
}
}

View File

@@ -0,0 +1,112 @@
package org.toop.app.widget.complex;
import org.toop.app.GameInformation;
import org.toop.app.widget.Primitive;
import javafx.scene.Node;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
public class PlayerInfoWidget {
private final GameInformation.Player information;
private final VBox container;
private Text playerName;
private boolean hasSet;
public PlayerInfoWidget(GameInformation.Player information) {
this.information = information;
container = Primitive.vbox(
buildToggle().getNode(),
buildContent()
);
this.playerName = null;
}
private ToggleWidget buildToggle() {
return new ToggleWidget(
"computer", "player",
information.isHuman,
isHuman -> {
information.isHuman = isHuman;
container.getChildren().setAll(
buildToggle().getNode(),
buildContent()
);
}
);
}
private Node buildContent() {
if (information.isHuman) {
var spacer = Primitive.vbox(
makeAIButton(0, 0, "zwartepiet"),
makeAIButton(0, 0, "sinterklaas"),
makeAIButton(0, 0, "santa")
); //todo make a better solution
spacer.setVisible(false);
var nameInput = new LabeledInputWidget(
"name",
"enter-your-name",
information.name,
newName -> information.name = newName
);
return Primitive.vbox(spacer,nameInput.getNode());
} else {
var AIBox = Primitive.vbox(
makeAIButton(0, 1, "zwartepiet"),
makeAIButton(2, 1, "sinterklaas"),
makeAIButton(9, 1, "santa")
);
this.playerName = Primitive.text("");
playerName.setText(information.name);
var nameDisplay = Primitive.vbox(
Primitive.text("name"),
playerName
);
if (!hasSet) {
doDefault();
hasSet = true;
}
return Primitive.vbox(
AIBox,
nameDisplay
);
}
}
public Node getNode() {
return container;
}
private Node makeAIButton(int depth, int thinktime, String name) {
return Primitive.button(name, () -> {
information.name = getName(name);
information.computerDifficulty = depth;
information.computerThinkTime = thinktime;
this.playerName.setText(getName(name));
}, false);
}
private String getName(String name) {
return switch (name) {
case "sinterklaas" -> "Sint. R. Klaas";
case "zwartepiet" -> "Zwarte Piet";
case "santa" -> "Santa";
default -> "Default";
};
}
private void doDefault() {
information.name = getName("zwartepiet");
information.computerDifficulty = 0;
information.computerThinkTime = 1;
this.playerName.setText(getName("zwartepiet"));
}
}

View File

@@ -0,0 +1,21 @@
package org.toop.app.widget.complex;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
public abstract class PopupWidget extends StackWidget {
private final Button popButton;
public PopupWidget() {
super("bg-popup");
popButton = new Button("X");
popButton.setOnAction(_ -> hide());
add(Pos.TOP_RIGHT, popButton);
}
protected void setOnPop(Runnable onPop) {
popButton.setOnAction(_ -> onPop.run());
}
}

View File

@@ -0,0 +1,44 @@
package org.toop.app.widget.complex;
import org.toop.app.widget.Widget;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.layout.StackPane;
public abstract class StackWidget extends StackPane implements Widget {
public StackWidget(String cssClass) {
this.getStyleClass().add(cssClass);
}
public void add(Pos position, Node node) {
Platform.runLater(() -> {
if (this.getChildren().contains(node)) {
return;
}
StackPane.setAlignment(node, position);
this.getChildren().add(node);
});
}
public void add(Pos position, Widget widget) {
add(position, widget.getNode());
}
public void remove(Node node) {
Platform.runLater(() -> {
this.getChildren().remove(node);
});
}
public void remove(Widget widget) {
remove(widget.getNode());
}
@Override
public StackPane getNode() {
return this;
}
}

View File

@@ -0,0 +1,61 @@
package org.toop.app.widget.complex;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Pos;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import java.util.ArrayList;
import java.util.List;
public class TableWidget<DATATYPE> extends PopupWidget {
private ObservableList<DATATYPE> serverList = FXCollections.observableArrayList();
private TableView<DATATYPE> table = new TableView<>();
public TableWidget(String... columns) {
var cols = new ArrayList<TableColumn<DATATYPE, String>>();
for (String column : columns) {
TableColumn<DATATYPE, String> col = new TableColumn<>(column.toUpperCase());
col.setCellValueFactory(new PropertyValueFactory<>(column));
cols.add(col);
}
table.getColumns().addAll(cols);
update();
onColumnClicked();
add(Pos.CENTER, table);
}
public void add(DATATYPE serverFound) {
serverList.add(serverFound);
update();
}
public void add(List<DATATYPE> serverFound) {
serverList.addAll(serverFound);
}
public void remove(DATATYPE serverFound) {
serverList.remove(serverFound);
update();
}
public void onColumnClicked() {
table.setOnMouseClicked(event -> {
DATATYPE selected = table.getSelectionModel().getSelectedItem();
if (selected == null) return;
IO.println(selected.toString());
});
}
private void update() {
table.setItems(serverList);
}
}

View File

@@ -0,0 +1,65 @@
package org.toop.app.widget.complex;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.Widget;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.local.AppContext;
import java.util.function.Consumer;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
public class ToggleWidget implements Widget {
private final Button button;
private final VBox container;
private final String onKey;
private final String offKey;
private boolean state;
public ToggleWidget(String onKey, String offKey, boolean initialState, Consumer<Boolean> onToggle) {
this.onKey = onKey;
this.offKey = offKey;
this.state = initialState;
button = new Button(AppContext.getString(getCurrentKey()));
button.setOnAction(_ -> {
state = !state;
updateText();
if (onToggle != null) {
onToggle.accept(state);
new EventFlow().addPostEvent(new AudioEvents.ClickButton()).postEvent(); // TODO FIX PRIMITIVES
}
});
container = Primitive.vbox(button);
}
private String getCurrentKey() {
return state? offKey : onKey;
}
private void updateText() {
button.setText(AppContext.getString(getCurrentKey()));
}
public boolean getState() {
return state;
}
public void setState(boolean newState) {
if (state != newState) {
state = newState;
updateText();
}
}
@Override
public Node getNode() {
return container;
}
}

View File

@@ -0,0 +1,5 @@
package org.toop.app.widget.complex;
public interface Update {
void update() throws Exception;
}

View File

@@ -0,0 +1,104 @@
package org.toop.app.widget.complex;
import org.toop.app.widget.Primitive;
import javafx.geometry.Pos;
public abstract class ViewWidget extends StackWidget {
private ViewWidget previous = null;
public ViewWidget() {
super("bg-primary");
}
public void transition(ViewWidget view) {
view.previous = this;
replace(Pos.CENTER, view);
}
public void transitionNext(ViewWidget view) {
transitionNext(view, false);
}
public void transitionNext(ViewWidget view, boolean aware) {
if (aware && this.getClass().equals(view.getClass())) {
view.previous = this.previous;
}
else{
view.previous = this;
}
replace(Pos.CENTER, view);
var backButton = Primitive.button("back", () -> {
view.transitionPrevious();
}, false);
view.add(Pos.BOTTOM_LEFT, Primitive.vbox(backButton));
}
public void transitionNextCustom(ViewWidget view, String key, Runnable runnable) {
view.previous = this;
replace(Pos.CENTER, view);
var customButton = Primitive.button(key, () -> {
runnable.run();
view.transitionPrevious();
}, false);
view.add(Pos.BOTTOM_LEFT, Primitive.vbox(customButton));
}
public void transitionPrevious() {
if (previous == null) {
return;
}
replace(Pos.CENTER, previous);
previous = null;
}
public void removeIndexFromPreviousChain(int index) {
ViewWidget view = this;
while (index > 0 && view != null) {
index--;
if (index == 0) {
if (view.previous != null && view.previous.previous != null) {
view.previous = view.previous.previous;
}
}
view = view.previous;
}
}
public void removeViewFromPreviousChain(ViewWidget view) {
ViewWidget prev = previous;
int index = 0;
while (prev != null) {
index++;
if (prev == view) {
removeIndexFromPreviousChain(index);
break;
}
prev = prev.previous;
}
}
public void reload(ViewWidget view) {
view.previous = previous;
replace(Pos.CENTER, view);
var backButton = Primitive.button("back", () -> {
view.transitionPrevious();
}, false);
view.add(Pos.BOTTOM_LEFT, Primitive.vbox(backButton));
}
}

View File

@@ -0,0 +1,117 @@
package org.toop.app.widget.display;
import org.toop.app.widget.Widget;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.eventbus.GlobalEventBus;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ProgressBar;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
public class SongDisplay extends VBox implements Widget {
private final Text songTitle;
private final ProgressBar progressBar;
private final Text progressText;
public SongDisplay() {
new EventFlow()
.listen(AudioEvents.PlayingMusic.class, this::updateTheSong, false);
setAlignment(Pos.CENTER);
setMaxHeight(Region.USE_PREF_SIZE);
getStyleClass().add("song-display");
// TODO ADD GOOD SONG TITLES WITH ARTISTS DISPLAYED
songTitle = new Text("song playing");
songTitle.getStyleClass().add("song-title");
progressBar = new ProgressBar(0);
progressBar.getStyleClass().add("loading-progress-bar");
progressText = new Text("0:00/0:00");
progressText.getStyleClass().add("progress-text");
// TODO ADD BETTER CSS FOR THE SKIPBUTTON WHERE ITS AT A NICER POSITION
Button skipButton = new Button(">>");
Button pauseButton = new Button("");
Button previousButton = new Button("<<");
skipButton.getStyleClass().setAll("skip-button");
pauseButton.getStyleClass().setAll("pause-button");
previousButton.getStyleClass().setAll("previous-button");
skipButton.setOnAction( event -> {
GlobalEventBus.get().post(new AudioEvents.SkipMusic());
});
pauseButton.setOnAction(event -> {
GlobalEventBus.get().post(new AudioEvents.PauseMusic());
if (pauseButton.getText().equals("")) {
pauseButton.setText("");
}
else if (pauseButton.getText().equals("")) {
pauseButton.setText("");
}
});
previousButton.setOnAction( event -> {
GlobalEventBus.get().post(new AudioEvents.PreviousMusic());
});
HBox control = new HBox(10, previousButton, pauseButton, skipButton);
control.setAlignment(Pos.CENTER);
control.getStyleClass().add("controls");
getChildren().addAll(songTitle, progressBar, progressText, control);
}
private void updateTheSong(AudioEvents.PlayingMusic event) {
Platform.runLater(() -> {
String text = event.name();
text = text.substring(0, text.length() - 4);
songTitle.setText(text);
double currentPos = event.currentPosition();
double duration = event.duration();
if (currentPos / duration > 0.05) {
double progress = currentPos / duration;
progressBar.setProgress(progress);
}
else if (currentPos / duration < 0.05) {
progressBar.setProgress(0.05);
}
progressText.setText(getTimeString(event.currentPosition(), event.duration()));
});
}
private String getTimeString(long position, long duration) {
long positionMinutes = position / 60;
long durationMinutes = duration / 60;
long positionSeconds = position % 60;
long durationSeconds = duration % 60;
String positionSecondsStr = String.valueOf(positionSeconds);
String durationSecondsStr = String.valueOf(durationSeconds);
if (positionSeconds < 10) {
positionSecondsStr = "0" + positionSeconds;
}
if (durationSeconds < 10) {
durationSecondsStr = "0" + durationSeconds;
}
String time = positionMinutes + ":" + positionSecondsStr + " / " + durationMinutes + ":" + durationSecondsStr;
return time;
}
@Override
public Node getNode() {
return this;
}
}

View File

@@ -0,0 +1,64 @@
package org.toop.app.widget.popup;
import org.toop.app.GameInformation;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.PlayerInfoWidget;
import org.toop.app.widget.complex.PopupWidget;
import java.util.function.Consumer;
import javafx.geometry.Pos;
import org.toop.local.AppContext;
public final class ChallengePopup extends PopupWidget {
private final GameInformation.Player playerInformation;
private final String challenger;
private final String game;
private final Consumer<GameInformation.Player> onAccept;
public ChallengePopup(String challenger, String game, Consumer<GameInformation.Player> onAccept) {
this.challenger = challenger;
this.game = game;
this.onAccept = onAccept;
this.playerInformation = new GameInformation.Player();
setupLayout();
}
private void setupLayout() {
var challengeText = Primitive.text("you-were-challenged-by");
var challengerHeader = Primitive.header(challenger, false);
var toAGameOfText = Primitive.text("to-a-game-of");
var gameHeader = Primitive.header(game, false);
var acceptButton = Primitive.button("accept", () -> {
onAccept.accept(playerInformation);
this.hide();
}, false);
var denyButton = Primitive.button("deny", () -> hide(), false);
var leftSection = Primitive.vbox(
challengeText,
challengerHeader,
toAGameOfText,
gameHeader,
Primitive.separator(),
Primitive.hbox(
acceptButton,
denyButton
)
);
var playerInfoWidget = new PlayerInfoWidget(playerInformation);
add(Pos.CENTER,
Primitive.hbox(
leftSection,
playerInfoWidget.getNode()
)
);
}
}

View File

@@ -0,0 +1,16 @@
package org.toop.app.widget.popup;
import org.toop.app.widget.complex.ConfirmWidget;
import org.toop.app.widget.complex.PopupWidget;
import javafx.geometry.Pos;
public class ErrorPopup extends PopupWidget {
public ErrorPopup(String error) {
var confirmWidget = new ConfirmWidget("error");
confirmWidget.setMessage(error);
confirmWidget.addButton("ok", this::hide);
add(Pos.CENTER, confirmWidget);
}
}

View File

@@ -0,0 +1,48 @@
package org.toop.app.widget.popup;
import javafx.geometry.Pos;
import javafx.scene.Node;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.Widget;
import org.toop.app.widget.WidgetContainer;
import org.toop.app.widget.complex.PopupWidget;
import org.toop.app.widget.complex.ViewWidget;
import org.toop.app.widget.view.GameView;
import org.toop.app.widget.view.OptionsView;
import org.toop.local.AppContext;
import java.util.ArrayList;
public class EscapePopup extends PopupWidget {
public EscapePopup() {
ViewWidget currentView = WidgetContainer.getCurrentView();
ArrayList<Node> nodes = new ArrayList<>();
nodes.add(Primitive.button("Continue", this::hide, false, false)); // TODO, localize
if (!(currentView.getClass().isAssignableFrom(OptionsView.class))) {
var opt = Primitive.button("options", () -> {
hide();
WidgetContainer.getCurrentView().transitionNext(new OptionsView());
}, false);
nodes.add(opt);
}
if (currentView.getClass().isAssignableFrom(GameView.class)) {
Widget tut = AppContext.currentTutorial();
if (tut != null) {
nodes.add(Primitive.button("tutorialstring", () -> {
WidgetContainer.getCurrentView().add(Pos.CENTER, tut);
}, false));
}
}
nodes.add(Primitive.button("quit", () -> {
hide();
WidgetContainer.add(Pos.CENTER, new QuitPopup());
}, false));
add(Pos.CENTER, Primitive.vbox(nodes.toArray(new Node[0])));
}
}

View File

@@ -0,0 +1,23 @@
package org.toop.app.widget.popup;
import org.toop.app.widget.complex.ConfirmWidget;
import org.toop.app.widget.complex.PopupWidget;
import javafx.geometry.Pos;
import org.toop.framework.game.games.reversi.BitboardReversi;
public final class GameOverPopup extends PopupWidget {
public GameOverPopup(boolean winOrTie, String winner) {
var confirmWidget = new ConfirmWidget("game-over");
if (winOrTie) {
confirmWidget.setMessage(winner + " won the game!");
}
else{
confirmWidget.setMessage("It was a tie!");
}
confirmWidget.addButton("ok", this::hide);
add(Pos.CENTER, confirmWidget);
}
}

View File

@@ -0,0 +1,27 @@
package org.toop.app.widget.popup;
import org.toop.app.App;
import org.toop.app.widget.complex.ConfirmWidget;
import org.toop.app.widget.complex.PopupWidget;
import javafx.geometry.Pos;
public class QuitPopup extends PopupWidget {
public QuitPopup() {
var confirmWidget = new ConfirmWidget("are-you-sure");
confirmWidget.addButton("yes", () -> {
App.quit();
});
confirmWidget.addButton("no", () -> {
hide();
});
add(Pos.CENTER, confirmWidget);
setOnPop(() -> {
hide();
});
}
}

View File

@@ -0,0 +1,90 @@
package org.toop.app.widget.popup;
import org.toop.app.GameInformation;
import org.toop.app.Server;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.LabeledChoiceWidget;
import org.toop.app.widget.complex.PlayerInfoWidget;
import org.toop.app.widget.complex.PopupWidget;
import org.toop.local.AppContext;
import java.util.function.BiConsumer;
import javafx.geometry.Pos;
import javafx.util.StringConverter;
public final class SendChallengePopup extends PopupWidget {
private final Server server;
private final String opponent;
private final BiConsumer<GameInformation.Player, String> onSend;
private final GameInformation.Player playerInformation;
public SendChallengePopup(Server server, String opponent, BiConsumer<GameInformation.Player, String> onSend) {
this.server = server;
this.opponent = opponent;
this.onSend = onSend;
this.playerInformation = new GameInformation.Player();
setupLayout();
}
private void setupLayout() {
// --- Left side: challenge text and buttons ---
var challengeText = Primitive.text("challenge");
var opponentHeader = Primitive.header(opponent, false);
var gameText = Primitive.text("to-a-game-of");
var games = server.getGameList();
var gameChoice = new LabeledChoiceWidget<>(
"game",
new StringConverter<>() {
@Override
public String toString(String game) {
return AppContext.getString(game);
}
@Override
public String fromString(String s) { return null; }
},
games.getFirst(),
newGame -> {
playerInformation.computerDifficulty = Math.min(
playerInformation.computerDifficulty,
Server.gameToType(newGame).getMaxDepth()
);
},
games.toArray(new String[0])
);
var sendButton = Primitive.button(
"send",
() -> { onSend.accept(playerInformation, gameChoice.getValue()); this.hide(); }
, false);
var cancelButton = Primitive.button("cancel", () -> hide(), false);
var leftSection = Primitive.vbox(
challengeText,
opponentHeader,
gameText,
gameChoice.getNode(),
Primitive.separator(),
Primitive.hbox(
sendButton,
cancelButton
)
);
var playerInfoWidget = new PlayerInfoWidget(playerInformation);
add(Pos.CENTER,
Primitive.hbox(
leftSection,
playerInfoWidget.getNode()
)
);
}
}

View File

@@ -0,0 +1,112 @@
package org.toop.app.widget.tutorial;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.image.ImageView;
import javafx.scene.text.Text;
import org.apache.maven.surefire.shared.lang3.tuple.ImmutablePair;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.Updatable;
import org.toop.app.widget.complex.PopupWidget;
import org.toop.framework.resource.resources.ImageAsset;
import org.toop.local.AppContext;
import java.util.List;
/**
* A widget base for all the tutorial widgets.
*
* <p>Usage example:
*
* <pre>{@code
* public class Connect4TutorialWidget extends BaseTutorialWidget {
* public Connect4TutorialWidget(Runnable nextScreen) {
* super(List.of(
* new ImmutablePair<>("connect4.1", ResourceManager.get("connect41.png")),
* new ImmutablePair<>("connect4.2", ResourceManager.get("connect42.png"))
* ), nextScreen);
* }
* }</pre>
*/
public class BaseTutorialWidget extends PopupWidget implements Updatable {
private final Text tutorialText;
private final ImageView imagery;
private final Button previousButton;
private final Button nextButton;
private final List<ImmutablePair<String, ImageAsset>> pages;
private final Runnable nextScreen;
private int pageIndex = 0;
public BaseTutorialWidget(List<ImmutablePair<String, ImageAsset>> pages, Runnable nextScreen) {
this.tutorialText = Primitive.text(pages.getFirst().getKey());
this.imagery = Primitive.image(pages.getFirst().getValue());
this.pages = pages;
this.nextScreen = nextScreen;
previousButton = Primitive.button("goback", () -> { update(false); this.hide(); }, false);
nextButton = Primitive.button(">", () -> update(true), false);
var w = Primitive.hbox(
previousButton,
nextButton
);
var x = Primitive.vbox(imagery, tutorialText);
add(Pos.CENTER, Primitive.vbox(x, w));
}
@Override
public void update() {
update(true);
}
// TODO Refactor if statements to make code easier to read.
public void update(boolean next) {
pageIndex = next ? pageIndex + 1 : pageIndex - 1;
if (pageIndex >= pages.size()) {
pageIndex--;
return;
} else if (pageIndex < 0) {
pageIndex++;
return;
}
if (pageIndex == pages.size()-1) {
nextButton.textProperty().unbind();
nextButton.setText(AppContext.getString("startgame"));
nextButton.setOnAction((_) -> {
this.hide();
nextScreen.run();
});
} else {
nextButton.textProperty().unbind();
nextButton.setText(AppContext.getString(">"));
nextButton.setOnAction((_) -> this.update(true));
}
if (pageIndex == 0) {
previousButton.textProperty().unbind();
previousButton.setText(AppContext.getString("goback"));
previousButton.setOnAction((_) -> this.hide());
} else {
previousButton.textProperty().unbind();
previousButton.setText(AppContext.getString("<"));
previousButton.setOnAction((_) -> this.update(false));
}
var currentPage = pages.get(pageIndex);
var text = currentPage.getKey();
var image = currentPage.getValue();
tutorialText.textProperty().unbind();
tutorialText.setText(AppContext.getString(text));
imagery.setImage(Primitive.image(image).getImage());
}
}

View File

@@ -0,0 +1,15 @@
package org.toop.app.widget.tutorial;
import org.apache.maven.surefire.shared.lang3.tuple.ImmutablePair;
import org.toop.framework.resource.ResourceManager;
import java.util.List;
public class Connect4TutorialWidget extends BaseTutorialWidget {
public Connect4TutorialWidget(Runnable nextScreen) {
super(List.of(
new ImmutablePair<>("connect4.1", ResourceManager.get("connect41.png")),
new ImmutablePair<>("connect4.2", ResourceManager.get("connect42.png"))
), nextScreen);
}
}

View File

@@ -0,0 +1,17 @@
package org.toop.app.widget.tutorial;
import org.apache.maven.surefire.shared.lang3.tuple.ImmutablePair;
import org.toop.framework.resource.ResourceManager;
import java.util.List;
public class ReversiTutorialWidget extends BaseTutorialWidget {
public ReversiTutorialWidget(Runnable nextScreen) {
super(List.of(
new ImmutablePair<>("reversi1", ResourceManager.get("reversi1.png")),
new ImmutablePair<>("reversi2", ResourceManager.get("reversi2.png")),
new ImmutablePair<>("reversi3", ResourceManager.get("cat.jpg")),
new ImmutablePair<>("reversi4", ResourceManager.get("cat.jpg"))
), nextScreen);
}
}

View File

@@ -0,0 +1,22 @@
package org.toop.app.widget.tutorial;
import javafx.geometry.Pos;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.WidgetContainer;
import org.toop.app.widget.complex.PopupWidget;
import org.toop.local.AppSettings;
public class ShowEnableTutorialWidget extends PopupWidget {
public ShowEnableTutorialWidget(Runnable tutorial, Runnable nextScreen, Runnable appSettingsSetter) {
var a = Primitive.hbox(
Primitive.button("ok", () -> { appSettingsSetter.run(); tutorial.run(); this.hide(); }, false),
Primitive.button("no", () -> { appSettingsSetter.run(); nextScreen.run(); this.hide(); }, false),
Primitive.button("never", () -> { AppSettings.getSettings().setTutorialFlag(false); nextScreen.run(); this.hide(); }, false)
);
var txt = Primitive.text("tutorial");
add(Pos.CENTER, Primitive.vbox(txt, a));
WidgetContainer.add(Pos.CENTER, this);
}
}

View File

@@ -0,0 +1,16 @@
package org.toop.app.widget.tutorial;
import org.apache.maven.surefire.shared.lang3.tuple.ImmutablePair;
import org.toop.framework.resource.ResourceManager;
import java.util.List;
public class TicTacToeTutorialWidget extends BaseTutorialWidget {
public TicTacToeTutorialWidget(Runnable nextScreen) {
super(List.of(
new ImmutablePair<>("tictactoe1", ResourceManager.get("tictactoe1.png")),
new ImmutablePair<>("tictactoe2", ResourceManager.get("tictactoe2.png"))
), nextScreen);
}
}

View File

@@ -0,0 +1,81 @@
package org.toop.app.widget.view;
import org.toop.app.App;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.ViewWidget;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.geometry.Pos;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.text.Text;
import javafx.util.Duration;
public class CreditsView extends ViewWidget {
public CreditsView() {
var scrumMasterCredit = newCredit("scrum-master", "Stef");
var productOwnerCredit = newCredit("product-owner", "Omar");
var mergeCommanderCredit = newCredit("merge-commander", "Bas");
var localizationCredit = newCredit("localization", "Ticho");
var aiCredit = newCredit("ai", "Michiel");
var developersCredit = newCredit("developers", "Michiel, Bas, Stef, Omar, Ticho");
var moralSupportCredit = newCredit("moral-support", "Wesley");
var openglCredit = newCredit("opengl", "Omar");
var topSpacer = new Region();
topSpacer.setPrefHeight(App.getHeight());
var bottomSpacer = new Region();
bottomSpacer.setPrefHeight(App.getHeight());
var creditsContainer = Primitive.vbox(
topSpacer,
scrumMasterCredit,
productOwnerCredit,
mergeCommanderCredit,
localizationCredit,
aiCredit,
developersCredit,
moralSupportCredit,
openglCredit,
bottomSpacer
);
var creditsScroll = Primitive.scroll(creditsContainer);
creditsScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
creditsScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
add(Pos.CENTER, creditsScroll);
animate(creditsScroll, 15);
}
private HBox newCredit(String key, String other) {
var credit = new Text(": " + other);
credit.getStyleClass().add("header");
var creditBox = Primitive.hbox(
Primitive.header(key),
credit
);
creditBox.setPrefHeight(App.getHeight() / 3.0);
return creditBox;
}
private void animate(ScrollPane scroll, int length) {
final Timeline timeline = new Timeline(
new KeyFrame(Duration.seconds(0), new KeyValue(scroll.vvalueProperty(), 0.0)),
new KeyFrame(Duration.seconds(length), new KeyValue(scroll.vvalueProperty(), 1.0))
);
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.play();
}
}

View File

@@ -0,0 +1,195 @@
package org.toop.app.widget.view;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.text.Font;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.ViewWidget;
import org.toop.app.widget.popup.GameOverPopup;
import java.util.Objects;
import java.util.function.Consumer;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.text.Text;
import org.toop.app.widget.tutorial.Connect4TutorialWidget;
import org.toop.app.widget.tutorial.ReversiTutorialWidget;
import org.toop.app.widget.tutorial.TicTacToeTutorialWidget;
import org.toop.local.AppContext;
public final class GameView extends ViewWidget {
private final Text playerHeader;
private final Text turnHeader;
private final Text player1Header;
private final Text player2Header;
private Circle player1Icon;
private Circle player2Icon;
private final Text player1Score;
private final Text player2Score;
private final Button forfeitButton;
private final Button exitButton;
private final TextField chatInput;
private final Text keyThingy;
private boolean hasSet = false;
public GameView(Runnable onForfeit, Runnable onExit, Consumer<String> onMessage, String gameType) {
playerHeader = Primitive.header("");
turnHeader = Primitive.header("");
keyThingy = Primitive.text("turnof");
player1Header = Primitive.header("");
player2Header = Primitive.header("");
player1Icon = new Circle();
player2Icon = new Circle();
player1Score = Primitive.header("");
player2Score = Primitive.header("");
if (onForfeit != null) {
forfeitButton = Primitive.button("forfeit", () -> onForfeit.run(), false);
} else {
forfeitButton = null;
}
exitButton = Primitive.button("exit", () -> {
onExit.run();
transitionPrevious();
}, false);
if (onMessage != null) {
chatInput = Primitive.input("enter-your-message", "", null);
chatInput.setOnAction(_ -> {
onMessage.accept(chatInput.getText());
chatInput.clear();
});
} else {
chatInput = null;
}
switch (gameType) {
case "TicTacToe":
AppContext.setCurrentTutorial(new TicTacToeTutorialWidget(() -> {}));
break;
case "Reversi":
AppContext.setCurrentTutorial(new ReversiTutorialWidget(() -> {}));
break;
case "Connect4":
AppContext.setCurrentTutorial(new Connect4TutorialWidget(() -> {}));
break;
}
setupLayout();
}
private void setupLayout() {
var turnInfo = Primitive.vbox(
turnHeader
);
add(Pos.TOP_CENTER, turnInfo);
var buttons = Primitive.vbox(
forfeitButton,
exitButton
);
add(Pos.BOTTOM_LEFT, buttons);
if (chatInput != null) {
add(Pos.BOTTOM_RIGHT, Primitive.vbox(chatInput));
}
}
public void nextPlayer(boolean isMe, String currentPlayer, String nextPlayer, String GameType) {
Platform.runLater(() -> {
if (!(hasSet)) {
playerHeader.setText(currentPlayer + " vs. " + nextPlayer);
hasSet = true;
setPlayerHeaders(isMe, currentPlayer, nextPlayer, GameType);
}
//TODO idk if theres any way to check this? only EN uses 's and the rest doesnt. if theres a better way to do this pls let me know
if (AppContext.getLocale().toLanguageTag().equals("en")) {
turnHeader.setText(currentPlayer + keyThingy.getText());
}
});
}
public void gameOver(boolean iWon, String winner) {
new GameOverPopup(iWon, winner).show(Pos.CENTER);
}
private void setPlayerHeaders(boolean isMe, String currentPlayer, String nextPlayer, String GameType) {
if (Objects.equals(GameType, "TicTacToe")) {
if (isMe) {
player1Header.setText("X: " + currentPlayer);
player2Header.setText("O: " + nextPlayer);
}
else {
player1Header.setText("X: " + nextPlayer);
player2Header.setText("O: " + currentPlayer);
}
setPlayerInfoTTT();
}
else if (Objects.equals(GameType, "Reversi")) {
if (isMe) {
player1Header.setText(currentPlayer);
player2Header.setText(nextPlayer);
}
else {
player1Header.setText(nextPlayer);
player2Header.setText(currentPlayer);
}
setPlayerInfoReversi();
}
}
private void setPlayerInfoTTT() {
var playerInfo = Primitive.vbox(
playerHeader,
Primitive.separator(),
player1Header,
player2Header
);
add(Pos.TOP_RIGHT, playerInfo);
}
private void setPlayerInfoReversi() {
var player1box = Primitive.hbox(
player1Icon,
player1Header,
player1Score
);
player1box.getStyleClass().add("hboxspacing");
var player2box = Primitive.hbox(
player2Icon,
player2Header,
player2Score
);
player2box.getStyleClass().add("hboxspacing");
var playerInfo = Primitive.vbox(
playerHeader,
Primitive.separator(),
player1box,
player2box
);
player1Icon.setRadius(player1Header.fontProperty().map(Font::getSize).getValue());
player2Icon.setRadius(player2Header.fontProperty().map(Font::getSize).getValue());
player1Icon.setFill(Color.WHITE);
player2Icon.setFill(Color.BLACK);
add(Pos.TOP_RIGHT, playerInfo);
}
public void setPlayer1Score(int score) {
player1Score.setText("(" + Integer.toString(score) + ")");
}
public void setPlayer2Score(int score) {
player2Score.setText("(" + Integer.toString(score) + ")");
}
}

View File

@@ -0,0 +1,145 @@
package org.toop.app.widget.view;
import javafx.application.Platform;
import org.toop.app.GameInformation;
import org.toop.app.gameControllers.ReversiBitController;
import org.toop.app.gameControllers.TicTacToeBitController;
import org.toop.framework.game.players.LocalPlayer;
import org.toop.framework.gameFramework.controller.GameController;
import org.toop.framework.gameFramework.model.player.Player;
import org.toop.framework.game.players.ArtificialPlayer;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.PlayerInfoWidget;
import org.toop.app.widget.complex.ViewWidget;
import org.toop.app.widget.popup.ErrorPopup;
import org.toop.app.widget.tutorial.*;
import org.toop.game.players.ai.MiniMaxAI;
import org.toop.game.players.ai.mcts.MCTSAI1;
import org.toop.game.players.ai.mcts.MCTSAI3;
import org.toop.game.players.ai.mcts.MCTSAI4;
import org.toop.local.AppContext;
import javafx.geometry.Pos;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import org.toop.local.AppSettings;
public class LocalMultiplayerView extends ViewWidget {
private final GameInformation information;
private GameController gameController;
public LocalMultiplayerView(GameInformation.Type type) {
this(new GameInformation(type));
}
public LocalMultiplayerView(GameInformation information) {
this.information = information;
var playButton = Primitive.button("play", () -> {
if (gameController != null) {
gameController.stop();
}
for (var player : information.players) {
if (player.isHuman && player.name.isEmpty()) {
new ErrorPopup(AppContext.getString("please-enter-your-name")).show(Pos.CENTER);
return;
}
}
// TODO: Fix this temporary ass way of setting the players
Player[] players = new Player[2];
switch (information.type) {
case TICTACTOE:
if (information.players[0].isHuman) {
players[0] = new LocalPlayer(information.players[0].name);
} else {
players[0] = new ArtificialPlayer(new MCTSAI1(100), "MCTS AI");
}
if (information.players[1].isHuman) {
players[1] = new LocalPlayer(information.players[1].name);
} else {
players[1] = new ArtificialPlayer(new MiniMaxAI(9), "MiniMax AI");
}
if (AppSettings.getSettings().getTutorialFlag() && AppSettings.getSettings().getFirstTTT()) {
new ShowEnableTutorialWidget(
() -> new TicTacToeTutorialWidget(() -> {
gameController = new TicTacToeBitController(players);
gameController.start();
}),
() -> Platform.runLater(() -> {
gameController = new TicTacToeBitController(players);
gameController.start();
}),
() -> AppSettings.getSettings().setFirstTTT(false)
);
} else {
gameController = new TicTacToeBitController(players);
gameController.start();
}
break;
case REVERSI:
if (information.players[0].isHuman) {
players[0] = new LocalPlayer(information.players[0].name);
} else {
// players[0] = new ArtificialPlayer(new RandomAI(), "Random AI");
players[0] = new ArtificialPlayer(new MCTSAI1(100), "MCTS V1 AI");
}
if (information.players[1].isHuman) {
players[1] = new LocalPlayer(information.players[1].name);
} else {
players[1] = new ArtificialPlayer(new MCTSAI4(100, 8), "MCTS V4 AI");
}
if (AppSettings.getSettings().getTutorialFlag() && AppSettings.getSettings().getFirstReversi()) {
new ShowEnableTutorialWidget(
() -> new ReversiTutorialWidget(() -> {
gameController = new ReversiBitController(players);
gameController.start();
}),
() -> Platform.runLater(() -> {
gameController = new ReversiBitController(players);
gameController.start();
}),
() -> AppSettings.getSettings().setFirstReversi(false)
);
} else {
gameController = new ReversiBitController(players);
gameController.start();
}
break;
}
}, false);
var playerSection = setupPlayerSections();
add(Pos.CENTER, Primitive.vbox(
playerSection,
Primitive.separator(),
playButton
));
}
private ScrollPane setupPlayerSections() {
int playerCount = information.type.getPlayerCount();
VBox[] playerBoxes = new VBox[playerCount];
for (int i = 0; i < playerCount; i++) {
var player = information.players[i];
var playerHeader = Primitive.header("");
playerHeader.setText("player" + " #" + (i + 1));
var playerWidget = new PlayerInfoWidget(player);
playerBoxes[i] = Primitive.vbox(
playerHeader,
Primitive.separator(),
playerWidget.getNode()
);
}
return Primitive.scroll(Primitive.hbox(
playerBoxes
));
}
}

View File

@@ -0,0 +1,24 @@
package org.toop.app.widget.view;
import org.toop.app.GameInformation;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.ViewWidget;
import javafx.geometry.Pos;
public class LocalView extends ViewWidget {
public LocalView() {
var ticTacToeButton = Primitive.button("tic-tac-toe", () -> {
transitionNext(new LocalMultiplayerView(GameInformation.Type.TICTACTOE));
}, false);
var reversiButton = Primitive.button("reversi", () -> {
transitionNext(new LocalMultiplayerView(GameInformation.Type.REVERSI));
}, false);
add(Pos.CENTER, Primitive.vbox(
ticTacToeButton,
reversiButton
));
}
}

View File

@@ -0,0 +1,39 @@
package org.toop.app.widget.view;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.ViewWidget;
import javafx.geometry.Pos;
import org.toop.app.widget.popup.QuitPopup;
public class MainView extends ViewWidget {
public MainView() {
var localButton = Primitive.button("local", () -> {
transitionNext(new LocalView());
}, false);
var onlineButton = Primitive.button("online", () -> {
transitionNext(new OnlineView());
}, false);
var creditsButton = Primitive.button("credits", () -> {
transitionNext(new CreditsView());
}, false);
var optionsButton = Primitive.button("options", () -> {
transitionNext(new OptionsView());
}, false);
var quitButton = Primitive.button("quit", () -> {
var a = new QuitPopup();
a.show(Pos.CENTER);
}, false);
add(Pos.CENTER, Primitive.vbox(
localButton,
onlineButton,
creditsButton,
optionsButton,
quitButton
));
}
}

View File

@@ -0,0 +1,72 @@
package org.toop.app.widget.view;
import org.toop.app.Server;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.LabeledInputWidget;
import org.toop.app.widget.complex.ViewWidget;
import javafx.geometry.Pos;
import org.toop.framework.game.games.reversi.BitboardReversi;
import org.toop.framework.game.games.tictactoe.BitboardTicTacToe;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
import org.toop.framework.networking.server.gateway.NettyGatewayServer;
import org.toop.framework.networking.server.stores.TurnBasedGameTypeStore;
import java.time.Duration;
import java.util.concurrent.ConcurrentHashMap;
public class OnlineView extends ViewWidget {
public OnlineView() {
var serverInformationHeader = Primitive.header("server-information");
var serverIPInput = new LabeledInputWidget("ip-address", "enter-the-server-ip", "", _ -> {});
var serverPortInput = new LabeledInputWidget("port", "enter-the-server-port", "", _ -> {});
var playerNameInput = new LabeledInputWidget("player-name", "enter-your-name", "", _ -> {});
var connectButton = Primitive.button("connect", () -> {
new Server(
serverIPInput.getValue(),
serverPortInput.getValue(),
playerNameInput.getValue()
);
}, false);
var localHostButton = Primitive.button("host!", () -> {
var tps = new TurnBasedGameTypeStore();
tps.register("tic-tac-toe", BitboardTicTacToe::new);
tps.register("reversi", BitboardReversi::new);
var a = new NettyGatewayServer(6666, tps, Duration.ofSeconds(10));
new Thread(() -> {
try {
a.start();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}).start();
new Server(
"127.0.0.1",
"6666",
"host",
a
);
}, false, false);
add(Pos.CENTER, Primitive.vbox(
serverInformationHeader,
Primitive.separator(),
serverIPInput.getNode(),
serverPortInput.getNode(),
playerNameInput.getNode(),
Primitive.separator(),
connectButton,
Primitive.separator(),
localHostButton
));
}
}

View File

@@ -0,0 +1,161 @@
package org.toop.app.widget.view;
import org.toop.app.App;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.LabeledChoiceWidget;
import org.toop.app.widget.complex.LabeledSliderWidget;
import org.toop.app.widget.complex.ViewWidget;
import org.toop.app.widget.complex.ToggleWidget;
import org.toop.framework.audio.VolumeControl;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.local.AppContext;
import org.toop.local.AppSettings;
import java.util.Locale;
import javafx.geometry.Pos;
import javafx.scene.layout.VBox;
import javafx.util.StringConverter;
public class OptionsView extends ViewWidget {
public OptionsView() {
add(Pos.CENTER, Primitive.hbox(
generalSection(),
volumeSection(),
styleSection()
));
}
private VBox generalSection() {
var languageWidget = new LabeledChoiceWidget<>(
"language",
new StringConverter<>() {
@Override
public String toString(Locale locale) {
return AppContext.getString(locale.getDisplayName().toLowerCase());
}
@Override
public Locale fromString(String s) { return null; }
},
AppContext.getLocale(),
newLocale -> {
AppSettings.getSettings().setLocale(newLocale.toString());
AppContext.setLocale(newLocale);
reload(new OptionsView());
},
AppContext.getLocalization().getAvailableLocales().toArray(new Locale[0])
);
var fullscreenToggle = new ToggleWidget(
"fullscreen", "windowed",
AppSettings.getSettings().getFullscreen(),
fullscreen -> {
AppSettings.getSettings().setFullscreen(fullscreen);
App.setFullscreen(fullscreen);
}
);
return Primitive.vbox(
Primitive.header("general"),
Primitive.separator(),
languageWidget.getNode(),
fullscreenToggle.getNode()
);
}
private VBox volumeSection() {
var masterVolumeWidget = new LabeledSliderWidget(
"master-volume",
0, 100,
AppSettings.getSettings().getVolume(),
val -> {
AppSettings.getSettings().setVolume(val);
new EventFlow()
.addPostEvent(new AudioEvents.ChangeVolume(val, VolumeControl.MASTERVOLUME))
.postEvent();
}
);
var effectsVolumeWidget = new LabeledSliderWidget(
"effects-volume",
0, 100,
AppSettings.getSettings().getFxVolume(),
val -> {
AppSettings.getSettings().setFxVolume(val);
new EventFlow()
.addPostEvent(new AudioEvents.ChangeVolume(val, VolumeControl.FX))
.postEvent();
}
);
var musicVolumeWidget = new LabeledSliderWidget(
"music-volume",
0, 100,
AppSettings.getSettings().getMusicVolume(),
val -> {
AppSettings.getSettings().setMusicVolume(val);
new EventFlow()
.addPostEvent(new AudioEvents.ChangeVolume(val, VolumeControl.MUSIC))
.postEvent();
}
);
return Primitive.vbox(
Primitive.header("volume"),
Primitive.separator(),
masterVolumeWidget.getNode(),
effectsVolumeWidget.getNode(),
musicVolumeWidget.getNode()
);
}
private VBox styleSection() {
var themeWidget = new LabeledChoiceWidget<>(
"theme",
new StringConverter<>() {
@Override
public String toString(String theme) {
return AppContext.getString(theme);
}
@Override
public String fromString(String s) { return null; }
},
AppSettings.getSettings().getTheme(),
newTheme -> {
AppSettings.getSettings().setTheme(newTheme);
App.setStyle(newTheme, AppSettings.getSettings().getLayoutSize());
},
"dark", "light", "high-contrast"
);
var layoutWidget = new LabeledChoiceWidget<>(
"layout-size",
new StringConverter<>() {
@Override
public String toString(String layout) {
return AppContext.getString(layout);
}
@Override
public String fromString(String s) { return null; }
},
AppSettings.getSettings().getLayoutSize(),
newLayout -> {
AppSettings.getSettings().setLayoutSize(newLayout);
App.setStyle(AppSettings.getSettings().getTheme(), newLayout);
},
"small", "medium", "large"
);
return Primitive.vbox(
Primitive.header("style"),
Primitive.separator(),
themeWidget.getNode(),
layoutWidget.getNode()
);
}
}

View File

@@ -0,0 +1,115 @@
package org.toop.app.widget.view;
import javafx.collections.FXCollections;
import javafx.css.converter.StringConverter;
import javafx.scene.control.ComboBox;
import org.toop.app.widget.Primitive;
import org.toop.app.widget.complex.ViewWidget;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.function.Consumer;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.eventbus.GlobalEventBus;
import org.toop.framework.networking.connection.events.NetworkEvents;
public final class ServerView extends ViewWidget {
private final String user;
private final Consumer<String> onPlayerClicked;
private final long clientId;
private final ComboBox<String> gameListSub;
private final ComboBox<String> gameListTour;
private final ListView<Button> listView;
private Button subscribeButton;
public ServerView(String user, Consumer<String> onPlayerClicked, String userName, long clientId) {
this.user = user;
this.onPlayerClicked = onPlayerClicked;
this.clientId = clientId;
this.gameListSub = new ComboBox<>();
this.gameListTour = new ComboBox<>();
this.listView = new ListView<>();
setupLayout(userName);
}
private void setupLayout(String userName) {
var playerHeader = Primitive.header(user, false);
if (userName.equals("host")) { // TODO is fragile
var tournamentButton = Primitive.hbox(
gameListTour,
Primitive.button(
"tournament",
() -> GlobalEventBus.get().post(new NetworkEvents.SendCommand(clientId, "tournament", "start", gameListTour.getValue())),
false,
false
)
);
add(Pos.BOTTOM_CENTER, tournamentButton);
} else {
subscribeButton = Primitive.button(
"subscribe",
() -> new EventFlow().addPostEvent(new NetworkEvents.SendSubscribe(clientId, gameListSub.getValue())).postEvent(),
false,
true
); // TODO localize
var subscribe = Primitive.hbox(gameListSub, subscribeButton);
var playerListSection = Primitive.vbox(
playerHeader,
Primitive.separator(),
subscribe,
listView
);
add(Pos.CENTER, playerListSection);
var disconnectButton = Primitive.button(
"disconnect",
this::transitionPrevious,
false
);
add(Pos.BOTTOM_LEFT, Primitive.vbox(disconnectButton));
}
}
public void update(List<String> players) {
Platform.runLater(() -> {
listView.getItems().clear();
for (String player : players) {
var playerButton = Primitive.button(player, () -> onPlayerClicked.accept(player), false, false);
listView.getItems().add(playerButton);
}
});
}
public void updateGameList(List<String> games) {
Platform.runLater(() -> {
gameListSub.getItems().clear();
gameListSub.setItems(FXCollections.observableArrayList(games));
gameListSub.getSelectionModel().select(0);
gameListTour.getItems().clear();
gameListTour.setItems(FXCollections.observableArrayList(games));
gameListTour.getSelectionModel().select(0);
});
}
public void reEnableButton() {
subscribeButton.setDisable(false);
}
}

View File

@@ -1,19 +1,36 @@
package org.toop.local;
import java.util.MissingResourceException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.toop.app.widget.tutorial.BaseTutorialWidget;
import org.toop.framework.resource.ResourceManager;
import org.toop.framework.resource.resources.LocalizationAsset;
import java.util.Locale;
import org.toop.framework.asset.ResourceManager;
import org.toop.framework.asset.resources.LocalizationAsset;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.StringBinding;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
public class AppContext {
private static final Logger logger = LogManager.getLogger(AppContext.class);
private static final LocalizationAsset localization = ResourceManager.get("localization");
private static Locale locale = Locale.forLanguageTag("en");
private static final ObjectProperty<Locale> localeProperty = new SimpleObjectProperty<>(locale);
private static BaseTutorialWidget tutorialWidget;
public static LocalizationAsset getLocalization() {
return localization;
}
public static void setLocale(Locale locale) {
AppContext.locale = locale;
localeProperty.set(locale);
}
public static Locale getLocale() {
@@ -22,6 +39,48 @@ public class AppContext {
public static String getString(String key) {
assert localization != null;
return localization.getString(key, locale);
// TODO: Gebruik ResourceBundle.getBundle() zodat de fallback automatisch gaat.
// Hiervoor zou de assetManager aangepast moeten worden.
try{ // Main return
return localization.getString(key, locale);
}
catch (MissingResourceException e) {
logger.error("Missing resource key: {}, in bundle: {}. ", key, locale, e);
}
try{ // Fallback return
return localization.getString(key, localization.getFallback());
}
catch (MissingResourceException e) {
logger.error("Missing resource key: {}, in default bundle!", key, e);
}
// Default return
return "MISSING RESOURCE";
}
}
public static StringBinding bindToKey(String key, boolean localize) {
if (localize) return Bindings.createStringBinding(
() -> localization.getString(key, locale),
localeProperty
);
return Bindings.createStringBinding(
() -> key
);
}
public static StringBinding bindToKey(String key) {
return bindToKey(key, true);
}
public static void setCurrentTutorial(BaseTutorialWidget tutorial) {
AppContext.tutorialWidget = tutorial;
}
public static BaseTutorialWidget currentTutorial() {
return AppContext.tutorialWidget;
}
}

View File

@@ -1,58 +1,114 @@
package org.toop.local;
import org.toop.app.App;
import org.toop.framework.audio.VolumeControl;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.resource.ResourceManager;
import org.toop.framework.resource.ResourceMeta;
import org.toop.framework.resource.resources.SettingsAsset;
import org.toop.framework.settings.Settings;
import java.io.File;
import java.util.Locale;
import org.toop.app.App;
import org.toop.framework.asset.resources.SettingsAsset;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.settings.Settings;
public class AppSettings {
private static SettingsAsset settingsAsset;
private SettingsAsset settingsAsset;
public static void applySettings() {
settingsAsset = getPath();
if (!settingsAsset.isLoaded()) {
settingsAsset.load();
}
public void applySettings() {
SettingsAsset settings = getPath();
if (!settings.isLoaded()) {
settings.load();
checkSettings();
Settings settingsData = settingsAsset.getContent();
AppContext.setLocale(Locale.of(settingsData.locale));
App.setFullscreen(settingsData.fullScreen);
App.setStyle(settingsAsset.getTheme(), settingsAsset.getLayoutSize());
}
public static void applyMusicVolumeSettings() {
Settings settingsData = settingsAsset.getContent();
new EventFlow()
.addPostEvent(new AudioEvents.ChangeVolume(settingsData.volume, VolumeControl.MASTERVOLUME))
.postEvent();
new EventFlow()
.addPostEvent(new AudioEvents.ChangeVolume(settingsData.fxVolume, VolumeControl.FX))
.postEvent();
new EventFlow()
.addPostEvent(new AudioEvents.ChangeVolume(settingsData.musicVolume, VolumeControl.MUSIC))
.postEvent();
}
public static SettingsAsset getPath() {
if (settingsAsset == null) {
String os = System.getProperty("os.name").toLowerCase();
String basePath;
if (os.contains("win")) {
basePath = System.getenv("APPDATA");
if (basePath == null) {
basePath = System.getProperty("user.home");
}
} else if (os.contains("mac")) {
basePath = System.getProperty("user.home") + "/Library/Application Support";
} else {
basePath = System.getProperty("user.home") + "/.config";
}
File settingsFile =
new File(basePath + File.separator + "ISY1" + File.separator + "settings.json");
// this.settingsAsset = new SettingsAsset(settingsFile);
ResourceManager.addAsset(new ResourceMeta<>("settings.json", new SettingsAsset(settingsFile)));
}
return ResourceManager.get("settings.json");
}
public static SettingsAsset getSettings() {
return settingsAsset;
}
public static void checkSettings() {
Settings s = settingsAsset.getContent();
boolean changed = false;
if (s.showTutorials == null) {
settingsAsset.setTutorialFlag(true);
changed = true;
}
if (s.firstReversi == null) {
settingsAsset.setFirstReversi(true);
changed = true;
}
if (s.firstTTT == null) {
settingsAsset.setFirstTTT(true);
changed = true;
}
if (s.firstConnect4 == null) {
settingsAsset.setFirstConnect4(true);
changed = true;
}
if (changed) {
getSettings().save();
}
Settings settingsData = settings.getContent();
AppContext.setLocale(Locale.of(settingsData.locale));
App.setFullscreen(settingsData.fullScreen);
new EventFlow()
.addPostEvent(new AudioEvents.ChangeVolume(settingsData.volume))
.asyncPostEvent();
new EventFlow()
.addPostEvent(new AudioEvents.ChangeFxVolume(settingsData.fxVolume))
.asyncPostEvent();
new EventFlow()
.addPostEvent(new AudioEvents.ChangeMusicVolume(settingsData.musicVolume))
.asyncPostEvent();
App.setStyle(settingsAsset.getTheme(), settingsAsset.getLayoutSize());
}
public SettingsAsset getPath() {
if (this.settingsAsset == null) {
String os = System.getProperty("os.name").toLowerCase();
String basePath;
if (os.contains("win")) {
basePath = System.getenv("APPDATA");
if (basePath == null) {
basePath = System.getProperty("user.home");
}
} else if (os.contains("mac")) {
basePath = System.getProperty("user.home") + "/Library/Application Support";
} else {
basePath = System.getProperty("user.home") + "/.config";
}
File settingsFile =
new File(basePath + File.separator + "ISY1" + File.separator + "settings.json");
this.settingsAsset = new SettingsAsset(settingsFile);
}
return this.settingsAsset;
public static void doDefaultSettings() {
settingsAsset.setFirstConnect4(true);
settingsAsset.setFirstTTT(true);
settingsAsset.setFirstReversi(true);
settingsAsset.setLocale("en");
settingsAsset.setTheme("dark");
settingsAsset.setFullscreen(false);
settingsAsset.setVolume(100);
settingsAsset.setFxVolume(20);
settingsAsset.setMusicVolume(15);
settingsAsset.setTutorialFlag(true);
settingsAsset.setLayoutSize("medium");
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -1,63 +0,0 @@
ai=\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0635\u0646\u0627\u0639\u064a
appTitle=\u0645\u062e\u062a\u0627\u0631 \u0623\u0644\u0639\u0627\u0628 ISY
back=\u0631\u062c\u0648\u0639
backToMainMenu=\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629
computer=\u0627\u0644\u062d\u0627\u0633\u0648\u0628
computerDifficulty=\u0635\u0639\u0648\u0628\u0629 \u0627\u0644\u062d\u0627\u0633\u0648\u0628
computerThinkTime=\u0632\u0645\u0646 \u062a\u0641\u0643\u064a\u0631 \u0627\u0644\u0643\u0645\u0628\u064a\u0648\u062a\u0631
congratulations=\u0645\u0628\u0631\u0648\u0643
connect=\u0627\u062a\u0635\u0644
connectionType=\u0646\u0648\u0639 \u0627\u0644\u0627\u062A\u0635\u0627\u0644
credits=\u0627\u0644\u0634\u0643\u0631 \u0648\u0627\u0644\u062a\u0642\u062f\u064a\u0631
dark-hc=\u063A\u0627\u0645\u0642 (\u062A\u0646\u0627\u0642\u0636 \u0639\u0627\u0644\u064D)
dark=\u063A\u0627\u0645\u0642
developers=\u0627\u0644\u0645\u0637\u0648\u0631\u0648\u0646
drawText=\u0627\u0646\u062A\u0647\u062A \u0627\u0644\u0644\u0639\u0628\u0629 \u0628\u062A\u0639\u0627\u062F\u0644
effectsVolume=\u062d\u062c\u0645 \u0627\u0644\u062a\u0623\u062b\u064a\u0631\u0627\u062a
musicVolume=Music Volume (translate me)
fullscreen=\u0643\u0627\u0645\u0644 \u0627\u0644\u0634\u0627\u0634\u0629
goodGameText=\u0644\u0639\u0628\u0629 \u0631\u0627\u0626\u0639\u0629. \u0623\u062D\u0633\u0646\u062A.
human=\u0627\u0644\u0625\u0646\u0633\u0627\u0646
language=\u0627\u0644\u0644\u063a\u0629
large=\u0643\u0628\u064A\u0631
layoutSize=\u062D\u062C\u0645 \u0627\u0644\u062A\u0635\u0645\u064A\u0645
light-hc=\u0641\u0627\u062A\u062D (\u062A\u0646\u0627\u0642\u0636 \u0639\u0627\u0644\u064D)
light=\u0641\u0627\u062A\u062D
local=\u0645\u062d\u0644\u064a
localization=\u062a\u0648\u0645\u064a\u0645 \u0627\u0644\u0644\u063a\u0629
medium=\u0645\u062A\u0648\u0633\u0637
mergeCommander=\u0642\u0627\u0626\u062f \u0627\u0644\u062f\u0645\u062c
moralSupport=\u062f\u0639\u0645 \u0645\u0639\u0646\u0648\u064a
no=\u0644\u0627
opengl=OpenGL
options=\u0627\u0644\u062e\u064a\u0627\u0631\u0627\u062a
othello=\u0623\u0648\u062a\u064a\u0644\u0648
playerName=\u0627\u0633\u0645 \u0627\u0644\u0644\u0627\u0639\u0628
productOwner=\u0645\u0627\u0644\u0643 \u0627\u0644\u0645\u0646\u062a\u062c
quit=\u062e\u0631\u0648\u062c
quitSure=\u0647\u0644 \u0623\u0646\u062a \u0645\u062a\u0623\u0643\u062f\u061f
scrumMaster=\u0645\u062f\u064a\u0631 \u0627\u0644\u0633\u0643\u0631\u0645
server=\u062e\u0627\u062f\u0645
serverIP=IP \u0627\u0644\u062e\u0627\u062f\u0645
serverPort=\u0645\u0646\u0641\u0630 \u0627\u0644\u062e\u0627\u062f\u0645
small=\u0635\u063A\u064A\u0631
start=\u0627\u0628\u062f\u0623
theme=\u0627\u0644\u0645\u0648\u0636\u0648\u0639
tictactoe=\u062a\u064a\u0643 \u062a\u0627\u0643 \u062a\u0648
volume=\u0627\u0644\u062d\u062c\u0645 \u0627\u0644\u0631\u0626\u064a\u0633\u064a
windowed=\u0646\u0627\u0641\u0630\u064a
yes=\u0646\u0639\u0645
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629
chinese=\u4e2d\u6587 (\u0627\u0644\u0635\u064a\u0646\u064a\u0629)
dutch=Nederlands (\u0627\u0644\u0647\u0648\u0644\u0646\u062f\u064a\u0629)
english=English (\u0627\u0644\u0625\u0646\u062c\u0644\u064a\u0632\u064a\u0629)
french=Fran\u00e7ais (\u0627\u0644\u0641\u0631\u0646\u0633\u064a\u0629)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (\u0627\u0644\u062c\u0648\u0631\u062c\u064a\u0629)
german=Deutsch (\u0627\u0644\u0623\u0644\u0645\u0627\u0646\u064a\u0629)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (\u0627\u0644\u0647\u0646\u062f\u064a\u0629)
italian=Italiano (\u0627\u0644\u0625\u064a\u0637\u0627\u0644\u064a\u0629)
japanese=\u65e5\u672c\u8a9e (\u0627\u0644\u064a\u0627\u0628\u0627\u0646\u064a\u0629)
korean=\ud55c\uad6d\uc5b4 (\u0627\u0644\u0643\u0648\u0631\u064a\u0629)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (\u0627\u0644\u0631\u0648\u0633\u064a\u0629)
spanish=Espa\u00f1ol (\u0627\u0644\u0625\u0633\u0628\u0627\u0646\u064a\u0629)

View File

@@ -1,63 +0,0 @@
ai=K\u00fcnstliche Intelligenz
appTitle=ISY Spieleauswahl
back=Zur\u00fcck
backToMainMenu=Zur\u00FCck zum Hauptmen\u00FC
computer=Computer
computerDifficulty=Computerschwierigkeit
computerThinkTime=Computer Denkzeit
congratulations=Gl\u00FCckwunsch
connect=Verbinden
connectionType=Verbindungstyp
credits=Credits
dark-hc=Dunkel (Hoher Kontrast)
dark=Dunkel
developers=Entwickler
drawText=Das Spiel endete unentschieden
effectsVolume=Effektlautst\u00e4rke
musicVolume=Music Volume (translate me)
fullscreen=Vollbild
goodGameText=Gutes Spiel. Gut gespielt.
human=Mensch
language=Sprache
large=Gro\u00DF
layoutSize=Layout-Gr\u00F6\u00DFe
light-hc=Hell (Hoher Kontrast)
light=Hell
local=Lokal
localization=Lokalisierung
medium=Mittel
mergeCommander=Merge-Kommandant
moralSupport=Mentale Unterst\u00fctzung
no=Nein
opengl=OpenGL
options=Optionen
othello=Othello
playerName=Spielername
productOwner=Produktverantwortlicher
quit=Beenden
quitSure=Bist du dir sicher?
scrumMaster=Scrum Master
server=Server
serverIP=Server-IP
serverPort=Server-Port
small=Klein
start=Start
theme=Thema
tictactoe=Tic Tac Toe
volume=Hauptlautst<EFBFBD>rke
windowed=Fenstermodus
yes=Ja
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (Arabisch)
chinese=\u4e2d\u6587 (Chinesisch)
dutch=Nederlands (Niederl\u00e4ndisch)
english=English (Englisch)
french=Fran\u00e7ais (Franz\u00f6sisch)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (Georgisch)
german=Deutsch
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (Hindi)
italian=Italiano (Italienisch)
japanese=\u65e5\u672c\u8a9e (Japanisch)
korean=\ud55c\uad6d\uc5b4 (Koreanisch)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (Russisch)
spanish=Espa\u00f1ol (Spanisch)

View File

@@ -1,67 +0,0 @@
accept=Accept
ai=Artificial Intelligence
appTitle=ISY Games Selector
back=Back
backToMainMenu=Back to main menu
challengeText=You were challenged by
computer=Computer
computerDifficulty=Computer Difficulty
computerThinkTime=Computer Think Time
congratulations=Congratulations
connect=Connect
connectionType=Connection Type
credits=Credits
dark=Dark
dark-hc=Dark (High Contrast)
deny=Deny
developers=Developers
drawText=The game ended in a draw
effectsVolume=Effects Volume
musicVolume=Music Volume
fullscreen=Fullscreen
gameIsText=To a game of
goodGameText=Good game. Well played.
human=Human
language=Language
large=Large
layoutSize=Layout Size
light=Light
light-hc=Light (High Contrast)
local=Local
localization=Localization
medium=Medium
mergeCommander=Merge Commander
moralSupport=Moral Support
no=No
opengl=OpenGL
options=Options
othello=Othello
playerName=Player Name
productOwner=Product Owner
quit=Quit
quitSure=Are you sure?
scrumMaster=Scrum Master
server=Server
serverIP=Server IP
serverPort=Server Port
small=Small
start=Start
theme=Theme
tictactoe=Tic Tac Toe
volume=Master Volume
windowed=Windowed
yes=Yes
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (Arabic)
chinese=\u4e2d\u6587 (Chinese)
dutch=Nederlands (Dutch)
english=English
french=Fran\u00e7ais (French)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (Georgian)
german=Deutsch (German)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (Hindi)
italian=Italiano (Italian)
japanese=\u65e5\u672c\u8a9e (Japanese)
korean=\ud55c\uad6d\uc5b4 (Korean)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (Russian)
spanish=Espa\u00f1ol (Spanish)

View File

@@ -1,63 +0,0 @@
ai=Inteligencia Artificial
appTitle=Selector de Juegos ISY
back=Atr\u00e1s
backToMainMenu=Volver al men\u00FA principal
computer=Ordenador
computerDifficulty=Dificultad del Ordenador
computerThinkTime=Tiempo de pensamiento de la computadora
congratulations=Felicitaciones
connect=Conectar
connectionType=Tipo de conexi\u00F3n
credits=Cr\u00e9ditos
dark-hc=Oscuro (Alto Contraste)
dark=Oscuro
developers=Desarrolladores
drawText=El juego termin\u00F3 en empate
effectsVolume=Volumen de efectos
musicVolume=Music Volume (translate me)
fullscreen=Pantalla completa
goodGameText=Buen juego. Bien jugado.
human=Humano
language=Idioma
large=Grande
layoutSize=Tama\u00F1o del dise\u00F1o
light-hc=Claro (Alto Contraste)
light=Claro
local=Local
localization=Localizaci\u00f3n
medium=Mediano
mergeCommander=Comandante de Merge
moralSupport=Apoyo moral
no=No
opengl=OpenGL
options=Opciones
othello=Othello
playerName=Nombre del Jugador
productOwner=Propietario del Producto
quit=Salir
quitSure=\u00BFAst\u00e1s seguro?
scrumMaster=Scrum Master
server=Servidor
serverIP=Servidor-IP
serverPort=Servidor-puerto
small=Peque\u00F1o
start=Iniciar
theme=Tema
tictactoe=Tres en Raya
volume=Volumen principal
windowed=Ventana
yes=S\u00ed
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (Ar\u00e1bigo)
chinese=\u4e2d\u6587 (Chino)
dutch=Nederlands (Neerland\u00e9s)
english=English (Ingl\u00e9s)
french=Fran\u00e7ais (Franc\u00e9s)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (Georgiano)
german=Deutsch (Alem\u00e1n)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (Hindi)
italian=Italiano (Italiano)
japanese=\u65e5\u672c\u8a9e (Japon\u00e9s)
korean=\ud55c\uad6d\uc5b4 (Coreano)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (Ruso)
spanish=Espa\u00f1ol

View File

@@ -1,63 +0,0 @@
ai=Intelligence Artificielle
appTitle=S\u00e9lecteur de Jeux ISY
back=Retour
backToMainMenu=Retour au menu principal
computer=Ordinateur
computerDifficulty=Difficult\u00e9 de l'Ordinateur
computerThinkTime=Temps de r\u00e9flexion de l'ordinateur
congratulations=F\u00E9licitations
connect=Connecter
connectionType=Type de connexion
credits=Cr\u00e9dits
dark-hc=Sombre (Contraste \u00E9lev\u00E9)
dark=Sombre
developers=D\u00e9veloppeurs
drawText=La partie s'est termin\u00E9e par un match nul
effectsVolume=Volume des effets
musicVolume=Music Volume (translate me)
fullscreen=Plein \u00e9cran
goodGameText=Bien jou\u00E9. Bonne partie.
human=Humain
language=Langue
large=Grand
layoutSize=Taille de la disposition
light-hc=Clair (Contraste \u00E9lev\u00E9)
light=Clair
local=Local
localization=Localisation
medium=Moyen
mergeCommander=Commandant de Merge
moralSupport=Soutien moral
no=Non
opengl=OpenGL
options=Options
othello=Othello
playerName=Nom du joueur
productOwner=Responsable du produit
quit=Quitter
quitSure=Es-tu s\u00fbr ?
scrumMaster=Scrum Master
server=Serveur
serverIP=Serveur-IP
serverPort=Serveur-Port
small=Petit
start=D\u00e9marrer
theme=Th\u00E8me
tictactoe=Morpion
volume=Volume principal
windowed=Fen\u00eatre
yes=Oui
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (Arabe)
chinese=\u4e2d\u6587 (Chinois)
dutch=Nederlands (N\u00e9erlandais)
english=English (Anglais)
french=Fran\u00e7ais
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (G\u00e9orgien)
german=Deutsch (Allemand)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (Hindi)
italian=Italiano (Italien)
japanese=\u65e5\u672c\u8a9e (Japonais)
korean=\ud55c\uad6d\uc5b4 (Cor\u00e9en)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (Russe)
spanish=Espa\u00f1ol (Espagnol)

View File

@@ -1,63 +0,0 @@
ai=\u092a\u094d\u0930\u0924\u093f\u092a\u094d\u0930\u0923\u093e\u0924\u094d\u092e\u093e\u0928 \u092a\u094d\u0930\u092c\u094d\u0939\u093e\u0935\u0924\u094d\u0924\u093e
appTitle=ISY \u0917\u0947\u092e \u0938\u0947\u0932\u0947\u0915\u094d\u091f\u0930
back=\u092a\u093f\u091a\u093e\u0932
backToMainMenu=\u092E\u0947\u0928 \u092E\u0947\u0928\u0942 \u092A\u0930 \u0935\u093E\u092A\u0938 \u091C\u093E\u090F\u0902
computer=\u0915\u092e\u092a\u094d\u092f\u0942\u091f\u0930
computerDifficulty=\u0915\u092e\u092a\u094d\u092f\u0942\u091f\u0930 \u092a\u094d\u0930\u092f\u093e\u0938
computerThinkTime=\u0915\u0902\u092a\u094d\u092f\u0942\u091f\u0930 \u0915\u0940 \u092a\u0930 \u092b\u0930 \u0938\u092e\u092f
congratulations=\u092C\u0927\u093E\u0908
connect=\u091c\u0942\u0921\u094d\u0921 \u0915\u0930\u0947\u0902
connectionType=\u0915\u0928\u0947\u0915\u094D\u0936\u0928 \u0915\u093E \u092A\u094D\u0930\u0915\u093E\u0930
credits=\u0916\u094d\u092f\u093e\u0924\u0947
dark-hc=\u0915\u093E\u0932\u093E (\u090A\u091A\u094D\u091A \u0915\u0949\u0928\u094D\u091F\u094D\u0930\u093E\u0938\u094D\u091F)
dark=\u0915\u093E\u0932\u093E
developers=\u0935\u093f\u0915\u0938\u093f\u0915\u0930
drawText=\u0916\u0947\u0932 \u091F\u0940\u091A \u092A\u0930 \u0916\u0924\u094D\u092E \u0939\u094B \u0917\u092F\u0940
effectsVolume=\u092a\u0631\u094d\u092a\u093e\u0935 \u0935\u094b\u0932\u094d\u092e
musicVolume=Music Volume (translate me)
fullscreen=\u092a\u0942\u0930\u094d\u0923 \u0938\u0915\u0940\u0928\u093e
goodGameText=\u0905\u091A\u094D\u091B\u0940 \u0916\u0947\u0932 \u0925\u0940\u0964 \u091B\u0940 \u0916\u0942\u092C \u0916\u0947\u0932\u093E.
human=\u092e\u093e\u0928\u0935
language=\u092d\u093e\u0937\u093e
large=\u092C\u0921\u093C\u093E
layoutSize=\u0930\u0942\u092A\u0930\u0947\u0916 \u0915\u093E \u0906\u0915\u093E\u0930
light-hc=\u091A\u094D\u092E\u092C\u0940\u0932\u093E (\u090A\u091A\u094D\u091A \u0915\u0949\u0928\u094D\u091F\u094D\u0930\u093E\u0938\u094D\u091F)
light=\u091A\u094D\u092E\u092C\u0940\u0932\u093E
local=\u0938\u094d\u0925\u093e\u0928\u093f\u092f
localization=\u0938\u094d\u0925\u093e\u0928\u093f\u092f\u0915\u0930\u0923
medium=\u092E\u0927\u094D\u092F\u092E
mergeCommander=\u092e\u0930\u094d\u091c \u0915\u092e\u0902\u0921\u0930
moralSupport=\u0928\u094d\u092e\u093e\u0928\u093f\u0915 \u0938\u092e\u0930\u094d\u0925\u0928
no=\u0928\u0939\u0940\u0902
opengl=OpenGL
options=\u0935\u093f\u0915\u0932\u094d\u092a
othello=\u0913\u0925\u0940\u0932\u094b
playerName=\u0915\u0941\u0930\u093e\u0930\u0940 \u0928\u093e\u092e
productOwner=\u0906\u092f\u0947\u0915\u093e \u092e\u093e\u0932\u093f\u0915
quit=\u0938\u094e\u091c\u094d
quitSure=\u0915\u094d\u092f\u093e \u0915\u094d\u092f\u093e \u091f\u0940\u091f \u0939\u0948\u0902?
scrumMaster=\u0938\u094d\u0915\u094d\u0930\u0941\u092e \u092e\u093e\u0938\u094d\u091f\u0930
server=\u0938\u0930\u094d\u0935\u0930
serverIP=\u0938\u0930\u094d\u0935\u0930 IP
serverPort=\u0938\u0930\u094d\u0935\u0930 \u092a\u094b\u0930\u094d\u091f
small=\u091B\u094B\u091F\u093E
start=\u092b\u093f\u0930\u0942
theme=\u0925\u0940\u092E
tictactoe=\u091f\u093f\u0915 \u091f\u0948\u0915 \u091f\u094b
volume=\u092e\u0941\u0916\u094d\u092f \u0906\u0935\u093e\u091c
windowed=\u0915\u094d\u0930\u094d\u0939 \u092e\u0947\u0902
yes=\u0939\u093e\u0907
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (\u0905\u0930\u092c\u0940)
chinese=\u4e2d\u6587 (\u091a\u0940\u0928\u0940)
dutch=Nederlands (\u0921\u091a)
english=English (\u0905\u0902\u0917\u094d\u0930\u0947\u091c\u0940)
french=Fran\u00e7ais (\u092b\u094d\u0930\u0947\u0902\u091a)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (\u091c\u094d\u091c\u094b\u0930\u094d\u091c\u093f\u092f\u0928)
german=Deutsch (\u091c\u0930\u094d\u092e\u0928)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940
italian=Italiano (\u0907\u091f\u093e\u0932\u093f\u092f\u0928)
japanese=\u65e5\u672c\u8a9e (\u091c\u093e\u092a\u093e\u0928\u0940)
korean=\ud55c\uad6d\uc5b4 (\u0915\u094b\u0930\u093f\u092f\u0928)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (\u0930\u0942\u0938\u0940)
spanish=Espa\u00f1ol (\u0938\u094d\u092a\u0947\u0928\u093f\u0936)

View File

@@ -1,63 +0,0 @@
ai=Intelligenza Artificiale
appTitle=Selettore di Giochi ISY
back=Indietro
backToMainMenu=Ritorna al menu principale
computer=Computer
computerDifficulty=Difficolt\u00e0 del computer
computerThinkTime=Tempo di pensiero del computer
congratulations=Congratulazioni
connect=Connetti
connectionType=Tipo di connessione
credits=Crediti
dark-hc=Scuro (Alto Contrasto)
dark=Scuro
developers=Sviluppatori
drawText=La partita \u00E8 terminata in parit\u00E0
effectsVolume=Volume effetti
musicVolume=Music Volume (translate me)
fullscreen=Schermo intero
goodGameText=Bel gioco. Ben giocato.
human=Umano
language=Lingua
large=Grande
layoutSize=Dimensione Layout
light-hc=Chiaro (Alto Contrasto)
light=Chiaro
local=Locale
localization=Localizzazione
medium=Medio
mergeCommander=Comandante di Merge
moralSupport=Supporto morale
no=No
opengl=OpenGL
options=Opzioni
othello=Othello
playerName=Nome del giocatore
productOwner=Proprietario del prodotto
quit=Uscire
quitSure=Sei sicuro?
scrumMaster=Scrum Master
server=Server
serverIP=Server-IP
serverPort=Porta del server
small=Piccolo
start=Inizia
theme=Tema
tictactoe=Tic Tac Toe
volume=Volume principale
windowed=Finestra
yes=S\u00ec
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (Arabo)
chinese=\u4e2d\u6587 (Cinese)
dutch=Nederlands (Olandese)
english=English (Inglese)
french=Fran\u00e7ais (Francese)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (Georgiano)
german=Deutsch (Tedesco)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (Hindi)
italian=Italiano
japanese=\u65e5\u672c\u8a9e (Giapponese)
korean=\ud55c\uad6d\uc5b4 (Coreano)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (Russo)
spanish=Espa\u00f1ol (Spagnolo)

View File

@@ -1,63 +0,0 @@
ai=\u4eba\u5de5\u77e5\u80fd
appTitle=ISY \u30b2\u30fc\u30e0\u30bb\u30ec\u30af\u30bf\u30fc
back=\u623b\u308b
backToMainMenu=\u30E1\u30A4\u30F3\u30E1\u30CB\u30E5\u30FC\u306B\u623B\u308B
computer=\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc
computerDifficulty=\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u96e3\u6613\u5ea6
computerThinkTime=\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u8003\u3048\u6642\u9593
congratulations=\u304A\u3081\u3067\u3068\u3046\u3054\u3056\u3044\u307E\u3059
connect=\u63a5\u7d9a
connectionType=\u63A5\u7D9A\u30BF\u30A4\u30D7
credits=\u30af\u30ec\u30b8\u30c3\u30c8
dark-hc=\u30C0\u30FC\u30AF (\u9AD8\u30B3\u30F3\u30C8\u30E9\u30B9\u30C8)
dark=\u30C0\u30FC\u30AF
developers=\u958b\u767a\u8005
drawText=\u30B2\u30FC\u30E0\u306F\u5E73\u7B49\u306B\u7D42\u4E86\u3057\u307E\u3057\u305F
effectsVolume=\u30a8\u30d5\u30a7\u30af\u30c8\u30dc\u30ea\u30e5\u30fc\u30e0
musicVolume=Music Volume (translate me)
fullscreen=\u5168\u753b\u9762
goodGameText=\u3044\u3044\u30B2\u30FC\u30E0\u3067\u3057\u305F\u3002\u3088\u304F\u6226\u3044\u307E\u3057\u305F\u3002
human=\u4eba\u9593
language=\u8a00\u8a9e
large=\u5927
layoutSize=\u30EC\u30A4\u30A2\u30A6\u30C8\u30B5\u30A4\u30BA
light-hc=\u30E9\u30A4\u30C8 (\u9AD8\u30B3\u30F3\u30C8\u30E9\u30B9\u30C8)
light=\u30E9\u30A4\u30C8
local=\u5730\u57df
localization=\u30ed\u30fc\u30ab\u30e9\u30a4\u30bc\u30fc\u30b7\u30e7\u30f3
medium=\u4E2D
mergeCommander=\u30de\u30fc\u30b8\u30b3\u30de\u30f3\u30c0\u30fc
moralSupport=\u6c17\u529b\u652f\u63f4
no=\u3044\u3044\u3048
opengl=OpenGL
options=\u30aa\u30d7\u30b7\u30e7\u30f3
othello=\u30aa\u30bb\u30ed
playerName=\u30d7\u30ec\u30a4\u30e4\u30fc\u540d
productOwner=\u30d7\u30ed\u30c0\u30af\u30c8\u30aa\u30fc\u30ca\u30fc
quit=\u7d42\u4e86
quitSure=\u672c\u5f53\u306b\u7d42\u4e86\u3057\u307e\u3059\u304b\uff1f
scrumMaster=\u30b9\u30af\u30e9\u30e0\u30de\u30b9\u30bf\u30fc
server=\u30b5\u30fc\u30d0\u30fc
serverIP=\u30b5\u30fc\u30d0\u30fc IP
serverPort=\u30b5\u30fc\u30d0\u30fc \u30dd\u30fc\u30c8
small=\u5C0F
start=\u59cb\u307e\u308a
theme=\u30C6\u30FC\u30DE
tictactoe=\u30bf\u30a4\u30af\u30bf\u30c3\u30c8\u30c8\u30a6
volume=\u30de\u30b9\u30bf\u30fc\u30dc\u30ea\u30e5\u30fc\u30e0
windowed=\u30a6\u30a3\u30f3\u30c9\u30a6
yes=\u306f\u3044
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (\u30a2\u30e9\u30d3\u30a2\u8a9e)
chinese=\u4e2d\u6587 (\u4e2d\u6587)
dutch=Nederlands (\u30aa\u30e9\u30f3\u30c0\u8a9e)
english=English (\u82f1\u8a9e)
french=Fran\u00e7ais (\u30d5\u30e9\u30f3\u30b9\u8a9e)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (\u30b0\u30eb\u30b8\u30a2\u8a9e)
german=Deutsch (\u30c9\u30a4\u30c4\u8a9e)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (\u30d2\u30f3\u30c7\u30a3\u8a9e)
italian=Italiano (\u30a4\u30bf\u30ea\u30a2\u8a9e)
japanese=\u65e5\u672c\u8a9e
korean=\ud55c\uad6d\uc5b4 (\u97d3\u56fd\u8a9e)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (\u30ed\u30b7\u30a2\u8a9e)
spanish=Espa\u00f1ol (\u30b9\u30da\u30a4\u30f3\u8a9e)

View File

@@ -1,63 +0,0 @@
ai=\uc778\uacf5 \uc9c0\ub2a5
appTitle=ISY \uac8c\uc784 \uc120\ud0dd\uae30
back=\ub4a4\ub85c
backToMainMenu=\uBA54\uC778 \uBA54\uB274\uB85C \uB3CC\uC544\uAC00\uAE30
computer=\uce74\ud14c\uae4c
computerDifficulty=\uce74\ud14c\uae4c \ub2e8\uacc4
computerThinkTime=\uc870\ub9ac\ud558\ub294 \uc2dc\uac04
congratulations=\uCD95\uD558\uD569\uB2C8\uB2E4
connect=\uc5f0\uacb0
connectionType=\uC5F0\uACB0 \uC720\uD615
credits=\uac10\uc0ac
dark-hc=\uC5B4\uB460 (\uACE0 \uB300\uBE44)
dark=\uC5B4\uB460
developers=\uac1c\ubc1c\uc790
drawText=\uAC8C\uC784\uC740 \uBB34\uC2B9\uBD84\uC73C\uB85C \uB05D\uB0AC\uC2B5\uB2C8\uB2E4
effectsVolume=\ud654\uac70 \ubc84\uc804
musicVolume=Music Volume (translate me)
fullscreen=\uc804\uccb4 \ud654\uba74
goodGameText=\uC88B\uC740 \uAC8C\uC784\uC774\uC600\uC2B5\uB2C8\uB2E4. \uC798 \uD50C\uB808\uC774\uD588\uC2B5\uB2C8\uB2E4.
human=\uc778\uac04
language=\uc5b8\uc5b4
large=\uD070
layoutSize=\uB808\uC774\uC544\uC6C3 \uD06C\uAE30
light-hc=\uBC1D\uC74C (\uACE0 \uB300\uBE44)
light=\uBC1D\uC74C
local=\ub85c\uceec
localization=\uc5b8\uc5b4\ud654
medium=\uBCF4\uD1B5
mergeCommander=\uba54\uc9c0 \ucea0\ub9ac\ub354
moralSupport=\uc815\uc2e0\uc801 \uc9c0\uc6d0
no=\uc544\ub2c8\uc624
opengl=OpenGL
options=\uc635\uc158
othello=\uc624\ud14c\ub85c
playerName=\ud50c\ub808\uc774\uc5b4 \uc774\ub984
productOwner=\uc81c\ud488 \uad00\ub9ac\uc790
quit=\uc885\ub8cc
quitSure=\uc815\ub9d0 \uc885\ub8cc\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?
scrumMaster=\uc2a4\ud06c\ub7fc \ub9c8\uc2a4\ud130
server=\uc11c\ubc84
serverIP=\uc11c\ubc84 IP
serverPort=\uc11c\ubc84 \ud3ec\ud2b8
small=\uC791\uC74C
start=\uc2dc\uc791
theme=\uC8FC\uC81C
tictactoe=\ud2f0\ud06c\ud0d0\ud1a0
volume=\ub9c8\uc2a4\ud130 \ubcfc\ub80c
windowed=\ucc3d \ubaa8\ub4dc
yes=\ub124
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (\u0639\u0631\u0628\u064a\u0629)
chinese=\u4e2d\u6587 (\u4e2d\u6587)
dutch=Nederlands (\ub3c4\ucc99)
english=English (\uc601\uad6d\uc5b4)
french=Fran\u00e7ais (\ud504\ub791\uc81c\uc2a4\ucf54)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (\uac8c\uc774\uc874)
german=Deutsch (\ub3c4\ucf54)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (\ud567\ub9ac)
italian=Italiano (\uc774\ud0c0\ub9ac\uc5b4\ub098)
japanese=\u65e5\u672c\u8a9e (\uc65c\uc790\ub9ac\uc5b4)
korean=\ud55c\uad6d\uc5b4
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (\ub85c\uc6b0\uc2a4\uc544\uc774\ucf58)
spanish=Espa\u00f1ol (\uc2a4\ud398\ub974\uc2a4\uc544\uc774\ucf58)

View File

@@ -1,63 +0,0 @@
ai=Kunstmatige Intelligentie
appTitle=ISY Spel Kiezer
back=Terug
backToMainMenu=Terug naar hoofdmenu
computer=Computer
computerDifficulty=Computermoeilijkheid
computerThinkTime=Computer Denk Tijd
congratulations=Gefeliciteerd
connect=Verbinden
connectionType=Verbindingstype
credits=Credits
dark-hc=Donker (Hoog Contrast)
dark=Donker
developers=Ontwikkelaars
drawText=Het spel eindigde in een gelijkspel
effectsVolume=Effecten Volume
musicVolume=Music Volume (translate me)
fullscreen=Volledig scherm
goodGameText=Goed gespeeld. Mooie wedstrijd.
human=Mens
language=Taal
large=Groot
layoutSize=Lay-outgrootte
light-hc=Licht (Hoog Contrast)
light=Licht
local=Lokaal
localization=Lokalisatie
medium=Middel
mergeCommander=Merge-commandant
moralSupport=Moraalsteun
no=Nee
opengl=OpenGL
options=Opties
othello=Othello
playerName=Spelernaam
productOwner=Producteigenaar
quit=Afsluiten
quitSure=Weet je het zeker?
scrumMaster=Scrum Master
server=Server
serverIP=Server-IP
serverPort=Serverpoort
small=Klein
start=Start
theme=Thema
tictactoe=Boter Kaas en Eieren
volume=Hoofdvolume
windowed=Venstermodus
yes=Ja
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (Arabisch)
chinese=\u4e2d\u6587 (Chinees)
dutch=Nederlands
english=English (Engels)
french=Fran\u00e7ais (Frans)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (Georgisch)
german=Deutsch (Duits)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (Hindi)
italian=Italiano (Italiaans)
japanese=\u65e5\u672c\u8a9e (Japans)
korean=\ud55c\uad6d\uc5b4 (Koreaans)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (Russisch)
spanish=Espa\u00f1ol (Spaans)

View File

@@ -1,63 +0,0 @@
ai=\u0418\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442
appTitle=ISY \u0412\u044b\u0431\u043e\u0440 \u0438\u0433\u0440
back=\u041d\u0430\u0437\u0430\u0434
backToMainMenu=\u041D\u0430\u0437\u0430\u0434 \u0432 \u0433\u043B\u0430\u0432\u043D\u043E\u0435 \u043C\u0435\u043D\u044E
computer=\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440
computerDifficulty=\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430
computerThinkTime=\u0412\u0440\u0435\u043c\u044f \u043e\u0431\u0434\u0443\u043c\u044b \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430
congratulations=\u041F\u043E\u0437\u0434\u0440\u0430\u0432\u043B\u044F\u0435\u043C
connect=\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f
connectionType=\u0442\u0438\u043F \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F
credits=\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438
dark-hc=\u0442\u0451\u043C\u043D\u044B\u0439 (\u0432\u044B\u0441\u043E\u043A\u0438\u0439 \u043A\u043E\u043D\u0442\u0440\u0430\u0441\u0442)
dark=\u0442\u0451\u043C\u043D\u044B\u0439
developers=\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438
drawText=\u0418\u0433\u0440\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C \u043D\u0438\u0447\u044C\u0435\u0439
effectsVolume=\u042d\u0444\u0444\u0435\u043a\u0442\u044b \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u044c
musicVolume=Music Volume (translate me)
fullscreen=\u041f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c
goodGameText=\u0425\u043E\u0440\u043E\u0448\u0430\u044F \u0438\u0433\u0440\u0430. \u0425\u043E\u0440\u043E\u0448\u043E \u0441\u044B\u0433\u0440\u0430\u043D\u043E.
human=\u0427\u0435\u043b\u043e\u0432\u0435\u043a
language=\u042f\u0437\u044b\u043a
large=\u0431\u043E\u043B\u044C\u0448\u043E\u0439
layoutSize=\u0440\u0430\u0437\u043C\u0435\u0440 \u043C\u0430\u043A\u0435\u0442\u0430
light-hc=\u0441\u0432\u0435\u0442\u043B\u044B\u0439 (\u0432\u044B\u0441\u043E\u043A\u0438\u0439 \u043A\u043E\u043D\u0442\u0440\u0430\u0441\u0442)
light=\u0441\u0432\u0435\u0442\u043B\u044B\u0439
local=\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439
localization=\u041b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f
medium=\u0441\u0440\u0435\u0434\u043D\u0438\u0439
mergeCommander=\u041a\u043e\u043c\u0430\u043d\u0434\u0435\u0440 \u0441\u043b\u0438\u044f\u043d\u0438\u044f
moralSupport=\u041c\u043e\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430
no=\u041d\u0435\u0442
opengl=OpenGL
options=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438
othello=\u041e\u0442\u0435\u043b\u043b\u043e
playerName=\u0418\u043c\u044f \u0438\u0433\u0440\u043e\u043a\u0430
productOwner=\u0412\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430
quit=\u0412\u044b\u0445\u043e\u0434
quitSure=\u0423\u0432\u0435\u0440\u0435\u043d\u044b \u043b\u0438?
scrumMaster=\u041c\u0430\u0441\u0442\u0435\u0440 Scrum
server=\u0421\u0435\u0440\u0432\u0435\u0440
serverIP=\u0418\u043f\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430
serverPort=\u041f\u043e\u0440\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430
small=\u043C\u0430\u043B\u0435\u043D\u044C\u043A\u0438\u0439
start=\u0421\u0442\u0430\u0440\u0442
theme=\u0442\u0435\u043C\u0430
tictactoe=\u041a\u0440\u0435\u0441\u0442\u0438\u043a\u0438
volume=\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u044c
windowed=\u041e\u043a\u043d\u043e
yes=\u0414\u0430
arabic=\u0627\u0644\u0639\u0631\u0628\u064a\u0629 (\u0410\u0440\u0430\u0431\u0441\u043a\u0438\u0439)
chinese=\u4e2d\u6587 (\u041a\u0438\u0442\u0430\u0439\u0441\u043a\u0438\u0439)
dutch=Nederlands (\u041d\u0438\u0434\u0435\u0440\u043b\u0430\u043d\u0434\u0441\u043a\u0438\u0439)
english=English (\u0410\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439)
french=Fran\u00e7ais (\u0424\u0440\u0430\u043d\u0446\u0443\u0437\u0441\u043a\u0438\u0439)
georgian=\u10e5\u10d0\u10e0\u10d4\u10e1\u10d8 (\u0413\u0440\u0443\u0437\u0438\u043d\u0441\u043a\u0438\u0439)
german=Deutsch (\u041d\u0435\u043c\u0435\u0446\u043a\u0438\u0439)
hindi=\u0939\u093f\u0928\u094d\u0926\u0940 (\u0425\u0438\u043d\u0434\u0438)
italian=Italiano (\u0418\u0442\u0430\u043b\u044c\u044f\u043d\u0441\u043a\u0438\u0439)
japanese=\u65e5\u672c\u8a9e (\u042f\u043f\u043e\u043d\u0441\u043a\u0438\u0439)
korean=\ud55c\uad6d\uc5b4 (\u041a\u043e\u0440\u0435\u0439\u0441\u043a\u0438\u0439)
russian=\u0420\u0443\u0441\u0441\u043a\u0438\u0439
spanish=Espa\u00f1ol (\u0418\u0441\u043f\u0430\u043d\u0441\u043a\u0438\u0439)

Some files were not shown because too many files have changed in this diff Show More