private void InitializeComponents() { spriteManager = new SpriteManager(this); gameObjectManager = new GameObjectManager(this); visualObjectManager = new VisualObjectManager(this, spriteBatch, spriteManager); postEffectManager = new PostProcessManager(this, spriteBatch, mainSurface); particleSystem = new ParticleSystem(this, spriteBatch); stateManager = new StateManager( this, visualObjectManager, gameObjectManager, particleSystem); stateManager.UpdateOrder = 1; gameObjectManager.UpdateOrder = 2; visualObjectManager.UpdateOrder = 3; visualObjectManager.DrawOrder = 1; particleSystem.DrawOrder = 2; particleSystem.UpdateOrder = 4; visualObjectManager.RegisterFactory(new MenuVisualFactory(this)); visualObjectManager.RegisterFactory(new MessageVisualFactory(this)); visualObjectManager.RegisterFactory(new ScrollingBackGroundFactory(this)); // get live sign setup //Components.Add(new GamerServicesComponent(this)); stateManager.SetState(new MainMenuState(stateManager, GraphicsDevice, fontManager, new MenuGamePadController(this))); Components.Add(stateManager); Components.Add(gameObjectManager); Components.Add(visualObjectManager); Components.Add(particleSystem); }
public void Show(IYesNoDialogOwner owner, DialogWindowType type, string label = "label", string description = "description", bool change_effect = true) { this.m_DialogType = type; this.m_DW.m_LabelText.text = label; this.m_DW.m_DescriptionText.text = description; if (type == DialogWindowType.YesNo) { this.m_DW.m_Button1.gameObject.SetActive(true); this.m_DW.m_Button2.gameObject.SetActive(true); this.m_DW.m_Button3.gameObject.SetActive(false); } if (type == DialogWindowType.Ok) { this.m_DW.m_Button1.gameObject.SetActive(false); this.m_DW.m_Button2.gameObject.SetActive(false); this.m_DW.m_Button3.gameObject.SetActive(true); } base.gameObject.SetActive(true); this.m_Screen = owner; this.m_MainCanvasObject = GameObject.Find("MainMenuCanvas"); if (this.m_MainCanvasObject != null) { this.m_MainCanvas = this.m_MainCanvasObject.GetComponent <Canvas>(); this.m_MainCanvas.enabled = false; } this.m_ChangeEffect = change_effect; if (this.m_ChangeEffect) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 1f); } if (this.m_Screen is MainMenuScreen) { Time.timeScale = 0.5f; } }
//Vignette vignette; private void Awake() { if (!instance) { instance = this; } }
private void Close() { base.gameObject.SetActive(false); this.SetCanvasActive(true); UIAudioPlayer.Play(UIAudioPlayer.UISoundType.Click); if (this.m_ChangeEffect) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 0f); } MenuScreen menuScreen = this.m_Screen as MenuScreen; if (menuScreen != null && !menuScreen.m_IsIngame) { Time.timeScale = 1f; } EventSystem current = EventSystem.current; if (current != null) { current.SetSelectedGameObject(null); } InputsManager.Get().UnregisterReceiver(this); IYesNoDialogOwner screen = this.m_Screen; if (screen == null) { return; } screen.OnCloseDialog(); }
private void UpdateDamagePP() { float num = 0f; float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Blood); if (PlayerConditionModule.Get().IsHPCriticalLevel()) { num = CJTools.Math.GetProportionalClamp(0f, 1f, PlayerConditionModule.Get().GetHP(), PlayerConditionModule.Get().m_CriticalLevel, 0f); } if (this.m_LastDamageTime > 0f && Time.time - this.m_LastDamageTime < this.m_DamageEffectDuration) { num = 1f; } if (PlayerInjuryModule.Get().GetAllInjuriesOfState(InjuryState.Bleeding).Count > 0) { num = 1f; } if (weight > 0f && Time.time - this.m_LastDamageTime >= this.m_DamageEffectDuration) { num = Mathf.Max(num, weight - Time.deltaTime * 0.5f); } num = (Player.Get().m_DreamPPActive ? 0f : num); if (num != weight) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, num); } }
private void ToggleUI() { SetUIVisible(!uiVisible); if (uiVisible) { // Fetch components attached to MainCamera List <Component> cameraComponents = new List <Component>(32); CameraManager.Get().m_MainCamera.GetComponents <Component>(cameraComponents); for (int i = cameraComponents.Count - 1; i >= 0; i--) { Component component = cameraComponents[i]; if (!component || excludedComponents.Contains(component.GetType()) || !(component is Behaviour)) { cameraComponents.RemoveAt(i); } //ModAPI.Log.Write( "COMPONENT: " + component ); } skyComponent = TOD_Sky.Instance; components = cameraComponents.ToArray(); postProcessing = PostProcessManager.Get() ? PostProcessManager.Get().GetComponentsInChildren <PostProcessVolume>() : new PostProcessVolume[0]; } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { tick += (float)gameTime.ElapsedGameTime.TotalSeconds; graphics.GraphicsDevice.SetRenderTarget(0, mainSurface); GraphicsDevice.Clear(Color.Black); // componets draw here //================================= base.Draw(gameTime); Texture2D shipTexture = spriteManager.GetSprite("ship0"); spriteBatch.Begin(SpriteBlendMode.AlphaBlend); spriteBatch.Draw(shipTexture, new Rectangle(512, 100, 32, 32), Color.White); spriteBatch.End(); graphics.GraphicsDevice.SetRenderTarget(0, null); //================================= // post drawing postEffectManager.Draw(gameTime); spriteBatch.Begin(SpriteBlendMode.None); PostProcessManager.DrawScreenRect(spriteBatch, postEffectManager.OutPutTexture); spriteBatch.End(); }
public void HideMenu() { if (this.m_CurrentScreen) { this.m_CurrentScreen.Hide(); if (this.m_CurrentScreen.ShouldPauseGame()) { MainLevel.Instance.Pause(false); } } foreach (Type key in this.m_Screens.Keys) { this.m_Screens[key].m_ActiveMenuOption = null; } this.m_CurrentScreen = null; this.m_PreviousScreens.Clear(); Player.Get().UnblockMoves(); Player.Get().UnblockRotation(); CursorManager.Get().SetCursor(CursorManager.TYPE.Normal); if (this.m_CursorVisible) { CursorManager.Get().ShowCursor(false, false); this.m_CursorVisible = false; } this.m_OutlineCamera.enabled = true; PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 0f); InputsManager.Get().m_OmitMouseUp = true; }
public override void OnAnimEvent(AnimEventID id) { base.OnAnimEvent(id); if (id == AnimEventID.DemoHitReaction) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, 1f); } }
private void UpdateDebugDofPP() { float num = this.m_DebugDofPP ? 1f : 0f; if (PostProcessManager.Get().GetWeight(PostProcessManager.Effect.DebugDof) != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.DebugDof, num); } }
private void UpdateDreamPP() { float num = Player.Get().m_DreamPPActive ? 1f : 0f; if (PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Dream) != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Dream, num); } }
public void Show(IYesNoDialogOwner owner, DialogWindowType type, string label = "label", string description = "description", bool change_effect = true) { this.m_DialogType = type; this.m_DW.m_LabelText.text = label; this.m_DW.m_DescriptionText.text = description; if (GreenHellGame.IsPadControllerActive()) { this.m_DW.m_Button1.gameObject.SetActive(false); this.m_DW.m_Button2.gameObject.SetActive(false); this.m_DW.m_Button3.gameObject.SetActive(false); if (type == DialogWindowType.YesNo) { this.m_DW.m_PadButton1.gameObject.SetActive(true); this.m_DW.m_PadButton2.gameObject.SetActive(true); this.m_DW.m_PadButton3.gameObject.SetActive(false); } else if (type == DialogWindowType.Ok) { this.m_DW.m_PadButton1.gameObject.SetActive(false); this.m_DW.m_PadButton2.gameObject.SetActive(false); this.m_DW.m_PadButton3.gameObject.SetActive(true); } } else { this.m_DW.m_PadButton1.gameObject.SetActive(false); this.m_DW.m_PadButton2.gameObject.SetActive(false); this.m_DW.m_PadButton3.gameObject.SetActive(false); if (type == DialogWindowType.YesNo) { this.m_DW.m_Button1.gameObject.SetActive(true); this.m_DW.m_Button2.gameObject.SetActive(true); this.m_DW.m_Button3.gameObject.SetActive(false); } else if (type == DialogWindowType.Ok) { this.m_DW.m_Button1.gameObject.SetActive(false); this.m_DW.m_Button2.gameObject.SetActive(false); this.m_DW.m_Button3.gameObject.SetActive(true); } } base.gameObject.SetActive(true); this.m_Screen = owner; this.SetCanvasActive(false); this.m_ChangeEffect = change_effect; if (this.m_ChangeEffect) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 1f); } MenuScreen menuScreen = this.m_Screen as MenuScreen; if (menuScreen != null && !menuScreen.m_IsIngame) { Time.timeScale = 0.5f; } InputsManager.Get().RegisterReceiver(this); }
private void UpdateUnderwaterPP() { float num = Player.Get().IsCameraUnderwater() ? 1f : 0f; num = (Player.Get().m_DreamPPActive ? 0f : num); if (PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Underwater) != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Underwater, num); } }
private void UpdateNotepadPP() { float num = Player.Get().GetComponent <NotepadController>().IsActive() ? 1f : 0f; float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Notepad); if (weight != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Notepad, weight + (num - weight) * Time.deltaTime * 2f); } }
private void UpdateSanityPP() { float proportionalClamp = CJTools.Math.GetProportionalClamp(0f, 1f, (float)PlayerSanityModule.Get().m_Sanity / 100f, 1f, 0f); float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Sanity); if (weight != proportionalClamp) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Sanity, weight + (proportionalClamp - weight) * Time.deltaTime * 2f); } }
private void UpdateLowEnergyPP() { float num = (PlayerConditionModule.Get().m_Energy >= 10f) ? 0f : 1f; float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.LowEnergy); if (weight != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.LowEnergy, weight + (num - weight) * Time.deltaTime * 2f); } }
public void Update() { if (!this.m_EndDemo && Input.GetKey(KeyCode.RightControl) && Input.GetKeyDown(KeyCode.G)) { PlayableDirector cutscene = CutscenesManager.Get().GetCutscene("DemoEnd_Cutscene"); cutscene.transform.rotation = Player.Get().transform.rotation; cutscene.transform.position = Player.Get().transform.position; Item currentItem = Player.Get().GetCurrentItem(Hand.Right); if (currentItem != null) { Player.Get().SetWantedItem(Hand.Right, null, true); InventoryBackpack.Get().InsertItem(currentItem, null, null, true, true, true, true, true); } currentItem = Player.Get().GetCurrentItem(Hand.Left); if (currentItem != null) { Player.Get().SetWantedItem(Hand.Left, null, true); InventoryBackpack.Get().InsertItem(currentItem, null, null, true, true, true, true, true); } Player.Get().BlockMoves(); Player.Get().BlockRotation(); PlayableDirector cutscene2 = CutscenesManager.Get().GetCutscene("DemoEnd_Cutscene"); this.m_CutsceneDuration = (float)cutscene2.duration - 4.5f; CutscenesManager.Get().PlayCutscene("DemoEnd_Cutscene"); this.m_StartCutsceneTime = Time.time; this.m_EndDemo = true; Player.Get().StartController(PlayerControllerType.PlayerCutscene); } if (this.m_EndDemo) { if (!this.m_FirstHit && Time.time - this.m_StartCutsceneTime >= this.m_FirstHitTime) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, 1f); PlayerConditionModule.Get().DecreaseEnergy(PlayerConditionModule.Get().GetEnergy() * 0.5f); this.m_FirstHit = true; } if (!this.m_SecondHit && Time.time - this.m_StartCutsceneTime >= this.m_SecondHitTime) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, 1f); HUDManager.Get().SetActiveGroup(HUDManager.HUDGroup.TwitchDemo); HUDEndDemo.Get().gameObject.SetActive(false); this.m_SecondHit = true; } if (this.m_SecondHit) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, 1f); } if (Time.time - this.m_StartCutsceneTime >= this.m_CutsceneDuration) { HUDManager.Get().ShowDemoEnd(); this.m_EndDemo = true; } } }
private void UpdateSanityPP() { float num = CJTools.Math.GetProportionalClamp(0f, 1f, (float)PlayerSanityModule.Get().m_Sanity / 100f, 1f, 0f); num = (Player.Get().m_DreamPPActive ? 0f : num); float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Sanity); if (weight != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Sanity, weight + (num - weight) * Time.deltaTime * 2f); } }
private void UpdateGamePP() { float num = (!Player.Get().GetComponent <NotepadController>().IsActive()) ? 1f : 0f; num = (((float)PlayerSanityModule.Get().m_Sanity >= 10f) ? num : 0f); float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Game); if (weight != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Game, weight + (num - weight) * Time.deltaTime * 2f); } }
private void UpdateLowHPPP() { float num = (PlayerConditionModule.Get().m_HP < 10f) ? 1f : 0f; num = (Player.Get().m_DreamPPActive ? 0f : num); float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.LowHP); if (weight != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.LowHP, weight + (num - weight) * Time.deltaTime * 2f); } }
public override void OnTakeDamage(DamageInfo info) { base.OnTakeDamage(info); if (info.m_Blocked) { return; } if (info.m_DamageType != DamageType.Insects && info.m_DamageType != DamageType.Cut && info.m_DamageType != DamageType.Thrust && info.m_DamageType != DamageType.None) { this.m_LastDamageTime = Time.time; PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, 1f); } }
private void UpdateGamePP() { float num = Player.Get().GetComponent <NotepadController>().IsActive() ? 0f : 1f; num = (((float)PlayerSanityModule.Get().m_Sanity < 10f) ? 0f : num); num = (Player.Get().IsCameraUnderwater() ? 0f : num); num = (Player.Get().m_DreamPPActive ? 0f : num); float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Game); if (weight != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Game, weight + (num - weight) * Time.deltaTime * 2f); } }
private void Setup() { if (!setuped) { setuped = true; AudioManager.Instance.Setup(); PostProcessManager.Setup(); InputManager.Setup(); OverwatchManager.Setup(); ThreadTaskQueuer.Setup(); ComputerManager.Instance.Setup(); MenuManager.Instance.Setup(); ScholarManager.Instance.Setup(); } }
private void UpdatePoisonPP() { float num = 0f; PlayerDiseasesModule playerDiseasesModule = PlayerDiseasesModule.Get(); int num2 = (!playerDiseasesModule.GetDisease(ConsumeEffect.FoodPoisoning).IsActive()) ? 0 : playerDiseasesModule.GetDisease(ConsumeEffect.FoodPoisoning).m_Level; if ((float)num2 > 0f) { num = CJTools.Math.GetProportionalClamp(0f, 1f, (float)num2, 0f, this.m_PoisonLevelToMaxEffect); } float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Poison); if (weight != num) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Poison, weight + (num - weight) * Time.deltaTime * 2f); } }
private void Close() { base.gameObject.SetActive(false); this.m_MainCanvasObject = GameObject.Find("MainMenuCanvas"); if (this.m_MainCanvasObject != null) { this.m_MainCanvas = this.m_MainCanvasObject.GetComponent <Canvas>(); this.m_MainCanvas.enabled = true; } if (this.m_ChangeEffect) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 0f); } if (this.m_Screen is MainMenuScreen) { Time.timeScale = 1f; } }
public void HideMenu() { if (this.m_CurrentScreen) { this.m_CurrentScreen.Hide(); if (this.m_CurrentScreen.ShouldPauseGame()) { MainLevel.Instance.Pause(false); } } this.m_CurrentScreen = null; this.m_PrevoiusScreen = null; Player.Get().UnblockMoves(); Player.Get().UnblockRotation(); CursorManager.Get().SetCursor(CursorManager.TYPE.Normal); CursorManager.Get().ShowCursor(false); this.m_OutlineCamera.enabled = true; PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 0f); }
public void ShowScreen(Type screen_type) { if (LoadingScreen.Get().m_Active) { return; } if (!this.m_Initialized) { this.Init(); } MenuScreen menuScreen = null; this.m_Screens.TryGetValue(screen_type, out menuScreen); if (!menuScreen) { DebugUtils.Assert("[MenuInGameManager::ShowScreen] Can't find screen " + screen_type.ToString() + "!", true, DebugUtils.AssertType.Info); return; } if (menuScreen == this.m_CurrentScreen) { return; } PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 1f); this.m_OutlineCamera.enabled = false; this.m_PrevoiusScreen = this.m_CurrentScreen; if (this.m_CurrentScreen) { this.m_CurrentScreen.Hide(); } else { Player.Get().BlockMoves(); Player.Get().BlockRotation(); CursorManager.Get().ShowCursor(true); if (menuScreen.ShouldPauseGame()) { MainLevel.Instance.Pause(true); } } menuScreen.Show(); this.m_CurrentScreen = menuScreen; }
public static bool SpendHealth(float health) { if (!BookUIHandler.saveData.useHealth) { return(true); } if (Player.currentCreature.currentHealth > health) { Player.currentCreature.currentHealth -= health; PostProcessManager.RefreshHealth(); return(true); } PostProcessManager.DoTimedEffect(new Color(1, 0.1f, 0.1f), PostProcessManager.TimedEffect.Flash, 0.5f); return(false); }
private void Start() { List <PostProcessVolume> postProcessVolumeList = ListPool <PostProcessVolume> .Get(); PostProcessManager.get_instance().GetActiveVolumes(this.PostProcessLayer, postProcessVolumeList, true, true); using (List <PostProcessVolume> .Enumerator enumerator = postProcessVolumeList.GetEnumerator()) { while (enumerator.MoveNext()) { PostProcessVolume current = enumerator.Current; Bloom setting1 = (Bloom)current.get_profile().GetSetting <Bloom>(); if (Object.op_Implicit((Object)setting1)) { this._bloom.Add(setting1); } AmbientOcclusion setting2 = (AmbientOcclusion)current.get_profile().GetSetting <AmbientOcclusion>(); if (Object.op_Inequality((Object)setting2, (Object)null) && ((PostProcessEffectSettings)setting2).active != null) { this._ao.Add(setting2); } ScreenSpaceReflections setting3 = (ScreenSpaceReflections)current.get_profile().GetSetting <ScreenSpaceReflections>(); if (Object.op_Inequality((Object)setting3, (Object)null) && ((PostProcessEffectSettings)setting3).active != null) { this._ssr.Add(setting3); } DepthOfField setting4 = (DepthOfField)current.get_profile().GetSetting <DepthOfField>(); if (Object.op_Inequality((Object)setting4, (Object)null) && ((PostProcessEffectSettings)setting4).active != null) { this._dof.Add(setting4); } Vignette setting5 = (Vignette)current.get_profile().GetSetting <Vignette>(); if (Object.op_Inequality((Object)setting5, (Object)null) && ((PostProcessEffectSettings)setting5).active != null) { this._vignette.Add(setting5); } } } this.Refresh(); }
public override void Update() { base.Update(); if (this.m_Active && MainLevel.Instance.m_TODSky.Cycle.GameTime - this.m_StartTime >= this.m_Duration) { this.m_Active = false; } float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Coca); if (this.m_Active && weight < 1f) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Coca, weight + Time.deltaTime * 3f); } else if (!this.m_Active && weight > 0f) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Coca, weight - Time.deltaTime * 3f); } if (this.m_Active && this.m_IncreaseEnergyPerSec > 0f) { PlayerConditionModule.Get().IncreaseEnergy(this.m_IncreaseEnergyPerSec * Time.deltaTime); } }