int GetUnlockLevel() { int currLevel = m_SkillGridData.rideData.level; table.RideSkillData currskilldata = GameTableManager.Instance.GetTableItem <table.RideSkillData>(m_SkillGridData.rideData.baseid, currLevel); while (currskilldata != null) { if (currskilldata.skillArray.Contains(m_SkillGridData.skill)) { break; } currLevel++; currskilldata = GameTableManager.Instance.GetTableItem <table.RideSkillData>(m_SkillGridData.rideData.baseid, currLevel); } return(currLevel); }
private void SetSkillState() { if (m_SkillGridData.rideData.skill_ids.Contains((int)m_SkillGridData.skill)) { Unlock = true; UnLearn = false; m_goLock.SetActive(false); m_spriteIcon.color = new Color(m_spriteIcon.color.r, m_spriteIcon.color.g, m_spriteIcon.color.b, 1f); m_goUnLearn.SetActive(false); return; } table.RideSkillData currskilldata = GameTableManager.Instance.GetTableItem <table.RideSkillData>(m_SkillGridData.rideData.baseid, m_SkillGridData.rideData.level); if (currskilldata != null) { bool bcanOpen = currskilldata.skillArray.Contains(m_SkillGridData.skill); if (bcanOpen) { m_spriteIcon.color = new Color(m_spriteIcon.color.r, m_spriteIcon.color.g, m_spriteIcon.color.b, 1f); UnLearn = true; m_goLock.SetActive(false); m_goUnLearn.SetActive(true); int preSkillId = 0; foreach (var item in currskilldata.skillArray) { if (item == m_SkillGridData.skill) { if (preSkillId != 0 && !m_SkillGridData.rideData.skill_ids.Contains(preSkillId)) { Unlock = false; m_goUnLearn.GetComponentInChildren <UILabel>().text = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Ride_Skill_weijiesuo); return; } } else { preSkillId = (int)item; } } Unlock = true; m_goUnLearn.GetComponentInChildren <UILabel>().text = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Ride_Skill_weilingwu);; return; } int m_openSkillLevel = GetUnlockLevel(); UnLearn = false; Unlock = false; m_goLock.SetActive(true); m_spriteIcon.color = new Color(m_spriteIcon.color.r, m_spriteIcon.color.g, m_spriteIcon.color.b, 51 / 255.0f); m_goUnLearn.SetActive(false); m_goLock.GetComponentInChildren <UILabel>().text = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Ride_Skill_dengjijiesuo, m_openSkillLevel); } else { UnLearn = false; Unlock = false; m_goLock.SetActive(true); m_spriteIcon.color = new Color(m_spriteIcon.color.r, m_spriteIcon.color.g, m_spriteIcon.color.b, 51 / 255.0f); m_goUnLearn.SetActive(false); if (m_lableUnlockLevel != null) { int currLevel = m_SkillGridData.rideData.level; if (currLevel == 0) { currLevel++; currskilldata = GameTableManager.Instance.GetTableItem <table.RideSkillData>(m_SkillGridData.rideData.baseid, currLevel); } while (currskilldata != null) { if (currskilldata.skillArray.Contains(m_SkillGridData.skill)) { m_lableUnlockLevel.text = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Ride_Skill_dengjijiesuo, currLevel); break; } currLevel++; currskilldata = GameTableManager.Instance.GetTableItem <table.RideSkillData>(m_SkillGridData.rideData.baseid, currLevel); } } } }