diff --git a/Assets/_Client/GUI/Main.uss b/Assets/_Client/GUI/Main.uss
index 44e2e18..3bd152b 100644
--- a/Assets/_Client/GUI/Main.uss
+++ b/Assets/_Client/GUI/Main.uss
@@ -2,6 +2,5 @@
}
.expandable {
- flex-grow: 1;
white-space: normal;
}
diff --git a/Assets/_Client/GUI/Main.uxml b/Assets/_Client/GUI/Main.uxml
index b02b208..a3951ed 100644
--- a/Assets/_Client/GUI/Main.uxml
+++ b/Assets/_Client/GUI/Main.uxml
@@ -1,11 +1,10 @@
-
-
-
-
+
-
+
+
+
diff --git a/Assets/_Client/Scripts/UI/UIController.cs b/Assets/_Client/Scripts/UI/UIController.cs
index ce39cca..4f5d689 100644
--- a/Assets/_Client/Scripts/UI/UIController.cs
+++ b/Assets/_Client/Scripts/UI/UIController.cs
@@ -6,40 +6,28 @@ using UnityEngine.UIElements;
namespace PPGIA.X540.Project3
{
- [RequireComponent(typeof(UIController))]
+ [RequireComponent(typeof(UIDocument))]
public class UIController : MonoBehaviour
{
+ public enum UIState
+ {
+ Idle = 0,
+ Recording = 1,
+ Processing = 2
+ }
+
private UIDocument _uiDocument;
private VisualElement _root;
#region -- Fields & Properties ----------------------------------------
- // Buttons ------------------------------------------------------------
- private readonly string[] _sessionButtonLabels = {
- "Iniciar Sessão",
- "Encerrar Sessão"
+ private readonly string[] _sendChatButtonLabels = {
+ "Falar...",
+ "Enviar...",
+ "Processando... Aguarde..."
};
- private Button _sessionButton;
- private Button _sendChatButton;
- private int _currentSessionState = 0;
- public bool SessionActive
- {
- get => _currentSessionState == 1;
- set
- {
- _currentSessionState = value ? 1 : 0;
- _sessionButton.text = _sessionButtonLabels[_currentSessionState];
- InputEnabled = value;
- }
- }
-
- // Chat Fields --------------------------------------------------------
- private TextField _chatInputField;
- public string ChatInput
- {
- get => _chatInputField.value;
- set => _chatInputField.value = value;
- }
+ // UI controls --------------------------------------------------------
+ private Button _talkButton;
private TextField _chatOutputField;
public string ChatOutput
@@ -48,22 +36,6 @@ namespace PPGIA.X540.Project3
set => _chatOutputField.value = value;
}
- public bool InputEnabled
- {
- get
- {
- var value = _chatInputField.enabledSelf;
- _sendChatButton.SetEnabled(value);
- return value;
- }
- set
- {
- _chatInputField.SetEnabled(value);
- _sendChatButton.SetEnabled(value);
- }
- }
-
- // Progress Bar -------------------------------------------------------
private ProgressBar _progressBar;
public float Progress
{
@@ -71,9 +43,30 @@ namespace PPGIA.X540.Project3
set => _progressBar.value = value;
}
+ // State management ---------------------------------------------------
+ private UIState _currentState = UIState.Idle;
+ public UIState CurrentState
+ {
+ get => _currentState;
+ set
+ {
+ _currentState = value;
+ _talkButton.text = _sendChatButtonLabels[(int)value];
+ if (value == UIState.Processing)
+ {
+ _talkButton.SetEnabled(false);
+ _progressBar.value = 0.5f;
+ }
+ else
+ {
+ _talkButton.SetEnabled(true);
+ _progressBar.value = 0f;
+ }
+ }
+ }
+
// Event Handlers -----------------------------------------------------
- public event Action OnSessionButtonClicked;
- public event Action OnSendChatButtonClicked;
+ public event Action OnTalkButtonClicked;
#endregion ------------------------------------------------------------
@@ -83,36 +76,43 @@ namespace PPGIA.X540.Project3
_uiDocument = GetComponent();
_root = _uiDocument.rootVisualElement;
- _sessionButton = _root.Q