Fix export

This commit is contained in:
2025-03-31 01:18:36 -07:00
parent ffc3177244
commit 20dad3069a
15 changed files with 212 additions and 189 deletions

View File

@@ -38,80 +38,80 @@ public partial class App : CanvasLayer, IApp
public void Initialize()
{
var container = new SimpleInjector.Container();
container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();
container.Register<IAppRepo, AppRepo>(Lifestyle.Singleton);
container.Register<IAppLogic, AppLogic>(Lifestyle.Singleton);
container.Verify();
var container = new SimpleInjector.Container();
container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();
container.RegisterSingleton<IAppRepo, AppRepo>();
container.RegisterSingleton<IAppLogic, AppLogic>();
//container.Verify();
Instantiator = new Instantiator(GetTree());
Instantiator = new Instantiator(GetTree());
AppRepo = container.GetInstance<IAppRepo>();
AppLogic = container.GetInstance<IAppLogic>();
AppRepo = container.GetInstance<IAppRepo>();
AppLogic = container.GetInstance<IAppLogic>();
AppLogic.Set(AppRepo);
AppLogic.Set(new AppLogic.Data());
AppLogic.Set(AppRepo);
AppLogic.Set(new AppLogic.Data());
Menu.NewGame += OnNewGame;
Menu.LoadGame += OnLoadGame;
Menu.Quit += OnQuit;
Menu.NewGame += OnNewGame;
Menu.LoadGame += OnLoadGame;
Menu.Quit += OnQuit;
AnimationPlayer.AnimationFinished += OnAnimationFinished;
AnimationPlayer.AnimationFinished += OnAnimationFinished;
Input.MouseMode = Input.MouseModeEnum.Visible;
this.Provide();
Input.MouseMode = Input.MouseModeEnum.Visible;
this.Provide();
}
public void OnReady()
{
AppBinding = AppLogic.Bind();
AppBinding = AppLogic.Bind();
AppBinding
.Handle((in AppLogic.Output.ShowSplashScreen _) =>
{
HideMenus();
BlankScreen.Hide();
Splash.Show();
})
.Handle((in AppLogic.Output.HideSplashScreen _) =>
{
BlankScreen.Show();
FadeToBlack();
})
.Handle((in AppLogic.Output.SetupGameScene _) =>
{
Game = Instantiator.LoadAndInstantiate<Game>(GAME_SCENE_PATH);
GameWindow.AddChildEx(Game);
Instantiator.SceneTree.Paused = false;
})
.Handle((in AppLogic.Output.ShowMainMenu _) =>
{
// Load everything while we're showing a black screen, then fade in.
HideMenus();
Menu.Show();
AppBinding
.Handle((in AppLogic.Output.ShowSplashScreen _) =>
{
HideMenus();
BlankScreen.Hide();
Splash.Show();
})
.Handle((in AppLogic.Output.HideSplashScreen _) =>
{
BlankScreen.Show();
FadeToBlack();
})
.Handle((in AppLogic.Output.SetupGameScene _) =>
{
Game = Instantiator.LoadAndInstantiate<Game>(GAME_SCENE_PATH);
GameWindow.AddChildEx(Game);
Instantiator.SceneTree.Paused = false;
})
.Handle((in AppLogic.Output.ShowMainMenu _) =>
{
// Load everything while we're showing a black screen, then fade in.
HideMenus();
Menu.Show();
FadeInFromBlack();
Menu.NewGameButton.GrabFocus();
})
.Handle((in AppLogic.Output.FadeToBlack _) => FadeToBlack())
.Handle((in AppLogic.Output.HideGame _) => FadeToBlack())
.Handle((in AppLogic.Output.ShowGame _) =>
{
HideMenus();
FadeInFromBlack();
})
.Handle((in AppLogic.Output.StartLoadingSaveFile _) =>
{
Game.SaveFileLoaded += OnSaveFileLoaded;
Game.LoadExistingGame();
})
.Handle((in AppLogic.Output.ExitGame _) =>
{
GetTree().Quit();
});
FadeInFromBlack();
Menu.NewGameButton.GrabFocus();
})
.Handle((in AppLogic.Output.FadeToBlack _) => FadeToBlack())
.Handle((in AppLogic.Output.HideGame _) => FadeToBlack())
.Handle((in AppLogic.Output.ShowGame _) =>
{
HideMenus();
FadeInFromBlack();
})
.Handle((in AppLogic.Output.StartLoadingSaveFile _) =>
{
Game.SaveFileLoaded += OnSaveFileLoaded;
Game.LoadExistingGame();
})
.Handle((in AppLogic.Output.ExitGame _) =>
{
GetTree().Quit();
});
AppLogic.Start();
AppLogic.Start();
}
public void OnNewGame() => AppLogic.Input(new AppLogic.Input.NewGame());
@@ -122,44 +122,44 @@ public partial class App : CanvasLayer, IApp
public void OnSaveFileLoaded()
{
Game.SaveFileLoaded -= OnSaveFileLoaded;
AppLogic.Input(new AppLogic.Input.SaveFileLoaded());
Game.SaveFileLoaded -= OnSaveFileLoaded;
AppLogic.Input(new AppLogic.Input.SaveFileLoaded());
}
public void FadeInFromBlack()
{
BlankScreen.Show();
AnimationPlayer.Play("fade_in");
BlankScreen.Show();
AnimationPlayer.Play("fade_in");
}
public void FadeToBlack()
{
BlankScreen.Show();
AnimationPlayer.Play("fade_out");
BlankScreen.Show();
AnimationPlayer.Play("fade_out");
}
public void HideMenus()
{
Splash.Hide();
Menu.Hide();
Splash.Hide();
Menu.Hide();
}
public void OnAnimationFinished(StringName animation)
{
if (animation == "fade_in")
{
AppLogic.Input(new AppLogic.Input.FadeInFinished());
BlankScreen.Hide();
return;
}
if (animation == "fade_in")
{
AppLogic.Input(new AppLogic.Input.FadeInFinished());
BlankScreen.Hide();
return;
}
AppLogic.Input(new AppLogic.Input.FadeOutFinished());
AppLogic.Input(new AppLogic.Input.FadeOutFinished());
}
public void OnExitTree()
{
AppLogic.Stop();
AppBinding.Dispose();
AppRepo.Dispose();
AppLogic.Stop();
AppBinding.Dispose();
AppRepo.Dispose();
}
}

