当前位置: 首页>>代码示例>>C#>>正文


C# GObject.LocalToRoot方法代码示例

本文整理汇总了C#中FairyGUI.GObject.LocalToRoot方法的典型用法代码示例。如果您正苦于以下问题:C# GObject.LocalToRoot方法的具体用法?C# GObject.LocalToRoot怎么用?C# GObject.LocalToRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FairyGUI.GObject的用法示例。


在下文中一共展示了GObject.LocalToRoot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPoupPosition

        /// <summary>
        /// 
        /// </summary>
        /// <param name="popup"></param>
        /// <param name="target"></param>
        /// <param name="downward"></param>
        /// <returns></returns>
        public Vector2 GetPoupPosition(GObject popup, GObject target, object downward)
        {
            Vector2 pos;
            Vector2 size = Vector2.zero;
            if (target != null)
            {
                pos = target.LocalToRoot(Vector2.zero, this);
                size = target.LocalToRoot(target.size, this) - pos;
            }
            else
            {
                pos = this.GlobalToLocal(Stage.inst.touchPosition);
            }
            float xx, yy;
            xx = pos.x;
            if (xx + popup.width > this.width)
                xx = xx + size.x - popup.width;
            yy = pos.y + size.y;
            if ((downward == null && yy + popup.height > this.height)
                || downward != null && (bool)downward == false)
            {
                yy = pos.y - popup.height - 1;
                if (yy < 0)
                {
                    yy = 0;
                    xx += size.x / 2;
                }
            }

            return new Vector2(Mathf.RoundToInt(xx), Mathf.RoundToInt(yy));
        }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:38,代码来源:GRoot.cs

示例2: StartDrag

        /// <summary>
        /// Start dragging.
        /// 开始拖动。
        /// </summary>
        /// <param name="source">Source object. This is the object which initiated the dragging.</param>
        /// <param name="icon">Icon to be used as the dragging sign.</param>
        /// <param name="sourceData">Custom data. You can get it in the onDrop event data.</param>
        /// <param name="touchPointID">Copy the touchId from InputEvent to here, if has one.</param>
        public void StartDrag(GObject source, string icon, object sourceData, int touchPointID = -1)
        {
            if (_agent.parent != null)
                return;

            _sourceData = sourceData;
            _agent.url = icon;
            GRoot.inst.AddChild(_agent);
            _agent.xy = source.LocalToRoot(Vector2.zero, null);
            _agent.StartDrag(touchPointID);
        }
开发者ID:yinlei,项目名称:Fishing,代码行数:19,代码来源:DragDropManager.cs


注:本文中的FairyGUI.GObject.LocalToRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。