summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XRequestDocument.cs
blob: 019d488ded3368f86d7b40f08546e498875d87b9 (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
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XRequestDocument : XDocComponent
	{
		public List<PartyExchangeItemInfo> List
		{
			get
			{
				return this._list;
			}
		}

		public override uint ID
		{
			get
			{
				return XRequestDocument.uuID;
			}
		}

		public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("RequestDocument");

		private List<PartyExchangeItemInfo> _list = new List<PartyExchangeItemInfo>();

		public int MainInterfaceNum = 0;

		protected override void OnReconnected(XReconnectedEventArgs arg)
		{
		}

		public void QueryRequestList()
		{
			RpcC2G_GetGuildCampPartyExchangeInfo rpc = new RpcC2G_GetGuildCampPartyExchangeInfo();
			XSingleton<XClientNetwork>.singleton.Send(rpc);
		}

		public void OnRequestListGet(List<PartyExchangeItemInfo> list)
		{
			this._list.Clear();
			for (int i = 0; i < list.Count; i++)
			{
				this._list.Add(this.Copy(list[i]));
			}
			bool flag = DlgBase<RequestDlg, RequestBehaviour>.singleton.IsVisible();
			if (flag)
			{
				DlgBase<RequestDlg, RequestBehaviour>.singleton.Refresh(true);
			}
		}

		public void RemoveList(bool isAll, ulong uid)
		{
			if (isAll)
			{
				this._list.Clear();
			}
			else
			{
				for (int i = 0; i < this._list.Count; i++)
				{
					bool flag = this._list[i].role_id == uid;
					if (flag)
					{
						this._list.RemoveAt(i);
						break;
					}
				}
			}
			bool flag2 = DlgBase<RequestDlg, RequestBehaviour>.singleton.IsVisible();
			if (flag2)
			{
				DlgBase<RequestDlg, RequestBehaviour>.singleton.Refresh(true);
			}
		}

		public PartyExchangeItemInfo Copy(PartyExchangeItemInfo info)
		{
			return new PartyExchangeItemInfo
			{
				level = info.level,
				name = info.name,
				profession_id = info.profession_id,
				time = info.time,
				role_id = info.role_id
			};
		}

		public void ClearList()
		{
			RpcC2G_ReplyPartyExchangeItemOpt rpcC2G_ReplyPartyExchangeItemOpt = new RpcC2G_ReplyPartyExchangeItemOpt();
			rpcC2G_ReplyPartyExchangeItemOpt.oArg.operate_type = 2u;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_ReplyPartyExchangeItemOpt);
		}

		public void QueryAcceptExchange(ulong uid)
		{
			RpcC2G_ReplyPartyExchangeItemOpt rpcC2G_ReplyPartyExchangeItemOpt = new RpcC2G_ReplyPartyExchangeItemOpt();
			rpcC2G_ReplyPartyExchangeItemOpt.oArg.lauch_role_id = uid;
			rpcC2G_ReplyPartyExchangeItemOpt.oArg.operate_type = 3u;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_ReplyPartyExchangeItemOpt);
		}

		public void QueryRefuseExchange(ulong uid)
		{
			RpcC2G_ReplyPartyExchangeItemOpt rpcC2G_ReplyPartyExchangeItemOpt = new RpcC2G_ReplyPartyExchangeItemOpt();
			rpcC2G_ReplyPartyExchangeItemOpt.oArg.lauch_role_id = uid;
			rpcC2G_ReplyPartyExchangeItemOpt.oArg.operate_type = 1u;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_ReplyPartyExchangeItemOpt);
		}

		public void SetMainInterfaceNum(int num)
		{
			this.MainInterfaceNum = num;
			DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_Exchange, true);
		}
	}
}