Exemplo n.º 1
0
 private void ValidateGrid()
 {
     if (_GridPoints.Items.Count != _Path.Keys.Length)
     {
         for (int i = 0; i < Mathf.Min(_GridPoints.Items.Count, _Path.Keys.Length); i++)
         {
             _GridPoints.Items[i].Content.text = i.ToString();
         }
         if (_GridPoints.Items.Count > _Path.Keys.Length)
         {
             while (_GridPoints.Items.Count > _Path.Keys.Length)
             {
                 _GridPoints.Items.Remove(_GridPoints.Items[_GridPoints.Items.Count - 1]);
             }
         }
         else if (_Path.Keys.Length > _GridPoints.Items.Count)
         {
             for (int i = _GridPoints.Items.Count; i < _Path.Keys.Length; i++)
             {
                 Skill.Framework.UI.SelectionGridItem item = new Skill.Framework.UI.SelectionGridItem();
                 item.Content.text = i.ToString();
                 _GridPoints.Items.Add(item);
             }
         }
         ValidateGridPointsSize();
     }
 }
Exemplo n.º 2
0
        public TextureBrushGrid(int brushSize = 64)
        {
            LoadBrushes(brushSize);
            _BrushBg = new Skill.Framework.UI.Box()
            {
                Row = 0, Column = 0
            };
            _BrushSelectionGrid = new Skill.Framework.UI.SelectionGrid()
            {
                Row = 0, Column = 0, XCount = 10
            };
            for (int i = 0; i < _Brushes.Length; i++)
            {
                Skill.Framework.UI.SelectionGridItem item = new Skill.Framework.UI.SelectionGridItem();
                item.Name          = _Brushes[i].Brush.name;
                item.Content.image = _Brushes[i].Brush;
                _BrushSelectionGrid.Items.Add(item);
            }

            this.Controls.Add(_BrushBg);
            this.Controls.Add(_BrushSelectionGrid);

            _TryToLoadStyle = false;
        }