private static System.Func <SpritesForGame, bool> IsNeeddType(TicTacToe.SpriteNames needFind) { TicTacToe.SpriteNames needsToBeFound = needFind; return((SpritesForGame checlFrom) => { if (checlFrom.spriteEnum == needsToBeFound) { return true; } return false; }); }
public void GetSprite(TicTacToe.Seed forSeed, UnityEngine.UI.Image imageTOPast) { TicTacToe.SpriteNames needToFInd = TicTacToe.SpriteNames.None; switch (forSeed) { case TicTacToe.Seed.Cross: needToFInd = TicTacToe.SpriteNames.SeedCross; break; case TicTacToe.Seed.Circle: needToFInd = TicTacToe.SpriteNames.SeedCircle; break; } GetSprite(needToFInd, imageTOPast); }
public async void GetSprite(TicTacToe.SpriteNames forEnum, UnityEngine.UI.Image imageTOPast) { System.Func <SpritesForGame, bool> predicateToFind = IsNeeddType(forEnum); int result = await getResultFromThreads <int, SpritesForGame>( (IReadOnlyList <SpritesForGame>) currentlyUsedSprites, WithPredicate(predicateToFind), CHeckIfValid ); Debug.LogWarning(" Found : " + result); if (imageTOPast != null && result != -1) { imageTOPast.sprite = atlasSprites.GetSprite(currentlyUsedSprites[result].spriteName); } }