示例#1
0
        public override void OnValidateEditor()
        {
            base.OnValidateEditor();

            //if (this.gameObject.activeSelf == false) return;

            #region source macros UI.Windows.Editor.ImageComponent
            {
                //if (this.image == null) this.image = this.GetComponent<Image>();
                //if (this.rawImage == null) this.rawImage = this.GetComponent<RawImage>();

                WindowSystemResources.Validate(this);

                this.imageCrossFadeModule.Init(this);
                this.imageCrossFadeModule.OnValidateEditor();

                /*if (this.image == null || this.image.GetComponent<UIFlippable>() == null ||
                 *      this.rawImage == null || this.rawImage.GetComponent<UIFlippable>() == null) {
                 *
                 *      if (this.flippableEffect != null) ME.EditorUtilities.Destroy(this.flippableEffect, () => { this.flippableEffect = null; });
                 *
                 * }
                 *
                 * if (this.rawImage == null || this.rawImage.GetComponent<UIPreserveAspect>() == null) {
                 *
                 *      if (this.preserveAspectEffect != null) ME.EditorUtilities.Destroy(this.preserveAspectEffect, () => { this.preserveAspectEffect = null; });
                 *
                 * }*/

                var gr = (this.rawImage as Graphic ?? this.image as Graphic);
                if (gr != null)
                {
                    this.flippableEffect = gr.GetComponent <UIFlippable>();
                    if (this.flippableEffect == null)
                    {
                        this.flippableEffect = gr.gameObject.AddComponent <UIFlippable>();
                    }
                    if (this.flippableEffect != null)
                    {
                        this.flippableEffect.horizontal = this.flipHorizontal;
                        this.flippableEffect.vertical   = this.flipVertical;
                    }
                }

                if (this.rawImage != null)
                {
                    this.preserveAspectEffect = this.rawImage.GetComponent <UIPreserveAspect>();
                    if (this.preserveAspectEffect == null)
                    {
                        this.preserveAspectEffect = this.rawImage.gameObject.AddComponent <UIPreserveAspect>();
                    }
                    if (this.preserveAspectEffect != null)
                    {
                        this.preserveAspectEffect.preserveAspect = this.preserveAspect;
                        this.preserveAspectEffect.rawImage       = this.rawImage;
                    }
                }
            }
            #endregion
        }
        public override void OnValidateEditor()
        {
            base.OnValidateEditor();

            if (this.gameObject.activeSelf == false)
            {
                return;
            }

            if (this.button == null)
            {
                var buttons = this.GetComponentsInChildren <Button>(true);
                if (buttons.Length == 1)
                {
                    this.button = buttons[0];
                }
            }

            #region macros UI.Windows.Editor.TextComponent

            /*
             * This code is auto-generated by Macros Module
             * Do not change anything
             */
            var texts = this.GetComponentsInChildren <Text>(true);
            if (texts.Length == 1)
            {
                this.text = texts[0];
            }

            if (this.valueFormat != TextValueFormat.None)
            {
                this.SetValue(999999L);
            }
            #endregion

            #region macros UI.Windows.Editor.ImageComponent

            /*
             * This code is auto-generated by Macros Module
             * Do not change anything
             */
            {
                //if (this.image == null) this.image = this.GetComponent<Image>();
                //if (this.rawImage == null) this.rawImage = this.GetComponent<RawImage>();

                WindowSystemResources.Validate(this);

                this.imageCrossFadeModule.Init(this);
                this.imageCrossFadeModule.OnValidateEditor();
            }
            #endregion
        }
        public override void OnValidateEditor()
        {
            base.OnValidateEditor();

            if (this.gameObject.activeSelf == false)
            {
                return;
            }

            #region source macros UI.Windows.Editor.ImageComponent
            {
                //if (this.image == null) this.image = this.GetComponent<Image>();
                //if (this.rawImage == null) this.rawImage = this.GetComponent<RawImage>();

                WindowSystemResources.Validate(this);

                this.imageCrossFadeModule.Init(this);
                this.imageCrossFadeModule.OnValidateEditor();
            }
            #endregion
        }