using System.Collections.Generic; using Gameplay.Net; using NLDPB; namespace Gameplay.Level { public class LevelSettleData { private readonly int _levelID; private readonly Team _team; private readonly Dictionary _favorDic; //角色好感度缓存 private readonly Dictionary _expDic; //角色经验值缓存 private uint _playerEXp; //玩家经验值缓存 public int LevelID => _levelID; public Team Team => _team; public Dictionary FavorDic => _favorDic; public Dictionary ExpDic => _expDic; public uint PlayerEXp => _playerEXp; public LevelSettleData(int levelId, Team team) { _levelID = levelId; _team = team; _favorDic = new Dictionary(); _expDic = new Dictionary(); SetCharacterExp(); SetPlayerExp(); } private void SetCharacterExp() { var charIDs = _team.GetCharacterIDs(); for (int i = 0; i < charIDs.Length; i++) { var id = charIDs[i]; if (id != Team.NONE_ID) { if (!CharacterDataInfoManager.Instance.DataDic.TryGetValue(id, out var charDataInfo)) { continue; } _favorDic.Add(id, charDataInfo.LikelyExp); _expDic.Add(id, charDataInfo.Exp); } } } private void SetPlayerExp() { var exp = Actor.Instance.Base.GetProp(ActorProp.Exp); _playerEXp = exp; } } public partial class LevelManager { private LevelSettleData _cacheSettleData; public LevelSettleData SettleData => _cacheSettleData; } }