mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
Adds summary help and Room ActivityComponentBase
This commit is contained in:
@@ -41,42 +41,81 @@ namespace PepperDash.Essentials.Core.Interfaces.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRoomActivityComponent : IRoomComponent
|
public interface IRoomActivityComponent : IRoomComponent
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if the component is enabled
|
||||||
|
/// </summary>
|
||||||
BoolFeedback IsEnabledFeedback { get; }
|
BoolFeedback IsEnabledFeedback { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set this value to enable or disable the component
|
||||||
|
/// </summary>
|
||||||
bool Enable { set; }
|
bool Enable { set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Label to be displayed for the activity on the UI
|
||||||
|
/// </summary>
|
||||||
string Label { get; }
|
string Label { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Icon to be displayed for the activity on the UI
|
||||||
|
/// </summary>
|
||||||
string Icon { get; }
|
string Icon { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// The component group that will be activated when this activty starts
|
||||||
|
/// </summary>
|
||||||
IRoomBehaviourGroupComponent Component { get; }
|
IRoomBehaviourGroupComponent Component { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Determines the order the activities will be displayed on the UI
|
||||||
|
/// </summary>
|
||||||
int Order { get; }
|
int Order { get; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts the activity
|
||||||
|
/// </summary>
|
||||||
void StartActivity();
|
void StartActivity();
|
||||||
|
/// <summary>
|
||||||
|
/// Ends the activity
|
||||||
|
/// </summary>
|
||||||
void EndActivity();
|
void EndActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Describes a room component that can be "used" by a user
|
/// Describes a room component that can be "activated"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IActivatableComponent : IRoomComponent
|
public interface IActivatableComponent : IRoomComponent
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if the component is activated
|
||||||
|
/// </summary>
|
||||||
BoolFeedback ActivatedFeedback { get; }
|
BoolFeedback ActivatedFeedback { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Activates the component
|
||||||
|
/// </summary>
|
||||||
void Activate();
|
void Activate();
|
||||||
|
/// <summary>
|
||||||
|
/// Dactivates the component
|
||||||
|
/// </summary>
|
||||||
void Deactivate();
|
void Deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Describes a room behaviour component. Is able to contain a collection of components that aggregate
|
/// Describes a group of room behaviour component. Is able to contain a collection of components that aggregate
|
||||||
/// together to behave as one
|
/// together to behave as one
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRoomBehaviourGroupComponent
|
public interface IRoomBehaviourGroupComponent
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A collection of components that work together to achieve a common behaviour
|
||||||
|
/// </summary>
|
||||||
List<IActivatableComponent> Components { get; }
|
List<IActivatableComponent> Components { get; }
|
||||||
|
|
||||||
void ActivateComponents();
|
void ActivateComponents();
|
||||||
void DeactivateComponents();
|
void DeactivateComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Describes an individual room behaviour component
|
||||||
|
/// </summary>
|
||||||
public interface IRoomBehaviourComponent : IActivatableComponent
|
public interface IRoomBehaviourComponent : IActivatableComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -84,10 +123,13 @@ namespace PepperDash.Essentials.Core.Interfaces.Components
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Describes a room device component
|
/// Describes a room device component behaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRoomDeviceComponent<T> : IActivatableComponent where T : EssentialsDevice
|
public interface IDeviceBehaviourComponent<T> : IActivatableComponent where T : EssentialsDevice
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The device this component applies behaviour to
|
||||||
|
/// </summary>
|
||||||
T Device { get; }
|
T Device { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,5 +35,78 @@ namespace PepperDash.Essentials.Core.Room.Components
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The base class from which Room Activities should be derived
|
||||||
|
/// </summary>
|
||||||
|
public abstract class RoomActivityComponentBase : IRoomActivityComponent
|
||||||
|
{
|
||||||
|
|
||||||
|
#region IRoomActivityComponent Members
|
||||||
|
|
||||||
|
public BoolFeedback IsEnabledFeedback { get; private set; }
|
||||||
|
|
||||||
|
private bool _enable;
|
||||||
|
|
||||||
|
public bool Enable
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != _enable)
|
||||||
|
{
|
||||||
|
_enable = value;
|
||||||
|
IsEnabledFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Label { get; private set; }
|
||||||
|
|
||||||
|
public string Icon { get; private set; }
|
||||||
|
|
||||||
|
public IRoomBehaviourGroupComponent Component { get; private set; }
|
||||||
|
|
||||||
|
public int Order { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IRoomComponent Members
|
||||||
|
|
||||||
|
public IComponentRoom Parent { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IKeyed Members
|
||||||
|
|
||||||
|
private string _componentKey;
|
||||||
|
|
||||||
|
public string Key
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Parent.Key + "-" + _componentKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public RoomActivityComponentBase(string key, IComponentRoom parent)
|
||||||
|
{
|
||||||
|
_componentKey = key;
|
||||||
|
Parent = parent;
|
||||||
|
|
||||||
|
IsEnabledFeedback = new BoolFeedback(() => _enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartActivity()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndActivity()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user