private void Start()
    {
        myAV = FindObjectOfType <AvatarChoice>();
        int value = myAV.avchoice;

        if (value == 1)
        {
            myA = FindObjectOfType <ScoreA>();
        }
        else if (value == 2)
        {
            myB = FindObjectOfType <ScoreB>();
        }
        else if (value == 3)
        {
            myC = FindObjectOfType <ScoreC>();
        }
        else if (value == 4)
        {
            myD = FindObjectOfType <ScoreD>();
        }
        else if (value == 5)
        {
            myE = FindObjectOfType <ScoreE>();
        }
        else if (value == 6)
        {
            myF = FindObjectOfType <ScoreF>();
        }
        else if (value == 7)
        {
            myG = FindObjectOfType <ScoreG>();
        }
    }
        private void ScoreBTextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            try {
                ScoreATextBox.TextChanging -= ScoreATextBox_TextChanging;

                if (ScoreBTextBox.Text.Length != 0)
                {
                    if (ScoreBTextBox.Text == "-")
                    {
                        ScoreA             = 0;
                        ScoreATextBox.Text = "0";
                        ScoreBTextBox.Text.TrimStart('-');
                        string NegativeScore = ScoreBTextBox.Text;
                        NegativeScore += "0";
                        ScoreB         = Convert.ToInt32(NegativeScore);
                        ScoreB         = int.Parse(NegativeScore);
                        ScoreB         = -1 * ScoreA;
                    }
                    else
                    {
                        ScoreA             = 0;
                        ScoreATextBox.Text = "0";
                        ScoreB             = Convert.ToInt32(ScoreBTextBox.Text);
                        ScoreB             = int.Parse(ScoreBTextBox.Text);
                        if ((ScoreB % 5) == 0 && ScoreB != 0)
                        {
                            if ((ScoreB > 100 && ScoreB <= 200) || (ScoreB >= -200 && ScoreB < -100))
                            {
                                ScoreA             = 200 - ScoreB;
                                ScoreATextBox.Text = ScoreA.ToString();
                            }
                            else if ((ScoreB > 200 && ScoreB <= 300) || (ScoreB >= -300 && ScoreB < -200))
                            {
                                ScoreA             = 300 - ScoreB;
                                ScoreATextBox.Text = ScoreA.ToString();
                            }
                            else if (ScoreB == 400)
                            {
                                ScoreA             = 0;
                                ScoreATextBox.Text = ScoreA.ToString();
                            }
                            else if (((ScoreB > 0) && (ScoreB <= 100)))
                            {
                                ScoreA             = 100 - ScoreB;
                                ScoreBTextBox.Text = ScoreB.ToString();
                            }
                            else if ((ScoreB >= -100) && (ScoreB < 0))
                            {
                                ScoreA             = -1 * ScoreB;
                                ScoreATextBox.Text = ScoreA.ToString();
                            }
                        }
                    }
                }
            }
            catch
            {
                ScoreBTextBox.Text = String.Empty;
            }
        }
        private void EnterScoreButton_Click(object sender, RoutedEventArgs e)
        {
            if (!(String.IsNullOrEmpty(ScoreATextBox.Text) || String.IsNullOrEmpty(ScoreBTextBox.Text)))
            {
                ScoreA = Convert.ToInt32(ScoreATextBox.Text);
                ScoreA = int.Parse(ScoreATextBox.Text);
                ScoreB = Convert.ToInt32(ScoreBTextBox.Text);
                ScoreB = int.Parse(ScoreBTextBox.Text);
                if (((ScoreA + ScoreB) == 0 || (ScoreA + ScoreB) == 100 || (ScoreA + ScoreB) == 200 || (ScoreA + ScoreB) == 300 || (ScoreA + ScoreB) == 400) && (ScoreA % 5 == 0) && (ScoreB % 5 == 0))
                {
                    TextBlock _newScoreA = new TextBlock();
                    _newScoreA.Text                = ScoreA.ToString();
                    _newScoreA.FontSize            = 20;
                    _newScoreA.HorizontalAlignment = HorizontalAlignment.Center;
                    ScoreAStackPanel.Children.Add(_newScoreA);
                    TextBlock _newScoreB = new TextBlock();
                    _newScoreB.Text                = ScoreB.ToString();
                    _newScoreB.FontSize            = 20;
                    _newScoreB.HorizontalAlignment = HorizontalAlignment.Center;
                    ScoreBStackPanel.Children.Add(_newScoreB);

                    TotalScoreA += ScoreA;
                    TotalScoreB += ScoreB;
                    TotalAScoreTextBlock.Text = TotalScoreA.ToString();
                    TotalBScoreTextBlock.Text = TotalScoreB.ToString();
                    ScoreATextBox.Text        = String.Empty;
                    ScoreBTextBox.Text        = String.Empty;

                    Rounds++;
                    TextBlock _rounds = new TextBlock();
                    _rounds.Text = Rounds.ToString();
                    _rounds.HorizontalAlignment = HorizontalAlignment.Center;
                    _rounds.FontSize            = 20;
                    RoundsStackPanel.Children.Add(_rounds);
                }
                else
                {
                    ScoreATextBox.Text = String.Empty;
                    ScoreBTextBox.Text = String.Empty;
                }
            }

            ScoreATextBox.TextChanging += ScoreATextBox_TextChanging;
            ScoreBTextBox.TextChanging += ScoreBTextBox_TextChanging;

            //Sqlite part
            game.A.Score[Rounds] = ScoreA;
            game.B.Score[Rounds] = ScoreB;
            game.rounds          = Rounds;
            game.A.calcTotalScore();
            game.B.calcTotalScore();
            conn.Commit();
        }
