Eventy upraveny pro podporu dvou hráčů. Všechny dveře se zobrazují na správných pozicích pro oba hráče.
This commit is contained in:
parent
cea56112ea
commit
3049417914
18 changed files with 157 additions and 75 deletions
|
|
@ -9,8 +9,8 @@ namespace FNAF_Clone.GUI;
|
|||
public class Screen {
|
||||
|
||||
public static Dictionary<string, Screen> Screens = new();
|
||||
public static Screen CurrentScreen{ get; private set; }
|
||||
|
||||
public static Screen CurrentScreen{ get; private set; } = Empty;
|
||||
|
||||
public static void AddScreens(Screen[] screens) {
|
||||
foreach (var screen in screens){
|
||||
Screens.Add(screen.Label, screen);
|
||||
|
|
@ -33,6 +33,8 @@ public class Screen {
|
|||
Screens.Remove(id);
|
||||
}
|
||||
|
||||
public static Screen Empty => new("");
|
||||
|
||||
|
||||
public string Label;
|
||||
private Dictionary<string, UIElement> elements = new();
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ public class UIManager {
|
|||
int j1 = j;
|
||||
Point point1 = new Point(336 + (32 * i), 144 + (32 * j));
|
||||
Point point2 = new Point(367 + (32 * i), 175 + (32 * j));
|
||||
monitorScreen.AddElement($"room{MapTileProjection.CoordsToId(i, 4 - j)}", new UIElement(point1, point2)
|
||||
{Pressable = true, OnMousePress = (() => CommandManager.SendChangeCamera(MapTileProjection.CoordsToId(i1, 4 - j1)))});
|
||||
monitorScreen.AddElement($"room{ClientMapManager.CoordsToId(i, 4 - j)}", new UIElement(point1, point2)
|
||||
{Pressable = true, OnMousePress = (() => CommandManager.SendChangeCamera(ClientMapManager.Get((i1, 4 - j1)).Id))});
|
||||
//
|
||||
// if (doorPositions.ContainsKey((i, j))){
|
||||
// monitorScreen.AddElement("door"+doorPositions[(i, j)], new UIElement([monitorAtlas[5], monitorAtlas[6]], point1));
|
||||
|
|
@ -75,7 +75,7 @@ public class UIManager {
|
|||
int targetId = door.Tiles.tile1.GridPosition.y > door.Tiles.tile2.GridPosition.y ? door.Tiles.tile1.Id : door.Tiles.tile2.Id;
|
||||
UIElement tile = monitorScreen["room"+targetId];
|
||||
|
||||
monitorScreen.AddElement("door"+targetId+"-"+(targetId == door.Tiles.tile1.Id ? door.Tiles.tile2.Id : door.Tiles.tile1.Id), new UIElement([monitorAtlas[5], monitorAtlas[6]], tile.Bounds.Item1));
|
||||
monitorScreen.AddElement("door"+Math.Max(door.Tiles.tile1.Id, door.Tiles.tile2.Id)+"-"+Math.Min(door.Tiles.tile1.Id, door.Tiles.tile2.Id), new UIElement([monitorAtlas[5], monitorAtlas[6]], tile.Bounds.Item1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,8 +87,8 @@ public class UIManager {
|
|||
monitorScreen.AddElement("p2-office-door-left", new UIElement([monitorAtlas[17], monitorAtlas[18]], new Point(400, 144)));
|
||||
|
||||
}
|
||||
|
||||
public static void ChangeDoorState(Direction dir, bool state) { // TODO: make this also change for p2
|
||||
|
||||
public static void ChangeDoorState(Direction dir, bool state) {
|
||||
int stateInt = state ? 1 : 0;
|
||||
|
||||
switch ((int)dir){
|
||||
|
|
@ -106,6 +106,22 @@ public class UIManager {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChangeDoorStateOpponent(Direction dir, bool state) { // TODO: overload to avoid excessive casting
|
||||
int stateInt = state ? 1 : 0;
|
||||
|
||||
switch ((int)dir){
|
||||
case 0:
|
||||
monitorScreen["p2-office-door-left"].SetTexture(stateInt);
|
||||
break;
|
||||
case 1:
|
||||
monitorScreen["p2-office-door-centre"].SetTexture(stateInt);
|
||||
break;
|
||||
case 2:
|
||||
monitorScreen["p2-office-door-right"].SetTexture(stateInt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChangeRemoteDoorState((int, int) id, bool state) {
|
||||
monitorScreen["door"+Math.Max(id.Item1, id.Item2)+"-"+Math.Min(id.Item1, id.Item2)].SetTexture(state ? 1 : 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue