-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMauiSlidePuzzle.puml
167 lines (146 loc) · 4.41 KB
/
MauiSlidePuzzle.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
@startuml MauiSlidePuzzle
class SlidePuzzleView
{
'- puzzle : SlidePuzzle
~ PanelViews : List<SlidePanelView>
~ BlankPanelView : BlankPanelView
- skImage : SKImage
~ SlidePuzzleView(width : double, height : double)
~ SetImageSource(embeddedImageSource : String) : void
~ ClearImageSource() : void
~ Initialize(model : SlidePuzzle) : void
~ ConvertLocToTrans(location : Point) : Point
'~ ShuffleAsync(count : int) : Task
}
abstract SlidePanelView
{
+ ID : int
+ Translation : Point
~ IsMoving : bool <<get only>>
# isMoving : bool
- imagePanel : ClipImagePanel
- gv : GraphicsView <<read only>>
# SlidePanelView(image : IImage, clipRect : RectF, id : int)
'# AddTapRecognizer(tapped : Action<SlidePanelView>) : void
{abstract} ~ DrawPanelFrame(canvas : ICanvas, clipRect : RectF) : void
'{abstract} ~ SetTappedNotifier(tapped : Action<SlidePanelView>) : void
{abstract} ~ MoveTo(point : Point, length : uint) : Task
~ Shake(amplitude : double, length : uint) : Task
}
class ImagePanelView
{
' - panel : ImagePanel
' - isBlank : bool
' ~ ImagePanelView(panel : ImagePanel)
' ~ SetAsBlank() : void
}
class BlankPanelView
{
}
class PanelFrameDrawable
{
'- image : IImage <<read only>>
- clipRect : RectF <<read only>>
+ DrawFrame : Action<ICanvas, RectF>
}
class SlidePuzzle
{
+ Rows : int <<read only>>
+ Columns : int <<read only>>
+ Panels : List<SlidePanel> <<read only>>
+ BlankPanel : SlidePanel <<read only>>
' - panels : List<ImagePanel>
' - blankPanel : ImagePanel
~ SlidePuzzle(rows : int, columns : int)
~ Shuffle(counts : int) : IEnumerable<SlidePanel>
- Shuffle() : IEnumerable<SlidePanel>
~ Reset() : void
~ TryMove(panel : SlidePanel) : bool
- GetNeighbors(panel : SlidePanel) : List<SlidePanel>
~ IsCompleted() : bool
}
class SlidePanel
{
- initialLocation : Point <<read only>>
+ ID : int
+ Location : Point
~ SlidePanel(initialLocation : Point, id : int)
~ SwapLocation(targetPanel : SlidePanel) : void
~ IsInitialLocation() : bool
}
class SlidePuzzleController
{
- view : SlidePuzzleView <<read only>>
- model : SlidePuzzle <<read only>>
~ SlidePuzzleController(view : SlidePuzzleView, model : SlidePuzzle)
~ Initialize() : void
- EnablePanelTap() : void
- DisablePanelTap() : void
~ ShuffleAsync(counts : int) : Task
~ ResetAsync() : Task
- PanelTapped(panelView : SlidePanelView) : void
'- ViewTapped() : void
'- SwapPanelTranslatinoAsync(imagePanelView : ImagePanelView, blankPanelView : BlankPanelView, length : uint) : Task
}
class MainPage
{
+ CurrentStageInfo : StageInfo
- stageList : List<StageInfo>
- controller : SlidePuzzleController <<read only>>
+ MainPage()
- PrepareNewStage() : void
}
class StageInfo <<Observable Object>>
{
StageName : string
ImageFilename : string
Rows : int
Columns : int
EmbeddedImagePath : string
ShuffleCounts : int
}
' arrows
ImagePanelView -up-|> SlidePanelView
BlankPanelView -up-|> SlidePanelView
SlidePanelView -right-> PanelFrameDrawable
MainPage --> SlidePuzzleView
MainPage ..> SlidePuzzle : <create>
MainPage --> SlidePuzzleController
SlidePuzzle *.down. "many" SlidePanel
SlidePuzzleView *.down. "many" SlidePanelView
SlidePuzzleController -left-> SlidePuzzleView
SlidePuzzleController -right-> SlidePuzzle
MainPage -right-> StageInfo
@enduml
@startuml AppStates
title AppStates
hide empty description
[*] -> Initialized
Initialized -> OnGamePreparing
state OnGame {
state OnGamePreparing {
}
OnGamePreparing --> OnGameReady
OnGameReady -> OnGamePlay : StartClicked
OnGamePlay --> OnGameReset : ResetClicked
OnGameReset --> OnGamePlay : await ResetAsync
OnGamePlay -> OnGameReady : OnCompleted
}
OnGame --> OnGamePreparing : PrevStageClicked / \nNextStageClicked / \nReloadStageClicked
@enduml
@startuml AppStates_CompletedMessage
title AppStates.CompletedMessage
hide empty description
[*] -> Default
Default --> OnGameCompleted : OnCompleted
OnGameCompleted --> Default : StartClicked / \nPrevStageClicked / \nNextStageClicked
@enduml
@startuml AppStates_CurrentStageImage
title AppStates.CurrentStageImage
hide empty description
[*] -> Default
Default --> OnGameReady : PrepareNewStage
OnGameReady --> Default : StartClicked
Default --> OnGameCompleted : OnCompleted
OnGameCompleted --> Default : StartClicked
@enduml