• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FairyGUI.EventContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



EventContext类属于FairyGUI命名空间,在下文中一共展示了EventContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnCopy

 static void OnCopy(EventContext context)
 {
     TextEditor te = new TextEditor();
     #if (UNITY_5_3 || UNITY_5_4)
     te.text = (string)context.data;
     #else
     te.content = new GUIContent((string)context.data);
     #endif
     te.OnFocus();
     te.Copy();
 }
开发者ID:yinlei,项目名称:Fishing,代码行数:11,代码来源:CopyPastePatch.cs


示例2: OnPaste

 static void OnPaste(EventContext context)
 {
     TextField target = (TextField)context.data;
     TextEditor te = new TextEditor();
     te.Paste();
     #if (UNITY_5_3 || UNITY_5_4)
     string value = te.text;
     #else
     string value = te.content.text;
     #endif
     if (!string.IsNullOrEmpty(value))
         target.ReplaceSelection(value);
 }
开发者ID:yinlei,项目名称:Fishing,代码行数:13,代码来源:CopyPastePatch.cs


示例3: CallInternal

 public void CallInternal(EventContext context)
 {
     _dispatching = true;
     context.sender = owner;
     try
     {
         if (_callback1 != null)
             _callback1(context);
         if (_callback0 != null)
             _callback0();
     }
     finally
     {
         _dispatching = false;
     }
 }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:16,代码来源:EventBridge.cs


示例4: CallCaptureInternal

        public void CallCaptureInternal(EventContext context)
        {
            if (_captureCallback == null)
                return;

            _dispatching = true;
            context.sender = owner;
            try
            {
                _captureCallback(context);
            }
            finally
            {
                _dispatching = false;
            }
        }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:16,代码来源:EventBridge.cs


示例5: __mouseDown

        private void __mouseDown(EventContext context)
        {
            if (!_touchEffect)
                return;

            InputEvent evt = context.inputEvent;
            _touchId = evt.touchId;
            Vector2 pt = _owner.GlobalToLocal(new Vector2(evt.x, evt.y));
            if (_tweener != null)
            {
                _tweener.Complete();
                _tweener = null;
                Stage.inst.CancelClick(_touchId);
            }

            _y1 = _y2 = _maskContentHolder.y;
            _yOffset = pt.y - _maskContentHolder.y;

            _x1 = _x2 = _maskContentHolder.x;
            _xOffset = pt.x - _maskContentHolder.x;

            _time1 = _time2 = Time.time;
            _holdAreaPoint.x = pt.x;
            _holdAreaPoint.y = pt.y;
            _isHoldAreaDone = false;
            _isMouseMoved = false;

            _container.stage.onMouseMove.Add(__mouseMove);
            _container.stage.onMouseUp.Add(__mouseUp);
        }
开发者ID:niuniuzhu,项目名称:FairyGUI-unity,代码行数:30,代码来源:ScrollPane.cs


示例6: __mouseUp

        private void __mouseUp(EventContext context)
        {
            if (!_touchEffect)
            {
                _isMouseMoved = false;
                return;
            }

            InputEvent evt = context.inputEvent;
            if (_touchId != evt.touchId)
                return;

            _container.stage.onMouseMove.Remove(__mouseMove);
            _container.stage.onMouseUp.Remove(__mouseUp);

            if (!_isMouseMoved)
                return;

            _isMouseMoved = false;

            float time = Time.time - _time2;
            if (time == 0)
                time = 0.001f;
            float yVelocity = (_maskContentHolder.y - _y2) / time;
            float xVelocity = (_maskContentHolder.x - _x2) / time;

            float minDuration = _bouncebackEffect ? 0.3f : 0;
            float maxDuration = 0.5f;
            int overShoot = _bouncebackEffect ? 1 : 0;

            float xMin = -_xOverlap, yMin = -_yOverlap;
            float xMax = 0, yMax = 0;

            float duration = 0f;

            if (_hScroll)
                ThrowTween.CalculateDuration(_maskContentHolder.x, xMin, xMax, xVelocity, overShoot, ref duration);
            if (_vScroll)
                ThrowTween.CalculateDuration(_maskContentHolder.y, yMin, yMax, yVelocity, overShoot, ref duration);

            if (duration > maxDuration)
                duration = maxDuration;
            else if (duration < minDuration)
                duration = minDuration;

            _throwTween.start.x = _maskContentHolder.x;
            _throwTween.start.y = _maskContentHolder.y;

            Vector2 change1, change2;
            float endX = 0, endY = 0;

            if (_scrollType == ScrollType.Both || _scrollType == ScrollType.Horizontal)
            {
                change1.x = ThrowTween.CalculateChange(xVelocity, duration);
                change2.x = 0;
                endX = _maskContentHolder.x + change1.x;
            }
            else
                change1.x = change2.x = 0;

            if (_scrollType == ScrollType.Both || _scrollType == ScrollType.Vertical)
            {
                change1.y = ThrowTween.CalculateChange(yVelocity, duration);
                change2.y = 0;
                endY = _maskContentHolder.y + change1.y;
            }
            else
                change1.y = change2.y = 0;

            if (_snapToItem)
            {
                endX = -endX / GRoot.contentScaleFactor;
                endY = -endY / GRoot.contentScaleFactor;
                _owner.FindObjectNear(ref endX, ref endY);
                endX = -endX * GRoot.contentScaleFactor;
                endY = -endY * GRoot.contentScaleFactor;
                change1.x = endX - _maskContentHolder.x;
                change1.y = endY - _maskContentHolder.y;
            }

            if (xMax < endX)
                change2.x = xMax - _maskContentHolder.x - change1.x;
            else if (xMin > endX)
                change2.x = xMin - _maskContentHolder.x - change1.x;

            if (yMax < endY)
                change2.y = yMax - _maskContentHolder.y - change1.y;
            else if (yMin > endY)
                change2.y = yMin - _maskContentHolder.y - change1.y;

            _throwTween.value = 0;
            _throwTween.change1 = change1;
            _throwTween.change2 = change2;

            if (_tweener != null)
                _tweener.Complete();

            _tweener = DOTween.To(() => _throwTween.value, v => _throwTween.value = v, 1, duration)
                .SetEase(Ease.OutCubic)
                .OnUpdate(__tweenUpdate2)
//.........这里部分代码省略.........
开发者ID:niuniuzhu,项目名称:FairyGUI-unity,代码行数:101,代码来源:ScrollPane.cs


示例7: __dragStart

        private void __dragStart(EventContext context)
        {
            context.PreventDefault();

            this.StartDrag((int)context.data);
        }
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:6,代码来源:Window.cs


示例8: __touchMove

		void __touchMove(EventContext context)
		{
			if (isDisposed)
				return;

			if (_selectionStart == null)
				return;

			Vector3 v = Stage.inst.touchPosition;
			v = this.GlobalToLocal(v);
			if (float.IsNaN(v.x))
				return;

			Vector2 offset = _GetPositionOffset();
			v.x += offset.x;
			v.y += offset.y;

			CharPosition cp = GetCharPosition(v);
			if (cp.charIndex != _caretPosition)
				AdjustCaret(cp);
		}
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:21,代码来源:TextField.cs


示例9: __keydown

		void __keydown(EventContext context)
		{
			if (_caret == null || context.isDefaultPrevented)
				return;

			InputEvent evt = context.inputEvent;

			switch (evt.keyCode)
			{
				case KeyCode.Backspace:
					{
						context.PreventDefault();
						if (_selectionStart != null)
						{
							DeleteSelection();
							OnChanged();
						}
						else if (_caretPosition > 0)
						{
							int tmp = _caretPosition; //this.text 会修改_caretPosition
							_caretPosition--;
							this.text = _text.Substring(0, tmp - 1) + _text.Substring(tmp);
							OnChanged();
						}

						break;
					}

				case KeyCode.Delete:
					{
						context.PreventDefault();
						if (_selectionStart != null)
						{
							DeleteSelection();
							OnChanged();
						}
						else if (_caretPosition < _text.Length)
						{
							this.text = _text.Substring(0, _caretPosition) + _text.Substring(_caretPosition + 1);
							OnChanged();
						}

						break;
					}

				case KeyCode.LeftArrow:
					{
						context.PreventDefault();
						if (evt.shift)
						{
							if (_selectionStart == null)
								_selectionStart = GetCharPosition(_caretPosition);
						}
						else
							ClearSelection();
						if (_caretPosition > 0)
						{
							CharPosition cp = GetCharPosition(_caretPosition - 1);

							AdjustCaret(cp);
						}
						break;
					}

				case KeyCode.RightArrow:
					{
						context.PreventDefault();
						if (evt.shift)
						{
							if (_selectionStart == null)
								_selectionStart = GetCharPosition(_caretPosition);
						}
						else
							ClearSelection();
						if (_caretPosition < _text.Length)
						{
							CharPosition cp = GetCharPosition(_caretPosition + 1);
							AdjustCaret(cp);
						}
						break;
					}

				case KeyCode.UpArrow:
					{
						context.PreventDefault();
						if (evt.shift)
						{
							if (_selectionStart == null)
								_selectionStart = GetCharPosition(_caretPosition);
						}
						else
							ClearSelection();

						CharPosition cp = GetCharPosition(_caretPosition);
						if (cp.lineIndex == 0)
							return;

						LineInfo line = _lines[cp.lineIndex - 1];
						cp = GetCharPosition(new Vector3(_caret.cachedTransform.localPosition.x + _GetPositionOffset().x, line.y, 0));
						AdjustCaret(cp);
//.........这里部分代码省略.........
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:101,代码来源:TextField.cs


示例10: __focusIn

		void __focusIn(EventContext context)
		{
			if (_mobileInputAdapter != null)
			{
				OpenKeyboard();
			}
			else
			{
				_caret = Stage.inst.inputCaret;
				_caret.grahpics.sortingOrder = this.renderingOrder + 1;
				_caret.SetParent(cachedTransform);
				_caret.SetSizeAndColor(_textFormat.size, _textFormat.color);

				_highlighter = Stage.inst.highlighter;
				_highlighter.grahpics.sortingOrder = this.renderingOrder + 2;
				_highlighter.SetParent(cachedTransform);

				_caretPosition = _text.Length;
				CharPosition cp = GetCharPosition(_caretPosition);
				AdjustCaret(cp);
				_selectionStart = cp;
			}
		}
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:23,代码来源:TextField.cs


示例11: __mouseDown

 private void __mouseDown(EventContext context)
 {
     if (this.isShowing)
     {
         BringToFront();
     }
 }
开发者ID:wwxx,项目名称:FairyGUI-unity,代码行数:7,代码来源:Window.cs


示例12: __dragStart

        private void __dragStart(EventContext context)
        {
            context.PreventDefault();

            this.StartDrag(null);
        }
开发者ID:wwxx,项目名称:FairyGUI-unity,代码行数:6,代码来源:Window.cs


示例13: Return

 internal static void Return(EventContext value)
 {
     pool.Push(value);
 }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:4,代码来源:EventContext.cs


示例14: __touchBegin

        void __touchBegin(EventContext context)
        {
            if (Stage.inst.touchCount == 2)
            {
                if (!_started)
                {
                    Stage.inst.GetAllTouch(_touches);
                    Vector2 pt1 = _host.GlobalToLocal(Stage.inst.GetTouchPosition(_touches[0]));
                    Vector2 pt2 = _host.GlobalToLocal(Stage.inst.GetTouchPosition(_touches[1]));
                    _startDistance = Vector2.Distance(pt1, pt2);

                    Stage.inst.onTouchMove.Add(__touchMove);
                    Stage.inst.onTouchEnd.Add(__touchEnd);
                }
            }
        }
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:16,代码来源:PinchGesture.cs


示例15: __touchMove

        void __touchMove(EventContext context)
        {
            InputEvent evt = context.inputEvent;
            Vector2 pt1 = _host.GlobalToLocal(Stage.inst.GetTouchPosition(_touches[0]));
            Vector2 pt2 = _host.GlobalToLocal(Stage.inst.GetTouchPosition(_touches[1]));
            float dist = Vector2.Distance(pt1, pt2);

            if (!_started && Mathf.Abs(dist - _startDistance) > UIConfig.touchDragSensitivity)
            {
                _started = true;
                scale = 1;
                _lastScale = 1;

                onBegin.Call(evt);
            }

            if (_started)
            {
                float ss = dist / _startDistance;
                delta = ss - _lastScale;
                _lastScale = ss;
                this.scale += delta;
                onAction.Call(evt);
            }
        }
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:25,代码来源:PinchGesture.cs


示例16: __touchMove2

        private void __touchMove2(EventContext context)
        {
            InputEvent evt = context.inputEvent;
            if (_dragTouchId != -1 && _dragTouchId != evt.touchId || this.parent == null)
                return;

            if (displayObject == null || displayObject.isDisposed)
                return;

            float xx = evt.x - sGlobalDragStart.x + sGlobalRect.x;
            float yy = evt.y - sGlobalDragStart.y + sGlobalRect.y;

            if (dragBounds != null)
            {
                Rect rect = GRoot.inst.LocalToGlobal((Rect)dragBounds);
                if (xx < rect.x)
                    xx = rect.x;
                else if (xx + sGlobalRect.width > rect.xMax)
                {
                    xx = rect.xMax - sGlobalRect.width;
                    if (xx < rect.x)
                        xx = rect.x;
                }

                if (yy < rect.y)
                    yy = rect.y;
                else if (yy + sGlobalRect.height > rect.yMax)
                {
                    yy = rect.yMax - sGlobalRect.height;
                    if (yy < rect.y)
                        yy = rect.y;
                }
            }

            Vector2 pt = this.parent.GlobalToLocal(new Vector2(xx, yy));
            if (float.IsNaN(pt.x))
                return;

            sUpdateInDragging = true;
            this.SetXY(Mathf.RoundToInt(pt.x), Mathf.RoundToInt(pt.y));
            sUpdateInDragging = false;

            onDragMove.Call();
        }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:44,代码来源:GObject.cs


示例17: __stageTouchBegin

        void __stageTouchBegin(EventContext context)
        {
            if (_tooltipWin != null)
                HideTooltips();

            CheckPopups();
        }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:7,代码来源:GRoot.cs


示例18: __clickItem

        private void __clickItem(EventContext context)
        {
            if (dropdown.parent is GRoot)
                ((GRoot)dropdown.parent).HidePopup(dropdown);
            _selectedIndex = _list.GetChildIndex((GObject)context.data);
            if (_selectedIndex >= 0)
                this.text = _items[_selectedIndex];
            else
                this.text = string.Empty;

            onChanged.Call();
        }
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:12,代码来源:GComboBox.cs


示例19: __focusOut

		void __focusOut(EventContext contxt)
		{
			if (_mobileInputAdapter != null)
			{
				_mobileInputAdapter.CloseKeyboard();
			}

			if (_caret != null)
			{
				_caret.SetParent(null);
				_caret = null;
				_highlighter.SetParent(null);
				_highlighter = null;
			}
		}
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:15,代码来源:TextField.cs


示例20: __touchBegin

        private void __touchBegin(EventContext context)
        {
            _down = true;

            if (dropdown != null)
                ShowDropdown();

            context.CaptureTouch();
        }
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:9,代码来源:GComboBox.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FairyGUI.GObject类代码示例发布时间:2022-05-24
下一篇:
C# Facebook.FacebookClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap