using System.Collections.Generic;
namespace AxibugEmuOnline.Client.InputDevices
{
public abstract class InputResolver
{
public static InputResolver Create()
{
#if ENABLE_INPUT_SYSTEM //InputSystem
return new InputSystemResolver();
#elif UNITY_PSP2 //SDK
throw new System.NotImplementedException();
#elif UNITY_PS3 //SDK
throw new System.NotImplementedException();
#else //使用旧Input
throw new System.NotImplementedException();
#endif
}
/// 禁止外部构造
protected InputResolver()
{
OnInit();
}
protected abstract void OnInit();
///
/// 获得所有当前已连入的输入设备
///
///
public abstract IEnumerable GetDevices();
///
/// 检查指定输入设备是否还保持着连接
///
///
public abstract bool CheckOnline(InputDevice device);
/// 丢失的设备
public delegate void OnDeviceLostHandle(InputDevice lostDevice);
/// 当设备丢失时触发
public event OnDeviceLostHandle OnDeviceLost;
protected void RaiseDeviceLost(InputDevice lostDevice)
{
OnDeviceLost?.Invoke(lostDevice);
}
/// 建立连接的设备
public delegate void OnDeviceConnectedHandle(InputDevice connectDevice);
/// 当设备连接时触发
public event OnDeviceConnectedHandle OnDeviceConnected;
protected void RaiseDeviceConnected(InputDevice connectDevice)
{
OnDeviceConnected?.Invoke(connectDevice);
}
}
}