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

namespace XMainClient.UI
{
	public class EncourageShowInfo
	{
		public uint EncourageCount
		{
			get
			{
				return this._battleSource.GetEncourageCount(this._index);
			}
		}

		public bool Valid
		{
			get
			{
				return this._valid;
			}
			set
			{
				this._valid = value;
				this.ReqEncourage = null;
				this._encourageTransform.gameObject.SetActive(value);
				this._buffTransfrom.gameObject.SetActive(value);
			}
		}

		public IWorldBossBattleSource BattleSource
		{
			get
			{
				return this._battleSource;
			}
			set
			{
				this._battleSource = value;
			}
		}

		public string attr_string;

		public string cost_string;

		public string encourage_type;

		public string encourage_title;

		public string encourage_effect;

		private IWorldBossBattleSource _battleSource;

		private bool _valid = true;

		private IXUIButton _courageBtn;

		private IXUILabel _courageValueText;

		private IXUITweenTool _courageValueTween;

		private IXUILabel _courageLabel;

		private Transform _encourageTransform;

		private Transform _buffTransfrom;

		private int _index;

		public Action ReqEncourage = null;

		public bool isNeedGuild = false;

		public EncourageShowInfo(Transform encourage, Transform buff, int index)
		{
			this._index = index;
			this._encourageTransform = encourage;
			this._buffTransfrom = buff;
			this._courageBtn = (encourage.GetComponent("XUIButton") as IXUIButton);
			this._courageValueText = (buff.transform.Find("buff").GetComponent("XUILabel") as IXUILabel);
			this._courageValueTween = (buff.transform.Find("buff").GetComponent("XUIPlayTween") as IXUITweenTool);
			this._courageLabel = (buff.transform.Find("text").GetComponent("XUILabel") as IXUILabel);
			this._courageValueText.SetText("0%");
			this._courageBtn.ID = (ulong)((long)index);
		}

		public void RegisterCourageClick(ButtonClickEventHandler handler)
		{
			bool flag = this._courageBtn != null;
			if (flag)
			{
				this._courageBtn.RegisterClickEventHandler(handler);
			}
		}

		public void SetEncourageValue(int attrValue)
		{
			this._courageLabel.SetText(XStringDefineProxy.GetString(this.encourage_title));
			this._courageValueText.SetVisible(true);
			this._courageValueText.SetText(string.Format("{0}%", (long)attrValue * (long)((ulong)this.EncourageCount)));
			this._courageValueTween.ResetTween(true);
			this._courageValueTween.PlayTween(true, 0.5f);
		}

		public void OnDispose()
		{
			this.ReqEncourage = null;
		}
	}
}