summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/GVGDuelHandlerBase.cs
blob: 3f23e1545560f9cf7725bd400dd9d8042bd39797 (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
using System;
using UILib;
using UnityEngine;

namespace XMainClient.UI
{
	internal class GVGDuelHandlerBase : DlgHandlerBase
	{
		private IXUIWrapContent _WrapContent;

		private IXUIScrollView _WrapScroll;

		private Transform _emptyTransform;

		protected IXUILabel m_DuelHelp;

		private GVGDuelWrapDisplay _display;

		protected override void Init()
		{
			this._WrapScroll = (base.transform.Find("DuelList").GetComponent("XUIScrollView") as IXUIScrollView);
			this._WrapContent = (base.transform.Find("DuelList/WrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent);
			this.m_DuelHelp = (base.transform.Find("Intro").GetComponent("XUILabel") as IXUILabel);
			this._emptyTransform = base.transform.Find("UnApply");
			this._WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.OnItemWrapContentUpdate));
		}

		public override void OnUnload()
		{
			bool flag = this._display != null;
			if (flag)
			{
				this._display.Recycle();
				this._display = null;
			}
			base.OnUnload();
		}

		public override void RefreshData()
		{
			int duelInfoSize = this.GetDuelInfoSize();
			this._WrapContent.SetContentCount(duelInfoSize, false);
			this._WrapScroll.ResetPosition();
		}

		protected void ShowOrHide(bool active)
		{
			this._emptyTransform.gameObject.SetActive(active);
		}

		protected virtual void OnEnterScene(IXUISprite sprite)
		{
		}

		protected virtual int GetDuelInfoSize()
		{
			return 0;
		}

		protected virtual GVGDuelCombatInfo GetDuelInfo(int index)
		{
			return null;
		}

		private void OnItemWrapContentUpdate(Transform t, int index)
		{
			bool flag = this._display == null;
			if (flag)
			{
				this._display = new GVGDuelWrapDisplay();
			}
			this._display.Setup(t, index, new SpriteClickEventHandler(this.OnEnterScene));
			this._display.Set(this.GetDuelInfo(index));
		}
	}
}