コード例 #1
0
        }      //YA

        public void leerArchivoEstampasD()
        {
            string   Path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/EstampasDisponibles.csv";
            Estampas aux;

            using (StreamReader sr = System.IO.File.OpenText(Path))
            {
                string s;
                while ((s = sr.ReadLine()) != null)
                {
                    if (s != "")
                    {
                        aux          = new Estampas();
                        aux.ID       = Convert.ToInt32(s.Split('|')[0]);
                        aux.NombreJ  = s.Split('|')[1];
                        aux.Equipo   = s.Split('|')[2];
                        aux.Cantidad = Convert.ToInt16(s.Split('|')[3]);
                        Guardado Gaux = new Guardado();
                        if (DiccionarioMisEstampas.ContainsKey(aux.Equipo) == true)
                        {
                            DiccionarioMisEstampas[aux.Equipo].ListaEstampas.Add(aux);
                        }
                        else
                        {
                            Gaux.ListaEstampas.Add(aux);
                            DiccionarioMisEstampas.Add(aux.Equipo, Gaux);
                        }
                    }
                }
            }
        }      //YA
コード例 #2
0
ファイル: Cargar_Barras.cs プロジェクト: Michaelllll/Li
 void Update()
 {
     if (CargarBool == true)
     {
         Guardado.Cargar();
         CargarBool = false;
     }
 }
コード例 #3
0
    void Start()
    {
        Guardado.cargar(); //Cargo los datos de la partida anterior


        time         = TIEMPO;//Se asigna al tiempo, un tiempo por defecto
        cuenta_atras = false;
    }
コード例 #4
0
ファイル: CargarPartida.cs プロジェクト: hafewa/City-Builder
        public void CargarPartidaSeleccionada(Guardado partida)
        {
            sonido.RatonClick();
            escenario.PonerTerreno(partida);
            juego.CargarEdificios(partida);
            juego.CargarInterfaz();
            ayuda.Cargar(partida.ayuda);

            Objetos.Ocultar(canvas.gameObject);
            Objetos.Mostrar(juego.canvas.gameObject);
        }
コード例 #5
0
        public void CargarPartidaSeleccionada(Guardado partida)
        {
            escenario.PonerTerreno(partida);
            juego.CargarEdificios(partida);
            juego.CargarInterfaz();

            canvas.gameObject.GetComponent <CanvasGroup>().alpha          = 0;
            canvas.gameObject.GetComponent <CanvasGroup>().interactable   = false;
            canvas.gameObject.GetComponent <CanvasGroup>().blocksRaycasts = false;

            juego.canvas.gameObject.GetComponent <CanvasGroup>().alpha          = 1;
            juego.canvas.gameObject.GetComponent <CanvasGroup>().interactable   = true;
            juego.canvas.gameObject.GetComponent <CanvasGroup>().blocksRaycasts = true;
        }
コード例 #6
0
    public Guardado CargarPartida(string nombre)
    {
        Guardado partida = null;

        if (File.Exists(Application.persistentDataPath + "/" + nombre + ".save"))
        {
            BinaryFormatter bf      = new BinaryFormatter();
            FileStream      fichero = File.Open(Application.persistentDataPath + "/" + nombre + ".save", FileMode.Open);
            partida = (Guardado)bf.Deserialize(fichero);
            fichero.Close();
        }

        return(partida);
    }
コード例 #7
0
    void Update()
    {
        if (Input.GetKey(KeyCode.Escape))  //Se se presiona el boton esc, o en caso de movil el boton de atras, se sale de la aplicacion

        {
            Guardado.guardado(); //Guarda los datos obtenidos para utiliarlos con anterioridad
            Application.Quit();
        }


        if (numeroClicks % 5 == 4) //Controla que se pueda entrar al bucle para cambiar las frases de apoyo
        {
            semaforo_apoyo = true;
        }


        if (semaforo_apoyo == true && numeroClicks % 5 == 0 && numeroClicks != 0)    //Cambia aleatoriamente las frases de aopoyo al jugador

        {
            NumerodeclicksTexto.fontSize = 40;
            apoyo_t.text = apoyo[UnityEngine.Random.Range(0, apoyo.Length)];

            semaforo_apoyo = false;
        }
        else
        {
            NumerodeclicksTexto.fontSize = 30;
        }


        if (time > 0 && cuenta_atras == true)//Determina cuando el contador de tiempo debe avanzar y cuando no.
        {
            time -= Time.deltaTime;

            tiempo.text = "Tiempo: " + time.ToString("f0");
            NumerodeclicksTexto.text = Convert.ToString(numeroClicks);
        }

        else if (time < 0 && cuenta_atras == true)  //En caso de que la partida haya terminado, se cambia de ventana, y la cuantaatras se convierte en falsa. Se compureban las HS

        {
            ventanaFinal();
            cuenta_atras = false;
            Guardado.comprobacionHS();
            Guardado.comprobacionLogros();
        }

        puntuacionfinal.text = Convert.ToString(numeroClicks);//Pinto el numero de puntuacion en la pantalla
    }
