Esempio n. 1
0
    private void HintButton(LevelHint aHintType)
    {
        if (state != State.Play || aHintType == LevelHint.None)
        {
            return;
        }
        if ((ELSingleton <HintManager> .Instance.GetAmount(aHintType) > 0 || (ELSingleton <HintManager> .Instance.GetCoins(aHintType) > 0 && ELSingleton <CoinsManager> .Instance.Coins >= ELSingleton <HintManager> .Instance.GetCoins(aHintType))) && board.Hint(aHintType))
        {
            if (ELSingleton <HintManager> .Instance.GetAmount(aHintType) > 0)
            {
                ELSingleton <HintManager> .Instance.ChangeAmount(aHintType, -1);
            }
            else
            {
                ELSingleton <CoinsManager> .Instance.AddCoins(-ELSingleton <HintManager> .Instance.GetCoins(aHintType));

                shopButton.AddCoins(-ELSingleton <HintManager> .Instance.GetCoins(aHintType));
            }
            ELSingleton <AudioManager> .Instance.PlaySfx(soundHint);

            AnalyticsManager            instance   = ELSingleton <AnalyticsManager> .Instance;
            Dictionary <string, object> dictionary = new Dictionary <string, object>();
            object value;
            switch (aHintType)
            {
            default:
                value = "none";
                break;

            case LevelHint.Tip:
                value = "tip";
                break;

            case LevelHint.Expose:
                value = "expose";
                break;

            case LevelHint.StartAndFinish:
                value = "start_and_finish";
                break;

            case LevelHint.GoodStart:
                value = "good_start";
                break;
            }
            dictionary.Add("type", value);
            dictionary.Add("level", level.number + 1);
            instance.Event("hint_used", dictionary);
        }
        else if (ELSingleton <HintManager> .Instance.GetAmount(aHintType) == 0 && (ELSingleton <HintManager> .Instance.GetCoins(aHintType) < 0 || ELSingleton <CoinsManager> .Instance.Coins < ELSingleton <HintManager> .Instance.GetCoins(aHintType)))
        {
            ShopButton();
            ELSingleton <AudioManager> .Instance.PlaySfx(soundButtonGeneral);
        }
        else
        {
            ELSingleton <AudioManager> .Instance.PlaySfx(soundButtonX);
        }
        goodStartButton.Setup();
        startAndFinishButton.Setup();
        exposeButton.Setup();
        tipButton.Setup();
        ELSingleton <TutorialWindow> .Instance.Hide();
    }