public void StartMatch(ClientListener client, Pluto pluto) { LoggerHelper.Debug("StartMatch"); foreach (var item in m_roomsData.Values) { if (!item.IsBusy) { var canStart = item.AddClient(client); var ecap = new EntityCellAttachedPluto(); var res = ecap.ServerEncode(GetCellData(client)); client.Send(res); AOINew(client); AOIEntityies(client); if (canStart) { StartBattle(client, pluto); } LoggerHelper.Debug("StartMatch " + canStart); return; } } CreatRoom(client, (int)pluto.Arguments[0], (int)pluto.Arguments[1]); if ((int)pluto.Arguments[0] == 1)//单人模式 { StartBattle(client, pluto); } }
public void PlutoHasASurface() { IPlanet pluto = new Pluto(); object[,] surface = pluto.Surface; Assert.IsNotNull(surface); }
static void Main(string[] args) { // Testing methods //var pluto = new Pluto(null) //{ // SurfaceArea = new int[4, 4] // { { 0, 1, 0, 0 }, // { 0, 0, 1, 0 }, // { 1, 1, 0, 0 }, // { 0, 0, 0, 0 } } //}; //for(int i = 0; i <= pluto.SurfaceArea.GetLength(0) - 1; i++) { // for(int j = 0; j <= pluto.SurfaceArea.GetLength(1) - 1; j++) // { // System.Console.Write("{0} ", pluto.SurfaceArea[i, j]); // } // System.Console.WriteLine(); //} var pluto = new Pluto(null); var rover = new Rover(pluto, ""); rover.ExecuteRoute(); System.Console.ReadLine(); }
public void SetUp() { _rover = new Rover(0, 0); _pluto = new Pluto(XSize, YSize); _turnOperation = new TurnOperation(); _movementOperation = new MovementOperation(); _service = new RoverService(); }
private void AOIRPC(ClientListener client, Pluto pluto) { var res = pluto.Content; for (int i = 0; i < client.ClientData.BelongRoom.MemberList.Count; i++) { client.ClientData.BelongRoom.MemberList[i].Send(res); //var c = tempList[i]; //c.Send(res); } }
public void When_TryPositionRoverInsideGrid_ExpectSuccess() { // Arrange var pluto = new Pluto(100, 100); // Act var exception = Record.Exception(() => new PlutoRover(pluto, new Position(new Location(0, 0), Orientation.N))); // Assert exception.Should().BeNull(); }
public void When_ThereIsAnObstacleInTheWay_Expect_StopAtTheObstacle() { // Arrange var pluto = new Pluto(100, 100, new [] { new Location(0, 2) }); var rover = new PlutoRover(pluto, new Position(new Location(0, 0), Orientation.N)); // Act rover.Move("FF"); // Assert rover.Position.ToString() .Should().Be("0,1,N"); }
public void When_ThereAreNoObstaclesInTheWay_Expect_ReportNone() { // Arrange var pluto = new Pluto(100, 100); var rover = new PlutoRover(pluto, new Position(new Location(0, 0), Orientation.N)); // Act rover.Move("FF"); // Assert // Note: not using Fluent assertion (.Should().Be(...)) - it is not compatible with the Option type Assert.Equal(rover.ObstacleInTheWay, Option.None <Location>()); }
private void HandleMove(ClientListener client, Pluto pluto) { if (pluto.Arguments.Length > 0) { var cell = pluto.Arguments[0] as CellAttachedInfo; if (cell != null) { //client.ClientData.face = cell.face; //client.ClientData.Position = cell.position; //UpdatePos(client); } } //LoggerHelper.Debug("HandleMove: " + pluto.Arguments.Length); }
public EvictionOutput GetEvictionProbabilitiesByBBL(string bbl) { Pluto data = db.Plutoes.Where(w => w.BBL == bbl).FirstOrDefault(); string BldgArea = data.BldgArea.HasValue ? data.BldgArea.ToString() : ""; string ComArea = data.ComArea.HasValue ? data.ComArea.ToString() : ""; string ResArea = data.ResArea.HasValue ? data.ResArea.ToString() : ""; string NumFloors = data.NumFloors.HasValue ? data.NumFloors.ToString() : ""; string UnitsRes = data.UnitsRes.HasValue ? data.UnitsRes.ToString() : ""; string AssessTot = data.AssessTot.HasValue ? data.AssessTot.ToString() : ""; string YearBuilt = data.YearBuilt.HasValue ? data.YearBuilt.ToString() : ""; EvictionOutput evOutput = RestDAL.InvokeRequestResponseEvictionStatus15KProperties(bbl, data.Borough, data.ZipCode, BldgArea, ComArea, ResArea, NumFloors, UnitsRes, data.ZoneDist1, AssessTot, YearBuilt, data.BldgClass, data.LandUse, null); return(evOutput); }
public void When_ThereIsAnObstacleInTheWay_Expect_ReportTheObstacleLocation() { // Arrange var obstacleLocation = new Location(0, 2); var pluto = new Pluto(100, 100, new [] { obstacleLocation }); var rover = new PlutoRover(pluto, new Position(new Location(0, 0), Orientation.N)); // Act rover.Move("FF"); // Assert // Note: not using Fluent assertion (.Should().Be(...)) - it is not compatible with the Option type Assert.Equal(rover.ObstacleInTheWay, Option.Some(obstacleLocation)); }
public void PlutoIs100By100() { IPlanet pluto = new Pluto(); object[,] surface = pluto.Surface; var minX = 0; var minY = 0; var lenX = 100; var lenY = 100; Assert.AreEqual(minX, surface.GetLowerBound(0)); Assert.AreEqual(minY, surface.GetLowerBound(1)); Assert.AreEqual(lenX, surface.GetLength(0)); Assert.AreEqual(lenY, surface.GetLength(1)); }
public void GivenPlanetHasObstacles_WhenRequestedToGetObstacles_ShouldReturnObstacles() { //Arrange _sut = new Pluto(); _obstacles = new List <Point> { new Point(0, 0), new Point(1, 1), new Point(2, 2) }; _sut.SetObstacles(_obstacles); //Act var obstaclesStr = _sut.GetObstacles(); //Assert obstaclesStr.Should().ContainAll("(0,0)", "(1,1)", "(2,2)"); }
private void RunCommand( string initialPosition, string command, string expectedFinalPosition, int plutoWidth = 100, int plutoHeight = 100) { // Arrange var pluto = new Pluto(plutoWidth, plutoHeight); var rover = new PlutoRover(pluto, new Position(initialPosition)); // Act rover.Move(command); // Assert rover.Position.ToString() .Should().Be(expectedFinalPosition); }
private void OnDataReceive(byte[] data) { try { var pluto = Pluto.Decode(data); pluto.HandleData(); //temp 以下代码需放在PRCCallPluto里面 //if (!String.IsNullOrEmpty(pluto.FuncName) && pluto.Arguments != null) // EventDispatcher.TriggerEvent<object[]>(pluto.FuncName, pluto.Arguments); //else // LoggerHelper.Warning(String.Format("Null function in RpcCallPluto.")); //LoggerHelper.Debug("OnDataReceive " + pluto.FuncName); } catch (Exception ex) { LoggerHelper.Except(ex); } }
private void HandleRPCCall(ClientListener client, Pluto pluto) { switch (pluto.FuncName) { case "HeartBeat": break; case "StartMatch": StartMatch(client, pluto); break; case "CreateAvatarResp": CreateAvatar(); break; default: AOIRPC(client, pluto); break; } //LoggerHelper.Debug("HandleRPCCall: " + pluto.Arguments.Length); }
private void HandleLogin(ClientListener client, Pluto pluto) { client = InitClientData(client, pluto.Arguments[0].ToString()); var eap = new EntityAttachedPluto(); var res = eap.ServerEncode(new BaseAttachedInfo() { typeId = Avatar, id = client.ClientData.Id, dbid = client.ClientData.Dbid, props = new List <EntityPropertyValue>() { new EntityPropertyValue(GetEntityDefPropertyByName("Name"), client.ClientData.Name), } }); client.Send(res); //AOINew(client); //AOIEntityies(client); LoggerHelper.Debug("Client Login: " + pluto.Arguments[0]); }
public void ParseIntent(string intent, dynamic json) { switch (intent) { case "GetTime": Say(Pluto.GetTime()); break; case "PlaySong": pluto.musicSystem.PlayIndex(int.Parse(json.slots.index.ToString()) - 1); break; case "StopSong": pluto.musicSystem.StopSong(); break; case "Volume": string state = json.slots.state.ToString(); if (state == "down") { pluto.Log("has turned the volume down"); pluto.musicSystem.ModifyVolume(-0.05f); } else if (state == "up") { pluto.Log("has turned the volume up"); pluto.musicSystem.ModifyVolume(0.05f); } break; case "Shutdown": pluto.shouldClose = true; break; default: pluto.Log("failed to catch an intent"); break; } }
private void OnDataReceive(ClientListener client, Byte[] data) { var pluto = Pluto.Decode(data); var type = pluto.GetType(); if (type == typeof(LoginPluto)) { HandleLogin(client, pluto); } else if (type == typeof(MovePluto)) { HandleMove(client, pluto); } else if (type == typeof(RpcCallPluto)) { HandleRPCCall(client, pluto); } else { LoggerHelper.Debug("Unkown type pluto: " + pluto.GetType().ToString()); } }
private static int GetNextYCoOrd(Rover rover, int displacement, Pluto pluto) => (rover.PosY + displacement + pluto.YSize) % pluto.YSize;
public Instruction(Pluto pluto, Rover rover, string instruction) { Pluto = pluto; Rover = rover; _instruction = instruction; }
public Visuals(Pluto pluto) : base(pluto) { }
public void StartBattle(ClientListener client, Pluto pluto) { AOIRPC(client, pluto); }
public override void Update() { timeText.SetText(DateTime.Now.ToString("MM-dd").Replace("-", "/") + " | " + Pluto.GetTime().ToUpper()); if (Raylib.IsKeyPressed(KeyboardKey.KEY_R)) { GenerateStars(); } if (PaperUtils.RectClick(volumeSlider.GetRectangle())) { volumeHandle.position = new Vector2(Raylib.GetMouseX(), volumeHandle.position.Y); float newVolume = GetRelativePercentage(volumeSlider.literalPosition.X, volumeSlider.literalPosition.X + volumeSlider.size.X, Raylib.GetMouseX()); // Console.WriteLine(newVolume); pluto.musicSystem.SetVolume(newVolume); } if (PaperUtils.RectClick(brightnessSlider.GetRectangle())) { brightnessHandle.position = new Vector2(Raylib.GetMouseX(), brightnessHandle.position.Y); brightness = GetRelativePercentage(brightnessSlider.literalPosition.X, brightnessSlider.literalPosition.X + brightnessSlider.size.X, Raylib.GetMouseX()); // Console.WriteLine(brightness); } }
public Module(Pluto pluto) { this.pluto = pluto; }
private static string LongitudinalMovement(Rover rover, MoveInstructions instruction, Pluto pluto) { var displacement = 1; if (rover.CurrentDirection == "W") { displacement = -1; } if (AreMovingBackwards(instruction)) { displacement *= -1; } if (pluto.Grid[GetNextXCoOrd(rover, displacement, pluto)][rover.PosY].IsObstacle) { return("IsObstacle"); } rover.PosX = GetNextXCoOrd(rover, displacement, pluto); return(Success); }
public void PlutoIsAPlanet() { IPlanet pluto = new Pluto(); }
public void CanCreatePluto() { Pluto pluto = new Pluto(); }
public MusicSystem(Pluto pluto) : base(pluto) { }
public Rhasspy(Pluto pluto) : base(pluto) { }