public UICharacterListItem(PlayerFileData data) { BorderColor = new Color(89, 116, 213) * 0.7f; _dividerTexture = TextureManager.Load("Images/UI/Divider"); _innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground"); _buttonCloudActiveTexture = TextureManager.Load("Images/UI/ButtonCloudActive"); _buttonCloudInactiveTexture = TextureManager.Load("Images/UI/ButtonCloudInactive"); _buttonFavoriteActiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteActive"); _buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive"); _buttonPlayTexture = TextureManager.Load("Images/UI/ButtonPlay"); _buttonDeleteTexture = TextureManager.Load("Images/UI/ButtonDelete"); Height.Set(96f, 0.0f); Width.Set(0.0f, 1f); SetPadding(6f); playerFileData = data; _playerPanel = new UICharacter(data.Player); _playerPanel.Left.Set(4f, 0.0f); _playerPanel.OnDoubleClick += new UIElement.MouseEvent(PlayGame); OnDoubleClick += new UIElement.MouseEvent(PlayGame); Append(_playerPanel); UIImageButton uiImageButton1 = new UIImageButton(_buttonPlayTexture); uiImageButton1.VAlign = 1f; uiImageButton1.Left.Set(4f, 0.0f); uiImageButton1.OnClick += new UIElement.MouseEvent(PlayGame); uiImageButton1.OnMouseOver += new UIElement.MouseEvent(PlayMouseOver); uiImageButton1.OnMouseOut += new UIElement.MouseEvent(ButtonMouseOut); Append(uiImageButton1); UIImageButton uiImageButton2 = new UIImageButton(playerFileData.IsFavorite ? _buttonFavoriteActiveTexture : _buttonFavoriteInactiveTexture); uiImageButton2.VAlign = 1f; uiImageButton2.Left.Set(28f, 0.0f); uiImageButton2.OnClick += new UIElement.MouseEvent(FavoriteButtonClick); uiImageButton2.OnMouseOver += new UIElement.MouseEvent(FavoriteMouseOver); uiImageButton2.OnMouseOut += new UIElement.MouseEvent(ButtonMouseOut); uiImageButton2.SetVisibility(1f, playerFileData.IsFavorite ? 0.8f : 0.4f); Append(uiImageButton2); UIImageButton uiImageButton4 = new UIImageButton(_buttonDeleteTexture); uiImageButton4.VAlign = 1f; uiImageButton4.HAlign = 1f; uiImageButton4.OnClick += new UIElement.MouseEvent(DeleteButtonClick); uiImageButton4.OnMouseOver += new UIElement.MouseEvent(DeleteMouseOver); uiImageButton4.OnMouseOut += new UIElement.MouseEvent(DeleteMouseOut); _deleteButton = uiImageButton4; if (!playerFileData.IsFavorite) Append(uiImageButton4); _buttonLabel = new UIText("", 1f, false); _buttonLabel.VAlign = 1f; _buttonLabel.Left.Set(80f, 0.0f); _buttonLabel.Top.Set(-3f, 0.0f); Append(_buttonLabel); _deleteButtonLabel = new UIText("", 1f, false); _deleteButtonLabel.VAlign = 1f; _deleteButtonLabel.HAlign = 1f; _deleteButtonLabel.Left.Set(-30f, 0.0f); _deleteButtonLabel.Top.Set(-3f, 0.0f); Append(_deleteButtonLabel); }
private void DrawSpecialCharacter(On.Terraria.GameContent.UI.Elements.UICharacterListItem.orig_DrawSelf orig, Terraria.GameContent.UI.Elements.UICharacterListItem self, SpriteBatch spriteBatch) { orig(self, spriteBatch); Vector2 origin = new Vector2(self.GetDimensions().X, self.GetDimensions().Y); Rectangle box = new Rectangle((int)(origin + new Vector2(86, 66)).X, (int)(origin + new Vector2(86, 66)).Y, 80, 25); int playerStamina = 0; //horray double reflection, f**k you vanilla Type typ = self.GetType(); FieldInfo playerInfo = typ.GetField("_playerPanel", BindingFlags.NonPublic | BindingFlags.Instance); UICharacter character = (UICharacter)playerInfo.GetValue(self); Type typ2 = character.GetType(); FieldInfo playerInfo2 = typ2.GetField("_player", BindingFlags.NonPublic | BindingFlags.Instance); Player player = (Player)playerInfo2.GetValue(character); AbilityHandler mp = player.GetModPlayer <AbilityHandler>(); playerStamina = mp.staminamax + mp.permanentstamina; Texture2D wind = mp.unlock[0] == 1 ? ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Wind1") : ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Wind0"); Texture2D wisp = mp.unlock[1] == 1 ? ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Wisp1") : ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Wisp0"); Texture2D pure = mp.unlock[2] == 1 ? ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Purity1") : ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Purity0"); Texture2D smash = mp.unlock[3] == 1 ? ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Smash1") : ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Smash0"); Texture2D shadow = mp.unlock[4] == 1 ? ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Cloak1") : ModContent.GetTexture("StarlightRiver/NPCs/Pickups/Cloak0"); spriteBatch.Draw(ModContent.GetTexture("StarlightRiver/GUI/box"), box, Color.White); //Stamina box if (mp.unlock.Any(k => k > 0)) //Draw stamina if unlocked { spriteBatch.Draw(ModContent.GetTexture("StarlightRiver/GUI/Stamina"), origin + new Vector2(91, 68), Color.White); Utils.DrawBorderString(spriteBatch, playerStamina + " SP", origin + new Vector2(118, 68), Color.White); } else//Myserious if locked { spriteBatch.Draw(ModContent.GetTexture("StarlightRiver/GUI/Stamina3"), origin + new Vector2(91, 68), Color.White); Utils.DrawBorderString(spriteBatch, "???", origin + new Vector2(118, 68), Color.White); } //Draw ability Icons spriteBatch.Draw(wind, origin + new Vector2(390, 62), Color.White); spriteBatch.Draw(wisp, origin + new Vector2(426, 62), Color.White); spriteBatch.Draw(pure, origin + new Vector2(462, 62), Color.White); spriteBatch.Draw(smash, origin + new Vector2(498, 62), Color.White); spriteBatch.Draw(shadow, origin + new Vector2(534, 62), Color.White); if (player.statLifeMax > 400) //why vanilla dosent do this I dont know { spriteBatch.Draw(Main.heart2Texture, origin + new Vector2(80, 37), Color.White); } }
public UIClothStyleButton(Player player, int clothStyleId) { _player = player; ClothStyleId = clothStyleId; Width = StyleDimension.FromPixels(44f); Height = StyleDimension.FromPixels(80f); _BasePanelTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanel", (AssetRequestMode)1); _selectedBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", (AssetRequestMode)1); _hoveredBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelBorder", (AssetRequestMode)1); _char = new UICharacter(_player, animated: false, hasBackPanel: false) { HAlign = 0.5f, VAlign = 0.5f }; Append(_char); }
public UIClothStyleButton(Player player, int clothStyleId) { this._player = player; this.ClothStyleId = clothStyleId; this.Width = StyleDimension.FromPixels(44f); this.Height = StyleDimension.FromPixels(80f); this._BasePanelTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanel", (AssetRequestMode)1); this._selectedBorderTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", (AssetRequestMode)1); this._hoveredBorderTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelBorder", (AssetRequestMode)1); UICharacter uiCharacter = new UICharacter(this._player, false, false, 1f); uiCharacter.HAlign = 0.5f; uiCharacter.VAlign = 0.5f; this._char = uiCharacter; this.Append((UIElement)this._char); }
public UICharacterListItem(PlayerFileData data) { BorderColor = new Color(89, 116, 213) * 0.7f; _dividerTexture = TextureManager.Load("Images/UI/Divider"); _innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground"); _buttonCloudActiveTexture = TextureManager.Load("Images/UI/ButtonCloudActive"); _buttonCloudInactiveTexture = TextureManager.Load("Images/UI/ButtonCloudInactive"); _buttonFavoriteActiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteActive"); _buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive"); _buttonPlayTexture = TextureManager.Load("Images/UI/ButtonPlay"); _buttonDeleteTexture = TextureManager.Load("Images/UI/ButtonDelete"); Height.Set(96f, 0f); Width.Set(0f, 1f); SetPadding(6f); _data = data; _playerPanel = new UICharacter(data.Player); _playerPanel.Left.Set(4f, 0f); _playerPanel.OnDoubleClick += PlayGame; base.OnDoubleClick += PlayGame; Append(_playerPanel); UIImageButton uIImageButton = new UIImageButton(_buttonPlayTexture); uIImageButton.VAlign = 1f; uIImageButton.Left.Set(4f, 0f); uIImageButton.OnClick += PlayGame; uIImageButton.OnMouseOver += PlayMouseOver; uIImageButton.OnMouseOut += ButtonMouseOut; Append(uIImageButton); UIImageButton uIImageButton2 = new UIImageButton(_data.IsFavorite ? _buttonFavoriteActiveTexture : _buttonFavoriteInactiveTexture); uIImageButton2.VAlign = 1f; uIImageButton2.Left.Set(28f, 0f); uIImageButton2.OnClick += FavoriteButtonClick; uIImageButton2.OnMouseOver += FavoriteMouseOver; uIImageButton2.OnMouseOut += ButtonMouseOut; uIImageButton2.SetVisibility(1f, _data.IsFavorite ? 0.8f : 0.4f); Append(uIImageButton2); if (SocialAPI.Cloud != null) { UIImageButton uIImageButton3 = new UIImageButton(_data.IsCloudSave ? _buttonCloudActiveTexture : _buttonCloudInactiveTexture); uIImageButton3.VAlign = 1f; uIImageButton3.Left.Set(52f, 0f); uIImageButton3.OnClick += CloudButtonClick; uIImageButton3.OnMouseOver += CloudMouseOver; uIImageButton3.OnMouseOut += ButtonMouseOut; Append(uIImageButton3); } UIImageButton uIImageButton4 = new UIImageButton(_buttonDeleteTexture); uIImageButton4.VAlign = 1f; uIImageButton4.HAlign = 1f; uIImageButton4.OnClick += DeleteButtonClick; uIImageButton4.OnMouseOver += DeleteMouseOver; uIImageButton4.OnMouseOut += DeleteMouseOut; _deleteButton = uIImageButton4; if (!_data.IsFavorite) { Append(uIImageButton4); } _buttonLabel = new UIText(""); _buttonLabel.VAlign = 1f; _buttonLabel.Left.Set(80f, 0f); _buttonLabel.Top.Set(-3f, 0f); Append(_buttonLabel); _deleteButtonLabel = new UIText(""); _deleteButtonLabel.VAlign = 1f; _deleteButtonLabel.HAlign = 1f; _deleteButtonLabel.Left.Set(-30f, 0f); _deleteButtonLabel.Top.Set(-3f, 0f); Append(_deleteButtonLabel); }
public UICharacterListItem(PlayerFileData data, int snapPointIndex) { this.BorderColor = new Color(89, 116, 213) * 0.7f; this._dividerTexture = TextureManager.Load("Images/UI/Divider"); this._innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground"); this._buttonCloudActiveTexture = TextureManager.Load("Images/UI/ButtonCloudActive"); this._buttonCloudInactiveTexture = TextureManager.Load("Images/UI/ButtonCloudInactive"); this._buttonFavoriteActiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteActive"); this._buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive"); this._buttonPlayTexture = TextureManager.Load("Images/UI/ButtonPlay"); this._buttonDeleteTexture = TextureManager.Load("Images/UI/ButtonDelete"); this.Height.Set(96f, 0.0f); this.Width.Set(0.0f, 1f); this.SetPadding(6f); this._data = data; this._playerPanel = new UICharacter(data.Player); this._playerPanel.Left.Set(4f, 0.0f); this._playerPanel.OnDoubleClick += new UIElement.MouseEvent(this.PlayGame); this.OnDoubleClick += new UIElement.MouseEvent(this.PlayGame); this.Append((UIElement)this._playerPanel); UIImageButton uiImageButton1 = new UIImageButton(this._buttonPlayTexture); uiImageButton1.VAlign = 1f; uiImageButton1.Left.Set(4f, 0.0f); uiImageButton1.OnClick += new UIElement.MouseEvent(this.PlayGame); uiImageButton1.OnMouseOver += new UIElement.MouseEvent(this.PlayMouseOver); uiImageButton1.OnMouseOut += new UIElement.MouseEvent(this.ButtonMouseOut); this.Append((UIElement)uiImageButton1); UIImageButton uiImageButton2 = new UIImageButton(this._data.IsFavorite ? this._buttonFavoriteActiveTexture : this._buttonFavoriteInactiveTexture); uiImageButton2.VAlign = 1f; uiImageButton2.Left.Set(28f, 0.0f); uiImageButton2.OnClick += new UIElement.MouseEvent(this.FavoriteButtonClick); uiImageButton2.OnMouseOver += new UIElement.MouseEvent(this.FavoriteMouseOver); uiImageButton2.OnMouseOut += new UIElement.MouseEvent(this.ButtonMouseOut); uiImageButton2.SetVisibility(1f, this._data.IsFavorite ? 0.8f : 0.4f); this.Append((UIElement)uiImageButton2); if (SocialAPI.Cloud != null) { UIImageButton uiImageButton3 = new UIImageButton(this._data.IsCloudSave ? this._buttonCloudActiveTexture : this._buttonCloudInactiveTexture); uiImageButton3.VAlign = 1f; uiImageButton3.Left.Set(52f, 0.0f); uiImageButton3.OnClick += new UIElement.MouseEvent(this.CloudButtonClick); uiImageButton3.OnMouseOver += new UIElement.MouseEvent(this.CloudMouseOver); uiImageButton3.OnMouseOut += new UIElement.MouseEvent(this.ButtonMouseOut); this.Append((UIElement)uiImageButton3); uiImageButton3.SetSnapPoint("Cloud", snapPointIndex, new Vector2?(), new Vector2?()); } UIImageButton uiImageButton4 = new UIImageButton(this._buttonDeleteTexture); uiImageButton4.VAlign = 1f; uiImageButton4.HAlign = 1f; uiImageButton4.OnClick += new UIElement.MouseEvent(this.DeleteButtonClick); uiImageButton4.OnMouseOver += new UIElement.MouseEvent(this.DeleteMouseOver); uiImageButton4.OnMouseOut += new UIElement.MouseEvent(this.DeleteMouseOut); this._deleteButton = uiImageButton4; if (!this._data.IsFavorite) { this.Append((UIElement)uiImageButton4); } this._buttonLabel = new UIText("", 1f, false); this._buttonLabel.VAlign = 1f; this._buttonLabel.Left.Set(80f, 0.0f); this._buttonLabel.Top.Set(-3f, 0.0f); this.Append((UIElement)this._buttonLabel); this._deleteButtonLabel = new UIText("", 1f, false); this._deleteButtonLabel.VAlign = 1f; this._deleteButtonLabel.HAlign = 1f; this._deleteButtonLabel.Left.Set(-30f, 0.0f); this._deleteButtonLabel.Top.Set(-3f, 0.0f); this.Append((UIElement)this._deleteButtonLabel); uiImageButton1.SetSnapPoint("Play", snapPointIndex, new Vector2?(), new Vector2?()); uiImageButton2.SetSnapPoint("Favorite", snapPointIndex, new Vector2?(), new Vector2?()); uiImageButton4.SetSnapPoint("Delete", snapPointIndex, new Vector2?(), new Vector2?()); }
public UICharacterListItem(PlayerFileData data) { BorderColor = new Color(89, 116, 213) * 0.7f; _dividerTexture = TextureManager.Load("Images/UI/Divider"); _innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground"); _buttonCloudActiveTexture = TextureManager.Load("Images/UI/ButtonCloudActive"); _buttonCloudInactiveTexture = TextureManager.Load("Images/UI/ButtonCloudInactive"); _buttonFavoriteActiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteActive"); _buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive"); _buttonPlayTexture = TextureManager.Load("Images/UI/ButtonPlay"); _buttonDeleteTexture = TextureManager.Load("Images/UI/ButtonDelete"); Height.Set(96f, 0.0f); Width.Set(0.0f, 1f); SetPadding(6f); playerFileData = data; _playerPanel = new UICharacter(data.Player); _playerPanel.Left.Set(4f, 0.0f); _playerPanel.OnDoubleClick += new UIElement.MouseEvent(PlayGame); OnDoubleClick += new UIElement.MouseEvent(PlayGame); Append(_playerPanel); UIImageButton uiImageButton1 = new UIImageButton(_buttonPlayTexture); uiImageButton1.VAlign = 1f; uiImageButton1.Left.Set(4f, 0.0f); uiImageButton1.OnClick += new UIElement.MouseEvent(PlayGame); uiImageButton1.OnMouseOver += new UIElement.MouseEvent(PlayMouseOver); uiImageButton1.OnMouseOut += new UIElement.MouseEvent(ButtonMouseOut); Append(uiImageButton1); UIImageButton uiImageButton2 = new UIImageButton(playerFileData.IsFavorite ? _buttonFavoriteActiveTexture : _buttonFavoriteInactiveTexture); uiImageButton2.VAlign = 1f; uiImageButton2.Left.Set(28f, 0.0f); uiImageButton2.OnClick += new UIElement.MouseEvent(FavoriteButtonClick); uiImageButton2.OnMouseOver += new UIElement.MouseEvent(FavoriteMouseOver); uiImageButton2.OnMouseOut += new UIElement.MouseEvent(ButtonMouseOut); uiImageButton2.SetVisibility(1f, playerFileData.IsFavorite ? 0.8f : 0.4f); Append(uiImageButton2); UIImageButton uiImageButton4 = new UIImageButton(_buttonDeleteTexture); uiImageButton4.VAlign = 1f; uiImageButton4.HAlign = 1f; uiImageButton4.OnClick += new UIElement.MouseEvent(DeleteButtonClick); uiImageButton4.OnMouseOver += new UIElement.MouseEvent(DeleteMouseOver); uiImageButton4.OnMouseOut += new UIElement.MouseEvent(DeleteMouseOut); _deleteButton = uiImageButton4; if (!playerFileData.IsFavorite) { Append(uiImageButton4); } _buttonLabel = new UIText("", 1f, false); _buttonLabel.VAlign = 1f; _buttonLabel.Left.Set(80f, 0.0f); _buttonLabel.Top.Set(-3f, 0.0f); Append(_buttonLabel); _deleteButtonLabel = new UIText("", 1f, false); _deleteButtonLabel.VAlign = 1f; _deleteButtonLabel.HAlign = 1f; _deleteButtonLabel.Left.Set(-30f, 0.0f); _deleteButtonLabel.Top.Set(-3f, 0.0f); Append(_deleteButtonLabel); }
public UICharacterListItem(PlayerFileData data) { this.BorderColor = new Color(89, 116, 213) * 0.7f; this._dividerTexture = TextureManager.Load("Images/UI/Divider"); this._innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground"); this._buttonCloudActiveTexture = TextureManager.Load("Images/UI/ButtonCloudActive"); this._buttonCloudInactiveTexture = TextureManager.Load("Images/UI/ButtonCloudInactive"); this._buttonFavoriteActiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteActive"); this._buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive"); this._buttonPlayTexture = TextureManager.Load("Images/UI/ButtonPlay"); this._buttonDeleteTexture = TextureManager.Load("Images/UI/ButtonDelete"); this.Height.Set(96f, 0f); this.Width.Set(0f, 1f); base.SetPadding(6f); this._data = data; this._playerPanel = new UICharacter(data.Player); this._playerPanel.Left.Set(4f, 0f); this._playerPanel.OnDoubleClick += new UIElement.MouseEvent(this.PlayGame); base.OnDoubleClick += new UIElement.MouseEvent(this.PlayGame); base.Append(this._playerPanel); UIImageButton uIImageButton = new UIImageButton(this._buttonPlayTexture); uIImageButton.VAlign = 1f; uIImageButton.Left.Set(4f, 0f); uIImageButton.OnClick += new UIElement.MouseEvent(this.PlayGame); uIImageButton.OnMouseOver += new UIElement.MouseEvent(this.PlayMouseOver); uIImageButton.OnMouseOut += new UIElement.MouseEvent(this.ButtonMouseOut); base.Append(uIImageButton); UIImageButton uIImageButton2 = new UIImageButton(this._data.IsFavorite ? this._buttonFavoriteActiveTexture : this._buttonFavoriteInactiveTexture); uIImageButton2.VAlign = 1f; uIImageButton2.Left.Set(28f, 0f); uIImageButton2.OnClick += new UIElement.MouseEvent(this.FavoriteButtonClick); uIImageButton2.OnMouseOver += new UIElement.MouseEvent(this.FavoriteMouseOver); uIImageButton2.OnMouseOut += new UIElement.MouseEvent(this.ButtonMouseOut); uIImageButton2.SetVisibility(1f, this._data.IsFavorite ? 0.8f : 0.4f); base.Append(uIImageButton2); if (SocialAPI.Cloud != null) { UIImageButton uIImageButton3 = new UIImageButton(this._data.IsCloudSave ? this._buttonCloudActiveTexture : this._buttonCloudInactiveTexture); uIImageButton3.VAlign = 1f; uIImageButton3.Left.Set(52f, 0f); uIImageButton3.OnClick += new UIElement.MouseEvent(this.CloudButtonClick); uIImageButton3.OnMouseOver += new UIElement.MouseEvent(this.CloudMouseOver); uIImageButton3.OnMouseOut += new UIElement.MouseEvent(this.ButtonMouseOut); base.Append(uIImageButton3); } UIImageButton uIImageButton4 = new UIImageButton(this._buttonDeleteTexture); uIImageButton4.VAlign = 1f; uIImageButton4.HAlign = 1f; uIImageButton4.OnClick += new UIElement.MouseEvent(this.DeleteButtonClick); uIImageButton4.OnMouseOver += new UIElement.MouseEvent(this.DeleteMouseOver); uIImageButton4.OnMouseOut += new UIElement.MouseEvent(this.DeleteMouseOut); this._deleteButton = uIImageButton4; if (!this._data.IsFavorite) { base.Append(uIImageButton4); } this._buttonLabel = new UIText("", 1f, false); this._buttonLabel.VAlign = 1f; this._buttonLabel.Left.Set(80f, 0f); this._buttonLabel.Top.Set(-3f, 0f); base.Append(this._buttonLabel); this._deleteButtonLabel = new UIText("", 1f, false); this._deleteButtonLabel.VAlign = 1f; this._deleteButtonLabel.HAlign = 1f; this._deleteButtonLabel.Left.Set(-30f, 0f); this._deleteButtonLabel.Top.Set(-3f, 0f); base.Append(this._deleteButtonLabel); }
public UICharacterListItem(PlayerFileData data, int snapPointIndex) { BorderColor = new Color(89, 116, 213) * 0.7f; _dividerTexture = Main.Assets.Request <Texture2D>("Images/UI/Divider", Main.content, (AssetRequestMode)1); _innerPanelTexture = Main.Assets.Request <Texture2D>("Images/UI/InnerPanelBackground", Main.content, (AssetRequestMode)1); _buttonCloudActiveTexture = Main.Assets.Request <Texture2D>("Images/UI/ButtonCloudActive", Main.content, (AssetRequestMode)1); _buttonCloudInactiveTexture = Main.Assets.Request <Texture2D>("Images/UI/ButtonCloudInactive", Main.content, (AssetRequestMode)1); _buttonFavoriteActiveTexture = Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteActive", Main.content, (AssetRequestMode)1); _buttonFavoriteInactiveTexture = Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteInactive", Main.content, (AssetRequestMode)1); _buttonPlayTexture = Main.Assets.Request <Texture2D>("Images/UI/ButtonPlay", Main.content, (AssetRequestMode)1); _buttonDeleteTexture = Main.Assets.Request <Texture2D>("Images/UI/ButtonDelete", Main.content, (AssetRequestMode)1); Height.Set(96f, 0f); Width.Set(0f, 1f); SetPadding(6f); _data = data; _playerPanel = new UICharacter(data.Player); _playerPanel.Left.Set(4f, 0f); _playerPanel.OnDoubleClick += PlayGame; base.OnDoubleClick += PlayGame; Append(_playerPanel); UIImageButton uIImageButton = new UIImageButton(_buttonPlayTexture); uIImageButton.VAlign = 1f; uIImageButton.Left.Set(4f, 0f); uIImageButton.OnClick += PlayGame; uIImageButton.OnMouseOver += PlayMouseOver; uIImageButton.OnMouseOut += ButtonMouseOut; Append(uIImageButton); UIImageButton uIImageButton2 = new UIImageButton(_data.IsFavorite ? _buttonFavoriteActiveTexture : _buttonFavoriteInactiveTexture); uIImageButton2.VAlign = 1f; uIImageButton2.Left.Set(28f, 0f); uIImageButton2.OnClick += FavoriteButtonClick; uIImageButton2.OnMouseOver += FavoriteMouseOver; uIImageButton2.OnMouseOut += ButtonMouseOut; uIImageButton2.SetVisibility(1f, _data.IsFavorite ? 0.8f : 0.4f); Append(uIImageButton2); if (SocialAPI.Cloud != null) { UIImageButton uIImageButton3 = new UIImageButton(_data.IsCloudSave ? _buttonCloudActiveTexture : _buttonCloudInactiveTexture); uIImageButton3.VAlign = 1f; uIImageButton3.Left.Set(52f, 0f); uIImageButton3.OnClick += CloudButtonClick; uIImageButton3.OnMouseOver += CloudMouseOver; uIImageButton3.OnMouseOut += ButtonMouseOut; Append(uIImageButton3); uIImageButton3.SetSnapPoint("Cloud", snapPointIndex); } UIImageButton uIImageButton4 = new UIImageButton(_buttonDeleteTexture) { VAlign = 1f, HAlign = 1f }; if (!_data.IsFavorite) { uIImageButton4.OnClick += DeleteButtonClick; } uIImageButton4.OnMouseOver += DeleteMouseOver; uIImageButton4.OnMouseOut += DeleteMouseOut; _deleteButton = uIImageButton4; Append(uIImageButton4); _buttonLabel = new UIText(""); _buttonLabel.VAlign = 1f; _buttonLabel.Left.Set(80f, 0f); _buttonLabel.Top.Set(-3f, 0f); Append(_buttonLabel); _deleteButtonLabel = new UIText(""); _deleteButtonLabel.VAlign = 1f; _deleteButtonLabel.HAlign = 1f; _deleteButtonLabel.Left.Set(-30f, 0f); _deleteButtonLabel.Top.Set(-3f, 0f); Append(_deleteButtonLabel); uIImageButton.SetSnapPoint("Play", snapPointIndex); uIImageButton2.SetSnapPoint("Favorite", snapPointIndex); uIImageButton4.SetSnapPoint("Delete", snapPointIndex); }