/// <summary> /// Insert CampaignLevel score through business logic /// </summary> private void InsertStudentScore() { StudentScoreBL studentScoreBL = new StudentScoreBL(); int result = studentScoreBL.InsertStudentScore(Global.StudentId, Global.WorldId, Global.SectionId, Global.LevelId, gamePlay.GetTimeLeft(), level.TimeLimit); int score = Global.CalculateScore(gamePlay.GetTimeLeft(), level.TimeLimit); int star = 0; switch (score) { case int ls when(ls >= 1 && ls <= 50): star = 1; break; case int ls when(ls >= 51 && ls <= 70): star = 2; break; case int ls when(ls >= 71 && ls <= 100): star = 3; break; } gamePlay.DisplayStars(star); //GetTree().ChangeScene("res://Presentation/World/World.tscn"); }
/// <summary> /// Initialization /// </summary> public override void _Ready() { //Intializing nodes sectionBL = new SectionBL(); studentScoreBL = new StudentScoreBL(); forwardBtn = GetNode <TextureButton>("ArrowNavigation/ForwardButton"); backWardBtn = GetNode <TextureButton>("ArrowNavigation/BackwardButton"); sectionLbl = GetNode <Label>("Title/SectionName"); level1 = GetNode <TextureButton>("Levels/Level1"); level2 = GetNode <TextureButton>("Levels/Level2"); level3 = GetNode <TextureButton>("Levels/Level3"); level4 = GetNode <TextureButton>("Levels/Level4"); level5 = GetNode <TextureButton>("Levels/Level5"); level6 = GetNode <TextureButton>("Levels/Level6"); bg = GetNode <Sprite>("Bg"); bgList = new List <string>(); bgList.Add("res://Assets/LevelUI/LvlMap03.png"); bgList.Add("res://Assets/LevelUI/LvlMap01.png"); bgList.Add("res://Assets/LevelUI/LvlMap02.png"); //On load set section id to 1 to display section 1 Global.SectionId = 1; sectionList = sectionBL.GetWorldSections(Global.WorldId); sectionLbl.Text = sectionList[count - 1].SectionName; //Star path string[] starArray = new string[3]; starArray[0] = "Level/1 stars.png"; starArray[1] = "Level/2 stars.png"; starArray[2] = "Level/3 stars.png"; //Disable forward n back btns if only have 1 level DisableBothButtons(); backWardBtn.Disabled = true; HideLevels(); DisplayLevelScore(); }
/// <summary> /// Initialization /// </summary> public override void _Ready() { studentBL = new StudentBL(); Student student = studentBL.GetStudentCharacter(Global.StudentId); Label lbl = GetNode <Label>("NameLbl"); lbl.Text = student.StudentName; AnimatedSprite character = GetNode <AnimatedSprite>("Character"); Label charName = GetNode <Label>("CharacterName"); Label charSkill = GetNode <Label>("CharacterSkill"); charName.Text = student.Character.CharName; charSkill.Text = student.Character.CharSkill; string spritePath = "res://CharSprites/"; string charPath = String.Format(spritePath + "{0}/", student.Character.CharName); List <string> animationList = new List <string>(); animationList.Add("Idle"); Global.LoadSprite(charPath, character, animationList); StudentScoreBL studentScoreBL = new StudentScoreBL(); Label avgScoreLbl = GetNode <Label>("AvgScoreLbl"); Label campaignLbl = GetNode <Label>("RankLbl"); if (studentScoreBL.GetCampaignRanking(Global.StudentId) != 0) { campaignLbl.Text = studentScoreBL.GetCampaignRanking(Global.StudentId).ToString(); } else { campaignLbl.Text = "-"; } if (studentScoreBL.GetAvgWorldScores(Global.StudentId) != null) { avgScoreLbl.Text = studentScoreBL.GetAvgWorldScores(Global.StudentId).LevelScore.ToString(); } }