• Хостинг игровых серверов

    Максимальная производительность для ваших игровых серверов!

    Заказать сейчас

Помогите Плагин MultiEvents

DoKZaMmer

22 Окт 2023
243
1
14
23
30
В общем ситуация следующая..
Хочу сменить пространство ГУИ, но не знаю как это сделать, ну точнее по цифрам то я всё разобрался, что куда я хочу перекинуть.
НО вот какой именно инструмент оффсета отвечает за это решение - я не понимаю, там слишком замудрён код по всем этим оффсетам и анчорам, я разобрался только за внутренние настройки оффсета и анчора по разным смещениям верх-вниз, лево-право. А вот, как саму ГУИ панель переместить, верх-них, лево-право - тупо я не понимаю. Я уже перепробовал почти все строчки кода за 2 дня, но вот прям не могу, не знаю... Уже терпение кончается. Скинул строчки кода, помогите кто чем сможет)

Код:
        #endregion

        #region Interface

        private void TopUI(BasePlayer player, string Type, string TopName = "", string description = "",
            string oMin = "", string oMax = "", string color = "", List<KeyValuePair<BasePlayer, float>> list = null)
        {
            var container = new CuiElementContainer();
            var position = 35;

            switch (Type)
            {
                case "all":
                    container.Add(new CuiPanel
                    {
                        CursorEnabled = false,
                        RectTransform = {AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = oMin, OffsetMax = oMax},
                        Image = {Color = color}
                    }, "Hud", Layer);
                    container.Add(new CuiLabel
                    {
                        RectTransform = {AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -25", OffsetMax = "0 -5"},
                        Text = {Text = $"<b>{TopName}</b>", FontSize = 15, Align = TextAnchor.MiddleCenter}
                    }, Layer);
                    container.Add(new CuiPanel
                    {
                        RectTransform =
                            {AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "10 -28", OffsetMax = "-10 -27"},
                        Image = {Color = "1 1 1 1"}
                    }, Layer, Layer + ".Line");

                    container.Add(new CuiLabel
                    {
                        RectTransform =
                            {AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "24 0", OffsetMax = "0 0"},
                        Text =
                        {
                            Text = !string.IsNullOrEmpty(description) ? description : "", FontSize = 16,
                            Align = TextAnchor.MiddleLeft
                        }
                    }, Layer, Layer + ".Text");

                    CuiHelper.DestroyUi(player, Layer);
                    break;
                case "refresh":
                    CuiHelper.DestroyUi(player, Layer + ".Timer");
                    container.Add(new CuiLabel
                    {
                        RectTransform =
                            {AnchorMin = "0 0", AnchorMax = "1 0", OffsetMin = "0 0", OffsetMax = "0 20"},
                        Text =
                        {
                            Text = GetMessage("EVENT.Timer", player.UserIDString, $"{time:0}"), FontSize = 12,
                            Align = TextAnchor.MiddleCenter
                        }
                    }, Layer, Layer + ".Timer");
                    container.Add(new CuiPanel
                    {
                        RectTransform =
                            {AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "10 0", OffsetMax = "-10 1"},
                        Image = {Color = "1 1 1 1"}
                    }, Layer + ".Timer", Layer + ".Timer.Line");

                    if (list != null)
                        for (var i = 0; i < list.Count; i++)
                        {
                            var check = list[i];

                            CuiHelper.DestroyUi(player, Layer + $".TopLabel.{i}");

                            container.Add(new CuiPanel
                            {
                                RectTransform =
                                {
                                    AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = $"20 -{position + 20}",
                                    OffsetMax = $"-20 -{position}"
                                },
                                Image = {Color = "0 0 0 0"}
                            }, Layer, Layer + $".TopLabel.{i}");

                            container.Add(new CuiLabel
                            {
                                RectTransform =
                                    {AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "24 0", OffsetMax = "0 0"},
                                Text =
                                {
                                    Text = $"<b>{GetShortNickname(check.Key)}</b>", FontSize = 16,
                                    Align = TextAnchor.MiddleLeft
                                }
                            }, Layer + $".TopLabel.{i}", Layer + $".TopLabel.{i}.Text");

                            container.Add(new CuiElement
                            {
                                Name = Layer + $".TopLabel.{i}.Avatar",
                                Parent = Layer + $".TopLabel.{i}",
                                Components =
                                {
                                    new CuiRawImageComponent
                                    {
                                        Png = ImageLibrary.Call<string>("GetImage", $"avatar_{check.Key.UserIDString}")
                                    },
                                    new CuiRectTransformComponent
                                        {AnchorMin = "0 0", AnchorMax = "0 1", OffsetMax = "20 0"}
                                }
                            });
                            container.Add(new CuiLabel
                            {
                                RectTransform = {AnchorMin = "0 0", AnchorMax = "1 1"},
                                Text =
                                {
                                    Text = nowEvent == "KingMountain" ? $"{check.Value:0} м" :
                                        nowEvent == "CollectionResources" ? $"{check.Value} шт" : $"{check.Value}",
                                    FontSize = 16, Align = TextAnchor.MiddleRight
                                }
                            }, Layer + $".TopLabel.{i}", Layer + $".TopLabel.{i}.Height");
                            position += 30;
                        }

                    break;
                case "FoundationDrop_Timer":
                    CuiHelper.DestroyUi(player, Layer + ".Timer");
                    container.Add(new CuiLabel
                    {
                        RectTransform =
                            {AnchorMin = "0 0", AnchorMax = "1 0", OffsetMin = "0 0", OffsetMax = "0 20"},
                        Text =
                        {
                            Text = GetMessage("FOUNDROP.WaitTime", player.UserIDString, $"{time:0}"), FontSize = 12,
                            Align = TextAnchor.MiddleCenter
                        }
                    }, Layer, Layer + ".Timer");
                    container.Add(new CuiPanel
                    {
                        RectTransform =
                            {AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "10 0", OffsetMax = "-10 1"},
                        Image = {Color = "1 1 1 1"}
                    }, Layer + ".Timer", Layer + ".Timer.Line");
                    container.Add(new CuiPanel
                    {
                        RectTransform =
                            {AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "10 0", OffsetMax = "-10 1"},
                        Image = {Color = "1 1 1 1"}
                    }, Layer + ".Timer", Layer + ".Timer.Line");
                    break;
                case "FoundationDrop.Upd":
                    CuiHelper.DestroyUi(player, Layer + ".Text");
                    container.Add(new CuiLabel
                    {
                        RectTransform =
                            {AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "10 0", OffsetMax = "-10 -40"},
                        Text =
                        {
                            Text = GetMessage("FOUNDROP.BlockAndPlayers", player.UserIDString,
                                cEvent.BlockList.Count.ToString(), cEvent.PlayerConnected.Count.ToString()),
                            FontSize = 18, Align = TextAnchor.UpperLeft
                        }
                    }, Layer, Layer + ".Text");
                    break;
                case "SpecialCargo":
                    CuiHelper.DestroyUi(player, Layer + ".SpecialCargo");
                    container.Add(new CuiPanel
                    {
                        CursorEnabled = false,
                        RectTransform =
                            {AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-225 -45", OffsetMax = "-5 -5"},
                        Image = {Color = "0.024 0.016 0.17 0.7"}
                    }, "Hud", Layer + ".SpecialCargo");
                    container.Add(new CuiLabel
                    {
                        RectTransform = {AnchorMin = "0 0", AnchorMax = "1 1"},
                        Text =
                        {
                            Text = GetMessage("SpecialCargo.Purpose", player.UserIDString,
                                end_mission.displayPhrase.translated,
                                GetGridString(end_mission.transform.position)),
                            FontSize = 15, Align = TextAnchor.MiddleCenter
                        }
                    }, Layer + ".SpecialCargo");
                    break;
            }

            CuiHelper.AddUi(player, container);
        }

        private static void UI_Notification(BasePlayer player, string message, string Name = ".Notification",
            string color = "0.98 0.37 0.41 0.69")
        {
            CuiHelper.DestroyUi(player, Layer + Name);
            CuiHelper.AddUi(player, new CuiElementContainer
            {
                {
                    new CuiButton
                    {
                        RectTransform =
                            {AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -100", OffsetMax = "0 -50"},
                        Button = {Color = color},
                        Text =
                        {
                            FadeIn = 1f, Color = "1 1 1 1", FontSize = 18, Align = TextAnchor.MiddleCenter,
                            Text = $"{message}"
                        }
                    },
                    "Overlay",
                    Layer + Name
                }
            });
        }

        private void Help_UI(BasePlayer player, int page)
        {
            var container = new CuiElementContainer();
            if (_config.EnabledEvents.Count <= page || page < 0)
                page = 0;
            var list = _config.EnabledEvents[page];
            container.Add(new CuiPanel
            {
                CursorEnabled = true,
                RectTransform =
                    {AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-450 -255", OffsetMax = "450 255"},
                Image = {Color = "0.024 0.017 0.17 0.76"}
            }, "Overlay", Layer + ".Help");
            container.Add(new CuiButton
            {
                RectTransform = {AnchorMin = "10 10", AnchorMax = "-10 -10"},
                Text = {Text = ""},
                Button = {Color = "0 0 0 0", Close = Layer + ".Help"}
            }, Layer + ".Help");
            container.Add(new CuiButton
            {
                RectTransform = {AnchorMin = "0 0", AnchorMax = "0 0", OffsetMin = "40 10", OffsetMax = "120 35"},
                Button = {Color = "0 0 0 0", Command = $"UI_Event page {page - 1}"},
                Text =
                {
                    Text = GetMessage("UI.Back", player.UserIDString), FontSize = 20, Align = TextAnchor.LowerLeft,
                    Font = "robotocondensed-bold.ttf"
                }
            }, Layer + ".Help", Layer + ".Help.Pages.Back");
            container.Add(new CuiButton
            {
                RectTransform = {AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-120 10", OffsetMax = "-40 35"},
                Button = {Color = "0 0 0 0", Command = $"UI_Event page {page + 1}"},
                Text =
                {
                    Text = GetMessage("UI.Next", player.UserIDString), FontSize = 20, Align = TextAnchor.LowerRight,
                    Font = "robotocondensed-bold.ttf"
                }
            }, Layer + ".Help", Layer + ".Help.Pages.Next");
            container.Add(new CuiLabel
            {
                RectTransform = {AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "40 -65", OffsetMax = "-40 0"},
                Text =
                {
                    Text = GetMessage("UI.Name", player.UserIDString), FontSize = 38,
                    Align = TextAnchor.MiddleCenter
                }
            }, Layer + ".Help", Layer + ".Help.Logo");
            container.Add(new CuiPanel
            {
                RectTransform = {AnchorMin = "0 0", AnchorMax = "1 0", OffsetMax = "0 1"},
                Image = {Color = "1 1 1 1"}
            }, Layer + ".Help.Logo", Layer + ".Help.Logo.Line");
            container.Add(new CuiElement
            {
                Name = Layer + ".Help.Logo.Image",
                Parent = Layer + ".Help.Logo",
                Components =
                {
                    new CuiImageComponent {Png = (string) ImageLibrary.Call("GetImage", "ME_Logo_image")},
                    new CuiRectTransformComponent
                        {AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-142 -26", OffsetMax = "-90 26"}
                }
            });
            container.Add(new CuiElement
            {
                Name = Layer + ".Help.Event",
                Parent = Layer + ".Help",
                Components =
                {
                    new CuiImageComponent {Png = (string) ImageLibrary.Call("GetImage", "ME_Background_image")},
                    new CuiRectTransformComponent
                        {AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-328 -110", OffsetMax = "-90 140"}
                }
            });
            container.Add(new CuiLabel
            {
                RectTransform = {AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 -186"},
                Text =
                {
                    Text = GetMessage("UI." + list, player.UserIDString), Color = "0 0 0 1", FontSize = 26,
                    Align = TextAnchor.MiddleCenter
                }
            }, Layer + ".Help.Event", Layer + ".Help.Event.Name");
            container.Add(new CuiElement
            {
                Name = Layer + ".Help.Event.Image",
                Parent = Layer + ".Help.Event",
                Components =
                {
                    new CuiRawImageComponent {Png = (string) ImageLibrary.Call("GetImage", list)},
                    new CuiRectTransformComponent
                        {AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "13 63", OffsetMax = "-13 -15"}
                }
            });
            container.Add(new CuiLabel
            {
                RectTransform =
                    {AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-45 -200", OffsetMax = "370 170"},
                Text =
                {
                    Text = GetMessage("UI.Description." + list, player.UserIDString), FontSize = 22,
                    Align = TextAnchor.UpperLeft
                }
            }, Layer + ".Help", Layer + ".Help.Logo");

            container.Add(new CuiButton
            {
                RectTransform =
                    {AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-50 10", OffsetMax = "50 35"},
                Button = {Color = "0 0 0 0", Command = "UI_Event storage"},
                Text =
                {
                    Text = GetMessage("UI.Storage", player.UserIDString), FontSize = 20,
                    Align = TextAnchor.LowerCenter, Color = "0.48 0.41 0.9 1", Font = "robotocondensed-bold.ttf"
                }
            }, Layer + ".Help", Layer + ".Help.Cmd.Storage");

            if (player.IsAdmin || permission.UserHasPermission(player.UserIDString, _config.perm_admin))
            {
                container.Add(new CuiButton
                {
                    RectTransform =
                        {AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-50 -25", OffsetMax = "50 0"},
                    Button = {Color = "0 0 0 0", Command = "event start"},
                    Text =
                    {
                        Text = GetMessage("UI.Random", player.UserIDString), FontSize = 20,
                        Align = TextAnchor.LowerCenter, Color = "0.48 0.41 0.9 1", Font = "robotocondensed-bold.ttf"
                    }
                }, Layer + ".Help", Layer + ".Help.Cmd.Random");
                container.Add(new CuiButton
                {
                    RectTransform =
                        {AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-170 -25", OffsetMax = "-60 0"},
                    Button = {Color = "0 0 0 0", Command = "event cancel"},
                    Text =
                    {
                        Text = GetMessage("UI.Cancel", player.UserIDString), FontSize = 16,
                        Align = TextAnchor.LowerCenter, Color = "1 0.01 0.24 1", Font = "robotocondensed-bold.ttf"
                    }
                }, Layer + ".Help", Layer + ".Help.Cmd.Cancel");
                container.Add(new CuiButton
                {
                    RectTransform =
                        {AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "60 -25", OffsetMax = "170 0"},
                    Button = {Color = "0 0 0 0", Command = $"event start {list}"},
                    Text =
                    {
                        Text = GetMessage("UI.Start", player.UserIDString), FontSize = 16,
                        Align = TextAnchor.LowerCenter, Color = "0 0.6 0 1", Font = "robotocondensed-bold.ttf"
                    }
                }, Layer + ".Help", Layer + ".Help.Cmd.Start");
            }

            CuiHelper.DestroyUi(player, Layer + ".Help");
            CuiHelper.AddUi(player, container);
        }

        private const string storageLayer = Layer + ".Storage";

        private void StorageUI(BasePlayer player, int page = 0)
        {
            var userData = GetUserData(player.userID);
            if (userData == null) return;

            var container = new CuiElementContainer();

            container.Add(new CuiPanel
            {
                CursorEnabled = true,
                RectTransform =
                    {AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-450 -255", OffsetMax = "450 255"},
                Image = {Color = "0.024 0.017 0.17 0.76"}
            }, "Overlay", storageLayer);
            container.Add(new CuiButton
            {
                RectTransform = {AnchorMin = "10 10", AnchorMax = "-10 -10"},
                Text = {Text = ""},
                Button = {Color = "0 0 0 0", Close = storageLayer}
            }, storageLayer);

            container.Add(new CuiLabel
            {
                RectTransform = {AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "40 -65", OffsetMax = "-40 0"},
                Text =
                {
                    Text = GetMessage("UI.Storage", player.UserIDString), FontSize = 38,
                    Align = TextAnchor.MiddleCenter
                }
            }, storageLayer, storageLayer + ".Logo");

            container.Add(new CuiPanel
            {
                RectTransform = {AnchorMin = "0 0", AnchorMax = "1 0", OffsetMax = "0 1"},
                Image = {Color = "1 1 1 1"}
            }, storageLayer + ".Logo", storageLayer + ".Logo.Line");
            container.Add(new CuiElement
            {
                Name = storageLayer + ".Logo.Image",
                Parent = storageLayer + ".Logo",
                Components =
                {
                    new CuiImageComponent {Png = ImageLibrary.Call<string>("GetImage", "ME_Logo_image")},
                    new CuiRectTransformComponent
                        {AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-142 -26", OffsetMax = "-90 26"}
                }
            });

            if (userData.Count > 0)
            {
                var items = userData.Skip(page * 32).Take(32).ToList();

                var tempList = items.Take(8).ToList();
                var ySwitch = 180;
                var xSwitch = -((10 * (tempList.Count - 1) + 90 * tempList.Count) / 2);
                for (var i = 0; i < items.Count; i++)
                {
                    var item = items[i];
                    if (item == null) continue;

                    container.Add(new CuiPanel
                    {
                        RectTransform =
                        {
                            AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = $"{xSwitch} {ySwitch - 90}",
                            OffsetMax = $"{xSwitch + 90} {ySwitch}"
                        },
                        Image = {Color = "0.64 0.62 1 0.3"}
                    }, storageLayer, storageLayer + $".Item.{i}");

                    container.Add(new CuiElement
                    {
                        Parent = storageLayer + $".Item.{i}",
                        Components =
                        {
                            new CuiRawImageComponent
                            {
                                Png = ImageLibrary.Call<string>("GetImage",
                                    !string.IsNullOrEmpty(item.ImageURL) ? item.ImageURL : item.item.ShortName)
                            },
                            new CuiRectTransformComponent {AnchorMin = "0 0", AnchorMax = "1 1"}
                        }
                    });

                    container.Add(new CuiButton
                    {
                        RectTransform = {AnchorMin = "0 0", AnchorMax = "1 1"},
                        Text = {Text = ""},
                        Button =
                        {
                            Command = $"UI_Event openmodal {page} {userData.IndexOf(item)}", Color = "0 0 0 0"
                        }
                    }, storageLayer + $".Item.{i}");

                    xSwitch += 100;

                    if ((i + 1) % 8 == 0)
                    {
                        ySwitch -= 100;
                        tempList = items.Skip(8).Take(8).ToList();
                        xSwitch = -((10 * (tempList.Count - 1) + 90 * tempList.Count) / 2);
                    }
                }

                container.Add(new CuiButton
                {
                    RectTransform = {AnchorMin = "0 0", AnchorMax = "0 0", OffsetMin = "40 10", OffsetMax = "120 35"},
                    Button = {Color = "0 0 0 0", Command = page - 1 >= 0 ? $"UI_Event modalpage {page - 1}" : ""},
                    Text =
                    {
                        Text = GetMessage("UI.Back", player.UserIDString), FontSize = 20, Align = TextAnchor.LowerLeft,
                        Font = "robotocondensed-bold.ttf"
                    }
                }, storageLayer);
                container.Add(new CuiButton
                {
                    RectTransform = {AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-120 10", OffsetMax = "-40 35"},
                    Button =
                    {
                        Color = "0 0 0 0",
                        Command = userData.Count > (page + 1) * 32 ? $"UI_Event modalpage {page + 1}" : ""
                    },
                    Text =
                    {
                        Text = GetMessage("UI.Next", player.UserIDString), FontSize = 20, Align = TextAnchor.LowerRight,
                        Font = "robotocondensed-bold.ttf"
                    }
                }, storageLayer);
            }
            else
            {
                container.Add(new CuiLabel
                {
                    RectTransform = {AnchorMin = "0 0", AnchorMax = "1 1"},
                    Text =
                    {
                        Text = GetMessage("UI.StorageEmpty", player.UserIDString), FontSize = 38,
                        Align = TextAnchor.MiddleCenter, Font = "robotocondensed-bold.ttf"
                    }
                }, storageLayer);
            }

            CuiHelper.DestroyUi(player, storageLayer);
            CuiHelper.AddUi(player, container);
        }

        private const string modalLayer = Layer + ".Modal.Give";

        private void ModalGiveUI(BasePlayer player, int page, int itemid)
        {
            if (player == null) return;

            var data = GetUserData(player.userID);
            if (data == null || itemid < 0 || data.Count <= itemid) return;
            var item = data[itemid];
            if (item == null) return;

            var container = new CuiElementContainer();

            container.Add(new CuiButton
            {
                RectTransform = {AnchorMin = "0 0", AnchorMax = "1 1"},
                Button = {Close = modalLayer, Color = "0 0 0 0.95"},
                Text = {Text = ""}
            }, "Overlay", modalLayer);

            container.Add(new CuiPanel
            {
                RectTransform =
                    {AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-150 -200", OffsetMax = "150 200"},
                Image = {Color = "0.71 0.69 1 0.3"}
            }, modalLayer, modalLayer + ".Main");

            container.Add(new CuiElement
            {
                Parent = modalLayer + ".Main",
                Components =
                {
                    new CuiRawImageComponent
                    {
                        Png = ImageLibrary.Call<string>("GetImage",
                            !string.IsNullOrEmpty(item.ImageURL) ? item.ImageURL : item.item.ShortName)
                    },
                    new CuiRectTransformComponent
                        {AnchorMin = "0.5 0.75", AnchorMax = "0.5 0.75", OffsetMin = "-64 -64", OffsetMax = "64 64"}
                }
            });

            var itemInfo = !string.IsNullOrEmpty(item.DisplayName)
                ? item.DisplayName
                : ItemManager.FindItemDefinition(item.item.ShortName)?.displayName.translated ?? "";

            container.Add(new CuiLabel
            {
                RectTransform = {AnchorMin = "0.1 0", AnchorMax = "1 0.45"},
                Text =
                {
                    Text = GetMessage("MODAL.ItemInfo", player.UserIDString, itemInfo, item.Amount),
                    Align = TextAnchor.UpperLeft, FontSize = 18, Color = "1 1 1 1",
                    Font = "robotocondensed-bold.ttf"
                }
            }, modalLayer + ".Main");

            container.Add(new CuiButton
            {
                RectTransform =
                    {AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-100 20", OffsetMax = "100 70"},
                Button = {Command = $"UI_Event giveitem {page} {itemid}", Color = "1 1 1 0.3"},
                Text =
                {
                    Text = GetMessage("MODAL.Give", player.UserIDString), Align = TextAnchor.MiddleCenter,
                    FontSize = 18, Color = "1 1 1 1", Font = "robotocondensed-bold.ttf"
                }
            }, modalLayer + ".Main");

            CuiHelper.DestroyUi(player, modalLayer);
            CuiHelper.AddUi(player, container);
        }

        #endregion

        #region Commands

Больше всего меня смущаю эти две строчки кода.

Первый.

Код:
            if (userData.Count > 0)
            {
                var items = userData.Skip(page * 32).Take(32).ToList();

                var tempList = items.Take(8).ToList();
                var ySwitch = 180;
                var xSwitch = -((10 * (tempList.Count - 1) + 90 * tempList.Count) / 2);
                for (var i = 0; i < items.Count; i++)
                {
                    var item = items[i];
                    if (item == null) continue;

                    container.Add(new CuiPanel
                    {
                        RectTransform =
                        {
                            AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = $"{xSwitch} {ySwitch - 90}",
                            OffsetMax = $"{xSwitch + 90} {ySwitch}"
                        },
                        Image = {Color = "0.64 0.62 1 0.3"}
                    }, storageLayer, storageLayer + $".Item.{i}");

                    container.Add(new CuiElement
                    {
                        Parent = storageLayer + $".Item.{i}",
                        Components =
                        {
                            new CuiRawImageComponent
                            {
                                Png = ImageLibrary.Call<string>("GetImage",
                                    !string.IsNullOrEmpty(item.ImageURL) ? item.ImageURL : item.item.ShortName)
                            },
                            new CuiRectTransformComponent {AnchorMin = "0 0", AnchorMax = "1 1"}
                        }
                    });
Второй
Код:
            });
            container.Add(new CuiElement
            {
                Name = Layer + ".Help.Event",
                Parent = Layer + ".Help",
                Components =
                {
                    new CuiImageComponent {Png = (string) ImageLibrary.Call("GetImage", "ME_Background_image")},
                    new CuiRectTransformComponent
                        {AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-328 -110", OffsetMax = "-90 140"}
                }

По первому: мне не понятно, как и что он берёт в расчёт, т.к значения я менял, у меня не чего визуально не меняло.
Но судя по всем моим догадкам, я чувствую что это именно то, что нужно мне, НО я не знаю как математически и синтаксически записать его в код правильно.

По второму: Это, как я разобрался ЗАДНИЙ фон, но при его изменении он только сужает текст и внутреннее своё оформление.
Подскажите или направьте меня пожалуйста.
 
Активность
Пока никто не печатает сообщение