summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/XGuildRedPakageLogView.cs
blob: 7e6c2dc49500710fc8df42886f2b454961f5d899 (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
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient.UI
{
	internal class XGuildRedPakageLogView : DlgHandlerBase
	{
		public ILogSource LogSource
		{
			set
			{
				this.m_LogSource = value;
			}
		}

		private ILogSource m_LogSource;

		private XGuildRedPacketDocument _Doc;

		private IXUIWrapContent m_WrapContent;

		private IXUIScrollView m_ScrollView;

		private Vector3 startPos = new Vector3(-96f, 0f, 0f);

		protected override void Init()
		{
			this._Doc = XDocuments.GetSpecificDocument<XGuildRedPacketDocument>(XGuildRedPacketDocument.uuID);
			this.m_ScrollView = (base.PanelObject.transform.Find("LogMenu/Panel").GetComponent("XUIScrollView") as IXUIScrollView);
			this.m_WrapContent = (base.PanelObject.transform.Find("LogMenu/Panel/WrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent);
			this.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this._WrapContentItemUpdated));
		}

		protected override void OnShow()
		{
			base.OnShow();
		}

		protected override void OnHide()
		{
			base.OnHide();
		}

		public void Refresh()
		{
			List<ILogData> logList = this.m_LogSource.GetLogList();
			int count = logList.Count;
			this.m_WrapContent.SetContentCount(count, false);
			this.m_ScrollView.ResetPosition();
		}

		private void _WrapContentItemUpdated(Transform t, int index)
		{
			List<ILogData> logList = this.m_LogSource.GetLogList();
			bool flag = index < 0 || index >= logList.Count;
			if (!flag)
			{
				XGuildRedPacketLog xguildRedPacketLog = logList[index] as XGuildRedPacketLog;
				IXUILabelSymbol ixuilabelSymbol = t.Find("Content").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
				IXUILabel ixuilabel = t.Find("Time").GetComponent("XUILabel") as IXUILabel;
				IXUILabelSymbol ixuilabelSymbol2 = t.Find("Gold").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
				IXUISprite ixuisprite = t.Find("mvp").GetComponent("XUISprite") as IXUISprite;
				ixuilabelSymbol.RegisterNameEventHandler(new HyperLinkClickEventHandler(this._NameClick));
				bool flag2 = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID == xguildRedPacketLog.uid;
				if (flag2)
				{
					ixuilabelSymbol.InputText = XStringDefineProxy.GetString("YOU");
				}
				else
				{
					ixuilabelSymbol.InputText = XLabelSymbolHelper.FormatName(xguildRedPacketLog.name, xguildRedPacketLog.uid, "00ffff");
				}
				Vector3 localPosition = this.startPos;
				bool flag3 = this._Doc.CheckLuckest(xguildRedPacketLog.uid);
				if (flag3)
				{
					ixuisprite.SetVisible(true);
					ixuisprite.gameObject.transform.localPosition = localPosition;
					localPosition.x += (float)(ixuisprite.spriteWidth + 10);
				}
				else
				{
					ixuisprite.SetVisible(false);
				}
				ixuilabelSymbol2.InputText = XLabelSymbolHelper.FormatCostWithIcon(xguildRedPacketLog.itemcount, (ItemEnum)xguildRedPacketLog.itemid);
				ixuilabel.SetText(string.Empty);
			}
		}

		public override void RegisterEvent()
		{
			Transform transform = base.PanelObject.transform.Find("Close");
			bool flag = transform != null;
			if (flag)
			{
				IXUIButton ixuibutton = transform.GetComponent("XUIButton") as IXUIButton;
				ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCloseBtnClick));
			}
		}

		private bool _OnCloseBtnClick(IXUIButton go)
		{
			base.SetVisible(false);
			return true;
		}

		private void _NameClick(string param)
		{
			string text = "";
			ulong num = 0UL;
			bool flag = XLabelSymbolHelper.ParseNameParam(param, ref text, ref num);
			if (flag)
			{
				bool flag2 = num == XSingleton<XEntityMgr>.singleton.Player.Attributes.EntityID;
				if (!flag2)
				{
					XCharacterCommonMenuDocument.ReqCharacterMenuInfo(num, false);
				}
			}
		}
	}
}