Esempio n. 1
0
 private void UpdateDefaultTexture()
 {
     if (string.IsNullOrEmpty(_defaultUrl))
     {
         return;
     }
     if (_url == _defaultUrl || mainTexture != null)
     {
         return;
     }
     FuncUtil.Load(_defaultUrl, (Action <String>)OnLoadTextureComplete, _defaultUrl);
 }
Esempio 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);
 }
Esempio n. 3
0
 private void OnLoadMaskComplete(string path)
 {
     material       = new Material(FuncUtil.GetUIAssetByPath(path) as Material);
     material.color = color;
     FuncUtil.Load(_maskPath + "", (Action <string>)OnLoadMaskCullingComplete, _maskPath);
 }
Esempio n. 4
0
 public void SetMask(string path)
 {
     isMask    = true;
     _maskPath = path;
     FuncUtil.Load(UI_MASK, (Action <string>)OnLoadMaskComplete, UI_MASK);
 }