refactor: Converted message data to its own struct
This commit is contained in:
parent
1fc809141c
commit
9dd340eeb7
10 changed files with 339 additions and 18 deletions
25
Assets/Scripts/Messaging/Composer/SendButton.cs
Normal file
25
Assets/Scripts/Messaging/Composer/SendButton.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Messaging.Composer {
|
||||
public class SendButton : MonoBehaviour {
|
||||
[SerializeField] private InputField inputField;
|
||||
|
||||
private MessageManager _messageManager;
|
||||
|
||||
private void Awake() {
|
||||
_messageManager = FindObjectOfType<MessageManager>();
|
||||
}
|
||||
|
||||
public void SendEmojis() {
|
||||
if (CanSendText()) {
|
||||
_messageManager.CreateMessage(inputField.Text, true);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanSendText() {
|
||||
return !string.IsNullOrEmpty(inputField.Text) && !string.IsNullOrWhiteSpace(inputField.Text);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue