summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XChatVoiceStatusView.cs
blob: d40678f0fed8e815d205bbe86b18146071513aff (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
using System;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XChatVoiceStatusView : DlgBase<XChatVoiceStatusView, XChatVoiceStatusBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "GameSystem/ChatVoiceStatus";
			}
		}

		public override int group
		{
			get
			{
				return 1;
			}
		}

		public override bool autoload
		{
			get
			{
				return true;
			}
		}

		public override bool isHideChat
		{
			get
			{
				return false;
			}
		}

		public bool IsNormalHide { get; set; }

		protected override void OnShow()
		{
			base.OnShow();
			int num = 0;
			while ((long)num < (long)((ulong)XChatVoiceStatusBehaviour.MAX_VOL_NUM))
			{
				base.uiBehaviour.m_Volume[num].SetVisible(false);
				num++;
			}
			this.IsNormalHide = false;
		}

		protected override void OnUnload()
		{
			bool flag = !this.IsNormalHide;
			if (flag)
			{
				XSingleton<XChatApolloMgr>.singleton.StopRecord(true);
			}
			this.IsNormalHide = false;
		}

		public void SetNormalHide(bool normal)
		{
			this.IsNormalHide = normal;
		}

		public void OnSetVolume(uint volume)
		{
			bool flag = !base.IsLoaded() || !base.IsVisible();
			if (!flag)
			{
				bool flag2 = volume > XChatVoiceStatusBehaviour.MAX_VOL_NUM;
				if (flag2)
				{
					volume = XChatVoiceStatusBehaviour.MAX_VOL_NUM;
				}
				else
				{
					bool flag3 = volume <= 0u;
					if (flag3)
					{
						volume = 1u;
					}
				}
				int num = 0;
				while ((long)num < (long)((ulong)XChatVoiceStatusBehaviour.MAX_VOL_NUM))
				{
					bool flag4 = base.uiBehaviour.m_Volume[num] != null;
					if (flag4)
					{
						bool flag5 = (long)num < (long)((ulong)volume);
						if (flag5)
						{
							base.uiBehaviour.m_Volume[num].SetVisible(true);
						}
						else
						{
							base.uiBehaviour.m_Volume[num].SetVisible(false);
						}
					}
					num++;
				}
			}
		}
	}
}