Loading screen fixes, transition screen UI fixes
This commit is contained in:
@@ -38,34 +38,42 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
|
||||
|
||||
public event Action TransitionCompleted;
|
||||
|
||||
private bool _fadingIn = false;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
_player.ExperiencePointsComponent.Level.Sync += Level_Sync;
|
||||
_player.ExperiencePointsComponent.CurrentExp.Sync += Exp_Sync;
|
||||
_player.ExperiencePointsComponent.ExpToNextLevel.Sync += Exp_Sync;
|
||||
_player.HealthComponent.CurrentHP.Sync += HP_Sync;
|
||||
_player.HealthComponent.MaximumHP.Sync += HP_Sync;
|
||||
_player.VTComponent.CurrentVT.Sync += VT_Sync;
|
||||
_player.VTComponent.MaximumVT.Sync += VT_Sync;
|
||||
_player.AttackComponent.CurrentAttack.Sync += Attack_Sync;
|
||||
_player.AttackComponent.MaximumAttack.Sync += Attack_Sync;
|
||||
_player.DefenseComponent.CurrentDefense.Sync += Defense_Sync;
|
||||
_player.DefenseComponent.MaximumDefense.Sync += Defense_Sync;
|
||||
_player.EquipmentComponent.EquipmentChanged += EquipmentComponent_EquipmentChanged;
|
||||
_map.CurrentFloorNumber.Sync += CurrentFloorNumber_Sync;
|
||||
_player.ExperiencePointsComponent.Level.Sync += Level_Sync;
|
||||
_player.ExperiencePointsComponent.CurrentExp.Sync += Exp_Sync;
|
||||
_player.ExperiencePointsComponent.ExpToNextLevel.Sync += Exp_Sync;
|
||||
_player.HealthComponent.CurrentHP.Sync += HP_Sync;
|
||||
_player.HealthComponent.MaximumHP.Sync += HP_Sync;
|
||||
_player.VTComponent.CurrentVT.Sync += VT_Sync;
|
||||
_player.VTComponent.MaximumVT.Sync += VT_Sync;
|
||||
_player.AttackComponent.CurrentAttack.Sync += Attack_Sync;
|
||||
_player.AttackComponent.MaximumAttack.Sync += Attack_Sync;
|
||||
_player.DefenseComponent.CurrentDefense.Sync += Defense_Sync;
|
||||
_player.DefenseComponent.MaximumDefense.Sync += Defense_Sync;
|
||||
_player.EquipmentComponent.EquipmentChanged += EquipmentComponent_EquipmentChanged;
|
||||
_map.CurrentFloorNumber.Sync += CurrentFloorNumber_Sync;
|
||||
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
AnimationPlayer.AnimationStarted += AnimationPlayer_AnimationStarted;
|
||||
ContinueButton.Pressed += ContinueButton_Pressed;
|
||||
ExitButton.Pressed += ExitButton_Pressed;
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
AnimationPlayer.AnimationStarted += AnimationPlayer_AnimationStarted;
|
||||
ContinueButton.Pressed += ContinueButton_Pressed;
|
||||
ExitButton.Pressed += ExitButton_Pressed;
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (_fadingIn)
|
||||
GetViewport().SetInputAsHandled();
|
||||
}
|
||||
|
||||
private void CurrentFloorNumber_Sync(int _) => FloorNumber.Text = _map.CurrentFloorNumber.Value.ToString("D2");
|
||||
|
||||
private void EquipmentComponent_EquipmentChanged(EquipableItem obj)
|
||||
{
|
||||
Attack_Sync(0);
|
||||
Defense_Sync(0);
|
||||
Attack_Sync(0);
|
||||
Defense_Sync(0);
|
||||
}
|
||||
|
||||
private void Attack_Sync(int _) => ATKLabel.Text = $"{_player.AttackComponent.CurrentAttack.Value}/{_player.AttackComponent.MaximumAttack.Value}+{_player.EquipmentComponent.BonusAttack}";
|
||||
@@ -78,35 +86,44 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
|
||||
|
||||
private void ExitButton_Pressed()
|
||||
{
|
||||
ContinueButton.Disabled = true;
|
||||
ExitButton.Disabled = true;
|
||||
FadeOut();
|
||||
Exit?.Invoke();
|
||||
ContinueButton.Disabled = true;
|
||||
ExitButton.Disabled = true;
|
||||
FadeOut();
|
||||
Exit?.Invoke();
|
||||
}
|
||||
|
||||
private void ContinueButton_Pressed()
|
||||
{
|
||||
ContinueButton.Disabled = true;
|
||||
ExitButton.Disabled = true;
|
||||
GoToNextFloor?.Invoke();
|
||||
ContinueButton.Disabled = true;
|
||||
ExitButton.Disabled = true;
|
||||
GoToNextFloor?.Invoke();
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationStarted(StringName animName)
|
||||
{
|
||||
if (animName == "fade_in")
|
||||
ContinueButton.CallDeferred(MethodName.GrabFocus);
|
||||
if (animName == "fade_out")
|
||||
CallDeferred(MethodName.ReleaseFocus);
|
||||
if (animName == "fade_in")
|
||||
{
|
||||
_fadingIn = true;
|
||||
ContinueButton.Disabled = true;
|
||||
ExitButton.Disabled = true;
|
||||
ContinueButton.CallDeferred(MethodName.GrabFocus);
|
||||
}
|
||||
if (animName == "fade_out")
|
||||
{
|
||||
_fadingIn = true;
|
||||
CallDeferred(MethodName.ReleaseFocus);
|
||||
}
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "fade_in")
|
||||
{
|
||||
ContinueButton.Disabled = false;
|
||||
ExitButton.Disabled = false;
|
||||
}
|
||||
if (animName == "fade_out")
|
||||
TransitionCompleted?.Invoke();
|
||||
if (animName == "fade_in")
|
||||
{
|
||||
_fadingIn = false;
|
||||
ContinueButton.Disabled = false;
|
||||
ExitButton.Disabled = false;
|
||||
}
|
||||
if (animName == "fade_out")
|
||||
TransitionCompleted?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user