public Sprite FindSpriteByName(string name) { if (assetData != null) { HolderData hd = assetData.GetAssetByKey(name); if (hd != null) { Sprite sp = hd.asset as Sprite; if (sp != null) { return(sp); } } } for (int i = 0, len = injections.Count; i < len; i++) { if (useAssetName) { if (string.Equals(name, injections[i].value.name)) { return(injections[i].value); } } else { if (string.Equals(name, injections[i].name)) { return(injections[i].value); } } } return(null); }
void SetupHelmet(Creature creature, HolderData holderData) { Holder holder = new GameObject(HAT_HOLDER_NAME).AddComponent <Holder>(); holder.transform.SetParent(creature.ragdoll.headPart.transform); holder.transform.localPosition = HAT_POSITION; holder.transform.localRotation = HAT_ROTATION; holder.Load(holderData); creature.equipment.holders = new List <Holder>(creature.GetComponentsInChildren <Holder>()); }
private static bool CheckAssetDataIsMatchSpriteHolder(AssetData assetData, SpriteHolder spriteHolder) { bool isSame = true; foreach (var data in spriteHolder.injections) { string key = data.name; HolderData hd = assetData.GetAssetByKey(key); if (hd == null) { return(false); } if (((Object)data.value) != hd.asset) { return(false); } } return(isSame); }
public Sprite Get(string name) { if (assetData != null) { HolderData hd = assetData.GetAssetByKey(name); if (hd != null) { Sprite sp = hd.asset as Sprite; if (sp != null) { return(sp); } } } int index = keys.IndexOf(name); if (index >= 0) { return(values[index]); } return(null); }
private static bool CheckAssetDataIsMatchSpriteAtlas(AssetData assetData, SpriteAtlas spriteAtlas) { bool isSame = true; if (spriteAtlas.keys != null) { } for (int i = 0; i < spriteAtlas.keys.Count; i++) { string key = spriteAtlas.keys[i]; Sprite value = spriteAtlas.values[i]; HolderData hd = assetData.GetAssetByKey(key); if (hd == null) { return(false); } if (((Object)value) != hd.asset) { return(false); } } return(isSame); }