From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/BarrageBehaviour.cs | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/BarrageBehaviour.cs (limited to 'Client/Assets/Scripts/XMainClient/BarrageBehaviour.cs') diff --git a/Client/Assets/Scripts/XMainClient/BarrageBehaviour.cs b/Client/Assets/Scripts/XMainClient/BarrageBehaviour.cs new file mode 100644 index 00000000..d3c7d92c --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/BarrageBehaviour.cs @@ -0,0 +1,42 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class BarrageBehaviour : DlgBehaviourBase + { + public Transform m_tranLeftBound; + + public Transform m_tranRightBound; + + public IXUILabel m_lblTpl; + + public GameObject m_objQueueTpl; + + public GameObject[] m_objQueue; + + public XUIPool m_pool = new XUIPool(XSingleton.singleton.m_uiTool); + + private void Awake() + { + this.m_tranLeftBound = base.transform.Find("Bg/left"); + this.m_tranRightBound = base.transform.Find("Bg/right"); + this.m_lblTpl = (base.transform.Find("Bg/Text").GetComponent("XUILabel") as IXUILabel); + this.m_objQueueTpl = base.transform.Find("Bg/queue").gameObject; + this.m_pool.SetupPool(this.m_objQueueTpl.transform.parent.gameObject, this.m_objQueueTpl, 3u, true); + } + + public void SetupPool() + { + this.m_objQueue = new GameObject[BarrageDlg.MAX_QUEUE_CNT]; + for (int i = 0; i < BarrageDlg.MAX_QUEUE_CNT; i++) + { + this.m_objQueue[i] = this.m_pool.FetchGameObject(false); + this.m_objQueue[i].transform.localPosition = new Vector3(0f, (float)(320 - 40 * i), 0f); + } + } + } +} -- cgit v1.1-26-g67d0