forked from Exiled-Official/EXILED
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I did NOT wanna make a PR today
- Loading branch information
Showing
3 changed files
with
125 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
EXILED/Exiled.API/Features/Core/UserSettings/TextAreaSetting.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="TextAreaSetting.cs" company="ExMod Team"> | ||
// Copyright (c) ExMod Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.API.Features.Core.UserSettings | ||
{ | ||
using System; | ||
|
||
using Exiled.API.Interfaces; | ||
using global::UserSettings.ServerSpecific; | ||
using TMPro; | ||
|
||
/// <summary> | ||
/// Represents a text area setting. | ||
/// </summary> | ||
public class TextAreaSetting : SettingBase, IWrapper<SSTextArea> | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TextAreaSetting"/> class. | ||
/// </summary> | ||
/// <param name="id"><inheritdoc cref="SettingBase.Id"/></param> | ||
/// <param name="label"><inheritdoc cref="SettingBase.Label"/></param> | ||
/// <param name="foldoutMode"><inheritdoc cref="FoldoutMode"/></param> | ||
/// <param name="alignment"><inheritdoc cref="Alignment"/></param> | ||
/// <param name="hintDescription"><inheritdoc cref="SettingBase.HintDescription"/></param> | ||
/// <param name="header"><inheritdoc cref="SettingBase.Header"/></param> | ||
/// <param name="onChanged"><inheritdoc cref="SettingBase.OnChanged"/></param> | ||
public TextAreaSetting( | ||
int id, | ||
string label, | ||
SSTextArea.FoldoutMode foldoutMode = SSTextArea.FoldoutMode.NotCollapsable, | ||
TextAlignmentOptions alignment = TextAlignmentOptions.TopLeft, | ||
string hintDescription = null, | ||
HeaderSetting header = null, | ||
Action<Player, SettingBase> onChanged = null) | ||
: base(new SSTextArea(id, label, foldoutMode, hintDescription, alignment), header, onChanged) | ||
{ | ||
Base = (SSTextArea)base.Base; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TextAreaSetting"/> class. | ||
/// </summary> | ||
/// <param name="settingBase">A <see cref="SSTextArea"/> instance.</param> | ||
internal TextAreaSetting(SSTextArea settingBase) | ||
: base(settingBase) | ||
{ | ||
Base = settingBase; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public new SSTextArea Base { get; } | ||
|
||
/// <summary> | ||
/// Gets or sets the text for the setting. | ||
/// </summary> | ||
public new string Label | ||
{ | ||
get => Base.Label; | ||
set => Base.SendTextUpdate(value); | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the foldout mode. | ||
/// </summary> | ||
public SSTextArea.FoldoutMode FoldoutMode | ||
{ | ||
get => Base.Foldout; | ||
set => Base.Foldout = value; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the text alignment options. | ||
/// </summary> | ||
public TextAlignmentOptions Alignment | ||
{ | ||
get => Base.AlignmentOptions; | ||
set => Base.AlignmentOptions = value; | ||
} | ||
|
||
/// <summary> | ||
/// Returns a representation of this <see cref="TextAreaSetting"/>. | ||
/// </summary> | ||
/// <returns>A string in human-readable format.</returns> | ||
public override string ToString() | ||
{ | ||
return base.ToString() + $" /{FoldoutMode}/ *{Alignment}*"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters