Beispiel #1
0
        /// <summary>
        /// Shows popup dialog with UI to rename content item.
        /// </summary>
        /// <param name="item">The item to rename.</param>
        public void Rename(ContentItem item)
        {
            // Show element in view
            Select(item);

            // Show rename popup
            var popup = RenamePopup.Show(item, item.TextRectangle, item.ShortName, true);

            popup.Tag      = item;
            popup.Renamed += renamePopup => Rename((ContentItem)renamePopup.Tag, renamePopup.Text);
            popup.Closed  += renamePopup =>
            {
                // Check if was creating new element
                if (_newElement != null)
                {
                    // Destroy mock control
                    _newElement.ParentFolder = null;
                    _newElement.Dispose();
                    _newElement = null;
                }
            };

            // For new asset we want to mock the initial value so user can press just Enter to use default name
            if (_newElement != null)
            {
                popup.InitialValue = "?";
            }
        }
Beispiel #2
0
        /// <summary>
        /// Shows popup dialog with UI to rename content item.
        /// </summary>
        /// <param name="item">The item to rename.</param>
        public void Rename(ContentItem item)
        {
            // Show element in the view
            Select(item, true);

            // Disable scrolling in content view
            if (_split.Panel2.VScrollBar != null)
            {
                _split.Panel2.VScrollBar.ThumbEnabled = false;
            }
            if (_split.Panel2.HScrollBar != null)
            {
                _split.Panel2.HScrollBar.ThumbEnabled = false;
            }

            // Show rename popup
            var popup = RenamePopup.Show(item, item.TextRectangle, item.ShortName, true);

            popup.Tag       = item;
            popup.Validate += OnRenameValidate;
            popup.Renamed  += renamePopup => Rename((ContentItem)renamePopup.Tag, renamePopup.Text);
            popup.Closed   += renamePopup =>
            {
                // Restore scrolling in content view
                if (_split.Panel2.VScrollBar != null)
                {
                    _split.Panel2.VScrollBar.ThumbEnabled = true;
                }
                if (_split.Panel2.HScrollBar != null)
                {
                    _split.Panel2.HScrollBar.ThumbEnabled = true;
                }

                // Check if was creating new element
                if (_newElement != null)
                {
                    // Destroy mock control
                    _newElement.ParentFolder = null;
                    _newElement.Dispose();
                    _newElement = null;
                }
            };

            // For new asset we want to mock the initial value so user can press just Enter to use default name
            if (_newElement != null)
            {
                popup.InitialValue = "?";
            }
        }
Beispiel #3
0
    void showGetItemEffect(Vector2 originPosInGlobal, NewItem itemCopy)
    {
        GRoot.inst.AddChild(itemCopy);
        itemCopy.position     = GRoot.inst.GlobalToLocal(new Vector2(originPosInGlobal.x - itemCopy.width / 2, originPosInGlobal.y - itemCopy.height / 2));
        itemCopy.sortingOrder = 100;
        itemCopy.touchable    = false;
        itemCopy.alpha        = 0.4f;
        //GRoot.inst.AddChild (copyView);


        itemCopy.TweenFade(1, 0.8f).OnComplete(delegate() {
            itemCopy.TweenMove(new Vector2(0, GRoot.inst.height - itemCopy.height * 0.4f), 0.3f).OnUpdate(delegate(GTweener tweener) {
                itemCopy.InvalidateBatchingState();
                float r = (tweener.deltaValue.vec2 - tweener.startValue.vec2).magnitude / (tweener.endValue.vec2 - tweener.startValue.vec2).magnitude;
                r       = 1 - r * 0.6f;
                //r = r*0.6;
                itemCopy.scale = new Vector2(r, r);
            }).OnComplete(delegate() {
                itemCopy.TweenFade(0, 0.2f).OnComplete(delegate() {
                    GRoot.inst.RemoveChild(itemCopy);
                    itemCopy.Dispose();
                });
            });
        });
    }