forked from slothsoft/stardew-informant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[slothsoft#51] create shipping bin decorator
- Loading branch information
Showing
10 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
Informant/Implementation/Decorator/ShippingBinDecorator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Microsoft.Xna.Framework.Graphics; | ||
using Slothsoft.Informant.Api; | ||
|
||
namespace Slothsoft.Informant.Implementation.Decorator; | ||
|
||
internal class ShippingBinDecorator : IDecorator<Item> { | ||
|
||
private static Texture2D? _shippingBin; | ||
|
||
private readonly IModHelper _modHelper; | ||
|
||
public ShippingBinDecorator(IModHelper modHelper) { | ||
_modHelper = modHelper; | ||
_shippingBin ??= modHelper.ModContent.Load<Texture2D>("assets/shipping_bin.png"); | ||
} | ||
|
||
public string Id => "shipping"; | ||
public string DisplayName => _modHelper.Translation.Get("ShippingBinDecorator"); | ||
public string Description => _modHelper.Translation.Get("ShippingBinDecorator.Description"); | ||
|
||
public bool HasDecoration(Item input) { | ||
if (_shippingBin != null && input is SObject obj && !obj.bigCraftable.Value) { | ||
return obj.countsForShippedCollection() && | ||
(!Game1.player.basicShipped.ContainsKey(obj.ParentSheetIndex) || Game1.player.basicShipped[obj.ParentSheetIndex] == 0); | ||
} | ||
return false; | ||
} | ||
|
||
public Decoration Decorate(Item input) { | ||
return new Decoration(_shippingBin!); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.