private void OnEnable()
 {
     if (this.m_ScreenEffectsMgr == null)
     {
         this.m_ScreenEffectsMgr = ScreenEffectsMgr.Get();
     }
     ScreenEffectsMgr.RegisterScreenEffect(this);
 }
 private void OnDestroy()
 {
     s_Instance = null;
     if (m_ActiveScreenEffects != null)
     {
         m_ActiveScreenEffects.Clear();
         m_ActiveScreenEffects = null;
     }
 }
 private void OnDisable()
 {
     if (this.m_ScreenEffectsMgr == null)
     {
         this.m_ScreenEffectsMgr = ScreenEffectsMgr.Get();
     }
     if (this.m_ScreenEffectsMgr != null)
     {
         ScreenEffectsMgr.UnRegisterScreenEffect(this);
     }
 }
 private void Awake()
 {
     s_Instance = this;
     if (m_ActiveScreenEffects == null)
     {
         m_ActiveScreenEffects = new List <ScreenEffect>();
     }
     if (!SystemInfo.supportsRenderTextures && (SystemInfo.graphicsDeviceName != "Null Device"))
     {
         base.enabled = false;
     }
 }
Esempio n. 5
0
 private void Awake()
 {
     if (ScreenEffectsMgr.Get() == null)
     {
         base.enabled = false;
     }
     if (this.m_MaskShader == null)
     {
         this.m_MaskShader = Shader.Find("Hidden/ScreenEffectsMask");
         if (this.m_MaskShader == null)
         {
             Debug.LogError("Failed to load ScreenEffectsRender Shader: Hidden/ScreenEffectsMask");
         }
     }
 }
Esempio n. 6
0
    private void Update()
    {
        bool flag = false;

        foreach (Camera camera in Camera.allCameras)
        {
            FullScreenEffects component = camera.GetComponent <FullScreenEffects>();
            if ((component != null) && component.enabled)
            {
                flag = true;
            }
        }
        if (this.m_GuiText == null)
        {
            GameObject obj2 = new GameObject("FPS")
            {
                transform = { position = Vector3.zero }
            };
            this.m_GuiText = obj2.AddComponent <GUIText>();
            SceneUtils.SetHideFlags(obj2, HideFlags.HideAndDontSave);
            this.m_GuiText.pixelOffset = new Vector2(Screen.width * 0.7f, 15f);
        }
        this.frames++;
        float realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup;

        if (realtimeSinceStartup > (this.m_LastInterval + this.m_UpdateInterval))
        {
            float num3 = ((float)this.frames) / (realtimeSinceStartup - ((float)this.m_LastInterval));
            if (this.m_verbose)
            {
                this.m_fpsText = string.Format("{0:f2} - {1} frames over {2}sec", num3, this.frames, this.m_UpdateInterval);
            }
            else
            {
                this.m_fpsText = string.Format("{0:f2}", num3);
            }
            this.frames         = 0;
            this.m_LastInterval = realtimeSinceStartup;
        }
        string fpsText = this.m_fpsText;

        if (this.m_FrameCountActive || (this.m_FrameCount > 0))
        {
            if (this.m_FrameCountActive)
            {
                this.m_FrameCountTime += ((realtimeSinceStartup - this.m_FrameCountLastTime) / 60f) * UnityEngine.Time.timeScale;
                if (this.m_FrameCountLastTime == 0f)
                {
                    this.m_FrameCountLastTime = realtimeSinceStartup;
                }
                this.m_FrameCount = Mathf.CeilToInt(this.m_FrameCountTime * 60f);
            }
            fpsText = string.Format("{0} - Frame Count: {1}", fpsText, this.m_FrameCount);
        }
        if (flag)
        {
            fpsText = string.Format("{0} - FSE", fpsText);
        }
        if (ScreenEffectsMgr.Get() != null)
        {
            int activeScreenEffectsCount = ScreenEffectsMgr.Get().GetActiveScreenEffectsCount();
            if ((activeScreenEffectsCount > 0) && ScreenEffectsMgr.Get().gameObject.activeSelf)
            {
                fpsText = string.Format("{0} - ScreenEffects Active: {1}", fpsText, activeScreenEffectsCount);
            }
        }
        this.m_GuiText.text = fpsText;
    }
 private void Awake()
 {
     this.m_ScreenEffectsMgr = ScreenEffectsMgr.Get();
 }