void OnGUI() { if (GUI.Button(new Rect(Screen.width / 2 - 110, 10, btnW, btnH), "Zoom in")) { Game.Zoom *= 0.8f; } if (GUI.Button(new Rect(Screen.width / 2 + 10, 10, btnW, btnH), "Zoom out")) { Game.Zoom /= 0.8f; } var ot = overlayNames[Game.DataOverlay]; if (GUI.Button(new Rect(Screen.width / 2 + 120, 10, btnW, btnH), ot)) { Game.DataOverlay = (Game.DataOverlay + 1) % 4; } if (Game.SelectedBuilding == null) { var terraform = new Terraform { Game = Game }; if (GUI.Button(new Rect(10, 10, btnW, btnH), "Level")) { terraform.LevelTerrain(Game.SelectedCell, Game.CursorSize); } if (GUI.Button(new Rect(10, 20 + btnH, btnW, btnH), "Raise")) { terraform.AdjustTerrain(Game.SelectedCell, Game.CursorSize, 0.25f); } if (GUI.Button(new Rect(10, 30 + btnH * 2, btnW, btnH), "Lower")) { terraform.AdjustTerrain(Game.SelectedCell, Game.CursorSize, -0.25f); } } else { if (GUI.Button(new Rect(10, 10, btnW, btnH), "Toggle")) { Game.SelectedBuilding.IsEnabled = !Game.SelectedBuilding.IsEnabled; } } if (GUI.Button(new Rect(10, 40 + btnH * 3, btnW / 3, btnH), "1x")) { Game.CursorSize = 1; } if (GUI.Button(new Rect(10 + btnW / 3, 40 + btnH * 3, btnW / 3, btnH), "2x")) { Game.CursorSize = 2; } if (GUI.Button(new Rect(10 + 2 * btnW / 3, 40 + btnH * 3, btnW / 3, btnH), "3x")) { Game.CursorSize = 3; } var dh = btnH + padding; if (Game.Buildings.Count == 0) { var didClick = GUI.Button(new Rect(10, 4 * dh, btnW, btnH), "Hub"); if (didClick) { InputFilter.AbortTap(); Game.AddBuilding(Definitions.hub, Game.SelectedCell); } } else if (Game.NeighbourDist[Game.SelectedCell] <= Game.BuildRange) { var i = 0; foreach (var type in Definitions.types.Where(t => t.w == Game.CursorSize)) { if (type.Predicate.CanBuild(type, Game.SelectedCell, Game)) { i++; var y = 3 * dh + dh * i; var didClick = GUI.Button(new Rect(10, y, btnW, btnH), type.name); if (didClick) { InputFilter.AbortTap(); Game.AddBuilding(type, Game.SelectedCell); } } } } }