private void _OrientHorizontal(bool reverse = false) { for (int i = 0; i < Items.Count; ++i) { HPane.Add(Items[reverse ? Items.Count - 1 - i : i]); } }
private void InitMapPane(HPane mapPane) { int w = Width / Map.Tiles.Length; int h = Height / Map.Tiles[0].Length; for (int x = 0; x < Map.Tiles.Length; ++x) { ListMenu vList = new ListMenu(); vList.ItemsOrientation = Orientation.Vertical; // vList.KeyBoardEnabled = false; mapPane.Add(vList); for (int y = 0; y < Map.Tiles[0].Length; ++y) { MenuItem item = new MenuItem(hiddenTexture, w, h); itemMap.Add(item, new Point(x, y)); vList.AddItem(item); item.FocusGain += (s, a) => item.ImageItem.Color = Color.Silver; item.FocusLoss += (s, a) => item.ImageItem.Color = Color.White; item.Action += (s, a) => { Point p = itemMap[item]; while (Map.RevealedTiles == 0 && Map.Tiles[p.X][p.Y].HasMine) { Map.ShuffleMines(); } if (Map.RevealTile(p.X, p.Y)) { Media.PlaySound(1); } else { Media.PlaySound(0); } if (IsGameOver()) { Manager.Add(CreateGameOverView()); State = ViewState.Suspended; } }; Map.Tiles[x][y].Revealed += (s, a) => { MapTile tile = (MapTile)s; item.IsDisabled = !tile.IsHidden; item.ImageItem.Image = tile.IsHidden ? hiddenTexture : tile.HasMine ? revealedTextures[9] : revealedTextures[tile.GetMineCount()]; // TODO test tile.GetNeighbours().ToList().ForEach(n => CutOutMine(n)); }; } } }