Exemple #1
0
    private void UpdateWidgets()
    {
        bool flag  = false;
        bool flag2 = false;
        bool hasCumulativeClipping = this.hasCumulativeClipping;

        if (!this.cullWhileDragging)
        {
            for (int i = 0; i < UIScrollView.list.size; i++)
            {
                UIScrollView uIScrollView = UIScrollView.list[i];
                if (uIScrollView.panel == this && uIScrollView.isDragging)
                {
                    flag2 = true;
                }
            }
        }
        if (this.mForced != flag2)
        {
            this.mForced  = flag2;
            this.mResized = true;
        }
        int frameCount = Time.frameCount;
        int j          = 0;
        int count      = this.widgets.Count;

        while (j < count)
        {
            UIWidget uIWidget = this.widgets[j];
            if (uIWidget.panel == this && uIWidget.enabled)
            {
                if (uIWidget.UpdateTransform(frameCount) || this.mResized)
                {
                    bool visibleByAlpha = flag2 || uIWidget.CalculateCumulativeAlpha(frameCount) > 0.001f;
                    uIWidget.UpdateVisibility(visibleByAlpha, flag2 || (!hasCumulativeClipping && !uIWidget.hideIfOffScreen) || this.IsVisible(uIWidget));
                }
                if (uIWidget.UpdateGeometry(frameCount))
                {
                    flag = true;
                    if (!this.mRebuild)
                    {
                        if (uIWidget.drawCall != null)
                        {
                            uIWidget.drawCall.isDirty = true;
                        }
                        else
                        {
                            this.FindDrawCall(uIWidget);
                        }
                    }
                }
            }
            j++;
        }
        if (flag && this.onGeometryUpdated != null)
        {
            this.onGeometryUpdated();
        }
        this.mResized = false;
    }
Exemple #2
0
    private void UpdateWidgets()
    {
        bool flag  = !cullWhileDragging && mCullTime > mUpdateTime;
        bool flag2 = false;

        if (mForced != flag)
        {
            mForced  = flag;
            mResized = true;
        }
        bool hasCumulativeClipping = this.hasCumulativeClipping;
        int  i = 0;

        for (int count = widgets.Count; i < count; i++)
        {
            UIWidget uIWidget = widgets[i];
            if (!(uIWidget.panel == this) || !uIWidget.enabled)
            {
                continue;
            }
            int frameCount = Time.frameCount;
            if (uIWidget.UpdateTransform(frameCount) || mResized)
            {
                bool visibleByAlpha = flag || uIWidget.CalculateCumulativeAlpha(frameCount) > 0.001f;
                uIWidget.UpdateVisibility(visibleByAlpha, flag || (!hasCumulativeClipping && !uIWidget.hideIfOffScreen) || IsVisible(uIWidget));
            }
            if (!uIWidget.UpdateGeometry(frameCount))
            {
                continue;
            }
            flag2 = true;
            if (!mRebuild)
            {
                if (uIWidget.drawCall != null)
                {
                    uIWidget.drawCall.isDirty = true;
                }
                else
                {
                    FindDrawCall(uIWidget);
                }
            }
        }
        if (flag2 && onGeometryUpdated != null)
        {
            onGeometryUpdated();
        }
        mResized = false;
    }
Exemple #3
0
    private void UpdateWidgets()
    {
        bool flag  = !this.cullWhileDragging && this.mCullTime > this.mUpdateTime;
        bool flag2 = false;

        if (this.mForced != flag)
        {
            this.mForced  = flag;
            this.mResized = true;
        }
        bool clipsChildren = this.clipsChildren;
        int  i             = 0;
        int  size          = this.widgets.size;

        while (i < size)
        {
            UIWidget uIWidget = this.widgets.buffer[i];
            if (uIWidget.panel == this && uIWidget.enabled)
            {
                int frameCount = Time.frameCount;
                if (uIWidget.UpdateTransform(frameCount) || this.mResized)
                {
                    bool visibleByAlpha = flag || uIWidget.CalculateCumulativeAlpha(frameCount) > 0.001f;
                    uIWidget.UpdateVisibility(visibleByAlpha, flag || (!clipsChildren && !uIWidget.hideIfOffScreen) || this.IsVisible(uIWidget));
                }
                if (uIWidget.UpdateGeometry(frameCount))
                {
                    flag2 = true;
                    if (!this.mRebuild)
                    {
                        if (uIWidget.drawCall != null)
                        {
                            uIWidget.drawCall.isDirty = true;
                        }
                        else
                        {
                            this.FindDrawCall(uIWidget);
                        }
                    }
                }
            }
            i++;
        }
        if (flag2 && this.onGeometryUpdated != null)
        {
            this.onGeometryUpdated();
        }
        this.mResized = false;
    }
