Esempio n. 1
0
        private void CreateMenuContents(BasePlayer player, int page = 0)
        {
            var   MenuElement = PCUI.CreateElementContainer(UIPanel, "0 0 0 0", "0 0", "1 1");
            var   elements    = configData.ChallengeSettings.Where(x => x.Value.Enabled).OrderByDescending(x => x.Value.UIPosition).Reverse().ToArray();
            int   count       = page * 5;
            int   number      = 0;
            float dimension   = 0.19f;

            for (int i = count; i < count + 5; i++)
            {
                if (elements.Length < i + 1)
                {
                    continue;
                }
                float leftPos = 0.005f + (number * (dimension + 0.01f));
                AddMenuStats(ref MenuElement, UIPanel, elements[i].Key, leftPos, 0.01f, leftPos + dimension, 0.92f);
                number++;
            }

            if (page > 0)
            {
                PCUI.CreateButton(ref MenuElement, UIPanel, UIColors["buttonbg"], "Previous", 16, "0.63 0.94", "0.73 0.98", $"PCUI_ChangePage {page - 1}");
            }
            if (page < 3 && elements.Length > count + 5)
            {
                PCUI.CreateButton(ref MenuElement, UIPanel, UIColors["buttonbg"], "Next", 16, "0.74 0.94", "0.84 0.98", $"PCUI_ChangePage {page + 1}");
            }
            PCUI.CreateButton(ref MenuElement, UIPanel, UIColors["buttonbg"], "Close", 16, "0.85 0.94", "0.95 0.98", "PCUI_DestroyAll");
            CuiHelper.AddUi(player, MenuElement);
        }
Esempio n. 2
0
        private void CreateMenuContents(BasePlayer player, int page = 0)
        {
            var MenuElement = PCUI.CreateElementContainer(UIPanel, "0 0 0 0", "0 0", "1 1");

            switch (page)
            {
            case 0:
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[0], "0.005 0.01", "0.195 0.92", "0.01 0.01", "0.19 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[1], "0.205 0.01", "0.395 0.92", "0.21 0.01", "0.39 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[2], "0.405 0.01", "0.595 0.92", "0.41 0.01", "0.59 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[3], "0.605 0.01", "0.795 0.92", "0.61 0.01", "0.79 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[4], "0.805 0.01", "0.995 0.92", "0.81 0.01", "0.99 0.91");
                break;

            case 1:
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[5], "0.005 0.01", "0.195 0.92", "0.01 0.01", "0.19 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[6], "0.205 0.01", "0.395 0.92", "0.21 0.01", "0.39 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[7], "0.405 0.01", "0.595 0.92", "0.41 0.01", "0.59 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[8], "0.605 0.01", "0.795 0.92", "0.61 0.01", "0.79 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[9], "0.805 0.01", "0.995 0.92", "0.81 0.01", "0.99 0.91");
                break;

            case 2:
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[10], "0.005 0.01", "0.195 0.92", "0.01 0.01", "0.19 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[11], "0.205 0.01", "0.395 0.92", "0.21 0.01", "0.39 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[12], "0.405 0.01", "0.595 0.92", "0.41 0.01", "0.59 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[13], "0.605 0.01", "0.795 0.92", "0.61 0.01", "0.79 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[14], "0.805 0.01", "0.995 0.92", "0.81 0.01", "0.99 0.91");
                break;

            case 3:
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[15], "0.005 0.01", "0.195 0.92", "0.01 0.01", "0.19 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[16], "0.205 0.01", "0.395 0.92", "0.21 0.01", "0.39 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[17], "0.405 0.01", "0.595 0.92", "0.41 0.01", "0.59 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[18], "0.605 0.01", "0.795 0.92", "0.61 0.01", "0.79 0.91");
                AddMenuStats(ref MenuElement, UIPanel, configData.UI_Arrangement[19], "0.805 0.01", "0.995 0.92", "0.81 0.01", "0.99 0.91");
                break;

            default:
                break;
            }

            if (page > 0)
            {
                PCUI.CreateButton(ref MenuElement, UIPanel, UIColors["buttonbg"], "Previous", 16, "0.63 0.94", "0.73 0.98", $"PCUI_ChangePage {page - 1}");
            }
            if (page < 3)
            {
                PCUI.CreateButton(ref MenuElement, UIPanel, UIColors["buttonbg"], "Next", 16, "0.74 0.94", "0.84 0.98", $"PCUI_ChangePage {page + 1}");
            }
            PCUI.CreateButton(ref MenuElement, UIPanel, UIColors["buttonbg"], "Close", 16, "0.85 0.94", "0.95 0.98", "PCUI_DestroyAll");
            CuiHelper.AddUi(player, MenuElement);
        }