From 813bd3997d06abdbff919f8221fc88f63682d327 Mon Sep 17 00:00:00 2001 From: jonas Date: Fri, 6 Jul 2018 00:09:27 +0200 Subject: [PATCH] Added different modes to 'Playthrough' console application to randomly send mouse input events / trigger game object interactions; minor fixes for main game --- .../Properties/Basement.Resources.Designer.cs | 2 +- .../Properties/Basement.Resources.resx | 2 +- .../Properties/Items.Resources.Designer.cs | 9 ++ .../GameLogic/Properties/Items.Resources.resx | 3 + .../Properties/Resources.Designer.cs | 9 ++ src/Game/GameLogic/Properties/Resources.resx | 3 + .../Resources_Session_6.Designer.cs | 2 +- .../Properties/Resources_Session_6.resx | 2 +- .../GameLogic/base/Components/TracerLine.cs | 4 + src/Game/GameLogic/content/build.bat | 7 +- src/Game/GameLogic/content/tree.cs | 5 +- src/Game/GameLogic/gui/dialog/Menu.cs | 2 + .../GameLogic/gui/positionselection/Label.cs | 4 +- .../GameLogic/gui/positionselection/Scene.cs | 2 + src/Game/GameLogic/items/Drone.cs | 10 ++ src/Game/GameLogic/items/Envelope.cs | 2 + src/Game/GameLogic/items/RFIDAntenna.cs | 16 ++- src/Game/GameLogic/menu/MainMenu.cs | 22 +++ src/Game/GameLogic/menu/MenuItems.cs | 13 +- src/Game/GameLogic/menu/SaveLoadGame.cs | 2 + .../rooms/basement/RFIDAntennaFloor.cs | 1 + .../GameLogic/rooms/basement/WoodenPanel.cs | 2 +- src/Game/GameLogic/sessions/Scene.cs | 2 + src/Game/GameLogic/sessions/SessionFive.cs | 6 + src/Game/GameLogic/sessions/SessionFour.cs | 6 + src/Game/GameLogic/sessions/SessionOne.cs | 3 + src/Game/GameLogic/sessions/SessionSeven.cs | 1 + src/Game/GameLogic/sessions/SessionSix.cs | 6 + src/Game/Playthrough/Playthrough.cs | 127 +++++++++++++++++- src/Game/Playthrough/Playthrough.csproj | 4 + .../Playthrough.cs | 1 + 31 files changed, 259 insertions(+), 21 deletions(-) diff --git a/src/Game/GameLogic/Properties/Basement.Resources.Designer.cs b/src/Game/GameLogic/Properties/Basement.Resources.Designer.cs index df1ec4a..73e1c7e 100644 --- a/src/Game/GameLogic/Properties/Basement.Resources.Designer.cs +++ b/src/Game/GameLogic/Properties/Basement.Resources.Designer.cs @@ -1815,7 +1815,7 @@ internal static string mouse_hole { } /// - /// Looks up a localized string similar to Move the mouse to rotate. Left click to confirm. Right click to abort.. + /// Looks up a localized string similar to Move the mouse to rotate until the line color is green. Left click to confirm. Right click to abort.. /// internal static string Move_the_mouse_to_rotate_Left_click_to_confirm_Right_click_to_abort { get { diff --git a/src/Game/GameLogic/Properties/Basement.Resources.resx b/src/Game/GameLogic/Properties/Basement.Resources.resx index 37c57f3..b949026 100644 --- a/src/Game/GameLogic/Properties/Basement.Resources.resx +++ b/src/Game/GameLogic/Properties/Basement.Resources.resx @@ -692,7 +692,7 @@ Might as well keep it with me. Maybe it's good luck. - Move the mouse to rotate. Left click to confirm. Right click to abort. + Move the mouse to rotate until the line color is green. Left click to confirm. Right click to abort. Left click to place the antenna. Right click to abort. diff --git a/src/Game/GameLogic/Properties/Items.Resources.Designer.cs b/src/Game/GameLogic/Properties/Items.Resources.Designer.cs index adc9cc1..fb81ca4 100644 --- a/src/Game/GameLogic/Properties/Items.Resources.Designer.cs +++ b/src/Game/GameLogic/Properties/Items.Resources.Designer.cs @@ -597,6 +597,15 @@ internal static string I_dont_need_to_cut_that_off_any_further { } } + /// + /// Looks up a localized string similar to I don't see the point in making the drone fly to that.. + /// + internal static string I_dont_see_the_point_in_making_the_drone_fly_to_that { + get { + return ResourceManager.GetString("I_dont_see_the_point_in_making_the_drone_fly_to_that", resourceCulture); + } + } + /// /// Looks up a localized string similar to I don't want to cut that.. /// diff --git a/src/Game/GameLogic/Properties/Items.Resources.resx b/src/Game/GameLogic/Properties/Items.Resources.resx index e580fee..0ca0352 100644 --- a/src/Game/GameLogic/Properties/Items.Resources.resx +++ b/src/Game/GameLogic/Properties/Items.Resources.resx @@ -586,4 +586,7 @@ Two batteries are installed. + + I don't see the point in making the drone fly to that. + \ No newline at end of file diff --git a/src/Game/GameLogic/Properties/Resources.Designer.cs b/src/Game/GameLogic/Properties/Resources.Designer.cs index 347568b..fe29e97 100644 --- a/src/Game/GameLogic/Properties/Resources.Designer.cs +++ b/src/Game/GameLogic/Properties/Resources.Designer.cs @@ -150,6 +150,15 @@ internal static string Could_not_load_save_game_Maybe_it_was_created_in_an_earli } } + /// + /// Looks up a localized string similar to Credits. + /// + internal static string Credits { + get { + return ResourceManager.GetString("Credits", resourceCulture); + } + } + /// /// Looks up a localized string similar to Display Mode. /// diff --git a/src/Game/GameLogic/Properties/Resources.resx b/src/Game/GameLogic/Properties/Resources.resx index f1ceffd..ab10d92 100644 --- a/src/Game/GameLogic/Properties/Resources.resx +++ b/src/Game/GameLogic/Properties/Resources.resx @@ -295,4 +295,7 @@ No + + Credits + \ No newline at end of file diff --git a/src/Game/GameLogic/Properties/Resources_Session_6.Designer.cs b/src/Game/GameLogic/Properties/Resources_Session_6.Designer.cs index 368c298..0bd7be3 100644 --- a/src/Game/GameLogic/Properties/Resources_Session_6.Designer.cs +++ b/src/Game/GameLogic/Properties/Resources_Session_6.Designer.cs @@ -1141,7 +1141,7 @@ internal static string Next_thing_I_knew_Cynthia_was_looking_up_at_him_and_he_wa } /// - /// Looks up a localized string similar to No. No it's not. I asked her, "who? who did this ?" and she kept crying and telling me to keep my voice down, and that's.... + /// Looks up a localized string similar to No. No it's not. I asked her, "who? who did this?" and she kept crying and telling me to keep my voice down, and that's.... /// internal static string No_No_its_not_I_asked_her_who_who_did_this__and_she_kept_crying_and_telling_me_to_keep_my_voice_down_and_thats { get { diff --git a/src/Game/GameLogic/Properties/Resources_Session_6.resx b/src/Game/GameLogic/Properties/Resources_Session_6.resx index c7700c0..76a795b 100644 --- a/src/Game/GameLogic/Properties/Resources_Session_6.resx +++ b/src/Game/GameLogic/Properties/Resources_Session_6.resx @@ -146,7 +146,7 @@ Session 6 - No. No it's not. I asked her, "who? who did this ?" and she kept crying and telling me to keep my voice down, and that's... + No. No it's not. I asked her, "who? who did this?" and she kept crying and telling me to keep my voice down, and that's... Session 6 diff --git a/src/Game/GameLogic/base/Components/TracerLine.cs b/src/Game/GameLogic/base/Components/TracerLine.cs index d06d605..d3043b7 100644 --- a/src/Game/GameLogic/base/Components/TracerLine.cs +++ b/src/Game/GameLogic/base/Components/TracerLine.cs @@ -36,6 +36,10 @@ public Vector2 Target } private Vector3 _Collider; + /// + /// (x,y) center position + /// z radius + /// public Vector3 Collider { get diff --git a/src/Game/GameLogic/content/build.bat b/src/Game/GameLogic/content/build.bat index db0ddae..fbd5f94 100644 --- a/src/Game/GameLogic/content/build.bat +++ b/src/Game/GameLogic/content/build.bat @@ -1,7 +1,7 @@  REM ------------------------------------------------------------------------------ REM -REM This code was generated by a tool on 25.05.2018 11:40:42. +REM This code was generated by a tool on 05.07.2018 22:35:55. REM REM Changes to this file may cause incorrect behavior and will be lost if REM the code is regenerated. @@ -12,6 +12,9 @@ copy "audio\basement.ogg" "bin\audio\basement.ogg" copy "audio\intro.ogg" "bin\audio\intro.ogg" copy "audio\session2.ogg" "bin\audio\session2.ogg" copy "audio\session3.ogg" "bin\audio\session3.ogg" +copy "audio\session4.ogg" "bin\audio\session4.ogg" +copy "audio\session5.ogg" "bin\audio\session5.ogg" +copy "audio\session6.ogg" "bin\audio\session6.ogg" copy "audio\spectres.ogg" "bin\audio\spectres.ogg" ContentCompiler.exe audio\battery_insert.wav bin\audio\battery_insert WavImporter SoundEffectProcessor true ContentCompiler.exe audio\battery_remove.wav bin\audio\battery_remove WavImporter SoundEffectProcessor true @@ -45,7 +48,9 @@ ContentCompiler.exe audio\hammer_wood.wav bin\audio\hammer_wood WavImporter Soun ContentCompiler.exe audio\light_off.wav bin\audio\light_off WavImporter SoundEffectProcessor true ContentCompiler.exe audio\light_on.wav bin\audio\light_on WavImporter SoundEffectProcessor true ContentCompiler.exe audio\lock_pick.wav bin\audio\lock_pick WavImporter SoundEffectProcessor true +ContentCompiler.exe audio\menu_click-backup1.wav bin\audio\menu_click-backup1 WavImporter SoundEffectProcessor true ContentCompiler.exe audio\menu_click.wav bin\audio\menu_click WavImporter SoundEffectProcessor true +ContentCompiler.exe audio\menu_focus-backup1.wav bin\audio\menu_focus-backup1 WavImporter SoundEffectProcessor true ContentCompiler.exe audio\menu_focus.wav bin\audio\menu_focus WavImporter SoundEffectProcessor true ContentCompiler.exe audio\mouse_eat.wav bin\audio\mouse_eat WavImporter SoundEffectProcessor true ContentCompiler.exe audio\open_panel.wav bin\audio\open_panel WavImporter SoundEffectProcessor true diff --git a/src/Game/GameLogic/content/tree.cs b/src/Game/GameLogic/content/tree.cs index 0866e36..8f9fc9f 100644 --- a/src/Game/GameLogic/content/tree.cs +++ b/src/Game/GameLogic/content/tree.cs @@ -1,7 +1,7 @@  // ------------------------------------------------------------------------------ // -// This code was generated by a tool on 25.05.2018 11:40:44. +// This code was generated by a tool on 05.07.2018 22:40:34. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,6 +19,9 @@ public static partial class audio public const string intro = "audio\\intro"; public const string session2 = "audio\\session2"; public const string session3 = "audio\\session3"; + public const string session4 = "audio\\session4"; + public const string session5 = "audio\\session5"; + public const string session6 = "audio\\session6"; public const string spectres = "audio\\spectres"; public const string battery_insert = "audio\\battery_insert"; public const string battery_remove = "audio\\battery_remove"; diff --git a/src/Game/GameLogic/gui/dialog/Menu.cs b/src/Game/GameLogic/gui/dialog/Menu.cs index c25a56f..77ea6f4 100644 --- a/src/Game/GameLogic/gui/dialog/Menu.cs +++ b/src/Game/GameLogic/gui/dialog/Menu.cs @@ -90,6 +90,8 @@ public Script StartSelectionScript(Scripts scripts) /// private IEnumerator WaitForSelection(bool setInteractive = true) { + Game.StopSkipping(); + while (State != DialogMenuState.Open && State != DialogMenuState.Closed) { yield return 0; diff --git a/src/Game/GameLogic/gui/positionselection/Label.cs b/src/Game/GameLogic/gui/positionselection/Label.cs index e639dba..c2c6fca 100644 --- a/src/Game/GameLogic/gui/positionselection/Label.cs +++ b/src/Game/GameLogic/gui/positionselection/Label.cs @@ -19,7 +19,7 @@ public Label() .SetFont(content.fonts.pixeloperator_outline_BMF) .SetAlign(Alignment.Top) .SetWidth(Game.VIRTUAL_WIDTH) - .SetWordWrap(false); + .SetWordWrap(true); Transform .Create(this) @@ -31,7 +31,7 @@ public override void OnBeginDraw(Renderer renderer) { if (renderer.Stage == RenderStage.PostBloom) { - renderer.SpriteBatch.Draw(renderer.WhitePixelTexture, new Rectangle(0, 0, Game.VIRTUAL_WIDTH, 20), new Color(0, 0, 0, 0.5f)); + renderer.SpriteBatch.Draw(renderer.WhitePixelTexture, new Rectangle(0, 0, Game.VIRTUAL_WIDTH, 18 * Get().Lines.Count), new Color(0, 0, 0, 0.5f)); } base.OnBeginDraw(renderer); diff --git a/src/Game/GameLogic/gui/positionselection/Scene.cs b/src/Game/GameLogic/gui/positionselection/Scene.cs index f863e77..cb21f5f 100644 --- a/src/Game/GameLogic/gui/positionselection/Scene.cs +++ b/src/Game/GameLogic/gui/positionselection/Scene.cs @@ -60,6 +60,8 @@ public Script StartSelectionScript(Scripts scripts, IPositionable entityToPositi /// private IEnumerator WaitForSelection(IPositionable entityToPosition, bool setInteractive = true, bool abortable = true, int mode = 0) { + Game.StopSkipping(); + Aborted = false; Enabled = true; Visible = true; diff --git a/src/Game/GameLogic/items/Drone.cs b/src/Game/GameLogic/items/Drone.cs index bbeec82..dd23fb5 100644 --- a/src/Game/GameLogic/items/Drone.cs +++ b/src/Game/GameLogic/items/Drone.cs @@ -18,10 +18,20 @@ protected override Interactions GetInteractions() { return Interactions .Create() + .For(Any.Object) + .Add(Verbs.Use, UseScript(), Game.Ego) .For(Game.Ego) .Add(Verbs.Look, LookScript()); } + IEnumerator UseScript() + { + using (Game.CutsceneBlock()) + { + yield return Game.Ego.Say(Items_Res.I_dont_see_the_point_in_making_the_drone_fly_to_that); + } + } + IEnumerator LookScript() { yield return Game.Ego.StartScript(DronePackage.LookScript()); diff --git a/src/Game/GameLogic/items/Envelope.cs b/src/Game/GameLogic/items/Envelope.cs index 2504e85..4d70717 100644 --- a/src/Game/GameLogic/items/Envelope.cs +++ b/src/Game/GameLogic/items/Envelope.cs @@ -61,6 +61,8 @@ IEnumerator OpenScript() Tree.Letter.Scene.Visible = true; Tree.GUI.Interaction.Scene.Interactive = false; + Game.StopSkipping(); + while (Tree.Letter.Scene.Enabled) { yield return 1; diff --git a/src/Game/GameLogic/items/RFIDAntenna.cs b/src/Game/GameLogic/items/RFIDAntenna.cs index 91af78f..4a98d0f 100644 --- a/src/Game/GameLogic/items/RFIDAntenna.cs +++ b/src/Game/GameLogic/items/RFIDAntenna.cs @@ -96,7 +96,7 @@ public IEnumerator UseScript(bool reset, bool doCheck) // place yield return Game.Ego.StartScript(PlaceScript(AntennaFloor, RFIDAntennaFloor.POSITIONMODE_POSITION)); - if (AntennaFloor.WasPlacedTooClose) + if (AntennaFloor.WasPlacedTooClose && !SelectionAborted) { yield return Game.Ego.Say(Items_Res.I_need_to_place_the_other_antenna_with_more_distance_for_the_triangulation_to_work); } @@ -109,6 +109,7 @@ public IEnumerator UseScript(bool reset, bool doCheck) yield return Game.Ego.StartScript(PlaceScript(AntennaFloor, RFIDAntennaFloor.POSITIONMODE_ROTATION)); } + // this needs to be evaluated here again if (!SelectionAborted) { if (HitCollider) @@ -143,13 +144,18 @@ public IEnumerator UseScript(bool reset, bool doCheck) } } } - - yield return Game.Ego.GoTo(AntennaFloor); - yield return Game.Ego.StartUse(); + if (!SelectionAborted) + { + yield return Game.Ego.GoTo(AntennaFloor); + yield return Game.Ego.StartUse(); + } Placed = false; AntennaFloor.Visible = false; AntennaFloor.Enabled = false; - yield return Game.Ego.StopUse(); + if (!SelectionAborted) + { + yield return Game.Ego.StopUse(); + } } } diff --git a/src/Game/GameLogic/menu/MainMenu.cs b/src/Game/GameLogic/menu/MainMenu.cs index eb3ef03..881718b 100644 --- a/src/Game/GameLogic/menu/MainMenu.cs +++ b/src/Game/GameLogic/menu/MainMenu.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Media; using STACK; using System; using TomShane.Neoforce.Controls; @@ -14,6 +15,8 @@ public partial class Menu : IDisposable private Label MainMenuLabel; private SoundEffect FocusSound, ClickSound; + public Song MenuSong { get; private set; } + public void Show() { RefreshSaveGames(); @@ -69,17 +72,28 @@ public void Dispose() { FocusSound.Dispose(); } + + if (null != MenuSong) + { + //MenuSong.Dispose(); + } } public Menu(StackEngine engine) { FocusSound = engine.EngineContent.Load(content.audio.menu_click); ClickSound = engine.EngineContent.Load(content.audio.menu_focus); + MenuSong = engine.EngineContent.Load(content.audio.session6); + + MediaPlayer.Play(MenuSong); + MediaPlayer.IsRepeating = true; Engine = engine; GameSettings = engine.GameSettings; var GUI = engine.Renderer.GUIManager; + + GUI.Input.KeyDown += new KeyEventHandler(OnKeyDown); var Cursor = CreateCursor(); GUI.ShowSoftwareCursor = true; @@ -116,5 +130,13 @@ public Menu(StackEngine engine) ShowLogo(true); } + + private void OnKeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Microsoft.Xna.Framework.Input.Keys.Escape && GameRunning) + { + ContinueGame(); + } + } } } diff --git a/src/Game/GameLogic/menu/MenuItems.cs b/src/Game/GameLogic/menu/MenuItems.cs index f1ee3c7..e58cfb7 100644 --- a/src/Game/GameLogic/menu/MenuItems.cs +++ b/src/Game/GameLogic/menu/MenuItems.cs @@ -30,6 +30,13 @@ private bool GameRunning } } + private void ContinueGame() + { + MainMenuBackground.Hide(); + Engine.Resume(); + Engine.Renderer.GUIManager.ShowSoftwareCursor = false; + } + IEnumerable GetMenuItems() { // Quit @@ -51,7 +58,7 @@ IEnumerable GetMenuItems() yield return Item; // Credits - Item = new Item("Credits"); + Item = new Item(GlblRes.Credits); Item.OnClick = () => { CreditsWindow.Show(); @@ -98,9 +105,7 @@ IEnumerable GetMenuItems() Item = new Item(GlblRes.Continue); Item.OnClick = () => { - MainMenuBackground.Hide(); - Engine.Resume(); - Engine.Renderer.GUIManager.ShowSoftwareCursor = false; + ContinueGame(); }; Item.IsVisible = () => { return GameRunning; }; yield return Item; diff --git a/src/Game/GameLogic/menu/SaveLoadGame.cs b/src/Game/GameLogic/menu/SaveLoadGame.cs index b31e69d..33414c9 100644 --- a/src/Game/GameLogic/menu/SaveLoadGame.cs +++ b/src/Game/GameLogic/menu/SaveLoadGame.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Media; using STACK; using System.Collections.Generic; using System.IO; @@ -105,6 +106,7 @@ void AddLoadGameWindow(Manager gui) LoadGameWindow.Close(); MainMenuBackground.Hide(); + MediaPlayer.Stop(); Engine.Resume(); Engine.Renderer.GUIManager.ShowSoftwareCursor = false; }; diff --git a/src/Game/GameLogic/rooms/basement/RFIDAntennaFloor.cs b/src/Game/GameLogic/rooms/basement/RFIDAntennaFloor.cs index bf8d10c..7805185 100644 --- a/src/Game/GameLogic/rooms/basement/RFIDAntennaFloor.cs +++ b/src/Game/GameLogic/rooms/basement/RFIDAntennaFloor.cs @@ -161,6 +161,7 @@ public void BeginPosition(int mode) Tree.GUI.PositionSelection.Label.LabelText = Basement_Res.Left_click_to_place_the_antenna_Right_click_to_abort; Get().Color = new Color(0, 0, 1f, 0.3f); Get().SetVisible(false); + WasPlacedTooClose = false; } Visible = true; diff --git a/src/Game/GameLogic/rooms/basement/WoodenPanel.cs b/src/Game/GameLogic/rooms/basement/WoodenPanel.cs index dab5485..aa8c6da 100644 --- a/src/Game/GameLogic/rooms/basement/WoodenPanel.cs +++ b/src/Game/GameLogic/rooms/basement/WoodenPanel.cs @@ -16,7 +16,7 @@ public class WoodenPanel : Entity /// /// Colliding circle, z equals radius /// - public static readonly Vector3 Collider = new Vector3(621, 275, 5); + public static readonly Vector3 Collider = new Vector3(621, 275, 8); public bool Uncovered { get; private set; } diff --git a/src/Game/GameLogic/sessions/Scene.cs b/src/Game/GameLogic/sessions/Scene.cs index bb128b8..031bc3b 100644 --- a/src/Game/GameLogic/sessions/Scene.cs +++ b/src/Game/GameLogic/sessions/Scene.cs @@ -108,6 +108,8 @@ public Script StartSession(Sessions session) Tree.Cutscenes.Scene.Visible = true; Tree.Cutscenes.Scene.Enabled = true; + Log.WriteLine("Starting Session " + session.ToString()); + return Get().Start(GetSessionScript(session)); } diff --git a/src/Game/GameLogic/sessions/SessionFive.cs b/src/Game/GameLogic/sessions/SessionFive.cs index 296c56a..1091554 100644 --- a/src/Game/GameLogic/sessions/SessionFive.cs +++ b/src/Game/GameLogic/sessions/SessionFive.cs @@ -13,6 +13,7 @@ public partial class Director : Entity { IEnumerator SessionFiveScript() { + Game.StopSong(); Game.PlaySoundEffect(content.audio.transition_4); Tree.Office.Scene.SetupEarly(); Fader.Visible = false; @@ -96,6 +97,9 @@ IEnumerator SessionFiveScript() var Selection = Menu.LastSelectedOption; ProcessScore(Selection); + Game.PlaySong(content.audio.session5); + World.Get().RepeatSong = true; + yield return RyanVoice.Say(Selection.Text); switch (Selection.ID) @@ -308,6 +312,8 @@ IEnumerator SessionFiveScript() Tree.GUI.Interaction.Scene.Interactive = true; + World.Get().RepeatSong = false; + World.Interactive = true; Game.StopSkipping(); } diff --git a/src/Game/GameLogic/sessions/SessionFour.cs b/src/Game/GameLogic/sessions/SessionFour.cs index b8c4802..7b9aeae 100644 --- a/src/Game/GameLogic/sessions/SessionFour.cs +++ b/src/Game/GameLogic/sessions/SessionFour.cs @@ -15,6 +15,7 @@ public partial class Director : Entity { IEnumerator SessionFourScript() { + Game.StopSong(); Game.PlaySoundEffect(content.audio.transition_4); Tree.Office.Scene.SetupEarly(); Fader.Visible = false; @@ -36,6 +37,9 @@ IEnumerator SessionFourScript() yield return Psychiatrist.Say(GlblRes.I_think_we_could_both_benefit_from_learning_a_little_bit_more_about_yourself); + Game.PlaySong(content.audio.session4); + World.Get().RepeatSong = true; + yield return Delay.Seconds(1); yield return RyanVoice.Say(GlblRes.Like_what); @@ -181,6 +185,8 @@ IEnumerator SessionFourScript() Tree.GUI.Interaction.Scene.Interactive = true; + World.Get().RepeatSong = false; + World.Interactive = true; Game.StopSkipping(); } diff --git a/src/Game/GameLogic/sessions/SessionOne.cs b/src/Game/GameLogic/sessions/SessionOne.cs index 007614e..75d884e 100644 --- a/src/Game/GameLogic/sessions/SessionOne.cs +++ b/src/Game/GameLogic/sessions/SessionOne.cs @@ -16,6 +16,9 @@ public partial class Director : Entity IEnumerator SessionOneScript() { + Game.StopSong(); + World.Get().RepeatSong = false; + var BloomSettings = new BloomSettings("SessionSeven", 0.75f, 1.5f, 0.8f, 1, 1, 1); World.Get().BloomSettings = BloomSettings; diff --git a/src/Game/GameLogic/sessions/SessionSeven.cs b/src/Game/GameLogic/sessions/SessionSeven.cs index 72f1900..9b6a352 100644 --- a/src/Game/GameLogic/sessions/SessionSeven.cs +++ b/src/Game/GameLogic/sessions/SessionSeven.cs @@ -19,6 +19,7 @@ public partial class Director : Entity /// IEnumerator SessionSevenScript() { + Game.StopSong(); Game.PlaySoundEffect(content.audio.transition_4); Tree.Office.Scene.SetupEarly(); Fader.Visible = false; diff --git a/src/Game/GameLogic/sessions/SessionSix.cs b/src/Game/GameLogic/sessions/SessionSix.cs index 8bf8842..6b2de9c 100644 --- a/src/Game/GameLogic/sessions/SessionSix.cs +++ b/src/Game/GameLogic/sessions/SessionSix.cs @@ -28,6 +28,7 @@ public bool KilledLandon IEnumerator SessionSixScript() { + Game.StopSong(); Game.PlaySoundEffect(content.audio.transition_4); Tree.Office.Scene.SetupLate(); Fader.Visible = false; @@ -54,6 +55,9 @@ IEnumerator SessionSixScript() yield return Psychiatrist.Say(GlblRes.Are_you_ready_to_tell_me_what_happened_that_night); + Game.PlaySong(content.audio.session6); + World.Get().RepeatSong = true; + yield return Delay.Seconds(0.5f); yield return RyanVoice.TransitionTo(RyanState.ArmsCrossed); @@ -515,6 +519,8 @@ IEnumerator SessionSixScript() Tree.GUI.Interaction.Scene.Interactive = true; + World.Get().RepeatSong = false; + World.Interactive = true; Game.StopSkipping(); } diff --git a/src/Game/Playthrough/Playthrough.cs b/src/Game/Playthrough/Playthrough.cs index c208ed9..d1647e3 100644 --- a/src/Game/Playthrough/Playthrough.cs +++ b/src/Game/Playthrough/Playthrough.cs @@ -1,6 +1,11 @@ using SessionSeven.Components; +using SessionSeven.Entities; +using SessionSeven.Functional.Test; +using SessionSeven.GUI.Interaction; using STACK; +using STACK.Components; using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; @@ -17,7 +22,7 @@ public static class Playthrough /// The main entry point for the application. /// [STAThread] - static void Main() + static void Main(string[] args) { try { @@ -26,9 +31,20 @@ static void Main() STACK.Logging.Log.AddLogger(new STACK.Logging.SystemConsoleLogHandler()); - var PlaythroughLogic = new SessionSeven.Functional.Test.Playthrough(); + if (null != args && "click" == args[0]) + { + ExecuteClicks(); + } + else if (null != args && "interact" == args[0]) + { + ExecuteInteractions(); + } + else + { + var PlaythroughLogic = new Functional.Test.Playthrough(); - PlaythroughLogic.SolveGameWithSaveGames(GetScoreType()); + PlaythroughLogic.SolveGameWithSaveGames(GetScoreType()); + } Console.WriteLine("Done."); } @@ -43,6 +59,110 @@ static void Main() } } + private static void ExecuteClicks() + { + SessionSevenTestEngine.Execute((runner) => + { + Console.WriteLine("Press ESC to quit."); + var PlayerScripts = Game.Ego.Get(); + + while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)) + { + while (PlayerScripts.ScriptCollection.Count > 0 || !runner.Game.World.Interactive) + { + runner.Tick(); + runner.MouseClick(runner.Game.World.Get().CreateInt(1110), runner.Game.World.Get().CreateInt(400)); + } + + runner.MouseClick(runner.Game.World.Get().CreateInt(1110), runner.Game.World.Get().CreateInt(400)); + } + runner.SaveState("click state"); + }); + } + + private static void ExecuteInteractions() + { + SessionSevenTestEngine.Execute((runner) => + { + Console.WriteLine("Press ESC to quit."); + var PlayerScripts = Game.Ego.Get(); + var Randomizer = runner.Game.World.Get(); + + while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)) + { + while (PlayerScripts.ScriptCollection.Count > 0 || !runner.Game.World.Interactive) + { + runner.Tick(); + if (runner.Game.World.Interactive) + { + runner.MouseClick(Randomizer.CreateInt(1110), Randomizer.CreateInt(400)); + } + } + + try + { + if (Randomizer.CreateInt(2) == 1) + { + var RandomEntity = ChooseRandomEntity(Randomizer); + var RandomVerb = ChooseRandomVerb(Randomizer); + + runner.Interact(RandomEntity, RandomVerb, false); + } + else + { + runner.Interact(ChooseRandomEntity(Randomizer), ChooseRandomEntity(Randomizer), ChooseRandomDitransitiveVerb(Randomizer), false); + } + } + catch (KeyNotFoundException) + { + + } + } + runner.SaveState("interaction state"); + }); + } + + private static Entity ChooseRandomEntity(Randomizer randomizer) + { + IEnumerable ObjectsToChooseFrom; + + if (randomizer.CreateInt(2) == 1) + { + ObjectsToChooseFrom = Tree.Basement.Scene.GameObjectCache.Entities.Where(e => e.Enabled && e.Visible && null != e.Get()); + } + else + { + ObjectsToChooseFrom = Game.Ego.Inventory.Scene.GameObjectCache.Entities.Where(e => e.Enabled && e.Visible && null != e.Get()); + } + + var count = ObjectsToChooseFrom.Count(); + if (0 == count) + { + return ChooseRandomEntity(randomizer); + } + var index = randomizer.CreateInt(0, count); + + return ObjectsToChooseFrom.ElementAt(index); + } + + private static LockedVerb ChooseRandomVerb(Randomizer randomizer) + { + var AllVerbs = Verbs.All; + var index = randomizer.CreateInt(0, AllVerbs.Count()); + + return AllVerbs.ElementAt(index); + } + + private static LockedVerb ChooseRandomDitransitiveVerb(Randomizer randomizer) + { + if (randomizer.CreateInt(2) == 1) + { + return Verbs.Use; + } + + return Verbs.Give; + } + static ScoreType GetScoreType() { var ValidChars = new char[] { '1', '2', '3' }; @@ -84,6 +204,7 @@ static void FatalExceptionObject(object exceptionObject) static void HandleException(Exception e) { + Console.WriteLine(e.ToString()); AppendToFile("error.log", e.ToString()); } diff --git a/src/Game/Playthrough/Playthrough.csproj b/src/Game/Playthrough/Playthrough.csproj index 29751d7..5a5bb40 100644 --- a/src/Game/Playthrough/Playthrough.csproj +++ b/src/Game/Playthrough/Playthrough.csproj @@ -92,6 +92,10 @@ {bdd5e5df-a2f6-44fc-a44b-33488ba054bb} STACK + + {A0CCDFD1-14C8-4B91-80CE-209C2EA6C4F7} + STACK.TestBase + {70539779-ef22-4ca3-8f1a-125dff443092} SessionSeven.Functional.Test diff --git a/src/Tests/SessionSeven.Functional.Test/Playthrough.cs b/src/Tests/SessionSeven.Functional.Test/Playthrough.cs index 3cc71da..d097c9c 100644 --- a/src/Tests/SessionSeven.Functional.Test/Playthrough.cs +++ b/src/Tests/SessionSeven.Functional.Test/Playthrough.cs @@ -286,6 +286,7 @@ private void SolveSessionFive(SessionSevenTestEngine runner, ScoreType targetSco runner.Interact(Tree.InventoryItems.RFIDAntennaBoxCabinet, Verbs.Open); runner.Interact(Tree.Basement.CabinetRightDoor, Verbs.Close); runner.Interact(Tree.InventoryItems.RFIDAntennaCabinet, Verbs.Use); + runner.SaveState("[Playthrough] PlacingAntenna"); SetupRFIDAntenna(runner);