示例#1
0
 public Material this[UIDrawCall.Clipping clipping]
 {
     get
     {
         UIMaterial.ClippingFlags clippingFlag = (UIMaterial.ClippingFlags)((int)UIDrawCall.Clipping.HardClip << (int)(clipping & (UIDrawCall.Clipping.HardClip | UIDrawCall.Clipping.AlphaClip | UIDrawCall.Clipping.SoftClip)));
         if ((clippingFlag & this.madeMats) != clippingFlag)
         {
             return this.MakeMaterial(clipping);
         }
         switch (clipping)
         {
             case UIDrawCall.Clipping.None:
             {
                 return this.matNone;
             }
             case UIDrawCall.Clipping.HardClip:
             {
                 return this.matHardClip;
             }
             case UIDrawCall.Clipping.AlphaClip:
             {
                 return this.matAlphaClip;
             }
             case UIDrawCall.Clipping.SoftClip:
             {
                 return this.matSoftClip;
             }
         }
         throw new NotImplementedException();
     }
 }
示例#2
0
    private static UIDrawCall Create(string name)
    {
        if (UIDrawCall.mInactiveList.size > 0)
        {
            UIDrawCall uidrawCall = UIDrawCall.mInactiveList.Pop();
            UIDrawCall.mActiveList.Add(uidrawCall);
            if (name != null)
            {
                uidrawCall.name = name;
            }
            NGUITools.SetActive(uidrawCall.gameObject, true);
            return(uidrawCall);
        }
        GameObject gameObject = new GameObject(name);

        UnityEngine.Object.DontDestroyOnLoad(gameObject);
        UIDrawCall uidrawCall2 = gameObject.AddComponent <UIDrawCall>();

        UIDrawCall.mActiveList.Add(uidrawCall2);
        return(uidrawCall2);
    }
    private static UIDrawCall Create(string name)
    {
        if (UIDrawCall.mInactiveList.size > 0)
        {
            UIDrawCall uIDrawCall = UIDrawCall.mInactiveList.Pop();
            UIDrawCall.mActiveList.Add(uIDrawCall);
            if (name != null)
            {
                uIDrawCall.set_name(name);
            }
            NGUITools.SetActive(uIDrawCall.get_gameObject(), true);
            return(uIDrawCall);
        }
        GameObject gameObject = new GameObject(name);

        Object.DontDestroyOnLoad(gameObject);
        UIDrawCall uIDrawCall2 = gameObject.AddComponent <UIDrawCall>();

        UIDrawCall.mActiveList.Add(uIDrawCall2);
        return(uIDrawCall2);
    }
示例#4
0
    /// <summary>
    /// Destroy the specified draw call.
    /// </summary>

    static public void Destroy(UIDrawCall dc)
    {
        if (dc)
        {
            dc.onRender = null;

            if (Application.isPlaying)
            {
                if (mActiveList.Remove(dc))
                {
                    NGUITools.SetActive(dc.gameObject, false);
                    mInactiveList.Add(dc);
                }
            }
            else
            {
                mActiveList.Remove(dc);
                NGUITools.DestroyImmediate(dc.gameObject);
            }
        }
    }
示例#5
0
    /// <summary>
    /// Get a draw call at the specified index position.
    /// </summary>

    UIDrawCall GetDrawCall(int index, Material mat)
    {
        if (index < UIDrawCall.list.size)
        {
            UIDrawCall dc = UIDrawCall.list.buffer[index];

            // If the material and texture match, keep using the same draw call
            if (dc != null && dc.panel == this && dc.baseMaterial == mat && dc.mainTexture == mat.mainTexture)
            {
                return(dc);
            }

            // Otherwise we need to destroy all the draw calls that follow
            for (int i = UIDrawCall.list.size; i > index;)
            {
                UIDrawCall rem = UIDrawCall.list.buffer[--i];
                DestroyDrawCall(rem, i);
            }
        }

#if UNITY_EDITOR
        // If we're in the editor, create the game object with hide flags set right away
        GameObject go = UnityEditor.EditorUtility.CreateGameObjectWithHideFlags("_UIDrawCall [" + mat.name + "]",
                                                                                //HideFlags.DontSave | HideFlags.NotEditable);
                                                                                HideFlags.HideAndDontSave);
#else
        GameObject go = new GameObject("_UIDrawCall [" + mat.name + "]");
        DontDestroyOnLoad(go);
#endif
        go.layer = cachedGameObject.layer;

        // Create the draw call
        UIDrawCall drawCall = go.AddComponent <UIDrawCall>();
        drawCall.baseMaterial = mat;
        drawCall.renderQueue  = UIDrawCall.list.size;
        drawCall.panel        = this;
        //Debug.Log("Added DC " + mat.name + " as " + UIDrawCall.list.size);
        UIDrawCall.list.Add(drawCall);
        return(drawCall);
    }
示例#6
0
    /// <summary>
    /// Update all of the widgets belonging to this panel.
    /// </summary>

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

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

            // If the widget is visible, update it
            if (w.enabled && w.panel == this && w.UpdateGeometry(this, forceVisible))
            {
                changed = true;
                if (mFullRebuild)
                {
                    continue;
                }
                UIDrawCall dc = w.drawCall;
                if (dc != null)
                {
                    dc.isDirty = true;
                }
                else
                {
                    mFullRebuild = true;
                }
            }
        }

        // Inform the changed event listeners
        if (changed && onChange != null)
        {
            onChange();
        }
    }
示例#7
0
    /// <summary>
    /// Create a new draw call, reusing an old one if possible.
    /// </summary>

    static UIDrawCall Create(string name)
    {
#if SHOW_HIDDEN_OBJECTS && UNITY_EDITOR
        name = (name != null) ? "_UIDrawCall [" + name + "]" : "DrawCall";
#endif
        if (mInactiveList.size > 0)
        {
            UIDrawCall dc = mInactiveList.Pop();
            dc.mIsEmpty = false;
            mActiveList.Add(dc);
            if (name != null)
            {
                dc.name = name;
            }
            NGUITools.SetActive(dc.gameObject, true);
            return(dc);
        }

#if UNITY_EDITOR
        // If we're in the editor, create the game object with hide flags set right away
        GameObject go = UnityEditor.EditorUtility.CreateGameObjectWithHideFlags(name,
#if SHOW_HIDDEN_OBJECTS
                                                                                HideFlags.DontSave, typeof(UIDrawCall));
#else
                                                                                HideFlags.HideAndDontSave, typeof(UIDrawCall));
