Exemple #1
0
    /// <summary>
    /// Update the clipping rect in the shaders and draw calls' positions.
    /// </summary>

    void UpdateDrawcalls()
    {
        Vector4 range = Vector4.zero;

        if (mClipping != UIDrawCall.Clipping.None)
        {
            range = new Vector4(mClipRange.x, mClipRange.y, mClipRange.z * 0.5f, mClipRange.w * 0.5f);
        }

        if (range.z == 0f)
        {
            range.z = Screen.width * 0.5f;
        }
        if (range.w == 0f)
        {
            range.w = Screen.height * 0.5f;
        }

        RuntimePlatform platform = Application.platform;

        if (platform == RuntimePlatform.WindowsPlayer ||
            platform == RuntimePlatform.WindowsWebPlayer ||
            platform == RuntimePlatform.WindowsEditor)
        {
            range.x -= 0.5f;
            range.y += 0.5f;
        }
        UIDrawCall.Update(this);
    }
Exemple #2
0
    /// <summary>
    /// Main update function
    /// </summary>

    void LateUpdate()
    {
        // Only the very first panel should be doing the update logic
        if (list[0] != this)
        {
            return;
        }

        // Update all panels
        for (int i = 0; i < list.size; ++i)
        {
            UIPanel panel = list[i];
            panel.mUpdateTime = RealTime.time;
            panel.UpdateTransformMatrix();
            panel.UpdateLayers();
            panel.UpdateWidgets();
        }

        if (mRebuild)
        {
            Fill();
        }
        else
        {
            BetterList <UIDrawCall> dcs = UIDrawCall.activeList;

            for (int i = 0; i < dcs.size;)
            {
                UIDrawCall dc = dcs.buffer[i];

                if (dc.isDirty && !Fill(dc))
                {
                    UIDrawCall.Destroy(dc);
                    continue;
                }
                ++i;
            }
        }

        // Update the clipping rects
        for (int i = 0; i < list.size; ++i)
        {
            UIDrawCall.Update(list[i]);
        }
        mRebuild = false;
    }