예제 #1
0
        /// <summary>
        /// Constructor - creates panel.
        /// </summary>
        internal BOBScalePanel()
        {
            // Default position - centre in screen.
            relativePosition = new Vector2(Mathf.Floor((GetUIView().fixedWidth - width) / 2), Mathf.Floor((GetUIView().fixedHeight - height) / 2));

            // Title label.
            SetTitle(Translations.Translate("BOB_NAM") + " : " + Translations.Translate("BOB_SCA_TIT"));

            // Minimum scale slider.
            minScaleSlider = AddBOBSlider(this, ControlX, MinOffsetY, ControlWidth - (Margin * 2f), "BOB_SCA_MIN", 0.5f, 2f, 0.5f, "MinScale");
            minScaleSlider.eventValueChanged += MinScaleValue;
            minScaleSlider.value              = 1f;
            maxScaleSlider = AddBOBSlider(this, ControlX, MaxOffsetY + 40f, ControlWidth - (Margin * 2f), "BOB_SCA_MAX", 0.5f, 2f, 0.5f, "MaxScale");
            maxScaleSlider.eventValueChanged += MaxScaleValue;
            maxScaleSlider.value              = 1f;

            // Revert button.
            revertButton = UIControls.AddSmallerButton(this, ControlX, RevertY, Translations.Translate("BOB_PNL_REV"), ControlWidth);
            revertButton.eventClicked += Revert;
            revertButton.Disable();

            // Loaded prop list.
            UIPanel loadedPanel = AddUIComponent <UIPanel>();

            loadedPanel.width            = LoadedWidth;
            loadedPanel.height           = ListHeight;
            loadedPanel.relativePosition = new Vector2(LoadedX, ListY);
            loadedList = UIFastList.Create <UILoadedScalingPropRow>(loadedPanel);
            ListSetup(loadedList);

            // Order button.
            loadedNameButton = ArrowButton(this, LoadedX + 10f, ListY - 20f);
            loadedNameButton.eventClicked += SortLoaded;

            loadedCreatorButton = ArrowButton(this, LoadedX + UILoadedScalingPropRow.CreatorX + 10f, ListY - 20f);
            loadedCreatorButton.eventClicked += SortLoaded;

            // Default is name ascending.
            SetFgSprites(loadedNameButton, "IconUpArrow2");

            // Populate loaded list.
            LoadedList();

            // Bring to front.
            BringToFront();
        }