mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:03:08 +08:00
Reduce duplicate texture retrieval code
This commit is contained in:
parent
9b3c1e4126
commit
834eeb6d98
@ -5,7 +5,6 @@ using System;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.UI
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
@ -40,28 +39,31 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
foreach (var textureIndex in clear_animation_sequence)
|
foreach (var textureIndex in clear_animation_sequence)
|
||||||
{
|
{
|
||||||
var textureName = getStateTextureName(textureIndex);
|
if (!addFrame(skin, textureIndex))
|
||||||
Texture texture = skin.GetTexture(textureName);
|
|
||||||
|
|
||||||
if (texture == null)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
AddFrame(texture);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; true; i++)
|
for (int i = 0; true; i++)
|
||||||
{
|
{
|
||||||
var textureName = getStateTextureName(i);
|
if (!addFrame(skin, i))
|
||||||
Texture texture = skin.GetTexture(textureName);
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool addFrame(ISkinSource skin, int textureIndex)
|
||||||
|
{
|
||||||
|
var textureName = getStateTextureName(textureIndex);
|
||||||
|
var texture = skin.GetTexture(textureName);
|
||||||
|
|
||||||
if (texture == null)
|
if (texture == null)
|
||||||
break;
|
return false;
|
||||||
|
|
||||||
AddFrame(texture);
|
AddFrame(texture);
|
||||||
}
|
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user