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 }
private void CopyFlip(IImageComponent imageSource, UIFlippable flippable) { if (imageSource.IsHorizontalFlip() == true) { flippable.horizontal = true; } if (imageSource.IsVerticalFlip() == true) { flippable.vertical = true; } }
public void ValidateCopy() { if (this.image != null && this.IsValid() == true) { this.copyFlippableImage = this.CreateCopy(ref this.copyImage, ref this.sourceImage, this.image.GetImageSource()); this.copyFlippableRawImage = this.CreateCopy(ref this.copyRawImage, ref this.sourceRawImage, this.image.GetRawImageSource()); } else { this.ClearCopy(this.copyImage, this.sourceImage, () => { this.copyImage = null; this.sourceImage = null; }); this.ClearCopy(this.copyRawImage, this.sourceRawImage, () => { this.copyRawImage = null; this.sourceRawImage = null; }); } }
protected void Awake() { if (this.m_Graphic == null || this.m_Tooltip == null) { return; } this.m_Flippable = this.m_Graphic.gameObject.GetComponent <UIFlippable>(); if (this.m_Flippable == null) { this.m_Flippable = this.m_Graphic.gameObject.AddComponent <UIFlippable>(); } }
protected void Awake() { if (this.m_Graphic == null || this.m_Tooltip == null) { return; } this.m_Flippable = this.m_Graphic.gameObject.GetComponent <UIFlippable>(); if (this.m_Flippable == null) { this.m_Flippable = this.m_Graphic.gameObject.AddComponent <UIFlippable>(); } this.m_OriginalPivot = this.m_Graphic.rectTransform.pivot; this.m_OriginalAnchorMin = this.m_Graphic.rectTransform.anchorMin; this.m_OriginalAnchorMax = this.m_Graphic.rectTransform.anchorMax; this.m_OriginalPosition = this.m_Graphic.rectTransform.anchoredPosition; }
private void CopyFlippable(bool isHorizontal, bool isVertical, UIFlippable copy) { copy.horizontal = isHorizontal; copy.vertical = isVertical; }