public override int CompareTo(object obj) { UICharacterListItem uICharacterListItem = obj as UICharacterListItem; if (uICharacterListItem != null) { if (IsFavorite && !uICharacterListItem.IsFavorite) { return(-1); } if (!IsFavorite && uICharacterListItem.IsFavorite) { return(1); } return(_data.Name.CompareTo(uICharacterListItem._data.Name)); } return(base.CompareTo(obj)); }
public override int CompareTo(object obj) { UICharacterListItem characterListItem = obj as UICharacterListItem; if (characterListItem == null) { return(base.CompareTo(obj)); } if (IsFavorite && !characterListItem.IsFavorite) { return(-1); } if (!IsFavorite && characterListItem.IsFavorite) { return(1); } return(playerFileData.Name.CompareTo(characterListItem.playerFileData.Name)); }
public override int CompareTo(object obj) { UICharacterListItem characterListItem = obj as UICharacterListItem; if (characterListItem == null) { return(base.CompareTo(obj)); } if (this.IsFavorite && !characterListItem.IsFavorite) { return(-1); } if (!this.IsFavorite && characterListItem.IsFavorite) { return(1); } if (this._data.Name.CompareTo(characterListItem._data.Name) != 0) { return(this._data.Name.CompareTo(characterListItem._data.Name)); } return(this._data.GetFileName(true).CompareTo(characterListItem._data.GetFileName(true))); }
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); } }