| | |
| | |
|
| | | public class TalentWin : Window
|
| | | {
|
| | | [SerializeField] TalentButtonBehaviour m_TalentAtkBehaviour;
|
| | | [SerializeField] TalentButtonBehaviour m_TalentDefBehaviour;
|
| | | [SerializeField] TalentButtonBehaviour m_TalentGeneralBehaviour;
|
| | |
|
| | | [SerializeField] TalentSkillScriptableObject m_TalentAtkConfig;
|
| | | [SerializeField] TalentSkillScriptableObject m_TalentDefConfig;
|
| | | [SerializeField] TalentSkillScriptableObject m_TalentGeneralConfig;
|
| | | [SerializeField] TalentButtonBehaviour[] m_TalentButtons;
|
| | | [SerializeField] TalentTreeBehaviour[] m_TalentTrees;
|
| | |
|
| | | [SerializeField] RectTransform m_ContainerSelect;
|
| | |
|
| | |
| | | [SerializeField] Text m_TalentSeries;
|
| | |
|
| | | [SerializeField] ScrollRect m_SkillScroller;
|
| | | [SerializeField] RectTransform m_SkillContent;
|
| | | [SerializeField] TalentSkillBehaviour[] m_SkillBehaviours;
|
| | | [SerializeField] Image[] m_Arrows;
|
| | |
|
| | | [SerializeField] RectTransform m_ContainerSelectSkill;
|
| | | [SerializeField] Image m_SelectSkillIcon;
|
| | |
| | | model.OnSelectSkillEvent -= OnSelectSkillEvent;
|
| | | model.talentSkillUpdate -= TalentSkillUpdate;
|
| | | model.talentPointUpdate -= TalentPointUpdate;
|
| | | m_TalentAtkBehaviour.Dispose();
|
| | | m_TalentDefBehaviour.Dispose();
|
| | | m_TalentGeneralBehaviour.Dispose();
|
| | | for (int i = 0; i < m_TalentButtons.Length; i++)
|
| | | {
|
| | | m_TalentButtons[i].Dispose();
|
| | | }
|
| | |
|
| | | for (int i = 0; i < m_SkillBehaviours.Length; i++)
|
| | | {
|
| | |
| | |
|
| | | void Display()
|
| | | {
|
| | | m_TalentAtkBehaviour.Display(model.selectSeries, 1);
|
| | | m_TalentDefBehaviour.Display(model.selectSeries, 2);
|
| | | m_TalentGeneralBehaviour.Display(model.selectSeries, 3);
|
| | | for (int i = 0; i < m_TalentButtons.Length; i++)
|
| | | {
|
| | | m_TalentButtons[i].Display(model.selectSeries);
|
| | | }
|
| | |
|
| | | DisplaySkills();
|
| | | DisplaySeries();
|
| | |
| | |
|
| | | void DisplaySkills()
|
| | | {
|
| | | var job = PlayerDatas.Instance.baseData.Job;
|
| | | List<int> talentSkills;
|
| | | model.TryGetTalents(job, model.selectSeries, model.selectTalentType, out talentSkills);
|
| | | var config = model.selectTalentType == 1 ? m_TalentAtkConfig : model.selectTalentType == 2 ?
|
| | | m_TalentDefConfig : m_TalentGeneralConfig;
|
| | | m_SkillScroller.verticalNormalizedPosition = 1;
|
| | | m_SkillContent.sizeDelta = m_SkillContent.sizeDelta.SetY(config == null ? 0 : config.contentHeight);
|
| | | for (int i = 0; i < m_SkillBehaviours.Length; i++)
|
| | | {
|
| | | if (talentSkills != null && i < talentSkills.Count)
|
| | | {
|
| | | m_SkillBehaviours[i].gameObject.SetActive(true);
|
| | | var position = config == null ? Vector3.zero : config.GetSkillPosition(i);
|
| | | m_SkillBehaviours[i].transform.localPosition = position;
|
| | | m_SkillBehaviours[i].Display(talentSkills[i]);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_SkillBehaviours[i].Dispose();
|
| | | m_SkillBehaviours[i].gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | model.selectSkill = talentSkills != null ? talentSkills[0] : 0;
|
| | | //var job = PlayerDatas.Instance.baseData.Job;
|
| | | //List<int> talentSkills;
|
| | | //model.TryGetTalents(job, model.selectSeries, model.selectTalentType, out talentSkills);
|
| | | //var config = model.selectTalentType == 1 ? m_TalentAtkConfig : model.selectTalentType == 2 ?
|
| | | // m_TalentDefConfig : m_TalentGeneralConfig;
|
| | | //m_SkillScroller.verticalNormalizedPosition = 1;
|
| | | //for (int i = 0; i < m_SkillBehaviours.Length; i++)
|
| | | //{
|
| | | // if (talentSkills != null && i < talentSkills.Count)
|
| | | // {
|
| | | // m_SkillBehaviours[i].gameObject.SetActive(true);
|
| | | // var position = config == null ? Vector3.zero : config.GetSkillPosition(i);
|
| | | // m_SkillBehaviours[i].transform.localPosition = position;
|
| | | // m_SkillBehaviours[i].Display(talentSkills[i]);
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // m_SkillBehaviours[i].Dispose();
|
| | | // m_SkillBehaviours[i].gameObject.SetActive(false);
|
| | | // }
|
| | | //}
|
| | | //
|
| | | //model.selectSkill = talentSkills != null ? talentSkills[0] : 0;
|
| | | }
|
| | |
|
| | | void DisplaySeries()
|
| | |
| | | var index = 0;
|
| | | if (model.TryGetTalent(model.selectSkill, out talent))
|
| | | {
|
| | | var talentConfig = ConfigManager.Instance.GetTemplate<TalentConfig>(talent.skillId + talent.level);
|
| | | var skillConfig = ConfigManager.Instance.GetTemplate<SkillConfig>(talent.skillId + talent.level);
|
| | | var talentConfig = Config.Instance.Get<TalentConfig>(talent.skillId + talent.level);
|
| | | var skillConfig = Config.Instance.Get<SkillConfig>(talent.skillId + talent.level);
|
| | | if (talentConfig != null)
|
| | | {
|
| | | if (talentConfig.property != 0 && index < m_SelectConditions.Length)
|
| | | {
|
| | | var propertyConfig = ConfigManager.Instance.GetTemplate<PlayerPropertyConfig>(talentConfig.property);
|
| | | var propertyConfig = Config.Instance.Get<PlayerPropertyConfig>(talentConfig.property);
|
| | | m_SelectConditions[index].gameObject.SetActive(true);
|
| | | m_SelectConditions[index].text = StringUtility.Contact(
|
| | | string.Format("需要{0}点:", propertyConfig.Name),
|
| | |
| | | TalentSkill learnTalent;
|
| | | if (skillConfig.LearnSkillReq != 0 && model.TryGetTalent(skillConfig.LearnSkillReq, out learnTalent))
|
| | | {
|
| | | var learnSkillConfig = ConfigManager.Instance.GetTemplate<SkillConfig>(skillConfig.LearnSkillReq);
|
| | | var learnSkillConfig = Config.Instance.Get<SkillConfig>(skillConfig.LearnSkillReq);
|
| | | m_SelectConditions[index].gameObject.SetActive(true);
|
| | | m_SelectConditions[index].text = StringUtility.Contact(
|
| | | "前置天赋: ", learnSkillConfig.SkillName, " ",
|
| | |
| | | if (model.TryGetTalent(model.selectSkill, out talent))
|
| | | {
|
| | | m_ContainerSelectSkill.gameObject.SetActive(true);
|
| | | var config = ConfigManager.Instance.GetTemplate<SkillConfig>(talent.skillId + talent.level);
|
| | | var config = Config.Instance.Get<SkillConfig>(talent.skillId + talent.level);
|
| | | m_SelectSkillIcon.SetSprite(config.IconName);
|
| | | m_SelectSkillLevel.text = StringUtility.Contact(talent.level, "/", talent.max);
|
| | | m_SelectSkillName.text = config.SkillName;
|
| | |
| | | TalentSkill talent;
|
| | | if (model.TryGetTalent(model.selectSkill, out talent))
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<SkillConfig>(talent.skillId + talent.level);
|
| | | var config = Config.Instance.Get<SkillConfig>(talent.skillId + talent.level);
|
| | | m_SelectSkillEffect.text = config.Description;
|
| | | m_ContainerNextEffect.gameObject.SetActive(talent.level < talent.max);
|
| | | if (talent.level < talent.max)
|
| | | {
|
| | | var nextConfig = ConfigManager.Instance.GetTemplate<SkillConfig>(talent.skillId + talent.level + 1);
|
| | | var nextConfig = Config.Instance.Get<SkillConfig>(talent.skillId + talent.level + 1);
|
| | | m_SelectNextEffect.text = nextConfig.Description;
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | #if UNITY_EDITOR
|
| | | [SerializeField] TalentSkillScriptableObject viewConfig;
|
| | | [ContextMenu("预览配置")]
|
| | | void ViewPositionConfig()
|
| | | {
|
| | | if (viewConfig == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | for (int i = 0; i < m_SkillBehaviours.Length; i++)
|
| | | {
|
| | | m_SkillBehaviours[i].transform.localPosition = viewConfig.GetSkillPosition(i);
|
| | | }
|
| | | }
|
| | | #endif
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|