Example #1
0
 /// <summary>
 /// returns the Height and Width of the UIComponent given as parameter as a Point.
 /// </summary>
 /// <param name="component">The UIComponent that call the function</param>
 /// <returns></returns>
 public Point ToPoint(UIComponent component)
 {
     return(new Point(Width(component), Height(component)));
 }
Example #2
0
 /// <summary>
 /// returns the Height and Width of the UIComponent given as parameter as a Vector2.
 /// </summary>
 /// <param name="component">The UIComponent that call the function</param>
 /// <returns></returns>
 public Vector2 ToVector2(UIComponent component)
 {
     return(new Vector2(Width(component), Height(component)));
 }
Example #3
0
 /// <summary>
 /// returns the Width of the UIComponent given as parameter.
 /// </summary>
 /// <param name="component">The UIComponent that call the function</param>
 /// <returns></returns>
 public abstract int Width(UIComponent component);
Example #4
0
 /// <summary>
 /// returns the Height of the UIComponent given as parameter.
 /// </summary>
 /// <param name="component">The UIComponent that call the function</param>
 /// <returns></returns>
 public abstract int Height(UIComponent component);
Example #5
0
 /// <summary>
 /// Method called when an object in the tilesList is selected. For now, only buttons can be clicked.
 /// </summary>
 /// <param name="o">The button that was clicked</param>
 private void OnItemSelect(UIComponent o)
 {
     ((Button)tilesList.Children[selectedTileIndex]).Selected = false;
     selectedTileIndex = tilesList.Children.IndexOf(o);
     ((Button)tilesList.Children[selectedTileIndex]).Selected = true;
 }
Example #6
0
 private void SaveLevel(UIComponent o)
 {
     FileIO.Save(level.Tiles);
 }
Example #7
0
        /// <summary>
        /// Creates a setting box, for selecting a setting from a set of options
        /// </summary>
        /// <param name="title">The title that should be displayed</param>
        /// <param name="options">The options to choose from</param>
        /// <param name="selected">The index that should be selected by default</param>
        /// <param name="settingBox">The setting box</param>
        /// <returns>The radio group of the items</returns>
        private List <RadioButton> InitSettingBox(string title, Dictionary <int, string> options, int selected, out UIComponent settingBox)
        {
            settingBox = new UIComponent(SimpleLocation.Zero, WrapperDimensions.All);
            List <RadioButton> settingRadioGroup = new List <RadioButton>();

            Textbox titleText = new Textbox(SimpleLocation.Zero, null, title, textColor: Color.Black);

            settingBox.AddChild(titleText);

            for (int i = 0; i < PlayerTypes.Count; i++)
            {
                RadioButton radioButton = new RadioButton(new RelativeToLocation(((i == 0) ? titleText : (UIComponent)settingRadioGroup[i - 1]), (i == 0) ? settingsDistance : 0, settingsDistance, relativeToTop: false), options[i], settingRadioGroup);
                if (i == selected)
                {
                    radioButton.Selected = true;
                }
                settingBox.AddChild(radioButton);
            }

            levelSettings.AddChild(settingBox);
            return(settingRadioGroup);
        }
Example #8
0
 public override int Y(UIComponent component)
 {
     return(relativeY);
 }
Example #9
0
 public override int X(UIComponent component)
 {
     return(relativeX);
 }