View File

@@ -78,7 +78,7 @@ public partial class Game : Node3D, IGame
{
_container = new SimpleInjector.Container();
Module.Bootstrap(_container);
_container.Verify();
//_container.Verify();
GameRepo = _container.GetInstance<IGameRepo>();
GameLogic = _container.GetInstance<IGameLogic>();

View File

@@ -173,7 +173,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
if (ItemSlots.Length == 0 || UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus())
return;
if (@event.IsActionPressed(GameInputs.UiRight) && _currentPageNumber == InventoryPageNumber.FirstPage && inventory.Items.Count() > _itemsPerPage)
if (@event.IsActionPressed(GameInputs.UiRight) && _currentPageNumber == InventoryPageNumber.FirstPage && inventory.Items.Count > _itemsPerPage)
ChangeInventoryPage(InventoryPageNumber.SecondPage);
if (@event.IsActionPressed(GameInputs.UiLeft) && _currentPageNumber == InventoryPageNumber.SecondPage)
@@ -250,7 +250,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
{
FloorLabel.Text = $"Floor {_map.CurrentFloorNumber:D2}";
if (ItemSlots.Any())
if (ItemSlots.Length != 0)
{
var item = ItemSlots.ElementAt(_currentIndex).Item;
ItemDescriptionTitle.Text = $"{item.ItemName}";
@@ -272,9 +272,9 @@ public partial class InventoryMenu : Control, IInventoryMenu
if (currentItem is EquipableItem equipable)
{
UseButton.Text = equipable.IsEquipped ? "Unequip" : "Equip";
ThrowButton.Disabled = equipable.IsEquipped ? true : false;
ThrowButton.Disabled = equipable.IsEquipped;
ThrowButton.FocusMode = equipable.IsEquipped ? FocusModeEnum.None : FocusModeEnum.All;
DropButton.Disabled = equipable.IsEquipped ? true : false;
DropButton.Disabled = equipable.IsEquipped;
DropButton.FocusMode = equipable.IsEquipped ? FocusModeEnum.None : FocusModeEnum.All;
}
else
@@ -345,7 +345,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
itemSlot.SetEquippedItemStyle();
}
if (ItemSlots.Any())
if (ItemSlots.Length != 0)
{
ItemSlots.ElementAt(_currentIndex).SetSelectedItemStyle();
if (ItemSlots.ElementAt(_currentIndex).Item is EquipableItem equipable && equipable.IsEquipped)

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=50 format=3 uid="uid://jds3hr41coal"]
[ext_resource type="Script" uid="uid://dcqssoikr3pl7" path="res://src/npc/Npc.cs" id="1_f3624"]
[ext_resource type="Resource" uid="uid://b681mabgdkg6j" path="res://src/npc/Ran/ran.dialogue" id="2_3udpp"]
[ext_resource type="Resource" uid="uid://lao0opxww3ib" path="res://src/dialog/Dialogue.dialogue" id="2_3udpp"]
[ext_resource type="Texture2D" uid="uid://ct2523slwx30o" path="res://src/npc/Ran/animations/Layer 1.png" id="4_bww12"]
[ext_resource type="Texture2D" uid="uid://b72fnsmgg1mff" path="res://src/npc/Ran/animations/Layer 2.png" id="5_jl1c6"]
[ext_resource type="Texture2D" uid="uid://c01a6i2hmq7nb" path="res://src/npc/Ran/animations/Layer 3.png" id="6_yx0nu"]

View File

@@ -95,7 +95,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
private Dictionary<int, int> _expToNextLevel;
private IDamageCalculator _damageCalculator;
private DamageCalculator _damageCalculator;
#region Initialization
public void Initialize()
@@ -118,7 +118,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
{
var container = new SimpleInjector.Container();
container.Register<IPlayerLogic, PlayerLogic>(Lifestyle.Singleton);
container.Verify();
//container.Verify();
Settings = new PlayerLogic.Settings() { RotationSpeed = PlayerStatResource.RotationSpeed, MoveSpeed = PlayerStatResource.MoveSpeed, Acceleration = PlayerStatResource.Acceleration };
Stats = new PlayerStatController();
@@ -218,10 +218,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
}
else
{
var attackSpeed = ((Weapon)EquippedWeapon.Value).AttackSpeed;
AnimationPlayer.SetSpeedScale((float)attackSpeed);
AnimationPlayer.Play("attack");
_gameRepo.OnPlayerAttack();
PlayAttackAnimation();
}
})
.Handle((in PlayerLogic.Output.ThrowItem output) =>
@@ -321,7 +318,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
transform.Basis = new Basis(Vector3.Up, Settings.RotationSpeed * -rawInput.X * delta) * transform.Basis;
var moveDirection = new Vector3(strafeRightInput - strafeLeftInput, 0, rawInput.Z).Normalized();
var velocity = Basis * moveDirection * Settings.MoveSpeed * Settings.Acceleration;
_knockbackStrength = _knockbackStrength * 0.9f;
_knockbackStrength *= 0.9f;
Transform = Transform with { Basis = transform.Basis };
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
MoveAndSlide();
@@ -481,6 +478,17 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
throwItem.GlobalRotation = GlobalRotation;
}
private void PlayAttackAnimation()
{
var attackSpeed = ((Weapon)EquippedWeapon.Value).AttackSpeed;
AnimationPlayer.SetSpeedScale((float)attackSpeed);
if (EquippedWeapon.Value.ItemName == "Atonement")
AnimationPlayer.Play("atonement_attack");
else
AnimationPlayer.Play("attack");
_gameRepo.OnPlayerAttack();
}
private void OnAnimationFinished(StringName animation)
{
PlayerLogic.Input(new PlayerLogic.Input.AttackAnimationFinished());

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=61 format=4 uid="uid://cfecvvav8kkp6"]
[gd_scene load_steps=62 format=4 uid="uid://cfecvvav8kkp6"]
[ext_resource type="Script" uid="uid://yxmiqy7i0t7r" path="res://src/player/Player.cs" id="1_xcol5"]
[ext_resource type="Script" uid="uid://6edayafleq8y" path="res://src/hitbox/Hitbox.cs" id="2_lb3qc"]
@@ -109,9 +109,14 @@ tracks/0/keys = {
"values": [10, 1, 11]
}
[sub_resource type="Animation" id="Animation_g183x"]
resource_name = "atonement_attack"
step = 0.0833333
[sub_resource type="AnimationLibrary" id="AnimationLibrary_w8l8m"]
_data = {
&"RESET": SubResource("Animation_hcjph"),
&"atonement_attack": SubResource("Animation_g183x"),
&"attack": SubResource("Animation_0jjwv"),
&"hit_wall": SubResource("Animation_es4xk")
}
@@ -539,7 +544,7 @@ flip_v = true
[node name="Camera" type="Node3D" parent="."]
[node name="Camera3D" type="Camera3D" parent="Camera"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.003, 1.52615, 0.482136)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.003, 1.62599, 0.482136)
cull_mask = 1048569
fov = 45.0
near = 0.001

