public static void SendToRoomManaged(this Habbo habbo, Room room, RoomPosition spawnPosition) { RoomPosition currentPosition = habbo.Position; if (room == null) { habbo.SetRoomManaged(null); if (currentPosition.Room != null) { currentPosition.Room.RemoveRoomUnit(habbo); } habbo.Position = RoomPosition.HotelView; // TODO: Send to hotel view (packet wise). } else { if (currentPosition.Room != room) { if (currentPosition.Room != null) { currentPosition.Room.RemoveRoomUnit(habbo); } room.AddRoomUnit(habbo); habbo.SetRoomManaged(room); habbo.Position = new RoomPosition(spawnPosition, room); } // TODO: Send the packet to force a reload. } }
//*************************************************************************************************** void AssessPoint(RoomPosition Pos, int Level) { List <Vector3> TopPoints = CreateVectors(Pos.Position, Pos.Position.y, 1); List <Vector3> BotPoints = CreateVectors(Pos.Position, Pos.Position.y - 1, 1); List <Vector3> ForwardPoints = CreateVectors(Pos.Position, Pos.Position.y - 1, 2); //print(Pos.Position.y); for (int i = 0; i < 4; i++) { //print("Top: " + TopPoints[i] + " :: Bot: " + BotPoints[i]); bool TopClear = ClearTheTop(TopPoints[i], Level); RoomPosition BotPos = FindThePos(BotPoints[i], Level - 1, 1); RoomPosition ForPos = FindThePos(ForwardPoints[i], Level - 1, 0); if (TopClear == true && BotPos != null && Pos.StairLock == false) { //print("here!"); BotPos.Value = 5; BotPos.Rotation = SetRotation(Pos.Position, BotPoints[i]); Pos.StairLock = true; StairLockThisLevel(Pos, Level); if (ForPos != null) { ForPos.Value = 1; } } } }
//*************************************************************************************************** void CreateDoor(List <RoomPosition> RoomPositions) { RoomPosition Pos = FindPosition(RoomPositions); DoorRotation(Pos); Pos.Value = 2; }
public void FillRoomToDoor() { while (OpenDoorList.Any()) { var i = OpenDoorList.Count - 1; RoomPosition.CheckRoomPosition(DungeonTiles, OpenDoorList[i].I, OpenDoorList[i].J); if (CheckPos()) { if (RoomPosition.Up) { RandomFillUpDown(OpenDoorList[i].I + 1, OpenDoorList[i].J, OpenDoorList[i]); } else if (RoomPosition.Down) { RandomFillUpDown(OpenDoorList[i].I - 1, OpenDoorList[i].J, OpenDoorList[i]); } else if (RoomPosition.Right) { RandomFillLeftRight(OpenDoorList[i].I, OpenDoorList[i].J - 1, OpenDoorList[i]); } else if (RoomPosition.Left) { RandomFillLeftRight(OpenDoorList[i].I, OpenDoorList[i].J + 1, OpenDoorList[i]); } } OpenDoorList.Remove(OpenDoorList[i]); } }
private void DrawRooms(Maze maze, Image <Rgba32> image) { foreach (Room room in maze.Rooms) { int xRooms = maze.Rooms.GetLength(0); int yRooms = maze.Rooms.GetLength(1); for (int xRoom = 0; xRoom < xRooms; xRoom++) { for (int yRoom = 0; yRoom < yRooms; yRoom++) { RoomPosition roomPosition = new RoomPosition(xRoom, yRoom, roomSize, connectorSize); for (int x = 0; x < roomSize; x++) { for (int y = 0; y < roomSize; y++) { int xPos = roomPosition.Left + x; int yPos = roomPosition.Bottom + y; image[xPos, ReverseY(yPos, image)] = Rgba32.Black; } } } } } }
public static void SendToRoomManaged(this Habbo habbo, Room room, RoomPosition spawnPosition) { RoomPosition currentPosition = habbo.Position; if (room == null) { habbo.SetRoomManaged(null); if (currentPosition.Room != null) currentPosition.Room.RemoveRoomUnit(habbo); habbo.Position = RoomPosition.HotelView; // TODO: Send to hotel view (packet wise). } else { if (currentPosition.Room != room) { if(currentPosition.Room != null) currentPosition.Room.RemoveRoomUnit(habbo); room.AddRoomUnit(habbo); habbo.SetRoomManaged(room); habbo.Position = new RoomPosition(spawnPosition, room); } // TODO: Send the packet to force a reload. } }
private List <Item> GetAllReachableItems(RoomPosition position, List <RoomPosition> visitedPositions, Room room) { var itemList = new List <Item>(); visitedPositions.Add(position); if (position.IsTaken && position.Item != this) { itemList.Add(position.Item); return(itemList); } for (int i = 0; i < 4; i++) { var delta = GetProgressDirection((Orientation)i); var adjacentPosition = room.GetPositionAt(position.Position.x + delta.x, position.Position.y + delta.y); if (adjacentPosition != null && !visitedPositions.Contains(adjacentPosition)) { var reachableItems = GetAllReachableItems(adjacentPosition, visitedPositions, room); itemList.AddRange(reachableItems); } } return(itemList); }
//public void Travel(int to, char toFacing) public void Travel(RoomPosition to, float speed) { Debug.Log("going from node " + currPos.node.ToString() + "-" + currPos.facing + " to " + to.node.ToString() + "-" + to.facing); if (to.filename.Length > 0) { Debug.Log("using manual filename " + myvidpath + to.filename); QueueMovement(to.filename, true, speed); } else if (currPos.node != to.node) { //Debug.Log("going from node " + currNode.ToString() + " to " + to.ToString()); QueueMovement(currPos.node.ToString() + "_" + to.node.ToString() + ".avi", true, speed); } else //rotation { if (currPos.facing + 1 == to.facing || currPos.facing > to.facing + 1)//f { QueueMovement("_" + currPos.node.ToString() + "f" + currPos.facing + ".avi", true, speed, tags: "turning");//the underscore won't always be there? } else //b { QueueMovement("_" + currPos.node.ToString() + "b" + to.facing + ".avi", true, speed, tags: "turning");//the underscore won't always be there? } } currPos = to; AfterTravel(); }
void FillRow(Transform row, MapRoom room, RoomPosition position, int maxHeight, int count) { for (int i = 1; i < count; i++) { Instantiate(emptyRoom, row); } room.transform.SetSiblingIndex(maxHeight - position.Row); }
public void Init() { var length = UnityEngine.Random.Range(5, 10); var posSideRooms = length - UnityEngine.Random.Range(1, 4); _rooms = _creator.CreateDungeon(length, posSideRooms, _appliedDungeon); _currentPosition = new RoomPosition(-1, 0); _currentRoom = _rooms.FirstOrDefault(e => e.Position.Equals(_currentPosition)); }
//*************************************************************************************************** void PlacePivot() { if (StartRoom == false) { RoomPosition Pos = FindDoor(); Pivot.transform.localPosition = Pos.Position * TileDimension; Pivot.transform.eulerAngles = new Vector3(0, Pos.Rotation, 0); } }
protected void MakeRoomTransition(RoomPosition fromPos, string roomName, int toNode, char toFacing, Rect clickbox, string file1, string file2, bool fade = true) { roomDestinations.Add(file1, new RoomDestination { roomName = roomName, fileName = file2, node = toNode, facing = toFacing, fade = fade }); nodeConnections.Add(new NodeConnection { fromPos = fromPos, type = ClickboxType.EXITROOM, clickbox = clickbox, callback = enterRoom, toPos = new RoomPosition[] { new RoomPosition(0, 'a', file1) } }); }
protected void CreateNodeConnection(int from, int to, Rect clickbox, char fromFacing, char toFacing, char before, char after) { RoomPosition fromPos = new RoomPosition(from, fromFacing); RoomPosition[] toPosArray = new RoomPosition[3] { new RoomPosition(from, before), new RoomPosition(to, toFacing), new RoomPosition(to, after) }; CreateNodeConnection(fromPos, toPosArray[0], clickbox, toPosArray); }
private void DrawConnections(Maze maze, Image <Rgba32> image) { int xRooms = maze.Rooms.GetLength(0); int yRooms = maze.Rooms.GetLength(1); for (int xRoom = 0; xRoom < xRooms; xRoom++) { for (int yRoom = 0; yRoom < yRooms; yRoom++) { RoomPosition roomPosition = new RoomPosition(xRoom, yRoom, roomSize, connectorSize); int yPos = roomPosition.Bottom + roomSize / 2; int xPos = 0; if (maze.Rooms[xRoom, yRoom].East) { for (int i = 0; i < connectorSize; i++) { xPos = roomPosition.Right + i; image[xPos, ReverseY(yPos, image)] = Rgba32.Black; } } if (maze.Rooms[xRoom, yRoom].West) { for (int i = 0; i < connectorSize; i++) { xPos = roomPosition.Left - 1 - i; image[xPos, ReverseY(yPos, image)] = Rgba32.Black; } } xPos = roomPosition.Left + roomSize / 2; if (maze.Rooms[xRoom, yRoom].North) { for (int i = 0; i < connectorSize; i++) { yPos = roomPosition.Bottom - 1 - i; //because y is reversed image[xPos, ReverseY(yPos, image)] = Rgba32.Black; } } if (maze.Rooms[xRoom, yRoom].South) { for (int i = 0; i < connectorSize; i++) { yPos = roomPosition.Top + i; //because y is reversed image[xPos, ReverseY(yPos, image)] = Rgba32.Black; } } } } }
void RoomSelected(RoomPosition pos) { if (_currentMapRoom == null) { throw new ArgumentException("CurrentMapRoom is null"); } SetConnectedRoomsInteractable(false); GoToRoom(_mappedRooms[pos]); }
protected void CreateNodeConnectionRotations(int from, char[] facings) { char firstFacing = facings[0]; char lastFacing = facings[facings.Length - 1]; if (false) //if disable click to turn, and only use arrow keys or WASD...will need a config setting for this later { //I can move this somewhere else since these aren't local to the function anymore left = new Rect(-5, 0, 10.02f, 1.0f); right = new Rect(5, 0, 10.02f, 1.0f); } for (int i = 0; i < facings.Length; i++) { char f = facings[i]; int iBehind = facings.Length - 1; if (i - 1 >= 0) { iBehind = i - 1; } char b = facings[iBehind]; int iNext = 0; if (i + 1 < facings.Length) { iNext = i + 1; } char n = facings[iNext]; RoomPosition posLeft = new RoomPosition(from, f); RoomPosition posRight = new RoomPosition(from, n); //RoomPosition pos180Left = new RoomPosition(from, f); RoomPosition pos180LeftLeft = new RoomPosition(from, b); posLeft.filename = "_" + from.ToString() + "b" + posLeft.facing + ".avi"; //turning left posRight.filename = "_" + from.ToString() + "f" + posLeft.facing + ".avi"; //turning right CreateNodeConnection(posRight, posLeft, left); CreateNodeConnection(posLeft, posRight, right); //posLeft.filename = ""; //posRight.filename = ""; if (iBehind != iNext) { CreateNodeConnection(posRight, null, turnaround, new RoomPosition[] { posLeft, pos180LeftLeft }, 2); } else { CreateNodeConnection(posRight, posLeft, turnaround); } } /*RoomPosition fromPos = new RoomPosition(from, firstFacing); * RoomPosition toPos = new RoomPosition(from, lastFacing); * CreateNodeConnection(fromPos, toPos, left); * CreateNodeConnection(toPos, fromPos, right);*/ }
/// <summary> /// 方向绑定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBox_Position_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox ObjSender = sender as ComboBox; if (ObjSender.SelectedItem is RoomPosition) { RoomPosition position = ObjSender.SelectedItem as RoomPosition; viewModel.Position.PositionName = position.PositionName; viewModel.Position.PositionValue = position.PositionValue; } }
//*************************************************************************************************** RoomPosition FindThePos(Vector3 Position, int Level, int value) { RoomPosition Pos = RoomData[Level].RoomPositions.Find(obj => obj.Position == Position); if (Pos != null && Pos.Value == value) //print("RoomPos is: " + Pos.Position); { return(Pos); } else //print("nope"); { return(null); } }
private void OnMessagePublished(NFCTag tag) { ImageWait.IsVisible = false; ImageOk.IsVisible = true; //TagId_Label.Text = tag.TagId; //EventId_Label.Text = tag.MeetingCode; NFCController.StopAll(); SendRequest(tag.TagId); //Application.Current.MainPage.DisplayAlert("Success", "Succesfully assigned tag " + tag.TagId + " to " + currentPosition.RoomName + "/" + currentPosition.PositionNumber, "Ok"); currentPosition = null; GeneratePickerElements(); NFCController.StartListening(); }
public void GetRoomsTest() { string type = "间"; string name = "CH/PH Stock 1"; double area = 10.0; RoomPosition roomPosition = RoomPosition.overground; string strArchPath = "D://Users//zheny//Source//Repos//HVAC-Checker//HVAC-Checker//建筑.GDB"; string strHVACPath = "D://Users//zheny//Source//Repos//HVAC-Checker//HVAC-Checker//机电.GDB"; HVACFunction hvacFunction = new HVACFunction(strArchPath, strHVACPath); HVACFunction.GetRooms(type, name, area, roomPosition); }
private Room GetRoomForPathGeneration(RoomPosition type) { switch (type) { case RoomPosition.Edge: return(edgeRooms[Random.Range(0, edgeRooms.Count)]); case RoomPosition.Center: return(roomsGraph[0]); default: return(roomsGraph[Random.Range(0, roomsGraph.Count)]); } }
public bool DoorIsLocked(RoomPosition roomPosition, Direction direction) { if (!Locked) { return(false); } if (roomPosition == LockedRoomPosition && direction == LockedDoorDirection) { return(true); } return((roomPosition == KeyPadRoomPosition) && (direction == KeyPadDoorDirection)); }
public void Draw(Graphics g, int lowestX, int lowestY, Font font) { int offsetX = RoomPosition.x - lowestX; int offsetY = RoomPosition.y - lowestY; var drawLoc = new Point() { X = offsetX * roomSizeOuter.Width, Y = offsetY * roomSizeOuter.Height }; drawLoc += roomSizeOuter / 2; using var brush = new SolidBrush(RoomColor); g.FillRectangle(brush, new Rectangle(drawLoc - roomSizeInner / 2, roomSizeInner)); var stringSize = g.MeasureString(RoomPosition.ToString(), font); g.DrawString(RoomPosition.ToString(), font, Brushes.Black, (PointF)drawLoc - stringSize / 2); if (GetTop != null) { int xPos = drawLoc.X - pathWidth / 2; int yPos = drawLoc.Y - roomSizeOuter.Height / 2; g.FillRectangle(Brushes.Green, new Rectangle(xPos, yPos, pathWidth, (roomSizeOuter.Height - roomSizeInner.Height) / 2)); } if (GetRight != null) { int xPos = drawLoc.X + roomSizeInner.Width / 2; int yPos = drawLoc.Y - pathWidth / 2; g.FillRectangle(Brushes.Green, new Rectangle(xPos, yPos, (roomSizeOuter.Width - roomSizeInner.Width) / 2, pathWidth)); } if (GetBottom != null) { int xPos = drawLoc.X - pathWidth / 2; int yPos = drawLoc.Y + roomSizeInner.Height / 2; g.FillRectangle(Brushes.Green, new Rectangle(xPos, yPos, pathWidth, (roomSizeOuter.Height - roomSizeInner.Height) / 2)); } if (GetLeft != null) { int xPos = drawLoc.X - roomSizeOuter.Width / 2; int yPos = drawLoc.Y - pathWidth / 2; g.FillRectangle(Brushes.Green, new Rectangle(xPos, yPos, (roomSizeOuter.Width - roomSizeInner.Width) / 2, pathWidth)); } }
//*************************************************************************************************** bool ClearTheTop(Vector3 Position, int Level) { RoomPosition Pos = RoomData[Level].RoomPositions.Find(obj => obj.Position == Position); if (Pos != null && Pos.Value == 0) { //print("true"); return(true); } else //print("false"); { return(false); } }
private void EnqueueRooms(GameObject room, RoomPosition rp) { Room roomScript = room.GetComponent <Room>(); if (roomScript.exitDown) { Vector2 newRoomPos = new Vector2(rp.position.x, rp.position.y - 17f); if (!takenPositions.Contains(newRoomPos)) { RoomPosition newRp = new RoomPosition(newRoomPos.x, newRoomPos.y, 'D'); q.Enqueue(newRp); --numberOfRooms; takenPositions.Add(newRoomPos); } } if (roomScript.exitLeft) { Vector2 newRoomPos = new Vector2(rp.position.x - 30f, rp.position.y); if (!takenPositions.Contains(newRoomPos)) { RoomPosition newRp = new RoomPosition(newRoomPos.x, newRoomPos.y, 'L'); q.Enqueue(newRp); --numberOfRooms; takenPositions.Add(newRoomPos); } } if (roomScript.exitUp) { Vector2 newRoomPos = new Vector2(rp.position.x, rp.position.y + 17f); if (!takenPositions.Contains(newRoomPos)) { RoomPosition newRp = new RoomPosition(newRoomPos.x, newRoomPos.y, 'U'); q.Enqueue(newRp); --numberOfRooms; takenPositions.Add(newRoomPos); } } if (roomScript.exitRight) { Vector2 newRoomPos = new Vector2(rp.position.x + 30f, rp.position.y); if (!takenPositions.Contains(newRoomPos)) { RoomPosition newRp = new RoomPosition(newRoomPos.x, newRoomPos.y, 'R'); q.Enqueue(newRp); --numberOfRooms; takenPositions.Add(newRoomPos); } } }
public override void AddEntryPoint() { bool entryIsOk; int x; int y; do { x = _dungeonHelper.GetRandomInt(1, DungeonTiles.Length - 1); y = _dungeonHelper.GetRandomInt(1, DungeonTiles.Length - 1); RoomPosition.CheckRoomPosition(DungeonTiles, x, y); entryIsOk = DungeonTiles[x][y].Texture == Textures.ROOM_EDGE && CheckPos() && CheckNearbyDoor(DungeonTiles[x][y]) && CheckEdges(DungeonTiles, x, y); }while (!entryIsOk); DungeonTiles[x][y].Texture = Textures.ENTRY; }
//*************************************************************************************************** void StairLockThisLevel(RoomPosition Pos, int Level) { List <Vector3> Points = CreateVectors(Pos.Position, Pos.Position.y, 1); foreach (Vector3 Point in Points) { RoomPosition newPos = RoomData[Level].RoomPositions.Find(obj => obj.Position == Point); if (newPos != null && ((newPos.Value == 1) || (newPos.Value) == 2)) { newPos.StairLock = true; //StairLockThisLevel(newPos, Level); print("locking"); } } }
public DungeonRoom(int col, int row, int level, RoomContent content = RoomContent.None) { _position = new RoomPosition(col, row); _content = content; _connections = new List <RoomConnection>(); if (content == RoomContent.Start || content == RoomContent.Boss || content == RoomContent.None) { return; } _encounter = new EncounterData() { encounter = DataHolder._data.Encounters.GetRandomEncounter(_content), level = level, rarity = (Rarity)Random.Range(0, 5) }; }
//*************************************************************************************************** RoomPosition FindDoor() { RoomPosition Pos = new RoomPosition(); foreach (RoomLevel level in RoomData) { foreach (RoomPosition pos in level.RoomPositions) { if (pos.Value == 3) { Pos = pos; } } } return(Pos); }
public static List <string> changeRoomPositonTypeToRoomPositionString(RoomPosition positon) { List <string> roomPositionStrings = new List <string>(); if ((positon & RoomPosition.overground) != 0) { roomPositionStrings.Add("地上房间"); } else if ((positon & RoomPosition.underground) != 0) { roomPositionStrings.Add("地下室"); } else if ((positon & RoomPosition.semi_underground) != 0) { roomPositionStrings.Add("半地下室"); } return(roomPositionStrings); }
private void PositionPicker_SelectedIndexChanged(object sender, EventArgs e) { try { if (!PositionPicker.IsEnabled && positions.Count > PositionPicker.SelectedIndex) { return; } currentPosition = positions[PositionPicker.SelectedIndex]; StartWriting_Button.BackgroundColor = Color.FromHex("008B8B"); StartWriting_Button.IsEnabled = NFCController.IsEnabled; ImageWait.IsVisible = true; ImageOk.IsVisible = false; } catch (Exception exception) { Console.WriteLine("Out of range exception"); } }