예제 #1
0
        void OnClickSwatch(AnturaSpaceSwatchButton _bt)
        {
            SelectSwatch(_bt.Data);

            // Is new check
            if (_bt.IcoNew.activeSelf)
            {
                _bt.SetAsNew(false);
                ReloadRewardsDatas();
                RefreshCategories();
                RefreshItems(true);
            }
        }
예제 #2
0
        void OnClickSwatch(AnturaSpaceSwatchButton _bt)
        {
            // Play audio
            AudioManager.I.PlayDialogue(_bt.Data.data.LocID);

            SelectSwatch(_bt.Data);

            // Is new check
            if (_bt.IcoNew.activeSelf)
            {
                _bt.SetAsNew(false);
                ReloadRewardsDatas();
                RefreshCategories();
                RefreshItems(true);
            }
        }
예제 #3
0
        void SelectReward(RewardBaseItem rewardBaseData)
        {
            var scene = AnturaSpaceScene.I as AnturaSpaceScene;

            if (rewardBaseData == null && scene.TutorialMode)
            {
                return;
            }

            showSwatchesTween.Rewind();
            bool isTextureOrDecal = currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture ||
                                    currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal;

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

            _currSelectedRewardBaseItem = rewardBaseData;
            currRewardColorItems        = AppManager.I.RewardSystemManager.GetRewardColorItemsForBase(rewardBaseData.data);
            if (currRewardColorItems.Count == 0)
            {
                Debug.Log("No color swatches for the selected reward!");
                return;
            }

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

            for (int i = 0; i < currRewardColorItems.Count; ++i)
            {
                RewardColorItem         swatchData = currRewardColorItems[i];
                AnturaSpaceSwatchButton swatch     = btsSwatches[i];
                swatch.gameObject.SetActive(true);
                swatch.Data = swatchData;
                if (swatchData != null)
                {
                    swatch.SetAsNew(false); // @note: we force the swatch colors to never be shown as new
                    //swatch.SetAsNew(!swatchData.IsSelected && swatchData.IsNew);
                    swatch.Toggle(swatchData.IsSelected);
                    Color hexColor1 = GenericHelper.HexToColor(swatchData.data.Color1RGB);
                    Color hexColor2 = swatchData.data.Color2RGB == null ? hexColor1 : GenericHelper.HexToColor(swatchData.data.Color2RGB);
                    swatch.SetColors(hexColor1, hexColor2);
                    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);
            }

            ReloadRewardsDatas();
            RefreshCategories();
            RefreshItems(true);
        }