From f9f2711f44e45021b4d69ca701bd25704578eef4 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 25 十一月 2025 17:20:34 +0800
Subject: [PATCH] 121 【武将】武将系统 - 同步武将升级增加固定属性
---
Main/System/Hero/HeroInfo.cs | 28 +++++++++++++
Main/System/HeroUI/HeroTrainAddAttrCell.cs | 13 +++++-
Main/System/Main/FightPowerManager.cs | 2 +
Main/Config/Configs/HeroQualityLVConfig.cs | 32 +++++++++++++++
Main/System/HeroUI/HeroTrainWin.cs | 16 +++++++
5 files changed, 86 insertions(+), 5 deletions(-)
diff --git a/Main/Config/Configs/HeroQualityLVConfig.cs b/Main/Config/Configs/HeroQualityLVConfig.cs
index dada278..ede60aa 100644
--- a/Main/Config/Configs/HeroQualityLVConfig.cs
+++ b/Main/Config/Configs/HeroQualityLVConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: 2025骞�8鏈�5鏃�
+// [ Date ]: Tuesday, November 25, 2025
//--------------------------------------------------------
using System.Collections.Generic;
@@ -20,6 +20,8 @@
public int Quality;
public int HeroLV;
public int[] UPCostItem;
+ public int[] AttrIDList;
+ public int[] AttrValueList;
public override int LoadKey(string _key)
{
@@ -50,6 +52,34 @@
int.TryParse(UPCostItemStringArray[i],out UPCostItem[i]);
}
}
+
+ if (tables[4].Contains("["))
+ {
+ AttrIDList = JsonMapper.ToObject<int[]>(tables[4]);
+ }
+ else
+ {
+ string[] AttrIDListStringArray = tables[4].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ AttrIDList = new int[AttrIDListStringArray.Length];
+ for (int i=0;i<AttrIDListStringArray.Length;i++)
+ {
+ int.TryParse(AttrIDListStringArray[i],out AttrIDList[i]);
+ }
+ }
+
+ if (tables[5].Contains("["))
+ {
+ AttrValueList = JsonMapper.ToObject<int[]>(tables[5]);
+ }
+ else
+ {
+ string[] AttrValueListStringArray = tables[5].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ AttrValueList = new int[AttrValueListStringArray.Length];
+ for (int i=0;i<AttrValueListStringArray.Length;i++)
+ {
+ int.TryParse(AttrValueListStringArray[i],out AttrValueList[i]);
+ }
+ }
}
catch (Exception exception)
{
diff --git a/Main/System/Hero/HeroInfo.cs b/Main/System/Hero/HeroInfo.cs
index e0b9657..0fedafc 100644
--- a/Main/System/Hero/HeroInfo.cs
+++ b/Main/System/Hero/HeroInfo.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using LitJson;
+using System;
// 姝﹀皢淇℃伅锛氬疄闄呰幏寰楃殑姝﹀皢锛屼笉鍖呭惈鍥鹃壌鏁版嵁
public partial class HeroInfo
@@ -159,7 +160,7 @@
}
return fightPower;
}
-
+
public void ChangeLockState()
{
@@ -169,4 +170,29 @@
GameNetSystem.Instance.SendInfo(pack);
}
+
+
+ public int GetHeroLVValue(int attrType)
+ {
+ var lvConfig = HeroQualityLVConfig.GetQualityLVConfig(Quality, heroLevel);
+ var index = Array.IndexOf(lvConfig.AttrIDList, attrType);
+ if (index == -1)
+ return 0;
+ return lvConfig.AttrValueList[index];
+ }
+
+ public int GetHeroLVPer(int attrType)
+ {
+ var _type = 0;
+ if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrType))
+ {
+ _type = PlayerPropertyConfig.baseAttr2perDict[attrType];
+ }
+
+ var lvConfig = HeroQualityLVConfig.GetQualityLVConfig(Quality, heroLevel);
+ var index = Array.IndexOf(lvConfig.AttrIDList, _type);
+ if (index == -1)
+ return 0;
+ return lvConfig.AttrValueList[index];
+ }
}
\ No newline at end of file
diff --git a/Main/System/HeroUI/HeroTrainAddAttrCell.cs b/Main/System/HeroUI/HeroTrainAddAttrCell.cs
index 142df5f..91b1209 100644
--- a/Main/System/HeroUI/HeroTrainAddAttrCell.cs
+++ b/Main/System/HeroUI/HeroTrainAddAttrCell.cs
@@ -14,12 +14,21 @@
[SerializeField] PositionTween addPerObject;
- public void Display(int value, Action func)
+ public void Display(HeroInfo hero, Action func)
{
+ int value = hero.qualityConfig.LVAddPer;
addPerObject.SetActive(true);
+ var lvConfig = HeroQualityLVConfig.GetQualityLVConfig(hero.Quality, hero.heroLevel + 1);
+ var beforeLVConfig = HeroQualityLVConfig.GetQualityLVConfig(hero.Quality, hero.heroLevel);
for (int i = 0; i < addPerText.Length; i++)
{
- addPerText[i].text = "+" + PlayerPropertyConfig.GetValueDescription(PlayerPropertyConfig.basePerAttrs[i], value);
+ var addValue = lvConfig.AttrValueList[i] - beforeLVConfig.AttrValueList[i];
+ string addString = "";
+ if (addValue != 0)
+ {
+ addString = $"+{addValue}\n";
+ }
+ addPerText[i].text = addString + "+" + PlayerPropertyConfig.GetValueDescription(PlayerPropertyConfig.basePerAttrs[i], value);
}
addPerObject.Play(() =>
{
diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs
index 1c05dc5..623f54d 100644
--- a/Main/System/HeroUI/HeroTrainWin.cs
+++ b/Main/System/HeroUI/HeroTrainWin.cs
@@ -196,6 +196,8 @@
HeroManager.Instance.onHeroChangeEvent += RefreshHeroEvent;
UIManager.Instance.OnCloseWindow += OnCloseWindow;
TeamManager.Instance.OnTeamChange += TeamPosChangeEvent;
+ PackManager.Instance.RefreshItemEvent += RefreshItemEvent;
+
guid = HeroUIManager.Instance.selectHeroGuid;
hero = HeroManager.Instance.GetHero(guid);
unfoldState = false;
@@ -211,6 +213,7 @@
HeroManager.Instance.onHeroChangeEvent -= RefreshHeroEvent;
UIManager.Instance.OnCloseWindow -= OnCloseWindow;
TeamManager.Instance.OnTeamChange -= TeamPosChangeEvent;
+ PackManager.Instance.RefreshItemEvent -= RefreshItemEvent;
}
private void OnCloseWindow(UIBase closeUI)
@@ -293,6 +296,17 @@
return;
lockImg.SetActive(hero.isLock);
unLockImg.SetActive(!hero.isLock);
+ }
+
+ void RefreshItemEvent(PackType type, int index, int itemID)
+ {
+ if (type != PackType.Item)
+ return;
+ if (itemID != 7 && itemID != 8)
+ {
+ return;
+ }
+ RefreshAttr();
}
void RefreshHeroEvent(HeroInfo hero)
@@ -494,7 +508,7 @@
lvupEffect.Play();
var cell = RequestCell();
cell.transform.localPosition = new Vector3(0, 0, 0);
- cell.Display(hero.qualityConfig.LVAddPer, () =>
+ cell.Display(hero, () =>
{
cell.SetActive(false);
ReturnCell(cell);
diff --git a/Main/System/Main/FightPowerManager.cs b/Main/System/Main/FightPowerManager.cs
index fc2e71d..505b512 100644
--- a/Main/System/Main/FightPowerManager.cs
+++ b/Main/System/Main/FightPowerManager.cs
@@ -311,6 +311,8 @@
propertyVariables["awakeTalentPer"] = hero.GetAwakeAttrPer(attrType) / 10000.0f;
propertyVariables["fetterValue"] = hero.GetFetterAttrValue(attrType);
propertyVariables["fetterPer"] = hero.GetFetterAttrPer(attrType) / 10000.0f;
+ propertyVariables["heroLVValue"] = hero.GetHeroLVValue(attrType);
+ propertyVariables["heroLVPer"] = hero.GetHeroLVPer(attrType) / 10000.0f;
#if UNITY_EDITOR
//鎺掗櫎鍊间负0鐨勫睘鎬ц緭鍑�
--
Gitblit v1.8.0