本文将继续介绍SvrManager中的脚本内容。
///
/// Svr event listener.
///
public interface SvrEventListener {
///
/// Raises the svr event event.
///
/// Ev.
void OnSvrEvent (SvrEvent ev);
};
public enum svrThermalLevel
{
kSafe,
kLevel1,
kLevel2,
kLevel3,
kCritical,
kNumThermalLevels
};
public enum svrThermalZone
{
kCpu,
kGpu,
kSkin,
kNumThermalZones
};
public struct svrEventData_Thermal
{
public svrThermalZone zone; //!< Thermal zone
public svrThermalLevel level; //!< Indication of the current zone thermal level
};
[StructLayout(LayoutKind.Explicit)]
public struct svrEventData
{
[FieldOffset(0)]
public svrEventData_Thermal thermal;
//[FieldOffset(0)]
//public svrEventData_New newData;
}
public struct SvrEvent
{
public svrEventType eventType; //!< Type of event
public uint deviceId; //!< An identifier for the device that generated the event (0 == HMD)
public float eventTimeStamp; //!< Time stamp for the event in seconds since the last svrBeginVr call
public svrEventData eventData; //!< Event specific data payload
};
private List eventListeners = new List();
Svr中定义了事件监听接口SvrEventListener,用来监听SDK运行状态的改变。开发者可以通过该接口定义自己的事件监听类,而SvrManager中保存的eventlisteners变量即为场景内的所有的事件监听类,当有状态改变时,监听类会收到事件改变的消息,并执行对应的方法。