379 lines
11 KiB
C#
379 lines
11 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using GCGame.Table;
|
|||
|
using Module.Log;
|
|||
|
|
|||
|
public class PvpInfo{
|
|||
|
|
|||
|
//PVP场景ID
|
|||
|
public int _PvpSceneId = 600;
|
|||
|
//挑战场景ID
|
|||
|
public int _PvpBattleSceneId = 601;
|
|||
|
|
|||
|
//当前创建房间场景匹配倒计时
|
|||
|
public int _RoomMatchRemainTime = 0;
|
|||
|
|
|||
|
//当前场景结束时间
|
|||
|
public int _PvpFightRoomEndTime = 0;
|
|||
|
|
|||
|
//当前所属房间ID
|
|||
|
public int _PvpRoomId = -1;
|
|||
|
//战斗场景结束时间
|
|||
|
public int _BattleSceneEndTime = -1;
|
|||
|
//是否拥有房间
|
|||
|
public bool _IsHavePvpRoom = false;
|
|||
|
private static PvpInfo _Instance;
|
|||
|
public PvpInfo Instance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_Instance == null)
|
|||
|
_Instance = this;
|
|||
|
return _Instance;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//当前PVP等级
|
|||
|
private int _PvpSegmentLevel;
|
|||
|
public int PvpSegmentLevel
|
|||
|
{
|
|||
|
get { return _PvpSegmentLevel; }
|
|||
|
set { _PvpSegmentLevel = value; }
|
|||
|
}
|
|||
|
|
|||
|
//个人积分
|
|||
|
private int _SelfPvpScore;
|
|||
|
public int SelfPvpScore
|
|||
|
{
|
|||
|
get { return _SelfPvpScore; }
|
|||
|
set { _SelfPvpScore = value; }
|
|||
|
}
|
|||
|
|
|||
|
//每日连胜次数
|
|||
|
private int _DayWinTimes;
|
|||
|
public int DayWinTimes
|
|||
|
{
|
|||
|
get { return _DayWinTimes; }
|
|||
|
set { _DayWinTimes = value; }
|
|||
|
}
|
|||
|
|
|||
|
//每日失败次数
|
|||
|
private int _DayBeDefeatedTimes;
|
|||
|
public int DayBtDefeatedTimes
|
|||
|
{
|
|||
|
get { return _DayBeDefeatedTimes; }
|
|||
|
set { _DayBeDefeatedTimes = value; }
|
|||
|
}
|
|||
|
|
|||
|
//每日匹配次数
|
|||
|
private int _DayMatchTimes;
|
|||
|
public int DayMatchTimes
|
|||
|
{
|
|||
|
get { return _DayMatchTimes; }
|
|||
|
set { _DayMatchTimes = value; }
|
|||
|
}
|
|||
|
|
|||
|
//赛季胜利次数
|
|||
|
public int _SeasonWinTimes;
|
|||
|
public int SeasonWinTimes
|
|||
|
{
|
|||
|
get { return _SeasonWinTimes; }
|
|||
|
set { _SeasonWinTimes = value; }
|
|||
|
}
|
|||
|
|
|||
|
//赛季失败次数
|
|||
|
private int _SeasonBeDefeatdTimes;
|
|||
|
public int SeasonBeDefeatedTimes
|
|||
|
{
|
|||
|
get{ return _SeasonBeDefeatdTimes; }
|
|||
|
set { _SeasonBeDefeatdTimes = value; }
|
|||
|
}
|
|||
|
|
|||
|
//赛季匹配次数
|
|||
|
private int _SeasonMatchTimes;
|
|||
|
public int SeasonMatchTimes
|
|||
|
{
|
|||
|
get { return _SeasonMatchTimes; }
|
|||
|
set { _SeasonMatchTimes = value; }
|
|||
|
}
|
|||
|
|
|||
|
//PVP最大等级
|
|||
|
private int _MaxSegmentLevel = -1;
|
|||
|
public int MaxSegmentLevel
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_MaxSegmentLevel != -1)
|
|||
|
return _MaxSegmentLevel;
|
|||
|
|
|||
|
foreach (var info in TableManager.GetHonorBattlefieldSegment())
|
|||
|
{
|
|||
|
if (info.Key > _MaxSegmentLevel)
|
|||
|
_MaxSegmentLevel = info.Key;
|
|||
|
}
|
|||
|
return _MaxSegmentLevel;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private int _MaxSegmentGrade = -1;
|
|||
|
public int MaxSegmentGrade
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_MaxSegmentGrade != -1)
|
|||
|
return _MaxSegmentGrade;
|
|||
|
|
|||
|
foreach (var info in TableManager.GetHonorBattlefieldSegment().Values)
|
|||
|
{
|
|||
|
if (info.Segment > _MaxSegmentGrade)
|
|||
|
_MaxSegmentGrade = info.Segment;
|
|||
|
}
|
|||
|
return _MaxSegmentGrade;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//0.未获取 1.可领取 2.已领取
|
|||
|
public Dictionary<int, int> _DayRewStateDic = new Dictionary<int, int>();
|
|||
|
public Dictionary<int, int> _RankRewStateDic = new Dictionary<int, int>();
|
|||
|
public Dictionary<int, int> _SeasonRewStateDic = new Dictionary<int, int>();
|
|||
|
|
|||
|
public bool IsDayHaveRew = false;
|
|||
|
public bool IsSeasonHaveRew = false;
|
|||
|
|
|||
|
public bool IsHaveRew()
|
|||
|
{
|
|||
|
return IsDayHaveRew || IsSeasonHaveRew;
|
|||
|
}
|
|||
|
|
|||
|
//刷新个人赛季信息
|
|||
|
public void UpdateSelfPcpInfo(RespHonorBattlefieldPlayerInfo packet)
|
|||
|
{
|
|||
|
_SelfPvpScore = packet.Score;
|
|||
|
_DayWinTimes = packet.WinsTimesDay;
|
|||
|
_DayBeDefeatedTimes = packet.FailsTimesDay;
|
|||
|
_DayMatchTimes = packet.MatchTimesDay;
|
|||
|
_SeasonWinTimes = packet.WinTimesSegment;
|
|||
|
_SeasonBeDefeatdTimes = packet.FailTimesSegment;
|
|||
|
_SeasonMatchTimes = packet.MatchTimesSegment;
|
|||
|
|
|||
|
bool hasetPvpSegmenTlevel = false;
|
|||
|
foreach(var tab in TableManager.GetHonorBattlefieldSegment().Values)
|
|||
|
{
|
|||
|
if(_SelfPvpScore >= tab.ScoreMin && _SelfPvpScore <= tab.ScoreMax)
|
|||
|
{
|
|||
|
_PvpSegmentLevel = tab.GetId();
|
|||
|
hasetPvpSegmenTlevel = true;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
if (!hasetPvpSegmenTlevel)
|
|||
|
_PvpSegmentLevel = MaxSegmentLevel;
|
|||
|
|
|||
|
bool DayHasRew = false;
|
|||
|
for (int index = 0; index < packet.DayAward.Count; index++)
|
|||
|
{
|
|||
|
if(packet.DayAward[index].State == 1)
|
|||
|
{
|
|||
|
DayHasRew = true;
|
|||
|
}
|
|||
|
if(_DayRewStateDic.ContainsKey(packet.DayAward[index].Id))
|
|||
|
{
|
|||
|
_DayRewStateDic[packet.DayAward[index].Id] = packet.DayAward[index].State;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_DayRewStateDic.Add(packet.DayAward[index].Id, packet.DayAward[index].State);
|
|||
|
}
|
|||
|
}
|
|||
|
IsDayHaveRew = DayHasRew;
|
|||
|
|
|||
|
|
|||
|
for(int index = 0; index < packet.SegmentAward.Count; index++)
|
|||
|
{
|
|||
|
if(_RankRewStateDic.ContainsKey(packet.SegmentAward[index].Id))
|
|||
|
{
|
|||
|
_RankRewStateDic[packet.SegmentAward[index].Id] = packet.SegmentAward[index].State;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_RankRewStateDic.Add(packet.SegmentAward[index].Id, packet.SegmentAward[index].State);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
bool SeasonHasRew = false;
|
|||
|
for (int index = 0; index < packet.SeasonAward.Count; index++)
|
|||
|
{
|
|||
|
if(packet.SeasonAward[index].State == 1)
|
|||
|
{
|
|||
|
SeasonHasRew = true;
|
|||
|
}
|
|||
|
if (_RankRewStateDic.ContainsKey(packet.SeasonAward[index].Id))
|
|||
|
{
|
|||
|
_SeasonRewStateDic[packet.SeasonAward[index].Id] = packet.SeasonAward[index].State;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_SeasonRewStateDic.Add(packet.SeasonAward[index].Id, packet.SeasonAward[index].State);
|
|||
|
}
|
|||
|
}
|
|||
|
IsSeasonHaveRew = SeasonHasRew;
|
|||
|
|
|||
|
if (PVPRoot.Instance)
|
|||
|
{
|
|||
|
PVPRoot.Instance.ShowRewRedIcon(IsSeasonHaveRew || IsDayHaveRew);
|
|||
|
}
|
|||
|
|
|||
|
if (PvpSceneInfo.Instance)
|
|||
|
PvpSceneInfo.Instance.RefreshRewRedIconState();
|
|||
|
|
|||
|
if (PvpRewPanel.Instance && PvpRewPanel.Instance.isActiveAndEnabled)
|
|||
|
{
|
|||
|
PvpRewPanel.Instance.RefreshRewState();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public List<HonorBattlefieldMatchMemberInfo> _TeamMemberInfoList = new List<HonorBattlefieldMatchMemberInfo>();
|
|||
|
public void RefreshTeamMemberInfoList(List<HonorBattlefieldMatchMemberInfo> infoList)
|
|||
|
{
|
|||
|
if (infoList.Count <= 0)
|
|||
|
return;
|
|||
|
|
|||
|
_TeamMemberInfoList = new List<HonorBattlefieldMatchMemberInfo>();
|
|||
|
_TeamMemberInfoList.AddRange(infoList);
|
|||
|
|
|||
|
if (PvpTeamInfoPanel.Instance)
|
|||
|
PvpTeamInfoPanel.Instance.InitContainer();
|
|||
|
else
|
|||
|
{
|
|||
|
if (GameManager.gameManager.RunningScene != GameManager.gameManager.PlayerDataPool.pvpIfo._PvpBattleSceneId)
|
|||
|
return;
|
|||
|
UIManager.ShowUI(UIInfo.PvpTeamInfoPanel);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public List<HonorBattlefieldMatchMemberInfo> _EnemyTeamMemberInfoList;
|
|||
|
public void SaveEnmeyTeamInfoList(List<HonorBattlefieldMatchMemberInfo> infoList)
|
|||
|
{
|
|||
|
if (infoList.Count <= 0)
|
|||
|
return;
|
|||
|
|
|||
|
_EnemyTeamMemberInfoList = new List<HonorBattlefieldMatchMemberInfo>();
|
|||
|
_EnemyTeamMemberInfoList.AddRange(infoList);
|
|||
|
|
|||
|
if (PvpTeamInfoPanel.Instance)
|
|||
|
PvpTeamInfoPanel.Instance.InitEnemyContainer();
|
|||
|
else
|
|||
|
{
|
|||
|
if (GameManager.gameManager.RunningScene != GameManager.gameManager.PlayerDataPool.pvpIfo._PvpBattleSceneId)
|
|||
|
return;
|
|||
|
UIManager.ShowUI(UIInfo.PvpTeamInfoPanel);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsMaxLevel()
|
|||
|
{
|
|||
|
return PvpSegmentLevel >= MaxSegmentLevel;
|
|||
|
}
|
|||
|
|
|||
|
//等级分段描述
|
|||
|
public string GetSegmentLevelDesc(int level)
|
|||
|
{
|
|||
|
if(level < 1)
|
|||
|
return StrDictionary.GetClientDictionaryString("#{82036}");
|
|||
|
var dicId = "#{" + (82000 + level) + "}";
|
|||
|
return StrDictionary.GetClientDictionaryString(dicId);
|
|||
|
}
|
|||
|
|
|||
|
public string GetSegmentGradeDesc(int grade)
|
|||
|
{
|
|||
|
if (grade < 1)
|
|||
|
return StrDictionary.GetClientDictionaryString("#{82036}");
|
|||
|
var dicId = "#{" + (82100 + grade) + "}";
|
|||
|
return StrDictionary.GetClientDictionaryString(dicId);
|
|||
|
}
|
|||
|
|
|||
|
public int GetNextLevelNeedScore()
|
|||
|
{
|
|||
|
if(IsMaxLevel())
|
|||
|
return -1; //表示满级
|
|||
|
|
|||
|
foreach (var tab in TableManager.GetHonorBattlefieldSegment().Values)
|
|||
|
{
|
|||
|
if(_SelfPvpScore < tab.ScoreMin)
|
|||
|
{
|
|||
|
return tab.ScoreMin;
|
|||
|
}
|
|||
|
}
|
|||
|
return -1; //异常值
|
|||
|
}
|
|||
|
|
|||
|
public List<int> GetAllSegmentlist()
|
|||
|
{
|
|||
|
List<int> _SegmentList = new List<int>();
|
|||
|
for(int index = 1; index <= MaxSegmentLevel; index++)
|
|||
|
{
|
|||
|
_SegmentList.Add(index);
|
|||
|
}
|
|||
|
return _SegmentList;
|
|||
|
}
|
|||
|
|
|||
|
public List<int> GetAllSegmentGradeList()
|
|||
|
{
|
|||
|
List<int> _SegmentList = new List<int>();
|
|||
|
for (int index = 1; index <= MaxSegmentGrade; index++)
|
|||
|
{
|
|||
|
_SegmentList.Add(index);
|
|||
|
}
|
|||
|
return _SegmentList;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public string GetPvpHeadIcon(int profession)
|
|||
|
{
|
|||
|
switch (profession)
|
|||
|
{
|
|||
|
case (int)Games.GlobeDefine.CharacterDefine.PROFESSION.TIANJI:
|
|||
|
return "pvptianji";
|
|||
|
case (int)Games.GlobeDefine.CharacterDefine.PROFESSION.XUANNV:
|
|||
|
return "pvpxuannv";
|
|||
|
case (int)Games.GlobeDefine.CharacterDefine.PROFESSION.LIUSHAN:
|
|||
|
return "pvpliushan";
|
|||
|
case (int)Games.GlobeDefine.CharacterDefine.PROFESSION.SHUSHAN:
|
|||
|
return "pvpshushan";
|
|||
|
default:
|
|||
|
return "";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public int _CountMaskEndTime = -1;
|
|||
|
public List<HonorBattlefieldBattlePlayerInfo> _BattleRedTeamList;
|
|||
|
public List<HonorBattlefieldBattlePlayerInfo> _BattleBlueTeamList;
|
|||
|
public void SaveBattleBothInfoList(List<HonorBattlefieldBattlePlayerInfo> infoList)
|
|||
|
{
|
|||
|
if (infoList.Count <= 0)
|
|||
|
return;
|
|||
|
ClearBattleBothInfoList();
|
|||
|
|
|||
|
for (int indedx = 0; indedx < infoList.Count; indedx++)
|
|||
|
{
|
|||
|
if (infoList[indedx].Camp == 6)
|
|||
|
{
|
|||
|
_BattleBlueTeamList.Add(infoList[indedx]);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_BattleRedTeamList.Add(infoList[indedx]);
|
|||
|
}
|
|||
|
}
|
|||
|
LogModule.ErrorLog("Blue : " + _BattleBlueTeamList.Count + ", Red: " + _BattleRedTeamList.Count);
|
|||
|
}
|
|||
|
|
|||
|
public void ClearBattleBothInfoList()
|
|||
|
{
|
|||
|
_BattleBlueTeamList = new List<HonorBattlefieldBattlePlayerInfo>();
|
|||
|
_BattleRedTeamList = new List<HonorBattlefieldBattlePlayerInfo>();
|
|||
|
}
|
|||
|
}
|