コード例 #8
0
ファイル: Juego.cs プロジェクト: pepeizq/pepeizqs-cities
    public void CargarEdificios(Guardado partida)
    {
        if (partida != null)
        {
            velocidad.contadorDias = partida.dia;
            velocidad.arranqueDia  = partida.hora;
            velocidad.ActualizarLuces();

            int i = 0;
            while (i < partida.edificiosID.Count)
            {
                Construccion edificioGuardado = edificios[partida.edificiosID[i]];

                if (edificioGuardado != null)
                {
                    edificioGuardado.rotacionColocacion = partida.edificiosRotacion[i];

                    Vector3 posicion = new Vector3(partida.edificiosX[i], 0.5f, partida.edificiosZ[i]);
                    posicion = Posicion.EdificioAjusteCarga(edificioGuardado, posicion);
                    construir.AñadirConstruccion(edificioGuardado, posicion, velocidad.encender);
                }

                i++;
            }

            //camara.transform.position = new Vector3(guardado.camaraPosicionX, guardado.camaraPosicionY, guardado.camaraPosicionZ);
            //camara.transform.Rotate(new Vector3(guardado.camaraRotacionX, guardado.camaraRotacionY, guardado.camaraRotacionZ));

            ciudad.Dinero    = partida.dinero;
            ciudad.ModoFacil = partida.modoFacil;

            ciudad.Banco         = partida.banco;
            ciudad.BancoCredito1 = partida.bancoCredito1;
            ciudad.BancoCredito2 = partida.bancoCredito2;
            ciudad.BancoCredito3 = partida.bancoCredito3;
            ciudad.BancoContadorTiempoCredito1 = partida.bancoContadorTiempoCredito1;
            ciudad.BancoContadorTiempoCredito2 = partida.bancoContadorTiempoCredito2;
            ciudad.BancoContadorTiempoCredito3 = partida.bancoContadorTiempoCredito3;

            ciudad.PoblacionActual = partida.poblacionActual;
            ciudad.PoblacionTope   = partida.poblacionTope;
            ciudad.TrabajosActual  = partida.trabajosActual;
            ciudad.TrabajosTope    = partida.trabajosTope;
            ciudad.Comida          = partida.comida;
        }
    }
コード例 #9
0
    public bool ComprobarPartida(string nombre)
    {
        bool existe = false;

        if (File.Exists(Application.persistentDataPath + "/" + nombre + ".save"))
        {
            BinaryFormatter bf       = new BinaryFormatter();
            FileStream      fichero  = File.Open(Application.persistentDataPath + "/" + nombre + ".save", FileMode.Open);
            Guardado        guardado = (Guardado)bf.Deserialize(fichero);
            fichero.Close();

            if (guardado != null)
            {
                existe = true;
            }
        }

        return(existe);
    }
コード例 #10
0
 //Creates a new instance of Class Guardado in order to save all its atributes into a binary file using serialization
 private void Button_Save_Click(object sender, RoutedEventArgs e)
 {
     timer.Stop();
     simSpeed.IsEnabled = false;
     try
     {
         Guardado       Guardar = new Guardado(cellGrid, variables, Mirror, Tiempo, tempValues, phaseValues);
         SaveFileDialog Dialogo = new SaveFileDialog();
         if (Dialogo.ShowDialog() == true)
         {
             BinaryFormatter Bf     = new BinaryFormatter();
             FileStream      stream = File.OpenWrite(Dialogo.FileName);
             Bf.Serialize(stream, Guardar);
             stream.Close();
         }
     }
     catch
     {
         MessageBox.Show("There was a problem saving");
     }
 }
