private void DrawAttribute(PersonStatUiItem item, SpriteBatch spriteBatch) { var sourceRect = GetAttributeIcon(item.Attribute.Type); spriteBatch.Draw(_uiContentStorage.GetAttributeBackgroundTexture(), new Vector2(item.UiRect.Left, item.UiRect.Top), Color.White); spriteBatch.Draw(_uiContentStorage.GetAttributeIconsTexture(), new Vector2(item.UiRect.Left, item.UiRect.Top), sourceRect, Color.White); var attributeTitle = GetAttributeTitle(item.Attribute); var attributeValue = GetAttributeTextValue(item.Attribute); spriteBatch.DrawString( _uiContentStorage.GetButtonFont(), $"{attributeTitle}: {attributeValue}", new Vector2(item.UiRect.Right + ATTRIBUTE_ITEM_SPACING, item.UiRect.Top), new Color(195, 180, 155)); }
/// <inheritdoc /> protected override void InitContent() { base.InitContent(); var person = _uiState.ActiveActor?.Actor?.Person; if (person is null) { throw new InvalidOperationException("Active person must be selected before this dialog was opened."); } var attributesModule = person.GetModuleSafe <IAttributesModule>(); if (attributesModule is null) { throw new InvalidOperationException( "Active person must have attributes to shown in this dialog."); } var currentAttributeItemList = new List <PersonStatUiItem>(); var attributes = attributesModule.GetAttributes(); foreach (var attribute in attributes) { var lastIndex = currentAttributeItemList.Count; var relativeY = lastIndex * (ATTRIBUTE_ITEM_SIZE + ATTRIBUTE_ITEM_SPACING); var uiRect = new Rectangle( ContentRect.Left, ContentRect.Top + relativeY, ATTRIBUTE_ITEM_SIZE, ATTRIBUTE_ITEM_SIZE); var uiItem = new PersonStatUiItem(attribute, lastIndex, uiRect); currentAttributeItemList.Add(uiItem); } _currentAttributesItems = currentAttributeItemList.ToArray(); }