Update() публичный Метод

public Update ( UpdateContext context ) : void
context UpdateContext
Результат void
Пример #1
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;
        }
 static public int Update(IntPtr l)
 {
     try {
         FairyGUI.DisplayObject self = (FairyGUI.DisplayObject)checkSelf(l);
         FairyGUI.UpdateContext a1;
         checkType(l, 2, out a1);
         self.Update(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #3
0
		public override void Update()
		{
			base.Update();

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

			if (gOwner != null && (gOwner is GComponent))
				((GComponent)gOwner).OnUpdate();
		}
Пример #4
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();
            }
        }
Пример #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)
        {
            _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();
            }
        }
Пример #7
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();
		}