Интерфейс для диалогов

This commit is contained in:
Евгений Титаренко 2024-08-24 19:53:51 +03:00
parent 7afef58a7f
commit 65003d3030
10 changed files with 288 additions and 49 deletions

View file

@ -35,11 +35,15 @@ public partial class Player : CharacterBody2D
break;
case State.ReadChat:
_nextLabel.Visible = false;
_exitLabel.Visible = true;
_chatLogContainer.CurrentState = ChatLogContainer.ChatState.Default;
break;
case State.Wait:
break;
case State.ChatWithNPC:
_nextLabel.Visible = true;
_exitLabel.Visible = false;
_chatLogContainer.CurrentState = ChatLogContainer.ChatState.Default;
break;
default:
throw new ArgumentOutOfRangeException();
@ -80,7 +84,8 @@ public partial class Player : CharacterBody2D
private AnimatedSprite2D _sprite;
private PanelContainer _chatLog;
private PanelContainer _nextLabel;
private VBoxContainer _chatLogContainer;
private PanelContainer _exitLabel;
private ChatLogContainer _chatLogContainer;
private Camera2D _camera;
private AudioCollection _footsteps;
private AudioCollection _doorSounds;
@ -91,7 +96,7 @@ public partial class Player : CharacterBody2D
private Vector2 _previousPosition;
private Vector2 _nextPosition;
private Vector2 _cameraDefaultPosition = new(0, -20);
private Vector2 _cameraChatLogPosition = new(96, -20);
private Vector2 _cameraChatLogPosition = new(108, -20);
private PackedScene _dialogBox = GD.Load<PackedScene>("res://prefabs/Dialog.tscn");
@ -100,7 +105,8 @@ public partial class Player : CharacterBody2D
_sprite = (AnimatedSprite2D)FindChild("AnimatedSprite2D");
_chatLog = (PanelContainer)FindChild("ChatLog");
_nextLabel = (PanelContainer)FindChild("NextLabel");
_chatLogContainer = (VBoxContainer)FindChild("ChatLogContainer");
_exitLabel = (PanelContainer)FindChild("ExitLabel");
_chatLogContainer = (ChatLogContainer)FindChild("ChatLogContainer");
_camera = (Camera2D)FindChild("Camera2D");
_footsteps = (AudioCollection)FindChild("Footsteps");
_doorSounds = (AudioCollection)FindChild("DoorSounds");
@ -251,6 +257,7 @@ public partial class Player : CharacterBody2D
break;
case State.ReadChat:
CurrentState = State.Normal;
_chatLogContainer.CurrentState = ChatLogContainer.ChatState.Hidden;
break;
}
}