// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.MixedReality.Toolkit.Physics;
using System.Collections.Generic;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Input
{
///
/// Delegate type used to handle primary pointer changes.
/// Old and new pointer values can be null to indicate transition from or to no primary pointer, but they won't both be null simultaneously.
///
public delegate void PrimaryPointerChangedHandler(IMixedRealityPointer oldPointer, IMixedRealityPointer newPointer);
///
/// Implements the Focus Provider for handling focus of pointers.
///
public interface IMixedRealityFocusProvider : IMixedRealityService, IMixedRealitySourceStateHandler, IMixedRealitySpeechHandler
{
///
/// Maximum distance at which all pointers can collide with a GameObject, unless it has an override extent.
///
float GlobalPointingExtent { get; }
///
/// The layer masks for the focus pointers to raycast against.
///
LayerMask[] FocusLayerMasks { get; }
///
/// The Camera the EventSystem uses to raycast against.
///
/// Every uGUI canvas in your scene should use this camera as its event camera.
Camera UIRaycastCamera { get; }
///
/// Current primary pointer. Determined by the primary pointer selector in use (see MixedRealityPointerProfile.PrimaryPointerSelector).
///
IMixedRealityPointer PrimaryPointer { get; }
///
/// Gets the currently focused object for the pointing source.
///
/// If the pointing source is not registered, then the Gaze's Focused GameObject is returned.
/// Currently Focused Object.
GameObject GetFocusedObject(IMixedRealityPointer pointingSource);
///
/// Gets the currently focused object for the pointing source.
///
bool TryGetFocusDetails(IMixedRealityPointer pointer, out FocusDetails focusDetails);
///
/// Sets the FocusDetails of the specified pointer, overriding the focus point that was currently set. This can be used to change
/// the FocusDetails of a specific pointer even if focus is locked.
///
///
/// True if the FocusDetails were set successfully. False if the pointer is not associated with the FocusProvider.
///
bool TryOverrideFocusDetails(IMixedRealityPointer pointer, FocusDetails focusDetails);
///
/// Generate a new unique pointer id.
///
uint GenerateNewPointerId();
///
/// Checks if the pointer is registered with the Focus Manager.
///
/// True, if registered, otherwise false.
bool IsPointerRegistered(IMixedRealityPointer pointer);
///
/// Registers the pointer with the Focus Manager.
///
/// True, if the pointer was registered, false if the pointer was previously registered.
bool RegisterPointer(IMixedRealityPointer pointer);
///
/// Unregisters the pointer with the Focus Manager.
///
/// True, if the pointer was unregistered, false if the pointer was not registered.
bool UnregisterPointer(IMixedRealityPointer pointer);
///
/// Provides access to all registered pointers of a specified type.
///
/// The type of pointers to request. Use IMixedRealityPointer to access all pointers.
IEnumerable GetPointers() where T : class, IMixedRealityPointer;
///
/// Subscribes to primary pointer changes.
///
/// Handler to be called when the primary pointer changes
/// When true, the passed in handler will be invoked immediately with the current primary pointer
/// before subscribing. This is useful to avoid having to manually poll the current value.
void SubscribeToPrimaryPointerChanged(PrimaryPointerChangedHandler handler, bool invokeHandlerWithCurrentPointer);
///
/// Unsubscribes from primary pointer changes.
///
/// Handler to unsubscribe
void UnsubscribeFromPrimaryPointerChanged(PrimaryPointerChangedHandler handler);
}
}