add pit and board view models
This commit is contained in:
parent
0a5392f20d
commit
03c4b506d6
11
src/factory/BoardViewModelFactory.ts
Normal file
11
src/factory/BoardViewModelFactory.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import BoardViewModel from "../viewmodel/BoardViewModel";
|
||||
import PitViewModel from "../viewmodel/PitViewModel";
|
||||
|
||||
export default class BoardViewModelFactory {
|
||||
public static create(
|
||||
id: string,
|
||||
pitViewModels: PitViewModel[]
|
||||
): BoardViewModel {
|
||||
return new BoardViewModel(id, pitViewModels);
|
||||
}
|
||||
}
|
||||
13
src/factory/PitViewModelFactory.ts
Normal file
13
src/factory/PitViewModelFactory.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import PitViewModel from "../viewmodel/PitViewModel";
|
||||
|
||||
export class PitViewModelFactory {
|
||||
public static create(params: {
|
||||
id: string;
|
||||
stoneCount: number;
|
||||
stoneColor: string;
|
||||
pitColor: string;
|
||||
}): PitViewModel {
|
||||
const { id, stoneCount, stoneColor, pitColor } = params;
|
||||
return new PitViewModel(id, stoneCount, stoneColor, pitColor);
|
||||
}
|
||||
}
|
||||
10
src/viewmodel/BoardViewModel.ts
Normal file
10
src/viewmodel/BoardViewModel.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import PitViewModel from "./PitViewModel";
|
||||
|
||||
export default class BoardViewModel {
|
||||
id: string;
|
||||
pits: PitViewModel[];
|
||||
constructor(id: string, pits: PitViewModel[]) {
|
||||
this.id = id;
|
||||
this.pits = pits;
|
||||
}
|
||||
}
|
||||
18
src/viewmodel/PitViewModel.ts
Normal file
18
src/viewmodel/PitViewModel.ts
Normal file
@ -0,0 +1,18 @@
|
||||
export default class PitViewModel {
|
||||
id: string;
|
||||
stoneCount: number;
|
||||
stoneColor: string;
|
||||
pitColor: string;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
stoneCount: number,
|
||||
stoneColor: string,
|
||||
pitColor: string
|
||||
) {
|
||||
this.id = id;
|
||||
this.stoneCount = stoneCount;
|
||||
this.stoneColor = stoneColor;
|
||||
this.pitColor = pitColor;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user