public override void OnNotificationReceived(Notification notification, NotificationParam param = null)
        {
            switch (notification)
            {
            case Notification.SetUi:
                // D.Log("IdleTestUiController -> SetUi");
                SetUpButtons();
                break;

            case Notification.IdleButtonsGenerated:
                App.Notify(Notification.UiSet);
                break;

            case Notification.UnitsUpdated:
                unitText.text = App.GetLevelData().Unit.ToShortString();
                IdleCurrency perSecond =
                    App.GetLevelData().UnitIncrement + App.GetLevelData().unitsFoundInTapThisSecond;
                unitsPerSecondText.text = perSecond.ToShortString() + "/sec";
                break;

            case Notification.SetUpIdleButtons:
                SetUpButtons();
                break;
            }
        }
示例#2
0
        private void SetUpCost(IdleCurrency cost)
        {
            IdleCurrency currentCost = cost * App.GetLevelData().currentMultiplier;

            for (int i = 0; i < costText.Length; i++)
            {
                costText[i].text = currentCost.ToShortString();
            }
        }
示例#3
0
        private void SetUpFinalUnit(IdleCurrency unitsPerSecond, int totalCount)
        {
            IdleCurrency finalUnits = unitsPerSecond * totalCount;

            for (int i = 0; i < finalUnitTexts.Length; i++)
            {
                finalUnitTexts[i].text = finalUnits.ToShortString() + "/sec";
            }
        }
示例#4
0
        public void ButtonPressed()
        {
            buttonPrice    += buttonPrice * rateOfPriceIncrease;
            buttonText.text = buttonPrice.ToShortString();

            rateOfChange         += rateOfUnitIncrease;
            rateOfChangeText.text = rateOfChange.ToShortString() + "/sec";

            CompareAndHandleButtonActivation(unit, buttonPrice);
        }
示例#5
0
        private void SetUpIncreaseUnit(IdleCurrency unitIncreasePerSecond, IdleCurrency permanentMultiplier)
        {
            IdleCurrency currentUnitsPerInNextClickPerSecond =
                unitIncreasePerSecond * permanentMultiplier * App.GetLevelData().Prestige *
                App.GetLevelData().currentMultiplier;

            for (int i = 0; i < increaseUnitTexts.Length; i++)
            {
                increaseUnitTexts[i].text = currentUnitsPerInNextClickPerSecond.ToShortString() + "/sec";
            }
        }
        // [Button()]
        public override void SetDefault()
        {
            base.SetDefault();
            growth.currentSliderValue = minSliderValue;
            if (dependsOn.dependencies != null)
            {
                for (int i = 0; i < dependsOn.dependencies.Count; i++)
                {
                    dependsOn.dependencies[i].isComplete = false;
                }
            }

            permanentMultiplier = 1;
        }
示例#7
0
        private void CompareAndHandleButtonActivation(IdleCurrency unit, IdleCurrency currentCost)
        {
            int a = IdleCurrency.Compare(unit, currentCost);

            // D.Log($"a = {a}");

            if (a == -1)
            {
                // D.Log($"unit {unit.ToShortString()} is less than currentCost {currentCost.ToShortString()}");
                priceButton.interactable = false;
            }
            else
            {
                // D.Log($"unit {unit.ToShortString()} is greater than currentCost {currentCost.ToShortString()}");
                priceButton.interactable = true;
            }
        }
示例#8
0
 public void SetDefault()
 {
     game               = new SaveGame();
     CurrentLevel       = currentLevelDefault;
     CurrentLevelActual = currentLevelDefault;
     IsTutorialOver     = isTutorialOverDefault;
     IsSfxOn            = isSfxOnDefault;
     IsMusicOn          = isMusicOnDefault;
     IsVibrationOn      = isVibrationOnDefault;
     Coins              = coinsDefault;
     AdsInactive        = isAdsInactiveDefault;
     AreLevelsExhausted = false;
     AdLastLevel        = firstAdLevel;
     //Idle Game Related
                 #if IDLEGAME
     LastDateTime = "";
     unitsFoundInTapThisSecond = new IdleCurrency(0);
     Prestige          = 1.0f;
     currentMultiplier = currentMultiplierDefault;
     UnitIncrement     = defaultUnitPerSecond;
     Unit = defaultUnits;
                 #endif
     //Idle Game Related
 }
示例#9
0
 private void SecondElapsed()
 {
     unit         += rateOfChange;
     showText.text = unit.ToShortString();
     CompareAndHandleButtonActivation(unit, buttonPrice);
 }
        private void HandleButtonPressed(IdleUnitType unitType)
        {
            IdleInfo info = App.GetIdleData().GetInfo(unitType);

            App.GetLevelData().unitsToBeAddedNextTick += info.defaultUnitIncreasePerSecond * info.permanentMultiplier *
                                                         (int)App.GetLevelData().currentMultiplier;
            IdleCurrency unit = App.GetLevelData().Unit;

            unit = unit - info.nextCost.cost.cost;
            if (unit < 0)
            {
                unit = 0;
            }
            App.GetLevelData().Unit = unit;
            //Formula for upgrading cost
            IdleCurrency currentCost = info.nextCost.cost.cost;

            if (info.hasAdsForCost)
            {
                if (info.alwaysVideo)
                {
                    info.nextCost.isVideo = true;
                }
                else
                {
                    info.currentCountOfTap++;
                    if (info.currentCountOfTap >= info.adsEveryHowManyTap)
                    {
                        info.nextCost.isVideo = true;
                    }
                    else
                    {
                        info.nextCost.isVideo = false;
                        IdleCurrency priceOnBaseCost = info.data.baseCost * info.data.percentageOnBaseCost;
                        priceOnBaseCost *= 0.01f;
                        IdleCurrency priceOnNewCost = currentCost * info.data.percentageOnNewCost;
                        priceOnNewCost          *= 0.01f;
                        info.nextCost.cost.cost += (priceOnBaseCost + priceOnNewCost);
                    }
                }
            }
            else
            {
                info.nextCost.isVideo = false;
                IdleCurrency priceOnBaseCost = info.data.baseCost * info.data.percentageOnBaseCost;
                priceOnBaseCost *= 0.01f;
                IdleCurrency priceOnNewCost = currentCost * info.data.percentageOnNewCost;
                priceOnNewCost          *= 0.01f;
                info.nextCost.cost.cost += (priceOnBaseCost + priceOnNewCost);
            }

            int addition = (int)App.GetLevelData().currentMultiplier;

            D.Log($"addition is {addition}");
            info.currentCount += addition;

            info.growth.currentSliderValue = 0;
            for (int i = 0; i < info.currentCount; i++)
            {
                if (i < info.growth.firstHalfClicks)
                {
                    info.growth.currentSliderValue += info.growth.firstHalfGrowthRate;
                }
                else
                {
                    info.growth.currentSliderValue += info.growth.lastHalfGrowthRate;
                }
            }

            if (info.data.hasTimerBeforeNextClick)
            {
                NotificationParam param = new NotificationParam(Mode.intData);
                param.intData.Add((int)info.unitType);
                App.Notify(Notification.StartBlockIng, param);
            }
            App.Notify(Notification.UnitsUpdated);
        }