using System;
|
using System.Collections.Generic;
|
|
//玩家信息
|
public class ArenaPlayerInfo
|
{
|
public byte IsReset; //是否是重置的 1,清空记录缓存
|
public int Score { get; private set; } // 当前积分
|
public int Ranking { get; private set; } // 当前排名
|
public int Combating { get; private set; } // 当前战力
|
public int DayPKCount { get; private set; } // 当日已PK次数
|
public int ItemAddBattleCountToday { get; private set; } // 今日已使用物品增加的挑战次数
|
public int MatchRefreshCount { get; private set; } //当前已刷新匹配列表次数,每次挑战后会重置
|
|
|
//更新个人竞技信息
|
public event Action UpdatePlayerInfoEvent;
|
|
|
|
public void UpdatePlayerInfo(IL_HA3C3_tagMCArenaPlayerInfo playerInfo)
|
{
|
this.IsReset = playerInfo.IsReset;
|
this.Score = (int)playerInfo.Score; //当前积分
|
this.DayPKCount = playerInfo.BattleCountToday; //今日已挑战次数
|
this.MatchRefreshCount=playerInfo.MatchRefreshCount; //当前已刷新匹配列表次数,每次挑战后会重置
|
this.ItemAddBattleCountToday = playerInfo.ItemAddBattleCountToday; //今日已使用物品增加的挑战次数
|
|
if(IsReset == 1)
|
{
|
ArenaModel.Instance.OnPlayerLoginOk();
|
}
|
ArenaManager.ShowLeftTimes = GetDayMatchCount().ToString();
|
if (GetDayMatchCount() <= 0)
|
{
|
ArenaManager.isArenaOver = true;
|
}
|
else
|
{
|
ArenaManager.isArenaOver = false;
|
}
|
//是否可以购买竞技券
|
int count = ArenaModel.Instance.playerInfo.GetDayMatchCount();
|
if (count >= ArenaModel.Instance.freeMaxMatchNum)
|
{
|
ArenaManager.isArenaUse = false;
|
}
|
else
|
{
|
ArenaManager.isArenaUse = true;
|
}
|
|
if (UpdatePlayerInfoEvent != null)
|
{
|
UpdatePlayerInfoEvent();
|
}
|
}
|
//竞技场挑战次数
|
public string GetDayMatchInfo()
|
{
|
int all = ItemAddBattleCountToday + ArenaModel.Instance.freeMaxMatchNum;
|
return string.Format("{0}/{1}", (all - DayPKCount).ToString(), ArenaModel.Instance.freeMaxMatchNum.ToString());
|
}
|
//检查剩余次数
|
public int GetDayMatchCount()
|
{
|
int all = ItemAddBattleCountToday + ArenaModel.Instance.freeMaxMatchNum;
|
return all - DayPKCount;
|
}
|
|
}
|