/// <summary> /// Display an avatar /// </summary> /// <param name="avatar"></param> public void DisplayAvatar(UISim avatar) { this.Avatar = avatar; SetSlotAvailable(false); PersonNameText.Caption = avatar.Name; PersonDescriptionText.CurrentText = avatar.Description; AvatarButton.Texture = Screen.SimSelectButtonImage; CityNameText.Caption = avatar.ResidingCity.Name; String gamepath = GameFacade.GameFilePath(""); int CityNum = GameFacade.GetCityNumber(avatar.ResidingCity.Name); string CityStr = gamepath + "cities\\" + ((CityNum >= 10) ? "city_00" + CityNum.ToString() : "city_000" + CityNum.ToString()); var stream = new FileStream(CityStr + "\\Thumbnail.bmp", FileMode.Open, FileAccess.Read, FileShare.Read); Texture2D cityThumbTex = TextureUtils.Resize(GameFacade.GraphicsDevice, ImageLoader.FromStream( GameFacade.Game.GraphicsDevice, stream), 78, 58); stream.Close(); TextureUtils.CopyAlpha(ref cityThumbTex, Screen.CityHouseButtonAlpha); CityThumb.Texture = cityThumbTex; SetTab(PersonSlotTab.EnterTab); }
/// <summary> /// Handle when a user selects a city /// </summary> /// <param name="element"></param> void CityListBox_OnChange(UIElement element) { var selectedItem = CityListBox.SelectedItem; if (selectedItem == null) { return; } var city = (ShardStatusItem)selectedItem.Data; String gamepath = GameFacade.GameFilePath(""); var fsoMap = int.Parse(city.Map) >= 100; var cityThumb = fsoMap ? Path.Combine(FSOEnvironment.ContentDir, "Cities/city_" + city.Map + "/thumbnail.png") : GameFacade.GameFilePath("cities/city_" + city.Map + "/thumbnail.bmp"); //Take a copy so we dont change the original when we alpha mask it Texture2D cityThumbTex = TextureUtils.Copy(GameFacade.GraphicsDevice, TextureUtils.TextureFromFile( GameFacade.GraphicsDevice, cityThumb)); TextureUtils.CopyAlpha(ref cityThumbTex, thumbnailAlphaImage); CityThumb.Texture = cityThumbTex; DescriptionText.CurrentText = GameFacade.Strings.GetString(fsoMap?"f104":"238", int.Parse(city.Map).ToString()); DescriptionText.VerticalScrollPosition = 0; /** Validate **/ var isValid = true; if (city.Status == ShardStatus.Frontier) { isValid = false; /** Already have a sim in this city **/ ShowCityErrorDialog(CityReservedDialogTitle, CityReservedDialogMessage); } else if (city.Status == ShardStatus.Full) { isValid = false; /** City is full **/ ShowCityErrorDialog(CityFullDialogTitle, CityFullDialogMessage); } else if (city.Status == ShardStatus.Busy) { isValid = false; /** City is busy **/ ShowCityErrorDialog(CityBusyDialogTitle, CityBusyDialogMessage); } OkButton.Disabled = !isValid; }
/// <summary> /// Handle when a user selects a city /// </summary> /// <param name="element"></param> private void CityListBox_OnChange(UIElement element) { var selectedItem = CityListBox.SelectedItem; if (selectedItem == null) { return; } var city = (CityInfo)selectedItem.Data; String gamepath = GameFacade.GameFilePath(""); int CityNum = GameFacade.GetCityNumber(city.Name); string CityStr = gamepath + "cities/" + ((CityNum >= 10) ? "city_00" + CityNum.ToString() : "city_000" + CityNum.ToString()); //Take a copy so we dont change the original when we alpha mask it var stream = new FileStream(CityStr + "/Thumbnail.bmp", FileMode.Open, FileAccess.Read, FileShare.Read); Texture2D cityThumbTex = TextureUtils.Copy(GameFacade.GraphicsDevice, ImageLoader.FromStream( GameFacade.Game.GraphicsDevice, stream)); TextureUtils.CopyAlpha(ref cityThumbTex, thumbnailAlphaImage); stream.Close(); CityThumb.Texture = cityThumbTex; DescriptionText.CurrentText = city.Description; DescriptionText.VerticalScrollPosition = 0; /** Validate **/ var isValid = true; if (city.Status == CityInfoStatus.Reserved) { isValid = false; /** Already have a sim in this city **/ ShowCityErrorDialog(CityReservedDialogTitle, CityReservedDialogMessage); } else if (city.Status == CityInfoStatus.Full) { isValid = false; /** City is full **/ ShowCityErrorDialog(CityFullDialogTitle, CityFullDialogMessage); } else if (city.Status == CityInfoStatus.Busy) { isValid = false; /** City is busy **/ ShowCityErrorDialog(CityBusyDialogTitle, CityBusyDialogMessage); } OkButton.Disabled = !isValid; }
/// <summary> /// Display an avatar /// </summary> /// <param name="avatar"></param> public void DisplayAvatar(AvatarData avatar) { this.Avatar = avatar; var isUsed = avatar != null; SetSlotAvailable(!isUsed); if (avatar == null) { return; } PersonNameText.Caption = avatar.Name; //PersonDescriptionText.CurrentText = avatar.Description; AvatarButton.Texture = Screen.SimSelectButtonImage; var shard = Screen.LoginRegulator.Shards.All.First(x => x.Name == avatar.ShardName); CityNameText.Caption = shard.Name; if (avatar.LotId.HasValue && avatar.LotName != null) { HouseNameText.Caption = avatar.LotName; HouseThumb.Texture = Screen.GetLotThumbnail(avatar.ShardName, avatar.LotLocation.Value); HouseThumb.Y += HouseThumb.Size.Y / 2; HouseThumb.SetSize(HouseThumb.Size.X, (int)(HouseThumb.Size.X * ((double)HouseThumb.Texture.Height / HouseThumb.Texture.Width))); HouseThumb.Y -= HouseThumb.Size.Y / 2; } var cityThumb = (int.Parse(shard.Map) >= 100)? Path.Combine(FSOEnvironment.ContentDir, "Cities/city_" + shard.Map + "/thumbnail.png") : GameFacade.GameFilePath("cities/city_" + shard.Map + "/thumbnail.bmp"); Texture2D cityThumbTex = TextureUtils.Resize( GameFacade.GraphicsDevice, TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, cityThumb), 78, 58); TextureUtils.CopyAlpha(ref cityThumbTex, Screen.CityHouseButtonAlpha); CityThumb.Texture = cityThumbTex; SetTab(PersonSlotTab.EnterTab); Sim.Avatar.Appearance = (AppearanceType)Enum.Parse(typeof(AppearanceType), avatar.AppearanceType.ToString()); Sim.Avatar.BodyOutfitId = avatar.BodyOutfitID; Sim.Avatar.HeadOutfitId = avatar.HeadOutfitID; Sim.Visible = true; PersonDescriptionText.CurrentText = avatar.Description; }
/// <summary> /// Handle when a user selects a city /// </summary> /// <param name="element"></param> void CityListBox_OnChange(TSOClient.Code.UI.Framework.UIElement element) { var selectedItem = CityListBox.SelectedItem; if (selectedItem == null) { return; } var city = (CityInfo)selectedItem.Data; //Take a copy so we dont change the original when we alpha mask it var cityThumb = TextureUtils.Copy(Texture2D.FromFile(GameFacade.GraphicsDevice, new MemoryStream(ContentManager.GetResourceFromLongID(city.Thumbnail)))); TextureUtils.CopyAlpha(ref cityThumb, thumbnailAlphaImage); CityThumb.Texture = cityThumb; DescriptionText.CurrentText = city.Description; DescriptionText.VerticalScrollPosition = 0; /** Validate **/ var isValid = true; if (city.Status == CityInfoStatus.Reserved) { isValid = false; /** Already have a sim in this city **/ ShowCityErrorDialog(CityReservedDialogTitle, CityReservedDialogMessage); } else if (city.Status == CityInfoStatus.Full) { isValid = false; /** City is full **/ ShowCityErrorDialog(CityFullDialogTitle, CityFullDialogMessage); } else if (city.Status == CityInfoStatus.Busy) { isValid = false; /** City is busy **/ ShowCityErrorDialog(CityBusyDialogTitle, CityBusyDialogMessage); } OkButton.Disabled = !isValid; }
/// <summary> /// Display an avatar /// </summary> /// <param name="avatar"></param> public void DisplayAvatar(Sim avatar) { this.Avatar = avatar; SetSlotAvaliable(false); PersonNameText.Caption = avatar.Name; PersonDescriptionText.CurrentText = avatar.Description; AvatarButton.Texture = Screen.SimSelectButtonImage; var myCity = NetworkFacade.Cities.First(x => x.ID == avatar.CityID); CityNameText.Caption = myCity.Name; var cityThumbTex = TextureUtils.Resize(GameFacade.GraphicsDevice, Texture2D.FromFile(GameFacade.GraphicsDevice, new MemoryStream(ContentManager.GetResourceFromLongID(myCity.Thumbnail))), 78, 58); TextureUtils.CopyAlpha(ref cityThumbTex, Screen.CityHouseButtonAlpha); CityThumb.Texture = cityThumbTex; SetTab(PersonSlotTab.EnterTab); }