Skip to content

Commit

Permalink
Adding more was pressed for inputs for door/ tree
Browse files Browse the repository at this point in the history
  • Loading branch information
AbsoluteStratos committed Dec 17, 2024
1 parent 8846015 commit c7cd35b
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 70 deletions.
Binary file modified bin/ChristmasInDirtmouth/ChristmasInDirtmouth.dll
Binary file not shown.
Binary file modified bin/ChristmasInDirtmouth/ChristmasInDirtmouth.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions bin/ChristmasInDirtmouth/SHA.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SHA256 - ChristmasInDirtmouth.dll, Version 1.0.1.0:
896824F083BAACFB4C81DF503FB0EFCB4ACEFBA4C714CB3117013983DB6F499A
SHA256 - ChristmasInDirtmouth.dll, Version 1.0.2.0:
E06B55373A5FDD28F7014E5DE8A0919AD0170F455B53C9338B0C75E5F8815FFE
SHA256 - ChristmasInDirtmouth.zip:
C5BA6317AFE8ACB632BCDB294F6D9C8D0B689960788FB2DC6B71792C235A0B64
9DECEFA56D128CE5ACDDC021EC491AD4BEF840F1572D44051B12CB5FE4C79329
4 changes: 2 additions & 2 deletions src/ChristmasInDirtmouth.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<Product>ChristmasInDirtmouth</Product>
<Description>A Hollow Knight Mod</Description>
<Copyright>Copyright © 2024</Copyright>
<AssemblyVersion>1.0.1.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion>
<AssemblyVersion>1.0.2.0</AssemblyVersion>
<FileVersion>1.0.2.0</FileVersion>
<OutputPath>$(ExportDir)\$(Configuration)\</OutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
44 changes: 24 additions & 20 deletions src/ChristmasShopSceneHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,30 +370,34 @@ public void OnHeroUpdate()
// In the modding tutorial you will see the use of Input.GetKeyDown
// We dont use that here because we want to be agnostic to the key bind for up and also support controllers
// User the inputHanlder instead
if (GameManager.instance.inputHandler.inputActions.up.IsPressed && active)
{
active = false;
doorArrowPrompt.GetComponent<CustomArrowPromptBehaviour>().Hide();
if (ChristmasInDirtmouth.GlobalData.ShopIntro)
{
ChristmasInDirtmouth.MerryDialogueManager.ShowDialogue("SLY_SHOP_INTRO");
//ChristmasInDirtmouth.GlobalData.ShopIntro = false;
}
else
if (active) {
Logger.Debug("NPC diaglog active");
if (GameManager.instance.inputHandler.inputActions.up.WasPressed || GameManager.instance.inputHandler.inputActions.up.IsPressed)
{
// Random dialog
System.Random rnd = new System.Random();
int index = rnd.Next(1, 4);
// Ensure we dont get the same message twice in a row
if (prev_convo == index)
Logger.Debug("NPC diaglog triggered");
active = false;
doorArrowPrompt.GetComponent<CustomArrowPromptBehaviour>().Hide();
if (ChristmasInDirtmouth.GlobalData.ShopIntro)
{
index += 1;
if (index == 4) { index = 1; }
ChristmasInDirtmouth.MerryDialogueManager.ShowDialogue("SLY_SHOP_INTRO");
//ChristmasInDirtmouth.GlobalData.ShopIntro = false;
}
ChristmasInDirtmouth.MerryDialogueManager.ShowDialogue(String.Format("MERRY_DIALOG_{0:d}", index));
prev_convo = index;
else
{
// Random dialog
System.Random rnd = new System.Random();
int index = rnd.Next(1, 4);
// Ensure we dont get the same message twice in a row
if (prev_convo == index)
{
index += 1;
if (index == 4) { index = 1; }
}
ChristmasInDirtmouth.MerryDialogueManager.ShowDialogue(String.Format("MERRY_DIALOG_{0:d}", index));
prev_convo = index;
}

}

}
}
}
Expand Down
99 changes: 55 additions & 44 deletions src/DirtmouthSceneHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,25 +169,32 @@ public void OnHeroUpdate()
// In the modding tutorial you will see the use of Input.GetKeyDown
// We dont use that here because we want to be agnostic to the key bind for up and also support controllers
// User the inputHanlder instead
if (GameManager.instance.inputHandler.inputActions.up.IsPressed && door_active)
if (door_active)
{
door_active = false;
// Trigger a scene transition
gm.BeginSceneTransition(new GameManager.SceneLoadInfo
Logger.Debug("Christmas shop door active");
// TODO Remove key down O, presently added due to issues
if (GameManager.instance.inputHandler.inputActions.up.WasPressed || GameManager.instance.inputHandler.inputActions.up.IsPressed || Input.GetKeyDown(KeyCode.O))
{
SceneName = ChristmasShopSceneHandler.Name,
EntryGateName = ChristmasShopSceneHandler.Gate,
HeroLeaveDirection = GatePosition.bottom,
EntryDelay = 0.2f,
WaitForSceneTransitionCameraFade = true,
PreventCameraFadeOut = false,
Visualization = GameManager.SceneLoadVisualizations.Default,
AlwaysUnloadUnusedAssets = false,
forceWaitFetch = false
});
// Must be after, the Begin transition will cancel animation if before
HeroController.instance.StartCoroutine(PlayExitAnimation());
Logger.Debug("Christmas shop door triggered");
door_active = false;
// Trigger a scene transition
gm.BeginSceneTransition(new GameManager.SceneLoadInfo
{
SceneName = ChristmasShopSceneHandler.Name,
EntryGateName = ChristmasShopSceneHandler.Gate,
HeroLeaveDirection = GatePosition.bottom,
EntryDelay = 0.2f,
WaitForSceneTransitionCameraFade = true,
PreventCameraFadeOut = false,
Visualization = GameManager.SceneLoadVisualizations.Default,
AlwaysUnloadUnusedAssets = false,
forceWaitFetch = false
});
// Must be after, the Begin transition will cancel animation if before
HeroController.instance.StartCoroutine(PlayExitAnimation());
}
}

}

