예제 #1
0
 private void OnLoadTextureComplete(string url)
 {
     //如果是默认图  并且实际上用的图已经加载好
     if (url == defaultUrl && (curTexture != null || string.IsNullOrEmpty(_url)))
     {
         return;
     }
     //不是当前需求要的图
     if (url != defaultUrl && url != _url)
     {
         return;
     }
     isClear = false;
     try {
         curTexture = FuncUtil.GetUIAssetByPath(url) as Texture2D;
     } catch (Exception e) {
         FuncUtil.ShowError("Image加载完毕后获取Texture2D失败:{0}", e.Message);
         return;
     }
     if (curTexture == null)
     {
         Clear();
         FuncUtil.ShowError("Image加载完毕后获取Texture2D失败:{0}", url);
     }
     FuncUtil.NoDispose(_url);
     UpdateBaseTexture();
     if (_imageWidth != 0 && _imageHeight != 0)
     {
         width  = Convert.ToInt32(_imageWidth);
         height = Convert.ToInt32(_imageHeight);
     }
     OnCompleteCallBack();
 }
예제 #2
0
 protected override void OnStart()
 {
     base.OnStart();
     try {
         Overlay.width = _itemWidth;
         Overlay.transform.localPosition = new Vector3(PaddingLeft, Overlay.height, 0);
         resetSpSel();
         if (barInContent == false)
         {
             Content.baseClipRegion = new Vector4((this.width - Bar.width) / 2, -this.height / 2, this.width - Bar.width, this.height);
         }
         else
         {
             Content.baseClipRegion = new Vector4((this.width) / 2, -this.height / 2, this.width, this.height);
         }
         UIEventListener.Get(this.gameObject).onScroll = OnMouseScroll;
         if (isDefaultItemRender)
         {
             itemRender = typeof(CDefaultItemRender);
         }
         Recycle.position = new Vector3(9999, 9999, 9999);
     } catch (Exception e) {
         FuncUtil.ShowError(e.Message);
     }
 }
예제 #3
0
 public static void DoVectorDelegate(VectorDelegate func, GameObject arg, Vector2 delta)
 {
     try {
         func(arg, delta);
     } catch (Exception ex) {
         //TopTip.addTip(a.Method.Name + "执行出错" + ex.ToString());
         FuncUtil.ShowError(func.Method.Name + "执行出错" + ex.ToString());
     }
 }
예제 #4
0
 public static void DoKeyCodeDelegate(KeyCodeDelegate func, GameObject arg, KeyCode key)
 {
     try {
         func(arg, key);
     } catch (Exception ex) {
         //TopTip.addTip(a.Method.Name + "执行出错" + ex.ToString());
         FuncUtil.ShowError(func.Method.Name + "执行出错" + ex.ToString());
     }
 }
예제 #5
0
 public static void DoBoolDelegate(BoolDelegate func, GameObject arg, bool state)
 {
     try {
         func(arg, state);
     } catch (Exception ex) {
         //TopTip.addTip(a.Method.Name + "执行出错" + ex.ToString());
         FuncUtil.ShowError(func.Method.Name + "执行出错" + ex.ToString());
     }
 }