public void SoomlaLevelUpInitTest() { LevelUpEvents.OnLevelUpInitialized += onLevelUpInitialized; Dictionary <string, object> evtLvlUpInitialized = new Dictionary <string, object> { { "handler", "onLevelUpInitialized" } }; EventQueue.Enqueue(evtLvlUpInitialized); World mainWorld = new World("main_world"); BadgeReward bronzeMedal = new BadgeReward("badge_bronzeMedal", "Bronze Medal"); BadgeReward silverMedal = new BadgeReward("badge_silverMedal", "Silver Medal"); BadgeReward goldMedal = new BadgeReward("badge_goldMedal", "Gold Medal"); VirtualItemReward perfectMedal = new VirtualItemReward("item_perfectMedal", "Perfect Medal", "perfect_medal", 1); SoomlaLevelUp.Initialize(mainWorld); //basic asserts Assert.AreEqual("main_world", SoomlaLevelUp.GetWorld("main_world").ID); Assert.AreEqual("badge_bronzeMedal", SoomlaLevelUp.GetReward("badge_bronzeMedal").ID); Assert.AreEqual("badge_silverMedal", SoomlaLevelUp.GetReward("badge_silverMedal").ID); Assert.AreEqual("main_world", SoomlaLevelUp.InitialWorld.ID); Assert.AreEqual(0, SoomlaLevelUp.GetLevelCount()); Assert.AreEqual(bronzeMedal, Reward.GetReward("badge_bronzeMedal")); Assert.AreEqual(silverMedal, Reward.GetReward("badge_silverMedal")); Assert.AreEqual(goldMedal, Reward.GetReward("badge_goldMedal")); Assert.AreEqual(perfectMedal, Reward.GetReward("item_perfectMedal")); }
public static void Play(World world) { World w1 = SoomlaLevelUp.GetWorld("machine_a"); SoomlaUtils.LogDebug(TAG, "Working with world: " + w1.ID); List <Level> levels = new List <Level> (); levels.Add((Level)w1.GetInnerWorldAt(0)); levels.Add((Level)w1.GetInnerWorldAt(1)); for (int i = 0; i < levels.Count; i++) { Level currentLevel = levels[i]; // Reward currentReward = new BadgeReward("badge_bronzeMedal_" + i, "Bronze Medal_" + i); // // string scoreId = "scoreId_" + i; // string recoreId = "record_gate_" + i; // RangeScore rangeScore = new RangeScore(scoreId, "RangeScore", true, new RangeScore.SRange(0, 100)); // RecordGate recordGate = new RecordGate(recoreId, scoreId, 100); // // currentLevel.AssignReward(currentReward); // currentLevel.Scores.Add(scoreId, rangeScore); currentLevel.Start(); Thread.Sleep(UnityEngine.Random.Range(2000, 3000) * i); currentLevel.SetSingleScoreValue(UnityEngine.Random.Range(20, 30)); // currentLevel.Pause(); currentLevel.End(true); } }