コード例 #11
0
ファイル: CargarPartida.cs プロジェクト: hafewa/City-Builder
 public void BorrarPartidaSeleccionada(Guardado partida)
 {
     sonido.RatonClick();
     partidas.BorrarPartida(partida.id);
     CargarListado();
 }
コード例 #12
0
    public void GuardarPartida()
    {
        List <Guardado> partidasGuardadas = partidas.ListadoPartidas();
        int             id = 0;

        if (partidasGuardadas.Count > 0)
        {
            partidasGuardadas.Sort((x, y) => y.id.CompareTo(x.id));

            id = partidasGuardadas[0].id + 1;
        }
        else
        {
            id = 1;
        }

        Guardado guardado = new Guardado
        {
            nombre       = id.ToString(),
            id           = id,
            fecha        = DateTime.Now.ToString(),
            versionJuego = Application.version
        };

        Terreno[,] terrenosGuardar = escenario.DevolverTerrenos();

        for (int x = 0; x < terrenosGuardar.GetLength(0); x++)
        {
            for (int z = 0; z < terrenosGuardar.GetLength(1); z++)
            {
                if (terrenosGuardar[x, z] != null)
                {
                    guardado.terrenosID.Add(terrenosGuardar[x, z].id);
                    guardado.terrenosX.Add(x);
                    guardado.terrenosZ.Add(z);
                }
            }
        }

        Construccion[,] edificiosGuardar = construir.DevolverConstrucciones();

        for (int x = 0; x < edificiosGuardar.GetLength(0); x++)
        {
            for (int z = 0; z < edificiosGuardar.GetLength(1); z++)
            {
                if (edificiosGuardar[x, z] != null)
                {
                    if (edificiosGuardar[x, z].id != 99)
                    {
                        guardado.edificiosID.Add(edificiosGuardar[x, z].id);
                        guardado.edificiosRotacion.Add(edificiosGuardar[x, z].rotacionColocacion);
                        guardado.edificiosX.Add(Funciones.RotacionGuardadoX(x, edificiosGuardar[x, z]));
                        guardado.edificiosZ.Add(Funciones.RotacionGuardadoZ(z, edificiosGuardar[x, z]));
                    }
                }
            }
        }

        guardado.camaraPosicionX = camara.transform.position.x;
        guardado.camaraPosicionY = camara.transform.position.y;
        guardado.camaraPosicionZ = camara.transform.position.z;

        guardado.camaraRotacionX = camara.transform.rotation.x;
        guardado.camaraRotacionY = camara.transform.rotation.y;
        guardado.camaraRotacionZ = camara.transform.rotation.z;

        guardado.dia  = (int)velocidad.contadorDias;
        guardado.hora = velocidad.arranqueDia;

        guardado.dinero          = ciudad.Dinero;
        guardado.modoFacil       = ciudad.ModoFacil;
        guardado.poblacionActual = ciudad.PoblacionActual;
        guardado.poblacionTope   = ciudad.PoblacionTope;
        guardado.trabajosActual  = ciudad.TrabajosActual;
        guardado.trabajosTope    = ciudad.TrabajosTope;
        guardado.comida          = ciudad.Comida;

        BinaryFormatter bf      = new BinaryFormatter();
        FileStream      fichero = File.Create(Application.persistentDataPath + "/" + guardado.id + ".save");

        bf.Serialize(fichero, guardado);
        fichero.Close();
    }
コード例 #13
0
 public void Probar_boton()
 {
     Guardado.Grabar();
     Application.LoadLevel("Menu");
 }
