Example #1
0
        public void SetLevelAs(GoldCardState cardState, bool animate = false)
        {
            switch (cardState)
            {
            case GoldCardState.Locked:

                clicker.interactable = false;
                poloroidHolder.gameObject.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, RandomRotation()));

                break;

            case GoldCardState.Unlocked:

                poloroidHolder.gameObject.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, RandomRotation()));
                padlockImage.SetActive(false);
                levelNumber.gameObject.SetActive(true);
                costLabel.SetActive(true);
                clicker.interactable = true;

                break;

            case GoldCardState.Purchased:

                poloroidHolder.gameObject.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, RandomRotation()));
                padlockImage.SetActive(false);
                levelNumber.gameObject.SetActive(true);
                costLabel.SetActive(false);
                clicker.interactable = true;

                break;

            case GoldCardState.Complete:

                incompletePoloroid.gameObject.SetActive(false);
                dropShadow.gameObject.SetActive(false);
                completePoloroid.gameObject.SetActive(true);
                puzzleIcon.gameObject.SetActive(true);
                poloroidHolder.gameObject.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                SetStarsForLevel(currentStarRecord);

                break;
            }
        }
Example #2
0
        public void LoadPlayerLevelProgress(string uniqueID, bool isLevelGroupLocked, Sprite levelCardSprite)
        {
            if (isLevelGroupLocked && goldCardState != GoldCardState.Locked)
            {
                thisGoldCardState = GoldCardState.Locked;
            }
            else
            {
                string subString = uniqueID.Substring(uniqueID.Length - 1);

                int  n;
                bool isNumeric = int.TryParse(uniqueID.Substring(uniqueID.Length - 1), out n);

                if (!isNumeric)
                {
                    // check state of gold card
                    if (subString.Contains("L"))
                    {
                        goldCardState = GoldCardState.Locked;
                    }
                    else if (subString.Contains("U"))
                    {
                        goldCardState = GoldCardState.Unlocked;
                    }
                    else if (subString.Contains("P"))
                    {
                        goldCardState = GoldCardState.Purchased;
                    }

                    SetLevelAs(goldCardState);
                }
                else
                {
                    currentStarRecord = int.Parse(subString);

                    goldCardState = GoldCardState.Complete;
                    SetLevelAs(goldCardState);
                }
            }

            cardUnplayedImage.sprite = levelCardSprite;
        }
Example #3
0
        public void ClickGoldCard()
        {
            //thisGoldCardState = GoldCardState.Unlocked;
            //SetLevelAs(GoldCardState.Unlocked);

            if (goldCardState != GoldCardState.Locked)
            {
                SoundController.Instance.PlayAudioClip(SoundSettingsKey.Buttonpressed);
            }

            switch (goldCardState)
            {
            case GoldCardState.Unlocked:

                //purchase
#if UNITY_ANDROID
                SceneActivationBehaviour <PopUpAndroidGoldActivator> .Instance.ShowGoldPopup(thisLevelRules, this, cardUnplayedImage.sprite, (bool purchased) =>
                {
                    if (purchased)
                    {
                        thisGoldCardState = GoldCardState.Purchased;
                        SceneActivationBehaviour <OverlayUISceneActivator> .Instance.ToggleBlocker(true);
                        Invoke(nameof(PlayLevel), 0.75f);
                    }
                    else
                    {
                        return;
                    }
                });
#else
                SceneActivationBehaviour <PopupGoldLevelPurchaseActivator> .Instance.ShowPopupGoldPurchasePanel((bool purchased) =>
                {
                    if (purchased)
                    {
                        thisGoldCardState = GoldCardState.Purchased;
                        SceneActivationBehaviour <OverlayUISceneActivator> .Instance.ToggleBlocker(true);
                        Invoke(nameof(PlayLevel), 0.75f);
                    }
                    else
                    {
                        return;
                    }
                });
#endif


                break;

            case GoldCardState.Purchased:

                //play level
                PlayLevel();

                break;

            case GoldCardState.Complete:

                // replay level
                SceneActivationBehaviour <PopupReplayLevelActivator> .Instance.ShowReplayPopupPanels(thisLevelRules, currentStarRecord, true, (bool purchased) =>
                {
                    if (purchased)
                    {
                        SceneActivationBehaviour <OverlayUISceneActivator> .Instance.ToggleBlocker(true);
                        Invoke(nameof(ReplayLevel), 0.5f);
                    }
                    else
                    {
                        return;
                    }
                });

                break;
            }
        }