NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Level/LevelManager.Settle.cs

66 lines
1.9 KiB
C#

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<uint, uint> _favorDic; //角色好感度缓存
private readonly Dictionary<uint, uint> _expDic; //角色经验值缓存
private uint _playerEXp; //玩家经验值缓存
public int LevelID => _levelID;
public Team Team => _team;
public Dictionary<uint, uint> FavorDic => _favorDic;
public Dictionary<uint, uint> ExpDic => _expDic;
public uint PlayerEXp => _playerEXp;
public LevelSettleData(int levelId, Team team)
{
_levelID = levelId;
_team = team;
_favorDic = new Dictionary<uint, uint>();
_expDic = new Dictionary<uint, uint>();
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;
}
}