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
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class BarrageItem : DlgBehaviourBase
{
private List<string> m_colors = new List<string>();
private List<int> m_sizes = new List<int>();
public IXUILabel label;
public GameObject outline;
public Transform cacheTrans;
private BarrageQueue mQueue;
private int labelWidth = 10;
private Vector3 start;
private Vector3 end;
private float t_start;
private float t_cnt;
public void Awake()
{
this.cacheTrans = base.transform;
this.label = (this.cacheTrans.GetComponent("XUILabel") as IXUILabel);
this.outline = this.cacheTrans.Find("me").gameObject;
this.m_colors = XSingleton<XGlobalConfig>.singleton.GetStringList("BarrageColors");
this.m_sizes = XSingleton<XGlobalConfig>.singleton.GetIntList("BarrageSize");
}
public void Make(string txt, BarrageQueue queue, bool outl)
{
this.mQueue = queue;
int index = UnityEngine.Random.Range(0, this.m_colors.Count);
int fontSize = UnityEngine.Random.Range(this.m_sizes[0], this.m_sizes[1]);
txt = XSingleton<XCommon>.singleton.StringCombine(this.m_colors[index], txt, "[-]");
this.label.SetText(txt);
this.label.spriteDepth = queue.depth;
this.label.fontSize = fontSize;
this.label.SetDepthOffset(queue.queueCnt);
this.labelWidth = this.label.spriteWidth;
this.start = base.transform.localPosition;
this.end = new Vector3(this.start.x - (float)(this.labelWidth * 2) - 1136f, this.start.y, this.start.z);
this.t_start = Time.time;
this.t_cnt = (float)BarrageDlg.MOVE_TIME;
this.outline.SetActive(outl);
}
public void Update()
{
bool flag = DlgBase<BarrageDlg, BarrageBehaviour>.singleton.IsOutScreen(this.cacheTrans.localPosition.x + (float)this.labelWidth);
if (flag)
{
bool flag2 = this.mQueue != null;
if (flag2)
{
this.mQueue.FadeOut(this);
}
DlgBase<BarrageDlg, BarrageBehaviour>.singleton.RecycleItem(this);
}
else
{
bool flag3 = this.cacheTrans != null;
if (flag3)
{
this.cacheTrans.localPosition = Vector3.Lerp(this.start, this.end, (Time.time - this.t_start) / this.t_cnt);
}
}
}
public void Drop()
{
bool flag = base.gameObject != null;
if (flag)
{
UnityEngine.Object.Destroy(base.gameObject);
}
}
}
}
|