Пример #1
0
    private void CallbackSkip()
    {
        BasicPopup popup = PopupSystem.GetPopup <BasicPopup>(Define.PopupType.Basic);

        popup.SetData(DataManager.GetText(TextTable.skipVideoKey));
        PopupSystem.OpenPopup(Define.PopupType.Basic);
    }
Пример #2
0
    public static void GameOver(bool bTimeUp)
    {
        if (instance == null)
        {
            return;
        }

        instance.bPlaying = false;
        instance.tileSystem.GameOver();

        ScenesManager.SetEscapeMethod(null);

        SoundManager.GetInstance().FadeOutAndStopBGM(Define.SoundType.TickTock, 0.5f);
        SoundManager.GetInstance().FadeOutAndStopBGM(Define.SoundType.TickTockBack, 0.5f);
        SoundManager.GetInstance().FadeOutAndStopBGM(Define.SoundType.GameBGM, 0.5f);

        TimeUpPopup popup = PopupSystem.GetPopup <TimeUpPopup>(Define.PopupType.TimeUp);

        popup.SetData(bTimeUp, () =>
        {
            bool bShowContinue = DataManager.GetInstance().CanShowContinueVideo();
            if (bShowContinue && UnityAdsController.IsReady(Define.continueId))
            {
                ContinueDialog.SetData(bTimeUp);
                UISystem.OpenDialog(Define.DialogType.ContinueDialog);
            }
            else
            {
                UISystem.OpenDialog(Define.DialogType.ResultDialog);
            }
        });
        PopupSystem.OpenPopup(Define.PopupType.TimeUp);

        instance.uiSystem.GameOver();
    }
Пример #3
0
    public void UseSkill(int idx)
    {
        PetData    data  = DataManager.GetInstance().GetSelectedPetData(idx);
        SkillTable skill = DataManager.GetInstance().GetSkillTable(data.activeSkillType);

        bActingSkill = true;

        UseSkillPopup popup = PopupSystem.GetPopup <UseSkillPopup>(Define.PopupType.UseSkill);

        popup.SetData(data, () =>
        {
            skillData[idx].nowCooltime = 0;
            skillData[idx].useSkillCount++;
            scoreAssistance.SetSkillPointMode();

            nowUseSkill = skill.skillType;

            switch (skill.skillType)
            {
            case Define.SkillType.StopTime:
                gameTimeAssistance.FreezeTime(skill.GetSkillValue(data.aSkillLv));
                AfterUseSkill();
                break;

            case Define.SkillType.BrokenTiles:
                mapAssistance.AllBlocksDown(AfterUseSkill);
                break;

            case Define.SkillType.ClearAllTiles:
                mapAssistance.ClearAllBlocks(AfterUseSkill);
                break;

            case Define.SkillType.DoubleScore:
                scoreAssistance.SetMultiBonus(
                    DataManager.GetDesignValue(Define.GameDesign.DoubleSkillScoreBonus),
                    skill.GetSkillValue(data.aSkillLv)
                    );
                AfterUseSkill();
                break;

            case Define.SkillType.FillLines:
                mapAssistance.ChangeTileTypeToFillLines(idx, AfterUseSkill);
                break;

            case Define.SkillType.ChangePuzzles:
                mapAssistance.ChangeAllPuzzles(AfterUseSkill);
                break;

            default:
                Debug.Log("something is wrong");
                AfterUseSkill();
                break;
            }
        });
        PopupSystem.OpenPopup(Define.PopupType.UseSkill);
    }
Пример #4
0
    private void CallbackSuccess()
    {
        AddCoinPopup popup = PopupSystem.GetPopup <AddCoinPopup>(Define.PopupType.AddCoin);

        popup.SetData(DataManager.GetDesignValue(Define.GameDesign.FreeCoin), () =>
        {
            DataManager.GetInstance().AfterShowFreeCoinVideo();
        });
        PopupSystem.OpenPopup(Define.PopupType.AddCoin, OnCloseButton);
    }
Пример #5
0
    public void GameStartOpening()
    {
        tileSystem.GameStartOpening();
        uiSystem.GameStartOpening();

        ReadyPopup popup = PopupSystem.GetPopup <ReadyPopup>(Define.PopupType.Ready);

        popup.SetCallback(GameStart);
        PopupSystem.OpenPopup(Define.PopupType.Ready);
    }
Пример #6
0
 public static void ExitGame()
 {
     PopupSystem.GetPopup <QuitPopup>(Define.PopupType.Quit).SetCallback(() =>
     {
         Debug.Log("Exit Game");
         Application.Quit();
     }, null);
     PopupSystem.OpenPopup(Define.PopupType.Quit);
     SoundManager.GetInstance().PlaySound(Define.SoundType.Click);
 }
Пример #7
0
 public void OnClickFreeVideo()
 {
     if (UnityAdsController.IsReady(Define.freeCoinId))
     {
         UnityAdsController.ShowAd(Define.freeCoinId, CallbackSuccess, CallbackSkip, CallbackSkip);
     }
     else
     {
         BasicPopup popup = PopupSystem.GetPopup <BasicPopup>(Define.PopupType.Basic);
         popup.SetData(DataManager.GetText(TextTable.errorVideKey));
         PopupSystem.OpenPopup(Define.PopupType.Basic);
     }
 }
