public static void SetAva(Server.TokenAndId tai, LightImage image, BrainDuelsLib.delegates.Action callback) { LightImage largeImage = image.CropToSize(SocketManager.Images.avatarSize.width, SocketManager.Images.avatarSize.height); LightImage miniImage = image.CropToSize(SocketManager.Images.miniAvatarSize.width, SocketManager.Images.miniAvatarSize.height); string content1 = ImageSerizlizer.Serialize(largeImage); string content2 = ImageSerizlizer.Serialize(miniImage); PictureRequest.SetPicture(tai, content1, callback, true); PictureRequest.SetPicture(tai, content2, callback, false); }
public static void GetPicture(Server.TokenAndId tai, int serverIndex, int pictureId, BrainDuelsLib.delegates.Action <LightImage> imageCallback) { KeyValuePair <int, int> address = new KeyValuePair <int, int>(serverIndex, pictureId); if (picturesCache.ContainsKey(address)) { imageCallback(picturesCache[address]); return; } BrainDuelsLib.delegates.Action <string> resultCallback = delegate(string s){ LightImage li = ImageSerizlizer.Deserialize(s); picturesCache[address] = li; imageCallback(li); }; PictureRequest.GetPicture(tai, serverIndex, pictureId, resultCallback); return; }