Skip to content

Commit

Permalink
Merge pull request #275 from JamesVeug/feature/Translations
Browse files Browse the repository at this point in the history
Feature/translations
  • Loading branch information
IngoHHacks authored Oct 11, 2023
2 parents 3858eb9 + 3fa79df commit a782877
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
15 changes: 15 additions & 0 deletions InscryptionAPI/Card/CardExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,11 @@ public static CardInfo SetEmissivePortrait(this CardInfo info, Sprite sprite)

return info;
}

public static Sprite GetEmissivePortrait(this CardInfo info)
{
return info.portraitTex.GetEmissionSprite();
}

/// <summary>
/// Sets the emissive alternate portrait for the card. This can only be done after the default portrait has been set (SetPortrait)
Expand Down Expand Up @@ -1316,6 +1321,11 @@ public static CardInfo SetEmissiveAltPortrait(this CardInfo info, Sprite portrai

return info;
}

public static Sprite GetEmissiveAltPortrait(this CardInfo info)
{
return info.alternatePortrait.GetEmissionSprite();
}

#endregion

Expand Down Expand Up @@ -1359,6 +1369,11 @@ public static CardInfo SetPixelPortrait(this CardInfo info, Sprite portrait)

return info;
}

public static Sprite GetPixelPortrait(this CardInfo info)
{
return info.pixelPortrait;
}

#endregion

Expand Down
2 changes: 1 addition & 1 deletion InscryptionAPI/Card/CardManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public static CardInfo New(string modPrefix, string name, string displayName, in
}
}

internal static Dictionary<string, string> GetCardExtensionTable(this CardInfo card) => CardExtensionProperties.GetOrCreateValue(card).StringMap;
public static Dictionary<string, string> GetCardExtensionTable(this CardInfo card) => CardExtensionProperties.GetOrCreateValue(card).StringMap;
internal static CardAltPortraits GetAltPortraits(this CardInfo card) => CardAlternatePortraits.GetOrCreateValue(card);

public static Sprite PixelAlternatePortrait(this CardInfo card)
Expand Down
4 changes: 4 additions & 0 deletions InscryptionAPI/Card/TribeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public static Tribe Add(string guid, string name, Texture2D tribeIcon = null, bo
Texture2D cardbackTexture = choiceCardbackTexture ?? MakePlaceholderCardback(tribeIcon);
TribeInfo info = new()
{
guid = guid,
name = name,
tribe = tribe,
icon = tribeIcon?.ConvertTexture(),
cardback = cardbackTexture,
Expand Down Expand Up @@ -222,6 +224,8 @@ public static Texture2D GetTribeIcon(Tribe tribe, bool useMissingIconIfNull = tr

public class TribeInfo
{
public string guid;
public string name;
public Tribe tribe;
public Sprite icon;
public bool tribeChoice;
Expand Down
25 changes: 25 additions & 0 deletions InscryptionAPI/Helpers/TextureHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,31 @@ public static void RegisterEmissionForSprite(this Sprite regularSprite, Sprite e
emissionMap[regularSprite] = emissionSprite;
}

public static Sprite GetEmissionSprite(this Sprite sprite)
{
if (sprite == null)
return null;

if (emissionMap.TryGetValue(sprite, out Sprite emission))
return emission;


string text = sprite.name + "_emission";
emission = ResourceBank.Get<Sprite>("Art/Cards/Portraits/" + text);
if (emission != null)
{
return emission;
}

emission = ResourceBank.Get<Sprite>("Art/Cards/GrimoraPortraits/" + text);
if (emission != null)
{
return emission;
}

return null;
}

/// <summary>
/// Sets the emissive sprite for a given sprite. This is used when an Act 1 card receives an ability from a card merge.
/// </summary>
Expand Down

0 comments on commit a782877

Please sign in to comment.