Esempio n. 1
0
        void OnDragPerform(DragPerformEvent evt)
        {
            var gameObject = DragAndDrop.objectReferences.OfType <GameObject>().Single();

            var template = new DropGameObjectEcsTemplate(gameObject, this.WorldToLocal(evt.mousePosition));

            template.PromptToCreate(m_Store);
        }
Esempio n. 2
0
        void UpdateUI()
        {
            Clear();
            m_ButtonsDependingOnSelection.Clear();
            m_LabelsDependingOnSelection.Clear();

            Add(new Label {
                text = k_NoScriptAssetSelectedText.text
            });

            var ecsGraphTemplate = new EcsGraphTemplate();

            Add(new Button(
                    () => ecsGraphTemplate.PromptToCreate(m_Store))
            {
                text = "Create " + ecsGraphTemplate.GraphTypeName
            });

            Button buttonFromObject = new Button(
                () =>
            {
                var template = new DropGameObjectEcsTemplate(m_SelectedGameObject);
                template.PromptToCreate(m_Store);
            })
            {
                text = "Create from selected GameObject"
            };

            m_ButtonsDependingOnSelection.Add(buttonFromObject);
            Add(buttonFromObject);

            var label = new Label("");

            label.AddToClassList(k_LabelWarningClass);
            m_LabelsDependingOnSelection.Add(label);
            Add(label);

            var macroGraphTemplate = new EcsMacroGraphTemplate();

            Add(new Button(() => macroGraphTemplate.PromptToCreate(m_Store))
            {
                text = "Create Macros"
            });

            Add(new Label(k_OrDragAndDropText.text));

            UpdateSelectionRelatedElements();

            m_DropLabel.StretchToParentSize();
            Add(m_DropLabel);
        }