-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
177 lines (166 loc) · 4.37 KB
/
main.cpp
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
168
169
170
171
172
173
174
175
176
/* Laboratorio Programacion IV - INCO/FING/UDELAR
* Laboratorio 4 - Implementacion de main (menu)
* Autores (por nombre):
* Alexis Baladon
* Guillermo Toyos
* Jorge Machado
* Juan Jose Mangado
* Mathias Ramilo
*/
#include <iostream>
#include <cstdlib>
#include <string>
#include <stdio.h>
#include <limits> // Necesario para limpiar el buffer de entrada.
#include "include/sistema.h"
#include "include/fechaSistema.h"
#include "include/menuUtilities.h"
using namespace menuUtilities;
using namespace std;
int menuUsuario(Sistema * sys){
int controlVar=0;
while (controlVar!=8){
cls();
ptitle();
cout << "\nFecha actual del sistema: " << fechaSistema::fecha << endl;
cout << "Usted ha iniciado sesion como: " << sys->getLoggedUserEmail() << "\n\n";
cout << "────────── Menu Jugador ──────────" << endl << endl;
cout << " 1. Suscribirse a videojuego" << endl;
cout << " 2. Asignar puntaje a videojuego" << endl;
cout << " 3. Iniciar partida" << endl;
cout << " 4. Abandonar partida multijugador" << endl;
cout << " 5. Finalizar partida" << endl;
cout << " 6. Ver informacion de videojuego" << endl;
cout << " 7. Modificar fecha del sistema" << endl;
cout << " 8. Salir" << endl;
cout << "Por favor ingrese una opcion: ";
controlVar = takeInputRange(1,8);
switch (controlVar) {
case 1:{
sys->suscribirseVideojuego();
break;
}
case 2:{
sys->asignarPuntajeVideojuego();
break;
}
case 3:{
sys->iniciarPartida();
break;
}
case 4:{
sys->abandonarPartidaMultijugador();
break;
}
case 5:{
sys->finalizarPartida();
break;
}
case 6:{
sys->verInformacionVideojuego();
break;
}
case 7:{
sys->modificarFecha();
}
}
}
return 0;
}
int menuDesarrollador(Sistema * sys){
int controlVar=0;
while (controlVar!=8){
cls();
ptitle();
cout << "\nFecha actual del sistema: " << fechaSistema::fecha << endl;
cout << "Usted ha iniciado sesion como: " << sys->getLoggedUserEmail() << "\n\n";
cout << "────────── Menu Desarrollador ──────────" << endl << endl;
cout << " 1. Agregar categoria" << endl;
cout << " 2. Publicar videojuego" << endl;
cout << " 3. Eliminar videojuego" << endl;
cout << " 4. Seleccionar estadisticas" << endl;
cout << " 5. Consultar estadisticas" << endl;
cout << " 6. Ver informacion de videojuego" << endl;
cout << " 7. Modificar fecha del sistema" << endl;
cout << " 8. Salir" << endl;
cout << "Por favor ingrese una opcion: ";
controlVar = takeInputRange(1,8);
switch (controlVar) {
case 1:{
sys->cargarCategoria();
break;
}
case 2:{
sys->publicarVideojuego();
break;
}
case 3:{
sys->eliminarVideojuego();
break;
}
case 4:{
sys->seleccionarEstadistica();
break;
}
case 5:{
sys->consultarEstadisticas();
break;
}
case 6:{
sys->verInformacionVideojuego();
break;
}
case 7:{
sys->modificarFecha();
break;
}
}
}
return 0;
}
int main() {
Sistema* sys = new Sistema();
int controlVar=0;
while (controlVar!=5){
cls();
ptitle();
cout << "\nFecha actual del sistema: " << fechaSistema::fecha << endl<<endl;
cout << "────────── Menu Principal ──────────" << endl << endl;
cout << " 1. Alta de Usuario" << endl;
cout << " 2. Iniciar sesion" << endl;
cout << " 3. Modificar fecha del sistema" << endl;
cout << " 4. Cargar datos de prueba" << endl;
cout << " 5. Salir" << endl;
cout << "Por favor ingrese una opcion: ";
controlVar = takeInputRange(1,5);
switch (controlVar) {
case 1: {
sys->altaUsuario();
break;
}
case 2: {
int x;
if ((x = sys->iniciarSesion()) == 1) menuUsuario(sys);
else if (x==2) menuDesarrollador(sys);
break;
}
case 3: {
sys->modificarFecha();
break;
}
case 4: {
if(sys->cargarDatosPrueba()){
cout << "ERROR: Los datos de prueba pueden ser cargados una sola vez.\n";
pkey();
}
break;
}
case 5: {
delete sys;
break;
}
}
}
cout << "Gracias por utilizar Steam v3.0.\n";
return 0;
}