Beispiel #1
0
    private void OnAdsRewardedBuySkin(OnAdsRewardedBuySkin obj)
    {
        GlobalEvents <OnAdsRewardedShow> .Call(new OnAdsRewardedShow());

        //Temp
        GlobalEvents <OnBuySkinByRewarded> .Call(new OnBuySkinByRewarded { Id = obj.Id });
    }
Beispiel #2
0
    void IsGiftAvailable()
    {
        if (_isWaitGiftTime)
        {
            DateTime _currentDate = DateTime.UtcNow;
            TimeSpan _difference  = _giftNextDate.Subtract(_currentDate);
            if (_difference.TotalSeconds <= 0f)
            {
                _isWaitGiftTime = false;
                GlobalEvents <OnGiftAvailable> .Call(new OnGiftAvailable { isAvailable = true });

                FlurryEventsManager.SendEvent("collect_prize_impression");
            }
//			else {
//				string _minutes = _difference.Minutes.ToString ();
//				if (_difference.Minutes < 10) {
//					_minutes = "0" + _minutes;
//				}
//				string _seconds = _difference.Seconds.ToString ();
//				if (_difference.Seconds < 10) {
//					_seconds = "0" + _seconds;
//				}
//				timeText.text = _minutes + ":" + _seconds;
//			}
        }
    }
Beispiel #3
0
    private void CompleteQuest(Quest quest)
    {
        quest.progress = quest.total;
        GlobalEvents <OnQuestCompleted> .Call(new OnQuestCompleted { QuestItem = quest });

        GlobalEvents <OnOpenSkin> .Call(new OnOpenSkin { QuestItem = quest });
    }
Beispiel #4
0
    public void add10Coins()
    {
        FlurryEventsManager.SendEvent("collect_prize");

        for (int i = 0; i < 10; i++)
        {
            GameObject _coin      = (GameObject)Instantiate(coin, Camera.main.ScreenToWorldPoint(Vector3.zero), Quaternion.identity);
            Coin       coinScript = _coin.GetComponent <Coin> ();
            coinScript.MoveToEnd();
        }
        //Save the current system time as a string in the player prefs class
        _giftNextDate = DateTime.UtcNow;
        DefsGame.BTN_GIFT_HIDE_DELAY = DefsGame.BTN_GIFT_HIDE_DELAY_ARR [DefsGame.BTN_GIFT_HIDE_DELAY_COUNTER];
        if (DefsGame.BTN_GIFT_HIDE_DELAY_COUNTER < DefsGame.BTN_GIFT_HIDE_DELAY_ARR.Length - 1)
        {
            ++DefsGame.BTN_GIFT_HIDE_DELAY_COUNTER;
            PlayerPrefs.SetInt("BTN_GIFT_HIDE_DELAY_COUNTER", DefsGame.BTN_GIFT_HIDE_DELAY_COUNTER);
        }
        _giftNextDate = _giftNextDate.AddMinutes(DefsGame.BTN_GIFT_HIDE_DELAY);
        PlayerPrefs.SetString("dateGiftClicked", _giftNextDate.ToBinary().ToString());
        //timeText.enabled = true;
        //giftButton.enabled = false;
        _isWaitGiftTime = true;
        //giftButton.DisableButtonClicks();

        GlobalEvents <OnGiftAvailable> .Call(new OnGiftAvailable { isAvailable = false });

        D.Log("Disable Button Clicks");
    }
    private void UpdateTmer()
    {
        if (_isWaitGiftTime)
        {
            var _currentDate = DateTime.UtcNow;
            var _difference  = _giftNextDate.Subtract(_currentDate);
            if (_difference.TotalSeconds <= 0f)
            {
                _isWaitGiftTime = false;
                GlobalEvents <OnGiftAvailable> .Call(new OnGiftAvailable { IsAvailable = true });

                FlurryEventsManager.SendEvent("collect_prize_impression");
            }
            else
            {
                string _minutes = _difference.Minutes.ToString();
                if (_difference.Minutes < 10)
                {
                    _minutes = "0" + _minutes;
                }
                string _seconds = _difference.Seconds.ToString();
                if (_difference.Seconds < 10)
                {
                    _seconds = "0" + _seconds;
                }
                timeText.text = _minutes + ":" + _seconds;
            }
        }
    }
 public void BtnClose()
 {
     UIManager.HideUiElement("ScreenGameOverBtnBack");
     UIManager.HideUiElement("NotifyGiftExtra");
     UIManager.HideUiElement("NotifySkinExtra");
     GlobalEvents <OnHideGiftScreen> .Call(new OnHideGiftScreen());
 }
    public void BtnClose()
    {
        UIManager.HideUiElement("ScreenGiftImageSkin");
        UIManager.HideUiElement("ScreenGiftBtnPlay");

        GlobalEvents <OnHideGiftScreen> .Call(new OnHideGiftScreen());
    }
    private void OnHideGiftScreen(OnHideGiftScreen obj)
    {
        // Предлагаем Еще оди подарок
        if (isFirstTime)
        {
            isFirstTime = false;

            UIManager.ShowUiElement("ScreenGameOverBtnBack");
            UIElement element = null;
            if (_giftType == 1)
            {
                UIManager.ShowUiElement("NotifyGiftExtra");
                element = GetUIElement("NotifyGiftExtra");
            }
            else
            if (_giftType == 2)
            {
                UIManager.ShowUiElement("NotifySkinExtra");
                element = GetUIElement("NotifySkinExtra");
            }

            if (element)
            {
                element.customStartAnchoredPosition    = new Vector3(0f, _centerPointY, 0f);
                element.useCustomStartAnchoredPosition = true;
            }

            return;
        }

        UIManager.HideUiElement("ScreenGift");
        GlobalEvents <OnGiftCollected> .Call(new OnGiftCollected());

        GlobalEvents <OnShowMenu> .Call(new OnShowMenu());
    }
