// private int _recordPuntos; public FrmEstadisticas(List <Estadisticas> lista) { InitializeComponent(); _listaDeEstadisticas = lista; if (File.Exists(Inicio.Ruta)) { _listaDeEstadisticas = Tetris.DeserializarListaEstadisticas(Inicio.Ruta); } CargarListBox(); CargarComboOrdenamiento(); this.lblPromedioPuntos.Text = CalcularPromedioPuntos().ToString("0"); this.lblMediana.Text = CalcularMedianaPuntos().ToString("0"); this.lblVarianza.Text = CalcularVarianzaPuntos().ToString("0"); this.lblDesvEstandard.Text = CalcularDevEstandardPuntos().ToString("0"); this.listBox1.Visible = false; ObtenerLapsosTiempoEntrePartidos(); MostrarNumeroLineas(); this.cboTipoOrdenamiento.SelectedIndexChanged += new EventHandler(CambioComboIndiceSeleccionado); }
public FrmPrincipal() { InitializeComponent(); _listaDeEstadisticas = new List <Estadisticas>(Tetris.DeserializarListaEstadisticas(Inicio.Ruta)); //if (File.Exists(Ruta)) //{ // _listaDeEstadisticas = DeserializarListaPuntajes(Ruta); //} //ASOCIO EL METODO AL EVENTO FORMCLOSING this.FormClosing += new FormClosingEventHandler(CerrandoAplicacion); }
// private List<int> _puntos; public FrmGraficos(List <Estadisticas> lista) { InitializeComponent(); _listaDeEstadisticas = lista; if (File.Exists(Inicio.Ruta)) { _listaDeEstadisticas = Tetris.DeserializarListaEstadisticas(Inicio.Ruta); } // this._puntos = new List<int>(); //for (int i = 0; i < _listaDeEstadisticas.Count ; i++) //{ // this._puntos.Add(_listaDeEstadisticas[i].Puntos); //} double[] x = new double[_listaDeEstadisticas.Count]; double[] y = new double[_listaDeEstadisticas.Count]; for (int i = 0; i < _listaDeEstadisticas.Count; i++) { x[i] = i; y[i] = _listaDeEstadisticas[i].Puntos; } zedGraphControl1.GraphPane.CurveList.Clear(); zedGraphControl1.GraphPane.Title.Text = "Puntos en funcion del tiempo"; zedGraphControl1.GraphPane.XAxis.Title.Text = "Tiempo"; zedGraphControl1.GraphPane.YAxis.Title.Text = "Puntos"; GraphPane myPane = zedGraphControl1.GraphPane; PointPairList spl1 = new PointPairList(x, y); LineItem myCurve1 = myPane.AddCurve("Puntos", spl1, Color.Blue, SymbolType.None); myCurve1.Line.Width = 2.0F; //GROSOR DE LA LINEA zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); zedGraphControl1.Refresh(); }
// public string Ruta = Application.StartupPath + "\\Tetris.xml"; public Tetris() { if (File.Exists(Inicio.Ruta)) { _listaDeEstadisticas = Tetris.DeserializarListaEstadisticas(Inicio.Ruta); } else { _listaDeEstadisticas = new List <Estadisticas>(); } // _estaFuncionando = true; _x1 = _x2 = _x3 = _x4 = 0; _puntos = 0; _lineasCompletas = 0; //for (int i = 0; i < _intervalosTiempo.Length; i++) //{ // _intervalosTiempo[i] -= (int)(_intervalosTiempo[0] * 0.5); //} _intervaloTiempo = _intervalosTiempo [0]; //INICIAMOS EL INTERVALO PARA LA CAIDA DE LA PIEZA A UN SEGUNDO _tablero = new int[FILAS, COL]; _r = new Random(); _posicion = new Posicion(); _posicion.X = 4; _posicion.Y = 0; _temporizador = new Timer(); _color = new Color[] { Color.Red, Color.Green, Color.Blue, Color.DarkSalmon, Color.Violet, Color.DarkOrange, Color.DeepPink }; _claros = new Color[] { Color.Pink, Color.LightGreen, Color.Cyan, Color.Yellow, Color.Magenta, Color.Orange, Color.Fuchsia }; _figuras = new List <int[, ]>(); //AGREGO TODAS LAS FIGURAS A LA LISTA _figuras.Add(new int[, ] { { 1, 0, 0 }, { 1, 0, 0 }, { 1, 1, 0 } }); _figuras.Add(new int[, ] { { 0, 1, 0 }, { 0, 1, 0 }, { 1, 1, 0 } }); _figuras.Add(new int[, ] { { 0, 0, 0 }, { 0, 1, 0 }, { 1, 1, 1 } }); _figuras.Add(new int[, ] { { 0, 0, 0 }, { 0, 1, 1 }, { 1, 1, 0 } }); _figuras.Add(new int[, ] { { 0, 0, 0 }, { 1, 1, 0 }, { 0, 1, 1 } }); _figuras.Add(new int[, ] { { 1, 1 }, { 1, 1 }, }); _figuras.Add(new int[, ] { { 1, 0, 0, 0 }, { 1, 0, 0, 0 }, { 1, 0, 0, 0 }, { 1, 0, 0, 0 } }); //INDICO EL METODO ASOCIADO AL EVENTO TICK DEL TEMPORIZADOR _temporizador.Tick += new EventHandler(Temporizador_Tick); _temporizador.Interval = _intervaloTiempo; //PARA QUE NO SE NOTEN LOS BARRIDOS CUANDO SE LIMPIA LA PANTALLA SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); }