/// <summary> /// 刷新所有技能展示界面; /// 默认选中技能处改变,从而技能说明处改变; /// </summary> /// <param name="ev">Ev.</param> public void PageShowSkill(EventBase ev) { if (skillSB == null) { #if UNITY_EDITOR Debug.LogError("Scrollbar not found"); #endif return; } //几个技能评分scrollView 1.0f; int der = MySkillModule.GetAllSkillsNum() - mMaxShowSkillNum; float ratio = 1.0f / der; skillSB.value = (CurPageNum - 1) * mMaxShowSkillNum * ratio; foreach (EventDelegate ed in skillSB.onChange) { if (ed != null && ed.isValid) { ed.Execute(); } } //当前显示页数之前技能和之后技能不显示; //当前是第2页,第一页*每页6个(skillsList索引0-5是隐藏的,6-11是显示的,12到最后一个技能是隐藏的) }
/// <summary> /// 读档创建所有技能列表; /// </summary> void InitSkills() { int i = 0, j = 0; for (j = MySkillModule.GetAllSkillsNum(); i < j; i++) { CreateSkill(i + 1); } int num = j % 6 == 0 ? j / 6 : j / 6 + 1; int total = num * 6; for (; j < num * 6; j++) { CreateNullSkill(j + 1); } UIGrid grid = skillRoot.GetComponent <UIGrid>(); if (grid != null) { grid.repositionNow = true; } }