public T GetTexture <T> (string _name, Action <T> _callBack, bool _doNotDispose) where T : UnityEngine.Object { TextureFactoryUnit <T> unit; Dictionary <string, ITextureFactoryUnit> tmpDic; if (_doNotDispose) { tmpDic = dic; } else { tmpDic = dicWillDispose; } if (!tmpDic.ContainsKey(_name)) { unit = new TextureFactoryUnit <T> (_name); tmpDic.Add(_name, unit); } else { unit = tmpDic [_name] as TextureFactoryUnit <T>; } return(unit.GetTexture(_callBack)); }
private bool SetSpriteReal(Image _img, ImageScript _script, string _name, bool _doNotDispose) { TextureFactoryUnit <Sprite> unit; Dictionary <string, ITextureFactoryUnit> tmpDic; if (_doNotDispose) { tmpDic = dic; } else { tmpDic = dicWillDispose; } if (!tmpDic.ContainsKey(_name)) { unit = new TextureFactoryUnit <Sprite> (_name); tmpDic.Add(_name, unit); } else { unit = tmpDic [_name] as TextureFactoryUnit <Sprite>; } Action <Sprite> callBack = delegate(Sprite obj) { GetSprite(_img, _script, _name, _doNotDispose, obj); }; Sprite result = unit.GetTexture(callBack); if (result == null) { _img.color = new Color(1, 1, 1, 0); Action <float> tween = delegate(float obj) { ChangeImageAlpha(_img, obj); }; Action <Sprite> startTween = delegate(Sprite obj) { SuperTween.Instance.To(0, 1, 0.1f, tween, null); }; unit.GetTexture(startTween); return(true); } else { _img.color = Color.white; return(false); } }
public T GetTexture <T> (string _name, Action <T> _callBack, bool _addUseNum) where T : UnityEngine.Object { TextureFactoryUnit <T> unit; if (!dic.ContainsKey(_name)) { unit = new TextureFactoryUnit <T> (_name); dic.Add(_name, unit); } else { unit = dic [_name] as TextureFactoryUnit <T>; } return(unit.GetTexture(_callBack, _addUseNum)); }