Exemple #1
0
 private void SetaValoresIniciais()
 {
     qtdPontos = 5;
     ponto     = pontos.A;
     A         = new Ponto4D(x: -100, y: -100);
     B         = new Ponto4D(x: -100, y: 100);
     C         = new Ponto4D(x: 100, y: 100);
     D         = new Ponto4D(x: 100, y: -100);
 }
 private void TelaRanking_Load(object sender, EventArgs e)
 {
     pontos[] v = new pontos[10];
     if (File.Exists("pontuacao.txt"))
     {
         string[] linhas = File.ReadAllLines("pontuacao.txt");
         {
             for (int i = 0; i < v.Length; i++)
             {
                 string[] dados = linhas[i].Split('|');
                 v[i].nome      = dados[0];
                 v[i].pontuacao = Convert.ToInt32(dados[1]);
             }
         }
         for (int i = 1; i < v.Length; i++)
         {
             for (int j = 0; j < i; j++)
             {
                 if (v[i].pontuacao > v[j].pontuacao)
                 {
                     int    numero = v[i].pontuacao;
                     string nome   = v[i].nome;
                     v[i].pontuacao = v[j].pontuacao;
                     v[i].nome      = v[j].nome;
                     v[j].pontuacao = numero;
                     v[j].nome      = nome;
                 }
             }
         }
         lbnome1.Text   = v[0].nome;
         lbponto1.Text  = Convert.ToString(v[0].pontuacao);
         lbnome2.Text   = v[1].nome;
         lbponto2.Text  = Convert.ToString(v[1].pontuacao);
         lbnome3.Text   = v[2].nome;
         lbponto3.Text  = Convert.ToString(v[2].pontuacao);
         lbnome4.Text   = v[3].nome;
         lbponto4.Text  = Convert.ToString(v[3].pontuacao);
         lbnome5.Text   = v[4].nome;
         lbponto5.Text  = Convert.ToString(v[4].pontuacao);
         lbnome6.Text   = v[5].nome;
         lbponto6.Text  = Convert.ToString(v[5].pontuacao);
         lbnome7.Text   = v[6].nome;
         lbponto7.Text  = Convert.ToString(v[6].pontuacao);
         lbnome8.Text   = v[7].nome;
         lbponto8.Text  = Convert.ToString(v[7].pontuacao);
         lbnome9.Text   = v[8].nome;
         lbponto9.Text  = Convert.ToString(v[8].pontuacao);
         lbnome10.Text  = v[9].nome;
         lbponto10.Text = Convert.ToString(v[9].pontuacao);
     }
     else
     {
         MessageBox.Show("Ainda não existe nenhum ranking");
     }
 }
Exemple #3
0
 /**
  *  Adiciona pontos
  * */
 public void AddPonto(pontos po)
 {
     try
     {
         using (SeeYouEntities syr = new SeeYouEntities())
         {
             syr.pontos.AddObject(po);
             syr.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }
    // Use this for initialization
    void Start()
    {
        //if(!PlayerPrefs.HasKey("volumeSFX"))          //se o jogo é a primeira vez que está sendo carregado deve-se armazenar 100%
        //	PlayerPrefs.SetFloat("volumeSFX",1f);
        //else{
        //	float volumeSFX = PlayerPrefs.GetFloat("volumeSFX");
        //}

        try{
            for (int i = 0; i < 5; i++)
            {
                audio[i].volume = AjustaVolume.volumeSFX;
            }
            for (int i = 5; i < 8; i++)
            {
                audio[i].volume = AjustaVolume.volumeMusica;
            }
        }
        catch {
            print("nao alterou o volume dos sons corretamente");
        }

        try { posInicial = player.position; }
        catch { print("error nao encontrou player"); }

        try { mostradorVidas = GameObject.FindGameObjectWithTag("Vidas").GetComponent <lifes>() as lifes; }
        catch { print("error nao encontrou vidas"); }

        try { mostradorPontos = GameObject.FindGameObjectWithTag("Pontos").GetComponent <pontos>() as pontos; }
        catch { print("error nao encontrou pontos"); }


        if (Application.loadedLevel != 1 && PlayerPrefs.HasKey("Vidas"))
        {
            qtdVida = PlayerPrefs.GetInt("Vidas");
        }
        try{
            mostradorVidas.setVidas(qtdVida);
        }catch { print("error nao conseguiu setar as vidas"); }

        if (Application.loadedLevel != 1 && PlayerPrefs.HasKey("Pontos"))
        {
            pontos = PlayerPrefs.GetInt("Pontos");
        }
        try{
            mostradorPontos.setPontos(pontos);
        }
        catch { print("error nao consegui setar os pontos"); }
    }
Exemple #5
0
        public void AddPontos(int idPercurso, DateTime data, double velocidade, double distancia, double ritimo, double altitude, double calorias, int duracao, string longitude, string latitude, string isMetrico)
        {
            pontos po = new pontos();

            po.id_percurso = idPercurso;
            po.distancia   = distancia;
            po.velocidade  = velocidade;
            po.duracao     = duracao;
            po.altitude    = altitude;
            po.longitude   = longitude;
            po.latitude    = latitude;
            po.caloria     = calorias;
            po.data_ponto  = data;
            po.isMetrico   = isMetrico;
            persitencia.AddPonto(po);
        }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     instance = this;
 }
Exemple #7
0
 // Use this for initialization
 void Start()
 {
     lavpontos = GameObject.Find("Pontos").GetComponent <pontos> ();
 }
Exemple #8
0
        protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e)
        {
            if (PontoSelecionado == null)
            {
                PontoSelecionado = A;
            }

            if (e.Key == Key.Escape)
            {
                Exit();
            }

            //Reinicia
            if (e.Key == Key.R)
            {
                SetaValoresIniciais();
            }

            //Aumenta a quantidade de ponto da Spline
            if (e.Key == Key.Plus || e.Key == Key.KeypadPlus)
            {
                qtdPontos++;
            }

            //Diminui a quantidade de ponto da Spline
            if (e.Key == Key.Minus || e.Key == Key.KeypadMinus)
            {
                if (qtdPontos > 0)
                {
                    qtdPontos--;
                }
            }

            //Muda pontos
            if (e.Key == Key.Number1 || e.Key == Key.Keypad1)
            {
                PontoSelecionado = A;
                ponto            = pontos.A;
            }

            if (e.Key == Key.Number2 || e.Key == Key.Keypad2)
            {
                PontoSelecionado = B;
                ponto            = pontos.B;
            }

            if (e.Key == Key.Number3 || e.Key == Key.Keypad3)
            {
                PontoSelecionado = C;
                ponto            = pontos.C;
            }

            if (e.Key == Key.Number4 || e.Key == Key.Keypad4)
            {
                PontoSelecionado = D;
                ponto            = pontos.D;
            }

            //Cima
            if (e.Key == Key.C)
            {
                PontoSelecionado.Y++;
            }

            //Baixo
            if (e.Key == Key.B)
            {
                PontoSelecionado.Y--;
            }

            //Direita
            if (e.Key == Key.D)
            {
                PontoSelecionado.X++;
            }

            //Esquerda
            if (e.Key == Key.E)
            {
                PontoSelecionado.X--;
            }
        }
 // Use this for initialization
 void Start()
 {
     cronos      = 60;
     tempolimite = 0;
     point       = GameObject.Find("Pontos").GetComponent <pontos> ();
 }