少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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;
     }
 
 }