Get Sprites from linked controllers also
This commit is contained in:
parent
1dc3b5e9f1
commit
ed0529deae
@ -964,9 +964,34 @@ namespace SpriteLibrary
|
|||||||
if (OneSprite.SpriteName == Name)
|
if (OneSprite.SpriteName == Name)
|
||||||
{ return OneSprite; }
|
{ return OneSprite; }
|
||||||
}
|
}
|
||||||
|
//If we have not found one on this controller, get it from another controller
|
||||||
|
foreach(SpriteController SC in LinkedControllers)
|
||||||
|
{
|
||||||
|
Sprite Found = SC.SpriteFromNameInternal(Name);
|
||||||
|
if (Found != null)
|
||||||
|
{
|
||||||
|
//If we get here, we do not have it in our list. Add it to this controller and then return it
|
||||||
|
AddSprite(Found);
|
||||||
|
return Found;
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The internal SpriteFromName does not check the linked controllers. Keeps us from entering into an endless loop
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Name"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
internal Sprite SpriteFromNameInternal(string Name)
|
||||||
|
{
|
||||||
|
foreach (Sprite OneSprite in Sprites)
|
||||||
|
{
|
||||||
|
if (OneSprite.SpriteName == Name)
|
||||||
|
{ return OneSprite; }
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add the specified sprite to the list of sprites we know about. You usually do not need to do this.
|
/// Add the specified sprite to the list of sprites we know about. You usually do not need to do this.
|
||||||
/// Sprites add themselves to the controller when you create a new sprite.
|
/// Sprites add themselves to the controller when you create a new sprite.
|
||||||
|
Loading…
Reference in New Issue
Block a user