From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/UI/BattleVoiceHandler.cs | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/BattleVoiceHandler.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/BattleVoiceHandler.cs') 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.singleton.m_uiTool); + + public Dictionary dic = new Dictionary(); + + 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 _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.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); + } + } + } + } + } +} -- cgit v1.1-26-g67d0