View File

@@ -0,0 +1,37 @@
shader_type spatial;
render_mode unshaded;
// Handles the concentric ripples
uniform float frequency: hint_range(0, 15, 0.01) = 4.0;
uniform float amplitude: hint_range(0, 3, 0.1) = 2.0;
uniform float ripple_rate : hint_range(0, 20.0, 1) = 5;
uniform float blending : hint_range(0.0, 1.0, 0.01) = 1.0;
// Handles the waves themselves
uniform float wave_amplitude: hint_range(0.001, 0.1, 0.001) = 0.05;
uniform float wave_frequency: hint_range(0, 15, 0.01) = 4.0;
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, filter_linear_mipmap, repeat_disable;
vec2 wave(vec2 uv, float time) {
return vec2(
uv.x + sin(uv.y * wave_frequency + time) * wave_amplitude,
uv.y + sin(uv.x * wave_frequency + time) * wave_amplitude
);
}
void fragment() {
vec2 screen_pixel_size = 1.0 / VIEWPORT_SIZE;
vec2 center_position = -1.0 + 2.0 * UV;
float center_distance = length(center_position);
float ripple = sin(center_distance * -frequency * PI + ripple_rate * TIME) * amplitude / (center_distance + 1.0);
vec2 uv = FRAGCOORD.xy * screen_pixel_size + (center_position/center_distance) * ripple * wave_amplitude;
vec2 background_wave = wave(uv, TIME);
vec4 background_texture = texture(SCREEN_TEXTURE, background_wave) * sqrt(amplitude);
ALBEDO = background_texture.rgb;
ALPHA = blending;
}

View File

@@ -0,0 +1 @@
uid://oatmuwfkep0w