Exemple #1
0
        IEnumerator CO_SelectCategory(AnturaSpaceCategoryButton.AnturaSpaceCategory _category)
        {
            BTRemoveMods.gameObject.SetActive(false);

            // Get rewards list
            currCategory        = _category;
            _currRewardBaseType = CategoryToRewardBaseType(_category);
            bool useImages = _category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture ||
                             _category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal;

            foreach (var item in btsItems)
            {
                item.SetImage(!useImages);
            }
            ReloadRewardsDatas();
            yield return(null);

            RewardBaseItem selectedRewardBaseData = RefreshItems();

            ItemsContainer.gameObject.SetActive(true);
            showItemsTween.PlayForward();

            // Select eventual reward
            if (selectedRewardBaseData != null)
            {
                SelectReward(selectedRewardBaseData);
            }
            else
            {
                showSwatchesTween.Rewind();
            }
        }
Exemple #2
0
        void SelectCategory(AnturaSpaceCategoryButton.AnturaSpaceCategory _category)
        {
            StopAllCoroutines();
            // Save configuration
            //AnturaModelManager.Instance.SaveAnturaCustomization();

            // Toggle buttons
            foreach (AnturaSpaceCategoryButton bt in btsCategories)
            {
                if (bt.Category == _category)
                {
                    bt.Toggle(true, true);
                }
                else
                {
                    bt.Toggle(false);
                }
            }
            if (_category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Unset)
            {
                return;
            }

            showItemsTween.Rewind();
            StartCoroutine(CO_SelectCategory(_category));
        }
Exemple #3
0
        RewardBaseType CategoryToRewardBaseType(AnturaSpaceCategoryButton.AnturaSpaceCategory _category)
        {
            switch (_category)
            {
            case AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture:
                return(RewardBaseType.Texture);

            case AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal:
                return(RewardBaseType.Decal);

            default:
                return(RewardBaseType.Prop);
            }
        }
        RewardTypes CategoryToRewardType(AnturaSpaceCategoryButton.AnturaSpaceCategory _category)
        {
            switch (_category)
            {
            case AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture:
                return(RewardTypes.texture);

            case AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal:
                return(RewardTypes.decal);

            default:
                return(RewardTypes.reward);
            }
        }
        void SelectCategory(AnturaSpaceCategoryButton.AnturaSpaceCategory _category)
        {
            this.StopAllCoroutines();
            // Toggle buttons
            foreach (AnturaSpaceCategoryButton bt in btsCategories)
            {
                if (bt.Category == _category)
                {
                    bt.Toggle(true, true);
                }
                else
                {
                    bt.Toggle(false);
                }
            }
            if (_category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Unset)
            {
                return;
            }

            showItemsTween.Rewind();
            this.StartCoroutine(CO_SelectCategory(_category));
        }
        IEnumerator CO_SelectCategory(AnturaSpaceCategoryButton.AnturaSpaceCategory _category)
        {
            BTRemoveMods.gameObject.SetActive(false);

            // Get rewards list
            currCategory   = _category;
            currRewardType = CategoryToRewardType(_category);
            bool useImages = _category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture || _category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal;

            foreach (AnturaSpaceItemButton item in btsItems)
            {
                item.SetImage(!useImages);
            }
            if (_category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Ears)
            {
                currRewardDatas = RewardSystemManager.GetRewardItemsByRewardType(currRewardType, rewardsContainers, "EAR_L");
                List <Transform> altRewardContainers = new List <Transform>(rewardsContainers);
                altRewardContainers.RemoveRange(0, currRewardDatas.Count);
                currRewardDatas.AddRange(RewardSystemManager.GetRewardItemsByRewardType(currRewardType, altRewardContainers, "EAR_R"));
            }
            else
            {
                currRewardDatas = RewardSystemManager.GetRewardItemsByRewardType(currRewardType, useImages ? rewardsImagesContainers : rewardsContainers, _category.ToString());
            }
            yield return(null);

            // Hide non-existent items
            for (int i = currRewardDatas.Count - 1; i < btsItems.Length; ++i)
            {
                btsItems[i].gameObject.SetActive(false);
            }
            // Setup and show items
            RewardItem selectedRewardData = null;

            for (int i = 0; i < currRewardDatas.Count; ++i)
            {
                RewardItem            rewardData = currRewardDatas[i];
                AnturaSpaceItemButton item       = btsItems[i];
                item.gameObject.SetActive(true);
                item.Data = rewardData;
                if (rewardData != null)
                {
                    if (!useImages)
                    {
                        item.RewardContainer.gameObject.SetLayerRecursive(GenericUtilities.LayerMaskToIndex(RewardsLayer));
                        CameraHelper.FitRewardToUICamera(item.RewardContainer.GetChild(0), item.RewardCamera, FlipRewards);
                    }
                    item.SetAsNew(rewardData.IsNew);
                    item.Toggle(rewardData.IsSelected);
                    if (rewardData.IsSelected)
                    {
                        selectedRewardData = rewardData;
                    }
                }
                else
                {
                    item.Toggle(false);
                }
                item.Lock(rewardData == null);
            }

            ItemsContainer.gameObject.SetActive(true);
            showItemsTween.PlayForward();

            // Select eventual reward
            if (selectedRewardData != null)
            {
                SelectReward(selectedRewardData);
            }
            else
            {
                showSwatchesTween.Rewind();
            }
        }