summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs94
1 files changed, 94 insertions, 0 deletions
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<XPostEffectMgr>
+ {
+ private XRadialBlur _radialBlur;
+
+ private XBlackWhite _blackWhite;
+
+ private XGausBlur _gausBlur;
+
+ public void OnEnterScene(uint sceneid)
+ {
+ bool flag = XSingleton<XScene>.singleton.GameCamera.UnityCamera != null;
+ if (flag)
+ {
+ GameObject gameObject = XSingleton<XScene>.singleton.GameCamera.UnityCamera.gameObject;
+ bool flag2 = gameObject != null;
+ if (flag2)
+ {
+ this._gausBlur = gameObject.GetComponent<XGausBlur>();
+ bool flag3 = this._gausBlur == null;
+ if (flag3)
+ {
+ this._gausBlur = gameObject.AddComponent<XGausBlur>();
+ }
+ this._gausBlur.shader = ShaderManager._gausBlur;
+ this._gausBlur.enabled = false;
+ this._blackWhite = gameObject.GetComponent<XBlackWhite>();
+ bool flag4 = this._blackWhite == null;
+ if (flag4)
+ {
+ this._blackWhite = gameObject.AddComponent<XBlackWhite>();
+ }
+ this._blackWhite.shader = ShaderManager._blackWhite;
+ this._blackWhite.enabled = false;
+ this._radialBlur = gameObject.GetComponent<XRadialBlur>();
+ bool flag5 = this._radialBlur == null;
+ if (flag5)
+ {
+ this._radialBlur = gameObject.AddComponent<XRadialBlur>();
+ }
+ 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;
+ }
+ }
+ }
+ }
+}