public static void SetSprite(Image image, string name) { DataSprite data = DataManager.Instance.Load <DataSprite>(); AtlasInformation information = data.GetAtlas(name); if (information == null) { return; } if (atlases.ContainsKey(information.name)) { if (atlases[information.name] != null) { SetSprite(image, atlases[information.name].GetSprite(name)); } } else { ResourceManager.LoadAsync <SpriteAtlas>(information.path, (atlas) => { if (atlas != null) { SetSprite(image, atlas.GetSprite(name)); } Add(information.name, atlas); }); } }
public static void SetSprite(RawImage image, string name) { DataSprite data = DataManager.Instance.Load <DataSprite>(); TextureInformation information = data.GetTexture2D(name); if (information == null) { return; } if (textures.ContainsKey(information.name)) { if (textures[information.name] != null) { SetSprite(image, textures[information.name]); } } else { ResourceManager.LoadAsync <Texture2D>(information.path, (texture) => { if (texture != null) { SetSprite(image, texture); } Add(information.name, texture); }); } }
public static void SetSprite(SpriteRenderer renderer, string name) { DataSprite data = DataManager.Instance.Load <DataSprite>(); SpriteInformation information = data.GetSprite(name); if (information == null) { return; } if (sprites.ContainsKey(information.name)) { if (sprites[information.name] != null) { SetSprite(renderer, sprites[information.name]); } } else { ResourceManager.LoadAsync <Sprite>(information.path, (sprite) => { if (sprite != null) { SetSprite(renderer, sprite); } Add(information.name, sprite); }); } }