示例#1
0
            public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
            {
                base.Init(ve, bag, cc);
                TemplateContainer templateContainer = (TemplateContainer)ve;

                templateContainer.templateId = this.m_Template.GetValueFromBag(bag, cc);
                VisualTreeAsset expr_2D         = cc.visualTreeAsset;
                VisualTreeAsset visualTreeAsset = (expr_2D != null) ? expr_2D.ResolveTemplate(templateContainer.templateId) : null;
                bool            flag            = visualTreeAsset == null;

                if (flag)
                {
                    templateContainer.Add(new Label(string.Format("Unknown Template: '{0}'", templateContainer.templateId)));
                }
                else
                {
                    TemplateAsset expr_70 = bag as TemplateAsset;
                    List <TemplateAsset.AttributeOverride> list = (expr_70 != null) ? expr_70.attributeOverrides : null;
                    List <TemplateAsset.AttributeOverride> attributeOverrides = cc.attributeOverrides;
                    List <TemplateAsset.AttributeOverride> list2 = null;
                    bool flag2 = list != null || attributeOverrides != null;
                    if (flag2)
                    {
                        list2 = new List <TemplateAsset.AttributeOverride>();
                        bool flag3 = attributeOverrides != null;
                        if (flag3)
                        {
                            list2.AddRange(attributeOverrides);
                        }
                        bool flag4 = list != null;
                        if (flag4)
                        {
                            list2.AddRange(list);
                        }
                    }
                    visualTreeAsset.CloneTree(ve, cc.slotInsertionPoints, list2);
                }
                bool flag5 = visualTreeAsset == null;

                if (flag5)
                {
                    Debug.LogErrorFormat("Could not resolve template with name '{0}'", new object[]
                    {
                        templateContainer.templateId
                    });
                }
            }
示例#2
0
 public void Init(string key, TemplateAsset Element, KeyWordInput input)
 {
     this.key     = key;
     this.element = Element;
     this.input   = input;
 }