Esempio n. 1
0
    public void OnChecked()
    {
        string result = ClckButton.txtTempt.GetComponent <Text>().text;                           // get value txtTemp in ClckButton and

        //start to check in lsttmpPlay
        Debug.Log(VSReadyStart.lsttmpPlay[2]);
        //ClckButton.lstCheck.Clear();
        for (int k = 0; k < VSReadyStart.lsttmpPlay.Count; k++)
        {
            if (result == VSReadyStart.lsttmpPlay[k])
            {
                for (int b = 0; b < result.Length; b++)
                {
                    GameObject btnClear = GameObject.Find(result[b].ToString());
                    btnClear.SetActive(false);
                }
                score += 1;                                                                   // add score
                txtScoreB.GetComponent <Text>().text = score.ToString();                      // assigned score --> textScore
                VSReadyStart.qty -= 1;                                                        // decrease qty --1
                VSReadyStart.txtQty.GetComponent <Text>().text = VSReadyStart.qty.ToString(); // assigned qty --> textQty
                ClckButton.txtTempt.GetComponent <Text>().text = "";
                // reset txtTempt
            }
            else
            {
                ClckButton.txtTempt.GetComponent <Text>().text = "";                             // reset txtTempt
            }
        }
        if (VSReadyStart.qty == 0)
        {
            BattleScript elopoint = new BattleScript();

            WWWForm form = new WWWForm();
            Time.timeScale = 0;                                                                 //set out game when qty word end.
            form.AddField("IdUser", CheckUserScript.userID);
            form.AddField("Win", 1);
            form.AddField("Lost", 0);
            form.AddField("EloPoint", elopoint.Cal_EloPoint_Win(HomeScript.elo).ToString());


            StartCoroutine(callAPiUpdateWinLose(form));
        }
    }