diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/UI/BattleVoiceHandler.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/UI/BattleVoiceHandler.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/UI/BattleVoiceHandler.cs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/UI/BattleVoiceHandler.cs b/Client/Assets/Scripts/XMainClient/UI/BattleVoiceHandler.cs new file mode 100644 index 00000000..c4e58e7d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/BattleVoiceHandler.cs @@ -0,0 +1,67 @@ +using System;
+using System.Collections.Generic;
+using KKSG;
+using UILib;
+using UnityEngine;
+using XMainClient.UI.UICommon;
+using XUtliPoolLib;
+
+namespace XMainClient.UI
+{
+ internal class BattleVoiceHandler : DlgHandlerBase
+ {
+ public GameObject tpl;
+
+ private XUIPool m_pool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
+
+ public Dictionary<ulong, BattleVoiceNode> dic = new Dictionary<ulong, BattleVoiceNode>();
+
+ protected override void Init()
+ {
+ base.Init();
+ this.tpl = base.PanelObject.transform.Find("tpl").gameObject;
+ this.m_pool.SetupPool(this.tpl.transform.parent.gameObject, this.tpl, 2u, true);
+ }
+
+ public void Refresh(List<VoipRoomMember> _server)
+ {
+ this.dic.Clear();
+ this.m_pool.ReturnAll(false);
+ for (int i = 0; i < _server.Count; i++)
+ {
+ GameObject gameObject = this.m_pool.FetchGameObject(false);
+ gameObject.transform.localPosition = new Vector3(-147f, (float)(10 - 40 * i), 0f);
+ IXUILabel ixuilabel = gameObject.GetComponent("XUILabel") as IXUILabel;
+ ixuilabel.SetText(_server[i].name);
+ GameObject gameObject2 = gameObject.transform.Find("voice").gameObject;
+ gameObject2.SetActive(true);
+ GameObject gameObject3 = gameObject.transform.Find("speak").gameObject;
+ gameObject3.SetActive(false);
+ BattleVoiceNode battleVoiceNode = new BattleVoiceNode();
+ battleVoiceNode.memberid = _server[i].memberID;
+ battleVoiceNode.sign = false;
+ battleVoiceNode.roleid = _server[i].roleID;
+ battleVoiceNode.speak = gameObject3;
+ battleVoiceNode.voice = gameObject2;
+ this.dic.Add(battleVoiceNode.roleid, battleVoiceNode);
+ }
+ }
+
+ public void Play(ulong[] roleids, int[] states)
+ {
+ bool flag = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded();
+ if (flag)
+ {
+ for (int i = 0; i < roleids.Length; i++)
+ {
+ bool flag2 = this.dic.ContainsKey(roleids[i]);
+ if (flag2)
+ {
+ this.dic[roleids[i]].speak.SetActive(states[i] == 2);
+ this.dic[roleids[i]].voice.SetActive(states[i] == 1);
+ }
+ }
+ }
+ }
+ }
+}
|