public void SetData(SkillData.RootObject data, int lv) { NameLabel.text = data.GetName(); LvLabel.text = "Lv." + lv; MPLabel.text = "MP:" + data.MP; CDLabel.text = "冷卻:" + data.CD; AddPowerLabel.text = "增加 Power:" + data.AddPower; NeedPowerLabel.text = "需要 Power:" + data.NeedPower; CommentLabel.text = data.GetComment(); if (data.ValueList.Count > 0) { if (data.Type == SkillData.TypeEnum.Attack) { DamageLabel.text = "傷害:" + data.ValueList[lv - 1]; } else { DamageLabel.text = "回復:" + data.ValueList[lv - 1]; } } else { DamageLabel.text = "傷害:" + 0; } if (data.Target == SkillData.TargetType.Us) { TargetLabel.text = "目標:我方"; } else if (data.Target == SkillData.TargetType.Them) { TargetLabel.text = "目標:敵方"; } else if (data.Target == SkillData.TargetType.All) { TargetLabel.text = "目標:全體"; } BattleStatusTitlle.gameObject.SetActive(true); for (int i = 0; i < BattleStatusComment.Length; i++) { if (data != null) { if (data.StatusID != 0) { BattleStatusData.RootObject statusData = BattleStatusData.GetData(data.StatusID); if ((int)statusData.ValueType <= 7) { BattleStatusComment[i].gameObject.SetActive(true); BattleStatusComment[i].text = statusData.GetComment(lv); } else { BattleStatusComment[i].gameObject.SetActive(false); } } else { BattleStatusComment[i].gameObject.SetActive(false); } if (data.SubID != 0) { data = SkillData.GetData(data.SubID); } else { data = null; } } else { BattleStatusComment[i].gameObject.SetActive(false); } } }
private void SetData(SkillData.RootObject data, int lv) { _data = data; NameLabel.text = data.GetName(); NameLabel.transform.parent.gameObject.SetActive(true); LvLabel.text = lv.ToString(); LvLabel.transform.parent.gameObject.SetActive(true); MPLabel.text = data.MP.ToString(); MPLabel.transform.parent.gameObject.SetActive(true); HitRateLabel.text = "命中:" + data.HitRate + "%"; CDLabel.text = "冷卻:" + data.CD; AddPowerLabel.text = "增加 Power:" + data.AddPower; NeedPowerLabel.text = "需要 Power:" + data.NeedPower; CommentLabel.text = data.GetComment(); if (data.ValueList.Count > 0) { if (data.Type == SkillData.TypeEnum.Attack) { DamageLabel.text = "傷害:" + data.ValueList[lv - 1]; } else { DamageLabel.text = "回復:" + data.ValueList[lv - 1]; } } else { DamageLabel.text = "傷害:" + 0; } if (data.Target == SkillData.TargetType.Us) { TargetLabel.text = "目標:我方"; } else if (data.Target == SkillData.TargetType.Them) { TargetLabel.text = "目標:敵方"; } else if (data.Target == SkillData.TargetType.All) { TargetLabel.text = "目標:全體"; } if (lv < data.MaxLv) { ItemAmountLabel.gameObject.SetActive(true); UpgradeButton.gameObject.SetActive(true); if (lv == 1) { _currentItemAmount = ItemManager.Instance.GetItemAmount(_bookId_1, _itemManagerType); NeedBookLabel.text = "初級技能書"; NeedBookIcon.overrideSprite = Resources.Load <Sprite>("Image/Item/Book_1"); _consumeBookId = _bookId_1; } else if (lv == 2) { _currentItemAmount = ItemManager.Instance.GetItemAmount(_bookId_2, _itemManagerType); NeedBookLabel.text = "中級技能書"; NeedBookIcon.overrideSprite = Resources.Load <Sprite>("Image/Item/Book_2"); _consumeBookId = _bookId_2; } else if (lv == 3) { _currentItemAmount = ItemManager.Instance.GetItemAmount(_bookId_3, _itemManagerType); NeedBookLabel.text = "高級技能書"; NeedBookIcon.overrideSprite = Resources.Load <Sprite>("Image/Item/Book_3"); _consumeBookId = _bookId_3; } if (_currentItemAmount < 1) { UpgradeButton.GetComponent <Image>().color = Color.gray; ItemAmountLabel.text = "<color=#FF0000>" + _currentItemAmount + "</color>/" + 1; } else { UpgradeButton.GetComponent <Image>().color = Color.white; ItemAmountLabel.text = _currentItemAmount + "/" + 1; } } else { ItemAmountLabel.gameObject.SetActive(false); UpgradeButton.gameObject.SetActive(false); } BattleStatusTitlle.gameObject.SetActive(true); for (int i = 0; i < BattleStatusComment.Length; i++) { BattleStatusComment[i].gameObject.SetActive(false); } for (int i = 0; i < BattleStatusComment.Length; i++) { if (data != null) { if (data.StatusID != 0) { BattleStatusData.RootObject statusData = BattleStatusData.GetData(data.StatusID); BattleStatusComment[i].gameObject.SetActive(true); BattleStatusComment[i].text = statusData.GetComment(lv); } else { i--; } if (data.SubID != 0) { data = SkillData.GetData(data.SubID); } else { data = null; } } else { break; } } }