Compare commits
6 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
b1593f0094 | |
|
|
5d0a0fa622 | |
|
|
94f353af5b | |
|
|
c400fd62fe | |
|
|
7e71ade965 | |
|
|
22b5f6e62d |
|
|
@ -22,11 +22,18 @@ jobs:
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build --no-restore
|
run: dotnet build --no-restore
|
||||||
- name: Publish
|
- name: Publish
|
||||||
run: dotnet publish -r linux-x64 --self-contained
|
run: cd Mine2d && make
|
||||||
- name: Upload a Build Artifact
|
- name: Upload a Build Artifact
|
||||||
uses: actions/upload-artifact@v3.1.0
|
uses: actions/upload-artifact@v3.1.0
|
||||||
with:
|
with:
|
||||||
# Artifact name
|
# Artifact name
|
||||||
name: Linux build
|
name: Linux build
|
||||||
# A file, directory or wildcard pattern that describes what to upload
|
# A file, directory or wildcard pattern that describes what to upload
|
||||||
path: Mine2d/bin/Debug/net6.0/linux-x64/publish/Mine2d
|
path: Mine2d/build/linux-64.zip
|
||||||
|
- name: Upload a Build Artifact
|
||||||
|
uses: actions/upload-artifact@v3.1.0
|
||||||
|
with:
|
||||||
|
# Artifact name
|
||||||
|
name: Windows build
|
||||||
|
# A file, directory or wildcard pattern that describes what to upload
|
||||||
|
path: Mine2d/build/win-64.zip
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@ all: win-64 linux-64
|
||||||
|
|
||||||
win-64:
|
win-64:
|
||||||
dotnet publish --runtime win-x64 --output build/win-64
|
dotnet publish --runtime win-x64 --output build/win-64
|
||||||
|
cp credits.md build/win-64
|
||||||
zip -r build/win-64.zip build/win-64
|
zip -r build/win-64.zip build/win-64
|
||||||
|
|
||||||
linux-64:
|
linux-64:
|
||||||
dotnet publish --runtime linux-x64 --output build/linux-64
|
dotnet publish --runtime linux-x64 --output build/linux-64
|
||||||
|
cp credits.md build/linux-64
|
||||||
zip -r build/linux-64.zip build/linux-64
|
zip -r build/linux-64.zip build/linux-64
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Credits of used assets and Libraries
|
||||||
|
|
||||||
|
## Assets
|
||||||
|
|
||||||
|
* Character - [CutieCatTv](https://github.com/CutieCatTv)
|
||||||
|
* Nova Mono Font - Open Font License
|
||||||
|
* audio/block_break.wav - dxeyes - CC BY 4.0
|
||||||
|
* audio/block_hit.wav - MattRuthSound - CC BY 4.0
|
||||||
|
* audio/block_hit_alt.wav - MattRuthSound - CC BY 4.0
|
||||||
|
* audio/music-loop.wav - [Chris aka el3usis](https://www.youtube.com/@Eleusis/featured)
|
||||||
|
|
||||||
|
## Libraries
|
||||||
|
|
||||||
|
* SDL2# - zlib
|
||||||
|
* SDL2 - zlib
|
||||||
|
* Newtonsoft.Json - MIT
|
||||||
|
* WatsonTcp - MIT
|
||||||
|
|
@ -5,6 +5,13 @@ public enum Sound
|
||||||
BlockHit,
|
BlockHit,
|
||||||
BlockBreak,
|
BlockBreak,
|
||||||
ItemPickup,
|
ItemPickup,
|
||||||
|
MusicLoop,
|
||||||
|
Step0,
|
||||||
|
Step1,
|
||||||
|
Step2,
|
||||||
|
Step3,
|
||||||
|
Step4,
|
||||||
|
Step5,
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AudioPlayer
|
public class AudioPlayer
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using Mine2d.engine;
|
using Mine2d.engine;
|
||||||
using Mine2d.engine.system.annotations;
|
using Mine2d.engine.system.annotations;
|
||||||
using Mine2d.game.backend.network.packets;
|
using Mine2d.game.backend.network.packets;
|
||||||
|
using Mine2d.game.core;
|
||||||
|
|
||||||
namespace Mine2d.game.backend.interactor;
|
namespace Mine2d.game.backend.interactor;
|
||||||
|
|
||||||
|
|
@ -13,4 +14,35 @@ public class Audio
|
||||||
var ctx = Context.Get();
|
var ctx = Context.Get();
|
||||||
ctx.GameAudio.Play(Sound.BlockBreak);
|
ctx.GameAudio.Play(Sound.BlockBreak);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Interaction(InteractorKind.Client, PacketType.Tick)]
|
||||||
|
public static void Tick()
|
||||||
|
{
|
||||||
|
var ctx = Context.Get();
|
||||||
|
if (ctx.FrontendGameState.NextMusicPlay < DateTime.Now)
|
||||||
|
{
|
||||||
|
ctx.GameAudio.Play(Sound.MusicLoop);
|
||||||
|
ctx.FrontendGameState.NextMusicPlay = DateTime.Now.AddSeconds(130);
|
||||||
|
}
|
||||||
|
if (false && ctx.FrontendGameState.NextStepPlay < DateTime.Now && PlayerEntity.GetSelf().PlayerMovementState.CurrentVelocity != Vector2.Zero)
|
||||||
|
{
|
||||||
|
ctx.GameAudio.Play(GetRandomStepSound());
|
||||||
|
ctx.FrontendGameState.NextStepPlay = DateTime.Now.AddSeconds(0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Sound GetRandomStepSound()
|
||||||
|
{
|
||||||
|
var sound = new Random().NextInt64(0, 6);
|
||||||
|
return sound switch
|
||||||
|
{
|
||||||
|
0 => Sound.Step0,
|
||||||
|
1 => Sound.Step1,
|
||||||
|
2 => Sound.Step2,
|
||||||
|
3 => Sound.Step3,
|
||||||
|
4 => Sound.Step4,
|
||||||
|
5 => Sound.Step5,
|
||||||
|
_ => Sound.Step0
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@ public class Camera
|
||||||
var scale = ctx.FrontendGameState.Settings.GameScale;
|
var scale = ctx.FrontendGameState.Settings.GameScale;
|
||||||
var windowWidth = ctx.FrontendGameState.WindowWidth;
|
var windowWidth = ctx.FrontendGameState.WindowWidth;
|
||||||
var windowHeight = ctx.FrontendGameState.WindowHeight;
|
var windowHeight = ctx.FrontendGameState.WindowHeight;
|
||||||
this.Position = target - (new Vector2(windowWidth, windowHeight) / 2) / scale;
|
this.Position = target - (new Vector2(windowWidth, windowHeight) / 2 / scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Mine2d.game.core;
|
namespace Mine2d.game.core;
|
||||||
|
|
||||||
public static class Debugger
|
public static class Debugger
|
||||||
|
|
@ -11,4 +6,4 @@ public static class Debugger
|
||||||
{
|
{
|
||||||
Context.Get().FrontendGameState.DebugState.Messages.Enqueue(message);
|
Context.Get().FrontendGameState.DebugState.Messages.Enqueue(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,13 @@ public class GameAudio
|
||||||
this.audioPlayer.Register(Sound.BlockBreak, "assets.audio.block_break.wav");
|
this.audioPlayer.Register(Sound.BlockBreak, "assets.audio.block_break.wav");
|
||||||
this.audioPlayer.Register(Sound.BlockHit, "assets.audio.block_hit_alt.wav");
|
this.audioPlayer.Register(Sound.BlockHit, "assets.audio.block_hit_alt.wav");
|
||||||
this.audioPlayer.Register(Sound.ItemPickup, "assets.audio.item_pickup.wav");
|
this.audioPlayer.Register(Sound.ItemPickup, "assets.audio.item_pickup.wav");
|
||||||
|
this.audioPlayer.Register(Sound.MusicLoop, "assets.audio.music-loop.wav");
|
||||||
|
this.audioPlayer.Register(Sound.Step0, "assets.audio.step0.wav");
|
||||||
|
this.audioPlayer.Register(Sound.Step1, "assets.audio.step1.wav");
|
||||||
|
this.audioPlayer.Register(Sound.Step2, "assets.audio.step2.wav");
|
||||||
|
this.audioPlayer.Register(Sound.Step3, "assets.audio.step3.wav");
|
||||||
|
this.audioPlayer.Register(Sound.Step4, "assets.audio.step4.wav");
|
||||||
|
this.audioPlayer.Register(Sound.Step5, "assets.audio.step5.wav");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Play(Sound sound)
|
public void Play(Sound sound)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ public class FrontendGameState
|
||||||
public InventoryKind OpenInventory { get; set; } = InventoryKind.None;
|
public InventoryKind OpenInventory { get; set; } = InventoryKind.None;
|
||||||
public InputState InputState { get; set; } = new();
|
public InputState InputState { get; set; } = new();
|
||||||
public DebugState DebugState { get; set; } = new();
|
public DebugState DebugState { get; set; } = new();
|
||||||
|
public DateTime NextMusicPlay { get; set; } = DateTime.MinValue;
|
||||||
|
public DateTime NextStepPlay { get; set; } = DateTime.MinValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DebugState {
|
public class DebugState {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue