blob: ae7bbdf9b97a84243ea7731359bde3ea22b5056a (
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
126
127
128
129
130
131
132
133
134
135
136
|
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
namespace XMainClient
{
internal class XSystemTipView : DlgBase<XSystemTipView, XSystemTipBehaviour>
{
public override string fileName
{
get
{
return "GameSystem/SystemTip";
}
}
public override bool autoload
{
get
{
return true;
}
}
public override bool isHideChat
{
get
{
return false;
}
}
public override bool needOnTop
{
get
{
return true;
}
}
private XSystemTipDocument _doc;
private int _showCount;
private GameObject _preTip = null;
private int _count;
private readonly float DEFAULT_INTERVAL = 0.4f;
private float m_Time;
private float m_Interval;
protected override void Init()
{
base.Init();
this._doc = XDocuments.GetSpecificDocument<XSystemTipDocument>(XSystemTipDocument.uuID);
}
protected override void OnShow()
{
base.uiBehaviour.m_TipPool.ReturnAll(false);
this._showCount = 0;
this._count = 0;
this.m_Time = 0f;
this._preTip = null;
this.m_Interval = this.DEFAULT_INTERVAL;
}
public void ShowTip(string text)
{
GameObject gameObject = base.uiBehaviour.m_TipPool.FetchGameObject(false);
gameObject.transform.localPosition = base.uiBehaviour.m_TipPool.TplPos;
IXUISprite ixuisprite = gameObject.transform.GetComponent("XUISprite") as IXUISprite;
ixuisprite.spriteDepth = this._count;
IXUILabel ixuilabel = gameObject.transform.Find("Text").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(text);
ixuilabel.spriteDepth = this._count + 1;
bool flag = this._preTip != null;
if (flag)
{
bool activeSelf = this._preTip.activeSelf;
if (activeSelf)
{
this._preTip.transform.parent = gameObject.transform;
}
}
this._preTip = gameObject;
IXUITweenTool ixuitweenTool = gameObject.transform.GetComponent("XUIPlayTween") as IXUITweenTool;
ixuitweenTool.SetTargetGameObject(gameObject);
ixuitweenTool.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnPlayTweenFinish));
ixuitweenTool.PlayTween(true, -1f);
this._showCount++;
this._count += 2;
}
private void OnPlayTweenFinish(IXUITweenTool iPlayTween)
{
bool flag = !base.IsVisible();
if (!flag)
{
base.uiBehaviour.m_TipPool.ReturnInstance(iPlayTween.gameObject, true);
this._showCount--;
bool flag2 = this._showCount == 0;
if (flag2)
{
this.SetVisible(false, true);
}
}
}
public override void OnUpdate()
{
base.OnUpdate();
bool flag = Time.time - this.m_Time > this.m_Interval;
if (flag)
{
string empty = string.Empty;
bool flag2 = this._doc.TryGetTip(ref empty);
if (flag2)
{
this.ShowTip(empty);
int leftCount = this._doc.LeftCount;
bool flag3 = leftCount > 3;
if (flag3)
{
this.m_Interval = this.DEFAULT_INTERVAL - 0.1f * (float)(leftCount - 3);
}
this.m_Time = Time.time;
}
}
}
}
}
|