using System;
using System.Collections.Generic;
using Barotrauma.LuaCs.Data;
namespace Barotrauma.LuaCs.Configuration;
///
/// Base type of all menu displayable types.
///
public interface IDisplayableConfigBase : IDataInfo, IConfigDisplayInfo
{
///
/// Whether the current config is editable.
///
bool IsEditable { get; }
///
/// Used to indicate the implemented interface and targeted display logic.
///
static virtual DisplayType DisplayOption => DisplayType.Undefined;
}
public interface IDisplayableConfigBase : IDisplayableConfigBase
{
void SetValue(TValue value);
TDisplay GetDisplayValue();
}
public interface IDisplayableConfigBool : IDisplayableConfigBase
{
static DisplayType IDisplayableConfigBase.DisplayOption => DisplayType.Boolean;
}
public interface IDisplayableConfigText : IDisplayableConfigBase
{
static DisplayType IDisplayableConfigBase.DisplayOption => DisplayType.Text;
}
public interface IDisplayableConfigInt : IDisplayableConfigBase
{
static DisplayType IDisplayableConfigBase.DisplayOption => DisplayType.Integer;
}
public interface IDisplayableConfigFloat : IDisplayableConfigBase
{
static DisplayType IDisplayableConfigBase.DisplayOption => DisplayType.Float;
}
public interface IDisplayableConfigSliderInt : IDisplayableConfigBase<(int Min, int Max, int Value, int Steps), int>
{
static DisplayType IDisplayableConfigBase.DisplayOption => DisplayType.SliderInt;
}
public interface IDisplayableConfigSliderFloat : IDisplayableConfigBase<(float Min, float Max, float Value, int Steps), float>
{
static DisplayType IDisplayableConfigBase.DisplayOption => DisplayType.SliderFloat;
}
public interface IDisplayableConfigDropdown : IDisplayableConfigBase, string>
{
static DisplayType IDisplayableConfigBase.DisplayOption => DisplayType.Dropdown;
}
///
/// Allows completely custom-designed UI for this configuration component.
///
public interface IDisplayableConfigCustom : IDisplayableConfigBase
{
static DisplayType IDisplayableConfigBase.DisplayOption => DisplayType.Custom;
///
/// Draw your menu settings option.
///
/// Parent layout component.
void DrawComponent(GUILayoutGroup layoutGroup);
///
/// Called when the config element is set to be disposed to allow for cleanup.
///
void DisposeGUI();
///
/// Called when the UI indicates to save the current value as permanent.
///
void OnValueSaved();
///
/// Called when the UI indicates to discard the currently displayed value and revert to the last saved value.
///
void OnValueDiscarded();
}
///
/// Indicates the intended display and feedback logic to be used by the .
///
[Important]
///
The type must implement the indicated interface for the selected option, or it will not be displayed.
///
public enum DisplayType
{
///
/// Will not be displayed in menus.
///
Undefined,
///
/// Will be shown as a checkbox.
///
[Requires()]
///
Boolean,
///
/// Shown as an editable text input.
///
[Requires()]
///
Text,
///
/// Shown as number input (no decimal input).
///
[Requires()]
///
Integer,
///
/// Shown as a number input.
///
[Requires()]
///
Float,
///
/// Shown as a slider, values parsed as integers.
///
[Requires()]
///
SliderInt,
///
/// Shown as a slider, values parsed as single-precision decimal numbers.
///
[Requires()]
///
SliderFloat,
///
/// Shown as a menu, values parsed as strings.
///
[Requires()]
///
Dropdown,
///
/// UI Display is implemented by inheritor and actioned by a call to .
///
[Requires()]
///
Custom
}