From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/XSwitchSight.cs | 71 +++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XSwitchSight.cs (limited to 'Client/Assets/Scripts/XMainClient/XSwitchSight.cs') diff --git a/Client/Assets/Scripts/XMainClient/XSwitchSight.cs b/Client/Assets/Scripts/XMainClient/XSwitchSight.cs new file mode 100644 index 00000000..971b41b7 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XSwitchSight.cs @@ -0,0 +1,71 @@ +using System; +using UILib; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XSwitchSight + { + private ButtonClickEventHandler buttonClick; + + public XSwitchSight(ButtonClickEventHandler eventHandler, IXUIButton Btn25D, IXUIButton Btn3D, IXUIButton Btn3DFree = null) + { + this.buttonClick = eventHandler; + bool flag = Btn3DFree != null; + if (flag) + { + Btn25D.ID = (ulong)((long)XFastEnumIntEqualityComparer.ToInt(XOperationMode.X25D)); + Btn25D.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSwitchSightClick)); + Btn3D.ID = (ulong)((long)XFastEnumIntEqualityComparer.ToInt(XOperationMode.X3D)); + Btn3D.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSwitchSightClick)); + Btn3DFree.ID = (ulong)((long)XFastEnumIntEqualityComparer.ToInt(XOperationMode.X3D_Free)); + Btn3DFree.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSwitchSightClick)); + } + else + { + Btn25D.ID = (ulong)((long)XFastEnumIntEqualityComparer.ToInt(XOperationMode.X3D)); + Btn25D.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSwitchSightClick)); + Btn3D.ID = (ulong)((long)XFastEnumIntEqualityComparer.ToInt(XOperationMode.X25D)); + Btn3D.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSwitchSightClick)); + } + } + + public bool OnSwitchSightClick(IXUIButton sp) + { + bool isPlaying = XSingleton.singleton.IsPlaying; + bool result; + if (isPlaying) + { + result = false; + } + else + { + SceneTable.RowData sceneData = XSingleton.singleton.GetSceneData(XSingleton.singleton.SceneID); + bool flag = sceneData != null && sceneData.ShieldSight != null; + if (flag) + { + for (int i = 0; i < sceneData.ShieldSight.Length; i++) + { + bool flag2 = (int)sp.ID == (int)sceneData.ShieldSight[i]; + if (flag2) + { + XSingleton.singleton.ShowSystemTip(XSingleton.singleton.GetString("OPTION_SHIELD_SIGHT"), "fece00"); + return false; + } + } + } + XOptionsDocument specificDocument = XDocuments.GetSpecificDocument(XOptionsDocument.uuID); + bool flag3 = (int)sp.ID != specificDocument.GetValue(XOptionsDefine.OD_VIEW); + if (flag3) + { + specificDocument.SetValue(XOptionsDefine.OD_VIEW, (int)sp.ID, false); + specificDocument.SetBattleOptionValue(); + } + this.buttonClick(sp); + result = true; + } + return result; + } + } +} -- cgit v1.1-26-g67d0