예제 #1
0
    public void selectanimal()
    {
        popup.SetActive(false);
        // animalselection.text = "You chose"+animaltype+"";
        // print("You chose"+animaltype+"");
        // print(animalselection.text);


        if (selected.animalType == "Cat")
        {                                 // if the animal that was selected's type is cat
            chosenpet.animalType = "Cat"; //set the chosen pet object to that
            chosenpet.health     = 100;
            selectedAnimalType   = "Cat";
            chosenpet.animalName = "Cat";
            output.text          = "You chose: " + chosenpet.animalType;
            string json = JsonUtility.ToJson(chosenpet);
            FireSaver.AddPet(userID, chosenpet.animalName, json);

            //  Debug.Log("animaltype of chosen = " + chosenpet.animalType);
        }
        else
        if (selected.animalType == "blackCat")
        {                                               // if the animal that was selected's type is cat
          //   Debug.Log(selected.animalType);
            chosenpet.animalType = selected.animalType; //set the chosen pet object to that
                                                        //  Debug.Log(chosenpet.animalType);
            chosenpet.health     = 100;
            selectedAnimalType   = "blackCat";
            chosenpet.animalName = selected.animalName;
            output.text          = "You chose: " + chosenpet.animalType;
            string json = JsonUtility.ToJson(chosenpet);
            FireSaver.AddPet(userID, chosenpet.animalName, json);

            //  Debug.Log("animaltype of chosen = " + chosenpet.animalType);
        }
        else
        if (selected.animalType == "shiba")
        {                                               // if the animal that was selected's type is cat
          //   Debug.Log(selected.animalType);
            chosenpet.animalType = selected.animalType; //set the chosen pet object to that
                                                        //  Debug.Log(chosenpet.animalType);
            chosenpet.health     = 100;
            selectedAnimalType   = "shiba";
            chosenpet.animalName = selected.animalName;
            output.text          = "You chose: " + chosenpet.animalType;
            string json = JsonUtility.ToJson(chosenpet);
            FireSaver.AddPet(userID, chosenpet.animalName, json);

            //  Debug.Log("animaltype of chosen = " + chosenpet.animalType);
        }

        // Text txt = transform.Find("Text").GetComponent<Text>();
        // if (selectedtext.enabled) {
        //     print("pressed");
        //     popup.SetActive(false);
        // }
    }
예제 #2
0
    public void createNewUser()
    {
        var    user = new NewUserGenerator(playerName, wish, userEmail);
        string json = JsonUtility.ToJson(user);

        FireSaver.SavePlayer(userID, json);

        SceneManager.LoadScene("first-adoption");
    }
예제 #3
0
    public void completeAdoption()
    {
        List <string> reducedActions   = new List <string>();
        List <string> reducedObstacles = new List <string>();

        for (int i = 0; i < 16; i++)
        {
            if (string.IsNullOrEmpty(actions[i]))
            {
                actions[i] = "Unassigned";
            }
            else
            {
                reducedActions.Add(actions[i]);
            }
        }

        for (int j = 0; j < 8; j++)
        {
            if (string.IsNullOrEmpty(obstacles[j]))
            {
                obstacles[j] = "Unassigned";
            }
            else
            {
                reducedObstacles.Add(obstacles[j]);
            }
        }

        actions   = reducedActions.ToArray();
        obstacles = reducedObstacles.ToArray();

/*        GameObject global = GameObject.Find("Global");
 *      GlobalVars globalVars = global.GetComponent<GlobalVars>();
 *      Debug.Log(globalVars.playerEmail);*/

        // var user = new UserGenerator(petType, wish, petName, actions, obstacles);
        var user = new UserGenerator(actions, obstacles);
        // Debug.Log(user.actions);
        string json = JsonUtility.ToJson(user);

        // FireSaver.SavePlayer(playerName, json);
        FireSaver.AdoptPet(userID, user.getDictionary());
        // Debug.Log(email);
    }
예제 #4
0
 public void currencyPosting()
 {
     FireSaver.getCurrency(userID);
 }