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/XPostEffectMgr.cs | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs (limited to 'Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs') diff --git a/Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs b/Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs new file mode 100644 index 00000000..3e888f61 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs @@ -0,0 +1,94 @@ +using System; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient +{ + public class XPostEffectMgr : XSingleton + { + private XRadialBlur _radialBlur; + + private XBlackWhite _blackWhite; + + private XGausBlur _gausBlur; + + public void OnEnterScene(uint sceneid) + { + bool flag = XSingleton.singleton.GameCamera.UnityCamera != null; + if (flag) + { + GameObject gameObject = XSingleton.singleton.GameCamera.UnityCamera.gameObject; + bool flag2 = gameObject != null; + if (flag2) + { + this._gausBlur = gameObject.GetComponent(); + bool flag3 = this._gausBlur == null; + if (flag3) + { + this._gausBlur = gameObject.AddComponent(); + } + this._gausBlur.shader = ShaderManager._gausBlur; + this._gausBlur.enabled = false; + this._blackWhite = gameObject.GetComponent(); + bool flag4 = this._blackWhite == null; + if (flag4) + { + this._blackWhite = gameObject.AddComponent(); + } + this._blackWhite.shader = ShaderManager._blackWhite; + this._blackWhite.enabled = false; + this._radialBlur = gameObject.GetComponent(); + bool flag5 = this._radialBlur == null; + if (flag5) + { + this._radialBlur = gameObject.AddComponent(); + } + this._radialBlur.shader = ShaderManager._radialBlur; + this._radialBlur.enabled = false; + } + } + } + + public void OnLeaveScene() + { + this._radialBlur = null; + this._blackWhite = null; + this._gausBlur = null; + } + + public void MakeEffectEnable(XPostEffect effect, bool enabled) + { + bool quality = XQualitySetting.GetQuality(EFun.ECamera); + switch (effect) + { + case XPostEffect.RadialBlur: + { + bool flag = this._radialBlur != null; + if (flag) + { + this._radialBlur.enabled = (quality && enabled); + } + break; + } + case XPostEffect.BlackWhite: + { + bool flag2 = this._blackWhite != null; + if (flag2) + { + this._blackWhite.enabled = (quality && enabled); + } + break; + } + case XPostEffect.GausBlur: + { + bool flag3 = this._gausBlur != null; + if (flag3) + { + this._gausBlur.enabled = (quality && enabled); + } + break; + } + } + } + } +} -- cgit v1.1-26-g67d0