public void Init(ScannedCodes.ScannedCodeDataModel data, bool present = false)
 {
     codeText.text         = data.code;
     timeText.text         = data.scannedTime.ToString(timeFormatString);
     backgroundImage.color = present ? Color.green : new Color(60, 60, 60);
     codeText.color        = present ? Color.black : Color.white;
     timeText.gameObject.SetActive(present);
     if (present)
     {
         transform.SetAsFirstSibling();
     }
 }
    public void Init(List <ScannedCodes.ScannedCodeDataModel> data)
    {
        foreach (Transform child in elementsContainer)
        {
            Destroy(child.gameObject);
        }

        foreach (var code in MainSceneController.expectedCodes)
        {
            ScannedCodes.ScannedCodeDataModel model = data.Find(item => item.code == code);
            bool present = true;
            if (model == null)
            {
                model = new ScannedCodes.ScannedCodeDataModel()
                {
                    code = code, scannedTime = System.DateTime.Now
                };
                present = false;
            }
            ScrollViewElementController.Instantiate(prefab, elementsContainer, model, present);
        }
    }
    public static void Instantiate(GameObject prefab, Transform parent, ScannedCodes.ScannedCodeDataModel data, bool present = false)
    {
        var instance = Instantiate(prefab, parent);

        instance.GetComponent <ScrollViewElementController>().Init(data);
    }