public void Init(SkillItemLink skillItemLink, ESkillType skillType) { mSkillType = skillType; mSkillItemLink = skillItemLink; mLinkIndex = 0; InitSkillByIdx(mLinkIndex); mIsSkillBtnDown = false; Game.EventMgr.Subscribe(PlayerCtrlEvent.UpdateSkillCD.EventID, OnEventUpdateSkillCD); }
void InitSkill() { CurrSkillPage = 0; mSkillCollect = new List <List <SkillItemLink> >(); for (int i = 0, max = 2; i < max; ++i) { List <SkillItemLink> tmpSkillPage = new List <SkillItemLink>(); mSkillCollect.Add(tmpSkillPage); for (int j = 0, jmax = 6; j < jmax; ++j) { SkillItemLink tmpSkillLink = new SkillItemLink(); tmpSkillPage.Add(tmpSkillLink); string tmpStr = PlayerPrefs.GetString($"Skill{i}_{j}"); if (!string.IsNullOrEmpty(tmpStr)) { string[] tmpStrs = tmpStr.Split('-'); for (int k = 0, kmax = tmpStrs.Length; k < kmax; ++k) { int tmpSkillID = 0; if (int.TryParse(tmpStrs[k], out tmpSkillID)) { SkillItem tmpSkillItem = new SkillItem(); tmpSkillItem.Init(tmpSkillID, 1); tmpSkillLink.SkillItems.Add(tmpSkillItem); } } } } } mExSkillLink = new SkillItemLink(); UnitExtraBase tmpUnitExtraBase = UnitExtraBaseManager.instance.Find(UnitID); if (null != tmpUnitExtraBase) { SkillItem tmpSkillItem = new SkillItem(); tmpSkillItem.Init(tmpUnitExtraBase.SkillEx, 1); mExSkillLink.SkillItems.Add(tmpSkillItem); } }