summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XFlowerSendDocument.cs
blob: 5788bf9ee08be2cb39a164ef6fc5e5bc84c47d72 (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
using System;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XFlowerSendDocument : XDocComponent
	{
		public override uint ID
		{
			get
			{
				return XFlowerSendDocument.uuID;
			}
		}

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

		public void SendFlower(ulong roleID, uint count, uint sendItemID)
		{
			RpcC2G_SendFlower rpcC2G_SendFlower = new RpcC2G_SendFlower();
			rpcC2G_SendFlower.oArg.roleid = roleID;
			rpcC2G_SendFlower.oArg.count = count;
			rpcC2G_SendFlower.oArg.sendItemID = sendItemID;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_SendFlower);
		}

		public void SendFlower(ulong roleID, uint count, uint sendItemID, uint needCostID, uint needCostCount)
		{
			RpcC2G_SendFlower rpcC2G_SendFlower = new RpcC2G_SendFlower();
			rpcC2G_SendFlower.oArg.roleid = roleID;
			rpcC2G_SendFlower.oArg.count = count;
			rpcC2G_SendFlower.oArg.sendItemID = sendItemID;
			rpcC2G_SendFlower.oArg.costItemID = needCostID;
			rpcC2G_SendFlower.oArg.costItemNum = needCostCount;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_SendFlower);
		}

		public void OnSendFlower(SendFlowerArg oArg, SendFlowerRes oRes)
		{
			bool flag = oRes.errorcode == ErrorCode.ERR_SUCCESS;
			if (flag)
			{
				DlgBase<XFlowerSendView, XFlowerSendBehaviour>.singleton.RefreshSendFlowerInfo();
				ItemList.RowData itemConf = XBagDocument.GetItemConf((int)oArg.sendItemID);
				string arg = (itemConf != null) ? XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemName, 0u) : "";
				XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("FLOWER_SEND_SUC"), oArg.count, arg), "fece00");
				XFlowerRankDocument specificDocument = XDocuments.GetSpecificDocument<XFlowerRankDocument>(XFlowerRankDocument.uuID);
				bool flag2 = specificDocument.View != null && specificDocument.View.IsVisible();
				if (flag2)
				{
					specificDocument.View.ReReqRank();
				}
			}
			else
			{
				bool flag3 = oRes.errorcode == ErrorCode.ERR_ITEM_NEED_DIAMOND;
				if (flag3)
				{
					DlgBase<XFlowerSendView, XFlowerSendBehaviour>.singleton.ShowGoToMallError(oArg);
				}
				else
				{
					bool flag4 = oRes.errorcode == ErrorCode.ERR_ITEM_NOT_ENOUGH;
					if (flag4)
					{
						DlgBase<XFlowerSendView, XFlowerSendBehaviour>.singleton.FlowerNotEnough(oArg);
					}
					else
					{
						bool flag5 = oRes.errorcode == ErrorCode.ERR_SHOP_LACKMONEY;
						if (flag5)
						{
							DlgBase<XFlowerSendView, XFlowerSendBehaviour>.singleton.ShowLackMoneyError();
						}
						else
						{
							XSingleton<UiUtility>.singleton.ShowSystemTip(oRes.errorcode, "fece00");
						}
					}
				}
			}
		}

		protected override void OnReconnected(XReconnectedEventArgs arg)
		{
		}
	}
}