Cache the BG Texture ID
This commit is contained in:
1 parent
19a87739a4
commit
5cc32cdca4
2 files changed
+54
-7
No files matched your search
@@ -5,10 +5,42 @@ namespace CalamityMod.Backgrounds
|
||||
{
|
||||
public class AstralUndergroundBGStyle : ModUndergroundBackgroundStyle
|
||||
{
|
||||
private int AUBG0;
|
||||
private int AUBG1;
|
||||
private int AUBG2;
|
||||
private int AUBG3;
|
||||
|
||||
private int AUBG4_0;
|
||||
private int AUBG4_1;
|
||||
private int AUBG4_2;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
AUBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG0");
|
||||
AUBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG1");
|
||||
AUBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG2");
|
||||
AUBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG3");
|
||||
|
||||
AUBG4_0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG4_0");
|
||||
AUBG4_1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG4_1");
|
||||
AUBG4_2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG4_2");
|
||||
}
|
||||
|
||||
public override void FillTextureArray(int[] textureSlots)
|
||||
{
|
||||
for (int i = 0; i <= 4; i++)
|
||||
textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot(i == 4 ? "CalamityMod/Backgrounds/AstralUG" + i.ToString() + "_" + Main.hellBackStyle : "CalamityMod/Backgrounds/AstralUG" + i.ToString());
|
||||
textureSlots[0] = AUBG0;
|
||||
textureSlots[1] = AUBG1;
|
||||
textureSlots[2] = AUBG2;
|
||||
textureSlots[3] = AUBG3;
|
||||
textureSlots[4] = Main.hellBackStyle switch
|
||||
{
|
||||
0 => AUBG4_0,
|
||||
1 => AUBG4_1,
|
||||
_ => AUBG4_2
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,28 @@ namespace CalamityMod.Backgrounds
|
||||
{
|
||||
public class SunkenSeaBGStyle : ModUndergroundBackgroundStyle
|
||||
{
|
||||
private int SSBG0;
|
||||
private int SSBG1;
|
||||
private int SSBG2;
|
||||
private int SSBG3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
SSBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG0");
|
||||
SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG1");
|
||||
SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG2");
|
||||
SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG3");
|
||||
}
|
||||
|
||||
public override void FillTextureArray(int[] textureSlots)
|
||||
{
|
||||
for (int i = 0; i <= 3; i++)
|
||||
{
|
||||
textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
|
||||
//textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString());
|
||||
}
|
||||
textureSlots[0] = SSBG0;
|
||||
textureSlots[1] = SSBG1;
|
||||
textureSlots[2] = SSBG2;
|
||||
textureSlots[3] = SSBG3;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user