#endif
        UIDrawCall newDC = go.GetComponent <UIDrawCall>();
#else
        GameObject go = new GameObject(name);
        DontDestroyOnLoad(go);
        UIDrawCall newDC = go.AddComponent <UIDrawCall>();
#endif
        //newDC.verts.Allocate(2048);
        //newDC.uvs.Allocate(2048);
        //newDC.cols.Allocate(2048);

        // Create the draw call
        mActiveList.Add(newDC);
        return(newDC);
    }
    static public void Destroy(UIDrawCall dc)
    {
        if (dc)
        {
            if (dc.onCreateDrawCall != null)
            {
                NGUITools.Destroy(dc.gameObject);
                return;
            }

            dc.onRender = null;

            if (Application.isPlaying)
            {
                if (mActiveList.Remove(dc))
                {
                    NGUITools.SetActive(dc.gameObject, false);
                    mInactiveList.Add(dc);
#if OPTIMISE_NGUI_GC_ALLOC
                    CachedGeometries.PushToCachedGeometries(dc.verts, dc.uvs, dc.cols);
                    dc.verts = new List <Vector3>();
                    dc.uvs   = new List <Vector2>();
                    dc.cols  = new List <Color>();
#endif
                    dc.mIsNew = true;
                }
            }
            else
            {
                mActiveList.Remove(dc);
#if SHOW_HIDDEN_OBJECTS && UNITY_EDITOR
                if (UnityEditor.Selection.activeGameObject == dc.gameObject)
                {
                    UnityEditor.Selection.activeGameObject = null;
                }
#endif
                NGUITools.DestroyImmediate(dc.gameObject);
            }
        }
    }
示例#9
0
    /// <summary>
    /// Invalidate the panel's draw calls, forcing them to be rebuilt on the next update.
    /// This call also affects all child panels.
    /// </summary>

    public void SetDirty()
    {
        UIDrawCall.SetDirty(this);

        for (int i = 0; i < UIWidget.list.size; ++i)
        {
            UIWidget w = UIWidget.list[i];
            if (w.panel == this)
            {
                w.MarkAsChangedLite();
            }
        }

        for (int i = 0; i < list.size; ++i)
        {
            UIPanel p = list[i];
            if (p != null && p != this && p.parent == this)
            {
                p.SetDirty();
            }
        }
    }
示例#10
0
 private void OnDestroy()
 {
     UserInterfacePortManager.ReleaseUtils.Releases(ref this.mTextures_Preload, false);
     UserInterfacePortManager.ReleaseUtils.Releases(ref this.mParticleSystems_Managed);
     ArsenalTaskManager._uiCommon     = null;
     ArsenalTaskManager._clsInputKey  = null;
     ArsenalTaskManager._clsTasks     = null;
     ArsenalTaskManager._clsArsenal   = null;
     ArsenalTaskManager._clsConstruct = null;
     ArsenalTaskManager._clsList      = null;
     ArsenalTaskManager.logicManager  = null;
     ArsenalTaskManager.soundManager  = null;
     ArsenalTaskManager.dialogPopUp   = null;
     ArsenalTaskManager.asyncObj      = null;
     ArsenalTaskManager.commonPopup   = null;
     ArsenalTaskManager._uiBgPanel    = null;
     Mem.DelAry <DeckModel>(ref ArsenalTaskManager._deck);
     Mem.DelAry <ShipModel>(ref ArsenalTaskManager._ship);
     Mem.DelAry <ShipModel>(ref ArsenalTaskManager._allShip);
     Mem.DelAry <BuildDockModel>(ref ArsenalTaskManager.dock);
     UIDrawCall.ReleaseInactive();
 }
示例#11
0
    public void UpdateDrawcalls()
    {
        Vector4 clipRange = Vector4.zero;

        if (mClipping != 0)
        {
            clipRange = new Vector4(mClipRange.x, mClipRange.y, mClipRange.z * 0.5f, mClipRange.w * 0.5f);
        }
        if (clipRange.z == 0f)
        {
            clipRange.z = (float)Screen.width * 0.5f;
        }
        if (clipRange.w == 0f)
        {
            clipRange.w = (float)Screen.height * 0.5f;
        }
        RuntimePlatform platform = Application.platform;

        if (platform == RuntimePlatform.WindowsPlayer || platform == RuntimePlatform.WindowsWebPlayer || platform == RuntimePlatform.WindowsEditor)
        {
            clipRange.x -= 0.5f;
            clipRange.y += 0.5f;
        }
        Transform cachedTransform = this.cachedTransform;
        int       i = 0;

        for (int size = mDrawCalls.size; i < size; i++)
        {
            UIDrawCall uIDrawCall = mDrawCalls.buffer[i];
            uIDrawCall.clipping     = mClipping;
            uIDrawCall.clipRange    = clipRange;
            uIDrawCall.clipSoftness = mClipSoftness;
            uIDrawCall.depthPass    = (depthPass && mClipping == UIDrawCall.Clipping.None);
            Transform transform = uIDrawCall.transform;
            transform.position   = cachedTransform.position;
            transform.rotation   = cachedTransform.rotation;
            transform.localScale = cachedTransform.lossyScale;
        }
    }
示例#12
0
    // Token: 0x06000501 RID: 1281 RVA: 0x00030B4C File Offset: 0x0002ED4C
    public static void ClearAll()
    {
        bool isPlaying = Application.isPlaying;
        int  i         = UIDrawCall.mActiveList.size;

        while (i > 0)
        {
            UIDrawCall uidrawCall = UIDrawCall.mActiveList.buffer[--i];
            if (uidrawCall)
            {
                if (isPlaying)
                {
                    NGUITools.SetActive(uidrawCall.gameObject, false);
                }
                else
                {
                    NGUITools.DestroyImmediate(uidrawCall.gameObject);
                }
            }
        }
        UIDrawCall.mActiveList.Clear();
    }
示例#13
0
    public static void ClearAll()
    {
        bool isPlaying = Application.isPlaying;
        int  num       = mActiveList.size;

        while (num > 0)
        {
            UIDrawCall uIDrawCall = mActiveList[--num];
            if ((bool)uIDrawCall)
            {
                if (isPlaying)
                {
                    NGUITools.SetActive(uIDrawCall.gameObject, state: false);
                }
                else
                {
                    NGUITools.DestroyImmediate(uIDrawCall.gameObject);
                }
            }
        }
        mActiveList.Clear();
    }
