Remove modelfactory from UltimateTicTacToePanelViewModel
This commit is contained in:
parent
016d6db839
commit
8de7f2ac50
@ -2,7 +2,6 @@ package de.icaotix.ultimatetictactoe.viewmodel;
|
|||||||
|
|
||||||
|
|
||||||
import de.icaotix.ultimatetictactoe.model.IUltimateTicTacToe;
|
import de.icaotix.ultimatetictactoe.model.IUltimateTicTacToe;
|
||||||
import de.icaotix.ultimatetictactoe.model.ModelFactory;
|
|
||||||
import de.icaotix.ultimatetictactoe.model.definitions.GameState;
|
import de.icaotix.ultimatetictactoe.model.definitions.GameState;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@ -14,12 +13,12 @@ public class UltimateTicTacToePanelViewModel {
|
|||||||
private Consumer<String> gameResultCallback;
|
private Consumer<String> gameResultCallback;
|
||||||
private Consumer<String> currentPlayerCallback;
|
private Consumer<String> currentPlayerCallback;
|
||||||
|
|
||||||
public UltimateTicTacToePanelViewModel(ModelFactory modelFactory, ViewModelFactory viewModelFactory) {
|
public UltimateTicTacToePanelViewModel(IUltimateTicTacToe ultimateTicTacToe, ViewModelFactory viewModelFactory) {
|
||||||
this.subGameViewModels = new TicTacToePanelViewModel[9];
|
this.subGameViewModels = new TicTacToePanelViewModel[9];
|
||||||
for (int i = 0; i < this.subGameViewModels.length; i++) {
|
for (int i = 0; i < this.subGameViewModels.length; i++) {
|
||||||
this.subGameViewModels[i] = viewModelFactory.getTicTacToePanelViewModel(this);
|
this.subGameViewModels[i] = viewModelFactory.getTicTacToePanelViewModel(this);
|
||||||
}
|
}
|
||||||
this.ultimateTicTacToe = modelFactory.getUltimateTicTacToe();
|
this.ultimateTicTacToe = ultimateTicTacToe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepareNextMove() {
|
public void prepareNextMove() {
|
||||||
|
@ -11,7 +11,8 @@ public class ViewModelFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public UltimateTicTacToePanelViewModel getUltimateTicTacToePanelViewModel() {
|
public UltimateTicTacToePanelViewModel getUltimateTicTacToePanelViewModel() {
|
||||||
return new UltimateTicTacToePanelViewModel(this.modelFactory, this);
|
var ultimateTicTacToeGame = this.modelFactory.getUltimateTicTacToe();
|
||||||
|
return new UltimateTicTacToePanelViewModel(ultimateTicTacToeGame, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TicTacToePanelViewModel getTicTacToePanelViewModel(UltimateTicTacToePanelViewModel ultimateTicTacToePanelViewModel) {
|
public TicTacToePanelViewModel getTicTacToePanelViewModel(UltimateTicTacToePanelViewModel ultimateTicTacToePanelViewModel) {
|
||||||
|
Loading…
Reference in New Issue
Block a user