Ejemplo n.º 1
0
 void OnAfterJoinRoom(JoinRoomEvent e)
 {
     if (e.ZoneId == GameManager.Instance.channelRoom.zoneId && e.RoomId == GameManager.Instance.channelRoom.roomId)
     {
         GameManager.LoadScene(ESceneName.ChannelTLMN);
     }
 }
Ejemplo n.º 2
0
 protected async Task HandleJoinRoom(JoinRoomEvent jre)
 {
     if (jre.Started)
     {
         Navigation.NavigateTo("lobby");
     }
 }
Ejemplo n.º 3
0
 private void OnAfterJoinRoom(JoinRoomEvent e)
 {
     if (e.RoomName == "chan_giaidau")
     {
         GameManager.LoadScene(ESceneName.ChannelLeague);
     }
 }
Ejemplo n.º 4
0
        public async Task JoinRoom(string roomId, UserModel user)
        {
            JoinRoomEvent jre = await _roomService.JoinRoom(roomId, user, Context.ConnectionId);

            if (jre == null)
            {
                await Clients.Caller.SendAsync("JoinRoomEvent", new JoinRoomEvent()
                {
                    Started = true
                });

                return;
            }
            await Groups.RemoveFromGroupAsync(Context.ConnectionId, "lobby");

            await Groups.AddToGroupAsync(Context.ConnectionId, roomId);

            await Clients.Caller.SendAsync("JoinRoomEvent", jre);

            await Clients.GroupExcept(roomId, Context.ConnectionId).SendAsync("UserJoinedRoom", user);

            Context.Items["room"] = roomId;
            await SendRoom(roomId);

            if (jre.Users.Count == 1)
            {
                await _roomService.SetRoomHost(roomId, Room);
            }
        }
Ejemplo n.º 5
0
    void OnAfterJoinRoom(JoinRoomEvent e)
    {
        if (cbSavePass.value)
        {
            if (IsClickButtonLogin)
            {
                StoreGame.SaveString(StoreGame.EType.SAVE_USERNAME, lableUsername.value);
                StoreGame.SaveString(StoreGame.EType.SAVE_PASSWORD, lablePassword.value);
            }
        }
        //else
        //{
        //    StoreGame.Remove(StoreGame.EType.SAVE_ACCESSTOKEN);
        //    StoreGame.Remove(StoreGame.EType.SAVE_USERNAME);
        //    StoreGame.SaveString(StoreGame.EType.SAVE_PASSWORD, lablePassword.text);
        //}
        //OK Next Scene

        if (GameManager.Instance.selectedLobby.gameId != 0)
        {
            return;
        }
        WaitingView.Hide();
        NotificationView.Instance.HideMessageView();
        GameManager.LoadScene(ESceneName.HallSceen);
    }
Ejemplo n.º 6
0
 void OnAfterJoinRoom(JoinRoomEvent e)
 {
     if (e.ZoneId == GameManager.Instance.channelRoom.zoneId && e.RoomId == GameManager.Instance.channelRoom.roomId)
     {
         GameManager.LoadScene(ESceneName.ChannelPhom);
     }
     //else if (e.ZoneId == GameManager.Instance.selectedLobby.zoneId && e.RoomId == GameManager.Instance.selectedLobby.roomId)
     //    GameManager.LoadScene(ESceneName.Gameplay);
 }
Ejemplo n.º 7
0
 private void OnAfterJoinRoom(JoinRoomEvent e)
 {
     if (e.RoomId == currentShow.info.roomId && e.ZoneId == currentShow.info.zoneId)
     {
         GameManager.Instance.currentTournamentInfo = currentShow.info;
         TournamentInfo info = GameManager.Instance.currentTournamentInfo;
         GameManager.LoadScene(ESceneName.Tournament);
     }
 }
Ejemplo n.º 8
0
 void OnAfterJoinRoom(JoinRoomEvent e)
 {
     if (e.RoomName == "hall")
     {
         GameManager.LoadScene(ESceneName.HallSceen);
     }
     else
     {
         GameManager.LoadScene(ESceneName.LobbyPhom);
     }
 }
Ejemplo n.º 9
0
 void OnAfterJoinRoom(JoinRoomEvent e)
 {
     if (e.RoomName.Trim() == "chan_giaidau")
     {
         GameManager.Instance.currentRoomGiaiDau = new RoomInfo(e.ZoneId, e.RoomId);
         GameManager.LoadScene(ESceneName.ChannelLeague);
     }
     else if (e.RoomName == "hall")
     {
         GameManager.LoadScene(ESceneName.HallSceen);
     }
     else
     {
         GameManager.LoadScene(ESceneName.LobbyChan);
     }
 }
Ejemplo n.º 10
0
        public async Task <JoinRoomEvent> JoinRoom(string roomId, UserModel user, string connectionid)
        {
            RoomModel room = await _rooms.GetRoomById(roomId);

            if (room == null || room.Settings.Slots <= room.UsersOnline || room.Started)
            {
                return(null);
            }
            user.Token = connectionid;
            user.Id    = Guid.NewGuid().ToString();
            room.Users.Add(user);
            await _rooms.Save(roomId, room);

            JoinRoomEvent jre = room.Adapt <JoinRoomEvent>();

            jre.Token  = user.Token;
            jre.RoomId = roomId;
            jre.UserId = user.Id;
            return(jre);
        }
