void takeScreenshot() { vkc.api("photos.getAlbums", new Dictionary <string, object>(), delegate(object arg1, Callback arg2) { Debug2.LogDebug("im at takeScreenshot=====\n" + Json.Serialize(arg1)); Dictionary <string, object> resultDict = arg1 as Dictionary <string, object>; if (!resultDict.ContainsKey("response")) { Debug2.LogError("vk api error \n" + Json.Serialize(arg1)); return; } Dictionary <string, object> response = resultDict["response"] as Dictionary <string, object>; List <object> items = response["items"] as List <object>; long albumId = -1; for (int i = 0; i < items.Count; i++) { Dictionary <string, object> album = items[i] as Dictionary <string, object>; if (((string)album["title"]).Equals(albumName)) { albumId = (long)album["id"]; break; } } if (albumId == -1) { createAlbumAndPostScreenShot(); } else { postScreenShot(albumId); } }); }
public void onPictureSave(Texture2D texture, string pictureName) { vkc.api("photos.getAlbums", new Dictionary <string, object>(), delegate(object arg1, Callback arg2) { Debug2.LogDebug("im at takeScreenshot=====\n" + Json.Serialize(arg1)); Dictionary <string, object> resultDict = arg1 as Dictionary <string, object>; if (!resultDict.ContainsKey("response")) { Debug2.LogError("vk api error \n" + Json.Serialize(arg1)); return; } Dictionary <string, object> response = resultDict["response"] as Dictionary <string, object>; List <object> items = response["items"] as List <object>; long albumId = -1; for (int i = 0; i < items.Count; i++) { Dictionary <string, object> album = items[i] as Dictionary <string, object>; if (((string)album["title"]).Equals(albumName)) { albumId = (long)album["id"]; break; } } string wallText = wallMessage.Replace("PICTURE_NAME", pictureName); if (albumId == -1) { createAlbumAndPostScreenShot(texture, wallText); } else { postScreenShot(texture, wallText, albumId); } }); }