summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Team/XTeamInviteListData.cs
blob: d75faf154a0e17f4814c38f26602155a8aae0345 (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
using System;
using KKSG;

namespace XMainClient
{
	internal class XTeamInviteListData : XDataBase, IComparable<XTeamInviteListData>
	{
		public XTeamRelation relation = new XTeamRelation();

		public ulong uid;

		public string name;

		public uint ppt;

		public uint level;

		public uint profession = 1u;

		public uint vip;

		public string guildname;

		public uint degree;

		public int sameGuild;

		public bool bSent;

		public XTeamInviteListData.InviteState state;

		public string openid;

		public bool isOnline;

		public string bigpic;

		public string midpic;

		public string smallpic;

		public bool wantHelp;

		public enum InviteState
		{
			IS_IDLE,
			IS_OTHER_TEAM,
			IS_MY_TEAM,
			IS_FIGHTING,
			IS_NO_COUNT,
			IS_NO_FATIGUE,
			IS_NOT_OPEN
		}

		public void SetData(TeamInvRoleInfo data, bool bIsFriend, bool bIsGuild, bool bIsPartner)
		{
			this.uid = data.userID;
			this.name = data.userName;
			this.level = data.userLevel;
			this.ppt = data.userPowerPoint;
			this.vip = data.userVip;
			this.guildname = data.guildName;
			this.degree = data.degree;
			this.sameGuild = ((data.teamguildid == 0UL || data.roleguildid == data.teamguildid) ? 1 : 0);
			this.profession = (uint)data.profession;
			this.bSent = false;
			this.state = this._GetInviteState(data.state);
			this.wantHelp = data.wanthelp;
			this.relation.Reset();
			if (bIsGuild)
			{
				this.relation.Append(XTeamRelation.Relation.TR_GUILD, true);
			}
			if (bIsFriend)
			{
				this.relation.Append(XTeamRelation.Relation.TR_FRIEND, true);
			}
			if (bIsPartner)
			{
				this.relation.Append(XTeamRelation.Relation.TR_PARTNER, true);
			}
		}

		public void SetData(PlatFriendRankInfo2Client data)
		{
			this.name = data.platfriendBaseInfo.nickname;
			this.level = data.level;
			this.ppt = data.maxAbility;
			this.profession = (uint)data.profession;
			this.bSent = false;
			this.state = XTeamInviteListData.InviteState.IS_IDLE;
			this.vip = 0u;
			this.guildname = null;
			this.sameGuild = 1;
			this.openid = data.platfriendBaseInfo.openid;
			this.isOnline = data.isOnline;
			this.bigpic = data.platfriendBaseInfo.bigpic;
			this.midpic = data.platfriendBaseInfo.midpic;
			this.smallpic = data.platfriendBaseInfo.smallpic;
			this.relation.Reset();
		}

		public int CompareTo(XTeamInviteListData other)
		{
			int num = this.relation.CompareTo(other.relation);
			bool flag = num != 0;
			int result;
			if (flag)
			{
				result = num;
			}
			else
			{
				bool flag2 = this.sameGuild != other.sameGuild;
				if (flag2)
				{
					result = -this.sameGuild.CompareTo(other.sameGuild);
				}
				else
				{
					bool flag3 = this.wantHelp != other.wantHelp;
					if (flag3)
					{
						result = -this.wantHelp.CompareTo(other.wantHelp);
					}
					else
					{
						bool flag4 = this.state != other.state;
						if (flag4)
						{
							result = this.state.CompareTo(other.state);
						}
						else
						{
							bool flag5 = this.degree != other.degree;
							if (flag5)
							{
								result = -this.degree.CompareTo(other.degree);
							}
							else
							{
								result = -this.ppt.CompareTo(other.ppt);
							}
						}
					}
				}
			}
			return result;
		}

		private XTeamInviteListData.InviteState _GetInviteState(TeamInvRoleState state)
		{
			XTeamInviteListData.InviteState result;
			switch (state)
			{
			case TeamInvRoleState.TIRS_IN_OTHER_TEAM:
				result = XTeamInviteListData.InviteState.IS_OTHER_TEAM;
				break;
			case TeamInvRoleState.TIRS_IN_MY_TEAM:
				result = XTeamInviteListData.InviteState.IS_MY_TEAM;
				break;
			case TeamInvRoleState.TIRS_IN_BATTLE:
				result = XTeamInviteListData.InviteState.IS_FIGHTING;
				break;
			case TeamInvRoleState.TIRS_NORMAL:
				result = XTeamInviteListData.InviteState.IS_IDLE;
				break;
			case TeamInvRoleState.TIRS_NOT_OPEN:
				result = XTeamInviteListData.InviteState.IS_NOT_OPEN;
				break;
			case TeamInvRoleState.TIRS_COUNT_LESS:
				result = XTeamInviteListData.InviteState.IS_NO_COUNT;
				break;
			case TeamInvRoleState.TIRS_FATIGUE_LESS:
				result = XTeamInviteListData.InviteState.IS_NO_FATIGUE;
				break;
			default:
				result = XTeamInviteListData.InviteState.IS_IDLE;
				break;
			}
			return result;
		}

		public override void Recycle()
		{
			XDataPool<XTeamInviteListData>.Recycle(this);
		}
	}
}