/// <summary> /// Sets position, size, ect. of all objects depending on the mode the extended panel is in. /// </summary> /// <param name="mode">The extended panel mode</param> public void setMode(Mode mode) { cs = cs.getComponentSettings(mode, Parent.isLeft); foreach (UIPanel panel in sliders) { UIComponent slider = panel.Find("Slider"); UILabel total = panel.Find<UILabel>("Total"); UILabel percentage = panel.Find<UILabel>("Percentage"); UIComponent icon = panel.Find("Icon"); UIButton buttonPlus = panel.Find<UIButton>("Budget Plus One Button"); UIButton buttonMinus = panel.Find<UIButton>("Budget Minus One Button"); panel.width = cs.panelWidth; slider.size = new Vector2(210,slider.height); slider.relativePosition = new Vector3(cs.sliderX, slider.relativePosition.y); slider.isVisible = cs.sliderIsVisible; total.relativePosition = new Vector3(cs.totalX, cs.totalY); total.size = new Vector2(cs.totalWidth, cs.totalHeight); total.isVisible = cs.totalIsVisible; percentage.relativePosition = new Vector3(cs.percentageX, cs.percentageY); percentage.size = new Vector2(cs.percentageWidth, cs.percentageHeight); percentage.isVisible = cs.percentageIsVisible; icon.relativePosition = new Vector3(cs.iconX, icon.relativePosition.y); buttonPlus.relativePosition = new Vector3(cs.buttonPlusX, cs.buttonPlusY); buttonPlus.isVisible = cs.buttonPlusIsVisible; buttonMinus.relativePosition = new Vector3(cs.buttonMinusX, cs.buttonMinusY); buttonMinus.isVisible = cs.buttonMinusIsVisible; } autoLayoutPadding = new RectOffset(cs.autolayoutpadding[0], cs.autolayoutpadding[1], cs.autolayoutpadding[2], cs.autolayoutpadding[3]); if (mode == Mode.Slim) { for (int i = 0; i < slimCloseTimer.Count; i++) { slimCloseTimer[i] = -1; } if (Parent.isLeft) { autoLayoutStart = LayoutStart.BottomRight; } } else { autoLayoutStart = LayoutStart.TopLeft; } }
/// <summary> /// Creates all objects. Call first. /// </summary> public void start() { sliders = new List<UIPanel>(); slimCloseTimer = new List<int>(); cs = new ComponentSettings(); name = "Slider Container"; autoLayout = true; autoLayoutDirection = LayoutDirection.Vertical; autoLayoutStart = LayoutStart.TopLeft; autoLayoutPadding = new RectOffset(14, 0, 0, 5); autoFitChildrenHorizontally = true; autoFitChildrenVertically = true; }