Example #1
0
        void OnClickItem(AnturaSpaceItemButton _bt)
        {
            var scene = AnturaSpaceScene.I as AnturaSpaceScene;

            if (scene.TutorialMode && scene.tutorialManager.CurrentTutorialFocus != _bt)
            {
                return;
            }

            SelectReward(_bt.Data);
            RewardBase rewardBase = _bt.Data.data;

            if (rewardBase != null && onRewardSelectedInCustomization != null)
            {
                onRewardSelectedInCustomization(rewardBase.ID);
            }

            RewardProp rewardProp = rewardBase as RewardProp;

            if (rewardProp != null &&
                (rewardProp.Category == "EAR_R" || rewardProp.Category == "EAR_L") &&
                onRewardCategorySelectedInCustomization != null)
            {
                onRewardCategorySelectedInCustomization(rewardProp.Category);
            }
        }
Example #2
0
        // Returns eventual selected reward item
        RewardBaseItem RefreshItems(bool toggleOnly = false)
        {
            bool useImages = currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture ||
                             currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal;

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

            for (int i = 0; i < currRewardBaseItems.Count; ++i)
            {
                RewardBaseItem        rewardBaseItem = currRewardBaseItems[i];
                AnturaSpaceItemButton item           = btsItems[i];
                item.gameObject.SetActive(true);
                item.Data = rewardBaseItem;
                if (rewardBaseItem != null)
                {
                    if (!useImages && !toggleOnly)
                    {
                        item.RewardContainer.gameObject.SetLayerRecursive(GenericHelper.LayerMaskToIndex(RewardsLayer));
                        CameraHelper.FitRewardToUICamera(item.RewardContainer.GetChild(0), item.RewardCamera, FlipRewards);
                    }
                    item.SetAsNew(rewardBaseItem.IsNew);
                    item.Toggle(rewardBaseItem.IsSelected);
                    if (rewardBaseItem.IsSelected)
                    {
                        selectedRewardBaseData = rewardBaseItem;
                    }
                }
                else
                {
                    item.Toggle(false);
                }
                item.Lock(rewardBaseItem == null || !AppManager.I.RewardSystemManager.IsRewardBaseUnlocked(rewardBaseItem.data));
            }
            return(selectedRewardBaseData);
        }
Example #3
0
        public void Initialise()
        {
            btsCategories = CategoriesContainer.GetComponentsInChildren <AnturaSpaceCategoryButton>(true);
            btsSwatches   = SwatchesContainer.GetComponentsInChildren <AnturaSpaceSwatchButton>(true);
            SelectCategory(AnturaSpaceCategoryButton.AnturaSpaceCategory.Unset);
            BtOpenModsPanel.SetAsNew(AppManager.I.RewardSystemManager.IsThereSomeNewReward());


            // Create items
            rewardsContainers       = new List <Transform>();
            rewardsImagesContainers = new List <Transform>();
            btsItems    = new AnturaSpaceItemButton[MaxItems];
            btsItems[0] = BtItemMain;
            rewardsContainers.Add(BtItemMain.RewardContainer);
            rewardsImagesContainers.Add(BtItemMain.RewardImage.transform);
            for (int i = 1; i < MaxItems; ++i)
            {
                AnturaSpaceItemButton item = Instantiate(BtItemMain);
                item.transform.SetParent(BtItemMain.transform.parent, false);
                item.Setup();
                btsItems[i] = item;
                rewardsContainers.Add(item.RewardContainer);
                rewardsImagesContainers.Add(item.RewardImage.transform);
            }
            BtItemMain.Setup();

            const float duration = 0.3f;

            showCategoriesTween = DOTween.Sequence().SetAutoKill(false).Pause()
                                  .Append(CategoriesContainer.DOAnchorPosY(150, duration).From().SetEase(Ease.OutBack))
                                  .Join(BtBonesShop.RectT.DOAnchorPosY(-830, duration))
                                  .OnRewind(() => CategoriesContainer.gameObject.SetActive(false));
            showShopTween = DOTween.Sequence().SetAutoKill(false).Pause()
                            .Append(ShopPanelContainer.DOAnchorPosY(-830, duration).From().SetEase(Ease.OutQuad))
                            .Join(BtOpenModsPanel.RectT.DOAnchorPosY(150, duration))
                            .OnRewind(() => ShopPanelContainer.gameObject.SetActive(false));
            showItemsTween = ItemsContainer.DOAnchorPosX(-350, duration).From().SetEase(Ease.OutBack).SetAutoKill(false).Pause()
                             .OnRewind(() => {
                ItemsContainer.gameObject.SetActive(false);
                // Clear items containers children
                foreach (Transform container in rewardsContainers)
                {
                    foreach (Transform child in container)
                    {
                        Destroy(child.gameObject);
                    }
                }
            });
            showSwatchesTween = SwatchesContainer.DOAnchorPosY(-100, duration).From().SetEase(Ease.OutBack).SetAutoKill(false).Pause()
                                .OnRewind(() => SwatchesContainer.gameObject.SetActive(false));

            CategoriesContainer.gameObject.SetActive(false);
            ShopPanelContainer.gameObject.SetActive(false);
            ItemsContainer.gameObject.SetActive(false);
            SwatchesContainer.gameObject.SetActive(false);

            // Listeneres
            BtOpenModsPanel.Bt.onClick.AddListener(() => OnClick(BtOpenModsPanel));
            BtBonesShop.Bt.onClick.AddListener(() => OnClick(BtBonesShop));
            BTRemoveMods.Bt.onClick.AddListener(() => OnClick(BTRemoveMods));
            foreach (var bt in btsCategories)
            {
                var b = bt;
                b.Bt.onClick.AddListener(() => OnClickCategory(b));
            }
            foreach (var bt in btsItems)
            {
                var b = bt;
                b.Bt.onClick.AddListener(() => OnClickItem(b));
            }
            foreach (var bt in btsSwatches)
            {
                var b = bt;
                b.Bt.onClick.AddListener(() => OnClickSwatch(b));
            }

            ShopPanelUI.Initialise();
        }