mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 12:06:58 +00:00
fix: invert interface to be custom instead of default
This way, existing rooms and devices will build messengers by default, while new plugins can implement their own messengers
This commit is contained in:
parent
4d608eef06
commit
b689c847fb
3 changed files with 21 additions and 7 deletions
|
|
@ -6,9 +6,9 @@ using PepperDash.Core;
|
||||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use this interface on a device or room if it should use default Mobile Control messengers
|
/// Use this interface on a device or room if it uses custom Mobile Control messengers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IStandardMobileControl : IKeyed
|
public interface ICustomMobileControl : IKeyed
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,20 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
CreateMobileControlMessengers();
|
||||||
|
|
||||||
|
return base.CustomActivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override this method to build and create custom Mobile Control Messengers during the Activation phase
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void CreateMobileControlMessengers() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||||
|
|
|
||||||
|
|
@ -476,23 +476,23 @@ namespace PepperDash.Essentials
|
||||||
var room = Core.DeviceFactory.GetDevice(roomConfig);
|
var room = Core.DeviceFactory.GetDevice(roomConfig);
|
||||||
|
|
||||||
DeviceManager.AddDevice(room);
|
DeviceManager.AddDevice(room);
|
||||||
if (!(room is IStandardMobileControl))
|
if (room is ICustomMobileControl)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildMC(room as IStandardMobileControl);
|
BuildMC(room as IEssentialsRoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void BuildMC(IStandardMobileControl room)
|
private static void BuildMC(IEssentialsRoom room)
|
||||||
{
|
{
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge for ");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, $"Attempting to build Mobile Control Bridge for {room?.Key}");
|
||||||
|
|
||||||
CreateMobileControlBridge(room as IEssentialsRoom);
|
CreateMobileControlBridge(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateMobileControlBridge(IEssentialsRoom room)
|
private static void CreateMobileControlBridge(IEssentialsRoom room)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue