LeaveClipping() public method

public LeaveClipping ( ) : void
return void
示例#1
0
 static public int LeaveClipping(IntPtr l)
 {
     try {
         FairyGUI.UpdateContext self = (FairyGUI.UpdateContext)checkSelf(l);
         self.LeaveClipping();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#2
0
        override public void Update(UpdateContext context)
        {
            base.Update(context);

            if (_paintingMode != 0 && paintingGraphics.texture != null)
            {
                context.PushRenderTarget(paintingGraphics.texture, new Vector2(_renderRect.x, _renderRect.y));
            }

            if (_clipRect != null)
            {
                //在这里可以直接使用 _localToWorldMatrix, 因为已经更新
                Rect      clipRect = (Rect)_clipRect;
                Matrix4x4 mat      = Matrix4x4.Identity;
                ToolSet.TransformRect(ref clipRect, ref _localToWorldMatrix, ref mat);
                context.EnterClipping(this.id, clipRect);
            }

            float savedAlpha = context.alpha;

            context.alpha *= this.alpha;
            bool savedGrayed = context.grayed;

            context.grayed = context.grayed || this.grayed;

            int cnt = _children.Count;

            for (int i = 0; i < cnt; i++)
            {
                DisplayObject child = _children[i];
                if (child.visible)
                {
                    child.Update(context);
                }
            }

            if (_clipRect != null)
            {
                context.LeaveClipping();
            }

            if (_paintingMode != 0 && paintingGraphics.texture != null)
            {
                context.PopRenderTarget();
                paintingGraphics.Render(_renderRect, _renderScale, _renderRotation, 1, context);
            }

            context.alpha  = savedAlpha;
            context.grayed = savedGrayed;
        }
示例#3
0
        override public void Update(UpdateContext context)
        {
            if (_disabled)
            {
                return;
            }

            base.Update(context);

            if (_cacheAsBitmap && _paintingMode != 0 && _paintingFlag == 2)
            {
                if (onUpdate != null)
                {
                    onUpdate();
                }
                return;
            }

            if (_mask != null)
            {
                context.EnterClipping(this.id, null, null, reversedMask);
            }
            else if (_clipRect != null)
            {
                context.EnterClipping(this.id, this.TransformRect((Rect)_clipRect, null), clipSoftness, false);
            }

            float savedAlpha = context.alpha;

            context.alpha *= this.alpha;
            bool savedGrayed = context.grayed;

            context.grayed = context.grayed || this.grayed;

            if (_fBatching)
            {
                context.batchingDepth++;
            }

            if (context.batchingDepth > 0)
            {
                int cnt = _children.Count;
                for (int i = 0; i < cnt; i++)
                {
                    DisplayObject child = _children[i];
                    if (child.visible)
                    {
                        child.Update(context);
                    }
                }
            }
            else
            {
                if (_mask != null)
                {
                    _mask.renderingOrder = context.renderingOrder++;
                }

                int cnt = _children.Count;
                for (int i = 0; i < cnt; i++)
                {
                    DisplayObject child = _children[i];
                    if (child.visible)
                    {
                        if (child != _mask)
                        {
                            child.renderingOrder = context.renderingOrder++;
                        }

                        child.Update(context);
                    }
                }

                if (_mask != null)
                {
                    _mask.graphics._SetStencilEraserOrder(context.renderingOrder++);
                }
            }

            if (_fBatching)
            {
                if (context.batchingDepth == 1)
                {
                    SetRenderingOrder(context);
                }
                context.batchingDepth--;
            }

            context.alpha  = savedAlpha;
            context.grayed = savedGrayed;

            if (_clipRect != null || _mask != null)
            {
                context.LeaveClipping();
            }

            if (_paintingMode > 0 && paintingGraphics.texture != null)
            {
                UpdateContext.OnEnd += _captureDelegate;
            }

            if (onUpdate != null)
            {
                onUpdate();
            }
        }
		internal void _AfterClip(UpdateContext context)
		{
			if (_highlighter != null)
				_highlighter.grahpics.UpdateMaterial(context);

			context.LeaveClipping();

			if (_caret != null) //不希望光标发生剪切,所以放到LeaveClipping后
			{
				_caret.grahpics.UpdateMaterial(context);
				_caret.Blink();
			}
		}
示例#5
0
        override public void Update(UpdateContext context)
        {
            if ((_flags & Flags.UserGameObject) != 0 && !gameObject.activeInHierarchy)
            {
                return;
            }

            base.Update(context);

            if (_paintingMode != 0)
            {
                if ((_flags & Flags.CacheAsBitmap) != 0 && _paintingInfo.flag == 2)
                {
                    if (onUpdate != null)
                    {
                        onUpdate();
                    }
                    return;
                }

                context.EnterPaintingMode();
            }

            if (_mask != null)
            {
                context.EnterClipping(this.id, reversedMask);
                if (_mask.graphics != null)
                {
                    _mask.graphics._PreUpdateMask(context, _mask.id);
                }
            }
            else if (_clipRect != null)
            {
                context.EnterClipping(this.id, this.TransformRect((Rect)_clipRect, null), clipSoftness);
            }

            float savedAlpha = context.alpha;

            context.alpha *= this.alpha;
            bool savedGrayed = context.grayed;

            context.grayed = context.grayed || this.grayed;

            if ((_flags & Flags.FairyBatching) != 0)
            {
                context.batchingDepth++;
            }

            if (context.batchingDepth > 0)
            {
                int cnt = _children.Count;
                for (int i = 0; i < cnt; i++)
                {
                    DisplayObject child = _children[i];
                    if ((child._flags & Flags.GameObjectDisposed) != 0)
                    {
                        child.DisplayDisposedWarning();
                        continue;
                    }

                    if (child.visible)
                    {
                        child.Update(context);
                    }
                }
            }
            else
            {
                if (_mask != null)
                {
                    _mask.renderingOrder = context.renderingOrder++;
                }

                int cnt = _children.Count;
                for (int i = 0; i < cnt; i++)
                {
                    DisplayObject child = _children[i];
                    if ((child._flags & Flags.GameObjectDisposed) != 0)
                    {
                        child.DisplayDisposedWarning();
                        continue;
                    }

                    if (child.visible)
                    {
                        if (!(child.graphics != null && child.graphics._maskFlag == 1)) //if not a mask
                        {
                            child.renderingOrder = context.renderingOrder++;
                        }

                        child.Update(context);
                    }
                }

                if (_mask != null)
                {
                    if (_mask.graphics != null)
                    {
                        _mask.graphics._SetStencilEraserOrder(context.renderingOrder++);
                    }
                }
            }

            if ((_flags & Flags.FairyBatching) != 0)
            {
                if (context.batchingDepth == 1)
                {
                    SetRenderingOrder(context);
                }
                context.batchingDepth--;
            }

            context.alpha  = savedAlpha;
            context.grayed = savedGrayed;

            if (_clipRect != null || _mask != null)
            {
                context.LeaveClipping();
            }

            if (_paintingMode != 0)
            {
                context.LeavePaintingMode();
                UpdateContext.OnEnd += _paintingInfo.captureDelegate;
            }

            if (onUpdate != null)
            {
                onUpdate();
            }
        }
示例#6
0
        override public void Update(UpdateContext context, float parentAlpha)
        {
            _skipRendering = gOwner != null && gOwner.parent != null && !gOwner.parent.IsChildInView(gOwner);
            if (_skipRendering)
            {
                if (gameObject.activeSelf)
                {
                    gameObject.SetActive(false);
                }
                return;
            }
            else if (!gameObject.activeSelf && this.visible)
            {
                gameObject.SetActive(true);
            }

            if (onUpdate != null)
            {
                onUpdate();
            }

            if (_clipRect != null)
            {
                context.EnterClipping(this);
            }

            float thisAlpha = parentAlpha * this.alpha;

            if (_fBatching && !_fBatchingInherited)
            {
                if (_fBatchingRequested)
                {
                    DoFairyBatching();
                }

                this.tmpZ          = 0f;
                context.allotingZ += PresetZOrder(0f);
            }

            if (_fBatching || _fBatchingInherited)
            {
                foreach (DisplayObject child in _children)
                {
                    if (child.visible)
                    {
                        context.counter++;
                        child.z = child.tmpZ - this.tmpZ;
                        child.Update(context, thisAlpha);
                    }
                }
            }
            else
            {
                foreach (DisplayObject child in _children)
                {
                    if (child.visible)
                    {
                        context.counter++;

                        if (child.z <= context.allotingZ && (context.allotingZ - child.z) < 1)
                        {
                            context.allotingZ = child.z;                            //optimize not change obj.z;
                        }
                        else
                        {
                            child.z = context.allotingZ;
                        }
                        context.allotingZ -= 0.001f;

                        float savedZ = context.allotingZ;
                        context.allotingZ = 0f;
                        child.Update(context, thisAlpha);
                        context.allotingZ += savedZ;
                    }
                }
            }

            if (_clipRect != null)
            {
                context.LeaveClipping();
            }
        }
        public override void Update(UpdateContext context)
        {
            if (_disabled)
                return;

            if (onUpdate != null)
                onUpdate();

            base.Update(context);

            if (_mask != null)
                context.EnterClipping(this.id, null, null);
            else if (_clipRect != null)
                context.EnterClipping(this.id, this.TransformRect((Rect)_clipRect, null), clipSoftness);

            float savedAlpha = context.alpha;
            context.alpha *= this.alpha;
            bool savedGrayed = context.grayed;
            context.grayed = context.grayed || this.grayed;

            if (_fBatching)
                context.batchingDepth++;

            if (context.batchingDepth > 0)
            {
                if (_mask != null)
                    _mask.graphics.maskFrameId = UpdateContext.frameId;

                int cnt = _children.Count;
                for (int i = 0; i < cnt; i++)
                {
                    DisplayObject child = _children[i];
                    if (child.visible)
                        child.Update(context);
                }
            }
            else
            {
                if (_mask != null)
                {
                    _mask.graphics.maskFrameId = UpdateContext.frameId;
                    _mask.renderingOrder = context.renderingOrder++;
                }

                int cnt = _children.Count;
                for (int i = 0; i < cnt; i++)
                {
                    DisplayObject child = _children[i];
                    if (child.visible)
                    {
                        if (child != _mask)
                            child.renderingOrder = context.renderingOrder++;

                        child.Update(context);
                    }
                }

                if (_mask != null)
                    _mask.graphics.SetStencilEraserOrder(context.renderingOrder++);
            }

            if (_fBatching)
            {
                if (context.batchingDepth == 1)
                    SetRenderingOrder(context);
                context.batchingDepth--;
            }

            context.alpha = savedAlpha;
            context.grayed = savedGrayed;

            if (_clipRect != null || _mask != null)
                context.LeaveClipping();

            if (_paintingMode > 0 && paintingGraphics.texture != null)
                UpdateContext.OnEnd += _captureDelegate;
        }
示例#8
0
		public override void Update(UpdateContext context)
		{
			if (_mobileInputAdapter != null)
			{
				if (_mobileInputAdapter.done)
				{
					UpdateContext.OnEnd += () =>
					{
						//将促使一个onFocusOut事件的调用。如果不focus-out,则在键盘关闭后,玩家再次点击文本,focus-in不会触发,键盘不会打开
						//另外也使开发者有机会得到一个键盘关闭的通知
						Stage.inst.focus = null;
					};
				}

				string s = _mobileInputAdapter.GetInput();

				if (s != null && s != _text)
				{
					if (s.Length > _maxLength)
						s = s.Substring(0, _maxLength);
					this.text = s;
					UpdateContext.OnEnd += () => { onChanged.Call(); };
				}
			}

			if (_caret != null)
			{
				string s = Input.inputString;
				if (!string.IsNullOrEmpty(s))
				{
					StringBuilder sb = new StringBuilder();
					for (int i = 0; i < s.Length; ++i)
					{
						char ch = s[i];
						if (ch >= ' ') sb.Append(ch.ToString());
					}
					if (sb.Length > 0)
					{
						s = sb.ToString();
						if (_text.Length + s.Length > _maxLength)
							s = s.Substring(0, _text.Length - maxLength);
						InsertText(s);
					}
				}
			}

			if (_font != null)
			{
				if (_font.mainTexture != graphics.texture)
				{
					if (!_textChanged)
						RequestText();
					graphics.texture = _font.mainTexture;
					_requireUpdateMesh = true;
				}

				if (_textChanged)
					BuildLines();

				if (_requireUpdateMesh)
					BuildMesh();
			}

			if (_input)
			{
				Rect rect = _contentRect;
				rect.x += GUTTER_X;
				rect.y += GUTTER_Y;
				rect.width -= GUTTER_X * 2;
				rect.height -= GUTTER_Y * 2;
				context.EnterClipping(this.id, this.TransformRect(rect, null), null);

				base.Update(context);

				if (_highlighter != null)
					_highlighter.grahpics.UpdateMaterial(context);

				context.LeaveClipping();

				if (_caret != null) //不希望光标发生剪切,所以放到LeaveClipping后
				{
					_caret.grahpics.UpdateMaterial(context);
					_caret.Blink();
				}
			}
			else
				base.Update(context);
		}
示例#9
0
        override public void Update(UpdateContext context)
        {
            _skipRendering = gOwner != null && gOwner.parent != null && !gOwner.parent.IsChildInView(gOwner);
            if (_skipRendering)
            {
                return;
            }

            if (_onUpdate != null)
            {
                _onUpdate();
            }

            if (_mask != null)
            {
                context.EnterClipping(this._internalIndex, null, null);
            }
            else if (_clipRect != null)
            {
                context.EnterClipping(this._internalIndex, this.TransformRect((Rect)_clipRect, null), _clipSoftness);
            }

            _alphaInFrame = parent != null ? (parent._alphaInFrame * this.alpha) : this.alpha;

            if (_fBatching && !_fBatchingInherited)
            {
                if (_fBatchingRequested)
                {
                    DoFairyBatching();
                }

                context.batchingDepth++;
                SetRenderingOrder(context);
            }

            if ((_fBatching || _fBatchingInherited) && context.batchingDepth > 0)
            {
                int cnt = _children.Count;
                for (int i = 0; i < cnt; i++)
                {
                    DisplayObject child = _children[i];
                    if (child.visible)
                    {
                        context.counter++;
                        child.Update(context);
                        if (child.graphics != null)
                        {
                            child.graphics.alpha = _alphaInFrame * child.alpha;
                        }
                    }
                }
            }
            else
            {
                if (_mask != null)
                {
                    _mask.graphics.maskFrameId = context.frameId;
                    _mask.renderingOrder       = context.renderingOrder;
                    context.renderingOrder++;
                }

                int cnt = _children.Count;
                for (int i = 0; i < cnt; i++)
                {
                    DisplayObject child = _children[i];
                    if (child.visible)
                    {
                        context.counter++;
                        if (!(child is Container) && child != _mask)
                        {
                            child.renderingOrder    = context.renderingOrder;
                            context.renderingOrder += 3;
                        }

                        child.Update(context);
                        if (child.graphics != null)
                        {
                            child.graphics.alpha = _alphaInFrame * child.alpha;
                        }
                    }
                }
            }

            if (_fBatching && !_fBatchingInherited)
            {
                context.batchingDepth--;
            }

            if (_clipRect != null || _mask != null)
            {
                context.LeaveClipping();
            }
        }
示例#10
0
        public override void Update(UpdateContext context, float parentAlpha)
        {
            _skipRendering = gOwner != null && gOwner.parent != null && !gOwner.parent.IsChildInView(gOwner);
            if (_skipRendering)
            {
                if (gameObject.activeSelf)
                    gameObject.SetActive(false);
                return;
            }
            else if (!gameObject.activeSelf && this.visible)
                gameObject.SetActive(true);

            if (onUpdate != null)
                onUpdate();

            if (_clipRect != null)
                context.EnterClipping(this);

            float thisAlpha = parentAlpha * this.alpha;
            if (_fBatching && !_fBatchingInherited)
            {
                if (_fBatchingRequested)
                {
                    DoFairyBatching();
                }

                this.tmpZ = 0f;
                context.allotingZ += PresetZOrder(0f);
            }

            if (_fBatching || _fBatchingInherited)
            {
                foreach (DisplayObject child in _children)
                {
                    if (child.visible)
                    {
                        context.counter++;
                        child.z = child.tmpZ - this.tmpZ;
                        child.Update(context, thisAlpha);
                    }
                }
            }
            else
            {
                foreach (DisplayObject child in _children)
                {
                    if (child.visible)
                    {
                        context.counter++;

                        if (child.z <= context.allotingZ && (context.allotingZ - child.z) < 1)
                            context.allotingZ = child.z;//optimize not change obj.z;
                        else
                            child.z = context.allotingZ;
                        context.allotingZ -= 0.001f;

                        float savedZ = context.allotingZ;
                        context.allotingZ = 0f;
                        child.Update(context, thisAlpha);
                        context.allotingZ += savedZ;
                    }
                }
            }

            if (_clipRect != null)
                context.LeaveClipping();
        }
示例#11
0
		override public void Update(UpdateContext context)
		{
			if (_disabled)
				return;

			base.Update(context);

			if (_mask != null)
				context.EnterClipping(this.id, null, null);
			else if (_clipRect != null)
				context.EnterClipping(this.id, this.TransformRect((Rect)_clipRect, null), clipSoftness);

			float savedAlpha = context.alpha;
			context.alpha *= this.alpha;
			bool savedGrayed = context.grayed;
			context.grayed = context.grayed || this.grayed;

			if (_fBatching)
				context.batchingDepth++;

			if (context.batchingDepth > 0)
			{
				if (_mask != null)
					_mask.graphics.maskFrameId = UpdateContext.frameId;

				int cnt = _children.Count;
				for (int i = 0; i < cnt; i++)
				{
					DisplayObject child = _children[i];
					if (child.visible)
						child.Update(context);
				}
			}
			else
			{
				if (_mask != null)
				{
					_mask.graphics.maskFrameId = UpdateContext.frameId;
					_mask.renderingOrder = context.renderingOrder++;
				}

				int cnt = _children.Count;
				for (int i = 0; i < cnt; i++)
				{
					DisplayObject child = _children[i];
					if (child.visible)
					{
						if (child != _mask)
							child.renderingOrder = context.renderingOrder++;

						child.Update(context);
					}
				}

				if (_mask != null)
					_mask.graphics.SetStencilEraserOrder(context.renderingOrder++);
			}

			if (_fBatching)
			{
				if (context.batchingDepth == 1)
					SetRenderingOrder(context);
				context.batchingDepth--;
			}

			context.alpha = savedAlpha;
			context.grayed = savedGrayed;

			if (_clipRect != null || _mask != null)
				context.LeaveClipping();

			if (_paintingMode > 0 && paintingGraphics.texture != null)
				UpdateContext.OnEnd += _captureDelegate;

			if (onUpdate != null)
				onUpdate();
		}