Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions InscryptionAPI/PixelCard/PixelCardBehaviours.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public override void ApplyAppearance() { }
public virtual Sprite PixelAppearance() { return null; }
public virtual Sprite OverridePixelPortrait() { return null; }
public virtual Sprite OverrideBackground() { return null; }
public virtual Sprite OverrideQueuedBackground() { return null; }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do me a favor, add a XML comment explaining what this does or is for. See the Documentation branch of the repository for examples (Note the documentation refactor is a work in progress). ^^

This isn't a blocking, just a would be nice.

public virtual void OnAppearanceApplied() { }
}

Expand Down
14 changes: 12 additions & 2 deletions InscryptionAPI/PixelCard/PixelCardManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ private static void DecalPatches(PixelCardDisplayer __instance, PlayableCard pla

private static void AddDecalToCard(in PixelCardDisplayer instance, PlayableCard playableCard)
{
Transform cardElements = instance?.gameObject?.transform?.Find("CardElements");
if (cardElements == null)
Transform cardElements = instance?.cardElements?.transform;
Transform queuedCardElements = instance?.queuedCardElements?.transform;
if (cardElements == null || queuedCardElements == null)
return;

List<Transform> existingDecals = new();
Expand Down Expand Up @@ -139,6 +140,15 @@ private static void AddDecalToCard(in PixelCardDisplayer instance, PlayableCard
Sprite overridePortrait = pixelBehav.OverridePixelPortrait();
if (overridePortrait != null)
instance.SetPortrait(overridePortrait);
// override queued background
Sprite overrideQueuedBackground = pixelBehav.OverrideQueuedBackground();
if (overrideQueuedBackground != null)
{
Transform queuedBackground = queuedCardElements.Find("QueuedBackground");
SpriteRenderer component = queuedBackground?.GetComponent<SpriteRenderer>();
if (component != null)
component.sprite = overrideQueuedBackground;
}
}
UnityObject.Destroy(behav);
}
Expand Down