Ejemplo n.º 1
0
        public void saveNote()
        {
            if (currentNote == null)
            {
                currentNote             = new BacktoryObject("Note");
                currentNote["title"]    = noteTitleInput.text;
                currentNote["priority"] = int.Parse(notePriorityInput.text);
                currentNote["pinned"]   = notePinnedToggle.isOn;

                currentNote.SaveInBackground(response => {
                    if (response.Successful)
                    {
                        ResultText.text = "New note created successfully!\n" + currentNote.ToString();
                    }
                    else
                    {
                        ResultText.text = "failed; " + response.Message;
                    }
                });
            }
            else
            {
                if (noteTitleInput.text != "")
                {
                    currentNote["title"] = noteTitleInput.text;
                }
                if (notePriorityInput.text != "")
                {
                    currentNote["priority"] = int.Parse(notePriorityInput.text);
                }
                currentNote["pinned"] = notePinnedToggle.isOn;

                currentNote.SaveInBackground(response => {
                    if (response.Successful)
                    {
                        ResultText.text = "The note updated successfully!\n" + currentNote.ToString();
                    }
                    else
                    {
                        ResultText.text = "failed; " + response.Message;
                    }
                });
            }
        }
Ejemplo n.º 2
0
 public void deleteNote()
 {
     if (currentNote == null)
     {
         ResultText.text = "No note (BacktoryObject) is available!";
         return;
     }
     currentNote.DeleteInBackground(response => {
         if (response.Successful)
         {
             ResultText.text = "The note deleted successfully.";
             currentNote     = null;
         }
         else
         {
             ResultText.text = "failed; " + response.Message;
         }
     });
 }
Ejemplo n.º 3
0
    // Function for save age and gender
    public void saveAgegen()
    {
        BacktoryObject genderage = new BacktoryObject("GenderAge");

        genderage["gender"] = sexDropDown.value;
        genderage["age"]    = ageDropDown.value;
        genderage["userID"] = BacktoryUser.CurrentUser.UserId;


        genderage.SaveInBackground(response =>
        {
            if (response.Successful)
            {
                PlayerPrefs.SetInt(alreadyRegistered, 1);
                // successful save. good place for Debug.Log function.
            }
            else
            {
                // see response.Message to know the cause of error
            }
        });
    }