Esempio n. 1
0
    void UpdateCurrentTimeseries(System.DateTime date) //to be added to simulation onNewDay
    {
        switch (currentTrackedDataSource)
        {
        case TrackedDataSource.cityResource:
            if (currentGraphDataType == ResourcesHistory.DataType.undefined)
            {
                print("WARNING! Attempted to update a graph with data type of undefined. This shouldn't happen");
                CloseGraph();
                return;
            }
            //Get Last added data of type and add them to graphData
            activeGraphData.AddToTimeSeries(date, GameManager.resourceMan.GetLastHistoryEntry(currentGraphDataType));
            break;

        case TrackedDataSource.buildingHistory:
            if (currentTrackedBuildingData == null || currentTrackedBuilding == null)
            {
                print("WARNING! Attempted to update a graph with an unset building or dataTitle. This shouldn't happen");
                CloseGraph();
                return;
            }
            activeGraphData.AddToTimeSeries(date, currentTrackedBuilding.GetLastHistoricalDataFor(currentTrackedBuildingData));
            break;

        default:
            CloseGraph();
            return;
        }

        //redraw graph
        DrawGraphWindow();
    }