Exemple #1
0
    /// <summary>
    /// Display the information of the selected shovel
    /// </summary>
    /// <param name="shovel">shovel info to display</param>
    public void Setup(Shovel shovel)
    {
        shovelNameText.text = shovel.Name;
        Report report = reportsManager.GetReportByID(shovel.ID);

        if (report != null)
        {
            comparisionText.text           = $"{100 * report.Performance / report.PlannedPerformance} %";
            performanceBarImage.fillAmount = report.Performance / report.PlannedPerformance;
            performanceText.text           = report.Performance.ToString();
            plannedPerformanceText.text    = report.PlannedPerformance.ToString();

            foreach (Transform item in statesContent)
            {
                Destroy(item.gameObject);
            }

            foreach (var item in report.LastStates)
            {
                GameObject stateUI = Instantiate(stateUIPrefab, statesContent);
                stateUI.GetComponent <ShovelStateUI>().Setup(item);
            }
        }
    }