public void GetExp()
        {
            const int stageNumber = 100;
            // 스테이지와 캐릭터 레벨 차가 최저일 때.
            var characterLevel = stageNumber + StageRewardExpHelper.DifferLowerLimit;
            var exp            = StageRewardExpHelper.GetExp(characterLevel, stageNumber);

            Assert.AreEqual(StageRewardExpHelper.RewardExpMax, exp);
            characterLevel--;
            exp = StageRewardExpHelper.GetExp(characterLevel, stageNumber);
            Assert.AreEqual(StageRewardExpHelper.RewardExpMax, exp);

            // 스테이지와 캐릭터 레벨 차가 최고일 때.
            characterLevel = stageNumber + StageRewardExpHelper.DifferUpperLimit;
            exp            = StageRewardExpHelper.GetExp(characterLevel, stageNumber);
            Assert.AreEqual(StageRewardExpHelper.RewardExpMin, exp);
            characterLevel++;
            exp = StageRewardExpHelper.GetExp(characterLevel, stageNumber);
            Assert.AreEqual(StageRewardExpHelper.RewardExpMin, exp);

            // 스테이지와 캐릭터 레벨 차가 0일 때.
            const int differ = 0;

            Assert.IsTrue(StageRewardExpHelper.CachedExp.ContainsKey(differ));
            characterLevel = stageNumber + differ;
            exp            = StageRewardExpHelper.GetExp(characterLevel, stageNumber);
            Assert.AreEqual(StageRewardExpHelper.CachedExp[differ], exp);
        }
Exemplo n.º 2
0
        private void UpdateStageInformation(int stageId, int characterLevel)
        {
            var isSubmittable = false;

            if (!(_sharedViewModel.WorldInformation is null))
            {
                if (!_sharedViewModel.WorldInformation.TryGetWorldByStageId(stageId, out var world))
                {
                    throw new ArgumentException(nameof(stageId));
                }

                isSubmittable = world.IsPlayable(stageId);
            }

            var stageWaveSheet = Game.Game.instance.TableSheets.StageWaveSheet;

            stageWaveSheet.TryGetValue(stageId, out var stageWaveRow, true);
            titleText.text = $"Stage {GetStageIdString(stageWaveRow.StageId)}";

            var monsterCount = stageWaveRow.TotalMonsterIds.Count;

            for (var i = 0; i < monstersAreaCharacterViews.Count; i++)
            {
                var characterView = monstersAreaCharacterViews[i];
                if (i < monsterCount)
                {
                    characterView.Show();
                    characterView.SetByCharacterId(stageWaveRow.TotalMonsterIds[i]);

                    continue;
                }

                characterView.Hide();
            }

            var stageSheet = Game.Game.instance.TableSheets.StageSheet;

            stageSheet.TryGetValue(stageId, out var stageRow, true);
            var rewardItemRows  = stageRow.GetRewardItemRows();
            var rewardItemCount = rewardItemRows.Count;

            for (var i = 0; i < rewardsAreaItemViews.Count; i++)
            {
                var itemView = rewardsAreaItemViews[i];
                if (i < rewardItemCount)
                {
                    itemView.Show();
                    itemView.SetData(rewardItemRows[i]);

                    continue;
                }

                itemView.Hide();
            }

            var exp = StageRewardExpHelper.GetExp(characterLevel, stageId);

            expText.text = $"EXP +{exp}";

            submitButton.SetSubmittable(isSubmittable);
            buttonNotification.SetActive(stageId == Find <WorldMap>().StageIdToNotify);
        }