コード例 #1
0
        public void Restriction_Min()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Min", "2" }, null);

            Assert.AreEqual(typeof(MinSequenceLimit), sut.Restriction.GetType());
            Assert.AreEqual(2, (sut.Restriction as MinSequenceLimit).MinLimit);
        }
コード例 #2
0
        public void Restriction_Bannned()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Banned", "1" }, null);

            Assert.AreEqual(typeof(Scripts.Workers.Score_and_Limits.BannedSprite), sut.Restriction.GetType());
            Assert.AreEqual(1, (sut.Restriction as Scripts.Workers.Score_and_Limits.BannedSprite).SpriteValue);
        }
コード例 #3
0
        public void Restriction_Max()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Max", "3" }, null);

            Assert.AreEqual(typeof(MaxSequenceLimit), sut.Restriction.GetType());
            Assert.AreEqual(3, (sut.Restriction as MaxSequenceLimit).MaxLimit);
        }
コード例 #4
0
        public void Restriction_Type()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Type", "r" }, null);

            Assert.AreEqual(typeof(BannedPieceType), sut.Restriction.GetType());
            Assert.AreEqual(PieceTypes.Rainbow, (sut.Restriction as BannedPieceType).BannedPiece);
        }
コード例 #5
0
        public void Limit_Time()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "Time", "5" }, null);

            Assert.AreEqual(typeof(TimeLimit), sut.Limit.GetType());
            Assert.AreEqual("5 seconds", (sut.Limit as TimeLimit).GetDescription());
        }
コード例 #6
0
        private void LoadLevelStars(Dictionary <string, Level[]> levelDTO, Dictionary <string, Level_Info.Level[]> levels)
        {
            CheckForInitialisation();

            var events = eventReader.GetEvents();

            foreach (var chapter in levels)
            {
                var eventsForChapter = events.ContainsKey(chapter.Key) ? events[chapter.Key] : null;

                foreach (var level in chapter.Value)
                {
                    if (level == null)
                    {
                        continue;
                    }

                    var eventsForLevel = eventsForChapter?.FirstOrDefault(x => x.LevelNumber == level.LevelNumber);

                    var dto = levelDTO[chapter.Key].FirstOrDefault(x => x.LevelNumber == level.LevelNumber);

                    level.Star1Progress = LevelStarFactory.GetLevelStar(1, dto.Star1, eventsForLevel?.Star1);
                    level.Star2Progress = LevelStarFactory.GetLevelStar(2, dto.Star2, eventsForLevel?.Star2);
                    level.Star3Progress = LevelStarFactory.GetLevelStar(3, dto.Star3, eventsForLevel?.Star3);
                }
            }
        }
コード例 #7
0
        public void Events()
        {
            var testEvent = new LevelEvents.EventTrigger[] {
                new LevelEvents.EventTrigger()
                {
                    Trigger = "Turns", TriggerOn = "1-2", Events = new LevelEvents.Event[] { new LevelEvents.Event()
                                                                                             {
                                                                                                 EventType = "Destroy", NumberOfPiecesToSelect = 2
                                                                                             } }
                }
            };

            var sut = LevelStarFactory.GetLevelStar(2, null, testEvent);

            Assert.IsNotNull(sut.Events);
        }
コード例 #8
0
 public void Restriction_Bannned_InvalidFormat()
 {
     Assert.Throws <FormatException>(() => LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Banned", "Red" }, null));
 }
コード例 #9
0
 public void Restriction_Max_InvalidFormat()
 {
     Assert.Throws <FormatException>(() => LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Max", "Two" }, null));
 }
コード例 #10
0
        public void Limit_NoData()
        {
            var sut = LevelStarFactory.GetLevelStar(2, null, null);

            Assert.IsNull(sut.Limit);
        }
コード例 #11
0
        public void Limit_EmptyData()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "" }, null);

            Assert.IsNull(sut.Limit);
        }
コード例 #12
0
        public void Restriction_NoValues()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "" }, null);

            Assert.AreEqual(typeof(Assets.Scripts.Workers.Score_and_Limits.NoRestriction), sut.Restriction.GetType());
        }
コード例 #13
0
        public void Restriction_TurnTimeLimit()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Time", "6" }, null);

            Assert.AreEqual(typeof(TurnTimeLimit), sut.Restriction.GetType());
        }
コード例 #14
0
        public void CorrectStarNumber()
        {
            var sut = LevelStarFactory.GetLevelStar(2, null, null);

            Assert.AreEqual(2, sut.Number);
        }
コード例 #15
0
        public void Restriction_DiagonalOnly()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Diagonal Only", "" }, null);

            Assert.AreEqual(typeof(DiagonalOnlyRestriction), sut.Restriction.GetType());
        }
コード例 #16
0
        public void Restriction_BannedLocked()
        {
            var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Banned Locked", "" }, null);

            Assert.AreEqual(typeof(Assets.Scripts.Workers.Score_and_Limits.SwapEffectLimit), sut.Restriction.GetType());
        }