Exemple #1
0
    public void NewPlace(PlaceGroup place, bool clickedOnMap = false)
    {
        // Save places
        if (savePlacesAfterReload)
        {
            savePlacesAfterReload = false;
            PlacesSave.Save();
        }

        bool wait = true;

        if (TopBar.instance.currentTab == 2)
        {
            animator.SetTrigger("Change");
        }
        else
        {
            wait = false;
            TopBar.instance.SwitchTab(2);
        }
        StopAllCoroutines();


        if (!clickedOnMap)
        {
            RenderMap.instance.UpdateMapSize(0.3f);
            GlobalVariables.inst.MoveCamera(place.mapObject.gameObject.transform.position);
            place.mapObject.Select();
        }
        this.place = place;
        StartCoroutine(AfterAnimationChange(wait));
    }
Exemple #2
0
    public static void Load()
    {
        string     destination = Application.persistentDataPath + "/save2.dat";
        FileStream file;

        if (File.Exists(destination))
        {
            file = File.OpenRead(destination);
        }
        else
        {
            Debug.LogError("File not found");
            return;
        }

        BinaryFormatter bf   = new BinaryFormatter();
        SaveData        data = (SaveData)bf.Deserialize(file);

        file.Close();

        PlacesSave.LoadCategories(data.placesSave);
        ReadJson.instance.uploadedFiles = data.uploadedFiles;
        ReadJson.instance.days          = data.loadedJson;
        if (data.placesAddressSave != null)
        {
            GoogleLocationApi.instance.placesAddressSave = data.placesAddressSave;
        }
    }
Exemple #3
0
 void Start()
 {
     PlacesSave.Load();
     OpenFileDialog();
     if (uploadedFiles.Count > 0)
     {
         filesBox.SetupTexts(uploadedFiles);
         CheckIfCanDraw();
     }
 }
Exemple #4
0
 public void IconClicked(int id)
 {
     ChangeSelectedIcon(id);
     place.RefreshIcons(id);
     if (placeIcon != null)
     {
         placeIcon.sprite = PlacesRanking.instance.categories[place.icon].smallIcon;
     }
     PlacesSave.IconChange(place.placeInfo.id, id);
 }
 // Loading files
 static void LoadPlaces()
 {
     if (File.Exists(placesFileName))
     {
         StreamReader sr   = new StreamReader(placesFileName);
         string       line = sr.ReadLine();
         sr.Close();
         PlacesSave save = JsonConvert.DeserializeObject <PlacesSave>(line);
         places    = save.places;
         currentId = save.currentId;
     }
 }
Exemple #6
0
 public void RestartFiles()
 {
     days.Clear();
     RenderMap.instance.Clear();
     PlacesRanking.instance.Clear();
     dayNumber = 0;
     uploadedFiles.Clear();
     FilesBox.instance.SetupTexts(uploadedFiles);
     SaveSystem.Save();
     PlacesSave.Clear();
     blankPlaceholder.SetActive(true);
     dateTimeArrows.SetActive(false);
     TopBar.instance.Clear();
 }
Exemple #7
0
    void LoadIcon(MovesJson.SegmentsInfo.PlaceInfo place, Action <int> action)
    {
        PlaceType placeType = place.type;

        if (placeType == PlaceType.home)
        {
            action.Invoke(4);
        }
        else if (placeType == PlaceType.school)
        {
            action.Invoke(9);
        }
        else
        {
            action.Invoke(6);
        }

        int?customIcon = PlacesSave.FindIcon(place.id);

        if (customIcon != null)
        {
            action.Invoke(customIcon.Value);
        }
    }