Dogeku 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +39 -0
- data/app/Historique/Action.rb +29 -0
- data/app/Historique/ChangerCase.rb +44 -0
- data/app/Historique/HistoriqueAction.rb +114 -0
- data/app/components/CaseDessin.rb +325 -0
- data/app/components/GrilleDessin.rb +235 -0
- data/app/components/Header.rb +194 -0
- data/app/config/app.yml +0 -0
- data/app/config/database.yml +2 -0
- data/app/controller/ApprentissageControleur.rb +75 -0
- data/app/controller/ChargerControleur.rb +41 -0
- data/app/controller/JeuLibreControleur.rb +244 -0
- data/app/controller/MenuControleur.rb +57 -0
- data/app/controller/NiveauControleur.rb +54 -0
- data/app/controller/NouvellePartieControleur.rb +34 -0
- data/app/controller/PrincipaleControleur.rb +30 -0
- data/app/controller/PseudoControleur.rb +95 -0
- data/app/controller/ReglagesControleur.rb +86 -0
- data/app/controller/ReglesControleur.rb +34 -0
- data/app/controller/ScoresControleur.rb +42 -0
- data/app/controller/StatistiquesControleur.rb +64 -0
- data/app/core/Conf.rb +26 -0
- data/app/core/Controller.rb +180 -0
- data/app/core/Core.rb +186 -0
- data/app/core/Model.rb +159 -0
- data/app/core/View.rb +56 -0
- data/app/db/main.sqlite3 +0 -0
- data/app/model/Configuration.rb +180 -0
- data/app/model/Grille.rb +180 -0
- data/app/model/Jeu.rb +74 -0
- data/app/model/Score.rb +100 -0
- data/app/model/Utilisateur.rb +113 -0
- data/app/utils/DSubset.rb +98 -0
- data/app/utils/Generateur.rb +171 -0
- data/app/utils/HPTriple.rb +75 -0
- data/app/utils/Peche.rb +46 -0
- data/app/utils/SCandidate.rb +86 -0
- data/app/utils/SCell.rb +73 -0
- data/app/utils/Technique.rb +202 -0
- data/app/utils/TechniqueUsine.rb +25 -0
- data/app/utils/XWing.rb +203 -0
- data/app/view/Fenetre.rb +424 -0
- data/app/view/FenetreApprentissage.rb +272 -0
- data/app/view/FenetreCharger.rb +31 -0
- data/app/view/FenetreJeuLibre.rb +468 -0
- data/app/view/FenetreMenu.rb +198 -0
- data/app/view/FenetreNiveau.rb +105 -0
- data/app/view/FenetreNouvellePartie.rb +92 -0
- data/app/view/FenetrePrincipale.rb +45 -0
- data/app/view/FenetrePseudo.rb +115 -0
- data/app/view/FenetreReglages.rb +209 -0
- data/app/view/FenetreRegles.rb +111 -0
- data/app/view/FenetreScores.rb +120 -0
- data/app/view/FenetreStatistiques.rb +134 -0
- data/assets/css/style.css +69 -0
- data/assets/img/eraser.png +0 -0
- data/assets/img/fond.jpg +0 -0
- data/assets/img/iconApp.png +0 -0
- data/assets/img/logoS.jpeg +0 -0
- data/assets/img/sudokuIntro.jpg +0 -0
- data/assets/img/user.png +0 -0
- data/bin/dogeku +19 -0
- data/doc/Action.html +309 -0
- data/doc/ApprentissageControleur.html +568 -0
- data/doc/CaseDessin.html +2405 -0
- data/doc/ChangerCase.html +405 -0
- data/doc/ChargerControleur.html +342 -0
- data/doc/Conf.html +378 -0
- data/doc/Configuration.html +1115 -0
- data/doc/Controller.html +1008 -0
- data/doc/Core.html +1191 -0
- data/doc/DSubset.html +647 -0
- data/doc/Fenetre.html +2631 -0
- data/doc/FenetreApprentissage.html +1175 -0
- data/doc/FenetreCharger.html +343 -0
- data/doc/FenetreJeuLibre.html +1859 -0
- data/doc/FenetreMenu.html +900 -0
- data/doc/FenetreNiveau.html +626 -0
- data/doc/FenetreNouvellePartie.html +602 -0
- data/doc/FenetrePrincipale.html +371 -0
- data/doc/FenetrePseudo.html +695 -0
- data/doc/FenetreReglages.html +946 -0
- data/doc/FenetreRegles.html +636 -0
- data/doc/FenetreScores.html +650 -0
- data/doc/FenetreStatistiques.html +672 -0
- data/doc/Generateur.html +1015 -0
- data/doc/Grille.html +1348 -0
- data/doc/GrilleDessin.html +1281 -0
- data/doc/HPTriple.html +593 -0
- data/doc/Header.html +1253 -0
- data/doc/HistoriqueAction.html +792 -0
- data/doc/Jeu.html +923 -0
- data/doc/JeuLibreControleur.html +1445 -0
- data/doc/MenuControleur.html +522 -0
- data/doc/Model.html +996 -0
- data/doc/NiveauControleur.html +451 -0
- data/doc/NouvellePartieControleur.html +330 -0
- data/doc/Peche.html +396 -0
- data/doc/PrincipaleControleur.html +320 -0
- data/doc/PseudoControleur.html +695 -0
- data/doc/ReglagesControleur.html +747 -0
- data/doc/ReglesControleur.html +330 -0
- data/doc/SCandidate.html +617 -0
- data/doc/SCell.html +587 -0
- data/doc/Score.html +926 -0
- data/doc/ScoresControleur.html +346 -0
- data/doc/StatistiquesControleur.html +390 -0
- data/doc/Technique.html +543 -0
- data/doc/TechniqueUsine.html +252 -0
- data/doc/Utilisateur.html +806 -0
- data/doc/View.html +844 -0
- data/doc/XWing.html +1031 -0
- data/doc/_index.html +478 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +492 -0
- data/doc/file.README.html +141 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +141 -0
- data/doc/js/app.js +243 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +2523 -0
- data/doc/top-level-namespace.html +112 -0
- data/test/Generateur/grilleCorrecte.rb +198 -0
- data/test/Model/scoreCorrecte.rb +55 -0
- data/test/Model/utilisateurCorrecte.rb +68 -0
- data/test/test_helper.rb +2 -0
- data/test/unitTest.rb +72 -0
- metadata +187 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# => Contient la classe FenetreReglages contenant la gestion des reglages(taille, couleur)
|
|
2
|
+
#
|
|
3
|
+
# => Author:: Valentin, DanAurea
|
|
4
|
+
# => Version:: 0.1
|
|
5
|
+
# => Copyright:: © 2016
|
|
6
|
+
# => License:: Distributes under the same terms as Ruby
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
## classe FenetreReglages
|
|
10
|
+
##
|
|
11
|
+
class FenetreReglages < View
|
|
12
|
+
# VI box
|
|
13
|
+
@boxTop
|
|
14
|
+
@boxBottom
|
|
15
|
+
@config
|
|
16
|
+
# VI bouton
|
|
17
|
+
@boutonCouleurCaseBase
|
|
18
|
+
@boutonCouleurCaseSelectionne
|
|
19
|
+
@boutonCouleurTexte
|
|
20
|
+
@boutonCouleurIndices
|
|
21
|
+
@boutonPolice
|
|
22
|
+
# VI label
|
|
23
|
+
@titreLabel
|
|
24
|
+
@tmp
|
|
25
|
+
@labelCouleurCaseBase
|
|
26
|
+
@labelCouleurCaseSelectionne
|
|
27
|
+
@labelCouleurTexte
|
|
28
|
+
@labelCouleurIndices
|
|
29
|
+
@labelPolice
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
## Initialize
|
|
33
|
+
##
|
|
34
|
+
def initialize
|
|
35
|
+
# VI box
|
|
36
|
+
@boxTop = Gtk::Box.new(:vertical,0)
|
|
37
|
+
@boxBottom = Fenetre::creerBoxBottom()
|
|
38
|
+
|
|
39
|
+
# VI bouton
|
|
40
|
+
@boutonCouleurCaseBase = Gtk::ColorButton.new()
|
|
41
|
+
@boutonCouleurCaseSelectionne = Gtk::ColorButton.new()
|
|
42
|
+
@boutonCouleurTexte = Gtk::ColorButton.new()
|
|
43
|
+
@boutonCouleurIndices = Gtk::ColorButton.new()
|
|
44
|
+
@boutonPolice = Gtk::FontButton.new()
|
|
45
|
+
@boutonReset = Gtk::Button.new(:label => "Réinitialiser profil")
|
|
46
|
+
|
|
47
|
+
Fenetre::boutonRetour.signal_connect('clicked'){
|
|
48
|
+
enregistrerReglages(@pseudo, @config)
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# VI label
|
|
53
|
+
@titreLabel = Fenetre::creerLabelType("<u>Réglages</u>", Fenetre::SIZE_TITRE)
|
|
54
|
+
@tmp = Fenetre::creerLabelType(" ", 10)
|
|
55
|
+
@labelCouleurCaseBase = Fenetre::creerLabelType("Couleur des cases de base:", Fenetre::SIZE_TITRE_REGLAGE)
|
|
56
|
+
@labelCouleurCaseSelectionne = Fenetre::creerLabelType("Couleur des cases surlignées:", Fenetre::SIZE_TITRE_REGLAGE)
|
|
57
|
+
@labelCouleurTexte = Fenetre::creerLabelType("Couleur du texte:", Fenetre::SIZE_TITRE_REGLAGE)
|
|
58
|
+
@labelCouleurIndices = Fenetre::creerLabelType("Couleur des indices:", Fenetre::SIZE_TITRE_REGLAGE)
|
|
59
|
+
@labelPolice = Fenetre::creerLabelType("Police de texte:", Fenetre::SIZE_TITRE_REGLAGE)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
##
|
|
63
|
+
## Définis les paramètres en provenance de la base de donnée
|
|
64
|
+
##
|
|
65
|
+
## @return self
|
|
66
|
+
##
|
|
67
|
+
def setParams()
|
|
68
|
+
|
|
69
|
+
@boutonCouleurCaseBase.color = creerCouleur(@config["caseBase"])
|
|
70
|
+
@boutonCouleurCaseSelectionne.color = creerCouleur(@config["caseSelectionne"])
|
|
71
|
+
@boutonCouleurTexte.color = creerCouleur(@config["couleurTexte"])
|
|
72
|
+
@boutonCouleurIndices.color = creerCouleur(@config["couleurIndices"])
|
|
73
|
+
@boutonPolice.font_name = @config["police"] + " " + @config["taillePolice"].to_s
|
|
74
|
+
|
|
75
|
+
return self
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
##
|
|
79
|
+
## Permet de créer et d'ajouter les box au conteneur principal
|
|
80
|
+
##
|
|
81
|
+
##
|
|
82
|
+
def miseEnPlace()
|
|
83
|
+
creerBoxTop()
|
|
84
|
+
ajoutCss()
|
|
85
|
+
Fenetre::box.add(@boxTop)
|
|
86
|
+
Fenetre::box.add(@boxBottom)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
##
|
|
90
|
+
## Créer la box verticale contenant le listing des réglages et le titre
|
|
91
|
+
##
|
|
92
|
+
##
|
|
93
|
+
def creerBoxTop()
|
|
94
|
+
#Action des boutons
|
|
95
|
+
@labelCouleurCaseBase.halign = :start
|
|
96
|
+
@labelCouleurCaseSelectionne.halign = :start
|
|
97
|
+
@labelCouleurTexte.halign = :start
|
|
98
|
+
@labelCouleurIndices.halign = :start
|
|
99
|
+
@labelPolice.halign = :start
|
|
100
|
+
|
|
101
|
+
#tableau réglages
|
|
102
|
+
table=Gtk::Table.new(2,5,false)
|
|
103
|
+
table.attach(@labelCouleurCaseBase,0,1,0,1)
|
|
104
|
+
table.attach(@boutonCouleurCaseBase,1,2,0,1)
|
|
105
|
+
table.attach(@labelCouleurCaseSelectionne,0,1,1,2)
|
|
106
|
+
table.attach(@boutonCouleurCaseSelectionne,1,2,1,2)
|
|
107
|
+
table.attach(@labelCouleurTexte,0,1,2,3)
|
|
108
|
+
table.attach(@boutonCouleurTexte,1,2,2,3)
|
|
109
|
+
table.attach(@labelCouleurIndices,0,1,3,4)
|
|
110
|
+
table.attach(@boutonCouleurIndices,1,2,3,4)
|
|
111
|
+
table.attach(@labelPolice,0,1,4,5)
|
|
112
|
+
table.attach(@boutonPolice,1,2,4,5)
|
|
113
|
+
|
|
114
|
+
#Action des boutons
|
|
115
|
+
@boutonReset.signal_connect('clicked'){
|
|
116
|
+
resetUtilisateur()
|
|
117
|
+
Core::back()
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
#add des boutons
|
|
121
|
+
@boxTop.add(@titreLabel)
|
|
122
|
+
@boxTop.add(@tmp)
|
|
123
|
+
@boxTop.add(table)
|
|
124
|
+
@boxTop.add(@boutonReset)
|
|
125
|
+
|
|
126
|
+
paramCouleurPolice()
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
##
|
|
130
|
+
## Ajoute les classes css au widget
|
|
131
|
+
##
|
|
132
|
+
def ajoutCss()
|
|
133
|
+
#css label
|
|
134
|
+
@titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
135
|
+
@titreLabel.set_margin_top(30)
|
|
136
|
+
@tmp.set_margin_top(10)
|
|
137
|
+
@labelCouleurCaseBase.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
138
|
+
@labelCouleurCaseBase.set_margin(10)
|
|
139
|
+
@labelCouleurCaseBase.set_margin_bottom(0)
|
|
140
|
+
@labelCouleurCaseSelectionne.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
141
|
+
@labelCouleurCaseSelectionne.set_margin(10)
|
|
142
|
+
@labelCouleurCaseSelectionne.set_margin_bottom(0)
|
|
143
|
+
@labelCouleurTexte.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
144
|
+
@labelCouleurTexte.set_margin(10)
|
|
145
|
+
@labelCouleurTexte.set_margin_bottom(0)
|
|
146
|
+
@labelCouleurIndices.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
147
|
+
@labelCouleurIndices.set_margin(10)
|
|
148
|
+
@labelCouleurIndices.set_margin_bottom(0)
|
|
149
|
+
@labelPolice.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
150
|
+
@labelPolice.set_margin(10)
|
|
151
|
+
@labelPolice.set_margin_bottom(0)
|
|
152
|
+
#css bouton
|
|
153
|
+
@boutonCouleurCaseBase.set_margin(10)
|
|
154
|
+
@boutonCouleurCaseBase.set_margin_bottom(0)
|
|
155
|
+
@boutonCouleurCaseSelectionne.set_margin(10)
|
|
156
|
+
@boutonCouleurCaseSelectionne.set_margin_bottom(0)
|
|
157
|
+
@boutonCouleurTexte.set_margin(10)
|
|
158
|
+
@boutonCouleurTexte.set_margin_bottom(0)
|
|
159
|
+
@boutonCouleurIndices.set_margin(10)
|
|
160
|
+
@boutonCouleurIndices.set_margin_bottom(0)
|
|
161
|
+
@boutonPolice.set_margin(10)
|
|
162
|
+
@boutonPolice.set_margin_bottom(0)
|
|
163
|
+
@boutonReset.set_margin(30)
|
|
164
|
+
@boutonReset.set_margin_bottom(0)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
##
|
|
168
|
+
## Définis les paramètres d'apparence de l'utilisateur pour les réglages
|
|
169
|
+
##
|
|
170
|
+
## @return self
|
|
171
|
+
##
|
|
172
|
+
def paramCouleurPolice()
|
|
173
|
+
@boutonCouleurCaseBase.signal_connect "color-set" do
|
|
174
|
+
@config["caseBase"] = couleur(@boutonCouleurCaseBase.color)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
@boutonCouleurCaseSelectionne.signal_connect "color-set" do
|
|
178
|
+
@config["caseSelectionne"] = couleur(@boutonCouleurCaseSelectionne.color)
|
|
179
|
+
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
@boutonCouleurTexte.signal_connect "color-set" do
|
|
183
|
+
@config["couleurTexte"] = couleur(@boutonCouleurTexte.color)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
@boutonCouleurIndices.signal_connect "color-set" do
|
|
187
|
+
@config["couleurIndices"] = couleur(@boutonCouleurIndices.color)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
@boutonPolice.signal_connect "font-set" do
|
|
191
|
+
font = @boutonPolice.font_name
|
|
192
|
+
@config["taillePolice"]=font.slice!(-2,2).to_i
|
|
193
|
+
@config["police"]=font
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
return self
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
##
|
|
200
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
201
|
+
##
|
|
202
|
+
## @return self
|
|
203
|
+
##
|
|
204
|
+
def run()
|
|
205
|
+
self.setParams()
|
|
206
|
+
self.miseEnPlace()
|
|
207
|
+
return self
|
|
208
|
+
end
|
|
209
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# => Contient la classe FenetreRegles qui propose un texte explicatif des règles de base
|
|
2
|
+
#
|
|
3
|
+
# => Author:: Valentin, DanAurea
|
|
4
|
+
# => Version:: 0.1
|
|
5
|
+
# => Copyright:: © 2016
|
|
6
|
+
# => License:: Distributes under the same terms as Ruby
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
## classe FenetreRegles
|
|
10
|
+
##
|
|
11
|
+
class FenetreRegles < View
|
|
12
|
+
# VI box
|
|
13
|
+
@boxTop
|
|
14
|
+
@boxBottom
|
|
15
|
+
# VI label
|
|
16
|
+
@titreLabel
|
|
17
|
+
@regle0Label
|
|
18
|
+
@regle1Label
|
|
19
|
+
# VI règles
|
|
20
|
+
@tabRegle
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
## Initialize
|
|
24
|
+
##
|
|
25
|
+
def initialize()
|
|
26
|
+
# VI box
|
|
27
|
+
@boxTop = Gtk::Box.new(:vertical,0)
|
|
28
|
+
@boxBottom = Fenetre::creerBoxBottom()
|
|
29
|
+
# VI label
|
|
30
|
+
@titreLabel = Fenetre::creerLabelType("<u>Règles</u>", Fenetre::SIZE_TITRE)
|
|
31
|
+
@regle0Label = Fenetre::creerLabelType("*************************************************************", Fenetre::SIZE_TITRE_REGLE)
|
|
32
|
+
@regle1Label = Fenetre::creerLabelType("*************************************************************", Fenetre::SIZE_TITRE_REGLE)
|
|
33
|
+
# VI règles
|
|
34
|
+
@tabRegle = [
|
|
35
|
+
" - Un sudoku classique contient 9 lignes et 9 colonnes,",
|
|
36
|
+
"soit 81 cases au total.",
|
|
37
|
+
" - Le but du jeu est de remplir ces cases avec des chiffres",
|
|
38
|
+
"allant de 1 à 9 en veillant toujours à ce qu'un même chiffre",
|
|
39
|
+
"ne figure qu'une seule fois par colonne, une seule fois par",
|
|
40
|
+
"ligne et une seule fois par carré de 9 cases (appelé région).",
|
|
41
|
+
" - Au début du jeu, une vingtaine de chiffres sont déjà placés",
|
|
42
|
+
"et il vous reste à trouver les autres. En effet, une grille",
|
|
43
|
+
"initiale de sudoku correctement constituée ne peut aboutir qu'à",
|
|
44
|
+
"une et une seule solution. Pour trouver les chiffres manquants,",
|
|
45
|
+
"tout est une question de logique et d'observation.",
|
|
46
|
+
" - Suivez le tutoriel pour vous faciliter la tache et",
|
|
47
|
+
"apprendre certaines techniques..."
|
|
48
|
+
]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
##
|
|
52
|
+
## Permet de créer et d'ajouter les box au conteneur principal
|
|
53
|
+
##
|
|
54
|
+
##
|
|
55
|
+
def miseEnPlace()
|
|
56
|
+
creerBoxTop()
|
|
57
|
+
ajoutCss()
|
|
58
|
+
Fenetre::box.add(@boxTop)
|
|
59
|
+
Fenetre::box.add(@boxBottom)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
##
|
|
63
|
+
## Créer la box verticale contenant le texte explicatif et le titre
|
|
64
|
+
##
|
|
65
|
+
##
|
|
66
|
+
def creerBoxTop()
|
|
67
|
+
#regles enoncées
|
|
68
|
+
table=Gtk::Table.new(1,15,false)
|
|
69
|
+
table.attach(@regle0Label,0,1,0,1)
|
|
70
|
+
table.attach(@regle1Label,0,1,14,15)
|
|
71
|
+
|
|
72
|
+
@tabRegle.each_with_index{|tab,index|
|
|
73
|
+
id=index+1
|
|
74
|
+
regleLabel=Fenetre::creerLabelType("#{tab}", Fenetre::SIZE_CONTENU_REGLE)
|
|
75
|
+
regleLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
76
|
+
regleLabel.set_margin_top(5)
|
|
77
|
+
regleLabel.set_margin_left(10)
|
|
78
|
+
regleLabel.halign = :start
|
|
79
|
+
table.attach(regleLabel,0,1,id,id+1)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#add des boutons à la box
|
|
83
|
+
@boxTop.add(@titreLabel)
|
|
84
|
+
@boxTop.add(table)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
##
|
|
88
|
+
## Ajoute les classes css au widget
|
|
89
|
+
##
|
|
90
|
+
def ajoutCss()
|
|
91
|
+
#css label
|
|
92
|
+
@titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
93
|
+
@titreLabel.set_margin_top(30)
|
|
94
|
+
@regle0Label.override_color(:normal, Fenetre::COULEUR_ORANGE)
|
|
95
|
+
@regle1Label.override_color(:normal, Fenetre::COULEUR_ORANGE)
|
|
96
|
+
@regle0Label.set_margin_top(10)
|
|
97
|
+
@regle0Label.set_margin_bottom(5)
|
|
98
|
+
@regle1Label.set_margin_top(10)
|
|
99
|
+
@regle1Label.set_margin_bottom(5)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
##
|
|
103
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
104
|
+
##
|
|
105
|
+
## @return self
|
|
106
|
+
##
|
|
107
|
+
def run()
|
|
108
|
+
self.miseEnPlace()
|
|
109
|
+
return self
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# => Contient la classe FenetreScores contenant l'affichage des meilleurs scores du jeu
|
|
2
|
+
#
|
|
3
|
+
# => Author:: Valentin, DanAurea
|
|
4
|
+
# => Version:: 0.1
|
|
5
|
+
# => Copyright:: © 2016
|
|
6
|
+
# => License:: Distributes under the same terms as Ruby
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
## classe FenetreScores
|
|
10
|
+
##
|
|
11
|
+
class FenetreScores < View
|
|
12
|
+
# VI box
|
|
13
|
+
@boxTop
|
|
14
|
+
@boxBottom
|
|
15
|
+
@tableScore
|
|
16
|
+
# VI label
|
|
17
|
+
@titreLabel
|
|
18
|
+
@labelPosition
|
|
19
|
+
@labelNom
|
|
20
|
+
@labelPoint
|
|
21
|
+
# VI tableau de score
|
|
22
|
+
@tabScore
|
|
23
|
+
|
|
24
|
+
##
|
|
25
|
+
## Initialize
|
|
26
|
+
##
|
|
27
|
+
def initialize()
|
|
28
|
+
# VI box
|
|
29
|
+
@boxTop = Gtk::Box.new(:vertical,0)
|
|
30
|
+
@boxBottom = Fenetre::creerBoxBottom()
|
|
31
|
+
@tableScore=Gtk::Table.new(3,11,false)
|
|
32
|
+
# VI label
|
|
33
|
+
@titreLabel = Fenetre::creerLabelType("<u>Meilleurs Scores</u>", Fenetre::SIZE_TITRE)
|
|
34
|
+
@labelPosition = Fenetre::creerLabelType("<u>Position</u>", Fenetre::SIZE_TITRE_SCORE)
|
|
35
|
+
@labelNom = Fenetre::creerLabelType("<u>Personne</u>", Fenetre::SIZE_TITRE_SCORE)
|
|
36
|
+
@labelPoint = Fenetre::creerLabelType("<u>Points</u>", Fenetre::SIZE_TITRE_SCORE)
|
|
37
|
+
# VI tableau de score
|
|
38
|
+
@tabScore = []
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
##
|
|
42
|
+
## Permet de créer et d'ajouter les box au conteneur principal
|
|
43
|
+
##
|
|
44
|
+
##
|
|
45
|
+
def miseEnPlace()
|
|
46
|
+
creerBoxTop()
|
|
47
|
+
ajoutCss()
|
|
48
|
+
Fenetre::box.add(@boxTop)
|
|
49
|
+
Fenetre::box.add(@boxBottom)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
##
|
|
53
|
+
## Créer la box verticale contenant le listing des scores et le titre
|
|
54
|
+
##
|
|
55
|
+
##
|
|
56
|
+
def creerBoxTop()
|
|
57
|
+
#Action des boutons
|
|
58
|
+
#Conteneur box
|
|
59
|
+
@tableScore.attach(@labelPosition,0,1,0,1)
|
|
60
|
+
@tableScore.attach(@labelNom,1,2,0,1)
|
|
61
|
+
@tableScore.attach(@labelPoint,2,3,0,1)
|
|
62
|
+
|
|
63
|
+
@tabScore = @meilleursScores
|
|
64
|
+
if @tabScore.size() < 10
|
|
65
|
+
nbAjout= @tabScore.size()+1
|
|
66
|
+
(nbAjout..10).each{ |i|
|
|
67
|
+
@tabScore<<["---","0"]
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
@tabScore.each_with_index{|tab,index|
|
|
72
|
+
id=index+1
|
|
73
|
+
pos=Fenetre::creerLabelType("#{id}", Fenetre::SIZE_CONTENU_SCORE)
|
|
74
|
+
pos.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
75
|
+
pos.set_margin_top(10)
|
|
76
|
+
nom=Fenetre::creerLabelType("#{tab[0]}", Fenetre::SIZE_CONTENU_SCORE)
|
|
77
|
+
nom.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
78
|
+
nom.set_margin_top(10)
|
|
79
|
+
pts=Fenetre::creerLabelType("#{tab[1]}", Fenetre::SIZE_CONTENU_SCORE)
|
|
80
|
+
pts.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
81
|
+
pts.set_margin_top(10)
|
|
82
|
+
@tableScore.attach(pos,0,1,id,id+1)
|
|
83
|
+
@tableScore.attach(nom,1,2,id,id+1)
|
|
84
|
+
@tableScore.attach(pts,2,3,id,id+1)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
#add des boutons à la box
|
|
89
|
+
@boxTop.add(@titreLabel)
|
|
90
|
+
@boxTop.add(@tableScore)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
##
|
|
94
|
+
## Ajoute les classes css au widget
|
|
95
|
+
##
|
|
96
|
+
def ajoutCss()
|
|
97
|
+
#css label
|
|
98
|
+
@titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
99
|
+
@titreLabel.set_margin_top(30)
|
|
100
|
+
@labelPosition.override_color(:normal, Fenetre::COULEUR_ORANGE)
|
|
101
|
+
@labelPosition.set_margin(30)
|
|
102
|
+
@labelPosition.set_margin_bottom(10)
|
|
103
|
+
@labelNom.override_color(:normal, Fenetre::COULEUR_ORANGE)
|
|
104
|
+
@labelNom.set_margin(30)
|
|
105
|
+
@labelNom.set_margin_bottom(10)
|
|
106
|
+
@labelPoint.override_color(:normal, Fenetre::COULEUR_ORANGE)
|
|
107
|
+
@labelPoint.set_margin(30)
|
|
108
|
+
@labelPoint.set_margin_bottom(10)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
##
|
|
112
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
113
|
+
##
|
|
114
|
+
## @return self
|
|
115
|
+
##
|
|
116
|
+
def run()
|
|
117
|
+
self.miseEnPlace()
|
|
118
|
+
return self
|
|
119
|
+
end
|
|
120
|
+
end
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# => Contient la classe FenetreStatistiques exposant les statistiques
|
|
2
|
+
#
|
|
3
|
+
# => Author:: Valentin, DanAurea
|
|
4
|
+
# => Version:: 0.1
|
|
5
|
+
# => Copyright:: © 2016
|
|
6
|
+
# => License:: Distributes under the same terms as Ruby
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
## classe FenetreStatistiques
|
|
10
|
+
##
|
|
11
|
+
class FenetreStatistiques < View
|
|
12
|
+
# VI box
|
|
13
|
+
@boxTop
|
|
14
|
+
@boxBottom
|
|
15
|
+
# VI label
|
|
16
|
+
@titreLabel
|
|
17
|
+
@labelDifficulte
|
|
18
|
+
@labelRecord
|
|
19
|
+
@labelMoyenne
|
|
20
|
+
@labelNbPartie
|
|
21
|
+
@labelFacile
|
|
22
|
+
@labelMoyen
|
|
23
|
+
@labelDifficile
|
|
24
|
+
# VI stat
|
|
25
|
+
@tabStat
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
## Initialize
|
|
29
|
+
##
|
|
30
|
+
def initialize()
|
|
31
|
+
# VI box
|
|
32
|
+
@boxTop = Gtk::Box.new(:vertical,0)
|
|
33
|
+
@boxBottom = Fenetre::creerBoxBottom()
|
|
34
|
+
# VI label
|
|
35
|
+
@titreLabel = Fenetre::creerLabelType("<u>Statistiques</u>",Fenetre::SIZE_TITRE)
|
|
36
|
+
@labelDifficulte = Fenetre::creerLabelType("<u>Difficulté</u>",Fenetre::SIZE_TITRE_STAT)
|
|
37
|
+
@labelRecord = Fenetre::creerLabelType("<u>Record</u>",Fenetre::SIZE_TITRE_STAT)
|
|
38
|
+
@labelMoyenne = Fenetre::creerLabelType("<u>Moyenne</u>",Fenetre::SIZE_TITRE_STAT)
|
|
39
|
+
@labelNbPartie = Fenetre::creerLabelType("<u>Nb Parties</u>",Fenetre::SIZE_TITRE_STAT)
|
|
40
|
+
@labelFacile = Fenetre::creerLabelType("Facile", Fenetre::SIZE_CONTENU_STAT)
|
|
41
|
+
@labelMoyen = Fenetre::creerLabelType("Moyen", Fenetre::SIZE_CONTENU_STAT)
|
|
42
|
+
@labelDifficile = Fenetre::creerLabelType("Difficile", Fenetre::SIZE_CONTENU_STAT)
|
|
43
|
+
# VI stat
|
|
44
|
+
|
|
45
|
+
@tabStat = []
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
##
|
|
50
|
+
## Permet de créer et d'ajouter les box au conteneur principal
|
|
51
|
+
##
|
|
52
|
+
##
|
|
53
|
+
def miseEnPlace()
|
|
54
|
+
creerBoxTop()
|
|
55
|
+
ajoutCss()
|
|
56
|
+
Fenetre::box.add(@boxTop)
|
|
57
|
+
Fenetre::box.add(@boxBottom)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
##
|
|
61
|
+
## Créer la box verticale contenant le listing des stats et le titre
|
|
62
|
+
##
|
|
63
|
+
##
|
|
64
|
+
def creerBoxTop()
|
|
65
|
+
#Action des boutons
|
|
66
|
+
#tableau statistique
|
|
67
|
+
table=Gtk::Table.new(4,4,false)
|
|
68
|
+
table.attach(@labelDifficulte,0,1,0,1)
|
|
69
|
+
table.attach(@labelRecord,1,2,0,1)
|
|
70
|
+
table.attach(@labelMoyenne,2,3,0,1)
|
|
71
|
+
table.attach(@labelNbPartie,3,4,0,1)
|
|
72
|
+
table.attach(@labelFacile,0,1,1,2)
|
|
73
|
+
table.attach(@labelMoyen,0,1,2,3)
|
|
74
|
+
table.attach(@labelDifficile,0,1,3,4)
|
|
75
|
+
|
|
76
|
+
@tabStat = [
|
|
77
|
+
[@meilleursScores[Jeu::FACILE], @moyennes[Jeu::FACILE], @nombreParties[Jeu::FACILE]],
|
|
78
|
+
[@meilleursScores[Jeu::MOYEN], @moyennes[Jeu::MOYEN], @nombreParties[Jeu::MOYEN]],
|
|
79
|
+
[@meilleursScores[Jeu::DIFFICILE], @moyennes[Jeu::DIFFICILE], @nombreParties[Jeu::DIFFICILE]]
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
@tabStat.each_with_index{|tab,index|
|
|
83
|
+
tab.each_with_index{|valeur,id|
|
|
84
|
+
infoStat=Fenetre::creerLabelType("#{valeur}",Fenetre::SIZE_CONTENU_STAT)
|
|
85
|
+
if index==0
|
|
86
|
+
infoStat.override_color(:normal, Fenetre::COULEUR_VERT)
|
|
87
|
+
elsif index==1
|
|
88
|
+
infoStat.override_color(:normal, Fenetre::COULEUR_JAUNE)
|
|
89
|
+
else
|
|
90
|
+
infoStat.override_color(:normal, Fenetre::COULEUR_ROUGE)
|
|
91
|
+
end
|
|
92
|
+
infoStat.set_margin(15)
|
|
93
|
+
table.attach(infoStat,id+1,id+2,index+1,index+2)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#add des boutons à la box
|
|
98
|
+
@boxTop.add(@titreLabel)
|
|
99
|
+
@boxTop.add(table)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
##
|
|
103
|
+
## Ajoute les classes css au widget
|
|
104
|
+
##
|
|
105
|
+
def ajoutCss()
|
|
106
|
+
#css label
|
|
107
|
+
@titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
108
|
+
@titreLabel.set_margin_top(30)
|
|
109
|
+
@labelDifficulte.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
110
|
+
@labelDifficulte.set_margin(30)
|
|
111
|
+
@labelRecord.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
112
|
+
@labelRecord.set_margin(30)
|
|
113
|
+
@labelMoyenne.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
114
|
+
@labelMoyenne.set_margin(30)
|
|
115
|
+
@labelNbPartie.override_color(:normal, Fenetre::COULEUR_BLANC)
|
|
116
|
+
@labelNbPartie.set_margin(30)
|
|
117
|
+
@labelFacile.override_color(:normal, Fenetre::COULEUR_VERT)
|
|
118
|
+
@labelFacile.set_margin(15)
|
|
119
|
+
@labelMoyen.override_color(:normal, Fenetre::COULEUR_JAUNE)
|
|
120
|
+
@labelMoyen.set_margin(15)
|
|
121
|
+
@labelDifficile.override_color(:normal, Fenetre::COULEUR_ROUGE)
|
|
122
|
+
@labelDifficile.set_margin(15)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
##
|
|
126
|
+
## Lance la construction du modèle de la vue. Méthode à définir dans tout les cas ! Autrement pas de rendu de la page.
|
|
127
|
+
##
|
|
128
|
+
## @return self
|
|
129
|
+
##
|
|
130
|
+
def run()
|
|
131
|
+
self.miseEnPlace()
|
|
132
|
+
return self
|
|
133
|
+
end
|
|
134
|
+
end
|