public TravelScreen(InterfaceManager manager) : base(manager) { screenTitle = new Title(null, "Star Map", GraphicConsole.BufferWidth / 2 - 11, 1, Title.TextAlignModes.Center); starMap = new StarMap(); starMap.Position = new System.Drawing.Point(1, 2); starMap.Size = new System.Drawing.Point(74, 33); systemTitle = new Title(null, "Current System", 87, 1, Title.TextAlignModes.Center); systemDescriptionBox = new TextBox(null, 76, 3, 23, 15); systemDescriptionBox.FillColor = new Color4(0.15f, 0.15f, 0.15f, 1f); up = new Button(null, "▲", 87, 30); down = new Button(null, "▼", 87, 34); left = new Button(null, "◄", 84, 32); right = new Button(null, "►", 90, 32); systemButton = new Button(null, "System", 76, 27); travelButton = new Button(null, "Travel", 76, 30); ambushButton = new Button(null, "Ambush", 76, 33); cargoButton = new Button(null, "Cargo", GraphicConsole.BufferWidth - 7, 27); stockButton = new Button(null, "Stock", GraphicConsole.BufferWidth - 7, 30); screenTitle.Text = GameManager.GalacticDate.ToShortDateString(); clock = new Clock(null, 10, 5); clock.Position = new System.Drawing.Point(63, 1); playButton = new Button(null, "►", 74, 1, 1, 1); fasterButton = new Button(null, "+", 61, 1, 1, 1); slowerButton = new Button(null, "-", 62, 1, 1, 1); //UI Events #region Map Panning Events up.Click += (sender, e) => { starMap.PanMap(0f, 100f); InterfaceManager.DrawStep(); }; down.Click += (sender, e) => { starMap.PanMap(0f, -100f); InterfaceManager.DrawStep(); }; left.Click += (sender, e) => { starMap.PanMap(100f, 0f); InterfaceManager.DrawStep(); }; right.Click += (sender, e) => { starMap.PanMap(-100f, 0f); InterfaceManager.DrawStep(); }; #endregion #region Button Events systemButton.Click += (sender, e) => { if (!GameManager.PlayerShip.Pilot.IsTraveling) { InterfaceManager.ChangeInterface("System"); } }; travelButton.Click += (sender, e) => { if (starMap.HasSystemSelected && !GameManager.PlayerShip.Pilot.IsTraveling && GameManager.PlayerShip.CanFly()) { startTraveling(); } }; ambushButton.Click += (sender, e) => { if (!GameManager.PlayerShip.Pilot.IsTraveling) { InterfaceManager.ChangeInterface("Combat"); } }; cargoButton.Click += (sender, e) => { if (!GameManager.PlayerShip.Pilot.IsTraveling) { InterfaceManager.ChangeInterface("Ship"); } }; stockButton.Click += (sender, e) => { if (!GameManager.PlayerShip.Pilot.IsTraveling) { InterfaceManager.ChangeInterface("Stock"); } }; #endregion starMap.Selected += (sender, e) => { highlitedPath = GameManager.Pathfinder.FindPath(GameManager.CurrentSystem, e, GameManager.PlayerShip); starMap.SetPath(highlitedPath); updateScreenInformation(); InterfaceManager.DrawStep(); }; #region Clock Events clock.TimerLapse += (sender, e) => { screenTitle.Text = GameManager.GalacticDate.ToShortDateString(); }; clock.TimerTick += (sender, e) => { GameManager.SimulateGame(0.1); }; playButton.Click += (sender, e) => { playButton.Text = (playButton.Text == "■") ? "►" : "■"; clock.Toggle(); InterfaceManager.DrawStep(); }; fasterButton.Click += (sender, e) => { clock.TickRate -= 0.5; }; slowerButton.Click += (sender, e) => { clock.TickRate += 0.5; }; #endregion #region ControlRegister RegisterControl(screenTitle); RegisterControl(systemTitle); RegisterControl(systemDescriptionBox); RegisterControl(starMap); RegisterControl(up); RegisterControl(down); RegisterControl(left); RegisterControl(right); RegisterControl(playButton); RegisterControl(fasterButton); RegisterControl(slowerButton); RegisterControl(travelButton); RegisterControl(ambushButton); RegisterControl(systemButton); RegisterControl(cargoButton); RegisterControl(stockButton); RegisterControl(clock); #endregion }
public TradingScreen(InterfaceManager manager) : base(manager) { screenTitle = new Title(null, "Trading Hub", GraphicConsole.BufferWidth / 2, 1, Title.TextAlignModes.Center); playerValueTitle = new Title(null, "Player Value", 50, 11, Title.TextAlignModes.Center); computerValueTitle = new Title(null, "Computer Value", 51, GraphicConsole.BufferHeight - 11, Title.TextAlignModes.Center); differenceValueTitle = new Title(null, "Difference Value", GraphicConsole.BufferWidth / 2, GraphicConsole.BufferHeight / 2, Title.TextAlignModes.Center); playerCreditsTitle = new Title(null, "Player Credits", 1, 1, Title.TextAlignModes.Left); computerCreditsTitle = new Title(null, "Computer Credits", GraphicConsole.BufferWidth - 26, 1, Title.TextAlignModes.Left); backButton = new Button(null, "Back", 0, 0, 6, 1); backButton.Click += (sender, e) => { InterfaceManager.ChangeInterface("System"); }; Color4 controlFillColor = new Color4(0.15f, 0.15f, 0.15f, 1f); Color4 darkerColor = new Color4(0.1f, 0.1f, 0.1f, 1f); Color4 lighterColor = new Color4(0.2f, 0.2f, 0.2f, 1f); TradingListItem.BufferWidth = 25; //Set to the width of the inventory screens inventoryList = new ScrollingList(null, 1, 2, 25, GraphicConsole.BufferHeight - 3); inventoryList.FillColor = controlFillColor; availableItemsList = new ScrollingList(null, GraphicConsole.BufferWidth - 26, 2, 25, GraphicConsole.BufferHeight - 3); availableItemsList.FillColor = controlFillColor; offeredList = new ScrollingList(null, 38, 2, 25, 9); offeredList.FillColor = controlFillColor; interestedList = new ScrollingList(null, 37, GraphicConsole.BufferHeight - 10, 25, 9); interestedList.FillColor = controlFillColor; playerRemoveOne = new Button(null, "<1", 26, 2, 6, 3); playerRemoveOne.FillColor = darkerColor; playerRemoveTen = new Button(null, "<10", 26, 5, 6, 3); playerRemoveTen.FillColor = darkerColor; playerRemoveHundred = new Button(null, "<100", 26, 8, 6, 3); playerRemoveHundred.FillColor = darkerColor; playerAddOne = new Button(null, "1>", 32, 2, 6, 3); playerAddOne.FillColor = lighterColor; playerAddTen = new Button(null, "10>", 32, 5, 6, 3); playerAddTen.FillColor = lighterColor; playerAddHundred = new Button(null, "100>", 32, 8, 6, 3); playerAddHundred.FillColor = lighterColor; playerRemoveOne.Click += (sender, e) => RemovePlayerItem(offeredList.GetSelection(), 1); playerRemoveTen.Click += (sender, e) => RemovePlayerItem(offeredList.GetSelection(), 10); playerRemoveHundred.Click += (sender, e) => RemovePlayerItem(offeredList.GetSelection(), 100); playerAddOne.Click += (sender, e) => AddPlayerItem(inventoryList.GetSelection(), 1); playerAddTen.Click += (sender, e) => AddPlayerItem(inventoryList.GetSelection(), 10); playerAddHundred.Click += (sender, e) => AddPlayerItem(inventoryList.GetSelection(), 100); computerAddOne = new Button(null, "<1", 62, GraphicConsole.BufferHeight - 4, 6, 3); computerAddOne.FillColor = lighterColor; computerAddTen = new Button(null, "<10", 62, GraphicConsole.BufferHeight - 7, 6, 3); computerAddTen.FillColor = lighterColor; computerAddHundred = new Button(null, "<100", 62, GraphicConsole.BufferHeight - 10, 6, 3); computerAddHundred.FillColor = lighterColor; computerRemoveOne = new Button(null, "1>", 68, GraphicConsole.BufferHeight - 4, 6, 3); computerRemoveOne.FillColor = darkerColor; computerRemoveTen = new Button(null, "10>", 68, GraphicConsole.BufferHeight - 7, 6, 3); computerRemoveTen.FillColor = darkerColor; computerRemoveHundred = new Button(null, "100>", 68, GraphicConsole.BufferHeight - 10, 6, 3); computerRemoveHundred.FillColor = darkerColor; computerRemoveOne.Click += (sender, e) => RemoveComputerItem(interestedList.GetSelection(), 1); computerRemoveTen.Click += (sender, e) => RemoveComputerItem(interestedList.GetSelection(), 10); computerRemoveHundred.Click += (sender, e) => RemoveComputerItem(interestedList.GetSelection(), 100); computerAddOne.Click += (sender, e) => AddComputerItem(availableItemsList.GetSelection(), 1); computerAddTen.Click += (sender, e) => AddComputerItem(availableItemsList.GetSelection(), 10); computerAddHundred.Click += (sender, e) => AddComputerItem(availableItemsList.GetSelection(), 100); makeOfferButton = new Button(null, "Make Offer", GraphicConsole.BufferWidth / 2 - 6, GraphicConsole.BufferHeight / 2 - 3); makeOfferButton.Click += (sender, e) => makeOffer(); computerInventory = new Inventory(); #region Control Registration RegisterControl(screenTitle); RegisterControl(playerValueTitle); RegisterControl(computerValueTitle); RegisterControl(playerCreditsTitle); RegisterControl(computerCreditsTitle); RegisterControl(differenceValueTitle); RegisterControl(inventoryList); RegisterControl(availableItemsList); RegisterControl(offeredList); RegisterControl(interestedList); RegisterControl(playerAddOne); RegisterControl(playerAddTen); RegisterControl(playerAddHundred); RegisterControl(playerRemoveOne); RegisterControl(playerRemoveTen); RegisterControl(playerRemoveHundred); RegisterControl(computerAddOne); RegisterControl(computerAddTen); RegisterControl(computerAddHundred); RegisterControl(computerRemoveOne); RegisterControl(computerRemoveTen); RegisterControl(computerRemoveHundred); RegisterControl(makeOfferButton); RegisterControl(backButton); #endregion }
public BuildScreen(InterfaceManager manager) : base(manager) { //Titles Title screenTitle = new Title(null, "Building Interface", GraphicConsole.BufferWidth / 2, 1, Title.TextAlignModes.Center); Title planetListTitle = new Title(null, "Planets", 10, 2, Title.TextAlignModes.Center); //Lists planetList = new ScrollingList(null, 1, 3, 21, 23); planetList.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f); //Textboxes descriptionBox = new TextBox(null, 23, 3, 35, 23); descriptionBox.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f); //Buttons Button backButton = new Button(null, "Back", 0, 0, 6, 1); Button buildMarketButton = new Button(null, "Build Market", 1, 27); Button buildStationButton = new Button(null, "Build Station", 1, 30); Button buildFactoryButton = new Button(null, "Build Factory", 1, 33); /* UI EVENTS */ planetList.Selected += (sender, e) => { descriptionBox.Text = getPlanetDescription((Planetoid)planetList.GetSelection()); InterfaceManager.DrawStep(); }; backButton.Click += (sender, e) => { InterfaceManager.ChangeInterface("System"); }; buildMarketButton.Click += (sender, e) => { GameManager.CurrentSystem.BuildMarket(GameManager.PlayerFaction); }; buildStationButton.Click += (sender, e) => { foreach (Planetoid planet in GameManager.CurrentSystem.Planetoids) { planet.BuildStation(GameManager.PlayerFaction); } }; buildFactoryButton.Click += (sender, e) => { foreach (Planetoid planet in GameManager.CurrentSystem.Planetoids) { planet.BuildFactory(GameManager.PlayerFaction, Game.Factories.ProductFactory.CarbonDioxide); } }; /* END UI EVENTS */ //Control Register RegisterControl(screenTitle); RegisterControl(planetListTitle); RegisterControl(planetList); RegisterControl(descriptionBox); RegisterControl(backButton); RegisterControl(buildMarketButton); RegisterControl(buildStationButton); RegisterControl(buildFactoryButton); }
public NewGameScreen(InterfaceManager manager) : base(manager) { Title characterCreation = new Title(null, "Ship Registration", GraphicConsole.BufferWidth / 2, 1, Title.TextAlignModes.Center); Title playerName = new Title(null, "Name: ", 7, 2, Title.TextAlignModes.Left); Title shipName = new Title(null, "Ship Name: ", 2, 4, Title.TextAlignModes.Left); Title companyName = new Title(null, "Comp Name: ", 2, 6, Title.TextAlignModes.Left); Title shipType = new Title(null, "Ship Type: ", 2, 8, Title.TextAlignModes.Left); Title shipDescription = new Title(null, "Description: ", 25, 8, Title.TextAlignModes.Left); Title shipLayoutTitle = new Title(null, "Layout: ", 64, 8, Title.TextAlignModes.Left); playerNameInput = new InputBox(null, 13, 2, 20); playerNameInput.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f); playerNameInput.Text = "James Comey"; shipNameInput = new InputBox(null, 13, 4, 20); shipNameInput.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f); shipNameInput.Text = "Heart of the Horizon"; companyNameInput = new InputBox(null, 13, 6, 20); companyNameInput.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f); companyNameInput.Text = "Comey Shipping Inc"; shipSelectionList = new ScrollingList(null, 2, 9, 22, 19); shipSelectionList.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f); shipSelectionList.SetList(Game.Factories.ShipFactory.BasicShips); shipSelectionList.Selected += (sender, e) => { Ship selectedShip = (Ship)shipSelectionList.GetSelection(); shipDescriptionBox.Text = string.Format("== {0} ==\n{1}\n-\nFire: {2}\nDfns: {3}\nCargo: {4}\nJump: {5}", selectedShip.Model, selectedShip.Description, selectedShip.FirePower, selectedShip.DefenseRating, selectedShip.CargoCapacity, selectedShip.JumpRadius); shipLayout.SetShip((Ship)shipSelectionList.GetSelection()); InterfaceManager.DrawStep(); }; shipDescriptionBox = new TextBox(null, 25, 9, 38, 19); shipDescriptionBox.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f); startGameButton = new Button(null, "Start", GraphicConsole.BufferWidth - 8, GraphicConsole.BufferHeight - 4); startGameButton.Click += (sender, e) => { if (!isValidInputs()) { return; } GameManager.SetupGame(playerNameInput.Text.Trim(), companyNameInput.Text.Trim(), shipNameInput.Text.Trim(), (Ship)shipSelectionList.GetSelection()); InterfaceManager.ChangeInterface("Travel"); }; backButton = new Button(null, "Back", 1, GraphicConsole.BufferHeight - 4); backButton.Click += (sender, e) => { InterfaceManager.ChangeInterface("Start"); }; shipLayout = new ShipLayout(null, 34, 19); shipLayout.Position = new System.Drawing.Point(64, 9); RegisterControl(characterCreation); RegisterControl(playerName); RegisterControl(shipName); RegisterControl(companyName); RegisterControl(shipType); RegisterControl(shipDescriptionBox); RegisterControl(playerNameInput); RegisterControl(shipNameInput); RegisterControl(companyNameInput); RegisterControl(shipSelectionList); RegisterControl(shipDescription); RegisterControl(shipLayoutTitle); RegisterControl(startGameButton); RegisterControl(backButton); RegisterControl(shipLayout); }
public CombatScreen(InterfaceManager manager) : base(manager) { backButton = new Button(null, "Back", 1, 1); backButton.Click += (sender, e) => InterfaceManager.ChangeInterface("Travel"); attackButton = new Button(null, "Attack", 1, 4); attackButton.Click += (sender, e) => { if (!shipList.HasSelection) { return; } GameManager.CombatSimulator.SetCombatants(GameManager.PlayerShip, (Ship)shipList.GetSelection()); CombatGroup victor = GameManager.CombatSimulator.SimulateCombat(); updateDisplayInformation(); descriptionBox.Text = string.Format("{0} won!", victor.Ships[0].Name); }; scanButton = new Button(null, "Scan", 1, 7); scanButton.Click += (sender, e) => { if (!shipList.HasSelection) { return; } GameManager.CombatSimulator.SetCombatants(GameManager.PlayerShip, (Ship)shipList.GetSelection()); double oddsToWin = GameManager.CombatSimulator.GetCombatOdds(); string text = string.Format("{0}% chance to win.\n-\n", oddsToWin * 100.0); if (GameManager.CombatSimulator.GroupTwo.Ships[0].CanBeScanned(GameManager.PlayerShip)) { //List the equipped modules foreach (ShipNode node in GameManager.CombatSimulator.GroupTwo.Ships[0].Nodes) { if (node.Empty) { continue; } text += string.Format("{0} - {1}\n", node.ModType, node.Module.Name); } text += "-\n"; //List the carried items List <InventorySlot> inventory = GameManager.CombatSimulator.GroupTwo.Ships[0].Inventory.GetInventoryList(); foreach (InventorySlot slot in inventory) { text += string.Format("{0} - #{1}\n", slot.Item.Name, slot.Quantity); } } else { text += "Cannot be scanned."; } descriptionBox.Text = text; }; shipList = new ScrollingList(null, GraphicConsole.BufferWidth - 41, 1, 40, 20); shipList.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f); descriptionBox = new TextBox(null, GraphicConsole.BufferWidth - 41, 22, 40, 14); descriptionBox.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f); shipList.Selected += (sender, e) => { descriptionBox.Text = getShipDescription((Ship)shipList.GetSelection()); InterfaceManager.DrawStep(); }; RegisterControl(backButton); RegisterControl(attackButton); RegisterControl(scanButton); RegisterControl(shipList); RegisterControl(descriptionBox); }