예제 #1
0
    // Use this for initialization
    void Start()
    {
        var coins   = FindData("student", "Score", "StuID", SubmitName.getStuID());
        int intCoin = Convert.ToInt32(coins);

        HscoreTextProfile.text = ((int)intCoin).ToString();
    }
예제 #2
0
    public void OnClick()
    {
        var coins   = FindData("student", "Coin", "StuID", SubmitName.getStuID());
        int intCoin = Convert.ToInt32(coins);

        if (intCoin > 20)
        {
            print(intCoin);
            DeductData("student", "StuID", SubmitName.getStuID(), "Coin", 20);
            butt.transform.localScale += new Vector3(0.2f, 0.2f, 0.2f);
        }
    }
예제 #3
0
    //format add user query and select using teacherID stored on login and auto increment of stuID
    public void ActivateAdd()
    {
        //check to see if neccesary variables were received
        if (first)
        {
            //check if username is already taken again
            if (!(CheckUsername.IsTaken(four)))
            {
                //direct db connection to where the db is stored in app
                //and open connection
                const string  connectionString = "URI=file:Assets\\Plugins\\MumboJumbos.db";
                IDbConnection dbcon            = new SqliteConnection(connectionString);
                dbcon.Open();

                //create query for adding user
                IDbCommand dbcmd   = dbcon.CreateCommand();
                String     command =
                    "INSERT INTO wordlist " +
                    "(SetID, Word, Difficulty, TeacherID, Grade) " +
                    "VALUES (@two, @three, @four, @five, @six)";

                //dbcmd.Parameters.Add(new SqliteParameter("@one", one));
                dbcmd.Parameters.Add(new SqliteParameter("@two", three));
                dbcmd.Parameters.Add(new SqliteParameter("@three", four));
                dbcmd.Parameters.Add(new SqliteParameter("@four", five));
                dbcmd.Parameters.Add(new SqliteParameter("@five", SubmitName.getTeachID()));
                dbcmd.Parameters.Add(new SqliteParameter("@six", six));

                string sql = command;
                dbcmd.CommandText = sql;
                IDataReader reader = dbcmd.ExecuteReader();
                addedText.text    = "Word Added!";
                addedText.enabled = true;
                SetID.text        = null;
                Word.text         = null;
                Difficulty.text   = null;
                Grade.text        = null;
            }
            else
            {
                SceneManager.LoadScene("AddWord");
                Reset();
            }
        }
        else
        {
            SceneManager.LoadScene("AddWord");
            Reset();
        }
    }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        var hscore  = FindData("student", "Score", "StuID", SubmitName.getStuID());
        int hscores = Convert.ToInt32(hscore);

        if (hscores >= 10 && hscores < 20)
        {
            bronze.SetActive(true);
        }
        else
        {
            bronze.SetActive(false);
        }
    }
예제 #5
0
    public void OnDeath()
    {
        //direct db connection to where the db is stored in app
        //and open connection
        const string  connectionString = "URI=file:Assets\\Plugins\\MumboJumbos.db";
        IDbConnection dbcon            = new SqliteConnection(connectionString);

        dbcon.Open();
        IDbCommand dbcmd = dbcon.CreateCommand();

        //create query for adding score
        String command =
            "INSERT INTO score " +
            "(userID, totalScore, balance, grade) " +
            "VALUES (@two, @three, @four, @five)";

        //dbcmd.Parameters.Add(new SqliteParameter("@one", one));
        dbcmd.Parameters.Add(new SqliteParameter("@two", id));
        dbcmd.Parameters.Add(new SqliteParameter("@three", Int32.Parse(scoreText.text)));
        dbcmd.Parameters.Add(new SqliteParameter("@four", Int32.Parse(scoreText.text)));
        dbcmd.Parameters.Add(new SqliteParameter("@five", SubmitName.getStuGrade()));

        string sql = command;

        dbcmd.CommandText = sql;
        IDataReader reader = dbcmd.ExecuteReader();

        Debug.Log(sql);
        Debug.Log(SubmitName.getTeachID());
        Debug.Log(scoreText.text);
        Debug.Log(tokenText.text);
        Debug.Log(SubmitName.getStuGrade());

        isDeath = true;
        PlayerPrefs.SetFloat("Highscore", score);
        deathMenu.ToggleEndMenu(score);
        var hscore  = FindData("student", "Score", "StuID", SubmitName.getStuID());
        int hscores = Convert.ToInt32(hscore);

        if (hscores < score)
        {
            UpdateData("student", "StuID", SubmitName.getStuID(), "Score", score);
        }
        Score.score = 0;
    }
