/// <summary> /// 初始化记录页面 /// </summary> /// <param name="learnInfo">Learn info.</param> /// <param name="tabIndex">选项卡序号 【0:基本信息 1:错误单词】.</param> public void SetUpRecordView(LearningInfo learnInfo) { this.learnInfo = learnInfo; // 创建缓存池 wordPool = InstancePool.GetOrCreateInstancePool("WordItemPool", CommonData.poolContainerName); SetUpGeneralLearningInfo(); GetComponent <Canvas>().enabled = true; }
/// <summary> /// 初始化记录页面 /// </summary> /// <param name="learnInfo">Learn info.</param> /// <param name="tabIndex">选项卡序号 【0:基本信息 1:错误单词】.</param> public void SetUpRecordView(LearningInfo learnInfo, CallBackWithWord changeStatusCallBack, CallBackWithInt nextWordDetailClickCallBack, CallBackWithInt lastWordDetailClickCallBack) { this.learnInfo = learnInfo; learnedWordsCountOfCurrentType = learnInfo.learnedWordCount; wrongWordsCountOfCurrentType = learnInfo.ungraspedWordCount; this.changeWordStatusCallBack = changeStatusCallBack; SetUpGeneralLearningInfo(); wordDetail.InitWordRecordDetailHUD(nextWordDetailClickCallBack, lastWordDetailClickCallBack); GetComponent <Canvas>().enabled = true; }
// 构造函数 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"; } }
/// <summary> /// 初始化分享界面 /// </summary> public void SetUpShareView(ShareType shareType, CallBack shareSucceedCallBack, CallBack shareFailedCallBack, CallBack quitShareCallBack) { // 更新单词数据库,确保分享数据是正确的 if (ExploreManager.Instance != null) { ExploreManager.Instance.UpdateWordDataBase(); } // 初始化分享类型和分享回调 this.shareType = shareType; shareResult = ShareResult.Canceled; this.shareSucceedCallBack = shareSucceedCallBack; this.shareFailedCallBack = shareFailedCallBack; this.quitShareCallBack = quitShareCallBack; // 初始化UI // 计算学习天数 DateTime now = DateTime.Now; DateTime installDate = Convert.ToDateTime(GameManager.Instance.gameDataCenter.gameSettings.installDateString); TimeSpan timeSpan = now.Subtract(installDate); learnedDaysText.text = string.Format("<size=60>{0}</size> 天", timeSpan.Days + 1); LearningInfo learningInfo = LearningInfo.Instance; int learnedWordCountOfCurrentType = learningInfo.learnedWordCount; int wrongWordCountOfCurrentType = learningInfo.ungraspedWordCount; learnedWordCountText.text = string.Format("<size=60>{0}</size> 个", learnedWordCountOfCurrentType); int correctPercentageMultiply100 = learnedWordCountOfCurrentType == 0 ? 0 : (learnedWordCountOfCurrentType - wrongWordCountOfCurrentType) * 100 / learnedWordCountOfCurrentType; switch (shareType) { case ShareType.WeChat: shareTo.text = "分享到微信"; break; case ShareType.Weibo: shareTo.text = "分享到微博"; break; } shareButton.enabled = true; GetComponent <Canvas>().enabled = true; #if UNITY_IOS codeIcon.sprite = iosCodeSprite; downloadHintText.text = "前往AppStore\n进行下载"; #elif UNITY_ANDROID codeIcon.sprite = androidCodeSprite; downloadHintText.text = "前往TapTap\n进行下载"; #elif UNITY_EDITOR UnityEditor.BuildTarget buildTarget = UnityEditor.EditorUserBuildSettings.activeBuildTarget; switch (buildTarget) { case UnityEditor.BuildTarget.Android: codeIcon.sprite = androidCodeSprite; downloadHintText.text = "前往TapTap\n进行下载"; break; case UnityEditor.BuildTarget.iOS: codeIcon.sprite = iosCodeSprite; downloadHintText.text = "前往AppStore\n进行下载"; break; } #endif if (zoomCoroutine != null) { StopCoroutine(zoomCoroutine); } // zoomCoroutine = HUDZoomIn(); StartCoroutine(zoomCoroutine); }
public static LearnWord RandomWord() { LearningInfo learnInfo = LearningInfo.Instance; int wordId = 0; if (learnInfo.learnedWordCount != 0) { wordId = Random.Range(0, learnInfo.learnedWordCount); List <LearnWord> learnedWords = learnInfo.GetAllLearnedWords(); return(learnedWords [wordId]); } string tableName = string.Empty; WordType wt = GameManager.Instance.gameDataCenter.gameSettings.wordType; switch (wt) { case WordType.CET4: tableName = CommonData.CET4Table; break; case WordType.CET6: tableName = "CET6"; break; case WordType.Daily: tableName = "Daily"; break; case WordType.Bussiness: tableName = "Bussiness"; break; } MySQLiteHelper sql = MySQLiteHelper.Instance; // 连接数据库 sql.GetConnectionWith(CommonData.dataBaseName); int wordsCount = sql.GetItemCountOfTable(tableName, null, true); wordId = Random.Range(0, wordsCount); string[] conditions = new string[] { string.Format("wordId={0}", wordId) }; IDataReader reader = sql.ReadSpecificRowsOfTable(tableName, null, conditions, true); reader.Read(); string spell = reader.GetString(1); string explaination = reader.GetString(2); string phoneticSymbol = reader.GetString(3); string example = reader.GetString(4); int learnedTimes = reader.GetInt16(5); int ungraspTimes = reader.GetInt16(6); return(new LearnWord(wordId, spell, explaination, phoneticSymbol, example, learnedTimes, ungraspTimes)); }