feature: Added input field
This commit is contained in:
parent
630459fedf
commit
df2fa8aed8
17 changed files with 1239 additions and 13 deletions
20
Assets/Scripts/Messaging/Composer/EmojiButton.cs
Normal file
20
Assets/Scripts/Messaging/Composer/EmojiButton.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Messaging.Composer {
|
||||
public class EmojiButton : MonoBehaviour {
|
||||
private TMP_Text _text;
|
||||
private InputField _inputField;
|
||||
|
||||
private void Awake() {
|
||||
_text = GetComponentInChildren<TMP_Text>();
|
||||
_inputField = FindObjectOfType<InputField>();
|
||||
}
|
||||
|
||||
public void OnClick() {
|
||||
string emojiToWrite = _text.text;
|
||||
_inputField.WriteEmoji(emojiToWrite);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Messaging/Composer/EmojiButton.cs.meta
Normal file
11
Assets/Scripts/Messaging/Composer/EmojiButton.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8fafc854708b18b43a3c2206e6008d42
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/Scripts/Messaging/Composer/InputField.cs
Normal file
16
Assets/Scripts/Messaging/Composer/InputField.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Messaging.Composer {
|
||||
public class InputField : MonoBehaviour {
|
||||
[SerializeField] private TMP_Text fieldText;
|
||||
|
||||
public void EmptyText() {
|
||||
fieldText.SetText("");
|
||||
}
|
||||
|
||||
public void WriteEmoji(string emoji) {
|
||||
fieldText.text += emoji;
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/Messaging/Composer/InputField.cs.meta
Normal file
3
Assets/Scripts/Messaging/Composer/InputField.cs.meta
Normal file
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ae946a71ba034ccbb31ceaa9ae8e4207
|
||||
timeCreated: 1706308358
|
Loading…
Add table
Add a link
Reference in a new issue