121 【武将】武将系统 - 同步武将升级增加固定属性
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2025年8月5日
|
| | | // [ Date ]: Tuesday, November 25, 2025
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public int Quality;
|
| | | public int HeroLV;
|
| | | public int[] UPCostItem;
|
| | | public int[] AttrIDList;
|
| | | public int[] AttrValueList;
|
| | |
|
| | | public override int LoadKey(string _key)
|
| | | {
|
| | |
| | | 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)
|
| | | {
|
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | using System; |
| | | |
| | | // 武将信息:实际获得的武将,不包含图鉴数据 |
| | | public partial class HeroInfo |
| | |
| | | } |
| | | return fightPower; |
| | | } |
| | | |
| | | |
| | | |
| | | public void ChangeLockState() |
| | | { |
| | |
| | | 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]; |
| | | } |
| | | } |
| | |
| | | [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(() => |
| | | { |
| | |
| | | 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; |
| | |
| | | HeroManager.Instance.onHeroChangeEvent -= RefreshHeroEvent; |
| | | UIManager.Instance.OnCloseWindow -= OnCloseWindow; |
| | | TeamManager.Instance.OnTeamChange -= TeamPosChangeEvent; |
| | | PackManager.Instance.RefreshItemEvent -= RefreshItemEvent; |
| | | } |
| | | |
| | | private void OnCloseWindow(UIBase closeUI) |
| | |
| | | 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) |
| | |
| | | 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); |
| | |
| | | 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的属性输出 |