Beispiel #9
0
    private void OnAdsVideoTryShow(OnAdsVideoTryShow obj)
    {
        Debug.Log("OnAdsVideoTryShow" + _videoAdCounter + " " + _isVideoWaitTimer + " " + _videoDate);
        if (_isFirstTimeVideo && _videoAdCounter == 3 ||
            _videoAdCounter >= 5)
        {
            if (_isFirstTimeVideo)
            {
                _isFirstTimeVideo = false;
            }

            if (!_isVideoWaitTimer)
            {
                GlobalEvents <OnAdsVideoShow> .Call(new OnAdsVideoShow());

                Debug.Log("GlobalEvents<OnShowVideoAds>");
            }
//            _isVideoAdCalcNext = false;
        }
        else
        {
            if (_isVideoAdCalcNext)
            {
                ++_videoAdCounter;
            }
        }
    }
Beispiel #10
0
    void Start()
    {
        targetSpawner.bounds = new Rect(
            gameBounds.x + targetAreaPadLeft,
            gameBounds.y + targetAreaPadBottom,
            gameBounds.width - targetAreaPadLeft - targetAreaPadRight,
            gameBounds.height - targetAreaPadTop - targetAreaPadBottom);
        targetSpawner.scoreBounds = new Rect(
            scoreText.transform.position.x - 1.7f,
            scoreText.transform.position.y - 1.2f,
            3.4f,
            2.4f);
        targetSpawner.spawnStrategy = SpawnerStrategy.First;
        targetSpawner.Spawn();

        timerBar.ShowTimer();

        var highscore = PlayerPrefs.GetInt("Highscore");

        scoreText.text = highscore.ToString();
        if (highscore <= 0)
        {
            crown.DOFade(0f, 0f);
            scoreText.gameObject.SetActive(false);
        }

        RespawnArrow();

        _hint.SetActive(false);
        Invoke("ShowHintHand", 2f);

        GlobalEvents <OnGameLoaded> .Call(new OnGameLoaded());
    }
Beispiel #11
0
 private void ShowUnlockedDialog()
 {
     if (unlockedQuests.Count > 0)
     {
         var quest = unlockedQuests.Dequeue();
         GlobalEvents <OnQuestShowUnlockedDialog> .Call(new OnQuestShowUnlockedDialog { QuestItem = quest });
     }
 }
