public void PlayAISkill(int skillID) { SkillItem tmpSkillItem = null; for (int i = 0, max = mSkillItems.Count; i < max; ++i) { if (mSkillItems[i].ID == skillID) { tmpSkillItem = mSkillItems[i]; break; } } if (null == tmpSkillItem && 0 != skillID) { if (SkillBaseManager.instance.Find(skillID) != null) { tmpSkillItem = new SkillItem(); tmpSkillItem.Init(skillID, 1); mSkillItems.Add(tmpSkillItem); } } ActStatus.SkillItem = tmpSkillItem; }
private void InitSkillByIdx(int index) { mCurrSkillItem = index >= mSkillItemLink.SkillItems.Count ? null : mSkillItemLink.SkillItems[index]; if (null != mCurrSkillItem) { mIsInit = true; mCurrSkillItem.SkillInput = this; mCD = Game.ControllerMgr.Get <PlayerController>().GetSkillCD(mCurrSkillItem.ID); mCDImg.fillAmount = Mathf.Max(1f - mCD * 1000f / mCurrSkillItem.SkillAttrBase.CD, 0f); mIconLoader.Load(ImageLoader.EIconType.Skill, mCurrSkillItem.SkillBase.Icon, mIconImg, null, false); mLocalPlayerCache = Game.ControllerMgr.Get <UnitController>().LocalPlayer; mSkillActions = mCurrSkillItem.SkillBase.Action.Split(','); mSkillActionCaches.Clear(); for (int i = 0, max = mSkillActions.Length; i < max; ++i) { mSkillActionCaches.Add(mLocalPlayerCache.ActStatus.ActionGroup.GetActionIdx(mSkillActions[i])); } mIsSkillReady = false; } else { Reset(); } }
public void Reset() { mCDImg.fillAmount = 0f; Utility.GameObj.SetActive(mIconImg, false); mIconImg.sprite = null; if (null != mCurrSkillItem) { mCurrSkillItem.SkillInput = null; } mCurrSkillItem = null; mIsInit = false; Game.EventMgr.Unsubscribe(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); } }