210 lines
6.5 KiB
C#
210 lines
6.5 KiB
C#
using System.Collections.Generic;
|
|
using Cysharp.Threading.Tasks;
|
|
using Gameplay.Common;
|
|
using Gameplay.Net;
|
|
using Gameplay.SubSystems;
|
|
using NLDPB;
|
|
using PhxhSDK;
|
|
using UnityEngine.SceneManagement;
|
|
using Framework;
|
|
using Gameplay.Effect;
|
|
using Constants = Framework.Constants;
|
|
|
|
namespace Gameplay.Level
|
|
{
|
|
public partial class LevelManager
|
|
{
|
|
private LevelSettleData _cacheSettleData;
|
|
public LevelSettleData SettleData => _cacheSettleData;
|
|
public PVPSettleData PvpSettleData;
|
|
|
|
private List<uint> _showCharIDs; //结算动画展示角色
|
|
private uint _showVehicleID; //结算动画展示载具
|
|
|
|
private readonly string _testScenePath = "Assets/Scenes/FightWinSceneLocal.unity";
|
|
|
|
public List<uint> ShowCharIDs => _showCharIDs;
|
|
public uint ShowVehicleID => _showVehicleID;
|
|
|
|
#region API
|
|
public async UniTask SettleSceneProcess(ItemList itemList)
|
|
{
|
|
_UpdateSettleTeam();
|
|
|
|
//CommonUtils.CaptureScreenshot();
|
|
|
|
//播结算动画
|
|
await ShowTransitionMgr.Instance.EnterBlackTransition(true);
|
|
await ShowTransitionMgr.Instance.EnterBlack();
|
|
await UniTask.Delay(250);
|
|
EffectManager.instance.rootObj.SetActive(false);
|
|
SelecterView.Instance.Release();
|
|
UITipsManager.CloseClickShield();
|
|
//播放过程
|
|
TeamManager.Instance.TeamUIClose();
|
|
await UIManager.Instance.CreateAndOpenWindow(UINameConst.UIMissionWin);
|
|
var sceneHandle = await GameSceneHelper.Instance.LoadSceneForRt(_testScenePath);
|
|
var rTexture = GameSceneHelper.Instance.GetRenderTexture();
|
|
EventManager.Instance.Send(EventManager.EventName.UIMissionWinRtSet, rTexture);
|
|
//退出黑屏,渐变
|
|
await UniTask.Delay(1000);
|
|
await ShowTransitionMgr.Instance.ExitBlack();
|
|
ShowTransitionMgr.Instance.ExitTransition();
|
|
|
|
await UniTask.Delay(7500);
|
|
//CommonUtils.CaptureScreenshot();
|
|
await UniTask.Delay(100);
|
|
//卸载结算场景,进入结算界面
|
|
await ShowTransitionMgr.Instance.EnterBlackTransition(true);
|
|
await ShowTransitionMgr.Instance.EnterBlack();
|
|
await UniTask.Delay(250);
|
|
|
|
await UIPassGameController.Open(itemList);
|
|
|
|
await UniTask.Delay(250);
|
|
await ShowTransitionMgr.Instance.ExitBlack();
|
|
ShowTransitionMgr.Instance.ExitTransition();
|
|
}
|
|
|
|
public async UniTask OpenSettleScene()
|
|
{
|
|
var sceneHandle = await GameSceneManager.Instance.LoadSceneAsync(_testScenePath, LoadSceneMode.Additive);
|
|
if (sceneHandle == null)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
//加载数据
|
|
private void _UpdateSettleTeam()
|
|
{
|
|
if (_showCharIDs == null)
|
|
{
|
|
_showCharIDs = new List<uint>();
|
|
}
|
|
else
|
|
{
|
|
_showCharIDs.Clear();
|
|
}
|
|
|
|
_showVehicleID = Constants.INVALID_UINT_ID;
|
|
|
|
var team = TeamEditManager.Instance.GetSelectTeam();
|
|
var charIDs = team.GetCharacterIDs();
|
|
for (int i = 0; i < charIDs.Length; i++)
|
|
{
|
|
if (i == 5)
|
|
{
|
|
break;
|
|
}
|
|
if (charIDs[i] > 0)
|
|
{
|
|
_showCharIDs.Add(charIDs[i]);
|
|
}
|
|
}
|
|
|
|
_showVehicleID = team.GetVehicleID();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 结算界面所需数据
|
|
/// </summary>
|
|
public struct LvExp
|
|
{
|
|
public uint Lv;
|
|
public uint Exp;
|
|
|
|
public LvExp(uint exp, uint lv)
|
|
{
|
|
Lv = lv;
|
|
Exp = exp;
|
|
}
|
|
}
|
|
public class LevelSettleData
|
|
{
|
|
private readonly int _levelID;
|
|
private readonly Team _team;
|
|
private readonly Dictionary<uint, LvExp> _favorDic; //角色好感度缓存
|
|
private readonly Dictionary<uint, LvExp> _expDic; //角色经验值缓存
|
|
private LvExp _playerLvEXp; //玩家经验值缓存
|
|
public int _commonExpCount; //通用经验道具拥有数量
|
|
|
|
public int LevelID => _levelID;
|
|
|
|
public Team Team => _team;
|
|
|
|
public Dictionary<uint, LvExp> FavorDic => _favorDic;
|
|
|
|
public Dictionary<uint, LvExp> ExpDic => _expDic;
|
|
|
|
public LvExp PlayerLvExp => _playerLvEXp;
|
|
|
|
public int CommonExp => _commonExpCount;
|
|
|
|
public LevelSettleData(int levelId, Team team)
|
|
{
|
|
_levelID = levelId;
|
|
_team = team;
|
|
_favorDic = new Dictionary<uint, LvExp>();
|
|
_expDic = new Dictionary<uint, LvExp>();
|
|
SetCharacterExp();
|
|
SetPlayerExp();
|
|
_commonExpCount = GetCommonExp();
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
var favorData = new LvExp(charDataInfo.LikelyExp, charDataInfo.LikelyLevel);
|
|
|
|
var expData = new LvExp(charDataInfo.Exp, charDataInfo.Level);
|
|
_favorDic.Add(id, favorData);
|
|
_expDic.Add(id, expData);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void SetPlayerExp()
|
|
{
|
|
var exp = Actor.Instance.Base.GetProp(ActorProp.Exp);
|
|
var lv = Actor.Instance.Base.GetProp(ActorProp.Level);
|
|
_playerLvEXp = new LvExp(exp, lv);
|
|
}
|
|
|
|
private int GetCommonExp()
|
|
{
|
|
int count = (int)CommonUtils.GetItemCount(GLConfig.Inst.data.HeroExpItem);
|
|
|
|
return count;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// pvp的结算数据缓存
|
|
/// </summary>
|
|
public class PVPSettleData
|
|
{
|
|
public int Score;
|
|
public int Rank;
|
|
|
|
public PVPSettleData()
|
|
{
|
|
Score = PVPManager.Instance.score;
|
|
Rank = PVPManager.Instance.order;
|
|
}
|
|
}
|
|
|
|
} |