C#:
using System.Collections;
using System.Collections.Generic;
using Oxide.Game.Rust.Cui;
using Oxide.Core.Plugins;
using Newtonsoft.Json;
using Oxide.Core.Libraries;
using Oxide.Core;
using System.Linq;
using System;
using UnityEngine;
namespace Oxide.Plugins {
[Info("XSkinMenu", "Sempai#3239", "1.4.1")]
class XSkinMenu : RustPlugin {
private List<ulong> _adminSkins = new List<ulong>();
public Dictionary<string, string> errorshortnames = new Dictionary<string, string> {
["snowmobiletomaha"]
= "tomahasnowmobile"
}
;
private BaseEntity GetRHitEntity(BasePlayer player) {
RaycastHit rhit;
if(!Physics.Raycast(player.eyes.HeadRay(), out rhit, 3f, LayerMask.GetMask("Deployed", "Construction", "Prevent Building"))) return null;
return rhit.GetEntity();
}
private void OnPlayerInput(BasePlayer player, InputState input) {
if(!input.WasJustPressed(BUTTON.FIRE_SECONDARY) || !StoredData[player.userID].UseSprayC) return;
if(permission.UserHasPermission(player.UserIDString, permSprayC)) {
Item item = player.GetActiveItem();
if(item != null && item.info.shortname == "spraycan") EntitySkin(player);
}
}
private object OnEntityReskin(BaseEntity entity, ItemSkinDirectory.Skin skin, BasePlayer player) {
if(entity != null && player != null && config.Setting.Blacklist.Contains(entity.skinID)) {
EffectNetwork.Send(new Effect("assets/bundled/prefabs/fx/invite_notice.prefab", player, 0, new Vector3(), new Vector3()), player.Connection);
return false;
}
return null;
}
private void DefaultKitsGUI(BasePlayer player, int Page = 0) {
bool eck = config.Setting.EnableCustomKits;
CuiElementContainer container = new CuiElementContainer();
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = eck ? "0.5 1" : "1 1", OffsetMax = eck ? "-2.5 0" : "0 0"
}
, Image = {
Color = "0 0 0 0"
}
}
, ".KitsGUI", ".DefaultKitsGUI", ".DefaultKitsGUI");
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -40.25", OffsetMax = "0 0"
}
, Text = {
Text = lang.GetMessage("DESC_DEFAULT_KITS", this, player.UserIDString), Align = TextAnchor.MiddleCenter, FontSize = 18, Font = "robotocondensed-regular.ttf", Color = "0.8 0.8 0.8 0.75"
}
}
, ".DefaultKitsGUI");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -45.25", OffsetMax = "0 -40.25"
}
, Image = {
Color = config.GUI.BColor1, Material = "assets/icons/greyout.mat"
}
}
, ".DefaultKitsGUI");
if(permission.UserHasPermission(player.UserIDString, permKitsD)) {
int x = 0, y = 0, count = eck ? 6 : 12;
foreach(var kit in config.KitsSetting.Skip(Page * count)) {
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = $"{(eck ? -245 : -492.5) + (x * 165)} {-7.5 - (y * 165)}", OffsetMax = $"{(eck ? -85 : -332.5) + (x * 165)} {152.5 - (y * 165)}"
}
, Image = {
Color = config.GUI.BlockColor, Material = "assets/icons/greyout.mat"
}
}
, ".DefaultKitsGUI", ".DKit");
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "5 -20.5", OffsetMax = $"-5 -5"
}
, Text = {
Text = kit.Key.Replace(@"\", ""), Align = TextAnchor.MiddleLeft, FontSize = 11, Font = "robotocondensed-regular.ttf", Color = "0.9 0.9 0.9 0.75"
}
}
, ".DKit");
int xx = 0, yy = 0;
foreach(var skin in kit.Value.Take(kit.Value.Count > 6 ? 5 : 6)) {
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = $"{-75 + (xx * 51.75)} {7 - (yy * 52.5)}", OffsetMax = $"{-28.25 + (xx * 51.75)} {54.5 - (yy * 52.5)}"
}
, Image = {
Color = config.GUI.BlockKitColor
}
}
, ".DKit", ".Skin");
if(config.API.GameIMG) container.Add(new CuiElement {
Parent = ".Skin", Components = {
new CuiImageComponent {
ItemId = _itemsId[skin.Key], SkinId = skin.Value
}
, new CuiRectTransformComponent {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "2.5 2.5", OffsetMax = "-2.5 -2.5"
}
}
}
);
else container.Add(new CuiElement {
Parent = ".Skin", Components = {
new CuiRawImageComponent {
Png = (string) ImageLibrary.Call("GetImage", $"{skin.Value}152")
}
, new CuiRectTransformComponent {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "2.5 2.5", OffsetMax = "-2.5 -2.5"
}
}
}
);
if(_adminSkins.Contains(skin.Value)) container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "0 1", OffsetMin = "1.5 -7.5", OffsetMax = "7.5 -1.5"
}
, Image = {
Color = "0.9 0 0 1", Sprite = "assets/icons/circle_closed.png"
}
,
}
, ".Skin");
else if(_vipSkins.Contains(skin.Value)) container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "0 1", OffsetMin = "1.5 -7.5", OffsetMax = "7.5 -1.5"
}
, Image = {
Color = "0.9 0.9 0 1", Sprite = "assets/icons/circle_closed.png"
}
,
}
, ".Skin");
xx++;
if(xx == 3) {
xx = 0;
yy++;
}
}
if(kit.Value.Count > 6) container.Add(new CuiButton {
RectTransform = {
AnchorMin = "1 0.5", AnchorMax = "1 0.5", OffsetMin = "-51.75 -45.5", OffsetMax = "-5 2"
}
, Button = {
Color = config.GUI.BlockKitColor, Command = $"skin_c kitinfo default '{kit.Key}'"
}
, Text = {
Text = $"+{kit.Value.Count - 5}", Align = TextAnchor.MiddleCenter, FontSize = 16, Font = "robotocondensed-regular.ttf", Color = "0.9 0.9 0.9 0.75"
}
}
, ".DKit");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "0.5 0", OffsetMin = "5 5", OffsetMax = "-26.75 24.25"
}
, Button = {
Color = config.GUI.BlockKitColor, Command = $"skin_c setkit default true false '{kit.Key}'"
}
, Text = {
Text = lang.GetMessage("INV", this, player.UserIDString), Align = TextAnchor.MiddleCenter, FontSize = 9, Font = "robotocondensed-regular.ttf", Color = "0.9 0.9 0.9 0.75"
}
}
, ".DKit");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-24.58 5", OffsetMax = "24.58 24.25"
}
, Button = {
Color = config.GUI.BlockKitColor, Command = $"skin_c setkit default false true '{kit.Key}'"
}
, Text = {
Text = lang.GetMessage("SET", this, player.UserIDString), Align = TextAnchor.MiddleCenter, FontSize = 9, Font = "robotocondensed-regular.ttf", Color = "0.9 0.9 0.9 0.75"
}
}
, ".DKit");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0.5 0", AnchorMax = "1 0", OffsetMin = "26.75 5", OffsetMax = "-5 24.25"
}
, Button = {
Color = config.GUI.BlockKitColor, Command = $"skin_c setkit default true true '{kit.Key}'"
}
, Text = {
Text = lang.GetMessage("INV_SET", this, player.UserIDString), Align = TextAnchor.MiddleCenter, FontSize = 9, Font = "robotocondensed-regular.ttf", Color = "0.9 0.9 0.9 0.75"
}
}
, ".DKit");
x++;
if(x == (eck ? 3 : 6)) {
x = 0;
y++;
if(y == 2) break;
}
}
bool back = Page != 0;
bool next = config.KitsSetting.Count > ((Page + 1) * count);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-22.5 5", OffsetMax = "-2.5 25"
}
, Button = {
Color = back ? config.GUI.ActiveBackColor : config.GUI.InactiveBackColor, Command = back ? $"page.xskinmenu defaultkits 0 0 {Page - 1}" : ""
}
, Text = {
Text = "<", Align = TextAnchor.MiddleCenter, FontSize = 16, Font = "robotocondensed-regular.ttf", Color = back ? config.GUI.ActiveBackColorText : config.GUI.InactiveBackColorText
}
}
, ".DefaultKitsGUI");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "2.5 5", OffsetMax = "22.5 25"
}
, Button = {
Color = next ? config.GUI.ActiveNextReloadColor : config.GUI.InactiveNextReloadColor, Command = next ? $"page.xskinmenu defaultkits 0 0 {Page + 1}" : ""
}
, Text = {
Text = ">", Align = TextAnchor.MiddleCenter, FontSize = 16, Font = "robotocondensed-regular.ttf", Color = next ? config.GUI.ActiveNextReloadColorText : config.GUI.InactiveNextReloadColorText
}
}
, ".DefaultKitsGUI");
}
else container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-220 -57.5", OffsetMax = "220 12.5"
}
, Text = {
Text = lang.GetMessage("DEFAULT_KITS_NOPERM", this, player.UserIDString), Align = TextAnchor.MiddleCenter, FontSize = 20, Color = "0.8 0.8 0.8 0.75"
}
}
, ".DefaultKitsGUI");
CuiHelper.AddUi(player, container);
}
private const string permKitsD = "xskinmenu.defaultkits";
private void KitInfoGUI(BasePlayer player, string category, string kitname) {
Dictionary<string, ulong> skins = category == "default" && config.Setting.EnableDefaultKits && config.KitsSetting.ContainsKey(kitname) && permission.UserHasPermission(player.UserIDString, permKitsD) ? config.KitsSetting[kitname] : category == "custom" && config.Setting.EnableCustomKits && StoredData[player.userID].Kits.ContainsKey(kitname) && permission.UserHasPermission(player.UserIDString, permKitsC) ? StoredData[player.userID].Kits[kitname] : new Dictionary<string, ulong>();
CuiElementContainer container = new CuiElementContainer();
bool adminSkinPerm = !permission.UserHasPermission(player.UserIDString, permAdminS), vipSkinPerm = !permission.UserHasPermission(player.UserIDString, permVipS);
int x = 0, y = 0;
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0"
}
, Image = {
Color = config.GUI.BColor4
}
}
, ".KitsGUI", ".KitInfo", ".KitInfo");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-14.12 10", OffsetMax = "14.12 38.25"
}
, Button = {
Color = config.GUI.IconColor, Sprite = "assets/icons/close.png", Close = ".KitInfo"
}
, Text = {
Text = ""
}
}
, ".KitInfo");
foreach(var skin in skins) {
bool isAdminSkin = _adminSkins.Contains(skin.Value), isVipSkin = _vipSkins.Contains(skin.Value), adminOrVip = isAdminSkin && adminSkinPerm || isVipSkin && vipSkinPerm;
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = $"{-497.5 + (x * 71.42)} {131.33 - (y * 71.42)}", OffsetMax = $"{-431.08 + (x * 71.42)} {197.75 - (y * 71.42)}"
}
, Image = {
Color = config.GUI.BlockColor, Material = "assets/icons/greyout.mat"
}
}
, ".KitInfo", ".Skin");
if(config.API.GameIMG) container.Add(new CuiElement {
Parent = ".Skin", Components = {
new CuiImageComponent {
ItemId = _itemsId[skin.Key], SkinId = skin.Value, Color = adminOrVip ? "1 1 1 0.2" : "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "2.5 2.5", OffsetMax = "-2.5 -2.5"
}
}
}
);
else container.Add(new CuiElement {
Parent = ".Skin", Components = {
new CuiRawImageComponent {
Png = (string) ImageLibrary.Call("GetImage", $"{skin.Value}152"), Color = adminOrVip ? "1 1 1 0.2" : "1 1 1 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "2.5 2.5", OffsetMax = "-2.5 -2.5"
}
}
}
);
if(isAdminSkin) container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "0 1", OffsetMin = "2 -10", OffsetMax = "10 -2"
}
, Image = {
Color = "0.9 0 0 1", Sprite = "assets/icons/circle_closed.png"
}
,
}
, ".Skin");
else if(isVipSkin) container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "0 1", OffsetMin = "2 -10", OffsetMax = "10 -2"
}
, Image = {
Color = "0.9 0.9 0 1", Sprite = "assets/icons/circle_closed.png"
}
,
}
, ".Skin");
x++;
if(x == 14) {
x = 0;
y++;
if(y == 5) break;
}
}
CuiHelper.AddUi(player, container);
}
private const string permSkinI = "xskinmenu.item";
private List<ulong> _workshopCollections = new List<ulong>();
private Coroutine _coroutine;
private Dictionary<string, int> _itemsId = new Dictionary<string, int>();
public class SkinsQueryResponse {
public SkinsResponse response;
}
private void CreateKitGUI(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 -45.5"
}
, Image = {
Color = config.GUI.BColor3
}
}
, ".CustomKitsGUI", ".CreateKitGUI", ".CreateKitGUI");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0"
}
, Button = {
Color = "0 0 0 0", Close = ".CreateKitGUI"
}
, Text = {
Text = ""
}
}
, ".CreateKitGUI");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-200 -34.25", OffsetMax = "200 34.25"
}
, Image = {
Color = config.GUI.BColor1, Material = "assets/icons/greyout.mat"
}
}
, ".CreateKitGUI", ".CreateKit");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "5 5", OffsetMax = "-5 -5"
}
, Image = {
Color = config.GUI.BColor2
}
}
, ".CreateKit", ".CreateButtons");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-105 -25", OffsetMax = "105 -5"
}
, Image = {
Color = config.GUI.BlockColor, Material = "assets/icons/greyout.mat"
}
}
, ".CreateButtons", ".Input");
container.Add(new CuiElement {
Parent = ".Input", Components = {
new CuiInputFieldComponent {
Text = lang.GetMessage("KIT_NAME_CREATE", this, player.UserIDString), Align = TextAnchor.MiddleCenter, Font = "robotocondensed-regular.ttf", FontSize = 12, Command = "skin_c createkit", CharsLimit = 18, NeedsKeyboard = true
}
, new CuiRectTransformComponent {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0"
}
}
}
);
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 0", OffsetMin = "5 5", OffsetMax = "-5 35"
}
, Text = {
Text = lang.GetMessage("CREATE_KIT_INFO", this, player.UserIDString), Align = TextAnchor.LowerCenter, FontSize = 10, Font = "robotocondensed-regular.ttf", Color = "0.5 0.5 0.5 0.75"
}
}
, ".CreateButtons");
CuiHelper.AddUi(player, container);
}
private void SkinGUI(BasePlayer player, string item, int Page = 0, string category = "null", int PageC = 0, string search = "") {
bool comfort = StoredData[player.userID].Comfort;
CuiElementContainer container = new CuiElementContainer();
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-502.5 -228.25", OffsetMax = comfort ? "502.5 77.5" : "502.5 177.5"
}
, Image = {
Color = "0 0 0 0"
}
}
, ".SGUI", ".SkinGUI", ".SkinGUI");
int x = 0, y = 0, count = comfort ? 30 : 40;
ulong s = StoredData[player.userID].Skins[item];
int itemid = _itemsId[item];
List<ulong> list_skins = new List<ulong>();
if(config.Setting.AdminSkins.ContainsKey(item) && permission.UserHasPermission(player.UserIDString, permAdminS)) list_skins.AddRange(config.Setting.AdminSkins[item]);
if(config.Setting.VipSkins.ContainsKey(item) && permission.UserHasPermission(player.UserIDString, permVipS)) list_skins.AddRange(config.Setting.VipSkins[item]);
list_skins.AddRange(StoredDataSkins[item]);
if(!string.IsNullOrEmpty(search)) {
if(ulong.TryParse(search, out ulong searchSkinID)) list_skins = list_skins.Where(skinID => skinID == searchSkinID).ToList();
else list_skins = list_skins.Where(skinID => StoredDataSkinsName.ContainsKey(skinID) && StoredDataSkinsName[skinID].ToLower().Contains(search)).Take(count).ToList();
}
foreach(var skin in list_skins.Skip(Page * count)) {
bool isAdminSkin = _adminSkins.Contains(skin), isVipSkin = _vipSkins.Contains(skin);
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = comfort ? $"{-497.5 + (x * 100)} {52.37 - (y * 100)}" : $"{-497.5 + (x * 100)} {102.37 - (y * 100)}", OffsetMax = comfort ? $"{-402.5 + (x * 100)} {147.37 - (y * 100)}" : $"{-402.5 + (x * 100)} {197.37 - (y * 100)}"
}
, Image = {
Color = s == skin ? config.GUI.ActiveBlockColor : config.GUI.BlockColor, Material = "assets/icons/greyout.mat"
}
}
, ".SkinGUI", ".Skin");
if(config.API.GameIMG) container.Add(new CuiElement {
Parent = ".Skin", Components = {
new CuiImageComponent {
ItemId = itemid, SkinId = skin
}
, new CuiRectTransformComponent {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "10 5", OffsetMax = "-10 -15"
}
}
}
);
else container.Add(new CuiElement {
Parent = ".Skin", Components = {
new CuiRawImageComponent {
Png = (string) ImageLibrary.Call("GetImage", $"{skin}152")
}
, new CuiRectTransformComponent {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "10 5", OffsetMax = "-10 -15"
}
}
}
);
if(StoredDataSkinsName.ContainsKey(skin)) container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "2.5 -12.5", OffsetMax = "-2.5 -2.5"
}
, Text = {
Text = StoredDataSkinsName[skin], Align = TextAnchor.MiddleCenter, Font = "robotocondensed-regular.ttf", FontSize = 8, Color = "0.85 0.85 0.85 1"
}
}
, ".Skin");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0"
}
, Button = {
Color = "0 0 0 0", Command = comfort ? $"skin_c setskin {item} {skin} {Page} {category} {PageC} {search}" : $"skin_c setskin {item} {skin} {Page} {search}"
}
, Text = {
Text = ""
}
}
, ".Skin");
if(permission.UserHasPermission(player.UserIDString, permAdmin) && !_adminUiFD.Contains(player.userID)) {
if(_adminAndVipSkins.Contains(skin)) container.Add(new CuiButton {
RectTransform = {
AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-20 -30", OffsetMax = "-5 -15"
}
, Button = {
Color = "1 1 1 0.75", Sprite = "assets/icons/refresh.png", Command = $"xskin refresh_ui {item} {skin} {Page} {(isAdminSkin ? "admin_to_default" : isVipSkin ? "vip_to_default" : "")} {category}"
}
, Text = {
Text = ""
}
}
, ".Skin");
else {
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-38 -30", OffsetMax = "-23 -15"
}
, Button = {
Color = "0.9 0 0 1", Sprite = "assets/icons/refresh.png", Command = $"xskin refresh_ui {item} {skin} {Page} default_to_admin {category}"
}
, Text = {
Text = ""
}
}
, ".Skin");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-20 -30", OffsetMax = "-5 -15"
}
, Button = {
Color = "0.9 0.9 0 1", Sprite = "assets/icons/refresh.png", Command = $"xskin refresh_ui {item} {skin} {Page} default_to_vip {category}"
}
, Text = {
Text = ""
}
}
, ".Skin");
}
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-20 5", OffsetMax = "-5 20"
}
, Button = {
Color = "1 1 1 0.75", Sprite = "assets/icons/clear.png", Command = $"xskin remove_ui {item} {skin} {Page} {(isAdminSkin ? "admin" : isVipSkin ? "vip" : "default")} {category}"
}
, Text = {
Text = ""
}
}
, ".Skin");
}
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "0 0", OffsetMin = "5 5", OffsetMax = "20 20"
}
, Button = {
Color = "1 1 1 0.75", Sprite = config.GUI.IconZoom, Command = $"skin_c zoomskin {itemid} {skin}"
}
, Text = {
Text = ""
}
}
, ".Skin");
if(isAdminSkin) container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "0 1", OffsetMin = "2.5 -25", OffsetMax = "12.5 -15"
}
, Image = {
Color = "0.9 0 0 1", Sprite = "assets/icons/circle_closed.png"
}
,
}
, ".Skin");
else if(isVipSkin) container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 1", AnchorMax = "0 1", OffsetMin = "2.5 -25", OffsetMax = "12.5 -15"
}
, Image = {
Color = "0.9 0.9 0 1", Sprite = "assets/icons/circle_closed.png"
}
,
}
, ".Skin");
x++;
if(x == 10) {
x = 0;
y++;
if(y == (comfort ? 3 : 4)) break;
}
}
bool back = Page != 0;
bool next = list_skins.Count > ((Page + 1) * count);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = config.GUI.Page ? "-245 -36.75" : "-190 -36.75", OffsetMax = config.GUI.Page ? "-155 -10" : "-100 -10"
}
, Button = {
Color = back ? config.GUI.ActiveBackColor : config.GUI.InactiveBackColor, Command = back ? $"page.xskinmenu skin back {item} {Page} {category} {PageC}" : ""
}
, Text = {
Text = lang.GetMessage("BACK", this, player.UserIDString), Align = TextAnchor.MiddleCenter, FontSize = 16, Font = "robotocondensed-regular.ttf", Color = back ? config.GUI.ActiveBackColorText : config.GUI.InactiveBackColorText
}
}
, ".SkinGUI");
if(config.GUI.Page) container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-152.5 -36.75", OffsetMax = "-97.5 -10"
}
, Text = {
Text = $"{Page + 1}/{Math.Ceiling((double)list_skins.Count / count)}", Align = TextAnchor.MiddleCenter, Font = "robotocondensed-regular.ttf", FontSize = 15, Color = "0.75 0.75 0.75 0.9"
}
}
, ".SkinGUI");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-95 -36.75", OffsetMax = "-5 -10"
}
, Button = {
Color = next ? config.GUI.ActiveNextReloadColor : config.GUI.InactiveNextReloadColor, Command = next ? $"page.xskinmenu skin next {item} {Page} {category} {PageC}" : ""
}
, Text = {
Text = lang.GetMessage("NEXT", this, player.UserIDString), Align = TextAnchor.MiddleCenter, FontSize = 16, Font = "robotocondensed-regular.ttf", Color = next ? config.GUI.ActiveNextReloadColorText : config.GUI.InactiveNextReloadColorText
}
}
, ".SkinGUI");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = config.GUI.Page ? "-255 -41.75" : "-200 -41.75", OffsetMax = config.GUI.Page ? "-250 0" : "-195 0"
}
, Image = {
Color = config.GUI.BColor1, Material = "assets/icons/greyout.mat"
}
}
, ".SkinGUI");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = config.GUI.Page ? "-400 -36.75" : "-345 -36.75", OffsetMax = config.GUI.Page ? "-260 -10" : "-205 -10"
}
, Image = {
Color = config.GUI.BlockColor, Material = "assets/icons/greyout.mat"
}
}
, ".SkinGUI", ".Input");
container.Add(new CuiElement {
Parent = ".Input", Components = {
new CuiInputFieldComponent {
Text = string.IsNullOrEmpty(search) ? lang.GetMessage("SKIN_SEARCH", this, player.UserIDString) : search, Align = TextAnchor.MiddleCenter, Font = "robotocondensed-regular.ttf", FontSize = 10, Command = comfort ? $"skin_c searchskin {item} {category} {PageC}" : $"skin_c searchskin {item} {category}", CharsLimit = 30, NeedsKeyboard = true, Color = "0.8 0.8 0.8 1"
}
, new CuiRectTransformComponent {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0"
}
}
}
);
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = config.GUI.Page ? "-410 -41.75" : "-355 -41.75", OffsetMax = config.GUI.Page ? "-405 0" : "-350 0"
}
, Image = {
Color = config.GUI.BColor1, Material = "assets/icons/greyout.mat"
}
}
, ".SkinGUI");
CuiHelper.AddUi(player, container);
}
private class SkinConfig {
[JsonProperty(LanguageEnglish ? "Menu settings" : "Меню настроект")]
public MenuSSetting MenuS = new MenuSSetting();
internal class APISetting {
[JsonProperty(LanguageEnglish ? "Which API to use to upload images - [ True - regular images from the Steam Workshop (almost all existing skins) | False - beautiful images (all accepted skins by the developers, plus half from the Steam Workshop) ]" : "Какое API использовать для загрузки изображений - [ True - обычные изображения из Steam Workshop (практически все существующие скины) | False - красивые изображения (все принятые скины разработчиками, а также половина из Steam Workshop) ]")]
public bool APIOption;
[JsonProperty(LanguageEnglish ? "Display images of items and skins by game methods. ( Set to false if you want to use the API and plugin ImageLibrary )" : "Отображать изображения предметов и скинов методами игры. ( Установите false если хотите использовать API и плагин ImageLibrary )")]
public bool GameIMG = true;
}
[JsonProperty(LanguageEnglish ? "Category settings - [ Item shortname | Default item skin ]" : "Настройка категорий - [ Шортнейм предмета | Дефолтный скин предмета ]")]
public Dictionary<string, Dictionary<string, ulong>> Category = new Dictionary<string, Dictionary<string, ulong>>();
[JsonProperty(LanguageEnglish ? "Default player settings" : "Настройки игрока по умолчанию")]
public PlayerSetting PSetting = new PlayerSetting();
[JsonProperty(LanguageEnglish ? "Default skin kits setting" : "Настройка стандартных наборов скинов")]
public Dictionary<string, Dictionary<string, ulong>> KitsSetting = new Dictionary<string, Dictionary<string, ulong>>();
internal class SteamSetting {
[JsonProperty("Steam API Key")]
public string APIKey;
}
[JsonProperty(LanguageEnglish ? "Permissions settings. Maximum number of personal skin kits" : "Настройка разрешений. Максимальное кол-во личных наборов скинов")]
public Dictionary<string, int> KitsCPSetting = new Dictionary<string, int>();
[JsonProperty(LanguageEnglish ? "GUI settings" : "Настройки GUI")]
public GUISetting GUI = new GUISetting();
internal class MenuSSetting {
[JsonProperty(LanguageEnglish ? "Enabled parameter icon" : "Иконка включенного параметра")]
public string TButtonIcon;
[JsonProperty(LanguageEnglish ? "Disabled parameter icon" : "Иконка вылюченного параметра")]
public string FButtonIcon;
[JsonProperty(LanguageEnglish ? "Enabled parameter color" : "Цвет включенного параметра")]
public string CTButton;
[JsonProperty(LanguageEnglish ? "Disabled parameter color" : "Цвет вылюченного параметра")]
public string CFButton;
}
internal class GUISetting {
[JsonProperty(LanguageEnglish ? "Layer UI - [ Overlay - above inventory | Hud - under inventory (to view installed skins without closing the menu) ]" : "Слой UI - [ Overlay - поверх инвентаря | Hud - под инвентарем (для просмотра установленных скинов не закрывая меню) ]")]
public string LayerUI = "Overlay";
[JsonProperty(LanguageEnglish ? "Refresh UI page after skin selection" : "Обновлять UI страницу после выбора скина")]
public bool SkinUP;
[JsonProperty(LanguageEnglish ? "Refresh UI page after skin removal" : "Обновлять UI страницу после удаления скина")]
public bool DelSkinUP;
[JsonProperty(LanguageEnglish ? "Display selected skins on homepage" : "Отображать выбранные скины на главной")]
public bool MainSkin;
[JsonProperty(LanguageEnglish ? "Display button to reset, all selected skins" : "Отображать кнопку для сброса всех выбранных скинов")]
public bool ButtonClear;
[JsonProperty(LanguageEnglish ? "Display pages" : "Отображать страницы")]
public bool Page;
[JsonProperty(LanguageEnglish ? "Close the menu by tapping on an empty area of the screen" : "Закрыть меню нажатием на пустую область экрана")]
public bool CloseUI;
[JsonProperty(LanguageEnglish ? "Icon - Kits" : "Иконка - Наборы")]
public string IconKits = "assets/icons/clothing.png";
[JsonProperty(LanguageEnglish ? "Icon - XBuildingSkinMenu" : "Иконка - XBuildingSkinMenu")]
public string IconBSkin = "assets/icons/construction.png";
[JsonProperty(LanguageEnglish ? "Icon - Zoom" : "Иконка - Увеличение")]
public string IconZoom = "assets/icons/add.png";
[JsonProperty(LanguageEnglish ? "Material_background_0" : "Материал_фон_0")]
public string BMaterial0 = "assets/icons/greyout.mat";
[JsonProperty(LanguageEnglish ? "Color_background_0" : "Цвет_фон_0")]
public string BColor0 = "0 0 0 0";
[JsonProperty(LanguageEnglish ? "Color_background_1" : "Цвет_фон_1")]
public string BColor1;
[JsonProperty(LanguageEnglish ? "Color_background_2" : "Цвет_фон_2")]
public string BColor2;
[JsonProperty(LanguageEnglish ? "Color_background_3" : "Цвет_фон_3")]
public string BColor3 = "0.1 0.1 0.1 0.97";
[JsonProperty(LanguageEnglish ? "Color_background_4" : "Цвет_фон_4")]
public string BColor4 = "0.25 0.26 0.24 1";
[JsonProperty(LanguageEnglish ? "Active category color" : "Цвет активной категории")]
public string ActiveColor;
[JsonProperty(LanguageEnglish ? "Inactive category color" : "Цвет неактивной категории")]
public string InactiveColor;
[JsonProperty(LanguageEnglish ? "Category button color" : "Цвет кнопок категорий")]
public string CategoryColor;
[JsonProperty(LanguageEnglish ? "Settings buttons color" : "Цвет кнопок настроек")]
public string SettingColor;
[JsonProperty(LanguageEnglish ? "Button color (icons)" : "Цвет кнопок (иконки)")]
public string IconColor;
[JsonProperty(LanguageEnglish ? "Item/skin block color" : "Цвет блоков предметов/скинов")]
public string BlockColor;
[JsonProperty(LanguageEnglish ? "Color of skins/buttons block in kits" : "Цвет блоков скинов/кнопок в наборах")]
public string BlockKitColor = "0.66 0.67 0.65 0.5";
[JsonProperty(LanguageEnglish ? "Selected skin block color" : "Цвет блока выбранного скина")]
public string ActiveBlockColor;
[JsonProperty(LanguageEnglish ? "Active next/reset button color" : "Цвет активной кнопки далее/сбросить")]
public string ActiveNextReloadColor;
[JsonProperty(LanguageEnglish ? "Color of inactive next/reset button" : "Цвет неактивной кнопки далее/сбросить")]
public string InactiveNextReloadColor;
[JsonProperty(LanguageEnglish ? "Next/reset active button text color" : "Цвет текста активной кнопки далее/сбросить")]
public string ActiveNextReloadColorText;
[JsonProperty(LanguageEnglish ? "Text color of inactive next/reset button" : "Цвет текста неактивной кнопки далее/сбросить")]
public string InactiveNextReloadColorText;
[JsonProperty(LanguageEnglish ? "Active back button color" : "Цвет активной кнопки назад")]
public string ActiveBackColor;
[JsonProperty(LanguageEnglish ? "Back button color" : "Цвет неактивной кнопки назад")]
public string InactiveBackColor;
[JsonProperty(LanguageEnglish ? "Active back button text color" : "Цвет текста активной кнопки назад")]
public string ActiveBackColorText;
[JsonProperty(LanguageEnglish ? "Back button text color" : "Цвет текста неактивной кнопки назад")]
public string InactiveBackColorText;
}
internal class PlayerSetting {
[JsonProperty(LanguageEnglish ? "Change item skin in inventory after selecting skin in menu" : "Изменить скин предмета в инвентаре после выбора скина в меню")]
public bool ChangeSI;
[JsonProperty(LanguageEnglish ? "Change item skin in inventory after removing skin in menu" : "Изменить скин предмета в инвентаре после удаления скина в меню")]
public bool ChangeSCL;
[JsonProperty(LanguageEnglish ? "Change skin on installed items/constructions [ /skinentity ]" : "Изменить скин на установленных предметах/конструкциях [ /skinentity ]")]
public bool ChangeSE;
[JsonProperty(LanguageEnglish ? "Allow friends to change the skin on items/constructions you installed [ /skinentity ]" : "Разрешить друзьям изменить скин на установленных вами предметах/конструкциях [ /skinentity ]")]
public bool ChangeF;
[JsonProperty(LanguageEnglish ? "Change item skin when it is placed in the inventory by any means" : "Изменить скин предмета когда он любым способом попал в инвентарь")]
public bool ChangeSG;
[JsonProperty(LanguageEnglish ? "Change item skin only when pickup" : "Изменить скин предмета только при его подборе")]
public bool ChangeSP;
[JsonProperty(LanguageEnglish ? "Do not reset item skin for which no skin is selected when it enters the inventory" : "Не сбрасывать скин предмета, для которого не выбран скин, когда он попадает в инвентарь")]
public bool ChangeSGN;
[JsonProperty(LanguageEnglish ? "Change item skin when crafting" : "Изменить скин предмета при крафте")]
public bool ChangeSC;
[JsonProperty(LanguageEnglish ? "Use skins with a spray can" : "Использовать скины с помощью баллончика")]
public bool UseSprayC;
[JsonProperty(LanguageEnglish ? "Enable sound effects in the menu [ Clicks ]" : "Включить звуковые эффекты в меню [ Щелчки ]")]
public bool UseSoundE;
[JsonProperty(LanguageEnglish ? "[ True - Comfort menu | False - Default menu ]" : "[ True - Комфортное меню | False - Стандартное меню ]")]
public bool Comfort;
}
public static SkinConfig GetNewConfiguration() {
return new SkinConfig {
API = new APISetting {
GameIMG = true, APIOption = false
}
, Steam = new SteamSetting {
APIKey = ""
}
, Setting = new GeneralSetting {
UpdateSkins = true, UpdateSkinsFacepunch = false, RepairBench = true, ReskinConfig = false, ReskinRespawn = true, LogLoadIMG = true, LogReloadIMG = true, EnableDefaultKits = true, EnableCustomKits = true, Blacklist = new List<ulong> {
1742796979, 841106268
}
, AdminSkins = new Dictionary<string, List<ulong>> {
["rifle.ak"]
= new List<ulong> {
2428514763, 2431899986, 2802928155, 2551895055, 2957212973, 2976404884
}
, ["smg.mp5"] = new List<ulong> {
2468526014, 2966579723, 2590028692, 2354313222, 2558124512, 2432107615, 2351278756
}
, ["metal.facemask"] = new List<ulong> {
2976455803, 2972755707, 2960187815, 2963852242, 2462021937, 1658894467, 1539950759
}
}
, VipSkins = new Dictionary<string, List<ulong>> {
["hatchet"]
= new List<ulong> {
2940068053, 2891473448, 1567848320, 1414450116, 1306286667, 1277610054, 1679923378
}
, ["pickaxe"] = new List<ulong> {
29
// ... [Code preview truncated due to length. Full source in attached file] ...