Ejemplo n.º 1
0
 public void ClearTTOnly()
 {
     if ((isMask && material != null && material.GetTexture("_MainTex") != null) || mainTexture != null)
     {
         FuncUtil.CanDispose(_url);
     }
     mainTexture = null;
     curTexture  = null;
     if (material != null && material.GetTexture("_MainTex") != null)
     {
         material.SetTexture("_MainTex", curTexture);
         hasMainTex = curTexture != null;
         MarkAsChanged();
     }
 }
Ejemplo n.º 2
0
 private void UpdateBaseTexture()
 {
     if (hasDestroy || isClear)  //已经清除过的
     {
         return;
     }
     if (isMask == true)
     {
         if (string.IsNullOrEmpty(_maskPath) == false)
         {
             if (material == null && loadFlag < 2)       //如果材质一直加载不出,可能会死循环,做个标记
             {
                 loadFlag++;
                 FuncUtil.Load(UI_MASK, (Action <string>)OnLoadMaskComplete, UI_MASK);
                 return;
             }
             loadFlag = 0;
             if (material != null && curTexture != material.GetTexture("_MainTex"))
             {
                 RemoveFromPanel();
                 material.SetTexture("_MainTex", curTexture);
                 hasMainTex = curTexture != null;
                 MarkAsChanged();
             }
         }
         mainTexture = null;
     }
     else
     {
         mainTexture = curTexture;
         if (materialMode == false)
         {
             material = null;
         }
         if (_imageWidth != 0 && _imageHeight != 0)
         {
             width  = Convert.ToInt32(_imageWidth);
             height = Convert.ToInt32(_imageHeight);
         }
         else
         {
             MakePixelPerfect();
         }
     }
     FuncUtil.CanDispose(_lastURL);
 }