Beispiel #12
0
 private void Hide()
 {
     transform.DOLocalMoveX(-_rt.GetWidth(), 0.2f).OnComplete(() =>
     {
         _staff.SetActive(false);
     });
     GlobalEvents <OnGameInputEnable> .Call(new OnGameInputEnable { Flag = true });
 }
Beispiel #13
0
    private void OnGameOver(OnGameOver obj)
    {
        _perectCounter = 0;
        Camera.main.DOShakePosition(cameraShakeDuration, 0.2f, cameraShakeVibratio);
        GlobalEvents <OnVibrate> .Call(new OnVibrate());

        _background.DOColor(bgGameOverColor, 0.5f).SetEase(Ease.OutQuart)
        .OnComplete(() => _background.DOColor(Color.white, 0.5f).SetEase(Ease.InQuart));
    }
Beispiel #14
0
    private void OnGetQuest(OnGetQuest obj)
    {
        Quest quest = Quest.GetByID(obj.SkinType, obj.Id);

        if (quest != null)
        {
            GlobalEvents <OnSendQuest> .Call(new OnSendQuest { QuestItem = quest });
        }
    }
Beispiel #15
0
    private void BuySkin(int id)
    {
        Analytics.CustomEvent("SkinsSkinBuy",
                              new Dictionary <string, object> {
            { "sessions", PrefsManager.GameplayCounter }, { "id", id }
        });
//        OpenSkin(id);

        GlobalEvents <OnGotNewCharacter> .Call(new OnGotNewCharacter());
    }
Beispiel #16
0
    // Запускаем таймер ожидание следующей Ревардед рекламы
    private void OnAdsRewardedShowing(OnAdsRewardedShowing e)
    {
        _rewardDate          = UnbiasedTime.Instance.Now();
        _rewardDate          = _rewardDate.AddMinutes(2);
        _isRewardedWaitTimer = true;
        GlobalEvents <OnAdsRewardedWaitTimer> .Call(new OnAdsRewardedWaitTimer { IsWait = true });

        //Обнуляем Video таймер и коунтер
        StartWaitingVideo();
    }
Beispiel #17
0
    public void OnClickReviveButton()
    {
#if UNITY_EDITOR
        GameEvents.Send(OnRevive);
#else
        GlobalEvents <OnAdsRewardedShow> .Call(new OnAdsRewardedShow());
#endif

        Destroy(gameObject);
    }
Beispiel #18
0
 public static void ShowVideoAds()
 {
     if (_videoAdCounter >= 4)
     {
         GlobalEvents <OnShowVideoAds> .Call(new OnShowVideoAds());
     }
     else
     {
         ++_videoAdCounter;
     }
 }
Beispiel #19
0
    // Открыть скин за просмотр рекламы
    private void OnBuySkinByRewarded(OnBuySkinByRewarded obj)
    {
//        switch (obj.Id)
//        {
//            case CHARACTER_REWARDED_1: OpenSkin(CHARACTER_REWARDED_1);
//                break;
//        }
//        MasterAudio.PlaySoundAndForget("GUI_Grab");
        Hide();
        GlobalEvents <OnShowMenu> .Call(new OnShowMenu());
    }
Beispiel #20
0
 public void BtnTryClick()
 {
     if (_quest.skinType == SkinType.Arrow)
     {
         GlobalEvents <OnChangeSkin> .Call(new OnChangeSkin { Id = _quest.skinId });
     }
     else
     {
         GlobalEvents <OnChangeTargetSkin> .Call(new OnChangeTargetSkin { Id = _quest.skinId });
     }
     Close();
     GlobalEvents <OnScreenSkinsHide> .Call(new OnScreenSkinsHide());
 }
Beispiel #21
0
    private void OnIventPerfect(OnIventPerfect obj)
    {
        ++_perectCounter;
        if (_perectCounter >= 3)
        {
            GlobalEvents <OnVibrate> .Call(new OnVibrate());

            Camera.main.DOShakePosition(cameraShakeDuration, cameraShakeStrength, cameraShakeVibratio);
        }
        _background.DOKill();
        _background.DOColor(_perectCounter > 2 ? bgPerfectColor : bgHitColor, bgColorInDuration)
        .OnComplete(() => _background.DOColor(Color.white, bgColorOutDuration));
    }
Beispiel #22
0
    public void BtnNewSkinClick()
    {
        HideNotifications();
        int id = _activeNamesList.IndexOf("NotifyNewCharacter");

        if (id != -1)
        {
            _activeNamesList.RemoveAt(id);
        }

        AddNotifyNextSkin(200);

        GlobalEvents <OnBtnGetRandomSkinClick> .Call(new OnBtnGetRandomSkinClick());

        GlobalEvents <OnHideMenu> .Call(new OnHideMenu());
    }
    private void OnGiftShowRandomSkinAnimation(OnGiftShowRandomSkinAnimation obj)
    {
        int id = GetRandomAvailableSkin();

        if (id != -1)
        {
//			if (_sprRenderer.sprite) Resources.UnloadAsset(_sprRenderer.sprite);
            _sprRenderer.sprite  = Resources.Load <Sprite>("gfx/Skins/Skin" + "1");
            transform.localScale = Vector3.one;
            UIManager.ShowUiElement("ScreenGiftImageSkin");

            Invoke("ShowBtnClose", 1.5f);

            GlobalEvents <OnBuySkin> .Call(new OnBuySkin { Id = id });
        }
    }
Beispiel #24
0
    public void BtnEquip()
    {
        if (_quest.skinType == SkinType.Arrow)
        {
            ScreenSkins.CurrentFaceId = _quest.skinId;
            SecurePlayerPrefs.SetInt("currentFaceID", ScreenSkins.CurrentFaceId);
            GlobalEvents <OnChangeSkin> .Call(new OnChangeSkin { Id = ScreenSkins.CurrentFaceId });
        }
        else
        {
            ScreenSkins.CurrentTargetId = _quest.skinId;
            SecurePlayerPrefs.SetInt("currentFaceID", ScreenSkins.CurrentTargetId);
            GlobalEvents <OnChangeTargetSkin> .Call(new OnChangeTargetSkin { Id = ScreenSkins.CurrentTargetId });
        }

        Close();
    }
Beispiel #25
0
    public void BtnGiftClick()
    {
        HideNotifications();
        int id = _activeNamesList.IndexOf("NotifyGift");

        if (id != -1)
        {
            _activeNamesList.RemoveAt(id);
        }

        _activeNamesList.Add("NotifyGiftWaiting");

        GlobalEvents <OnBtnGiftClick> .Call(new OnBtnGiftClick { CoinsCount = _giftValue, IsResetTimer = true });

        _giftValue = 0;
        GlobalEvents <OnHideMenu> .Call(new OnHideMenu());
    }
Beispiel #26
0
    // Пришел Ивент о покупки скина
    private void OnBuySkinByIAP(OnBuySkinByIAP obj)
    {
//        switch (obj.Id)
//        {
//            case BillingManager.iapTierSkin1: OpenSkin(IapSkin1);
//                break;
//            case BillingManager.iapTierSkin2: OpenSkin(IapSkin2);
//                break;
//            case BillingManager.iapTierSkin3: OpenSkin(IapSkin3);
//                break;
//            case BillingManager.iapTierSkin4: OpenSkin(IapSkin4);
//                break;
//        }
//        MasterAudio.PlaySoundAndForget("GUI_Grab");
        Hide();
        GlobalEvents <OnShowMenu> .Call(new OnShowMenu());
    }
Beispiel #27
0
    public void TargetHit(bool isBullseye, Vector3 position)
    {
        targetHits++;
        bullseyeStreak = isBullseye ? bullseyeStreak + 1 : 0;
        score         += 1 + bullseyeStreak;

        _pointsBalloonManager.Add(bullseyeStreak + 1, Camera.main.WorldToScreenPoint(position));
        scoreText.text = score.ToString();

        GlobalEvents <OnTargetHit> .Call(new OnTargetHit
        {
            score          = score,
            totalScore     = PlayerPrefs.GetInt("TotalScore", 0) + score,
            bullseyeStreak = bullseyeStreak,
            targetHits     = targetHits,
            timerLeft      = timerBar.TimeLeft,
            isTargetMoving = targetSpawner.spawnStrategy == SpawnerStrategy.SimpleMoving || targetSpawner.spawnStrategy == SpawnerStrategy.SimpleMovingVertical
        });

        scoreText.transform.localScale = Vector3.one;
        scoreText.transform.DOPunchScale(Vector3.one * Mathf.Min(minScorePunch + bullseyeStreak / 10f, maxScorePunch),
                                         scorePunchDuration);

        timerBar.StartTimer(Mathf.Max(timerMaxTime - timerReductionPerHit * targetHits, timerMinTime));

        SetArrowParticles();

        if (isBullseye)
        {
            GlobalEvents <OnIventPerfect> .Call(new OnIventPerfect());
        }
        else
        {
            GlobalEvents <OnIventSimple> .Call(new OnIventSimple());
        }

        SetSpawnerStrategy();
        StartCoroutine(MyUtils.DelayedAction(targetSpawner.Spawn, targetRespawnInterval));

        isArrowFlying = false;

        if (!gameStarted)
        {
            StartGame();
        }
    }
Beispiel #28
0
    void Awake()
    {
        var cameraHeight = Camera.main.orthographicSize;
        var cameraWidth  = cameraHeight * Mathf.Min(gameAspect, Camera.main.aspect);

        gameBounds = new Rect(-cameraWidth, -cameraHeight, cameraWidth * 2, cameraHeight * 2);

        touchPositions = new Queue <Vector2>();

        var daysInRow = PlayerPrefs.GetInt("PlayedDaysInRow", 1);
        var lastLogin = PlayerPrefs.GetInt("LastLoginTime", 0);
        var now       = (int)TimeSpan.FromTicks(DateTime.Now.Ticks).TotalHours;

        if (lastLogin == 0)
        {
            lastLogin = now;
            PlayerPrefs.SetInt("LastLoginTime", now);
        }
        var hoursSinceLastLogin = now - lastLogin;

        if (hoursSinceLastLogin >= 24)
        {
            if (hoursSinceLastLogin < 48)
            {
                daysInRow++;
            }
            else
            {
                daysInRow = 1;
            }
            PlayerPrefs.SetInt("LastLoginTime", now);
            PlayerPrefs.SetInt("PlayedDaysInRow", daysInRow);
        }

        GlobalEvents <OnChangeSkin> .Happened       += OnChangeArrowSkin;
        GlobalEvents <OnChangeTargetSkin> .Happened += OnChangeTargetSkin;

        cross = Instantiate(crossPrefab).GetComponent <Cross>();
        cross.gameObject.SetActive(false);

        forceCoef = (maxForce - minForce) / (maxSwipeTime - minSwipeTime);

        _gameplayCounter = 0;

        GlobalEvents <OnGameAwake> .Call(new OnGameAwake { daysInRow = daysInRow });
    }
Beispiel #29
0
    private void CheckHighScore()
    {
        if (PlayerPrefs.GetInt("LastScore") > PlayerPrefs.GetInt("Highscore"))
        {
            fireworks.Play();

            highscoreText.transform.localScale = Vector3.zero;
            highscoreText.gameObject.SetActive(true);
            highscoreText.transform.DOScale(Vector3.one, highscoreDuration);

            scoreText.transform.DOScale(highscoreScale, highscoreDuration).SetLoops(6, LoopType.Yoyo)
            .SetEase(Ease.InOutQuad);

            PlayerPrefs.SetInt("Highscore", PlayerPrefs.GetInt("LastScore"));
            GlobalEvents <OnScreenRateShow> .Call(new OnScreenRateShow { IsBtnClick = false });
        }
    }
Beispiel #30
0
    public override void Select()
    {
        base.Select();
        if (SecurePlayerPrefs.GetInt("targetsAvailable_" + _id) == 1 || _id == 0)
        {
            ScreenSkins.CurrentTargetId = _id;
            SecurePlayerPrefs.SetInt("CurrentTargetId", ScreenSkins.CurrentTargetId);
            SetLock(false);
            GlobalEvents <OnChangeTargetSkin> .Call(new OnChangeTargetSkin { Id = _id });

//			MasterAudio.PlaySoundAndForget("GUI_Grab");
            GlobalEvents <OnScreenSkinsHide> .Call(new OnScreenSkinsHide());
        }
        else
        {
            GameEvents.Send(OnShowQuestDialog, _id);
        }
    }