void SelectSwatch(RewardColorItem _colorData)
 {
     foreach (AnturaSpaceSwatchButton item in btsSwatches)
     {
         item.Toggle(item.Data == _colorData);
     }
     if (_colorData != null)
     {
         RewardSystemManager.SelectRewardColorItem(_colorData.ID, currRewardType);
     }
     else
     {
         Debug.Log("SelectSwatch > _colorData is NULL!");
     }
 }
        /// <summary>
        /// Selects the reward item.
        /// </summary>
        /// <param name="_rewardItemId">The reward item identifier.</param>
        /// <returns></returns>
        public static List <RewardColorItem> SelectRewardItem(string _rewardItemId, RewardTypes _rewardType)
        {
            List <RewardColorItem> returnList = new List <RewardColorItem>();

            /// logic
            /// - Trigger selected reward event.
            /// - Load returnList of color for reward checking unlocked and if exist active one


            switch (_rewardType)
            {
            case RewardTypes.reward:
                foreach (RewardColor color in config.RewardsColorPairs)
                {
                    if (AppManager.I.Player.RewardsUnlocked.Exists(ur => ur.ItemID == _rewardItemId && ur.ColorId == color.ID))
                    {
                        RewardColorItem rci = new RewardColorItem(color);
                        returnList.Add(rci);
                    }
                    else
                    {
                        returnList.Add(null);
                    }
                }
                // set current reward in modification
                CurrentReward = new RewardPack()
                {
                    ItemID = _rewardItemId, Type = RewardTypes.reward
                };
                break;

            case RewardTypes.texture:
                foreach (RewardColor color in config.RewardsTileColor)
                {
                    if (AppManager.I.Player.RewardsUnlocked.Exists(ur => ur.ItemID == _rewardItemId && ur.ColorId == color.ID))
                    {
                        RewardColorItem rci = new RewardColorItem(color);
                        rci.Color2RGB = rci.Color1RGB;     // to avoid exadecimal conversion error on ui rgb code conversion.
                        returnList.Add(rci);
                    }
                    else
                    {
                        returnList.Add(null);
                    }
                }
                // set current reward in modification
                CurrentReward = new RewardPack()
                {
                    ItemID = _rewardItemId, Type = RewardTypes.texture
                };
                break;

            case RewardTypes.decal:
                foreach (RewardColor color in config.RewardsDecalColor)
                {
                    if (AppManager.I.Player.RewardsUnlocked.Exists(ur => ur.ItemID == _rewardItemId && ur.ColorId == color.ID))
                    {
                        RewardColorItem rci = new RewardColorItem(color);
                        rci.Color2RGB = rci.Color1RGB;     // to avoid exadecimal conversion error on ui rgb code conversion.
                        returnList.Add(rci);
                    }
                    else
                    {
                        returnList.Add(null);
                    }
                }
                //foreach (RewardColor color in config.RewardsDecalColor) {
                //    RewardColorItem rci = new RewardColorItem(color);
                //    rci.Color2RGB = rci.Color1RGB; // to avoid exadecimal conversion error on ui rgb code conversion.
                //    returnList.Add(rci);
                //}
                // set current reward in modification
                CurrentReward = new RewardPack()
                {
                    ItemID = _rewardItemId, Type = RewardTypes.decal
                };
                break;

            default:
                Debug.LogWarningFormat("Reward typology requested {0} not found", _rewardType);
                break;
            }
            // check if there is a selected item, if no one select the first.
            if (returnList.Count > 0 && !returnList.Exists(c => c != null && c.IsSelected == true))
            {
                foreach (var firstItem in returnList)
                {
                    if (firstItem != null)
                    {
                        firstItem.IsSelected = true;
                        return(returnList);
                    }
                }
            }
            return(returnList);
        }
        void SelectReward(RewardItem _rewardData)
        {
            showSwatchesTween.Rewind();
            bool isTextureOrDecal = currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture ||
                                    currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal;

            BTRemoveMods.gameObject.SetActive(!isTextureOrDecal && _rewardData != null);
            if (_rewardData == null)
            {
                foreach (AnturaSpaceItemButton item in btsItems)
                {
                    item.Toggle(false);
                }
                if (currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Ears)
                {
                    AnturaModelManager.Instance.ClearLoadedRewardInCategory("EAR_L");
                    AnturaModelManager.Instance.ClearLoadedRewardInCategory("EAR_R");
                }
                else
                {
                    AnturaModelManager.Instance.ClearLoadedRewardInCategory(currCategory.ToString());
                }
                return;
            }

            foreach (AnturaSpaceItemButton item in btsItems)
            {
                item.Toggle(item.Data == _rewardData);
            }
            currSwatchesDatas = RewardSystemManager.SelectRewardItem(_rewardData.ID, currRewardType);
            if (currSwatchesDatas.Count == 0)
            {
                Debug.Log("No color swatches for the selected reward!");
                return;
            }

            // Hide non-existent swatches
            for (int i = currSwatchesDatas.Count - 1; i < btsSwatches.Length; ++i)
            {
                btsSwatches[i].gameObject.SetActive(false);
            }
            // Setup and show swatches
            RewardColorItem selectedSwatchData = null;

            for (int i = 0; i < currSwatchesDatas.Count; ++i)
            {
                RewardColorItem         swatchData = currSwatchesDatas[i];
                AnturaSpaceSwatchButton swatch     = btsSwatches[i];
                swatch.gameObject.SetActive(true);
                swatch.Data = swatchData;
                if (swatchData != null)
                {
                    swatch.SetAsNew(swatchData.IsNew);
                    swatch.Toggle(swatchData.IsSelected);
                    swatch.SetColors(GenericUtilities.HexToColor(swatchData.Color1RGB), GenericUtilities.HexToColor(swatchData.Color2RGB));
                    if (swatchData.IsSelected)
                    {
                        selectedSwatchData = swatchData;
                    }
                }
                else
                {
                    swatch.Toggle(false);
                }
                swatch.Lock(swatchData == null);
            }

            SwatchesContainer.gameObject.SetActive(true);
            showSwatchesTween.PlayForward();

            // Select eventual color
            if (selectedSwatchData != null)
            {
                SelectSwatch(selectedSwatchData);
            }
        }