Exemplo n.º 1
0
    public static List <Marker> getAllMarkers()
    {
        pathToMarkerHistory     = Application.streamingAssetsPath + "/markerHistory.json";
        MarkerHistoryJsonString = File.ReadAllText(pathToMarkerHistory);
        MarkerContainer mc = JsonUtility.FromJson <MarkerContainer>(MarkerHistoryJsonString);

        return(mc.markers);
    }
Exemplo n.º 2
0
    private void OnDestroy()
    {
        StopGridGeneration();

        if (markerContainer != null)
        {
            Destroy(markerContainer.gameObject);
            markerContainer = null;
        }
    }
Exemplo n.º 3
0
    public void Activate()
    {
        isActive = true;

        inputHandler.OnLeftMouseUp  += OnSetPoint;
        inputHandler.OnRightMouseUp += OnCancel;

        if (markerContainer == null)
        {
            markerContainer = Instantiate(markerContainerPrefab, map.transform, false);
            markerContainer.Init();
        }
    }
Exemplo n.º 4
0
    public static void addMarkerToHistory(string name, string text)
    {
        pathToMarkerHistory     = Application.streamingAssetsPath + "/markerHistory.json";
        MarkerHistoryJsonString = File.ReadAllText(pathToMarkerHistory);
        MarkerContainer mc = JsonUtility.FromJson <MarkerContainer>(MarkerHistoryJsonString);

        foreach (Marker mark in mc.markers)
        {
            if (mark.name == name)
            {
                mc.markers.Remove(mark);
                break;
            }
        }

        mc.markers.Add(new Marker(name, text));
        string markersjson = JsonUtility.ToJson(mc);

        File.WriteAllText(pathToMarkerHistory, markersjson);
    }