Skip to content

Commit

Permalink
Merge pull request #60 from Deflaktor/master
Browse files Browse the repository at this point in the history
Fix #58
  • Loading branch information
Annosz authored Aug 23, 2021
2 parents 06da577 + 503b151 commit 9c26329
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
30 changes: 15 additions & 15 deletions UIInfoSuite2/UIElements/LocationOfTownsfolk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,23 @@ private void InitializeProperties()
}

_checkboxes.Clear();
foreach (var friendName in _friendNames)
for (int i = 0; i < _friendNames.Length; i++)
{
int hashCode = friendName.GetHashCode();
OptionsCheckbox checkbox = new OptionsCheckbox("", hashCode);
_checkboxes.Add(checkbox);

//default to on
bool optionForThisFriend = true;
if (!Game1.player.friendshipData.ContainsKey(friendName))
var friendName = _friendNames[i];
OptionsCheckbox checkbox = new OptionsCheckbox("", i);
if (Game1.player.friendshipData.ContainsKey(friendName))
{
checkbox.greyedOut = true;
optionForThisFriend = false;
// npc
checkbox.greyedOut = false;
checkbox.isChecked = _options.ShowLocationOfFriends.SafeGet(friendName, true);
}
else
{
bool optionValue = _options.ShowLocationOfFriends.SafeGet(hashCode.ToString(), optionForThisFriend);
// player
checkbox.greyedOut = true;
checkbox.isChecked = true;
}
checkbox.isChecked = optionForThisFriend;
_checkboxes.Add(checkbox);
}
}
}
Expand All @@ -220,7 +219,7 @@ private void CheckSelectedBox()
!checkbox.greyedOut)
{
checkbox.isChecked = !checkbox.isChecked;
_options.ShowLocationOfFriends[checkbox.whichOption.ToString()] = checkbox.isChecked;
_options.ShowLocationOfFriends[_friendNames[checkbox.whichOption]] = checkbox.isChecked;
Game1.playSound("drumkit6");
}
}
Expand Down Expand Up @@ -252,7 +251,8 @@ private void DrawSocialPageOptions()

if (yOffset != 560)
{
Game1.spriteBatch.Draw(Game1.staminaRect, new Rectangle(checkbox.bounds.X - 50, checkbox.bounds.Y + 72, SocialPanelWidth / 2 - 6, 4), Color.SaddleBrown);
// draw seperator line
Game1.spriteBatch.Draw(Game1.staminaRect, new Rectangle(checkbox.bounds.X - 50, checkbox.bounds.Y + 72, SocialPanelWidth / 2 - 6, 4), Color.SaddleBrown);
Game1.spriteBatch.Draw(Game1.staminaRect, new Rectangle(checkbox.bounds.X - 50, checkbox.bounds.Y + 76, SocialPanelWidth / 2 - 6, 4), Color.BurlyWood);
}
if (!Game1.options.hardwareCursor)
Expand All @@ -274,7 +274,7 @@ private void DrawNPCLocationsOnMap(GameMenu gameMenu)
{
try
{
bool shouldDrawCharacter = Game1.player.friendshipData.ContainsKey(character.Name) && _options.ShowLocationOfFriends.SafeGet(character.Name.GetHashCode().ToString());
bool shouldDrawCharacter = Game1.player.friendshipData.ContainsKey(character.Name) && _options.ShowLocationOfFriends.SafeGet(character.Name, true);
if (shouldDrawCharacter)
{
DrawNPC(character, namesToShow);
Expand Down
2 changes: 0 additions & 2 deletions UIInfoSuite2/UIInfoSuite2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Infrastucture\Extensions\CollectionExtensions.cs" />
Expand Down

0 comments on commit 9c26329

Please sign in to comment.