Exemplo n.º 1
0
        private void DrawControlElements()
        {
            LabelCenter(left, locale["sets"], true);
            Label(left, locale["name"], false);
            left.MoveOffsetX(Style.LabelOffset);
            newSetName = TextField(left, newSetName, string.Empty, 0f, true);
            left.ResetX();
            left.BeginHorizontal(2);
            if (Button(left, locale["btnAdd"], false))
            {
                SkinPreset add = null;
                if (pageSelection == Humans)
                {
                    add = new HumanSkinPreset(newSetName);
                }
                else if (pageSelection == Titans)
                {
                    add = new TitanSkinPreset(newSetName);
                }
                else if (pageSelection == City)
                {
                    add = new CityPreset(newSetName);
                }
                else if (pageSelection == Forest)
                {
                    add = new ForestPreset(newSetName);
                }
                else if (pageSelection == Skyboxes)
                {
                    add = new SkyboxPreset(newSetName);
                }
                else if (pageSelection == Custom)
                {
                    add = new CustomMapPreset(newSetName);
                }
                if (add != null)
                {
                    presets.Add(add);
                    skinSelection = presets.Count - 1;
                    newSetName    = locale["set"] + " " + (presets.Count + 1).ToString();
                    presetLabels  = new string[presets.Count];
                    for (int i = 0; i < presetLabels.Length; i++)
                    {
                        presetLabels[i] = presets[i].Name;
                    }
                }
            }
            left.MoveX();
            if (Button(left, locale["btnDelete"], true))
            {
                if (skinSelection >= 0)
                {
                    presets[skinSelection].Delete();
                    presets.RemoveAt(skinSelection);
                }
                skinSelection = presets.Count > 0 ? presets.Count - 1 : -1;
                presetLabels  = new string[presets.Count];
                for (int i = 0; i < presetLabels.Length; i++)
                {
                    presetLabels[i] = presets[i].Name;
                }
            }
            left.ResetX();

            scrollArea.y = left.y;
            left.MoveToEndY(BoxPosition, Style.Height + Style.VerticalMargin);
            scrollArea.height = left.y - scrollArea.y;
            scrollRect.Reset();
            scrollAreaView.height = (Style.Height * presetLabels.Length) + (Style.VerticalMargin * (presetLabels.Length + 1));


            scroll        = BeginScrollView(scrollArea, scroll, scrollAreaView);
            skinSelection = SelectionGrid(scrollRect, skinSelection, presetLabels, 1, true);
            EndScrollView();
        }
Exemplo n.º 2
0
 private void CustomPageEnable()
 {
     InitPresets(SkinSettings.CustomMapSet, CustomMapPreset.GetAllPresets());
 }