private IEnumerator PlayExitAnimation()
Expand Down Expand Up @@ -255,35 +262,39 @@ public void OnHeroUpdate()
// In the modding tutorial you will see the use of Input.GetKeyDown
// We dont use that here because we want to be agnostic to the key bind for up and also support controllers
// User the inputHanlder instead
if (GameManager.instance.inputHandler.inputActions.up.IsPressed && tree_active)
{
tree_active = false;
// Trigger a scene transition
SceneManager sm = GameManager.instance.sm;
FieldInfo gmField = sm.GetType().GetField("gm", BindingFlags.NonPublic | BindingFlags.Instance);
GameManager gm = gmField.GetValue(sm) as GameManager;

AtmosCue atmosCue = ScriptableObject.CreateInstance<AtmosCue>();
gm.AudioManager.ApplyAtmosCue(atmosCue, 1.0f);

MusicCue musicCue = ScriptableObject.CreateInstance<MusicCue>();
gm.AudioManager.ApplyMusicCue(musicCue, 0f, 1.0f, false);

// Back ground music
AudioSource audio = transform.Find("audio").GetComponent<AudioSource>();
audio.Play();

// Enable Credits
GameObject credits = transform.Find("credits").gameObject;
Animator animator = credits.GetComponent<Animator>();
animator.Play("CreditsAnimation", -1, 0f);
credits.SetActive(true);

// Stop any previous coroutine and restart
StopCoroutine(co);
co = PlayFireworksAnimation();
StartCoroutine(co);
if (tree_active){
// TODO Remove key down O, presently added due to issues
if (GameManager.instance.inputHandler.inputActions.up.WasPressed || GameManager.instance.inputHandler.inputActions.up.IsPressed || Input.GetKeyDown(KeyCode.O))
{
tree_active = false;
// Trigger a scene transition
SceneManager sm = GameManager.instance.sm;
FieldInfo gmField = sm.GetType().GetField("gm", BindingFlags.NonPublic | BindingFlags.Instance);
GameManager gm = gmField.GetValue(sm) as GameManager;

AtmosCue atmosCue = ScriptableObject.CreateInstance<AtmosCue>();
gm.AudioManager.ApplyAtmosCue(atmosCue, 1.0f);

MusicCue musicCue = ScriptableObject.CreateInstance<MusicCue>();
gm.AudioManager.ApplyMusicCue(musicCue, 0f, 1.0f, false);

// Back ground music
AudioSource audio = transform.Find("audio").GetComponent<AudioSource>();
audio.Play();

// Enable Credits
GameObject credits = transform.Find("credits").gameObject;
Animator animator = credits.GetComponent<Animator>();
animator.Play("CreditsAnimation", -1, 0f);
credits.SetActive(true);

// Stop any previous coroutine and restart
StopCoroutine(co);
co = PlayFireworksAnimation();
StartCoroutine(co);
}
}

}

private IEnumerator PlayFireworksAnimation()
Expand Down
2 changes: 1 addition & 1 deletion src/ModClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ChristmasInDirtmouth
public class ChristmasInDirtmouth : Mod, ILocalSettings<ModData>, ICustomMenuMod, ITogglableMod
{
new public static string GetName() => "Christmas In Dirtmouth";
public override string GetVersion() => "1.0.1";
public override string GetVersion() => "1.0.2";

public static CustomDialogueManager MerryDialogueManager;
internal static ModData GlobalData = new ModData();
Expand Down

0 comments on commit c7cd35b

Please sign in to comment.