| | |
| | | [SerializeField] Image m_SkillIcon;
|
| | | [SerializeField] Text m_SkillName;
|
| | | [SerializeField] Text m_Reiki;
|
| | | [SerializeField] ScrollerController m_Controller;
|
| | | [SerializeField] Text m_ReikiPoint;
|
| | | [SerializeField] ExpertSkillCyclicScroll m_CyclicScroll;
|
| | | [SerializeField] LayoutElement m_LayoutElement;
|
| | | [SerializeField] Button m_Active;
|
| | | [SerializeField] Button m_Select;
|
| | | [SerializeField] Button m_Close1;
|
| | | [SerializeField] Button m_Close2;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | int selectActiveLevel = 0;
|
| | |
|
| | | List<int> datas = new List<int>();
|
| | |
|
| | | TreasureSkillModel model { get { return ModelCenter.Instance.GetModel<TreasureSkillModel>(); } }
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | |
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | m_Controller.OnRefreshCell += OnRefreshCell;
|
| | | //m_Controller.OnRefreshCell += OnRefreshCell;
|
| | | m_Select.AddListener(OnSelect);
|
| | | m_Close1.AddListener(CloseClick);
|
| | | m_Close2.AddListener(CloseClick);
|
| | | m_Active.AddListener(OnActiveSkill);
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | |
| | |
|
| | | m_OpenDetail = false;
|
| | |
|
| | | m_CyclicScroll.enabled = false;
|
| | |
|
| | | Display();
|
| | |
|
| | | model.expertActiveRefresh += ExpertActiveRefresh;
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | m_CyclicScroll.Dispose();
|
| | |
|
| | | StopAllCoroutines();
|
| | |
|
| | | model.expertActiveRefresh -= ExpertActiveRefresh;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | |
| | | void SetDefaultSelect()
|
| | | {
|
| | | m_SelectExpert = 0;
|
| | | //model.TryGetExpertSkill(selectSkillId, out m_SelectExpert);
|
| | | }
|
| | |
|
| | | void DisplayExperts()
|
| | |
| | | {
|
| | | if (selectExpert != 0)
|
| | | {
|
| | | var level = 0;
|
| | | TreasurePotential expert;
|
| | | if (model.TryGetPotential(selectExpert, out expert))
|
| | | {
|
| | | level = expert.level;
|
| | | }
|
| | | selectActiveLevel = 0;
|
| | | model.TryGetExpertActiveLevel(selectExpert, out selectActiveLevel);
|
| | |
|
| | | m_Select.gameObject.SetActive(PlayerDatas.Instance.baseData.LV >= expert.limitLevel);
|
| | | DisplayButtonState();
|
| | |
|
| | | SkillConfig skillConfig;
|
| | | if (level == 0)
|
| | | {
|
| | | skillConfig = SkillConfig.Get(selectExpert);
|
| | | }
|
| | | else
|
| | | {
|
| | | skillConfig = SkillConfig.Get(selectExpert + level - 1);
|
| | | }
|
| | | var skillConfig = SkillConfig.Get(selectExpert);
|
| | |
|
| | | m_SkillIcon.SetSprite(skillConfig.IconName);
|
| | | m_SkillName.text = skillConfig.SkillName;
|
| | |
| | | m_Reiki.text = propertyConfig.Name;
|
| | | m_Reiki.color = UIHelper.GetPropertyColor(property);
|
| | |
|
| | | m_Controller.Refresh();
|
| | | m_ReikiPoint.text = string.Format("我的{0}灵根:{1}",
|
| | | propertyConfig.Name, UIHelper.GetPropertyValue((PropertyType)property));
|
| | |
|
| | | datas.Clear();
|
| | | for (int i = 1; i <= skillConfig.SkillMaxLV; i++)
|
| | | {
|
| | | m_Controller.AddCell(ScrollerDataType.Header, i);
|
| | | if (i >= selectActiveLevel)
|
| | | {
|
| | | datas.Add(selectExpert * 100 + i);
|
| | | }
|
| | | }
|
| | | m_Controller.Restart();
|
| | |
|
| | | //m_LayoutElement.preferredHeight = datas.Count > 2 ? 440 : 302;
|
| | |
|
| | | m_CyclicScroll.enabled = true;
|
| | |
|
| | | m_CyclicScroll.Dispose();
|
| | | m_CyclicScroll.Init(datas);
|
| | | StartCoroutine(Co_Arrange());
|
| | | }
|
| | | }
|
| | |
|
| | | IEnumerator Co_Arrange()
|
| | | {
|
| | | yield return null;
|
| | | m_CyclicScroll.ReArrange();
|
| | | }
|
| | |
|
| | | void DisplayButtonState()
|
| | | {
|
| | | TreasurePotential expert;
|
| | | if (model.TryGetPotential(selectExpert, out expert))
|
| | | {
|
| | | var satisfyActive = model.SatisfyActiveExpert(selectExpert);
|
| | | var activeLevel = 0;
|
| | | model.TryGetExpertActiveLevel(selectExpert, out activeLevel);
|
| | | m_Select.gameObject.SetActive(activeLevel > 0 && !satisfyActive);
|
| | | m_Active.gameObject.SetActive(satisfyActive);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | CloseImmediately();
|
| | | }
|
| | |
|
| | | private void OnActiveSkill()
|
| | | {
|
| | | if (m_CyclicScroll.IsPlaying)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var pak = new CA516_tagCMSelectSkillElement();
|
| | | pak.SkillTypeID = (uint)selectExpert;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | |
|
| | | private void OnSelect(int skillId)
|
| | | {
|
| | | if (m_CyclicScroll.IsPlaying)
|
| | | {
|
| | | return;
|
| | | }
|
| | | selectExpert = skillId;
|
| | | }
|
| | |
|
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell)
|
| | | private void ExpertActiveRefresh(int id)
|
| | | {
|
| | | var expertCell = cell as ExpertSkillConditionCell;
|
| | | expertCell.Display(selectExpert, cell.index);
|
| | | if (selectExpert == id)
|
| | | {
|
| | | var level = 0;
|
| | | if (model.TryGetExpertActiveLevel(selectExpert, out level))
|
| | | {
|
| | | if (level > selectActiveLevel && level > 1)
|
| | | {
|
| | | m_CyclicScroll.DisplayAnimation(()=> |
| | | {
|
| | | DisplayDetail();
|
| | | });
|
| | | }
|
| | | }
|
| | | DisplayButtonState();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | [SerializeField] Transform m_ContainerSelect;
|
| | | [SerializeField] Text m_Use;
|
| | | [SerializeField] Text m_Limit;
|
| | | [SerializeField] RedpointBehaviour m_Redpoint;
|
| | | [SerializeField] Button m_Select;
|
| | |
|
| | | public int skillId { get; private set; }
|
| | |
| | | m_Icon.gray = !unlock;
|
| | | m_ReikiBottom.gray = !unlock;
|
| | |
|
| | | m_Redpoint.redpointId = expert.activeRedpoint.id;
|
| | |
|
| | | m_Select.SetListener(() =>
|
| | | {
|
| | | if (func != null)
|