Example #4
0
    void Start()
    {
        GameOverPanel.SetActive(false);
        GC = FindObjectOfType <GameController2>();

        myAV = FindObjectOfType <AvatarChoice>();
        int value = myAV.avchoice;

        if (value == 1)
        {
            myA = FindObjectOfType <ScoreA>();
        }
        else if (value == 2)
        {
            myB = FindObjectOfType <ScoreB>();
        }
        else if (value == 3)
        {
            myC = FindObjectOfType <ScoreC>();
        }
    }
Example #5
0
 private void GiveNote()
 {
     CheckNote = true;
     if (current_Button == ButtonType.ButtonR)
     {
         CL.setMusic(CL.clip_Rnote);
         CL.winAnim.gameObject.GetComponent <Animator>().Play("NoteR");
         ScoreR++;
         txtR.text  = ScoreR.ToString();
         note_StayR = false;
         Destroy(note_prefab);
     }
     else if (current_Button == ButtonType.ButtonB)
     {
         CL.setMusic(CL.clip_Bnote);
         CL.winAnim.gameObject.GetComponent <Animator>().Play("NoteB");
         ScoreB++;
         txtB.text  = ScoreB.ToString();
         note_StayB = false;
         Destroy(note_prefab);
     }
     else if (current_Button == ButtonType.ButtonG)
     {
         CL.setMusic(CL.clip_Gnote);
         CL.winAnim.gameObject.GetComponent <Animator>().Play("NoteG");
         ScoreG++;
         txtG.text  = ScoreG.ToString();
         note_StayG = false;
         Destroy(note_prefab);
     }
     else if (current_Button == ButtonType.ButtonP)
     {
         CL.setMusic(CL.clip_Pnote);
         CL.winAnim.gameObject.GetComponent <Animator>().Play("NoteP");
         ScoreP++;
         txtP.text  = ScoreP.ToString();
         note_StayP = false;
         Destroy(note_prefab);
     }
 }
    void Start()
    {
        bonus.SetActive(false);
        bt_home.onClick.AddListener(navigate_toHome);
        highscore2 = PlayerPrefs.GetInt("current_lvl2highscore");
        nodechoice = PlayerPrefs.GetInt("current_selected_note");

        gameoverpanel.SetActive(false);
        myAV = FindObjectOfType <AvatarChoice>();
        int value = myAV.avchoice;

        if (value == 1)
        {
            myA = FindObjectOfType <ScoreA>();
        }
        else if (value == 2)
        {
            myB = FindObjectOfType <ScoreB>();
        }
        else if (value == 3)
        {
            myC = FindObjectOfType <ScoreC>();
        }
        else if (value == 4)
        {
            myD = FindObjectOfType <ScoreD>();
        }
        else if (value == 5)
        {
            myE = FindObjectOfType <ScoreE>();
        }
        else if (value == 6)
        {
            myF = FindObjectOfType <ScoreF>();
        }
        else if (value == 7)
        {
            myG = FindObjectOfType <ScoreG>();
        }


        //screenHalfSizeWorldUnits = new Vector2(Camera.main.aspect * Camera.main.orthographicSize, Camera.main.orthographicSize-1f);
        user_selection.Load_PlayerPrefs();
        if (nodechoice == 1)
        {
            StartCoroutine(SpawnA());
        }
        else if (nodechoice == 2)
        {
            StartCoroutine(SpawnB());
        }
        else if (nodechoice == 3)
        {
            StartCoroutine(SpawnC());
        }
        else if (nodechoice == 4)
        {
            StartCoroutine(SpawnD());
        }
        timerText.text = Mathf.RoundToInt(timeLeft).ToString();
    }