/// <summary> /// 初始化通关记录详细页面 /// </summary> /// <param name="playRecord">Play record.</param> public void SetUpPlayRecordDetailHUD(PlayRecord playRecord) { //if(playRecord.finishGame){ exploreEndAt.text = "获得艾尔文的宝藏"; //}else{ // exploreEndAt.text = string.Format("失败于: {0}", playRecord.dieFrom); //} exploreMaxLevelText.text = string.Format("最大探索层数: {0}", playRecord.maxExploreLevel); totalExploreTimeText.text = string.Format("探索时间: {0}天", playRecord.totalExploreDays); totalLearnedWordCountText.text = string.Format("学习单词总数: {0}", playRecord.totalLearnedWordCount); correctPercentageText.text = string.Format("总正确率: {0}%", playRecord.learnCorrectPercentageX100); totalDefeatMonsterCount.text = string.Format("总计击败怪物: {0}", playRecord.totalDefeatMonsterCount); evaluateStringText.text = string.Format("综合评分: <color=orange>{0}</color>", playRecord.evaluateString); maxHealtRecordText.text = playRecord.maxHealth.ToString(); maxManaRecordText.text = playRecord.maxMana.ToString(); attackRecordText.text = playRecord.attack.ToString(); magicAttackRecordText.text = playRecord.magicAttack.ToString(); armorRecordText.text = playRecord.armor.ToString(); magicResistRecordText.text = playRecord.magicResist.ToString(); armorDecreaseRecordText.text = playRecord.armorDecrease.ToString(); magicResistDecreaseRecordText.text = playRecord.magicResistDecrease.ToString(); dodgeRecordText.text = string.Format("{0}%", (playRecord.dodge * 100).ToString("0.0")); critRecordText.text = string.Format("{0}%", (playRecord.crit * 100).ToString("0.0")); extraGoldRecordText.text = playRecord.extraGold.ToString(); extraExperienceRecordText.text = playRecord.extraExperience.ToString(); healthRecoveryRecordText.text = playRecord.healthRecovery.ToString(); magicRecoveryRecordText.text = playRecord.magicRecovery.ToString(); int equipmentCellIndex = 0; // 重置所有装备槽 for (int i = 0; i < equipmentCells.Length; i++) { EquipmentCellInRecord cellInRecord = equipmentCells[i]; cellInRecord.Reset(); } // 根据通关时的装备创建装备槽 if (playRecord.equipedEquipments != null) { for (int i = 0; i < playRecord.equipedEquipments.Count; i++) { Equipment equipment = playRecord.equipedEquipments[i]; if (equipment.itemId < 0) { continue; } EquipmentCellInRecord cellInRecord = equipmentCells[equipmentCellIndex]; // 初始化装备槽 cellInRecord.SetUpEquipmentCellInRecord(equipment); equipmentCellIndex++; } } // 重置所有的技能槽 for (int i = 0; i < skillCells.Length; i++) { SkillCellInRecord cellInRecord = skillCells[i]; cellInRecord.Reset(); } // 根据通关时的技能创建技能槽 if (playRecord.learnedSkillRecords != null) { for (int i = 0; i < playRecord.learnedSkillRecords.Count; i++) { SkillModel skillModel = playRecord.learnedSkillRecords[i]; int skillLevel = skillModel.skillLevel; Skill skill = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj) { return(obj.skillId == skillModel.skillId); }); if (skill == null) { continue; } SkillCellInRecord cellInRecord = skillCells[i]; // 初始化技能槽 cellInRecord.SetUpSkillCellInRecord(skill, skillLevel); } } this.gameObject.SetActive(true); if (zoomCoroutine != null) { StopCoroutine(zoomCoroutine); } zoomCoroutine = HUDZoomIn(); StartCoroutine(zoomCoroutine); }
// 构造函数 public PlayRecord() { Debug.Log("generate play record"); Player player = Player.mainPlayer; player.ResetBattleAgentProperties(false); this.maxExploreLevel = player.maxUnlockLevelIndex + 1 > 50 ? 50 : Player.mainPlayer.maxUnlockLevelIndex + 1; DateTime now = DateTime.Now; DateTime installDate = Convert.ToDateTime(player.currentExploreStartDateString); TimeSpan timeSpan = now.Subtract(installDate); this.totalExploreDays = timeSpan.Days + 1; LearningInfo learningInfo = LearningInfo.Instance; int learnedWordCountOfCurrentType = player.learnedWordsCountInCurrentExplore; int correctWordCountOfCurrentType = player.correctWordsCountInCurrentExplore; this.totalDefeatMonsterCount = player.totaldefeatMonsterCount; this.totalLearnedWordCount = learnedWordCountOfCurrentType; this.learnCorrectPercentageX100 = learnedWordCountOfCurrentType == 0 ? 0 : correctWordCountOfCurrentType * 100 / learnedWordCountOfCurrentType; this.maxHealth = player.maxHealth; this.maxMana = player.maxMana; this.attack = player.attack; this.magicAttack = player.magicAttack; this.armor = player.armor; this.magicResist = player.magicResist; this.armorDecrease = player.armorDecrease; this.magicResistDecrease = player.magicResistDecrease; this.dodge = player.dodge; this.crit = player.crit; this.extraGold = player.extraGold; this.extraExperience = player.extraExperience; this.healthRecovery = player.healthRecovery; this.magicRecovery = player.magicRecovery; for (int i = 0; i < player.allEquipedEquipments.Length; i++) { Equipment equipment = player.allEquipedEquipments[i]; if (equipment.itemId < 0) { continue; } this.equipedEquipments.Add(equipment); } for (int i = 0; i < player.allLearnedSkillsRecord.Count; i++) { SkillModel learnedSkill = player.allLearnedSkillsRecord[i]; if (learnedSkill.skillId <= 0) { continue; } this.learnedSkillRecords.Add(learnedSkill); } // 计算评分 this.evaluatePoint = (int)(totalDefeatMonsterCount * 0.3f) + totalLearnedWordCount * learnCorrectPercentageX100 * learnCorrectPercentageX100 / 10000; if (evaluatePoint < 100) { evaluateString = "F"; } else if (evaluatePoint >= 100 && evaluatePoint < 300) { evaluateString = "E"; } else if (evaluatePoint >= 300 && evaluatePoint < 550) { evaluateString = "D"; } else if (evaluatePoint >= 550 && evaluatePoint < 850) { evaluateString = "C"; } else if (evaluatePoint >= 850 && evaluatePoint < 1250) { evaluateString = "B"; } else if (evaluatePoint >= 1250 && evaluatePoint < 1700) { evaluateString = "A"; } else if (evaluatePoint >= 1700 && evaluatePoint < 2200) { evaluateString = "S"; } else if (evaluatePoint >= 2200 && evaluatePoint < 2750) { evaluateString = "SS"; } else if (evaluatePoint >= 2750) { evaluateString = "SSS"; } }