예제 #6
0
 public void resetStats()
 {
     DeductData("student", "StuID", SubmitName.getStuID(), "Coin");
     DeductData("student", "StuID", SubmitName.getStuID(), "Score");
     show.SetActive(true);
 }
예제 #7
0
    //when character collides with an object
    private void OnControllerColliderHit(ControllerColliderHit hit)
    {
        if (hit.point.z > transform.position.z + 0.1f && hit.gameObject.tag == "Enemy")
        {
            anim.Play("DAMAGED01", -1, 0f);
            Death();
        }
        //for hitting the collectible
        if (hit.point.z > transform.position.z + 0.1f && hit.gameObject.tag == "collectible")
        {
            Destroy(hit.gameObject);
            ScoreforCoin.CoinScore++;
            if (GameObject.FindGameObjectWithTag("butterfly").transform.localScale == new Vector3(1, 1, 1))
            {
                ScoreforCoin.CoinScore = ScoreforCoin.CoinScore + 2;
            }
            DBSaveLoad.UpdateData("student", "StuID", SubmitName.getStuID(), "Coin", ScoreforCoin.CoinScore);
        }

        if (hit.point.z > transform.position.z + 0.1f && hit.gameObject.tag == "Coin")
        {
            //remove the coin from field of play
            Destroy(hit.gameObject);

            //take the letter associated with the coin
            grabLetter = hit.gameObject.GetComponentInChildren <TextMesh>().text.ToString();


            Debug.Log("LastLetterIssued: " + CoinPick.getCurrentLetter() + " CoinLetter " + grabLetter);

            //determine if that letter was correct
            if (grabLetter.Equals(CoinPick.getCurrentLetter()))
            {
                //update the partial word text
                partialWordText.text = null;
                partialWord          = partialWord + grabLetter;
                partialWordText.text = partialWord;
                CoinPick.currentLetterIndex++;

                //give a score boost
                Score.score = Score.score + 5;

                //check if word was spelled and then reset CoinPick indexes
                //while maintaining the word index
                if (partialWord.Equals(CoinPick.currentWord))
                {
                    int oldWordIndex = CoinPick.wordArrayIndex;
                    CoinPick.wordEndCount = CoinPick.counter;
                    CoinPick.ResetVars();
                    CoinPick.wordArrayIndex = oldWordIndex + 1;
                    partialWord             = null;

                    //this if statement checks to see how fast a player spelled a word
                    //if fast enough we give them a score bonus
                    if ((CoinPick.wordEndCount - CoinPick.wordStartCount) <= (CoinPick.currentWord.Length * 2))
                    {
                        Score.score = Score.score + 10;
                    }
                }
                //increment letter index and return out of method
                return;
            }
            //end the game if the letter was incorrect
            else if (grabLetter.Equals(null))
            {
                return;
            }
            else
            {
                WrongWordText.text = ("Word spelled incorrectly: " + CoinPick.currentWord);
                anim.Play("DAMAGED00", -1, 0f);
                Death();
                return;
            }
        }
    }
예제 #8
0
 //add user name to local variable for later use
 private void SubmitUserName(string input)
 {
     three = input;
     user  = true;
     two   = SubmitName.getTeachID().ToString();
 }
예제 #9
0
    // Use this for initialization
    void Start()
    {
        var coins = FindData("student", "StuUserName", "StuID", SubmitName.getStuID());

        UserTextProfile.text = coins.ToString();
    }