internal Object GetHoveredItem() { if (HoveredSlot.HasValue) { int Index = SlotBounds.IndexOf(HoveredSlot.Value); if (Index >= 0 && Index < PlaceholderItems.Count) { return(PlaceholderItems[Index]); } else { return(null); } } else { return(null); } }
public void DrawToolTips(SpriteBatch b) { // Draw tooltips on the hovered item inside the bag if (HoveredSlot.HasValue) { ItemBag HoveredBag = GetHoveredBag(); if (HoveredBag == null) { int Index = SlotBounds.IndexOf(HoveredSlot.Value); if (Index >= 0 && Index < Placeholders.Count) { HoveredBag = Placeholders[Index]; } } if (HoveredBag != null) { Rectangle Location; if (IsNavigatingWithGamepad) { Location = HoveredSlot.Value; //new Rectangle(HoveredSlot.Value.Right, HoveredSlot.Value.Bottom, 1, 1); } else { Location = new Rectangle(Game1.getMouseX() - 8, Game1.getMouseY() + 36, 8 + 36, 1); } //if (HoveredBag is Rucksack RS) //{ // int XPos = Location.Right; // int YPos = Location.Bottom; // RS.drawTooltip(b, ref XPos, ref YPos, Game1.smallFont, 1f, RS.Description); //} //else //{ // DrawHelpers.DrawToolTipInfo(b, Location, HoveredBag, true, true, true, true, true, Bag.MaxStackSize); //} DrawHelpers.DrawToolTipInfo(b, Location, HoveredBag, true, true, true, true, true, true, Bag.MaxStackSize); } } }
internal ItemBag GetHoveredBag() { if (HoveredSlot.HasValue) { int Index = SlotBounds.IndexOf(HoveredSlot.Value); if (Index >= 0 && Index < Placeholders.Count) { return(ActualContents[Index]); //string TypeId = Placeholders[Index].GetTypeId(); //return OmniBag.NestedBags.FirstOrDefault(x => x.GetTypeId() == TypeId); } else { return(null); } } else { return(null); } }