Example #1
0
    // example update command. can either have one of these and have a way to change it for every question. Or have several.
    //This is a general use to change names. It is as simpls as
    //  (the table being changed, the first column, game object in first column to be edited, the column in which you want to edit, the change you want to make, runtime)
    public static void UpdatePlayerName(bool runtime)
    {
        Debug.Log("<color=yellow>Updating cloud data: player names " + playername + ".</color>");

        // Look in the 'PlayerInfo' table, for an object of name 'Mithrandir', and set its completion time to a given amount.
        CloudConnectorCore.UpdateObjects(tableName, "name", playername, "name", "Cameron Root", runtime);
    }
Example #2
0
    //here is an example on how to update with a seperate method for every question
    public static void UpdatePlayerQuestion1(bool runtime)
    {
        Debug.Log("<color=yellow>Updating cloud data: player named " + playername + " finished question 1 in " + completetime + " seconds.</color>");

        // Look in the 'PlayerInfo' table, for an object of name 'Cameron Root, and set its level to 100.
        CloudConnectorCore.UpdateObjects(tableName, "name", playername, "q1", completetime.ToString(), runtime);
    }
Example #3
0
    // Update persisted objects fields on the cloud.
    public static void UpdateGandalf(bool runtime)
    {
        Debug.Log("<color=yellow>Updating cloud data: player called Mithrandir will be level 100.</color>");

        // Look in the 'PlayerInfo' table, for an object of name 'Mithrandir', and set its level to 100.
        CloudConnectorCore.UpdateObjects(tableName, "name", "Mithrandir", "level", "101", runtime);
    }
Example #4
0
    public IEnumerator AddWine(int index)
    {
        // Atualizar spreadsheet:
        WineInfo info = wineInfos.Find(i => i.id == index);

        info.quantity++;
        CloudConnectorCore.UpdateObjects(TABLE_NAME, ID_FIELD_NAME, info.id.ToString(), QUANTITY_FIELD_NAME, info.quantity.ToString());

        // Atualiza server no webhost por php:
        wineQuantitiesFromWebhost[index]++;
        WWW www = new WWW(WEBHOST_URL + "addWine.php?id=" + index.ToString());

        while (!www.isDone)
        {
            yield return(0);
        }

        // Atualizar server no heroku por node.js: @Heitor
        WWW wwnode = new WWW(HEROKU_URL + "addWine?id=" + index.ToString());

        while (!wwnode.isDone)
        {
            yield return(0);
        }
    }
Example #5
0
    /// <summary>
    /// Compares the answer <see cref="Matrix2x2"/> provided by the Player with the <see cref="solutionMatrix"/>.
    /// <para>
    ///     The <see cref="ResultText"/> will display whether or not the Player got the right answer.
    ///     This information will be recorded in the Google Sheets for Unity system (GSFU) via <see cref="CloudConnectorCore"/>.
    /// </para>
    /// <para>
    ///     Additional information can be sent to the <see cref="MatrixLogger"/> as well.
    /// </para>
    /// </summary>
    /// <param name="answerMatrix">The final answer the User submitted.</param>
    public void CheckAnswer(Matrix2x2 answerMatrix)
    {
        bool isCorrect = Matrix2x2.IsEqual(solutionMatrix, answerMatrix);

        if (isCorrect)
        {
            ResultText.text = "Correct!";
            MatrixLogger.Add("Correct! The answer was:\n" + solutionMatrix.ToString());
            SubmissionResultPanel.SetActive(true);

            answertime = Time.timeSinceLevelLoad;
            CloudConnectorCore.UpdateObjects("playerInfo", "name", Playername, q, answertime.ToString(), true);
            StopCoroutine("RemoveResultPanelAfterSomeSeconds");
            StartCoroutine("RemoveResultPanelAfterSomeSeconds");
        }
        else
        {
            MatrixLogger.Add("Incorrect! Your answer was:\n" + answerMatrix.ToString());

            ResultText.text = "Incorrect...";
            SubmissionResultPanel.SetActive(true);

            StopCoroutine("RemoveResultPanelAfterSomeSeconds");
            StartCoroutine("RemoveResultPanelAfterSomeSeconds");
        }
    }
 public static void updatePlayer(string field, string search, string field_to_change, string val)
 {
     CloudConnectorCore.UpdateObjects(PLAYER, field, search, field_to_change, val, true);
 }