Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with item spawning and audio distortion #9

Merged
merged 9 commits into from
Feb 4, 2024
77 changes: 77 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Automatic Release

on:
push:
branches:
- main

jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Configure Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"

- name: Determine new version and update modinfo.yml
run: |
# Lesen der aktuellen Version aus modinfo.yml
CURRENT_VERSION=$(grep 'version:' modinfo.yml | sed 's/version: //')
echo "Aktuelle Version: $CURRENT_VERSION"

# Inkrementieren der Patch-Version
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. -v OFS=. '{$NF += 1; print}')
echo "Neue Version: $NEW_VERSION"

# Aktualisieren der modinfo.yml mit der neuen Version
sed -i "s/version: $CURRENT_VERSION/version: $NEW_VERSION/" modinfo.yml

# Hinzufügen und Committen der Änderungen
git add modinfo.yml
git commit -m "Update version to $NEW_VERSION"
git push

# Setzen der neuen Version in der GitHub-Action-Umgebung
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ env.NEW_VERSION }}

- name: Archive Release
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'ItemRumbleMelodyManiaMod.zip'
exclusions: '*.git* /*node_modules/* .editorconfig'

- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.NEW_VERSION }}
name: Release ${{ env.NEW_VERSION }}
artifacts: 'ItemRumbleMelodyManiaMod.zip'
body: |
# Release ${{ env.NEW_VERSION }}

## Installation Instructions
For detailed installation instructions, visit [Melody Mania](https://melodymania.org/how-to-mods).

## Changelog
${{ steps.tag_version.outputs.changelog }}

## Download
Download the `ItemRumbleMelodyManiaMod.zip` from the artifacts below.




Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
// Mod settings are saved to file when the app is closed.
public class ItemRumbleModModSettings : IModSettings
{
public bool myBool = true;
public double myDouble = 12.34;
public int myInt = 42;
public int percentChanceToSpawnItem = 25;
public string activeItemList = "";

public bool collectOnPerfectNote = true;

public List<IModSettingControl> GetModSettingControls()
{
return new List<IModSettingControl>()
{
new BoolModSettingControl(() => myBool, newValue => myBool = newValue) { Label = "My Bool" },
new DoubleModSettingControl(() => myDouble, newValue => myDouble = newValue) { Label = "My Double" },
new IntModSettingControl(() => myInt, newValue => myInt = newValue) { Label = "My Int" },
new BoolModSettingControl(() => collectOnPerfectNote, newValue => collectOnPerfectNote = newValue) { Label = "Collect item on perfect note (Not on correct pitch at item Position)" },
new IntModSettingControl(() => percentChanceToSpawnItem, newValue => percentChanceToSpawnItem = newValue) { Label = "Spawn probability for item on each note (%)" }
};
}
}
2 changes: 0 additions & 2 deletions 001-Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ public class Item
// Has to be object, because of loading order of cs files.
public Action<object, object> OnCollectAction { get; set; } = (object itemActionsObject, object itemControlObject) => { };

// Dictionary to store spawn probability thresholds and probabilities
public Dictionary<int, float> SpawnProbabilities { get; set; } = new Dictionary<int, float>();


public Item(string name, string description = "")
Expand Down
20 changes: 15 additions & 5 deletions 003-ItemActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,28 @@ public void ChangePlaybackSpeed(float seconds, float speedFactor = 1.5f)
{
LeanTween.value(singSceneControl.gameObject, 1f, speedFactor, 0.5f).setOnUpdate((float val) =>
{
singSceneControl.songAudioPlayer.PlaybackSpeed = val;
singSceneControl.songAudioPlayer.SetPlaybackSpeed(val, true);
singSceneControl.songVideoPlayer.PlaybackSpeed = val;
});

LeanTween.delayedCall(seconds, () =>
{
LeanTween.value(singSceneControl.gameObject, speedFactor, 1f, 0.5f).setOnUpdate((float val) =>
{
singSceneControl.songAudioPlayer.PlaybackSpeed = val;
singSceneControl.songAudioPlayer.SetPlaybackSpeed(val, true);

singSceneControl.songVideoPlayer.PlaybackSpeed = val;
});
});
}

public void HideNotesForSeconds(float seconds)
public void HideNotesForSeconds(PlayerControl targetPlayerControl, float seconds)
{
LeanTween.delayedCall(seconds + 1.6f, () =>
{
playerControl.PlayerUiControl.NoteDisplayer.FadeIn(0.8f);
targetPlayerControl.PlayerUiControl.NoteDisplayer.FadeIn(0.8f);
});
playerControl.PlayerUiControl.NoteDisplayer.FadeOut(0.8f);
targetPlayerControl.PlayerUiControl.NoteDisplayer.FadeOut(0.8f);
}
public void BouncePlayerScoreLabel(PlayerControl targetPlayerControl, float scale = 1.5f)
{
Expand Down Expand Up @@ -129,6 +130,15 @@ public PlayerControl GetFirstPlacePlayerControl()
return playerControls.OrderByDescending(pc => pc.PlayerScoreControl.TotalScore).First();
}

public List<PlayerControl> GetPlayerControlsInFrontOfMe()
{
List<PlayerControl> playerControls = singSceneControl.PlayerControls;
int myPoints = playerControl.PlayerScoreControl.TotalScore;
return playerControls
.Where(pc => pc.PlayerScoreControl.TotalScore > myPoints)
.OrderBy(pc => pc.PlayerScoreControl.TotalScore).ToList();
}

public PlayerControl GetInFrontOfMePlayerControl()
{
List<PlayerControl> playerControls = singSceneControl.PlayerControls;
Expand Down
Loading