Пример #8
0
 public void GetReward(Define.RewardType rewardType)
 {
     if (rewardDic.ContainsKey(rewardType))
     {
         int rewardCoin = 0;
         if (rewardDic[rewardType].TryGetReward(ref rewardCoin))
         {
             AddCoinPopup popup = PopupSystem.GetPopup <AddCoinPopup>(Define.PopupType.AddCoin);
             popup.SetData(rewardCoin);
             PopupSystem.OpenPopup(Define.PopupType.AddCoin);
         }
     }
 }
Пример #9
0
    protected override void UIOpenAnimation(System.Action callback)
    {
        AnimCurveController.Scale(scaleCurve, startScale, endScale, animTime, moveTarget, () =>
        {
            if (callback != null)
            {
                callback();
            }

            PopupSystem.ClosePopup(Define.PopupType.Ready, () =>
            {
                GoPopup popup = PopupSystem.GetPopup <GoPopup>(Define.PopupType.Go);
                popup.SetData(this.callback);
                PopupSystem.OpenPopup(Define.PopupType.Go);
            });
        });

        AnimCurveController.Rotation(rotationCurve, Vector3.forward, startAngle, endAngle, animTime, moveTarget, null);
    }
Пример #10
0
    private void OnClickSkillIcon(bool bActiveSkill)
    {
        if (petData == null)
        {
            return;
        }
        skillData = bActiveSkill ? petData.GetActiveSkill() : petData.GetPassiveSkill();
        if (skillData == null)
        {
            return;
        }

        SoundManager.GetInstance().PlaySound(Define.SoundType.Click);

        SkillInfoPopup popup = PopupSystem.GetPopup <SkillInfoPopup>(Define.PopupType.SkillInfo);

        popup.SetData(petData, skillData, UpgradeSkill);
        PopupSystem.OpenPopup(Define.PopupType.SkillInfo);
    }
Пример #11
0
    public void OnPlayButton()
    {
        SoundManager.GetInstance().PlaySound(Define.SoundType.Click);

        int selectedPetCount = DataManager.GetInstance().GetTotalSelectedPetsCount();

        if (selectedPetCount <= 0)
        {
            PopupSystem.GetPopup <BasicPopup>(Define.PopupType.Basic).SetData(DataManager.GetText(TextTable.cantPlayGameKey));
            PopupSystem.OpenPopup(Define.PopupType.Basic);
        }
        else
        {
            UISystem.CloseDialog(Define.DialogType.GameReadyDialog, () =>
            {
                TipController.ShowRandomTip();
                ScenesManager.ChangeScene("GameScene");
            });
        }
    }
Пример #12
0
    public void OnClickAdoptButton()
    {
        if (petData == null)
        {
            return;
        }

        SoundManager.GetInstance().PlaySound(Define.SoundType.Click);

        int needCoin = 0;

        if (DataManager.GetInstance().IsEnoughCoin(petData.cost, ref needCoin))
        {
            string msg = string.Format(DataManager.GetText(TextTable.adoptPetPopupMsgKey), petData.GetName());

            UseCoinPopup popup = PopupSystem.GetPopup <UseCoinPopup>(Define.PopupType.UseCoin);
            popup.SetData(msg, petData.cost, petData.unqIdx, AdoptPet);
            PopupSystem.OpenPopup(Define.PopupType.UseCoin);
        }
        else
        {
            //need coin. //
            //NeedCoinPopup popup = PopupSystem.GetPopup<NeedCoinPopup>(Define.PopupType.NeedCoin);
            //popup.SetData(needCoin, () =>
            //{
            //    UISystem.OpenDialog(Define.DialogType.ShopDialog);
            //});
            //PopupSystem.OpenPopup(Define.PopupType.NeedCoin);
            DataManager.GetInstance().SetNeedCoin(needCoin);
            UISystem.OpenDialog(Define.DialogType.ShopDialog);
        }

        if (LobbyManager.activeAdoptGuideTutorial)
        {
            TutorialManager.GetInstance().CallReaction();
        }
    }
Пример #13
0
    private void OnClickBuyButton(int idx)
    {
        string productKey = "";

        if (DataManager.GetInstance().TryGetProductKey(idx, ref productKey))
        {
            InAppPurchaser.BuyProduct(productKey, (string key) =>
            {
                int value = 0;
                if (DataManager.GetInstance().TryGetProductValue(key, ref value))
                {
                    UISystem.UpdateNews();

                    AddCoinPopup popup = PopupSystem.GetPopup <AddCoinPopup>(Define.PopupType.AddCoin);
                    popup.SetData(value);
                    PopupSystem.OpenPopup(Define.PopupType.AddCoin, OnCloseButton);

                    UnityEngine.Analytics.Analytics.CustomEvent("buy product", new Dictionary <string, object>
                    {
                        { productKey, key }
                    });
                }
                else
                {
                    BasicPopup popup = PopupSystem.GetPopup <BasicPopup>(Define.PopupType.Basic);
                    popup.SetData(DataManager.GetText(TextTable.errorBuyProductKey));
                    PopupSystem.OpenPopup(Define.PopupType.Basic);

                    UnityEngine.Analytics.Analytics.CustomEvent("product error", new Dictionary <string, object>
                    {
                        { productKey, key }
                    });
                }
            });
        }
    }