Typing indicator (typing chat bubble) (#8215)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
namespace Content.Shared.Chat.TypingIndicator;
|
||||
|
||||
/// <summary>
|
||||
/// Sync typing indicator icon between client and server.
|
||||
/// </summary>
|
||||
public abstract class SharedTypingIndicatorSystem : EntitySystem
|
||||
{
|
||||
|
||||
}
|
||||
20
Content.Shared/Chat/TypingIndicator/TypingChangedEvent.cs
Normal file
20
Content.Shared/Chat/TypingIndicator/TypingChangedEvent.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Chat.TypingIndicator;
|
||||
|
||||
/// <summary>
|
||||
/// Networked event from client.
|
||||
/// Send to server when client started/stopped typing in chat input field.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class TypingChangedEvent : EntityEventArgs
|
||||
{
|
||||
public readonly EntityUid Uid;
|
||||
public readonly bool IsTyping;
|
||||
|
||||
public TypingChangedEvent(EntityUid uid, bool isTyping)
|
||||
{
|
||||
Uid = uid;
|
||||
IsTyping = isTyping;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Chat.TypingIndicator;
|
||||
|
||||
/// <summary>
|
||||
/// Show typing indicator icon when player typing text in chat box.
|
||||
/// Added automatically when player poses entity.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[Friend(typeof(SharedTypingIndicatorSystem))]
|
||||
public sealed class TypingIndicatorComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Prototype id that store all visual info about typing indicator.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[DataField("proto", customTypeSerializer: typeof(PrototypeIdSerializer<TypingIndicatorPrototype>))]
|
||||
public string Prototype = "default";
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Chat.TypingIndicator;
|
||||
|
||||
/// <summary>
|
||||
/// Prototype to store chat typing indicator visuals.
|
||||
/// </summary>
|
||||
[Prototype("typingIndicator")]
|
||||
public sealed class TypingIndicatorPrototype : IPrototype
|
||||
{
|
||||
[IdDataFieldAttribute]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
[DataField("spritePath")]
|
||||
public ResourcePath SpritePath = new("/Textures/Effects/speech.rsi");
|
||||
|
||||
[DataField("typingState", required: true)]
|
||||
public string TypingState = default!;
|
||||
|
||||
[DataField("offset")]
|
||||
public Vector2 Offset = new(0.5f, 0.5f);
|
||||
|
||||
[DataField("shader")]
|
||||
public string Shader = "unshaded";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Chat.TypingIndicator;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum TypingIndicatorVisuals : byte
|
||||
{
|
||||
IsTyping
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum TypingIndicatorLayers : byte
|
||||
{
|
||||
Base
|
||||
}
|
||||
Reference in New Issue
Block a user