Esempio n. 1
0
 public void TransitToRoom(RoomTransitionWaypointData roomData)
 {
     Debug.Log("Transiting to room: " + roomData.roomToTransitTo.ToString());
     currentRoom = roomData.roomToTransitTo;
     mainCamara.transform.position = roomData.newCamaraPosistion;
     player.transform.position     = roomData.newPlayerPosistion;
 }
Esempio n. 2
0
 public void CreateGameRoom(User player, GameRoom gameRoom)
 {
     if (player == null || gameRoom == null)
     {
         return;
     }
     GameRooms.Add(gameRoom.Id, gameRoom);
     player.GameRoomRef = gameRoom;
 }
Esempio n. 3
0
 public void RemoveGameRoom(User leader, GameRoom gameRoom)
 {
     if (leader == null || gameRoom == null)
     {
         return;
     }
     if (gameRoom.Leader.Id == leader.Id)
     {
         gameRoom.ClearPlayers(leader.Id);
         GameRooms.Remove(gameRoom.Id);
     }
 }
Esempio n. 4
0
 public GameRoom LookupGameRoom(User user, string gameRoomId, out string errMsg)
 {
     errMsg = string.Empty;
     if (user == null)
     {
         return(null);
     }
     if (!GameRooms.ContainsKey(gameRoomId ?? ""))
     {
         errMsg = string.Format(Constants.Instance.ErrorMessage.Cant_Find_Game_Room, gameRoomId);
         return(null);
     }
     return(GameRooms[gameRoomId]);
 }
Esempio n. 5
0
 public List <GameRoom> GetGameRooms()
 {
     return(GameRooms.Select(x => x.Value).ToArray().ToList());
 }
Esempio n. 6
0
 public int CreateRoom(int teamCount, string gameRoomName, int theGameRoomsHostClientID)
 {
     GameRooms.Add(GenerateManageeID(), new GameRoom(teamCount, gameRoomName));
     return(IDSeed);
 }
Esempio n. 7
0
 public static string GetSaveFilePath(GameRooms game_room, GameplaySpeeds gameplay_speed) => game_room + "_" + gameplay_speed + ".txt";
Esempio n. 8
0
 public ButtonLevel(int x, int y, GameRooms game_room) : base(x, y, 150, 84)
 {
     this.ShouldDrawBorder = false;
     this.GameRoom         = game_room;
     this.IsUnlocked       = this.DetermineIsUnlocked();
 }
Esempio n. 9
0
 public int GetRoomsQty()
 {
     return(GameRooms.Count());
 }
Esempio n. 10
0
 public GameRoom TryToLookupRoom(string gameRoomId)
 {
     return(GameRooms.ContainsKey(gameRoomId ?? "") ? GameRooms[gameRoomId] : null);
 }
Esempio n. 11
0
        private bool WaitForStartingInfo(NetClient client, out string msg)
        {
            var time = DateTime.Now;

            NetIncomingMessage inc;

            while (true)
            {
                if (DateTime.Now.Subtract(time).Seconds > 10)
                {
                    msg = "Couldn't find server";
                    return(false);
                }
                if ((inc = client.ReadMessage()) == null)
                {
                    continue;
                }

                switch (inc.MessageType)
                {
                case NetIncomingMessageType.Data:
                    if (inc.ReadByte() == (byte)PacketTypes.StartState)
                    {
                        var count1 = inc.ReadInt32();

                        GameRooms.Clear();
                        for (int i = 0; i < count1; i++)
                        {
                            var tempRoom = new GameRoom();
                            tempRoom.Name = inc.ReadString();
                            GameRooms.Add(tempRoom);
                        }

                        msg = "Successfully connected to lobby";
                        return(true);
                    }
                    break;

                case NetIncomingMessageType.StatusChanged:
                    switch ((NetConnectionStatus)inc.ReadByte())
                    {
                    //When connected to the server
                    case NetConnectionStatus.Connected:
                        break;

                    //When disconnected from the server
                    case NetConnectionStatus.Disconnected:
                    {
                        string reason = inc.ReadString();
                        if (string.IsNullOrEmpty(reason))
                        {
                            msg = "Connection denied";
                            return(false);
                        }
                        msg = "Connection denied, reason: " + reason;
                        return(false);
                    }
                    break;
                    }
                    break;
                }
            }
        }