示例#1
0
 public void SetCamerasPlugin(ICameraPlugin camplugin)
 {
     foreach (var camera in _registeredCameras)
     {
         camera.CameraPlugin = camplugin;
     }
 }
示例#2
0
        /// <summary>
        /// Creates an <see cref="ICameraPlugin"/> for the specified camera.
        /// </summary>
        /// <param name="camera">The camera</param>
        /// <returns>The ICameraPlugin</returns>
        /// <exception cref="ArgumentNullException"><paramref name="camera"/> is null.</exception>
        /// <exception cref="InvalidPluginException">The camera does not have a plugin assigned.</exception>
        /// <exception cref="InvalidPluginException">The plugin cannot be found.</exception>
        public static ICameraPlugin Create(CameraRow camera)
        {
            if (camera == null)
            {
                throw new ArgumentNullException(nameof(camera));
            }

            if (camera.PluginId == PluginTable.Defs.Values.NullPluginId)
            {
                throw new InvalidPluginException($"[{camera.Name}] does not have an associated plugin");
            }

            ICameraPluginCreator creator = CompositionManager.Instance.GetCameraPluginCreator(camera.PluginGuid);

            if (creator == null)
            {
                throw new InvalidPluginException($"The plugin configured for [{camera.Name}] [{camera.PluginName}, Id: {camera.PluginGuid}] cannot be found");
            }

            ICameraPlugin plugin = creator.Create(new ConnectionParameters(camera.IpAddress, camera.Port, camera.UserId, camera.Password));

            if (plugin is ICameraMotion motion)
            {
                motion.SetMotionSpeedAsync((int)camera.MotionSpeed);
            }
            return(plugin);
        }
示例#3
0
	/// <summary>
	/// Awake this instance.
	/// </summary>
	protected override void Awake()
	{
		base.Awake();
		
		m_WorldCamera = GameEngine.GetSingleton().QueryPlugin<ICameraPlugin>();
		if (!m_WorldCamera)
			throw new System.NullReferenceException();
	}
示例#4
0
文件: MainObserver.cs 项目: oathx/Six
	/// <summary>
	/// Awake this instance.
	/// </summary>
	void Awake()
	{
		m_Joystick = GameEngine.GetSingleton().LoadPlugin<IJoystickPlugin>();
		if (!m_Joystick)
			throw new System.NullReferenceException();
		
		IJoystickShape joystickShape = m_Joystick.GetJoystickShape();
		if (!joystickShape)
		{
			m_Joystick.SetJoysticyShape(
				UISystem.GetSingleton().LoadWidget<IJoystickShape>(ResourceDef.UI_JOYSTICK), new Vector3(88, 88, 0)
				);
		}

		// load game main camera
		m_MainCamera 	= GameEngine.GetSingleton().LoadPlugin<ICameraPlugin>();
		if (!m_MainCamera)
			throw new System.NullReferenceException();

		m_PlayerManager	= GameEngine.GetSingleton().LoadPlugin<PlayerManager>();
		if (!m_PlayerManager)
			throw new System.NullReferenceException();
	}
示例#5
0
	/// <summary>
	/// Initializes a new instance of the <see cref="CameraBaseAIState"/> class.
	/// </summary>
	/// <param name="camera">Camera.</param>
	public CameraBaseAIState(int nID, ICameraPlugin owner)
		: base(nID)
	{
		m_Owner 	= owner;
	}
示例#6
0
	/// <summary>
	/// Initializes a new instance of the <see cref="CameraNormal"/> class.
	/// </summary>
	/// <param name="nID">N I.</param>
	/// <param name="camera">Camera.</param>
	public CameraNormal(ICameraPlugin camera)
		: base(CameraStateIDType.NORMAL, camera)
	{
		
	}