diff options
author | Adam NAILI | 2018-02-01 20:58:24 +0100 |
---|---|---|
committer | Adam NAILI | 2018-02-01 20:58:24 +0100 |
commit | a07c49065165b2f896684a57d647f2b1a13b68ca (patch) | |
tree | dc825b31d14503208e8250a001b5ec128afb81c1 | |
parent | 5bff076cc86aa7c09baea850c3617ee2c1253594 (diff) | |
parent | 735be27e8802740cf0986bb6d14e720234889aae (diff) | |
download | wallj-a07c49065165b2f896684a57d647f2b1a13b68ca.tar.gz |
Merge branch 'master' of https://github.com/pacien/upem-java-wallj
44 files changed, 551 insertions, 591 deletions
diff --git a/src/docs/class.puml b/src/docs/class.puml index dbfb731..151e334 100644 --- a/src/docs/class.puml +++ b/src/docs/class.puml | |||
@@ -1,6 +1,8 @@ | |||
1 | @startuml | 1 | @startuml |
2 | 2 | ||
3 | skinparam linetype ortho | 3 | skinparam linetype ortho |
4 | skinparam monochrome reverse | ||
5 | skinparam backgroundColor #FFFFFF | ||
4 | 6 | ||
5 | class Main{ | 7 | class Main{ |
6 | static void main(String[]) | 8 | static void main(String[]) |
@@ -23,43 +25,48 @@ package viewer { | |||
23 | } | 25 | } |
24 | 26 | ||
25 | package context { | 27 | package context { |
28 | interface Updateable { | ||
29 | List<Event> update(Context) | ||
30 | static List<Event> updateAll(List<Updateable>, Context) | ||
31 | } | ||
32 | |||
26 | class Context { | 33 | class Context { |
27 | Context(Game,List<Event>,GraphicsContext) | 34 | Context(Game, List<Event>, GraphicsContext) |
28 | final Game | ||
29 | final List<Event> | ||
30 | final GraphicsContext | ||
31 | Game getGame() | 35 | Game getGame() |
32 | List<Event> getEvents() | 36 | List<Event> getEvents() |
33 | GraphicsContext getGraphicsContext() | 37 | GraphicsContext getGraphicsContext() |
38 | Duration getTimeDelta() | ||
34 | } | 39 | } |
35 | 40 | ||
36 | class GraphicsContext { | 41 | class GraphicsContext { |
37 | final Graphics2D | 42 | Graphics2D, ScreenInfo |
38 | final ScreenInfo | 43 | |
39 | paintCircle(Color, Vec2, float) | 44 | paintCircle(Color, Vec2, float) |
40 | paintSquare(Color, Vec2, float, float) | 45 | paintSquare(Color, Vec2, float, float) |
41 | paintString(Color, Vec2,String) | 46 | paintString(Color, Vec2,String) |
42 | } | 47 | } |
43 | 48 | ||
44 | class InputHandler { | 49 | class InputHandler { |
45 | private final ApplicationContext | 50 | ApplicationContext |
51 | |||
46 | InputHandler(ApplicationContext) | 52 | InputHandler(ApplicationContext) |
47 | List<Event> getEvents() | 53 | List<Event> getEvents() |
48 | } | 54 | } |
49 | 55 | ||
50 | class ScreenManager { | 56 | class ScreenManager { |
51 | private final ApplicationContext | 57 | ApplicationContext, Graphics2D |
52 | private final Graphics2D | 58 | |
53 | ScreenManager(ApplicationContext,Graphics2D) | 59 | ScreenManager(ApplicationContext,Graphics2D) |
54 | GraphicsContext clearScreen() | 60 | GraphicsContext clearScreen() |
55 | } | 61 | } |
56 | 62 | ||
57 | class Game { | 63 | class Game implements Updateable { |
58 | Stage | 64 | Stage |
59 | final List<Controller> | 65 | final List<Controller> |
60 | int indexBoard | 66 | int indexBoard |
61 | final List<Board> | 67 | final List<Board> |
62 | bool over | 68 | bool over |
69 | |||
63 | Game(List<Board>) | 70 | Game(List<Board>) |
64 | Stage getStage() | 71 | Stage getStage() |
65 | bool isOver() | 72 | bool isOver() |
@@ -68,31 +75,36 @@ package context { | |||
68 | void retryStage() | 75 | void retryStage() |
69 | List<Event> update(Context context) | 76 | List<Event> update(Context context) |
70 | } | 77 | } |
78 | |||
79 | class Stage implements Updateable { | ||
80 | Stage(Board) | ||
81 | Board getBoard() | ||
82 | List<Block> getBlocks() | ||
83 | List<Event> update(Context) | ||
84 | bool isCleared() | ||
85 | } | ||
71 | } | 86 | } |
72 | 87 | ||
73 | package event { | 88 | package event { |
74 | interface Event | 89 | interface Event |
75 | |||
76 | interface InputEvent implements Event | ||
77 | interface GameEvent implements Event | 90 | interface GameEvent implements Event |
91 | interface InputEvent implements Event | ||
78 | 92 | ||
79 | class DropBombEvent implements InputEvent | 93 | class ConfirmOrder implements InputEvent |
94 | class BombSetupOrder implements InputEvent | ||
80 | 95 | ||
81 | class AddBombEvent implements InputEvent { | 96 | class MoveRobotOrder implements InputEvent { |
82 | final TileVec2 | 97 | MoveRobotEvent(TileVec2) |
83 | AddBombEvent(TileVec2) | 98 | TileVec2 getTarget() |
84 | TileVec2 getTile() | ||
85 | } | 99 | } |
86 | 100 | ||
87 | class MoveRobotEvent implements InputEvent { | 101 | class BombSetupEvent implements GameEvent { |
88 | final TileVec2 | 102 | final TileVec2 |
89 | MoveRobotEvent(TileVec2) | 103 | AddBombEvent(TileVec2) |
90 | TileVec2 getTile() | 104 | TileVec2 getTile() |
91 | } | 105 | } |
92 | 106 | ||
93 | class ConfirmEvent implements InputEvent | 107 | class GameOverEvent implements GameEvent |
94 | class GameOverEvent implements Event | ||
95 | |||
96 | 108 | ||
97 | class ExplosionEvent implements GameEvent { | 109 | class ExplosionEvent implements GameEvent { |
98 | Block source | 110 | Block source |
@@ -114,7 +126,6 @@ package board { | |||
114 | 126 | ||
115 | class BoardValidator { | 127 | class BoardValidator { |
116 | static class Constraint | 128 | static class Constraint |
117 | Board | ||
118 | 129 | ||
119 | BoardValidator(Board) | 130 | BoardValidator(Board) |
120 | BoardValidator validate(Predicate<Board>, String error) | 131 | BoardValidator validate(Predicate<Board>, String error) |
@@ -130,15 +141,12 @@ package board { | |||
130 | static final int TILE_DIM | 141 | static final int TILE_DIM |
131 | static TileVec2 fromVec2(Vec2) | 142 | static TileVec2 fromVec2(Vec2) |
132 | 143 | ||
133 | Vec2 | ||
134 | TileVec2(col, row) | 144 | TileVec2(col, row) |
135 | Vec2 toPixelPos() | 145 | Vec2 toPixelPos() |
136 | List<TileVec2> neighbors() | 146 | List<TileVec2> neighbors() |
137 | } | 147 | } |
138 | 148 | ||
139 | class PathFinder { | 149 | class PathFinder { |
140 | Graph | ||
141 | |||
142 | PathFinder(Board) | 150 | PathFinder(Board) |
143 | List<TileVec2> findPath(TileVec2 origin, TileVec2 target) | 151 | List<TileVec2> findPath(TileVec2 origin, TileVec2 target) |
144 | } | 152 | } |
@@ -146,12 +154,8 @@ package board { | |||
146 |