コード例 #14
0
    public void PonerTerreno(Guardado partida)
    {
        for (int x = 0; x < terrenos2.GetLength(0); x++)
        {
            for (int z = 0; z < terrenos2.GetLength(1); z++)
            {
                if (terrenos2[x, z] != null)
                {
                    Object.DestroyImmediate(terrenos2[x, z].gameObject, true);
                    terrenos2[x, z] = null;
                }
            }
        }

        if (partida != null)
        {
            if (partida.terrenosID.Count > 0)
            {
                int i = 0;
                while (i < partida.terrenosID.Count)
                {
                    Terreno terreno  = terrenos[partida.terrenosID[i]];
                    Vector3 posicion = new Vector3(partida.terrenosX[i], -0.5f, partida.terrenosZ[i]);
                    GenerarTerreno(terreno, posicion);

                    i += 1;
                }
            }
        }
        else
        {
            if (rio != null)
            {
                int origen      = Random.Range(40, 60);
                int primerTramo = Random.Range(20, 30);

                int i = 0;
                while (i < primerTramo)
                {
                    GenerarTerreno(rio, new Vector3(origen, -0.5f, i));
                    GenerarTerreno(rio, new Vector3(origen + 1, -0.5f, i));

                    i += 1;
                }

                int positivoNegativo = Random.Range(0, 2);
                int segundoTramo     = 0;

                if (positivoNegativo == 0)
                {
                    segundoTramo = Random.Range(-10, -20);
                    i            = 0;
                    while (i > segundoTramo)
                    {
                        GenerarTerreno(rio, new Vector3(origen + i, -0.5f, primerTramo));
                        GenerarTerreno(rio, new Vector3(origen + i, -0.5f, primerTramo - 1));

                        i -= 1;
                    }
                }
                else
                {
                    segundoTramo = Random.Range(10, 20);
                    i            = 0;
                    while (i < segundoTramo)
                    {
                        GenerarTerreno(rio, new Vector3(origen + i + 1, -0.5f, primerTramo));
                        GenerarTerreno(rio, new Vector3(origen + i + 1, -0.5f, primerTramo - 1));

                        i += 1;
                    }
                }

                int tercerTramo = Random.Range(30, 40);

                i = 0;
                while (i < tercerTramo)
                {
                    GenerarTerreno(rio, new Vector3(origen + segundoTramo, -0.5f, primerTramo + i));
                    GenerarTerreno(rio, new Vector3(origen + segundoTramo + 1, -0.5f, primerTramo + i));

                    i += 1;
                }

                positivoNegativo = Random.Range(0, 2);
                int cuartoTramo = 0;

                if (positivoNegativo == 0)
                {
                    cuartoTramo = Random.Range(-10, -20);
                    i           = 0;
                    while (i > cuartoTramo)
                    {
                        GenerarTerreno(rio, new Vector3(origen + segundoTramo + i, -0.5f, primerTramo + tercerTramo));
                        GenerarTerreno(rio, new Vector3(origen + segundoTramo + i, -0.5f, primerTramo + tercerTramo - 1));

                        i -= 1;
                    }
                }
                else
                {
                    cuartoTramo = Random.Range(10, 20);
                    i           = 0;
                    while (i < cuartoTramo)
                    {
                        if (i > 0)
                        {
                            GenerarTerreno(rio, new Vector3(origen + segundoTramo + i, -0.5f, primerTramo + tercerTramo));
                        }

                        GenerarTerreno(rio, new Vector3(origen + segundoTramo + i + 1, -0.5f, primerTramo + tercerTramo - 1));

                        i += 1;
                    }
                }

                i = 0;
                while ((primerTramo + tercerTramo + i) < 100)
                {
                    GenerarTerreno(rio, new Vector3(origen + segundoTramo + cuartoTramo, -0.5f, primerTramo + tercerTramo + i));
                    GenerarTerreno(rio, new Vector3(origen + segundoTramo + cuartoTramo + 1, -0.5f, primerTramo + tercerTramo + i));

                    i += 1;
                }
            }

            if (tierra != null)
            {
                int i = 0;
                while (i < 100)
                {
                    int j = 0;
                    while (j < 100)
                    {
                        Vector3 posicion = new Vector3(i, -0.5f, j);
                        GenerarTerreno(tierra, posicion);

                        j += 1;
                    }
                    i += 1;
                }
            }
        }
    }
