コード例 #1
0
ファイル: Render.cs プロジェクト: evankiljoy/star-trek-kg
        public void CreateCRSViewScreen(IRegion Region, IMap map, Location shipLocation, int totalHostiles, string RegionDisplayName, bool isNebula, StringBuilder sectorScanStringBuilder)
        {
            List <string> lrsResults = LongRangeScan.For(map.Playership).RunLRSScan(shipLocation);

            var topBorder = this.Config.GetText("CRSTopBorder");

            this.CRS_Region_ScanLine(RegionDisplayName, topBorder, shipLocation);
            this.ScanLine(topBorder, String.Format(" Energy: {0}   Shields: {1}", map.Playership.Energy, Shields.For(map.Playership).Energy));

            int crsRows = Convert.ToInt32(this.Config.GetText("CRSRows"));

            for (int i = 0; i < crsRows; i++)
            {
                var rowIndicator = this.GetCRSRightTextLine(i, map, lrsResults, totalHostiles);
                this.ShowSectorRow(sectorScanStringBuilder, i, rowIndicator, Region.Sectors, totalHostiles, isNebula);
            }

            string lrsBottom = null;

            if (lrsResults.Count() == 7)
            {
                lrsBottom = " " + lrsResults[6];
            }

            this.ScanLine(this.Config.GetText("CRSBottomBorder"), lrsBottom + this.Config.GetText("AppVersion"));
        }
コード例 #2
0
        public void GetStarbaseInfoFromScanner2()
        {
            var game = new Game((new StarTrekKGSettings()));

            this.Game.Map = new Map(new SetupOptions
            {
                Initialize = true,
                AddNebulae = false,
                SectorDefs = new SectorDefs
                {
                    new SectorDef(new LocationDef(new Coordinate(0, 0), new Coordinate(0, 0)), SectorItem.PlayerShip),
                    new SectorDef(new LocationDef(new Coordinate(0, 0), new Coordinate(0, 1)), SectorItem.HostileShip),

                    new SectorDef(new LocationDef(new Coordinate(0, 0), new Coordinate(0, 2)), SectorItem.Starbase),
                    new SectorDef(new LocationDef(new Coordinate(0, 0), new Coordinate(0, 3)), SectorItem.Starbase),
                    new SectorDef(new LocationDef(new Coordinate(0, 0), new Coordinate(0, 4)), SectorItem.Starbase),
                    new SectorDef(new LocationDef(new Coordinate(0, 0), new Coordinate(0, 5)), SectorItem.Starbase),
                    new SectorDef(new LocationDef(new Coordinate(0, 0), new Coordinate(0, 6)), SectorItem.Starbase)
                },
                AddStars = false
            }, this.Game.Write, this.Game.Config);

            var x = LongRangeScan.For(this.Game.Map.Playership).Execute(this.Game.Map.Regions[0]); //pulls count from Region object

            Assert.AreEqual(5, x.Starbases);
        }
コード例 #3
0
        public void GetMapInfoForScanner()
        {
            //todo: fix hostiles and starbases and stars to test fully

            var x = LongRangeScan.For(this.Game.Map.Playership).Execute(this.Game.Map.Regions[0]); //pulls count from Region object

            Assert.Greater(0, x.Hostiles);
            Assert.Greater(0, x.Starbases);
            Assert.Greater(0, x.Stars);
        }
コード例 #4
0
ファイル: Region.cs プロジェクト: evankiljoy/star-trek-kg
        private LRSResult GetRegionData(ICoordinate region, Game game)
        {
            Region regionToScan = Regions.Get(game.Map, this.CoordinateToScan(region.X, region.Y, game.Config));
            var    regionResult = new LRSResult();

            if (regionToScan.Type != RegionType.Nebulae)
            {
                regionResult = LongRangeScan.For(game.Map.Playership).Execute(regionToScan);
            }
            else
            {
                regionResult.Coordinate = new Coordinate(region.X, region.Y);
                regionResult.Name       = regionToScan.Name;
                regionResult.Unknown    = true;
            }

            return(regionResult);
        }
コード例 #5
0
 public void ShortRangeScan1()
 {
     LongRangeScan.LongRangeSensorScan1(Program.Main);
 }
コード例 #6
0
ファイル: Write.cs プロジェクト: evankiljoy/star-trek-kg
        //This needs to be a command method that the UI passes values into.
        //Readline is done in UI

        public void Prompt(Ship playerShip, string mapText, Game game)
        {
            this.Console.Write(mapText);

            var readLine = this.Console.ReadLine();

            if (readLine == null)
            {
                return;
            }

            var command = readLine.Trim().ToLower();

            switch (command)
            {
            case "wrp":
            case "imp":
            case "nto":
                Navigation.For(playerShip).Controls(command);
                break;

            case "irs":
                ImmediateRangeScan.For(playerShip).Controls();
                break;

            case "srs":
                ShortRangeScan.For(playerShip).Controls();
                break;

            case "lrs":
                LongRangeScan.For(playerShip).Controls();
                break;

            case "crs":
                CombinedRangeScan.For(playerShip).Controls();
                break;

            case "pha":
                Phasers.For(playerShip).Controls(playerShip);
                break;

            case "tor":
                Torpedoes.For(playerShip).Controls();
                break;

            case "she":
                this.ShieldMenu(playerShip);
                break;

            case "com":
                this.ComputerMenu(playerShip);
                break;

            case "toq":
                Computer.For(playerShip).Controls(command);
                break;

            case "dmg":
                this.DamageControlMenu(playerShip);
                break;

            //Utility Commands
            case "dbg":
                this.DebugMenu(playerShip);
                break;

            case "ver":
                this.Console.WriteLine(this.Config.GetText("AppVersion").TrimStart(' '));
                break;

            case "cls":
                this.Console.Clear();
                break;

            default:     //case "?":
                this.CreateCommandPanel();
                this.Panel(this.GetPanelHead(playerShip.Name), ACTIVITY_PANEL);
                break;
            }
        }