Beispiel #1
0
            //#pragma warning disable 414
            //            private UxmlTypeAttributeDescription<int> m_Type = EnumFieldHelpers.type;
            //            private UxmlStringAttributeDescription m_Value = EnumFieldHelpers.value;
            //            private UxmlBoolAttributeDescription m_IncludeObsoleteValues = EnumFieldHelpers.includeObsoleteValues;
            //#pragma warning restore 414

            /// <summary>
            /// Initialize <see cref="EnumField"/> properties using values from the attribute bag.
            /// </summary>
            /// <param name="ve">The object to initialize.</param>
            /// <param name="bag">The attribute bag.</param>
            /// <param name="cc">The creation context; unused.</param>
            public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
            {
                base.Init(ve, bag, cc);

                MyOptionsField optionsField = (MyOptionsField)ve;

                optionsField.Init(0, new string[] { "empty" });
            }
        private void Init()
        {
            var           visualTree    = Resources.Load <VisualTreeAsset>("GeneratorElement");
            VisualElement labelFromUXML = visualTree.Instantiate();

            Add(labelFromUXML);

            startMelodieField            = this.Q <ObjectField>("start-melodie-field");
            startMelodieField.objectType = typeof(MidiAsset);
            genreField = this.Q <MyOptionsField>("genre-field");
            genreField.Init(0, MuseReciever.Genres);
            instrumentsField = this.Q <InstrumentField>("instruments-field");

            temperatureField        = this.Q <IntegerField>("temperature-field");
            turnicationField        = this.Q <IntegerField>("trunication-field");
            lengthField             = this.Q <FloatField>("length-field");
            amountField             = this.Q <IntegerField>("amount-field");
            generateButton          = this.Q <Button>("generate-button");
            generateButton.clicked += Generate;
        }