Пример #1
0
        private void CreateHandlers(IModel shape)
        {
            if (LastShape != null)
            {
                LastShape.RemoveHandle();
            }

            HandleCursor    cursor    = new HandleCursor();
            HandlePencil    pencil    = new HandlePencil();
            HandleLine      line      = new HandleLine();
            HandleEllipse   ellipse   = new HandleEllipse();
            HandleRectangle rectangle = new HandleRectangle();
            HandleBezier    bezier    = new HandleBezier();

            HandleFill fill = new HandleFill();

            HandleImage image = new HandleImage();

            cursor.Successor    = pencil;
            pencil.Successor    = line;
            line.Successor      = ellipse;
            ellipse.Successor   = rectangle;
            rectangle.Successor = bezier;
            bezier.Successor    = fill;
            fill.Successor      = image;

            cursor.Handle(shape);
        }
Пример #2
0
        protected override void OnStyleChanged(UIStyle style)
        {
            base.OnStyleChanged(style);

            Background.ValueFor(this).Update(PeerBackground, DefaultBackground);
            HandleImage.ValueFor(this).Update(PeerHandle, DefaultHandleImage);
        }
Пример #3
0
        //private Sprite GetSprite(YuLegoDropdownOptionMeta optionMeta)
        //{
        //    var spriteId = optionMeta.SpriteId;

        //    if (spriteDict.ContainsKey(spriteId))
        //    {
        //        return spriteDict[spriteId].GetAsset();
        //    }

        //    var spRef = AssetModule.GetSprite(spriteId);
        //    spriteDict.Add(spriteId, spRef);
        //    return spRef.GetAsset();
        //}

        #endregion

        public override void Metamorphose(LegoUIMeta uiMeta)
        {
            if (MetamorphoseStage == LegoMetamorphoseStage.Completed)
            {
                MetamorphoseStage = LegoMetamorphoseStage.Metamorphosing;
            }

            if (dropdownMeta == null)
            {
                dropdownMeta     = uiMeta.NextDropdown;
                dropdownRectMeta = uiMeta.CurrentRect;
            }

            switch (metamorphoseStatus)
            {
            case MetamorphoseStatus.Dropdown:
                MetamorphoseRect(dropdownRectMeta);

                // 输入框自身附带Image控件变形
                SelfImage.Metamorphose(dropdownMeta.DropdownImageMeta);

                if (dropdownMeta.Transition == LegoTransition.ColorTint)
                {
                    var colorTintMeta = dropdownMeta.ColorTintMeta;

                    colors = new ColorBlock
                    {
                        normalColor      = colorTintMeta.NormalLegoColor.ToColor(),
                        highlightedColor = colorTintMeta.HighlightedLegoColor.ToColor(),
                        pressedColor     = colorTintMeta.PressedLegoColor.ToColor(),
                        disabledColor    = colorTintMeta.DisabledLegoColor.ToColor(),
                        colorMultiplier  = colorTintMeta.ColorMultiplier,
                        fadeDuration     = colorTintMeta.FadeDuration
                    };
                }

                // 选项
                if (dropdownMeta.OptionMetas != null && dropdownMeta.OptionMetas.Count > 0)
                {
                    options.Clear();

                    foreach (var optionMeta in dropdownMeta.OptionMetas)
                    {
                        var optionData = new OptionData();
                        optionData.text = optionMeta.Text;
                        // todo 下拉框菜单精灵

                        //optionData.image = SpriteRouter.GetSprite(optionMeta.SpriteId);
                        options.Add(optionData);
                    }
                }

                metamorphoseStatus = MetamorphoseStatus.Label;
                break;

            case MetamorphoseStatus.Label:
                Label.Metamorphose(dropdownMeta.LabelRectMeta, dropdownMeta.LabelTextMeta);
                metamorphoseStatus = MetamorphoseStatus.Arrow;
                break;

            case MetamorphoseStatus.Arrow:
                Arrow.Metamorphose(dropdownMeta.ArrowRectMeta, dropdownMeta.ArrowImageMeta);
                metamorphoseStatus = MetamorphoseStatus.Template;
                break;

            case MetamorphoseStatus.Template:
                TemplateImage.Metamorphose(dropdownMeta.TemplateRectMeta, dropdownMeta.TemplateImageMeta);
                metamorphoseStatus = MetamorphoseStatus.Viewport;
                break;

            case MetamorphoseStatus.Viewport:
                ViewportImage.Metamorphose(dropdownMeta.ViewPortRectMeta, dropdownMeta.ViewPortImageMeta);
                metamorphoseStatus = MetamorphoseStatus.Content;
                break;

            case MetamorphoseStatus.Content:
                YuLegoUtility.MetamorphoseRect(Content, dropdownMeta.ContentRectMeta);
                metamorphoseStatus = MetamorphoseStatus.Item;
                break;

            case MetamorphoseStatus.Item:
                if (dropdownMeta.ItemTransition == LegoTransition.ColorTint)
                {
                    var colorTintMeta = dropdownMeta.ItemRootColorTintMeta;

                    Item.colors = new ColorBlock
                    {
                        normalColor      = colorTintMeta.NormalLegoColor.ToColor(),
                        highlightedColor = colorTintMeta.HighlightedLegoColor.ToColor(),
                        pressedColor     = colorTintMeta.PressedLegoColor.ToColor(),
                        disabledColor    = colorTintMeta.DisabledLegoColor.ToColor(),
                        colorMultiplier  = colorTintMeta.ColorMultiplier,
                        fadeDuration     = colorTintMeta.FadeDuration
                    };
                }

                YuLegoUtility.MetamorphoseRect(Item.RectTransform, dropdownMeta.ItemRootRectMeta);
                metamorphoseStatus = MetamorphoseStatus.ItemBackground;
                break;

            case MetamorphoseStatus.ItemBackground:
                ItemBackground.Metamorphose(dropdownMeta.ItemBackgroundRectMeta,
                                            dropdownMeta.ItemBackgroundImageMeta);
                metamorphoseStatus = MetamorphoseStatus.ItemCheckmark;
                break;

            case MetamorphoseStatus.ItemCheckmark:
                ItemCheckmark.Metamorphose(dropdownMeta.ItemCheckmarkRectMeta,
                                           dropdownMeta.ItemCheckmarkImageMeta);
                metamorphoseStatus = MetamorphoseStatus.ItemLabel;
                break;

            case MetamorphoseStatus.ItemLabel:
                ItemLabel.Metamorphose(dropdownMeta.ItemLabelRectMeta,
                                       dropdownMeta.ItemLabelTextMeta);
                metamorphoseStatus = MetamorphoseStatus.Scrollbar;
                break;

            case MetamorphoseStatus.Scrollbar:
                ScrollbarImage.Metamorphose(dropdownMeta.ScrollbarRectMeta,
                                            dropdownMeta.ScrollbarImageMeta);
                metamorphoseStatus = MetamorphoseStatus.SlidingArea;
                break;

            case MetamorphoseStatus.SlidingArea:
                YuLegoUtility.MetamorphoseRect(SlidingArea, dropdownMeta.SlidingAreaRectMeta);
                metamorphoseStatus = MetamorphoseStatus.Handle;
                break;

            case MetamorphoseStatus.Handle:
                HandleImage.Metamorphose(dropdownMeta.ScrollbarHandleRectMeta,
                                         dropdownMeta.ScrollbarHandleImageMeta);

                dropdownMeta       = null;
                dropdownRectMeta   = null;
                metamorphoseStatus = MetamorphoseStatus.Dropdown;
                MetamorphoseStage  = LegoMetamorphoseStage.Completed;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (btnBack != null)
            {
                btnBack.Dispose();
                btnBack = null;
            }

            if (btnDone != null)
            {
                btnDone.Dispose();
                btnDone = null;
            }

            if (cnsVActionBarAlignmentBasisHeight != null)
            {
                cnsVActionBarAlignmentBasisHeight.Dispose();
                cnsVActionBarAlignmentBasisHeight = null;
            }

            if (HandleImage != null)
            {
                HandleImage.Dispose();
                HandleImage = null;
            }

            if (Image != null)
            {
                Image.Dispose();
                Image = null;
            }

            if (NotificationButton != null)
            {
                NotificationButton.Dispose();
                NotificationButton = null;
            }

            if (NotificationButtonImage != null)
            {
                NotificationButtonImage.Dispose();
                NotificationButtonImage = null;
            }

            if (Score != null)
            {
                Score.Dispose();
                Score = null;
            }

            if (ScoreImage != null)
            {
                ScoreImage.Dispose();
                ScoreImage = null;
            }

            if (Title != null)
            {
                Title.Dispose();
                Title = null;
            }

            if (vActionBarAlignmentBasis != null)
            {
                vActionBarAlignmentBasis.Dispose();
                vActionBarAlignmentBasis = null;
            }

            if (vHandleImageLeftBottomBasis != null)
            {
                vHandleImageLeftBottomBasis.Dispose();
                vHandleImageLeftBottomBasis = null;
            }

            if (vLeftBottomBasis != null)
            {
                vLeftBottomBasis.Dispose();
                vLeftBottomBasis = null;
            }
        }
Пример #5
0
    public static void ChangeTextureType()
    {
        HandleImage win = (HandleImage)EditorWindow.GetWindow(typeof(HandleImage), true, "ChangeTextureType");

        win.ShowNotification(new GUIContent("请先选中需要操作的文件或者文件夹"));
    }