// Copyright (c) 2024 Augie R. Maddox, Guavaman Enterprises. All rights reserved.
#pragma warning disable 0649
namespace Rewired.Glyphs {
using System;
using Rewired;
///
/// Base class for displaying glyphs / text for a specific Action Element Map or Controller Element Identifier.
/// This component cannot be used alone. It requires a script to set either
/// or
/// the and
/// . This class is mainly useful if you need to display a
/// glyph for a specific controller element, such as when showing a list of glyphs for controller elements
/// in a controller or when showing glyphs for controller elements currently contributing to an Action value.
///
public abstract class ControllerElementGlyph : ControllerElementGlyphBase {
[NonSerialized]
private ActionElementMap _actionElementMap;
[NonSerialized]
private ControllerElementIdentifier _controllerElementIdentifier;
[NonSerialized]
private AxisRange _axisRange;
///
/// The Action Element Map for which glyphs / text will be displayed.
/// If Action Element Map is set, it takes precedence over Controller Element Identifier.
///
public ActionElementMap actionElementMap {
get {
return _actionElementMap;
}
set {
_actionElementMap = value;
}
}
///
/// The Controller Element Identifier for which glyphs / text will be displayed.
/// You must also set .
/// If set, it takes precedence over Controller Element Identifier and this will be ignored.
///
public ControllerElementIdentifier controllerElementIdentifier {
get {
return _controllerElementIdentifier;
}
set {
_controllerElementIdentifier = value;
}
}
///
/// The axis range of the Controller Element Identifier for which glyphs / text will be displayed.
/// You must also set .
///
public AxisRange axisRange {
get {
return _axisRange;
}
set {
_axisRange = value;
}
}
protected override void Update() {
base.Update();
if (!ReInput.isReady) return;
if (_actionElementMap == null && controllerElementIdentifier == null) {
Hide();
return;
}
if (actionElementMap != null) ShowGlyphsOrText(_actionElementMap);
else if (controllerElementIdentifier != null) ShowGlyphsOrText(_controllerElementIdentifier, axisRange);
EvaluateObjectVisibility();
}
}
}