public void Init(SessionManager manager, GameRoom.GameRoomSession session, Bet bet)
 {
     _manager = manager;
     _session = session;
     _bet = bet;
 }
        public void Init(SessionManager manager, GameRoom.GameRoomSession session)
        {
            _manager = manager;
            _session = session;

            _description = _session.GameRoom.Description;
            _password = _session.GameRoom.Password;
            _isBetting = _session.GameRoom.IsBetting;
            _isTeamBotPlaced = _session.GameRoom.IsTeamBotPlaced;
            _bettingType = _session.GameRoom.BettingType == null ? "1v1" : _session.GameRoom.BettingType;
            _isAdvertising = _session.GameRoom.IsAdvertising;
            _members = _session.GameRoom.Members;
            //temporary admins view does not include owner cause he cannot be disabled now, later admins must be initialized with complete list
            //_admins = session.GameRoom.Admins;
            _admins = session.GameRoom.AdminsWithoutOwner;
            _notAdmins = session.GameRoom.MembersNotAdmins;

            PrepareControls();
        }
        public void Init(SessionManager manager, GameRoom.GameRoomSession session)
        {
            _manager = manager; // the mediator and messaging service (sort of)
            _session = session; // the model (sort of)

            // socket membership messages trigger on the session, so update room's membership when session members change
            _session.Membership.CollectionChanged += Membership_CollectionChanged;
            _session.GameRoom.PropertyChanged += GameRoom_PropertyChanged;
            _session.RoomBets.CollectionChanged += RoomBets_CollectionChanged;
            _session.MyMatch.PropertyChanged += MyMatch_PropertyChanged;
            _session.ChatMessageReceived += ChatMessages_CollectionChanged;

            _mutedMembersIds = new List<string>();
            InitMembership();
        }
        public void JoinChatroom(string id, string password = null)
        {
            ChatroomSessionBase chatroomSession;
            if (_chatroomUsage.TryGetValue(id, out chatroomSession))
            {
                if (chatroomSession.State == ChatroomState.New)
                    return;// we are already joining
                else if (chatroomSession.State == ChatroomState.Connected)
                {
                    chatroomSession.ShowControl(true);// show it
                    return;
                }
                // else state == invited, so join it
            }

            if (id.StartsWith(PrefixGameLobby))
            {
                var gameId = id.Substring(PrefixGameLobby.Length);
                HomeTab.LauncherInfo gameInfo;
                if (_userData.TryGetGame(gameId, out gameInfo))
                {
                    var session = new Lobby.LobbySession(this, gameInfo);
                    session.LoadGameRoomsComplete += session_LoadGameRoomsComplete;
                    session.LoadGameRooms();
                    chatroomSession = session;
                }
            }
            else if (id.StartsWith(PrefixGameRoom))
            {
                var gameRoomId = id.Substring(PrefixGameRoom.Length);
                Lobby.LobbySession lobbySession;
                Lobby.GameRoomItem gameRoomItem;
                if (!TryGetGameRoomAndSession(gameRoomId, out lobbySession, out gameRoomItem))
                {
                    Lobby.LobbySession.LookupGameRoom(_userData, gameRoomId, JoinLobbyAndGameRoom);
                    return;
                }

                var gameRoomSession = new GameRoom.GameRoomSession(this, lobbySession, gameRoomItem);
                chatroomSession = gameRoomSession;
            }
            else
                chatroomSession = new ChatroomSession(this);

            chatroomSession.ChatroomId = id;

            _chatroomUsage[id] = chatroomSession;

            var chatroom = new Chatroom { _id = id };
            var joinChatroom = (password == null)
                ? chatroom
                : new ChatroomWithPassword { _id = id, password = password, };
            ChatroomUserJoin(joinChatroom);
            ChatroomMemberGetList(chatroom);
        }
 public void GameRoomJoining(GameRoomSession gameRoomSession)
 {
     gameRoomSession.SessionStateChanged += gameRoomSession_SessionStateChanged;
 }