| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | namespace DCL.ECSComponents |
| | 4 | | { |
| | 5 | | public interface INFTShapeFrameFactory |
| | 6 | | { |
| | 7 | | /// <summary> |
| | 8 | | /// Return the instance of a NFT shape frame based on the index |
| | 9 | | /// </summary> |
| | 10 | | /// <param name="index"></param> |
| | 11 | | /// <returns></returns> |
| | 12 | | NFTShapeFrame InstantiateLoaderController(int index); |
| | 13 | |
|
| | 14 | | /// <summary> |
| | 15 | | /// This will instantiate an error feedback and it will be attached to gameObject as a child |
| | 16 | | /// </summary> |
| | 17 | | /// <param name="gameObjectToAttach"></param> |
| | 18 | | /// <returns></returns> |
| | 19 | | GameObject InstantiateErrorFeedback(GameObject gameObjectToAttach); |
| | 20 | | } |
| | 21 | |
|
| | 22 | | public class NFTShapeFrameFactory : ScriptableObject, INFTShapeFrameFactory |
| | 23 | | { |
| | 24 | | [SerializeField] private NFTShapeFrame[] loaderControllersPrefabs; |
| | 25 | | [SerializeField] private NFTShapeFrame defaultFramePrefabs; |
| | 26 | | [SerializeField] private GameObject errorFeedback; |
| | 27 | |
|
| | 28 | | public NFTShapeFrame InstantiateLoaderController(int index) |
| | 29 | | { |
| 3 | 30 | | if (index >= 0 && index < loaderControllersPrefabs.Length) |
| 3 | 31 | | return Instantiate(loaderControllersPrefabs[index]); |
| | 32 | |
|
| 0 | 33 | | return Instantiate(defaultFramePrefabs); |
| | 34 | | } |
| | 35 | |
|
| | 36 | | public GameObject InstantiateErrorFeedback(GameObject gameObjectToAttach) |
| | 37 | | { |
| 3 | 38 | | return Instantiate(errorFeedback,gameObjectToAttach.transform); |
| | 39 | | } |
| | 40 | | } |
| | 41 | | } |