Exemple #4
0
 static public int CalculateCumulativeAlpha(IntPtr l)
 {
     try {
         UIWidget     self = (UIWidget)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         var ret = self.CalculateCumulativeAlpha(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #5
0
	static int CalculateCumulativeAlpha(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			UIWidget obj = (UIWidget)ToLua.CheckObject<UIWidget>(L, 1);
			int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
			float o = obj.CalculateCumulativeAlpha(arg0);
			LuaDLL.lua_pushnumber(L, o);
			return 1;
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Exemple #6
0
    private void UpdateWidgets()
    {
        Boolean flag  = false;
        Boolean flag2 = false;
        Boolean hasCumulativeClipping = this.hasCumulativeClipping;

        if (!this.cullWhileDragging)
        {
            for (Int32 i = 0; i < UIScrollView.list.size; i++)
            {
                UIScrollView uiscrollView = UIScrollView.list[i];
                if (uiscrollView.panel == this && uiscrollView.isDragging)
                {
                    flag2 = true;
                }
            }
        }
        if (this.mForced != flag2)
        {
            this.mForced  = flag2;
            this.mResized = true;
        }
        Int32 frameCount = Time.frameCount;
        Int32 j          = 0;
        Int32 count      = this.widgets.Count;

        while (j < count)
        {
            UIWidget uiwidget = (UIWidget)null;
            try
            {
                uiwidget = this.widgets[j];
            }
            catch
            {
                goto IL_183;
            }
            goto IL_B6;
IL_183:
            j++;
            continue;
IL_B6:
            if (!(uiwidget.panel == this) || !uiwidget.enabled)
            {
                goto IL_183;
            }
            if (uiwidget.UpdateTransform(frameCount) || this.mResized)
            {
                Boolean visibleByAlpha = flag2 || uiwidget.CalculateCumulativeAlpha(frameCount) > 0.001f;
                uiwidget.UpdateVisibility(visibleByAlpha, flag2 || (!hasCumulativeClipping && !uiwidget.hideIfOffScreen) || this.IsVisible(uiwidget));
            }
            if (!uiwidget.UpdateGeometry(frameCount))
            {
                goto IL_183;
            }
            flag = true;
            if (this.mRebuild)
            {
                goto IL_183;
            }
            if (uiwidget.drawCall != (UnityEngine.Object)null)
            {
                uiwidget.drawCall.isDirty = true;
                goto IL_183;
            }
            this.FindDrawCall(uiwidget);
            goto IL_183;
        }
        if (flag && this.onGeometryUpdated != null)
        {
            this.onGeometryUpdated();
        }
        this.mResized = false;
    }
Exemple #7
0
	/// <summary>
	/// Update all of the widgets belonging to this panel.
	/// </summary>

	void UpdateWidgets()
	{
#if UNITY_EDITOR
		bool forceVisible = cullWhileDragging ? false : (Application.isPlaying && mCullTime > mUpdateTime);
#else
		bool forceVisible = cullWhileDragging ? false : (mCullTime > mUpdateTime);
#endif
		bool changed = false;

		if (mForced != forceVisible)
		{
			mForced = forceVisible;
			mResized = true;
		}

		bool clipped = hasCumulativeClipping;

		// Update all widgets
		for (int i = 0, imax = widgets.Count; i < imax; ++i)
		{
			UIWidget w = widgets[i];

			// If the widget is visible, update it
			if (w.panel == this && w.enabled)
			{
#if UNITY_EDITOR
				// When an object is dragged from Project view to Scene view, its Z is...
				// odd, to say the least. Force it if possible.
				if (!Application.isPlaying)
				{
					Transform t = w.cachedTransform;

					if (t.hideFlags != HideFlags.HideInHierarchy)
					{
						t = (t.parent != null && t.parent.hideFlags == HideFlags.HideInHierarchy) ?
							t.parent : null;
					}

					if (t != null)
					{
						for (; ; )
						{
							if (t.parent == null) break;
							if (t.parent.hideFlags == HideFlags.HideInHierarchy) t = t.parent;
							else break;
						}

						if (t != null)
						{
							Vector3 pos = t.localPosition;
							pos.x = Mathf.Round(pos.x);
							pos.y = Mathf.Round(pos.y);
							pos.z = 0f;

							if (Vector3.SqrMagnitude(t.localPosition - pos) > 0.0001f)
								t.localPosition = pos;
						}
					}
				}
#endif
				int frame = Time.frameCount;

				// First update the widget's transform
				if (w.UpdateTransform(frame) || mResized)
				{
					// Only proceed to checking the widget's visibility if it actually moved
					bool vis = forceVisible || (w.CalculateCumulativeAlpha(frame) > 0.001f);
					w.UpdateVisibility(vis, forceVisible || ((clipped || w.hideIfOffScreen) ? IsVisible(w) : true));
				}
				
				// Update the widget's geometry if necessary
				if (w.UpdateGeometry(frame))
				{
					changed = true;

					if (!mRebuild)
					{
						if (w.drawCall != null)
						{
							w.drawCall.isDirty = true;
						}
						else
						{
							// Find an existing draw call, if possible
							FindDrawCall(w);
						}
					}
				}
			}
		}

		// Inform the changed event listeners
		if (changed && onGeometryUpdated != null) onGeometryUpdated();
		mResized = false;
	}