using scsmmedia;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// Sci-Fi Ship Controller. Copyright (c) 2018-2023 SCSM Pty Ltd. All rights reserved.
namespace SciFiShipController
{
///
/// Heads Up Display - typically used from an in-cockpit player view or setup.
/// The general approach here is to use RectTransforms that are NOT stretched
/// and are anchored at the centre.
/// Setup Notes:
/// HUDPanel should be anchored at four corners of screen (stretched)
/// Display Reticle panel should be anchored at the centre of HUD
/// Altitude Panel should be anchored to centre
/// Altitude Text pivot point should be 0,0 (left bottom corner of textbox)
///
[AddComponentMenu("Sci-Fi Ship Controller/Misc/Ship Display Module")]
[HelpURL("http://scsmmedia.com/ssc-documentation")]
public class ShipDisplayModule : MonoBehaviour
{
#region Enumerations
#endregion
#region Public Static Variables
public readonly static string hudPanelName = "HUDPanel";
public readonly static string targetsPanelName = "TargetsPanel";
public readonly static string gaugesPanelName = "GaugesPanel";
public readonly static string attitudePanelName = "AttitudePanel";
public readonly static string headingPanelName = "HeadingPanel";
public readonly static string overlayPanelName = "OverlayPanel";
public readonly static string attitudeScrollName = "AttitudeScroll";
public readonly static string headingScrollName = "HeadingScroll";
public readonly static string headingIndicatorName = "HeadingIndicator";
[System.NonSerialized] public static readonly AnimationCurve easeInOutCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
#endregion
#region Public Variables and Properties - General
///
/// If enabled, the Initialise() will be called as soon as Start() runs. This should be disabled if you are
/// instantiating the HUD through code.
///
public bool initialiseOnStart = false;
///
/// Show or Hide the HUD when it is first Initialised
///
public bool isShowOnInitialise = true;
///
/// Show overlay image on HUD. At runtime call ShowOverlay() or HideOverlay()
///
public bool showOverlay = true;
///
/// The head-up display's normalised width of the screen. 1.0 is full width, 0.5 is half width.
/// At runtime call shipDisplayModule.SetHUDSize(..)
///
[Range(0.1f, 1f)] public float displayWidth = 0.5f;
///
/// The head-up display's normalised height of the screen. 1.0 is full height, 0.5 is half height.
/// At runtime call shipDisplayModule.SetHUDSize(..)
///
[Range(0.1f, 1f)] public float displayHeight = 0.75f;
///
/// The head-up display's normalised offset between the left (-1) and the right (1) from the centre (0) of the screen.
/// At runtime call shipDisplayModule.SetHUDOffset(..)
///
[Range(-1f, 1f)] public float displayOffsetX = 0f;
///
/// The head-up display's normalised offset between the bottom (-1) and the top (1) from the centre (0) of the screen.
/// At runtime call shipDisplayModule.SetHUDOffset(..)
///
[Range(-1f, 1f)] public float displayOffsetY = 0f;
///
/// Primary colour of the heads-up display.
/// At runtime call shipDisplayModule.SetPrimaryColour(..)
///
public Color32 primaryColour = Color.grey;
///
/// Automatically hide the screen cursor or mouse pointer after it has been stationary
/// for a fixed period of time. Automatically show the cursor if the mouse if moved
/// provided that the Display Reticle is on shown.
///
public bool autoHideCursor = true;
///
/// The number of seconds to wait until after the cursor has not moved before hiding it
///
public float hideCursorTime = 3f;
///
/// Is the ship display module initialised? Gets set at runtime when Initialise() is called.
///
public bool IsInitialised { get; private set; }
///
/// Is the heads-up display shown? To set use ShowHUD() or HideHUD().
/// IsHUDShown should never be true at runtime if IsInitialised is false
///
public bool IsHUDShown { get; private set; }
///
/// Get a reference to the HUD canvas
///
public Canvas GetCanvas { get { return IsInitialised ? canvas : GetComponent