コード例 #1
0
    public void UpdateAndPlantThePlants(int i)
    {
        Dictionary <string, object> lParameters = new Dictionary <string, object>();

        SinglePlantTwo plant = new SinglePlantTwo();

        lParameters.Add("isPlantPlanted", plant.isPlantPlanted = true);
        reference.Child("USERS").Child(LogInAndRegister.Instance.UserName).Child("GAMESPACE").Child("CONTRACT" + ContractID).Child("PLANTS").Child("PLANT" + i).UpdateChildrenAsync(lParameters);
    }
コード例 #2
0
    public void SetEachPlantDataInDbAfterCreatingContract()
    {
        plant                   = new SinglePlantTwo();
        plant.ContractID        = ContractID;
        plant.isPlantInContract = true;
        plant.isPlantPlanted    = false;//true;
        plant.isDroneAssigned   = false;
        plant.FieldID           = id;
        //  PlayerPrefs.SetInt("contract", ContractID);

        string ToJson = JsonUtility.ToJson(plant);

        reference.Child("USERS").Child(LogInAndRegister.Instance.UserName).Child("GAMESPACE").Child("CONTRACT" + plant.ContractID).Child("PLANTS").Child("PLANT" + plant.FieldID).SetRawJsonValueAsync(ToJson);
    }
コード例 #3
0
 public void GetDBDataForPlant()
 {
     FirebaseDatabase.DefaultInstance
     .GetReference("USERS").Child(LogInAndRegister.Instance.UserName).Child("GAMESPACE").Child("CONTRACT" + ContractID).Child("PLANTS").Child("PLANT" + id)
     .GetValueAsync().ContinueWith(task =>
     {
         if (task.IsFaulted)
         {
             // Handle the error...
         }
         else if (task.IsCompleted)
         {
             DataSnapshot snapshot = task.Result;
             //   Debug.Log("data for plant " + snapshot.GetRawJsonValue());
             plant = JsonUtility.FromJson <SinglePlantTwo>(snapshot.GetRawJsonValue());
             // StartCoroutine(GetTheDataFromTheDbAndPopulateThePlant(snapshot.GetRawJsonValue()));
         }
     });
 }
コード例 #4
0
    // BEZ OBIEKTI DA PROBMSA D AZAPISAM WTFFF
    IEnumerator PlantingThePlant(int contract)
    {
        ContractID = contract;
        yield return(new WaitForSeconds(1f));

        plant                   = new SinglePlantTwo();
        plant.ContractID        = ContractID;
        plant.isPlantInContract = true;
        plant.isPlantPlanted    = true;
        plant.isDroneAssigned   = false;
        plant.FieldID           = id;
        //ContractID = contract;
        // PlayerPrefs.SetInt("contract", ContractID);

        string ToJson = JsonUtility.ToJson(plant);

        reference.Child("USERS").Child(LogInAndRegister.Instance.UserName).Child("GAMESPACE").Child("CONTRACT" + ContractID).Child("PLANTS").Child("PLANT" + plant.FieldID).SetRawJsonValueAsync(ToJson);

        //  PlayerPrefs.SetInt("plantid", id);
    }