Иконка ресурса

FREE RevolutionCraftMenu : 1.4.0 1.4.0

Нет прав для скачивания
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using UnityEngine;
namespace Oxide.Plugins {
    [Info("RevolutionCraftMenu", "DezLife", "1.4.0")]
    public class RevolutionCraftMenu : RustPlugin {
#region Fields
        [PluginReference]
        private Plugin ImageLibrary;
        private List<ulong> OpenMenu = new List<ulong>();
#endregion
#region Hooks
        private void OnServerInitialized() {
            if (!ImageLibrary) {
                NextTick(() => {
                    PrintError("Не найден ImageLibrary, плагин не будет работать!");
                    Interface.Oxide.UnloadPlugin(Name);
                }
                );
                return;
            }
            Dictionary<string, string> images = new Dictionary<string, string>();
            LoadConfigVars();
            if(_config.setings.ButonOpenMenu) ImageLibrary.Call("AddImage", _config.setings.PngForButton, _config.setings.PngForButton);
            for(int i = 0; i< _config.items.Count; i++) {
                if (!string.IsNullOrEmpty(_config.items[i].png)) {
                    ImageLibrary.Call("AddImage", _config.items[i].png, _config.items[i].png);
                }
                if (!string.IsNullOrEmpty(_config.items[i].shortname)) {
                    if (!(bool)ImageLibrary?.Call("HasImage", _config.items[i].shortname + 128)) ImageLibrary.Call("AddImage", $"http://api.skyplugins.ru/api/getimage/{_config.items[i].shortname}/128", _config.items[i].shortname + 128);
                }
                if (!string.IsNullOrEmpty((_config.items[i].shortname)) && _config.items[i].skinID != 0) {
                    if (!(bool)ImageLibrary?.Call("HasImage", _config.items[i].shortname + 128, _config.items[i].skinID)) ImageLibrary.Call("AddImage", $"http://api.skyplugins.ru/api/getskin/{_config.items[i].skinID}/128", _config.items[i].shortname + 128, _config.items[i].skinID);
                }
                for (int S = 0; S < _config.items[i].craftItems.Count; S++) {
                    var cfg = _config.items[i].craftItems[S];
                    if (cfg.skinID == 0) {
                        if (!(bool)ImageLibrary?.Call("HasImage", cfg.shortname + 64)) ImageLibrary.Call("AddImage", $"http://api.skyplugins.ru/api/getimage/{cfg.shortname}/64", cfg.shortname + 64);
                    }
                    else {
                        if (!(bool)ImageLibrary?.Call("HasImage", cfg.shortname, cfg.skinID)) ImageLibrary.Call("AddImage", $"http://api.skyplugins.ru/api/getskin/{cfg.skinID}/64/", cfg.shortname, cfg.skinID);
                    }
                }
            }
            foreach(BasePlayer player in BasePlayer.activePlayerList) OnPlayerConnected(player);
            cmd.AddChatCommand(_config.setings.CommandOpen, this, nameof(opencommand));
        }
        void Unload() {
            for(int i = 0; i < BasePlayer.activePlayerList.Count; i++) {
                BasePlayer p = BasePlayer.activePlayerList[i];
                CuiHelper.DestroyUi(p, GUICRAFT);
                CuiHelper.DestroyUi(p, IconLayer);
            }
        }
        void OnPlayerDisconnected(BasePlayer player) {
            if (OpenMenu.Contains(player.userID)) OpenMenu.Remove(player.userID);
        }
        private void OnPlayerConnected(BasePlayer player) {
            if (_config.setings.ButonOpenMenu) InitializeIconButton(player);
        }
#endregion
#region CONFIG
        private Configuration _config;
        public class Configuration {
            [JsonProperty("Настройки")]
            public Setings setings;
            [JsonProperty("Крафт предметы")]
            public List<ItemInfo> items = new List<ItemInfo>();
        }
        protected override void LoadDefaultConfig() {
            _config = new Configuration() {
                setings = new Setings {
                    ColorButton = "#4F5353C5", ColorWork1 = "#007822FF", ColorWork2 = "#1159BE8B", ColorWork3 = "#980016FF", ColorWork = "#00919AFF", ButonOpenMenu = true, PngForButton = "https://i.imgur.com/TkQjKcL.png", Ofssemin = "3 -50", Ofsetmax = "50 -3", CommandOpen = "craft"
                }
                , items = new List<ItemInfo> {
                    new ItemInfo {
                        name = "M39 Rifle", shortname = "rifle.m39", countCraft = 1, WorkBenchCraft = 2, skinID = 0U, png = null, craftItems = new List<CraftInfo> {
                            new CraftInfo {
                                shortname = "riflebody", amount = 4, skinID = 0U
                            }
                            , new CraftInfo {
                                shortname = "metal.refined", amount = 50, skinID = 0U
                            }
                            , new CraftInfo {
                                shortname = "metalspring", amount = 3, skinID = 0U
                            }
                        }
                    }
                    , new ItemInfo {
                        name = "L96 Rifle", shortname = "rifle.l96", countCraft = 1, WorkBenchCraft = 3, skinID = 0U, png = null, craftItems = new List<CraftInfo> {
                            new CraftInfo {
                                shortname = "metal.refined", amount = 100, skinID = 0U
                            }
                            , new CraftInfo {
                                shortname = "metalpipe", amount = 2, skinID = 0U
                            }
                            , new CraftInfo {
                                shortname = "metalspring", amount = 5, skinID = 0U
                            }
                            , new CraftInfo {
                                shortname = "riflebody", amount = 1, skinID = 0U
                            }
                            ,
                        }
                    }
                    , new ItemInfo {
                        name = "Rustigé Egg - Red", shortname = "rustige_egg_a", countCraft = 5, WorkBenchCraft = 0, skinID = 0U, png = null, craftItems = new List<CraftInfo> {
                            new CraftInfo {
                                shortname = "metal.refined", amount = 200, skinID = 0U
                            }
                            ,
                        }
                    }
                    , new ItemInfo {
                        name = "Радиактивная сера", shortname = "glue", countCraft = 1, WorkBenchCraft = 3, skinID = 1681986132, png = null, craftItems = new List<CraftInfo> {
                            new CraftInfo {
                                shortname = "metalpipe", amount = 20, skinID = 0U
                            }
                            , new CraftInfo {
                                shortname = "metal.refined", amount = 350, skinID = 0U
                            }
                            ,
                        }
                    }
                    , new ItemInfo {
                        name = "Перфаратор", shortname = "jackhammer", countCraft = 1, WorkBenchCraft = 1, skinID = 0U, png = null, craftItems = new List<CraftInfo> {
                            new CraftInfo {
                                shortname = "scrap", amount = 150, skinID = 0U
                            }
                            , new CraftInfo {
                                shortname = "metalblade", amount = 5, skinID = 0U
                            }
                            , new CraftInfo {
                                shortname = "metalpipe", amount = 3, skinID = 0U
                            }
                            ,
                        }
                    }
                }
            }
            ;
            SaveConfig(_config);
        }
        void SaveConfig(Configuration config) {
            Config.WriteObject(config, true);
            SaveConfig();
        }
        public void LoadConfigVars() {
            _config = Config.ReadObject<Configuration>();
            Config.WriteObject(_config, true);
        }
        public class Setings {
            [JsonProperty("Цвет кнопок вперед/назад (hex)")]
            public string ColorButton;
            [JsonProperty("Цвет 1 верстака (hex)")]
            public string ColorWork1;
            [JsonProperty("Цвет 2 верстака (hex)")]
            public string ColorWork2;
            [JsonProperty("Цвет 3 верстака (hex)")]
            public string ColorWork3;
            [JsonProperty("Цвет без верстака (hex)")]
            public string ColorWork;
            [JsonProperty("Включить иконку с кнопкой крафта")]
            public bool ButonOpenMenu;
            [JsonProperty("Картинка для кнопки")]
            public string PngForButton;
            [JsonProperty("OffsetMin кнопки")]
            public string Ofssemin;
            [JsonProperty("OffsetMax кнопки")]
            public string Ofsetmax;
            [JsonProperty("Команда для открытия меню")]
            public string CommandOpen;
        }
        public class ItemInfo {
            [JsonProperty("Название предмета")]
            public string name;
            [JsonProperty("Шортнейм предмета")]
            public string shortname;
            [JsonProperty("Крафтить шт")]
            public int countCraft;
            [JsonProperty("Какой верстак нужен для крафта (Если 0 то не нужен)")]
            public int WorkBenchCraft;
            [JsonProperty("СкинИД предмета[Не менять]")]
            public ulong skinID;
            [JsonProperty("Ссылка на иконку")]
            public string png;
            [JsonProperty("Предметы для крафта")]
            public List<CraftInfo> craftItems = new List<CraftInfo>();
        }
        public class CraftInfo {
            [JsonProperty("Шортнейм предмета")]
            public string shortname;
            [JsonProperty("Количество предмета")]
            public int amount;
            [JsonProperty("СкинИД предмета")]
            public ulong skinID;
        }
#endregion
#region Helper
        private bool CheckCraft(BasePlayer player, int Index) {
            var ItemList = _config.items[Index];
            var more = new Dictionary<string, int>();
            for (int i = 0; i < ItemList.craftItems.Count; i++) {
                var CraftItems = ItemList.craftItems[i];
                var name = CraftItems.shortname;
                var has = player.inventory.GetAmount(ItemManager.FindItemDefinition(CraftItems.shortname).itemid);
                var need = CraftItems.amount;
                if (has < CraftItems.amount) {
                    if (!more.ContainsKey(name)) more.Add(name, 0);
                    more[name] += need - has;
                }
            }
            if (more.Count == 0) return true;
            else return false;
        }
        private bool ImportImageList(string title, Dictionary<string, string> images) {
            plugins.Find("ImageLibrary").Call("ImportImageList", title, images);
            return true;
        }
        private bool HasImage(string fileName, ulong imageId) {
            return (bool)plugins.Find("ImageLibrary").Call("HasImage", fileName, imageId);
        }
        private void AddImage(string url, string fileName) {
            plugins.Find("ImageLibrary").Call("AddImage", url, fileName, 0);
        }
        private string GetImage(string fileName, ulong skin = 0) {
            var imageId = (string)plugins.Find("ImageLibrary").CallHook("GetImage", fileName, skin);
            if (!string.IsNullOrEmpty(imageId)) return imageId;
            return string.Empty;
        }
#region Msg
        void MessageUI(BasePlayer player, string Messages) {
            CuiElementContainer container = new CuiElementContainer();
            CuiHelper.DestroyUi(player, "TitleMSG");
            container.Add(new CuiPanel {
                FadeOut = 0.5f, RectTransform = {
                    AnchorMin = "0 0.8564815", AnchorMax = "1 0.9120371"
                }
                , Image = {
                    Color = HexToRGB("#FF888867"), FadeIn = 0.5f
                }
            }
            , GUICRAFT, "TitleMSG");
            container.Add(new CuiLabel {
                FadeOut = 0.3f, RectTransform = {
                    AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0"
                }
                , Text = {
                    Text = lang.GetMessage(Messages, this), Font = "robotocondensed-bold.ttf", FontSize = 23, Align = TextAnchor.MiddleCenter, Color = HexToRGB("#FFFFFFFF"), FadeIn = 0.5f
                }
            }
            , "TitleMSG");
            timer.Once(3f, () => {
                CuiHelper.DestroyUi(player, "TitleMSG");
            }
            );
            CuiHelper.AddUi(player, container);
        }
#endregion
        public static StringBuilder sb = new StringBuilder();
        private static string HexToRGB(string hex) {
            Color color;
            ColorUtility.TryParseHtmlString(hex, out color);
            sb.Clear();
            return sb.AppendFormat("{0:F2} {1:F2} {2:F2} {3:F2}", color.r, color.g, color.b, color.a).ToString();
        }
#region lang
        private new void LoadDefaultMessages() {
            lang.RegisterMessages(new Dictionary<string, string> {
                ["NOT_WORKBENCH"]
                = "Poor crafting bench level", ["NOT_ITEMS"] = "Not enough items to craft", ["GOOD_ITEMS"] = "<color=#9FFF8BFF><size=10>Collected</size></color>", ["WORK_NOTLVL"] = "Workbench {0} required", ["WORK_NOT"] = "No workbench", ["ITEM_CRAFT"] = "Craft", ["TITLE_MENU"] = "CRAFT MENU", ["BACK"] = "Back", ["NEXT"] = "Next",
            }
            , this);
            lang.RegisterMessages(new Dictionary<string, string> {
                ["NOT_WORKBENCH"]
                = "Неподходящий уровень верстака для крафта", ["NOT_ITEMS"] = "Недостаточно предметов для крафта", ["GOOD_ITEMS"] = "<color=#9FFF8BFF><size=10>Собрано</size></color>", ["WORK_NOTLVL"] = "Требуется верстак {0} уровня", ["WORK_NOT"] = "Верстак не нужен", ["ITEM_CRAFT"] = "Скрафтить", ["TITLE_MENU"] = "КРАФТ МЕНЮ", ["BACK"] = "Назад", ["NEXT"] = "Вперед",
            }
            , this, "ru");
            PrintWarning("Языковой файл загружен успешно");
        }
#endregion
#endregion
#region Comands
        [ConsoleCommand("CRAFT_items")]
        void consoleCmdNewItems(ConsoleSystem.Arg arg) {
            var player = arg.Connection?.player as BasePlayer;
            if (player == null) return;
            switch (arg.Args[0].ToLower()) {
                case "created" : {
                    int Index = Convert.ToInt32(arg.Args[1]);
                    int page = Convert.ToInt32(arg.Args[2]);
                    if (CheckCraft(player, Index)) {
                        if (player.currentCraftLevel < _config.items[Index].WorkBenchCraft) {
                            MessageUI(player, "NOT_WORKBENCH");
                            return;
                        }
                        CraftItems(player, Index, page);
                    }
                    else {
                        MessageUI(player, "NOT_ITEMS");
                    }
                    break;
                }
                case "pages" : {
                    int pageIndex;
                    if (int.TryParse(arg.Args[1], out pageIndex)) {
                        CuiHelper.DestroyUi(player, "CraftItem");
                        Pages(player, pageIndex);
                    }
                    break;
                }
                case "close" : {
                    if (OpenMenu.Contains(player.userID)) OpenMenu.Remove(player.userID);
                    DestroyGUI(player);
                    break;
                }
            }
        }
        void CraftItems(BasePlayer player, int index, int page) {
            for (int i = 0; i < _config.items[index].craftItems.Count; i++) {
                player.inventory.Take(null, ItemManager.FindItemDefinition(_config.items[index].craftItems[i].shortname).itemid, _config.items[index].craftItems[i].amount);
            }
            var item = CreateItem(index);
            player.GiveItem(item);
            Pages(player, page);
        }
        private Item CreateItem(int index) {
            var item = ItemManager.CreateByName(_config.items[index].shortname, _config.items[index].countCraft, _config.items[index].skinID);
            if (item == null) return null;
            return item;
        }
#endregion
#region GUI
#region Parent
        public static string GUICRAFT = "CRAFT_MENU_MAIN";
        private string IconLayer = "CRAFT_MENU_BUTTON";
        void DestroyGUI(BasePlayer player) {
            CuiHelper.DestroyUi(player, GUICRAFT);
        }
#endregion
        private void InitializeIconButton(BasePlayer player) {
            CuiHelper.DestroyUi(player, IconLayer);
            CuiElementContainer container = new CuiElementContainer();
            container.Add(new CuiElement {
                Parent = "Overlay", Name = IconLayer, Components = {
                    new CuiRawImageComponent {
                        Png = (string) ImageLibrary.Call("GetImage", _config.setings.PngForButton)
                    }
                    , new CuiRectTransformComponent {
                        AnchorMin = "0 1", AnchorMax = "0 1", OffsetMin = _config.setings.Ofssemin, OffsetMax = _config.setings.Ofsetmax
                    }
                }
            }
            );
            container.Add(new CuiButton {
                RectTransform = {
                    AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0"
                }
                , Button = {
                    Color = "0 0 0 0", Command = "chat.say /craft"
                }
                , Text = {
                    Text = ""
                }
            }
            , IconLayer);
            CuiHelper.AddUi(player, container);
        }
        void opencommand(BasePlayer player) {
            if (OpenMenu.Contains(player.userID)) return;
            OpenMenu.Add(player.userID);
            CRAFTGUI(player);
        }
        public void CRAFTGUI(BasePlayer player) {
            CuiHelper.DestroyUi(player, GUICRAFT);
            CuiElementContainer container = new CuiElementContainer();
            container.Add(new CuiPanel {
                CursorEnabled = true, RectTransform = {
                    AnchorMin = "0 0", AnchorMax = "1 1"
                }
                , Image = {
                    Color = "0 0 0 0.5", Material = "assets/content/ui/uibackgroundblur.mat", Sprite = "assets/content/ui/ui.background.transparent.radial.psd"
                }
            }
            , "Overlay", GUICRAFT);
            container.Add(new CuiButton {
                RectTransform = {
                    AnchorMin = "0.8776042 0.9305556", AnchorMax = "0.9947917 0.987037"
                }
                , Button = {
                    Command = "CRAFT_items close", Color = "0 0 0 0"
                }
                , Text = {
                    Text = "Закрыть", Align = TextAnchor.MiddleCenter, FontSize = 18
                }
            }
            , GUICRAFT);
#region Title
            container.Add(new CuiLabel {
                RectTransform = {
                    AnchorMin = "0.2057292 0.9194444", AnchorMax = "0.7796875 0.9879494"
                }
                , Text = {
                    Text = lang.GetMessage("TITLE_MENU", this), FontSize = 26, Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter
                }
            }
            , GUICRAFT);
            container.Add(new CuiPanel {
                Image = {
                    Color = HexToRGB("#616161FF"), Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                }
                , RectTransform = {
                    AnchorMin = "0 0.9166667", AnchorMax = "1 0.9194444"
                }
                ,
            }
            , GUICRAFT);
#endregion
            CuiHelper.AddUi(player, container);
            Pages(player, 0);
        }
        void Pages(BasePlayer player, int page) {
            CuiElementContainer container = new CuiElementContainer();
            CuiHelper.DestroyUi(player, "NextGo");
            CuiHelper.DestroyUi(player, "BackGo");
            CuiHelper.DestroyUi(player, "txttitle");
            CuiHelper.DestroyUi(player, "CraftItem");
            container.Add(new CuiPanel {
                Image = {
                    Color = "0 0 0 0"
                }
                , RectTransform = {
                    AnchorMin = "0.001041699 0.07592595", AnchorMax = "0.9958333 0.9111112"
                }
                ,
            }
            , GUICRAFT, "CraftItem");
            container.Add(new CuiLabel {
                RectTransform = {
                    AnchorMin = "0.31145315 0.002777793", AnchorMax = "0.6739583 0.06574074", OffsetMax = "0 0"
                }
                , Text = {
                    Text = $"СТРАНИЦА {page + 1} / {(_config.items.Count / 9) + 1}", Font = "robotocondensed-bold.ttf", FontSize = 26, Align = TextAnchor.MiddleCenter, Color = HexToRGB("#FFFFFFFF")
                }
            }
            , GUICRAFT, "txttitle");
            int x = 0, y = 0, i = 9 * page;
            foreach (var cfg in _config.items.Skip(page * 9).Take(9)) {
                //var cfg = _config.items[i];
                container.Add(new CuiElement {
                    Parent = "CraftItem", Name = "Items", Components = {
                        new CuiImageComponent {
                            Color = HexToRGB("#5959595E")
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = $"{0.05112157 + (x * 0.314)} {0.6853685 - (y * 0.31)}", AnchorMax = $"{0.3155973 + (x * 0.314)} {0.9284928 - (y * 0.31)}"
                        }
                        ,
                    }
                }
                );
                container.Add(new CuiElement {
                    Parent = "Items", Name = "itemscrafts", Components = {
                        new CuiImageComponent {
                            Color = HexToRGB("#505050FF")
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = "0.02169624 0.6153846", AnchorMax = "0.1696252 0.9547511"
                        }
                        , new CuiOutlineComponent {
                            Distance = "1.5 1.5", Color = HexToRGB("#FFFFFFFF")
                        }
                    }
                }
                );
                container.Add(new CuiElement {
                    Parent = "itemscrafts", Components = {
                        new CuiRawImageComponent {
                            Png = cfg.png == null? GetImage(cfg.shortname + 128, cfg.skinID) : GetImage(cfg.png), Color = HexToRGB("#FFFFFFFF")
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = "0.04000100 0.02666667", AnchorMax = "0.9733336 0.9600003"
                        }
                        ,
                    }
                }
                );
                container.Add(new CuiLabel {
                    RectTransform = {
                        AnchorMin = "0.2011834 0.8461543", AnchorMax = "0.95660325 0.9638013"
                    }
                    , Text = {
                        Text = cfg.name, FontSize = 15, Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleLeft
                    }
                }
                , "Items");
                container.Add(new CuiElement {
                    Parent = "Items", Name = "txtwork", Components = {
                        new CuiImageComponent {
                            Color = HexToRGB(cfg.WorkBenchCraft == 1 ? _config.setings.ColorWork1 : cfg.WorkBenchCraft == 2 ? _config.setings.ColorWork2 : cfg.WorkBenchCraft == 3 ? _config.setings.ColorWork3 : _config.setings.ColorWork)
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = "0.1893423 0.6153846", AnchorMax = "0.9861934 0.8144795"
                        }
                        ,
                    }
                }
                );
                container.Add(new CuiLabel {
                    RectTransform = {
                        AnchorMin = "0 0", AnchorMax = "1 1"
                    }
                    , Text = {
                        Text = cfg.WorkBenchCraft == 0 ? lang.GetMessage("WORK_NOT", this) : String.Format(lang.GetMessage("WORK_NOTLVL", this), cfg.WorkBenchCraft), FontSize = 15, Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter
                    }
                }
                , "txtwork");
                int ItemCount = 0;
                float itemMinPosition = 219f;
                float itemWidth = 0.503646f - 0.351563f;
                float itemMargin = 0.419895f - 0.403646f;
                int itemCount = cfg.craftItems.Count;
                float itemMinHeight = 0.266968f;
                float itemHeight = 0.59276f - 0.265741f;
                if (itemCount > 5) {
                    itemMinPosition = 0.5f - 5 / 2f * itemWidth - (5 - 1) / 2f * itemMargin;
                    itemCount -= 5;
                }
                else itemMinPosition = 0.5f - itemCount / 2f * itemWidth - (itemCount - 1) / 2f * itemMargin;
                for (int j = 0; j < cfg.craftItems.Count; j++) {
                    var has = player.inventory.GetAmount(ItemManager.FindItemDefinition(cfg.craftItems[j].shortname).itemid);
                    var result = cfg.craftItems[j].amount - has <= 0 ? lang.GetMessage("GOOD_ITEMS", this) : $"x{Convert.ToInt32(cfg.craftItems[j].amount - has)}";
                    var coloritem = cfg.craftItems[j].amount - has <= 0 ? "#31973BFF" : "#CF4343FF";
                    container.Add(new CuiPanel {
                        Image = {
                            Color = HexToRGB(coloritem)
                        }
                        , RectTransform = {
                            AnchorMin = $"{itemMinPosition} {itemMinHeight}", AnchorMax = $"{itemMinPosition + itemWidth} {itemMinHeight + itemHeight}"
                        }
                        ,
                    }
                    , "Items", "pngforcraft");
                    container.Add(new CuiElement {
                        Parent = "pngforcraft", Components = {
                            new CuiRawImageComponent {
                                Png = GetImage(cfg.craftItems[j].shortname + 64, 0)
                            }
                            , new CuiRectTransformComponent {
                                AnchorMin = "0.042856315 0.04285758", AnchorMax = "0.9714283 0.971429"
                            }
                            ,
                        }
                    }
                    );
                    container.Add(new CuiLabel {
                        RectTransform = {
                            AnchorMin = "0 0", AnchorMax = "1 1"
                        }
                        , Text = {
                            Text = result, FontSize = 10, Font = "robotocondensed-bold.ttf", Align = TextAnchor.LowerCenter
                        }
                    }
                    , "pngforcraft");
                    ItemCount++;
                    itemMinPosition += (itemWidth + itemMargin);
                    if (ItemCount % 5 == 0) {
                        itemMinHeight -= (itemHeight + (itemMargin * 2f));
                        if (itemCount > 5) {
                            itemMinPosition = 0.5f - 5 / 2f * itemWidth - (5 - 1) / 2f * itemMargin;
                            itemCount -= 5;
                        }
                        else itemMinPosition = 0.5f - itemCount / 2f * itemWidth - (itemCount - 1) / 2f * itemMargin;
                    }
                    if (j > 5) break;
                }
                container.Add(new CuiButton {
                    RectTransform = {
                        AnchorMin = "0.005917087 0.02262436", AnchorMax = "0.9940828 0.2443425"
                    }
                    , Button = {
                        Color = HexToRGB("#007ED0FF"), Command = $"CRAFT_items created {i} {page}"
                    }
                    , Text = {
                        Text = lang.GetMessage("ITEM_CRAFT", this), Align = TextAnchor.MiddleCenter, Font = "robotocondensed-bold.ttf", FontSize = 13
                    }
                }
                , "Items");
                i++;
                x++;
                if (x == 3) {
                    x = 0;
                    y++;
                }
            }
            if (page + 1 < (int)Math.Ceiling((double)_config.items.Count / 9)) {
                container.Add(new CuiButton {
                    RectTransform = {
                        AnchorMin = "0.8859293 0.01851858", AnchorMax = "0.9828002 0.06666667"
                    }
                    , Button = {
                        Command = $"CRAFT_items pages {page + 1}", Color = HexToRGB(_config.setings.ColorButton)
                    }
                    , Text = {
                        Text = lang.GetMessage("NEXT", this), Align = TextAnchor.MiddleCenter, FontSize = 15
                    }
                }
                , GUICRAFT, "NextGo");
            }
            if (page != 0) {
                container.Add(new CuiButton {
                    RectTransform = {
                        AnchorMin = "0.01927082 0.01851858", AnchorMax = "0.1161458 0.06666667"
                    }
                    , Button = {
                        Command = $"CRAFT_items pages {page - 1}", Color = HexToRGB(_config.setings.ColorButton)
                    }
                    , Text = {
                        Text = lang.GetMessage("BACK", this), Align = TextAnchor.MiddleCenter, FontSize = 15
                    }
                }
                , GUICRAFT, "BackGo");
            }
            CuiHelper.AddUi(player, container);
        }
#endregion
    }
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху