summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XPostEffectMgr.cs
blob: 3e888f6110c0e754636c293bf8ea7fd3787b85a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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;
			}
			}
		}
	}
}