コード例 #15
0
    public void PonerArboles(Guardado partida, Construir construir)
    {
        if (partida != null)
        {
            if (partida.edificiosID.Count > 0)
            {
                int i = 0;
                while (i < partida.edificiosID.Count)
                {
                    Vector3 posicion = new Vector3(partida.edificiosX[i], 0.5f, partida.edificiosZ[i]);

                    Construccion arbol = null;

                    foreach (Construccion arbol2 in arboles)
                    {
                        if (arbol2.id == partida.edificiosID[i])
                        {
                            arbol = arbol2;
                        }
                    }

                    if (arbol != null)
                    {
                        GenerarArbol(arbol, posicion, construir);
                    }

                    i += 1;
                }
            }
        }
        else
        {
            if (arboles != null)
            {
                if (arboles.Length > 0)
                {
                    int arbolesTramo1 = 250;

                    int i = 0;
                    while (i < arbolesTramo1)
                    {
                        Vector3 posicion = new Vector3(Random.Range(0, 30), 1, Random.Range(0, 99));
                        int     j        = Random.Range(0, arboles.Length);

                        if (arboles[j] != null)
                        {
                            GenerarArbol(arboles[j], posicion, construir);
                        }
                        i++;
                    }

                    int arbolesTramo2 = 30;
                    i = 0;
                    while (i < arbolesTramo2)
                    {
                        Vector3 posicion = new Vector3(Random.Range(31, 69), 1, Random.Range(0, 99));
                        int     j        = Random.Range(0, arboles.Length);

                        if (arboles[j] != null)
                        {
                            GenerarArbol(arboles[j], posicion, construir);
                        }
                        i++;
                    }

                    int arbolesTramo3 = 250;
                    i = 0;
                    while (i < arbolesTramo3)
                    {
                        Vector3 posicion = new Vector3(Random.Range(70, 99), 1, Random.Range(0, 99));
                        int     j        = Random.Range(0, arboles.Length);

                        if (arboles[j] != null)
                        {
                            GenerarArbol(arboles[j], posicion, construir);
                        }
                        i++;
                    }
                }
            }
        }
    }
コード例 #16
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))          //En el caso de salirnos guardamos los estados de las barras
        {
            Guardado.Grabar();
            Application.LoadLevel("Menu");
        }

        if (cont_comida <= 0)
        {
            if (ControlTarget.nChuletas > 0)
            {
                cont_comida = 5;
                if (cont == 1)
                {
                    ControlTarget.nChuletas--;
                }
                else
                {
                    cont++;
                }
            }

            t_comida = false;
            target_comida.gameObject.SetActive(false);
            target_comida.localScale = new Vector3(0.05f, 0.05f, 0.05f);
        }
        if (cont_bebida <= 0)
        {
            cont_bebida = 5;
            t_bebida    = false;
            target_bebida.gameObject.SetActive(false);
            target_bebida.localScale = new Vector3(0.078f, 0.02001f, 0.078f);
        }

        if (!t_comida && !t_bebida && com_beb)
        {
            ani.Play("Li_Run");
            com_beb = false;
        }
        if (!t_comida && !t_bebida && !ControlTarget.presencia_numeros)
        {
            Libre();
        }
        else if (t_comida && ControlTarget.nChuletas > 0)
        {
            if (!target_comida.gameObject.activeSelf)
            {
                target_comida.gameObject.SetActive(true);
            }
            Comer();
        }
        else if (t_bebida)
        {
            if (!target_bebida.gameObject.activeSelf)
            {
                target_bebida.gameObject.SetActive(true);
            }
            Beber();
        }
    }
コード例 #17
0
 public void BorrarPartidaSeleccionada(Guardado partida)
 {
     partidas.BorrarPartida(partida.id);
     CargarListado();
 }
