Qualcomm_Snapdragon_VR_SDK SvrManager脚本简介(1)

本文将继续介绍SvrManager中的脚本内容。

	/// <summary>
	/// Svr event listener.
	/// </summary>
	public interface SvrEventListener {
		/// <summary>
		/// Raises the svr event event.
		/// </summary>
		/// <param name="ev">Ev.</param>
		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<SvrEventListener> 	eventListeners = new List<SvrEventListener>();

Svr中定义了事件监听接口SvrEventListener,用来监听SDK运行状态的改变。开发者可以通过该接口定义自己的事件监听类,而SvrManager中保存的eventlisteners变量即为场景内的所有的事件监听类,当有状态改变时,监听类会收到事件改变的消息,并执行对应的方法。


阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