コード例 #1
0
        public void SetUp(SingleDependency dependency)
        {
            idleUnitType = dependency.unitType;
            for (int i = 0; i < valueText.Length; i++)
            {
                valueText[i].text = dependency.countToUnlock.ToString();
            }

            HideAll();

            if (dependency.isComplete)
            {
                for (int i = 0; i < completeItems.Length; i++)
                {
                    completeItems[i].Show();
                }
            }
            else
            {
                for (int i = 0; i < incompleteItems.Length; i++)
                {
                    incompleteItems[i].Show();
                }
            }
        }
コード例 #2
0
        private void HandleTimerOfInfo(IdleUnitType unit, bool isStarted)
        {
            IdleInfo info = App.GetIdleData().GetInfo(unit);

            if (info != null)
            {
                if (isStarted)
                {
                    info.idleActivation.hasTimerFinished = false;
                }
                else
                {
                    info.idleActivation.hasTimerFinished = true;
                }
            }
        }
コード例 #3
0
 private void SetUpData(IdleInfo info)
 {
     SetUpCount(info.currentCount, info.data.totalCount);
     SetUpCost(info.nextCost.cost.cost);
     SetUpIncreaseUnit(info.defaultUnitIncreasePerSecond, info.permanentMultiplier);
     SetUpFinalUnit(info.defaultUnitIncreasePerSecond, info.data.totalCount);
     if (info.data.hasTimerBeforeNextClick)
     {
         fillTimer = info.currentBlockTime;
     }
     else
     {
         fillTimer = 0.0f;
     }
     unitType = info.unitType;
 }
コード例 #4
0
        private IdleButtonView GetIdleButton(IdleUnitType type)
        {
            if (buttonViews == null)
            {
                return(null);
            }

            for (int i = 0; i < buttonViews.Count; i++)
            {
                if (buttonViews[i].GetUnit() == type)
                {
                    return(buttonViews[i]);
                }
            }

            return(null);
        }
コード例 #5
0
        public IdleInfo GetInfo(IdleUnitType item)
        {
            IdleInfo info     = null;
            bool     canBreak = false;

            for (int i = 0; i < idleLevels.Count; i++)
            {
                for (int j = 0; j < idleLevels[i].idleInfos.Count; j++)
                {
                    if (item == idleLevels[i].idleInfos[j].unitType)
                    {
                        info     = idleLevels[i].idleInfos[j];
                        canBreak = true;
                        break;
                    }
                }
                if (canBreak)
                {
                    break;
                }
            }
            return(info);
        }
コード例 #6
0
        public int GetCount(IdleUnitType item)
        {
            int  count    = 0;
            bool canBreak = false;

            for (int i = 0; i < idleLevels.Count; i++)
            {
                for (int j = 0; j < idleLevels[i].idleInfos.Count; j++)
                {
                    if (item == idleLevels[i].idleInfos[j].unitType)
                    {
                        count    = idleLevels[i].idleInfos[j].currentCount;
                        canBreak = true;
                        break;
                    }
                }
                if (canBreak)
                {
                    break;
                }
            }
            return(count);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        private void EvaluateInfos()
        {
            // D.Log($"Evaluating info");
            for (int i = 0; i < App.GetIdleData().idleLevels.Count; i++)
            {
                for (int j = 0; j < App.GetIdleData().idleLevels[i].idleInfos.Count; j++)
                {
                    IdleInfo info = App.GetIdleData().idleLevels[i].idleInfos[j];

                    LogicStatus status = App.GetLogicEvaluator().EvaluateLogic(info.logicToUnlock);

                    if (info.nextCost.cost.cost < App.GetLevelData().Unit&& status == LogicStatus.Fulfilled)
                    {
                        info.idleActivation.isAffordable = true;
                    }
                    else
                    {
                        info.idleActivation.isAffordable = false;
                    }

                    if (info.data.hasTimerBeforeNextClick)
                    {
                        if (info.idleActivation.hasTimerFinished)
                        {
                            info.idleActivation.isClickable = true;
                        }
                        else
                        {
                            info.idleActivation.isClickable = false;
                        }
                    }

                    if (!info.data.isLockedByDefault)
                    {
                        info.idleActivation.isUnlocked = true;
                    }
                    else
                    {
                        if (info.dependsOnAllPrevious)
                        {
                            bool canUnlock = true;

                            for (int k = 0; k < j; k++)
                            {
                                IdleInfo prevInfo = App.GetIdleData().idleLevels[i].idleInfos[k];
                                if (prevInfo.currentCount < prevInfo.data.totalCount)
                                {
                                    canUnlock = false;
                                    break;
                                }
                            }

                            info.idleActivation.isUnlocked = canUnlock;
                        }
                        else
                        {
                            int filledDependencies = 0;
                            for (int k = 0; k < info.dependsOn.dependencies.Count; k++)
                            {
                                IdleUnitType type          = info.dependsOn.dependencies[i].unitType;
                                int          requiredCount = info.dependsOn.dependencies[i].countToUnlock;
                                int          actualCount   = App.GetIdleData().GetCount(type);
                                if (requiredCount <= actualCount)
                                {
                                    info.dependsOn.dependencies[i].isComplete = true;
                                    filledDependencies++;
                                }
                                else
                                {
                                    info.dependsOn.dependencies[i].isComplete = false;
                                }
                            }
                            if (filledDependencies == info.dependsOn.dependencies.Count)
                            {
                                info.idleActivation.isUnlocked = true;
                            }
                            else
                            {
                                info.idleActivation.isUnlocked = false;
                            }
                        }
                    }
                }
            }
            App.Notify(Notification.ButtonsUpdated);
        }