diff options
26 files changed, 302 insertions, 502 deletions
diff --git a/src/docs/class.puml b/src/docs/class.puml index 0506357..cfc78b1 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[]) |
@@ -29,7 +31,7 @@ package context { | |||
29 | } | 31 | } |
30 | 32 | ||
31 | class Context { | 33 | class Context { |
32 | Context(Game,List<Event>,GraphicsContext) | 34 | Context(Game, List<Event>, GraphicsContext) |
33 | Game getGame() | 35 | Game getGame() |
34 | List<Event> getEvents() | 36 | List<Event> getEvents() |
35 | GraphicsContext getGraphicsContext() | 37 | GraphicsContext getGraphicsContext() |
@@ -37,22 +39,23 @@ package context { | |||
37 | } | 39 | } |
38 | 40 | ||
39 | class GraphicsContext { | 41 | class GraphicsContext { |
40 | final Graphics2D | 42 | Graphics2D, ScreenInfo |
41 | final ScreenInfo | 43 | |
42 | paintCircle(Color, Vec2, float) | 44 | paintCircle(Color, Vec2, float) |
43 | paintSquare(Color, Vec2, float, float) | 45 | paintSquare(Color, Vec2, float, float) |
44 | paintString(Color, Vec2,String) | 46 | paintString(Color, Vec2,String) |
45 | } | 47 | } |
46 | 48 | ||
47 | class InputHandler { | 49 | class InputHandler { |
48 | private final ApplicationContext | 50 | ApplicationContext |
51 | |||
49 | InputHandler(ApplicationContext) | 52 | InputHandler(ApplicationContext) |
50 | List<Event> getEvents() | 53 | List<Event> getEvents() |
51 | } | 54 | } |
52 | 55 | ||
53 | class ScreenManager { | 56 | class ScreenManager { |
54 | private final ApplicationContext | 57 | ApplicationContext, Graphics2D |
55 | private final Graphics2D | 58 | |
56 | ScreenManager(ApplicationContext,Graphics2D) | 59 | ScreenManager(ApplicationContext,Graphics2D) |
57 | GraphicsContext clearScreen() | 60 | GraphicsContext clearScreen() |
58 | } | 61 | } |
@@ -63,6 +66,7 @@ package context { | |||
63 | int indexBoard | 66 | int indexBoard |
64 | final List<Board> | 67 | final List<Board> |
65 | bool over | 68 | bool over |
69 | |||
66 | Game(List<Board>) | 70 | Game(List<Board>) |
67 | Stage getStage() | 71 | Stage getStage() |
68 | bool isOver() | 72 | bool isOver() |
@@ -71,6 +75,14 @@ package context { | |||
71 | void retryStage() | 75 | void retryStage() |
72 | List<Event> update(Context context) | 76 | List<Event> update(Context context) |
73 | } | 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 | } | ||
74 | } | 86 | } |
75 | 87 | ||
76 | package event { | 88 | package event { |
@@ -116,7 +128,6 @@ package board { | |||
116 | 128 | ||
117 | class BoardValidator { | 129 | class BoardValidator { |
118 | static class Constraint | 130 | static class Constraint |
119 | Board | ||
120 | 131 | ||
121 | BoardValidator(Board) | 132 | BoardValidator(Board) |
122 | BoardValidator validate(Predicate<Board>, String error) | 133 | BoardValidator validate(Predicate<Board>, String error) |
@@ -132,15 +143,12 @@ package board { | |||
132 | static final int TILE_DIM | 143 | static final int TILE_DIM |
133 | static TileVec2 fromVec2(Vec2) | 144 | static TileVec2 fromVec2(Vec2) |
134 | 145 | ||
135 | Vec2 | ||
136 | TileVec2(col, row) | 146 | TileVec2(col, row) |
137 | Vec2 toPixelPos() | 147 | Vec2 toPixelPos() |
138 | List<TileVec2> neighbors() | 148 | List<TileVec2> neighbors() |
139 | } | 149 | } |
140 | 150 | ||
141 | class PathFinder { | 151 | class PathFinder { |
142 | Graph | ||
143 | |||
144 | PathFinder(Board) | 152 | PathFinder(Board) |
145 | List<TileVec2> findPath(TileVec2 origin, TileVec2 target) | 153 | List<TileVec2> findPath(TileVec2 origin, TileVec2 target) |
146 | } | 154 | } |
@@ -148,12 +156,8 @@ package board { | |||
148 | 156 | ||
149 | package block { | 157 | package block { |
150 | enum BlockType { | 158 | enum BlockType { |
151 | FREE | 159 | FREE, WALL, TRASH, |
152 | WALL | 160 | GARBAGE, ROBOT, BOMB |
153 | TRASH | ||
154 | GARBAGE | ||
155 | ROBOT | ||
156 | BOMB | ||
157 | 161 | ||
158 | boolean isBounding() | 162 | boolean isBounding() |
159 | boolean mustBeReachable() | 163 | boolean mustBeReachable() |
@@ -166,71 +170,48 @@ package block { | |||
166 | } | 170 | } |
167 | 171 | ||
168 | abstract class Block implements Updateable { | 172 | abstract class Block implements Updateable { |
169 | BlockType | 173 | Block(BlockType) |
170 | List<Controller> | 174 | BlockType getType() |
171 | Vec2 | ||
172 | |||
173 | Block(BlockType, List<Controller>, Vec2) | ||
174 | void setPos(Vec2) | ||
175 | BlockType getBlockType() | ||
176 | Vec2 getPos() | ||
177 | TileVec2 getTile() | 175 | TileVec2 getTile() |
178 | List<Event> update(Context) | 176 | abstract Vec2 getPos() |
177 | abstract void link(World) | ||
179 | } | 178 | } |
180 | 179 | ||
181 | class WallBlock extends Block | 180 | abstract class JBoxBlock extends Block { |
182 | class TrashBlock extends Block | 181 | JBoxBlock(BlockType, BodyType, Shape, Vec2) |
183 | class BombBlock extends Block | 182 | Vec2 getPos() |
184 | class GarbageBlock extends Block | 183 | void link(World) |
185 | class RobotBlock extends Block | ||
186 | |||
187 | class Stage implements Updateable { | ||
188 | List<Block> | ||
189 | Board | ||
190 | Stage(Board) | ||
191 | Board getBoard() | ||
192 | List<Block> getBlocks() | ||
193 | List<Event> update(Context) | ||
194 | bool isCleared() | ||
195 | } | 184 | } |
196 | } | 185 | |
197 | 186 | class RobotBlock extends Block { | |
198 | package controller { | 187 | Vec2 getPos() |
199 | interface Controller extends Updateable | 188 | void link(World world) |
200 | 189 | List<Event> update(Context context) | |
201 | abstract class BlockController implements Controller { | ||
202 | Block | ||
203 | Controller(Block) | ||
204 | } | 190 | } |
205 | 191 | ||
206 | class BlockControllerFactory { | 192 | class WallBlock extends JBoxBlock { |
207 | BlockController build(Block) | 193 | List<Event> update(Context context) |
208 | } | 194 | } |
209 | class GameStateController implements Controller | ||
210 | 195 | ||
211 | abstract class PhysicsController extends BlockController | 196 | class TrashBlock extends JBoxBlock { |
212 | abstract class DisplayController extends BlockController | 197 | List<Event> update(Context context) |
213 | 198 | } | |
214 | class WallPhysicsController extends PhysicsController | ||
215 | class WallDisplayController extends DisplayController | ||
216 | |||
217 | class TrashPhysicsController extends PhysicsController | ||
218 | class TrashDisplayController extends DisplayController | ||
219 | 199 | ||
220 | class GarbagePhysicsController extends PhysicsController | 200 | class BombBlock extends JBoxBlock { |
221 | class GarbageDisplayController extends DisplayController |