} // end of DecrementFocus() protected override void UpdateIndex() { // Handy references. Boku.InGame inGame = Boku.InGame.inGame; Boku.InGame.Shared shared = inGame.shared; UIGrid2DBrushElement e = (UIGrid2DBrushElement)grid.SelectionElement; shared.editBrushIndex = e.BrushIndex; lastChangedTime = Time.WallClockTotalSeconds; } // end of BrushPicker UpdateIndex()
// c'tor public BrushPicker() : base(null, null) { helpOverlay = @"BrushPicker"; altHelpOverlay = @"BrushPickerMaterial"; // Create brush elements for the grid. // Start with a blob of common parameters. UIGridElement.ParamBlob blob = new UIGridElement.ParamBlob(); blob.width = 1.0f; blob.height = 1.0f; blob.edgeSize = 0.1f; blob.selectedColor = Color.Transparent; blob.unselectedColor = Color.Transparent; blob.normalMapName = @"QuarterRound4NormalMap"; blob.altShader = true; blob.ignorePowerOf2 = true; // Create and fill the list. int maxBrushes = Brush2DManager.NumBrushes; brushList = new List <UIGrid2DBrushElement>(maxBrushes); UIGrid2DBrushElement e = null; for (int i = 0; i < maxBrushes; i++) { Brush2DManager.Brush2D brush = Brush2DManager.GetBrush(i); e = new UIGrid2DBrushElement(blob, brush.TileTextureName, i); e.NoZ = true; e.Tag = brush.HelpOverlay; brushList.Add(e); } // Create and populate grid. By default we'll start with the full set of brushes. grid = new BrushPickerUIGrid(OnSelect, OnCancel, new Point(maxBrushes, 1), "TerrainEdit.BrushPicker"); for (int i = 0; i < maxBrushes; i++) { grid.Add(brushList[i], i, 0); } // Set grid properties. //grid.AlwaysReadInput = true; grid.Scrolling = false; grid.IgnoreInput = true; grid.Spacing = new Vector2(0.25f, 0.0f); grid.UseLeftStick = false; grid.UseTriggers = true; grid.Wrap = false; grid.LocalMatrix = Matrix.CreateTranslation(0.0f, -2.2f, -10.0f); } // end of BrushPicker c'tor