C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
using System.Collections;
using Facepunch;
using Newtonsoft.Json;
using System;
using UnityEngine.Networking;
using Oxide.Core.Libraries;
using Oxide.Core;
using System.Collections.Generic;
using System.Text;
using Oxide.Core.Libraries.Covalence;
using System.Text.RegularExpressions;
using CompanionServer;
using Newtonsoft.Json.Linq;
using ConVar;
using UnityEngine;
using System.IO;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using Object = System.Object;
using System.Linq;
namespace Oxide.Plugins {
[Info("IQChat", "Mercury", "2.52.32")]
[Description("The most pleasant chat for your server from the IQ system")]
class IQChat : RustPlugin {
[ConsoleCommand("mute")]
void MuteCustomAdmin(ConsoleSystem.Arg arg) {
if (arg.Player() != null) if (!permission.UserHasPermission(arg.Player().UserIDString, PermissionMute)) return;
if (arg == null || arg.Args == null || arg.Args.Length != 3 || arg.Args.Length > 3) {
PrintWarning(LanguageEn ? "Invalid syntax, use : mute Steam64ID/Nick Reason Time(seconds)" : "Неверный синтаксис,используйте : mute Steam64ID/Ник Причина Время(секунды)");
return;
}
string NameOrID = arg.Args[0];
string Reason = arg.Args[1];
Int32 TimeMute = 0;
if (!Int32.TryParse(arg.Args[2], out TimeMute)) {
PrintWarning(LanguageEn ? "Enter time in numbers!" : "Введите время цифрами!");
return;
}
BasePlayer target = GetPlayerNickOrID(NameOrID);
if (target == null) {
UInt64 Steam64ID = 0;
if (UInt64.TryParse(NameOrID, out Steam64ID)) {
if (UserInformation.ContainsKey(Steam64ID)) {
User Info = UserInformation[Steam64ID];
if (Info == null) return;
if (Info.MuteInfo.IsMute(MuteType.Chat)) {
PrintWarning(LanguageEn ? "The player already has a chat lock" : "Игрок уже имеет блокировку чата");
return;
}
Info.MuteInfo.SetMute(MuteType.Chat, TimeMute);
PrintWarning(LanguageEn ? "Chat blocking issued to offline player" : "Блокировка чата выдана offline-игроку");
return;
}
else {
PrintWarning(LanguageEn ? "This player is not on the server" : "Такого игрока нет на сервере");
return;
}
}
else {
PrintWarning(LanguageEn ? "This player is not on the server" : "Такого игрока нет на сервере");
return;
}
}
MutePlayer(target, MuteType.Chat, 0, arg.Player(), Reason, TimeMute, false, true);
Puts(LanguageEn ? "Successfully" : "Успешно");
}
Int32 API_GET_DEFAULT_SIZE_NICK() => config.ControllerMessages.GeneralSetting.OtherSetting.SizeNick;
private const String PermissionHideConnection = "iqchat.hideconnection";
private String XPrison_GetPrefix(BasePlayer player) {
if (!XPrison || !config.ReferenceSetting.xPrisonSettings.UseXPrison) return String.Empty;
Boolean isPrisonPlayer = (Boolean)XPrison.CallHook("API_IsOnlinePrisoner", player.userID.Get());
if (!isPrisonPlayer) return String.Empty;
String prefixPrison = (String)XPrison.CallHook("API_GetOnlinePrisonerPrefix", player);
if (String.IsNullOrWhiteSpace(prefixPrison)) return String.Empty;
String resultPrefix = GetLang("XPRISON_SYNTAX_PREFIX", player.UserIDString, prefixPrison);
Object resultColorMessage = IsGradientColorValue(config.ReferenceSetting.xPrisonSettings.colorTag);
if (resultColorMessage is List<String> gradientColors) resultPrefix = ApplyGradientToText(resultPrefix, gradientColors);
else resultPrefix = $"<color={config.ReferenceSetting.xPrisonSettings.colorTag}>{resultPrefix}</color>";
return resultPrefix;
}
void API_SEND_PLAYER_DISCONNECTED(String DisplayName, String reason, String userID) {
Configuration.ControllerAlert.PlayerSession AlertSessionPlayer = config.ControllerAlertSetting.PlayerSessionSetting;
if (AlertSessionPlayer.DisconnectedAlert) {
String Avatar = AlertSessionPlayer.ConnectedAvatarUse ? userID : String.Empty;
System.Object[] args = AlertSessionPlayer.DisconnectedReason ? new System.Object[] {
DisplayName, reason
}
: new System.Object[] {
DisplayName
}
;
String Lang = AlertSessionPlayer.DisconnectedReason ? "LEAVE_PLAYER_REASON" : "LEAVE_PLAYER";
ReplyBroadcast(null, Avatar, false, Lang, args);
}
}
private IEnumerable<T> GetPageOfPlayers<T>(IEnumerable<T> items, Int32 page) => items != null ? items.Skip(18 * page).Take(18) : Enumerable.Empty<T>();
String API_GET_NICK_COLOR(ulong ID) {
if (!UserInformation.ContainsKey(ID)) return String.Empty;
return UserInformation[ID].Info.ColorNick;
}
[ChatCommand("unmutevoice")]
void UnMuteVoiceCustomChat(BasePlayer Moderator, string cmd, string[] arg) {
if (!permission.UserHasPermission(Moderator.UserIDString, PermissionMute)) return;
if (arg == null || arg.Length != 1 || arg.Length > 1) {
ReplySystem(Moderator, LanguageEn ? "Invalid syntax, please use : unmutevoice Steam64ID" : "Неверный синтаксис,используйте : unmutevoice Steam64ID");
return;
}
string NameOrID = arg[0];
if (IsFakeUser(NameOrID)) {
List<FakePlayer> playerList = GetCombinedPlayerList();
if (playerList != null) {
FakePlayer fakeUser = playerList.FirstOrDefault(x => x.userId.Equals(NameOrID) || x.displayName.ToLower().Contains(NameOrID.ToLower()));
if (fakeUser != null) UnmutePlayer(null, MuteType.Chat, Moderator, false, true, fakeUser.userId);
}
return;
}
BasePlayer target = GetPlayerNickOrID(NameOrID);
if (target == null) {
UInt64 Steam64ID = 0;
if (UInt64.TryParse(NameOrID, out Steam64ID)) {
if (UserInformation.ContainsKey(Steam64ID)) {
User Info = UserInformation[Steam64ID];
if (Info == null) return;
if (!Info.MuteInfo.IsMute(MuteType.Voice)) {
ReplySystem(Moderator, LanguageEn ? "The player does not have a chat lock" : "У игрока нет блокировки чата");
return;
}
if (!Moderator.IsAdmin && Moderator.userID.Get() == Steam64ID) {
ReplySystem(Moderator, GetLang("FUNC_MESSAGE_UNMUTE_YOURSELF", Moderator.UserIDString));
return;
}
Info.MuteInfo.UnMute(MuteType.Voice);
ReplySystem(Moderator, LanguageEn ? "You have unblocked the offline chat to the player" : "Вы разблокировали чат offline игроку");
return;
}
else {
ReplySystem(Moderator, LanguageEn ? "This player is not on the server" : "Такого игрока нет на сервере");
return;
}
}
else {
ReplySystem(Moderator, LanguageEn ? "This player is not on the server" : "Такого игрока нет на сервере");
return;
}
}
UnmutePlayer(target, MuteType.Voice, Moderator, false, true);
}
private void DrawUI_IQChat_Sliders(BasePlayer player, String Name, String OffsetMin, String OffsetMax, TakeElementUser ElementType) {
String Interface = InterfaceBuilder.GetInterface("UI_Chat_Slider");
if (Interface == null) return;
Interface = Interface.Replace("%OFFSET_MIN%", OffsetMin);
Interface = Interface.Replace("%OFFSET_MAX%", OffsetMax);
Interface = Interface.Replace("%NAME%", Name);
Interface = Interface.Replace("%COMMAND_LEFT_SLIDE%", $"newui.cmd slider.controller {ElementType} -");
Interface = Interface.Replace("%COMMAND_RIGHT_SLIDE%", $"newui.cmd slider.controller {ElementType} +");
CuiHelper.DestroyUi(player, Name);
CuiHelper.AddUi(player, Interface);
DrawUI_IQChat_Slider_Update_Argument(player, ElementType);
}
Boolean API_CHECK_MUTE_CHAT(UInt64 ID) {
if (!UserInformation.ContainsKey(ID)) return false;
return UserInformation[ID].MuteInfo.IsMute(MuteType.Chat);
}
void Init() {
ReadData();
}
private void DrawUI_IQChat_OpenDropListArgument(BasePlayer player, Int32 Count) {
String Interface = InterfaceBuilder.GetInterface("UI_Chat_OpenDropListArgument_Taked");
if (Interface == null) return;
Interface = Interface.Replace("%COUNT%", Count.ToString());
CuiHelper.DestroyUi(player, $"TAKED_INFO_{Count}");
CuiHelper.AddUi(player, Interface);
}
public enum MuteType {
Chat, Voice
}
private const String PermissionMute = "iqchat.muteuse";
private BasePlayer GetPlayerNickOrID(String Info) {
String NameOrID = String.Empty;
KeyValuePair<UInt64, GeneralInformation.RenameInfo> RenameInformation = GeneralInfo.RenameList.FirstOrDefault(x => x.Value.RenameNick.Contains(Info) || x.Value.RenameID.ToString() == Info);
if (RenameInformation.Value == null) NameOrID = Info;
else NameOrID = RenameInformation.Key.ToString();
foreach (BasePlayer Finder in BasePlayer.activePlayerList) {
if (Finder.displayName.ToLower().Contains(NameOrID.ToLower()) || Finder.userID.ToString() == NameOrID) return Finder;
}
return null;
}
class Response {
[JsonProperty("country")]
public string Country {
get;
set;
}
}
[ChatCommand("rename")]
private void ChatCommandRename(BasePlayer Renamer, string command, string[] args) {
if (!permission.UserHasPermission(Renamer.UserIDString, PermissionRename)) return;
GeneralInformation General = GeneralInfo;
if (General == null) return;
if (Renamer == null) {
ReplySystem(Renamer, LanguageEn ? "You can only use this command while on the server" : "Вы можете использовать эту команду только находясь на сервере");
return;
}
if (args.Length == 0 || args == null) {
ReplySystem(Renamer, lang.GetMessage("COMMAND_RENAME_NOTARG", this, Renamer.UserIDString));
return;
}
String Name = args[0];
UInt64 ID = Renamer.userID;
if (args.Length == 2 && args[1] != null && !String.IsNullOrWhiteSpace(args[1])) if (!UInt64.TryParse(args[1], out ID)) {
ReplySystem(Renamer, GetLang("COMMAND_RENAME_NOT_ID", Renamer.UserIDString));
return;
}
if (General.RenameList.ContainsKey(Renamer.userID.Get())) {
General.RenameList[Renamer.userID.Get()].RenameNick = Name;
General.RenameList[Renamer.userID.Get()].RenameID = ID;
}
else General.RenameList.Add(Renamer.userID.Get(), new GeneralInformation.RenameInfo {
RenameNick = Name, RenameID = ID
}
);
ReplySystem(Renamer, GetLang("COMMAND_RENAME_SUCCES", Renamer.UserIDString, Name, ID));
Renamer.displayName = Name;
}
private String GetLastMessage(BasePlayer player, Int32 Count) {
String Messages = String.Empty;
if (LastMessagesChat.ContainsKey(player)) {
foreach (String Message in LastMessagesChat[player].Skip(LastMessagesChat[player].Count - Count)) Messages += $"\n{Message}";
}
return Messages;
}
[ConsoleCommand("hmute")]
void HideMuteConsole(ConsoleSystem.Arg arg) {
if (arg.Player() != null) if (!permission.UserHasPermission(arg.Player().UserIDString, PermissionMute)) return;
if (arg == null || arg.Args == null || arg.Args.Length != 3 || arg.Args.Length > 3) {
ConsoleOrPrintMessage(arg.Player(), LanguageEn ? "Invalid syntax, use : hmute Steam64ID Reason Time (seconds)" : "Неверный синтаксис,используйте : hmute Steam64ID Причина Время(секунды)");
return;
}
string NameOrID = arg.Args[0];
string Reason = arg.Args[1];
Int32 TimeMute = 0;
if (!Int32.TryParse(arg.Args[2], out TimeMute)) {
ConsoleOrPrintMessage(arg.Player(), LanguageEn ? "Enter the time in numbers!" : "Введите время цифрами!");
return;
}
BasePlayer target = GetPlayerNickOrID(NameOrID);
if (target == null) {
UInt64 Steam64ID = 0;
if (UInt64.TryParse(NameOrID, out Steam64ID)) {
if (UserInformation.ContainsKey(Steam64ID)) {
User Info = UserInformation[Steam64ID];
if (Info == null) return;
if (Info.MuteInfo.IsMute(MuteType.Chat)) {
ConsoleOrPrintMessage(arg.Player(), LanguageEn ? "The player already has a chat lock" : "Игрок уже имеет блокировку чата");
return;
}
Info.MuteInfo.SetMute(MuteType.Chat, TimeMute);
ConsoleOrPrintMessage(arg.Player(), LanguageEn ? "Chat blocking issued to offline player" : "Блокировка чата выдана offline-игроку");
return;
}
else {
ConsoleOrPrintMessage(arg.Player(), LanguageEn ? "This player is not on the server" : "Такого игрока нет на сервере");
return;
}
}
else {
ConsoleOrPrintMessage(arg.Player(), LanguageEn ? "This player is not on the server" : "Такого игрока нет на сервере");
return;
}
}
MutePlayer(target, MuteType.Chat, 0, arg.Player(), Reason, TimeMute, true, true);
}
private void DrawUI_IQChat_Update_Check_Box(BasePlayer player, ElementsSettingsType Type, String OffsetMin, String OffsetMax, Boolean StatusCheckBox) {
String Interface = InterfaceBuilder.GetInterface("UI_Chat_Context_CheckBox");
User Info = UserInformation[player.userID.Get()];
if (Info == null || Interface == null) return;
String Name = $"{Type}";
Interface = Interface.Replace("%NAME_CHECK_BOX%", Name);
Interface = Interface.Replace("%COLOR%", !StatusCheckBox ? "0.4716981 0.4716981 0.4716981 1" : "0.6040971 0.4198113 1 1");
Interface = Interface.Replace("%OFFSET_MIN%", OffsetMin);
Interface = Interface.Replace("%OFFSET_MAX%", OffsetMax);
Interface = Interface.Replace("%COMMAND_TURNED%", $"newui.cmd checkbox.controller {Type}");
CuiHelper.DestroyUi(player, Name);
CuiHelper.AddUi(player, Interface);
}
protected override void LoadDefaultConfig() => config = Configuration.GetNewConfiguration();
private void ReplyTranslationMessage(Chat.ChatChannel channel, BasePlayer player, BasePlayer playerSender, String OutMessage, String FormatMessage, String FormatPlayer, UInt64 RenameID) {
ListHashSet<BasePlayer> playerList = GetPlayerList(player, channel);
if (playerList == null) return;
if (!String.IsNullOrWhiteSpace(config.ReferenceSetting.translationApiSettings.codeLanguagePrimary)) {
Action<String> callback = translation => {
foreach (BasePlayer p in playerList) ReplyPlayerChat(channel, p, playerSender, !permission.UserHasPermission(p.UserIDString, PermissionTranslationIgnore) ? translation : OutMessage, FormatMessage, FormatPlayer, RenameID);
}
;
TranslationAPI.Call("Translate", OutMessage, config.ReferenceSetting.translationApiSettings.codeLanguagePrimary, "auto", callback);
}
else {
foreach (BasePlayer p in playerList) {
String codeResult = lang.GetLanguage(p.UserIDString);
saveTranslate.TryAdd(codeResult, new TranslationState());
Action<String> callback = translation => {
saveTranslate[codeResult].IsProcessed = true;
saveTranslate[codeResult].Translation = translation;
saveTranslate[codeResult].DoTranslation = OutMessage;
ReplyPlayerChat(channel, p, playerSender, !permission.UserHasPermission(p.UserIDString, PermissionTranslationIgnore) ? translation : OutMessage, FormatMessage, FormatPlayer, RenameID);
}
;
if (lang.GetLanguage(player.UserIDString) == codeResult) ReplyPlayerChat(channel, p, playerSender, OutMessage, FormatMessage, FormatPlayer, RenameID);
else if (saveTranslate[codeResult].IsProcessed && !string.IsNullOrWhiteSpace(saveTranslate[codeResult].Translation) && OutMessage == saveTranslate[codeResult].DoTranslation) ReplyPlayerChat(channel, p, playerSender, saveTranslate[codeResult].Translation, FormatMessage, FormatPlayer, RenameID);
else TranslationAPI.Call("Translate", OutMessage, codeResult, "auto", callback);
}
}
}
private const String PermissionTranslationIgnore = "iqchat.translationignore";
Int32 API_GET_DEFAULT_SIZE_MESSAGE() => config.ControllerMessages.GeneralSetting.OtherSetting.SizeMessage;
public Dictionary<BasePlayer, BasePlayer> PMHistory = new Dictionary<BasePlayer, BasePlayer>();
private void MutePlayer(BasePlayer Target, MuteType Type, Int32 ReasonIndex, BasePlayer Moderator = null, String ReasonCustom = null, Int32 TimeCustom = 0, Boolean HideMute = false, Boolean Command = false, String fakeUserId = "") {
Configuration.ControllerMute ControllerMutes = config.ControllerMutes;
if (IsReadyIQFakeActive() && Target == null && !String.IsNullOrWhiteSpace(fakeUserId)) {
ReplySystem(Moderator, GetLang(Type == MuteType.Chat ? "FUNC_MESSAGE_MUTE_CHAT" : "FUNC_MESSAGE_MUTE_VOICE", Moderator != null ? Moderator.displayName : Moderator.UserIDString, GetLang("IQCHAT_FUNCED_ALERT_TITLE_SERVER"), GetFakeName(fakeUserId), FormatTime(TimeCustom == 0 ? config.ControllerMutes.MuteChatReasons[ReasonIndex].SecondMute : TimeCustom), ReasonCustom ?? config.ControllerMutes.MuteChatReasons[ReasonIndex].Reason));
SetMuteFakeUser(fakeUserId, true);
return;
}
if (!UserInformation.ContainsKey(Target.userID.Get())) return;
User Info = UserInformation[Target.userID.Get()];
String LangMessage = String.Empty;
String Reason = String.Empty;
Int32 MuteTime = 0;
String NameModerator = GetLang("IQCHAT_FUNCED_ALERT_TITLE_SERVER", Target.UserIDString);
if (Moderator != null) {
if (!permission.UserHasPermission(Moderator.UserIDString, PermissionHideMuteName)) {
GeneralInformation.RenameInfo ModeratorRename = GeneralInfo.GetInfoRename(Moderator.userID.Get());
NameModerator = ModeratorRename != null ? $"{ModeratorRename.RenameNick ?? Moderator.displayName}" : Moderator.displayName;
}
}
GeneralInformation.RenameInfo TagetRename = GeneralInfo.GetInfoRename(Target.userID.Get());
String TargetName = TagetRename != null ? $"{TagetRename.RenameNick ?? Target.displayName}" : Target.displayName;
if (Target == null || !Target.IsConnected) {
if (Moderator != null && !Command) ReplySystem(Moderator, GetLang("UI_CHAT_PANEL_MODERATOR_MUTE_PANEL_TAKE_TYPE_CHAT_ACTION_NOT_CONNNECTED", Moderator.UserIDString));
return;
}
if (Moderator != null && !Command) if (Info.MuteInfo.IsMute(Type)) {
ReplySystem(Moderator, GetLang("IQCHAT_FUNCED_ALERT_TITLE_ISMUTED", Moderator.UserIDString));
return;
}
switch (Type) {
case MuteType.Chat : {
Reason = ReasonCustom ?? ControllerMutes.MuteChatReasons[ReasonIndex].Reason;
MuteTime = TimeCustom == 0 ? ControllerMutes.MuteChatReasons[ReasonIndex].SecondMute : TimeCustom;
LangMessage = "FUNC_MESSAGE_MUTE_CHAT";
break;
}
case MuteType.Voice : {
Reason = ReasonCustom ?? ControllerMutes.MuteVoiceReasons[ReasonIndex].Reason;
MuteTime = TimeCustom == 0 ? ControllerMutes.MuteVoiceReasons[ReasonIndex].SecondMute : TimeCustom;
LangMessage = "FUNC_MESSAGE_MUTE_VOICE";
break;
}
}
Info.MuteInfo.SetMute(Type, MuteTime);
if (Moderator != null && Moderator != Target) Interface.Oxide.CallHook("OnPlayerMuted", Target, Moderator, MuteTime, Reason);
if (!HideMute) ReplyBroadcast(null, null, false, LangMessage, NameModerator, TargetName, FormatTime(MuteTime, Target.UserIDString), Reason);
// ReplyBroadcast(GetLang(LangMessage, Target.UserIDString, NameModerator, TargetName, FormatTime(MuteTime, Target.UserIDString), Reason));
else {
if (Target != null) ReplySystem(Target, GetLang(LangMessage, Target.UserIDString, NameModerator, TargetName, FormatTime(MuteTime, Target.UserIDString), Reason));
if (Moderator != null) ReplySystem(Moderator, GetLang(LangMessage, Target.UserIDString, NameModerator, TargetName, FormatTime(MuteTime, Target.UserIDString), Reason));
}
DiscordLoggMuted(Target, Type, Reason, FormatTime(MuteTime, Target.UserIDString), Moderator);
}
public class TranslationState {
public Boolean IsProcessed {
get;
set;
}
public String Translation {
get;
set;
}
public String DoTranslation {
get;
set;
}
}
private class InterfaceBuilder {
public static InterfaceBuilder Instance;
public const String UI_Chat_Context = "UI_IQCHAT_CONTEXT";
public const String UI_Chat_Context_Visual_Nick = "UI_IQCHAT_CONTEXT_VISUAL_NICK";
public const String UI_Chat_Alert = "UI_IQCHAT_ALERT";
public Dictionary<String, String> Interfaces;
public InterfaceBuilder() {
Instance = this;
Interfaces = new Dictionary<String, String>();
BuildingStaticContext();
BuildingVisualNick();
BuildingCheckBox();
BuildingModerationStatic();
BuildingMuteAllChat();
BuildingMuteAllVoice();
BuildingSlider();
BuildingSliderUpdateArgument();
BuildingDropList();
BuildingOpenDropList();
BuildingElementDropList();
BuildingElementDropListTakeLine();
BuildingAlertUI();
BuildingMuteAndIgnore();
BuildingMuteAndIgnorePlayerPanel();
BuildingMuteAndIgnorePlayer();
BuildingMuteAndIgnorePages();
BuildingMuteAndIgnorePanelAlert();
BuildingIgnoreAlert();
BuildingMuteAlert();
BuildingMuteAlert_DropList_Title();
BuildingMuteAlert_DropList_Reason();
}
public static void AddInterface(String name, String json) {
if (Instance.Interfaces.ContainsKey(name)) {
_.PrintError($"Error! Tried to add existing cui elements! -> {name}");
return;
}
Instance.Interfaces.Add(name, json);
}
public static string GetInterface(String name) {
string json = string.Empty;
if (Instance.Interfaces.TryGetValue(name, out json) == false) {
_.PrintWarning($"Warning! UI elements not found by name! -> {name}");
}
return json;
}
public static void DestroyAll() {
for (var i = 0; i < BasePlayer.activePlayerList.Count; i++) {
var player = BasePlayer.activePlayerList[i];
CuiHelper.DestroyUi(player, UI_Chat_Context);
CuiHelper.DestroyUi(player, UI_Chat_Context_Visual_Nick);
CuiHelper.DestroyUi(player, UI_Chat_Alert);
CuiHelper.DestroyUi(player, "MUTE_AND_IGNORE_PANEL_ALERT");
}
}
private void BuildingVisualNick() {
CuiElementContainer container = new CuiElementContainer();
container.Add(new CuiElement {
Name = UI_Chat_Context_Visual_Nick, Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%NICK_DISPLAY%", Font = "robotocondensed-regular.ttf", FontSize = 7, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-135.769 -89.558", OffsetMax = "-12.644 -77.176"
}
}
}
);
AddInterface("UI_Chat_Context_Visual_Nick", container.ToJson());
}
private void BuildingStaticContext() {
Configuration.ControllerParameters Controller = config.ControllerParameter;
if (Controller == null) {
_.PrintWarning("Ошибка генерации интерфейса, null значение в конфигурации, свяжитесь с разработчиком");
return;
}
CuiElementContainer container = new CuiElementContainer();
container.Add(new CuiPanel {
CursorEnabled = true, RectTransform = {
AnchorMin = "1 0.5", AnchorMax = "1 0.5", OffsetMin = "-379 -217", OffsetMax = "-31 217"
}
, Image = {
Color = "0 0 0 0"
}
}
, "Overlay", UI_Chat_Context);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "1000 1000", OffsetMax = "-1000 -1000"
}
, Button = {
Close = UI_Chat_Context, Color = "0 0 0 0.5"
}
, Text = {
Text = ""
}
}
, UI_Chat_Context, "CLOSE_UI_Chat_Context_FullScreen");
container.Add(new CuiElement {
Name = "ImageContext", Parent = UI_Chat_Context, Components = {
new CuiRawImageComponent {
Color = "1 1 1 1", Png = "%IMG_BACKGROUND%"
}
, new CuiRectTransformComponent {
AnchorMin = "0 0", AnchorMax = "1 1"
}
}
}
);
container.Add(new CuiElement {
Name = "TitleLabel", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%TITLE%", Font = "robotocondensed-regular.ttf", FontSize = 17, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-149.429 166.408", OffsetMax = "-14.788 189.564"
}
}
}
);
container.Add(new CuiElement {
Name = "DescriptionLabel", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SETTING_ELEMENT%", Font = "robotocondensed-regular.ttf", FontSize = 8, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-149.429 112.0213406", OffsetMax = "152.881 131.787"
}
}
}
);
container.Add(new CuiElement {
Name = "InformationLabel", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%INFORMATION%", Font = "robotocondensed-regular.ttf", FontSize = 8, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-149.429 -53.432", OffsetMax = "-32.905 -39.808"
}
}
}
);
container.Add(new CuiElement {
Name = "InformationIcon", Parent = UI_Chat_Context, Components = {
new CuiRawImageComponent {
Color = "1 1 1 1", Png = _imageUI.GetImage("IQCHAT_INFORMATION_ICON")
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-14.788 -52.12", OffsetMax = "-3.788 -41.12"
}
}
}
);
container.Add(new CuiElement {
Name = "SettingLabel", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SETTINGS%", Font = "robotocondensed-regular.ttf", FontSize = 8, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "11.075 -53.432", OffsetMax = "126.125 -39.808"
}
}
}
);
container.Add(new CuiElement {
Name = "SettingIcon", Parent = UI_Chat_Context, Components = {
new CuiRawImageComponent {
Color = "1 1 1 1", Png = _imageUI.GetImage("IQCHAT_SETTING_ICON")
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "141.88 -52.12", OffsetMax = "152.88 -41.12"
}
}
}
);
container.Add(new CuiElement {
Name = "SettingPM", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SETTINGS_PM%", Font = "robotocondensed-regular.ttf", FontSize = 8, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "11.075 -70.712", OffsetMax = "126.125 -57.088"
}
}
}
);
container.Add(new CuiElement {
Name = "SettingAlertChat", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SETTINGS_ALERT%", Font = "robotocondensed-regular.ttf", FontSize = 8, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "11.075 -82.412", OffsetMax = "126.125 -68.788"
}
}
}
);
container.Add(new CuiElement {
Name = "SettingNoticyChat", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SETTINGS_ALERT_PM%", Font = "robotocondensed-regular.ttf", FontSize = 8, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "11.075 -94.412", OffsetMax = "126.125 -80.788"
}
}
}
);
container.Add(new CuiElement {
Name = "SettingSoundAlert", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SETTINGS_SOUNDS%", Font = "robotocondensed-regular.ttf", FontSize = 8, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "11.075 -106.412", OffsetMax = "126.125 -92.788"
}
}
}
);
container.Add(new CuiElement {
Name = "MuteStatus", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%MUTE_STATUS_PLAYER%", Font = "robotocondensed-regular.ttf", FontSize = 11, Align = TextAnchor.MiddleCenter, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-143.174 -131.59", OffsetMax = "-120.611 -114.967"
}
}
}
);
container.Add(new CuiElement {
Name = "MuteStatusTitle", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%MUTE_STATUS_TITLE%", Font = "robotocondensed-regular.ttf", FontSize = 7, Align = TextAnchor.MiddleCenter, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-143.174 -141.429", OffsetMax = "-89.127 -132.508"
}
}
}
);
container.Add(new CuiElement {
Name = "CountIgnored", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%IGNORED_STATUS_COUNT%", Font = "robotocondensed-regular.ttf", FontSize = 7, Align = TextAnchor.UpperLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-66.98 -131.715", OffsetMax = "-11.09 -116.831"
}
}
}
);
container.Add(new CuiElement {
Name = "IgonoredTitle", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%IGNORED_STATUS_TITLE%", Font = "robotocondensed-regular.ttf", FontSize = 7, Align = TextAnchor.UpperLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-66.98 -142.04", OffsetMax = "-19.967 -132.537"
}
}
}
);
container.Add(new CuiElement {
Name = "IgnoredIcon", Parent = UI_Chat_Context, Components = {
new CuiRawImageComponent {
Color = "1 1 1 1", Png = _imageUI.GetImage("IQCHAT_IGNORE_INFO_ICON")
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-19.483 -115.225", OffsetMax = "-11.762 -107.814"
}
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = $"newui.cmd action.mute.ignore open {SelectedAction.Ignore}", Color = "0 0 0 0"
}
, Text = {
Text = ""
}
}
, "IgnoredIcon", "CLOSE_IGNORED");
container.Add(new CuiElement {
Name = "TitleNickPanel", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%NICK_DISPLAY_TITLE%", Font = "robotocondensed-regular.ttf", FontSize = 10, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-135.769 -78.878", OffsetMax = "-85.632 -64.613"
}
}
}
);
container.Add(new CuiElement {
Name = "NickTitle", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SLIDER_NICK_COLOR_TITLE%", Font = "robotocondensed-regular.ttf", FontSize = 10, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "22.591 76.362", OffsetMax = "80.629 92.278"
}
}
}
);
container.Add(new CuiElement {
Name = "ChatMessageTitle", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SLIDER_MESSAGE_COLOR_TITLE%", Font = "robotocondensed-regular.ttf", FontSize = 10, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-136.591 9.362", OffsetMax = "-78.045 24.278"
}
}
}
);
container.Add(new CuiElement {
Name = "PrefixTitle", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SLIDER_PREFIX_TITLE%", Font = "robotocondensed-regular.ttf", FontSize = 10, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-136.591 77.362", OffsetMax = "-89.949 93.278"
}
}
}
);
container.Add(new CuiElement {
Name = "RankTitle", Parent = UI_Chat_Context, Components = {
new CuiTextComponent {
Text = "%SLIDER_IQRANK_TITLE%", Font = "robotocondensed-regular.ttf", FontSize = 10, Align = TextAnchor.MiddleLeft, Color = "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "22.825 9.242", OffsetMax = "81.375 25.158"
}
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "123.62 166", OffsetMax = "153.62 196"
}
, Button = {
Close = UI_Chat_Context, Color = "0 0 0 0"
}
, Text = {
Text = ""
}
}
, UI_Chat_Context, "CLOSE_UI_Chat_Context");
AddInterface("UI_Chat_Context", container.ToJson());
}
private void BuildingCheckBox() {
CuiElementContainer container = new CuiElementContainer();
container.Add(new CuiElement {
Name = "%NAME_CHECK_BOX%", Parent = UI_Chat_Context, Components = {
new CuiRawImageComponent {
Color = "%COLOR%", Png = _imageUI.GetImage("IQCHAT_ELEMENT_SETTING_CHECK_BOX")
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "%OFFSET_MIN%", OffsetMax = "%OFFSET_MAX%"
}
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = "%COMMAND_TURNED%", Color = "0 0 0 0"
}
, Text = {
Text = ""
}
}
, "%NAME_CHECK_BOX%", "CHECK_BOX_TURNED");
AddInterface("UI_Chat_Context_CheckBox", container.ToJson());
}
private void BuildingSlider() {
CuiElementContainer container = new CuiElementContainer();
String NameSlider = "%NAME%";
container.Add(new CuiElement {
Name = NameSlider, Parent = UI_Chat_Context, Components = {
new CuiRawImageComponent {
Color = "1 1 1 1", Png = _imageUI.GetImage("IQCHAT_ELEMENT_SLIDER_ICON")
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "%OFFSET_MIN%" , OffsetMax = "%OFFSET_MAX%"
}
}
}
);
container.Add(new CuiElement {
Name = "Left", Parent = NameSlider, Components = {
new CuiRawImageComponent {
Color = "1 1 1 1", Png = _imageUI.GetImage("IQCHAT_ELEMENT_SLIDER_LEFT_ICON")
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-53.9 -4.5", OffsetMax = "-48.9 4.5"
}
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = "%COMMAND_LEFT_SLIDE%", Color = "0 0 0 0"
}
, Text = {
Text = ""
}
}
, "Left", "LEFT_SLIDER_BTN");
container.Add(new CuiElement {
Name = "Right", Parent = NameSlider, Components = {
new CuiRawImageComponent {
Color = "1 1 1 1", Png = _imageUI.GetImage("IQCHAT_ELEMENT_SLIDER_RIGHT_ICON")
}
, new CuiRectTransformComponent {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "48.92 -4.5", OffsetMax = "53.92 4.5"
}
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = "%COMMAND_RIGHT_SLIDE%", Color = "0 0 0 0"
}
, Text = {
Text = ""
}
}
, "Right", "RIGHT_SLIDER_BTN");
AddInterface("UI_Chat_Slider", container.ToJson());
}
private void BuildingSliderUpdateArgument() {
CuiElementContainer container = new CuiElementContainer();
String ParentSlider = "%PARENT%";
String NameArgument = "%NAME%";
container.Add(new CuiElement {
Name = NameArgument, Parent = ParentSlider, Components = {
new CuiTextComponent {
Text = "%ARGUMENT%", Font = "robotocondensed-regular.ttf", FontSize =
// ... [Code preview truncated due to length. Full source in attached file] ...