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/RadioBattleDlg.cs | 178 +++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/RadioBattleDlg.cs (limited to 'Client/Assets/Scripts/XMainClient/RadioBattleDlg.cs') diff --git a/Client/Assets/Scripts/XMainClient/RadioBattleDlg.cs b/Client/Assets/Scripts/XMainClient/RadioBattleDlg.cs new file mode 100644 index 00000000..e28a401c --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/RadioBattleDlg.cs @@ -0,0 +1,178 @@ +using System; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class RadioBattleDlg : DlgBase + { + private XRadioDocument radioDocument + { + get + { + return XDocuments.GetSpecificDocument(XRadioDocument.uuID); + } + } + + public override string fileName + { + get + { + return "Common/RadioBattleDlg"; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + public override bool isMainUI + { + get + { + return true; + } + } + + public override bool isHideChat + { + get + { + return false; + } + } + + private int open_level = 2; + + protected override void Init() + { + base.Init(); + } + + public void Show(bool show) + { + if (show) + { + XApolloDocument specificDocument = XDocuments.GetSpecificDocument(XApolloDocument.uuID); + XOptionsDocument specificDocument2 = XDocuments.GetSpecificDocument(XOptionsDocument.uuID); + bool flag = specificDocument != null && specificDocument2 != null; + if (flag) + { + bool isRealVoice = specificDocument.IsRealVoice; + bool flag2 = DlgBase.singleton.IsVisible() && !isRealVoice && XSingleton.singleton.SceneID != 100u && (ulong)XSingleton.singleton.XPlayerData.Level >= (ulong)((long)this.open_level) && specificDocument2.GetValue(XOptionsDefine.OD_RADIO) == 1; + if (flag2) + { + this.SetVisible(true, true); + } + } + } + else + { + this.SetVisible(false, true); + } + } + + protected override void OnShow() + { + base.OnShow(); + base.uiBehaviour.m_objSelect.SetActive(false); + XChatDocument specificDocument = XDocuments.GetSpecificDocument(XChatDocument.uuID); + int type = XFastEnumIntEqualityComparer.ToInt(XSingleton.singleton.SceneType); + ChatOpen.RowData yuyinRaw = specificDocument.GetYuyinRaw(type); + XPlayerAttributes xplayerAttributes = XSingleton.singleton.Player.Attributes as XPlayerAttributes; + int num = 0; + bool flag = !XSingleton.singleton.CanAutoPlay(XSingleton.singleton.SceneID) && DlgBase.singleton.IsVisible() && yuyinRaw.id == 2u; + if (flag) + { + num = -60; + } + base.uiBehaviour.m_objSelect.transform.localPosition = new Vector3((float)(yuyinRaw.radioX + num), (float)yuyinRaw.radioY, 0f); + base.uiBehaviour.m_btnRadio.gameObject.transform.transform.localPosition = new Vector3((float)(yuyinRaw.radioX + num), (float)yuyinRaw.radioY, 0f); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + base.uiBehaviour.m_btnRadio.RegisterClickEventHandler(new ButtonClickEventHandler(this.Toggle)); + base.uiBehaviour.m_btnOpen.RegisterClickEventHandler(new ButtonClickEventHandler(this.OpenRadio)); + base.uiBehaviour.m_btnClose.RegisterClickEventHandler(new ButtonClickEventHandler(this.CloseRadio)); + } + + private bool Toggle(IXUIButton btn) + { + bool flag = base.IsVisible(); + if (flag) + { + bool activeSelf = base.uiBehaviour.m_objSelect.activeSelf; + if (activeSelf) + { + base.uiBehaviour.m_objSelect.SetActive(false); + } + else + { + base.uiBehaviour.m_objSelect.SetActive(true); + } + } + return true; + } + + private bool CloseRadio(IXUIButton btn) + { + bool flag = base.IsVisible(); + if (flag) + { + base.uiBehaviour.m_objSelect.SetActive(false); + this.Refresh(false); + } + return true; + } + + private bool OpenRadio(IXUIButton btn) + { + bool flag = base.IsVisible(); + if (flag) + { + base.uiBehaviour.m_objSelect.SetActive(false); + this.Refresh(true); + } + return true; + } + + private void Refresh(bool open) + { + if (open) + { + bool isBroadcast = DlgBase.singleton.isBroadcast; + if (isBroadcast) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_FM_FORBID2"), "fece00"); + } + else + { + bool flag = this.radioDocument.roomState == XRadioDocument.BigRoomState.OutRoom; + if (flag) + { + this.radioDocument.JoinBigRoom(); + } + } + } + else + { + bool flag2 = this.radioDocument.roomState == XRadioDocument.BigRoomState.InRoom; + if (flag2) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("FM_LEAVE_SUCCESS"), "fece00"); + this.radioDocument.QuitBigRoom(); + } + } + } + } +} -- cgit v1.1-26-g67d0