示例#14
0
 private void OnDestroy()
 {
     UserInterfacePortManager.ReleaseUtils.Releases(ref mTextures_Preload);
     UserInterfacePortManager.ReleaseUtils.Releases(ref mParticleSystems_Managed);
     _uiCommon     = null;
     _clsInputKey  = null;
     _clsTasks     = null;
     _clsArsenal   = null;
     _clsConstruct = null;
     _clsList      = null;
     logicManager  = null;
     soundManager  = null;
     dialogPopUp   = null;
     asyncObj      = null;
     commonPopup   = null;
     _uiBgPanel    = null;
     Mem.DelAry(ref _deck);
     Mem.DelAry(ref _ship);
     Mem.DelAry(ref _allShip);
     Mem.DelAry(ref dock);
     UIDrawCall.ReleaseInactive();
 }
示例#15
0
 static public int Create_s(IntPtr l)
 {
     try {
         UIPanel a1;
         checkType(l, 1, out a1);
         UnityEngine.Material a2;
         checkType(l, 2, out a2);
         UnityEngine.Texture a3;
         checkType(l, 3, out a3);
         UnityEngine.Shader a4;
         checkType(l, 4, out a4);
         UnityEngine.Texture a5;
         checkType(l, 5, out a5);
         var ret = UIDrawCall.Create(a1, a2, a3, a4, a5);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#16
0
	/// <summary>
	/// Fill the geometry for the specified draw call.
	/// </summary>

	bool FillDrawCall (UIDrawCall dc)
	{
		if (dc != null)
		{
			dc.isDirty = false;

			for (int i = 0; i < widgets.size; )
			{
				UIWidget w = widgets[i];

				if (w == null)
				{
#if UNITY_EDITOR
					Debug.LogError("This should never happen");
#endif
					widgets.RemoveAt(i);
					continue;
				}

				if (w.drawCall == dc)
				{
					if (w.isVisible && w.hasVertices)
					{
						if (generateNormals) w.WriteToBuffers(dc.verts, dc.uvs, dc.cols, dc.norms, dc.tans);
						else w.WriteToBuffers(dc.verts, dc.uvs, dc.cols, null, null);
					}
					else w.drawCall = null;
				}
				++i;
			}

			if (dc.verts.size != 0)
			{
				dc.UpdateGeometry();
				return true;
			}
		}
		return false;
	}
示例#17
0
    static UIDrawCall Create(string name)
    {
        if (mInactiveList.size > 0)
        {
            UIDrawCall dc = mInactiveList.Pop();
            mActiveList.Add(dc);
            if (name != null)
            {
                dc.name = name;
            }
            NGUITools.SetActive(dc.gameObject, true);
            return(dc);
        }

        GameObject go = new GameObject(name);

        DontDestroyOnLoad(go);
        UIDrawCall newDC = go.AddComponent <UIDrawCall>();

        mActiveList.Add(newDC);
        return(newDC);
    }
示例#18
0
    /// <summary>
    /// Clear all draw calls.
    /// </summary>

    static public void ClearAll()
    {
        bool playing = Application.isPlaying;

        for (int i = mActiveList.size; i > 0;)
        {
            UIDrawCall dc = mActiveList[--i];

            if (dc)
            {
                if (playing)
                {
                    NGUITools.SetActive(dc.gameObject, false);
                }
                else
                {
                    NGUITools.DestroyImmediate(dc.gameObject);
                }
            }
        }
        mActiveList.Clear();
    }
示例#19
0
 private void UpdateSelf()
 {
     this.mUpdateTime = RealTime.time;
     this.UpdateTransformMatrix();
     this.UpdateLayers();
     this.UpdateWidgets();
     if (this.mRebuild)
     {
         this.mRebuild = false;
         this.FillAllDrawCalls();
     }
     else
     {
         int i = 0;
         while (i < this.drawCalls.Count)
         {
             UIDrawCall uIDrawCall = this.drawCalls[i];
             if (uIDrawCall.isDirty && !this.FillDrawCall(uIDrawCall))
             {
                 UIDrawCall.Destroy(uIDrawCall);
                 this.drawCalls.RemoveAt(i);
             }
             else
             {
                 i++;
             }
         }
     }
     if (this.mUpdateScroll)
     {
         this.mUpdateScroll = false;
         UIScrollView component = base.GetComponent <UIScrollView>();
         if (component != null)
         {
             component.UpdateScrollbars();
         }
     }
 }
示例#20
0
 private void UpdateSelf()
 {
     mUpdateTime = RealTime.time;
     UpdateTransformMatrix();
     UpdateLayers();
     UpdateWidgets();
     if (mRebuild)
     {
         mRebuild = false;
         FillAllDrawCalls();
     }
     else
     {
         int num = 0;
         while (num < drawCalls.Count)
         {
             UIDrawCall uIDrawCall = drawCalls[num];
             if (uIDrawCall.isDirty && !FillDrawCall(uIDrawCall))
             {
                 UIDrawCall.Destroy(uIDrawCall);
                 drawCalls.RemoveAt(num);
             }
             else
             {
                 num++;
             }
         }
     }
     if (mUpdateScroll)
     {
         mUpdateScroll = false;
         UIScrollView component = GetComponent <UIScrollView>();
         if (component != null)
         {
             component.UpdateScrollbars();
         }
     }
 }
示例#21
0
    UIDrawCall FindDrawCall(UIWidget w)
    {
        // 机制:通过depth, mat/tex, visible的优先级判断;
        //      决定获取dc还是rebuild

        Material mat   = w.material;
        Texture  tex   = w.mainTexture;
        int      depth = w.depth;

        for (int i = 0; i < drawCalls.size; ++i)
        {
            UIDrawCall dc      = drawCalls.buffer[i];
            int        dcStart = (i == 0) ? int.MinValue : drawCalls.buffer[i - 1].depthEnd + 1;
            int        dcEnd   = (i + 1 == drawCalls.size) ? int.MaxValue : drawCalls.buffer[i + 1].depthStart - 1;

            // depth范围内;相同mat和tex;不同则rebuild
            if (dcStart <= depth && dcEnd >= depth)
            {
                if (dc.baseMaterial == mat && dc.mainTexture == tex)
                {
                    w.drawCall = dc;
                    if (w.hasVertices)
                    {
                        dc.isDirty = true;
                    }
                    return(dc);
                }
                else
                {
                    mRebuild = true;
                }
                return(null);
            }
        }

        mRebuild = true;
        return(null);
    }
示例#22
0
    internal void LinkedList__Remove()
    {
        if (this.mHasPrev)
        {
            this.mPrev.mHasNext = this.mHasNext;
            this.mPrev.mNext    = this.mNext;
        }
        if (this.mHasNext)
        {
            this.mNext.mHasPrev = this.mHasPrev;
            this.mNext.mPrev    = this.mPrev;
        }
        int  num  = 0;
        bool flag = (bool)num;

        this.mHasPrev = (bool)num;
        this.mHasNext = flag;
        object     obj        = null;
        UIDrawCall uIDrawCall = (UIDrawCall)obj;

        this.mPrev = (UIDrawCall)obj;
        this.mNext = uIDrawCall;
    }
    /// <summary>
    /// Draw the inspector widget.
    /// </summary>

    public override void OnInspectorGUI()
    {
        if (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout)
        {
            UIDrawCall dc = target as UIDrawCall;

            UIPanel[] panels = (UIPanel[])Component.FindObjectsOfType(typeof(UIPanel));

            foreach (UIPanel p in panels)
            {
                if (p.drawCalls.Contains(dc))
                {
                    EditorGUILayout.LabelField("Owner Panel", NGUITools.GetHierarchy(p.gameObject));
                    EditorGUILayout.LabelField("Triangles", dc.triangles.ToString());
                    return;
                }
            }
            if (Event.current.type == EventType.Repaint)
            {
                Debug.LogWarning("Orphaned UIDrawCall detected!\nUse [Selection -> Force Delete] to get rid of it.");
            }
        }
    }
示例#24
0
    protected override void OnDisable()
    {
        int i = 0;

        for (int count = drawCalls.Count; i < count; i++)
        {
            UIDrawCall uIDrawCall = drawCalls[i];
            if (uIDrawCall != null)
            {
                UIDrawCall.Destroy(uIDrawCall);
            }
        }
        drawCalls.Clear();
        list.Remove(this);
        mAlphaFrameID = -1;
        mMatrixFrame  = -1;
        if (list.Count == 0)
        {
            UIDrawCall.ReleaseAll();
            mUpdateFrame = -1;
        }
        base.OnDisable();
    }
示例#25
0
    private UIDrawCall.Iterator GetDrawCall(UIMaterial mat, bool createIfMissing)
    {
        for (UIDrawCall.Iterator iterator = (UIDrawCall.Iterator) this.mDrawCalls; iterator.Has; iterator = iterator.Next)
        {
            if (iterator.Current.material == mat)
            {
                return(iterator);
            }
        }
        UIDrawCall call = null;

        if (createIfMissing)
        {
            call = new GameObject("_UIDrawCall [" + mat.name + "]")
            {
                hideFlags = HideFlags.DontSave, layer = base.gameObject.layer
            }.AddComponent <UIDrawCall>();
            call.material = mat;
            call.LinkedList__Insert(ref this.mDrawCalls);
            this.mDrawCallCount++;
        }
        return((UIDrawCall.Iterator)call);
    }
示例#26
0
    /// <summary>
    /// Destroy the specified draw call.
    /// </summary>

    static public void Destroy(UIDrawCall dc)
    {
        if (dc)
        {
            if (dc.onCreateDrawCall != null)
            {
                NGUITools.Destroy(dc.gameObject);
                return;
            }

            dc.onRender   = null;
            dc.onUpdateRQ = null;
            dc.enabled    = true;
            dc.isActive   = true;
            dc.ExtraRq    = 0;
            if (Application.isPlaying)
            {
                if (mActiveList.Remove(dc))
                {
                    NGUITools.SetActive(dc.gameObject, false);
                    mInactiveList.Add(dc);
                    dc.mIsNew = true;
                }
            }
            else
            {
                mActiveList.Remove(dc);
#if SHOW_HIDDEN_OBJECTS && UNITY_EDITOR
                if (UnityEditor.Selection.activeGameObject == dc.gameObject)
                {
                    UnityEditor.Selection.activeGameObject = null;
                }
#endif
                NGUITools.DestroyImmediate(dc.gameObject);
            }
        }
    }
示例#27
0
    public UIDrawCall FindDrawCall(UIWidget w)
    {
        Material material    = w.material;
        Texture  mainTexture = w.mainTexture;
        int      depth       = w.depth;

        for (int i = 0; i < drawCalls.Count; i++)
        {
            UIDrawCall uIDrawCall = drawCalls[i];
            int        num        = (i != 0) ? (drawCalls[i - 1].depthEnd + 1) : int.MinValue;
            int        num2       = (i + 1 != drawCalls.Count) ? (drawCalls[i + 1].depthStart - 1) : int.MaxValue;
            if (num > depth || num2 < depth)
            {
                continue;
            }
            if (uIDrawCall.baseMaterial == material && uIDrawCall.mainTexture == mainTexture)
            {
                if (w.isVisible)
                {
                    w.drawCall = uIDrawCall;
                    if (w.hasVertices)
                    {
                        uIDrawCall.isDirty = true;
                    }
                    return(uIDrawCall);
                }
            }
            else
            {
                mRebuild = true;
            }
            return(null);
        }
        mRebuild = true;
        return(null);
    }
 private void DeleteRenderTexture()
 {
     //IL_0006: Unknown result type (might be due to invalid IL or missing references)
     //IL_001c: Unknown result type (might be due to invalid IL or missing references)
     //IL_002c: Unknown result type (might be due to invalid IL or missing references)
     if (renderCamera.get_targetTexture() != null)
     {
         renderCamera.get_targetTexture().DiscardContents();
         Object.Destroy(renderCamera.get_targetTexture());
         renderCamera.set_targetTexture(null);
         UIPanel panel = uiTexture.panel;
         uiTexture.mainTexture = null;
         if (uiTexture.drawCall != null)
         {
             uiTexture.drawCall.panel.drawCalls.Remove(uiTexture.drawCall);
             UIDrawCall.Destroy(uiTexture.drawCall);
             uiTexture.drawCall = null;
         }
         else if (panel != null)
         {
             panel.ForceUpDate();
         }
     }
 }
示例#29
0
 public static void Destroy(UIDrawCall dc)
 {
     //IL_002d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0033: Expected O, but got Unknown
     //IL_0055: Unknown result type (might be due to invalid IL or missing references)
     //IL_005a: Expected O, but got Unknown
     if (Object.op_Implicit(dc))
     {
         dc.onRender = null;
         if (Application.get_isPlaying())
         {
             if (mActiveList.Remove(dc))
             {
                 NGUITools.SetActive(dc.get_gameObject(), false);
                 mInactiveList.Add(dc);
             }
         }
         else
         {
             mActiveList.Remove(dc);
             NGUITools.DestroyImmediate(dc.get_gameObject());
         }
     }
 }
示例#30
0
	/// <summary>
	/// Update the panel, all of its widgets and draw calls.
	/// </summary>

	void UpdateSelf ()
	{
		mUpdateTime = RealTime.time;

		UpdateTransformMatrix();
		UpdateLayers();
		UpdateWidgets();

		if (mRebuild)
		{
			mRebuild = false;
			FillAllDrawCalls();
		}
		else
		{
			for (int i = 0; i < drawCalls.Count; )
			{
				UIDrawCall dc = drawCalls[i];

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

		if (mUpdateScroll)
		{
			mUpdateScroll = false;
			UIScrollView sv = GetComponent<UIScrollView>();
			if (sv != null) sv.UpdateScrollbars();
		}
	}
示例#31
0
文件: UIPanel.cs 项目: fengqk/Art
	/// <summary>
	/// Fill the geometry for the specified draw call.
	/// </summary>

	bool FillDrawCall (UIDrawCall dc)
	{
		if (dc != null)
		{
			dc.isDirty = false;
			if (dc.mUIParticleData != null)
			{
				dc.mUIParticleData.Destroy();
				dc.mUIParticleData = null;
			}

			for (int i = 0; i < widgets.size; )
			{
				UIWidget w = widgets[i];

				if (w == null)
				{
#if UNITY_EDITOR
					Debug.LogError("This should never happen");
#endif
					widgets.RemoveAt(i);
					continue;
				}

				if (w.drawCall == dc)
				{
					if (w.isVisible && w.hasVertices)
					{
						if (generateNormals) w.WriteToBuffers(dc.verts, dc.uvs, dc.cols, dc.norms, dc.tans);
						else w.WriteToBuffers(dc.verts, dc.uvs, dc.cols, null, null);
					}
					else if (w.isVisible && w.modelGameObject != null) //wym
					{
						if (dc.mUIParticleData != null)
							dc.mUIParticleData.Destroy();
						dc.mUIParticleData = new UIParticleData(w);
						dc.mUIParticleData.RebuildMaterials();
					}
					else w.drawCall = null;
				}
				++i;
			}

			if (dc.verts.size != 0)
			{
				dc.UpdateGeometry();
				return true;
			}
			if (dc.mUIParticleData != null)
			{
				return true;
			}
		}
		return false;
	}
 public void CreatePanel()
 {
     if (((this.mPanel == null) && base.enabled) && NGUITools.GetActive(base.gameObject))
     {
         this.mPanel = UIPanel.Find(this.cachedTransform, this.mStarted);
         if (this.mPanel != null)
         {
             int raycastDepth = this.raycastDepth;
             bool flag = false;
             for (int i = 0; i < list.size; i++)
             {
                 if (list[i].raycastDepth > raycastDepth)
                 {
                     list.Insert(i, this);
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 list.Add(this);
             }
             this.CheckLayer();
             this.mChanged = true;
             this.drawCall = UIPanel.InsertWidget(this);
         }
     }
 }
示例#33
0
	/// <summary>
	/// Fill the geometry for the specified draw call.
	/// </summary>

	static bool Fill (UIDrawCall dc)
	{
		if (dc != null)
		{
			dc.isDirty = false;

			for (int i = 0; i < UIWidget.list.size; )
			{
				UIWidget w = UIWidget.list[i];

				if (w == null)
				{
					UIWidget.list.RemoveAt(i);
					continue;
				}

				if (w.renderQueue == dc.renderQueue)
				{
					if (w.isVisible && w.hasVertices)
					{
						if (dc.panel.generateNormals) w.WriteToBuffers(mVerts, mUvs, mCols, mNorms, mTans);
						else w.WriteToBuffers(mVerts, mUvs, mCols, null, null);
					}
					else
					{
						w.renderQueue = -1;
					}
				}
				++i;
			}

			if (mVerts.size != 0)
			{
				dc.Set(mVerts, dc.panel.generateNormals ? mNorms : null, dc.panel.generateNormals ? mTans : null, mUvs, mCols);
				mVerts.Clear();
				mNorms.Clear();
				mTans.Clear();
				mUvs.Clear();
				mCols.Clear();
				return true;
			}
		}
		return false;
	}
示例#34
0
	/// <summary>
	/// Destroy the specified draw call.
	/// NOTE: Future optimization can be caching these at run-time instead of destroying them.
	/// </summary>

	static void DestroyDrawCall (UIDrawCall dc, int index)
	{
		if (dc != null)
		{
			//Debug.Log("Destroyed DC " + dc.material.name + " as " + dc.renderQueue);
			UIDrawCall.list.RemoveAt(index);
			NGUITools.DestroyImmediate(dc.gameObject);
		}
	}
示例#35
0
 public static UIMaterial Create(Material key, bool manageKeyDestruction, UIDrawCall.Clipping useAsClipping)
 {
     UIMaterial uIMaterial;
     if (!manageKeyDestruction)
     {
         return UIMaterial.Create(key);
     }
     if (!key)
     {
         return null;
     }
     if (UIMaterial.g.keyedMaterials.TryGetValue(key, out uIMaterial))
     {
         throw new InvalidOperationException("That material is registered and cannot be used with manageKeyDestruction");
     }
     if (UIMaterial.g.generatedMaterials.TryGetValue(key, out uIMaterial))
     {
         return uIMaterial;
     }
     uIMaterial = ScriptableObject.CreateInstance<UIMaterial>();
     uIMaterial.key = key;
     int num = UIMaterial.g.hashCodeIterator + 1;
     UIMaterial.g.hashCodeIterator = num;
     uIMaterial.hashCode = num;
     if (uIMaterial.hashCode == 2147483647)
     {
         UIMaterial.g.hashCodeIterator = -2147483648;
     }
     UIMaterial.g.generatedMaterials.Add(key, uIMaterial);
     uIMaterial.matFirst = key;
     switch (useAsClipping)
     {
         case UIDrawCall.Clipping.None:
         {
             uIMaterial.matNone = key;
             break;
         }
         case UIDrawCall.Clipping.HardClip:
         {
             uIMaterial.matHardClip = key;
             break;
         }
         case UIDrawCall.Clipping.AlphaClip:
         {
             uIMaterial.matAlphaClip = key;
             break;
         }
         case UIDrawCall.Clipping.SoftClip:
         {
             uIMaterial.matSoftClip = key;
             break;
         }
         default:
         {
             throw new NotImplementedException();
         }
     }
     uIMaterial.madeMats = (UIMaterial.ClippingFlags)((int)UIDrawCall.Clipping.HardClip << (int)(useAsClipping & (UIDrawCall.Clipping.HardClip | UIDrawCall.Clipping.AlphaClip | UIDrawCall.Clipping.SoftClip)));
     return uIMaterial;
 }
示例#36
0
	/// <summary>
	/// Submit the draw call using the current geometry.
	/// </summary>

	void SubmitDrawCall (UIDrawCall dc)
	{
		drawCalls.Add(dc);
		dc.Set(mVerts, generateNormals ? mNorms : null, generateNormals ? mTans : null, mUvs, mCols);
		mVerts.Clear();
		mNorms.Clear();
		mTans.Clear();
		mUvs.Clear();
		mCols.Clear();
	}
示例#37
0
 public void RemoveFromPanel()
 {
     if (this.panel != null)
     {
         this.panel.RemoveWidget(this);
         this.panel = null;
     }
     this.drawCall = null;
 }
示例#38
0
 private void Delete(ref UIDrawCall.Iterator iter)
 {
     if (iter.Has)
     {
         UIDrawCall current = iter.Current;
         if (object.ReferenceEquals(current, this.mDrawCalls))
         {
             this.mDrawCalls = iter.Next.Current;
         }
         iter = iter.Next;
         current.LinkedList__Remove();
         UIPanel uIPanel = this;
         uIPanel.mDrawCallCount = uIPanel.mDrawCallCount - 1;
         NGUITools.DestroyImmediate(current.gameObject);
     }
 }
示例#39
0
	/// <summary>
	/// Remove this widget from the panel.
	/// </summary>

	protected void RemoveFromPanel ()
	{
		if (mPanel != null)
		{
			SetDirty();
			mPanel = null;
		}
		drawCall = null;
#if UNITY_EDITOR
		mOldTex = null;
		mOldShader = null;
#endif
	}
示例#40
0
 internal void LinkedList__Remove()
 {
     if (this.mHasPrev)
     {
         this.mPrev.mHasNext = this.mHasNext;
         this.mPrev.mNext = this.mNext;
     }
     if (this.mHasNext)
     {
         this.mNext.mHasPrev = this.mHasPrev;
         this.mNext.mPrev = this.mPrev;
     }
     int num = 0;
     bool flag = (bool)num;
     this.mHasPrev = (bool)num;
     this.mHasNext = flag;
     object obj = null;
     UIDrawCall uIDrawCall = (UIDrawCall)obj;
     this.mPrev = (UIDrawCall)obj;
     this.mNext = uIDrawCall;
 }
示例#41
0
 internal void LinkedList__Insert(ref UIDrawCall list)
 {
     this.mHasPrev = false;
     this.mHasNext = list;
     this.mNext = list;
     this.mPrev = null;
     if (this.mHasNext)
     {
         list.mHasPrev = true;
         list.mPrev = this;
     }
     list = this;
 }
 private static bool Fill(UIDrawCall dc)
 {
     if (dc != null)
     {
         dc.isDirty = false;
         int index = 0;
         while (index < UIWidget.list.size)
         {
             UIWidget widget = UIWidget.list[index];
             if (widget == null)
             {
                 UIWidget.list.RemoveAt(index);
             }
             else
             {
                 if (widget.drawCall == dc)
                 {
                     if (widget.isVisible && widget.hasVertices)
                     {
                         if (dc.manager.generateNormals)
                         {
                             widget.WriteToBuffers(mVerts, mUvs, mCols, mNorms, mTans);
                         }
                         else
                         {
                             widget.WriteToBuffers(mVerts, mUvs, mCols, null, null);
                         }
                     }
                     else
                     {
                         widget.drawCall = null;
                     }
                 }
                 index++;
             }
         }
         if (mVerts.size != 0)
         {
             dc.Set(mVerts, !dc.manager.generateNormals ? null : mNorms, !dc.manager.generateNormals ? null : mTans, mUvs, mCols);
             mVerts.Clear();
             mNorms.Clear();
             mTans.Clear();
             mUvs.Clear();
             mCols.Clear();
             return true;
         }
     }
     return false;
 }
 private void SubmitDrawCall(UIDrawCall dc)
 {
     dc.clipping = this.clipping;
     dc.Set(mVerts, !this.generateNormals ? null : mNorms, !this.generateNormals ? null : mTans, mUvs, mCols);
     mVerts.Clear();
     mNorms.Clear();
     mTans.Clear();
     mUvs.Clear();
     mCols.Clear();
 }
示例#44
0
	/// <summary>
	/// Remove this widget from the panel.
	/// </summary>

	public void RemoveFromPanel ()
	{
		if (panel != null)
		{
			panel.RemoveWidget(this);
			panel = null;
		}
		drawCall = null;
#if UNITY_EDITOR
		mOldTex = null;
		mOldShader = null;
#endif
	}
示例#45
0
 public static void Destroy(UIDrawCall dc)
 {
     if (dc)
     {
         dc.onRender = null;
         if (Application.isPlaying)
         {
             if (UIDrawCall.mActiveList.Remove(dc))
             {
                 NGUITools.SetActive(dc.gameObject, false);
                 UIDrawCall.mInactiveList.Add(dc);
             }
         }
         else
         {
             UIDrawCall.mActiveList.Remove(dc);
             NGUITools.DestroyImmediate(dc.gameObject);
         }
     }
 }
示例#46
0
 protected void OnDisable()
 {
     UIPanel.Global.PanelDisabled(this);
     if (this.mHotSpots != null)
     {
         foreach (UIHotSpot mHotSpot in this.mHotSpots)
         {
             mHotSpot.OnPanelDisable();
         }
     }
     UIDrawCall.Iterator next = (UIDrawCall.Iterator)this.mDrawCalls;
     while (next.Has)
     {
         UIDrawCall current = next.Current;
         next = next.Next;
         NGUITools.DestroyImmediate(current.gameObject);
     }
     this.mDrawCalls = null;
     this.mChanged.Clear();
     this.mChildren.Clear();
 }
示例#47
0
 /// <summary>
 /// Mark the widget as changed so that the geometry can be rebuilt.
 /// </summary>
 void SetDirty()
 {
     if (drawCall != null)
     {
         drawCall.isDirty = true;
     }
     else if (isVisible && hasVertices)
     {
         drawCall = UIPanel.InsertWidget(this);
     }
 }
示例#48
0
 private bool FillDrawCall(UIDrawCall dc)
 {
     if (dc != null)
     {
         dc.isDirty = false;
         int num = 0;
         int i = 0;
         while (i < this.widgets.Count)
         {
             UIWidget uIWidget = this.widgets[i];
             if (uIWidget == null)
             {
                 this.widgets.RemoveAt(i);
             }
             else
             {
                 if (uIWidget.drawCall == dc)
                 {
                     if (uIWidget.isVisible && uIWidget.hasVertices)
                     {
                         num++;
                         if (this.generateNormals)
                         {
                             uIWidget.WriteToBuffers(dc.verts, dc.uvs, dc.cols, dc.norms, dc.tans);
                         }
                         else
                         {
                             uIWidget.WriteToBuffers(dc.verts, dc.uvs, dc.cols, null, null);
                         }
                         if (uIWidget.mOnRender != null)
                         {
                             if (this.mOnRender == null)
                             {
                                 this.mOnRender = uIWidget.mOnRender;
                             }
                             else
                             {
                                 this.mOnRender = (UIDrawCall.OnRenderCallback)Delegate.Combine(this.mOnRender, uIWidget.mOnRender);
                             }
                         }
                     }
                     else
                     {
                         uIWidget.drawCall = null;
                     }
                 }
                 i++;
             }
         }
         if (dc.verts.size != 0)
         {
             dc.UpdateGeometry(num);
             dc.onRender = this.mOnRender;
             this.mOnRender = null;
             return true;
         }
     }
     return false;
 }
示例#49
0
    /// <summary>
    /// Ensure we have a panel referencing this widget.
    /// </summary>
    public void CreatePanel()
    {
        if (mStarted && mPanel == null && enabled && NGUITools.GetActive(gameObject))
        {
            mPanel = UIPanel.Find(cachedTransform, mStarted);

            if (mPanel != null)
            {
                int rd = raycastDepth;
                bool inserted = false;

                // Try to insert this widget at the appropriate location within the list
                for (int i = 0; i < list.size; ++i)
                {
                    if (list[i].raycastDepth > rd)
                    {
                        list.Insert(i, this);
                        inserted = true;
                        break;
                    }
                }

                // Add this widget to the end of the list if it's not already there
                if (!inserted) list.Add(this);

                CheckLayer();
                mChanged = true;
                drawCall = UIPanel.InsertWidget(this);
            }
        }
    }
示例#50
0
	/// <summary>
	/// Submit the draw call using the current geometry.
	/// </summary>

	void SubmitDrawCall (UIDrawCall dc)
	{
		dc.clipping = clipping;
		dc.alwaysOnScreen = alwaysOnScreen && (clipping == UIDrawCall.Clipping.None || clipping == UIDrawCall.Clipping.ConstrainButDontClip);
		dc.Set(mVerts, generateNormals ? mNorms : null, generateNormals ? mTans : null, mUvs, mCols);
		mVerts.Clear();
		mNorms.Clear();
		mTans.Clear();
		mUvs.Clear();
		mCols.Clear();
	}
示例#51
0
    /// <summary>
    /// This callback is sent inside the editor notifying us that some property has changed.
    /// </summary>
    protected virtual void OnValidate()
    {
        mChanged = true;

        // Prior to NGUI 2.7.0 width and height was specified as transform's local scale
        if ((mWidth == 100 || mWidth == minWidth) &&
            (mHeight == 100 || mHeight == minHeight) && cachedTransform.localScale.magnitude > 8f)
        {
            UpgradeFrom265();
            cachedTransform.localScale = Vector3.one;
        }

        if (mWidth < minWidth) mWidth = minWidth;
        if (mHeight < minHeight) mHeight = minHeight;
        if (autoResizeBoxCollider) ResizeCollider();

        // If the texture is changing, we need to make sure to rebuild the draw calls
        if (mOldTex != mainTexture || mOldShader != shader)
        {
            mOldTex = mainTexture;
            mOldShader = shader;
            UIPanel.RemoveWidget(this);
            drawCall = UIPanel.InsertWidget(this);
        }
    }
 private void SetDirty()
 {
     if (this.drawCall != null)
     {
         this.drawCall.isDirty = true;
     }
     else if (this.isVisible && this.hasVertices)
     {
         this.drawCall = UIPanel.InsertWidget(this);
     }
 }
示例#53
0
	/// <summary>
	/// Fill the geometry for the specified draw call.
	/// </summary>

	bool FillDrawCall (UIDrawCall dc)
	{
		if (dc != null)
		{
			dc.isDirty = false;

			for (int i = 0; i < widgets.size; )
			{
				UIWidget w = widgets[i];

				if (w == null)
				{
#if UNITY_EDITOR
					Debug.LogError("This should never happen");
#endif
					widgets.RemoveAt(i);
					continue;
				}

				if (w.drawCall == dc)
				{
					if (w.isVisible && w.hasVertices)
					{
						if (generateNormals) w.WriteToBuffers(mVerts, mUvs, mCols, mNorms, mTans);
						else w.WriteToBuffers(mVerts, mUvs, mCols, null, null);
					}
					else w.drawCall = null;
				}
				++i;
			}

			if (mVerts.size != 0)
			{
				dc.Set(mVerts, generateNormals ? mNorms : null, generateNormals ? mTans : null, mUvs, mCols);
				mVerts.Clear();
				mNorms.Clear();
				mTans.Clear();
				mUvs.Clear();
				mCols.Clear();
				return true;
			}
		}
		return false;
	}
示例#54
0
	/// <summary>
	/// Destroy the specified draw call.
	/// NOTE: Future optimization can be caching these at run-time instead of destroying them.
	/// </summary>

	static void DestroyDrawCall (UIDrawCall dc, int index)
	{
		if (dc != null)
		{
			UIDrawCall.list.RemoveAt(index);
			NGUITools.DestroyImmediate(dc.gameObject);
		}
	}
示例#55
0
 private static Shader GetClippingShader(Shader original, UIDrawCall.Clipping clipping)
 {
     if (!original)
     {
         return null;
     }
     string str = original.name;
     switch (clipping)
     {
         case UIDrawCall.Clipping.None:
         {
             string str1 = str.Replace(" (HardClip)", string.Empty).Replace(" (AlphaClip)", string.Empty).Replace(" (SoftClip)", string.Empty);
             if (str1 == str)
             {
                 return original;
             }
             str = str1;
             break;
         }
         case UIDrawCall.Clipping.HardClip:
         {
             if (!UIMaterial.ShaderNameDecor(ref str, " (AlphaClip)", " (SoftClip)", " (HardClip)"))
             {
                 return original;
             }
             break;
         }
         case UIDrawCall.Clipping.AlphaClip:
         {
             if (!UIMaterial.ShaderNameDecor(ref str, " (SoftClip)", " (HardClip)", " (AlphaClip)"))
             {
                 return original;
             }
             break;
         }
         case UIDrawCall.Clipping.SoftClip:
         {
             if (!UIMaterial.ShaderNameDecor(ref str, " (HardClip)", " (AlphaClip)", " (SoftClip)"))
             {
                 return original;
             }
             break;
         }
         default:
         {
             throw new NotImplementedException();
         }
     }
     Shader shader = Shader.Find(str);
     if (!shader)
     {
         throw new MissingReferenceException(string.Concat("Theres no shader named ", str));
     }
     return shader;
 }
示例#56
0
	/// <summary>
	/// Destroy the specified draw call.
	/// </summary>

	static public void Destroy (UIDrawCall dc)
	{
		if (Application.isPlaying) NGUITools.SetActive(dc.gameObject, false);
		else NGUITools.DestroyImmediate(dc.gameObject);
	}
示例#57
0
	/// <summary>
	/// Fill the geometry for the specified draw call.
	/// </summary>

	bool FillDrawCall (UIDrawCall dc)
	{
		if (dc != null)
		{
			dc.isDirty = false;

			for (int i = 0; i < widgets.Count; )
			{
				UIWidget w = widgets[i];

				if (w == null)
				{
#if UNITY_EDITOR
					Debug.LogError("This should never happen");
#endif
					widgets.RemoveAt(i);
					continue;
				}

				if (w.drawCall == dc)
				{
					if (w.isVisible && w.hasVertices)
					{
						if (generateNormals) w.WriteToBuffers(dc.verts, dc.uvs, dc.cols, dc.norms, dc.tans);
						else w.WriteToBuffers(dc.verts, dc.uvs, dc.cols, null, null);
					}
					else w.drawCall = null;
				}
				++i;
			}

			if (dc.verts.size != 0)
			{
				dc.UpdateGeometry();
				return true;
			}
		}
		return false;
	}
示例#58
0
 private Material FastGet(UIDrawCall.Clipping clipping)
 {
     switch (clipping)
     {
         case UIDrawCall.Clipping.None:
         {
             return this.matNone;
         }
         case UIDrawCall.Clipping.HardClip:
         {
             return this.matHardClip;
         }
         case UIDrawCall.Clipping.AlphaClip:
         {
             return this.matAlphaClip;
         }
         case UIDrawCall.Clipping.SoftClip:
         {
             return this.matSoftClip;
         }
     }
     throw new NotImplementedException();
 }
示例#59
0
 private void OnLevelWasLoaded(int nLevel)
 {
     UIDrawCall.ReleaseInactive();
     SoundFile.ClearAllSE();
 }
示例#60
0
 private Material MakeMaterial(UIDrawCall.Clipping clipping)
 {
     Material material;
     Material material1;
     Shader clippingShader;
     Material material2;
     bool flag = (int)this.madeMats == 0;
     switch (clipping)
     {
         case UIDrawCall.Clipping.None:
         {
             clippingShader = this.key.shader;
             material1 = this.matNone;
             Material material3 = UIMaterial.CreateMaterial(clippingShader);
             material2 = material3;
             this.matNone = material3;
             material = material2;
             UIMaterial uIMaterial = this;
             uIMaterial.madeMats = uIMaterial.madeMats | UIMaterial.ClippingFlags.None;
             break;
         }
         case UIDrawCall.Clipping.HardClip:
         {
             clippingShader = UIMaterial.GetClippingShader(this.key.shader, UIDrawCall.Clipping.HardClip);
             material1 = this.matHardClip;
             Material material4 = UIMaterial.CreateMaterial(clippingShader);
             material2 = material4;
             this.matHardClip = material4;
             material = material2;
             UIMaterial uIMaterial1 = this;
             uIMaterial1.madeMats = uIMaterial1.madeMats | UIMaterial.ClippingFlags.HardClip;
             break;
         }
         case UIDrawCall.Clipping.AlphaClip:
         {
             clippingShader = UIMaterial.GetClippingShader(this.key.shader, UIDrawCall.Clipping.AlphaClip);
             material1 = this.matAlphaClip;
             Material material5 = UIMaterial.CreateMaterial(clippingShader);
             material2 = material5;
             this.matAlphaClip = material5;
             material = material2;
             UIMaterial uIMaterial2 = this;
             uIMaterial2.madeMats = uIMaterial2.madeMats | UIMaterial.ClippingFlags.AlphaClip;
             break;
         }
         case UIDrawCall.Clipping.SoftClip:
         {
             clippingShader = UIMaterial.GetClippingShader(this.key.shader, UIDrawCall.Clipping.SoftClip);
             material1 = this.matSoftClip;
             Material material6 = UIMaterial.CreateMaterial(clippingShader);
             material2 = material6;
             this.matSoftClip = material6;
             material = material2;
             UIMaterial uIMaterial3 = this;
             uIMaterial3.madeMats = uIMaterial3.madeMats | UIMaterial.ClippingFlags.SoftClip;
             break;
         }
         default:
         {
             throw new NotImplementedException();
         }
     }
     UIMaterial.g.generatedMaterials.Add(material, this);
     if (!flag)
     {
         material.CopyPropertiesFromMaterial(this.matFirst);
     }
     else
     {
         this.matFirst = material;
         material.CopyPropertiesFromMaterial(this.key);
     }
     if (material1)
     {
         UnityEngine.Object.DestroyImmediate(material1);
     }
     return material;
 }