Ejemplo n.º 11
0
    protected virtual void OnJoinRoom(JoinRoomEvent e)
    {
        Debug.Log("Current Room Saved!!! - " + this.GetType().ToString() + ": " + "Join to room:" + e.RoomName + " - ZoneID, RooID: " + e.ZoneId + "," + e.RoomId);
        //Rời room cũ trước khi Join vào room mới (Chỉ có lần đầu Join là không cần rời)
        if (GameManager.CurrentScene != ESceneName.LoginScreen && doJoiningRoom != null && GameManager.CurrentScene != ESceneName.GameplayChan)
        {
            doJoiningRoom = null;
            DoLeaveCurrentRoom();
        }

        if (GameManager.CurrentScene != ESceneName.ChannelLeague)
        {
            GameManager.Instance.currentRoomGiaiDau = new RoomInfo(e.ZoneId, e.RoomId);
        }

        GameManager.Instance.currentRoom = new RoomInfo(e.ZoneId, e.RoomId);
        if (EventJoinRoom != null)
        {
            //Debug.Log(LogEvent(EventJoinRoom));
            EventJoinRoom(e);
        }
        WaitingView.Instance.Close();
    }
Ejemplo n.º 12
0
    private void OnAfterJoinRoom(JoinRoomEvent e)
    {
        WaitingView.Hide();
        //lưu lại thông tin channel select to back button
        GameManager.Instance.channelRoom = new RoomInfo(e.ZoneId, e.RoomId);
        switch (e.RoomName.ToLower())
        {
        case "phom":
            GameManager.LoadScene(ESceneName.ChannelPhom);
            break;

        case "tlmn":
            GameManager.LoadScene(ESceneName.ChannelTLMN);
            break;

        case "chan":
            GameManager.LoadScene(ESceneName.ChannelChan);
            break;

        default:
            Debug.LogError("Cannot find any game");
            break;
        }
    }
Ejemplo n.º 13
0
        public async Task Reconnect(ReconnectToGameEvent e, string connectionid)
        {
            RoomModel room = await _rooms.GetRoomById(e.RoomId);

            UserModel user = room.Users.First(u => u.Token == e.Token && u.Disconnected);

            if (user == null)
            {
                throw new ArgumentException();
            }
            user.Disconnected = false;
            user.Token        = connectionid;
            JoinRoomEvent jre = room.Adapt <JoinRoomEvent>();

            jre.Token  = user.Token;
            jre.RoomId = e.RoomId;
            jre.UserId = user.Id;
            await _hub.Clients.Client(connectionid).SendAsync("JoinRoomEvent", jre);

            await _hub.Groups.AddToGroupAsync(connectionid, e.RoomId);

            await _hub.Clients.Client(connectionid).SendAsync("UpdateGameState", room.Game);

            await _hub.Clients.GroupExcept(e.RoomId, connectionid)
            .SendAsync("UserJoinedRoom", user.Adapt <UserJoinedRoomEvent>());

            List <Task> cards = new();

            foreach (CardModel card in user.CardDeck)
            {
                cards.Add(_hub.Clients.Client(connectionid).SendAsync("RefillCards", card));
            }
            await Task.WhenAll(cards);

            await _rooms.Save(e.RoomId, room);
        }
Ejemplo n.º 14
0
 public void OnJoinRoomEvent(object sender, JoinRoomEventArgs e)
 {
     JoinRoomEvent?.Invoke(sender, e);
 }
Ejemplo n.º 15
0
    private void OnJoinRoom(JoinRoomEvent evt)
    {
        Debug.Log("Joined a room!");
        waitingMessage = "Joined a room!";

        string descript = evt.RoomDescription;
        if (descript == LobbyConstants.PLUGIN_NAME)
        {
			//grab and store the reference to the room you just joined, IF it is a lobby room
            room = _es.ManagerHelper.ZoneManager.ZoneById(evt.ZoneId).RoomById(evt.RoomId);
            waitingMessage = "REVERSI LOBBY";
            inLobby = true;
        }
    }
Ejemplo n.º 16
0
    /**
     * Fired when the JoinRoomEvent is received by the client.
     */
    private void OnJoinRoom(JoinRoomEvent evt)
    {
        Log("Joined a room!");

        //grab and store the reference to the room you just joined
        room = _es.ManagerHelper.ZoneManager.ZoneById(evt.ZoneId).RoomById(evt.RoomId);

        SendMessage("SpawnLocalPlayer", _userName);

        // ask plugin for the full user list
        sendUserListRequest();
    }
Ejemplo n.º 17
0
 public async Task UserJoinRoom(JoinRoomEvent session) => await _signalr.HubConnection.SendAsync("UserJoinRoom", session);
Ejemplo n.º 18
0
    private void OnJoinRoom(JoinRoomEvent evt)
    {
        Debug.Log("Joined a room!");
        waitingMessage = "Joined a room!";

    	//grab and store the reference to the room you just joined
        room = _es.ManagerHelper.ZoneManager.ZoneById(evt.ZoneId).RoomById(evt.RoomId);
        waitingMessage = "Waiting for game to start";
        inGame = false;  // wait until the game starts to display the board
        sendInitMeRequest();
    }
Ejemplo n.º 19
0
 public async Task UserJoinRoom(JoinRoomEvent data)
 {
     await JoinRoom(data.RoomId, data.User);
 }