コード例 #18
0
        //Loads the file and initializes all settings with the information of the file
        private void Button_Load_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog Dialogo2 = new OpenFileDialog();
                if (Dialogo2.ShowDialog() == true)
                {
                    BinaryFormatter Bf  = new BinaryFormatter();
                    FileStream      r   = File.OpenRead(Dialogo2.FileName);
                    Guardado        bac = (Guardado)Bf.Deserialize(r);
                    r.Close();
                    Mirror    = bac.getMirror();
                    variables = bac.getVariables();
                    cellGrid  = bac.getGrid();
                    Tiempo    = bac.getTiempo();

                    //Plots
                    tempValues  = bac.getTemp();
                    phaseValues = bac.getPhase();
                    Charts.CreateGraph(tempgraph, tempValues, "Temperature");
                    Charts.CreateGraph(phasegraph, phaseValues, "Phase");

                    ColumnSlider.Value = cellGrid.getceldas()[0].Length - 2;
                    RowsSlider.Value   = cellGrid.getceldas().Length - 2;

                    //Restarting Grid
                    grid.Children.Clear();
                    grid.ColumnDefinitions.Clear();
                    grid.RowDefinitions.Clear();
                    grid2.Children.Clear();
                    grid2.ColumnDefinitions.Clear();
                    grid2.RowDefinitions.Clear();



                    //Adding Columns
                    for (int j = 0; j < ColumnSlider.Value; j++)
                    {
                        grid.ColumnDefinitions.Add(new ColumnDefinition());
                        grid2.ColumnDefinitions.Add(new ColumnDefinition());
                    }
                    //We convert the stack to list in order to serach for the first cells
                    Celda[][][] temp = cellGrid.getMemory().ToArray();

                    //Adding Rows
                    Rectangle[][] rectanglesTemp  = new Rectangle[cellGrid.getceldas().Length][];
                    Rectangle[][] rectanglesPhase = new Rectangle[cellGrid.getceldas().Length][];
                    for (int i = 1; i < RowsSlider.Value + 1; i++)
                    {
                        Rectangle[] CellRowTemp  = new Rectangle[cellGrid.getceldas()[0].Length];
                        Rectangle[] CellRowPhase = new Rectangle[cellGrid.getceldas()[0].Length];
                        grid.RowDefinitions.Add(new RowDefinition());
                        grid2.RowDefinitions.Add(new RowDefinition());

                        //This for loop prints the grid
                        for (int j = 1; j < ColumnSlider.Value + 1; j++)
                        {
                            Rectangle       rectangle  = new Rectangle();
                            Rectangle       rectangle2 = new Rectangle();
                            SolidColorBrush BlackBrush = new SolidColorBrush();
                            BlackBrush.Color  = Colors.Black;
                            rectangle.Stroke  = BlackBrush;
                            rectangle2.Stroke = BlackBrush;

                            if (temp[temp.Length - 1][i][j].getPhase() == 0)
                            {
                                rectangle.StrokeThickness  = 3;
                                rectangle2.StrokeThickness = 3;
                            }
                            else
                            {
                                rectangle.StrokeThickness  = 1;
                                rectangle2.StrokeThickness = 1;
                            }

                            rectangle.Fill  = new SolidColorBrush(Colors.White);
                            rectangle2.Fill = new SolidColorBrush(Colors.White);
                            //Here we add the rectangles inside the grid
                            Grid.SetRow(rectangle, i - 1);
                            Grid.SetColumn(rectangle, j - 1);
                            grid.Children.Add(rectangle);
                            Grid.SetRow(rectangle2, i - 1);
                            Grid.SetColumn(rectangle2, j - 1);
                            grid2.Children.Add(rectangle2);
                            CellRowTemp[j]  = rectangle;
                            CellRowPhase[j] = rectangle2;
                        }
                        rectanglesTemp[i]  = CellRowTemp;
                        rectanglesPhase[i] = CellRowPhase;
                    }
                    cellGrid.loadFixRectangles(rectanglesTemp, rectanglesPhase);
                    cellGrid.Represent();

                    //Style
                    SetGrid.IsEnabled              = false;
                    DiscardGrid.IsEnabled          = false;
                    ColumnSlider.IsEnabled         = false;
                    RowsSlider.IsEnabled           = false;
                    button_Demonstration.IsEnabled = false;

                    button_Play.IsEnabled     = true;
                    button_Pause.IsEnabled    = true;
                    button_Atrás.IsEnabled    = true;
                    button_Adelante.IsEnabled = true;
                    button_Stop.IsEnabled     = true;

                    Combobox_Condition.IsEnabled = false;
                    Combobox_Variables.IsEnabled = false;
                    Custom_Variables.IsEnabled   = false;

                    button_Save.Visibility = Visibility.Visible;
                    button_Load.Visibility = Visibility.Hidden;

                    Confirm_Button.Content = "Reset Configuration";
                    HelpLabel.Content      = "";

                    //Style
                    Confirm_Button.Background = new SolidColorBrush(Color.FromArgb(255, 255, 110, 110));

                    //ZedGRaph
                    tempgraph.AxisChange();
                    phasegraph.AxisChange();
                    tempgraph.Invalidate();
                    phasegraph.Invalidate();

                    //Simulation started
                    Started = true;
                }
            }
            catch
            {
                MessageBox.Show("There was a problem loading");
            }
        }