Пример #1
0
        private void GenerateObjectsFromArray(object[] array, Enumerators.DataType type)
        {
            if (array == null)
            {
                return;
            }

            AnnotateContentItem newItem;

            foreach (var item in array)
            {
                if (item == null)
                {
                    continue;
                }

                newItem = new AnnotateContentItem(_parentOfContentGroup, item, type);
                _annotateContentItems.Add(newItem);

                if (type == Enumerators.DataType.PAGES)
                {
                    foreach (var block in (item as Page).blocks)
                    {
                        newItem = new AnnotateContentItem(_parentOfContentGroup, block, Enumerators.DataType.BLOCKS);
                        _annotateContentItems.Add(newItem);

                        foreach (var paragraph in block.paragraphs)
                        {
                            newItem = new AnnotateContentItem(_parentOfContentGroup, paragraph, Enumerators.DataType.PARAGRAPH);
                            _annotateContentItems.Add(newItem);
                        }
                    }
                }
            }
        }
Пример #2
0
        public AnnotateContentItem(Transform parent, object value, Enumerators.DataType dataType)
        {
            _selfDataType = dataType;

            _selfObject = MonoBehaviour.Instantiate(Resources.Load <GameObject>("UI/Elements/Item_Content"));
            _selfObject.transform.SetParent(parent, false);

            _nameText     = _selfObject.GetComponent <Text>();
            _selfImage    = _selfObject.transform.Find("Image_Content").GetComponent <UnityEngine.UI.Image>();
            _selectButton = _selfObject.GetComponent <Button>();

            _selfImage.enabled = false;

            FillDataByType(value);
        }