public static string MakeUrlForMobileProfile(string url, BackgroundEnum background) { int index = url.LastIndexOf('/'); string rgb; string border; switch (background) { case BackgroundEnum.Black: rgb = "000000"; border = ",bo_4px_solid_white"; break; case BackgroundEnum.White: rgb = "ffffff"; border = ""; break; default: rgb = "252424"; border = ",bo_4px_solid_white"; break; } string transformation = "/w_180,h_180,c_thumb,g_face,r_90,b_rgb:" + rgb + border; string modifiedUrl = url.Substring(0, index) + transformation + url.Substring(index, url.Length - index); return(modifiedUrl); }
void LoadBackground() { BackgroundEnum bg = BackgroundEnum.TutorialBackground; if (enemyType == EnemyType.Dummy) { bg = BackgroundEnum.TutorialBackground; } else if (enemyType == EnemyType.Vampire) { bg = BackgroundEnum.VampireBackground; } else if (enemyType == EnemyType.Psychic) { bg = BackgroundEnum.TelepathicBackground; } else if (enemyType == EnemyType.DarkPlayer) { bg = BackgroundEnum.DarkPortal; } EventMessanger.GetInstance().TriggerEvent(new BackgroundLoadEvent(bg)); }
public ImageSource GetImageSource(string picture, BackgroundEnum background = BackgroundEnum.White, bool originalSize = false) { if (string.IsNullOrEmpty(picture) == true || picture.ToLower().StartsWith("http") == false) { string file; if (background == BackgroundEnum.Background1) { file = "personBackground1.png"; } else if (background == BackgroundEnum.Black) { file = "personBlackBackground.png"; } else { file = "personWhiteBackground.png"; } return(new FileImageSource() { File = file }); } string url; if (originalSize) { url = ImageUrlHelper.MakeUrlForOriginalImage(picture); } else { url = ImageUrlHelper.MakeUrlForMobileProfile(picture, background); } return(new UriImageSource() { Uri = new Uri(url) }); }
private void LoadBackground(BackgroundEnum backgroundEnum) { switch (backgroundEnum) { case BackgroundEnum.TutorialBackground: backgroundImage.sprite = tutorialBackground; break; case BackgroundEnum.VampireBackground: backgroundImage.sprite = vampireBackground; break; case BackgroundEnum.TelepathicBackground: backgroundImage.sprite = telepathicBackground; break; case BackgroundEnum.DarkPortal: backgroundImage.sprite = darkBackground; darkPortalChild.SetActive(true); break; } }
public BackgroundLoadEvent(BackgroundEnum background) { this.background = background; }