Open soulne4ny opened 11 years ago
There are some problems in https://github.com/yarcat/chemistry-lines/commit/ec5530a15cdfd31c60ff359679e390ca0203f5ec:
GameLogic
still has getScorer()
.Scorer.update()
implementation has to notify listener by itself.SwingUIFactory
has to make a fake call onScoreChange()
.getScorer()
by allowing to inject scorer into game logic (in this case creator will know the instance, and will be able to set/add listener(s))Base scorer can have implementation of update()
public void update(CompoundReference ref) {
String value = updateAndGetNewScore(ref);
for (ScoreListener listener : mListeners) {
listener.onScoreUpdate(value);
}
}
or smth similar. In this case implementations will have to override updateAndGetNewScore
, and listeners will be notified automagically.
init()
call.We have following debts left in the issue:
ScoreContainer
. To replace it with several separate score UI items it requires to allow multiple subscribers. I'd like to make it generic, but not right now.GameLogic.getScorer()
still there too. Moving scorer out of GameLogic
requires keeping multiple GameListerner
. See above.Please, review.
https://github.com/yarcat/chemistry-lines/commit/ce2161163cc303d1152fb714cd23e146e8bf1fec#commitcomment-2315909