コード例 #1
0
        private async void TeamQueueButton_Click(object sender, RoutedEventArgs e)
        {
            //To leave all other queues
            await LeaveAllQueues();

            InQueue    = false;
            LastSender = (Button)sender;
            GameQueueConfig config = (GameQueueConfig)LastSender.Tag;

            //Make Teambuilder work for duo
            if (config.Id != 61 && config.TypeString != "BOT")
            {
                if (Queues.Contains(config.Id))
                {
                    return;
                }
                Queues.Add(config.Id);
                MatchMakerParams parameters = new MatchMakerParams();
                parameters.QueueIds = new Int32[] { Convert.ToInt32(config.Id) };
                Client.GameQueue    = Convert.ToInt32(config.Id);
                LobbyStatus Lobby = await Client.PVPNet.createArrangedTeamLobby(Convert.ToInt32(config.Id));

                Client.ClearPage(typeof(TeamQueuePage));
                Client.SwitchPage(new TeamQueuePage(Lobby.InvitationID, Lobby));
            }
            else if (config.TypeString == "BOT")
            {
            }
            else
            {
                LobbyStatus Lobby = await Client.PVPNet.createArrangedTeamLobby(Convert.ToInt32(config.Id));

                Client.SwitchPage(new TeamBuilderPage(true, Lobby));
            }
        }
コード例 #2
0
        /// <summary>
        ///     When invited to a team
        /// </summary>
        public TeamQueuePage(string Invid, LobbyStatus NewLobby = null, bool IsReturningToLobby = false)
        {
            InitializeComponent();
            if (Client.Dev)
            {
                CreateRankedCheckBox.Visibility = Visibility.Visible;
                SelectChamp.Visibility          = Visibility.Visible;
            }
            else
            {
                AutoAcceptCheckBox.Margin       = new Thickness(0, 0, 657, 202);
                InstaCall.Margin                = new Thickness(0, 0, 572, 200);
                CreateRankedCheckBox.Visibility = Visibility.Hidden;
                SelectChamp.Visibility          = Visibility.Hidden;
            }
            Change();

            Client.InviteListView            = InviteListView;
            Client.PVPNet.OnMessageReceived += Update_OnMessageReceived;

            //MainWindow Window = new MainWindow();
            //Window.Hide();
            //Opps
            Invite       = Invid;
            CurrentLobby = NewLobby;
            if (!IsReturningToLobby)
            {
                LoadStats();
            }

            Client.CurrentPage             = this;
            Client.ReturnButton.Visibility = Visibility.Visible;
            Client.ReturnButton.Content    = "Return to Lobby";
        }
コード例 #3
0
        public RemotingMessageReceivedEventArgs HandleMessage(object sender, RemotingMessageReceivedEventArgs e)
        {
            SummonerClient summonerClient = sender as SummonerClient;

            var payload = new LobbyStatus
            {
                Owner = new InvitationPlayer
                {
                    SummonerId   = 1,
                    SummonerName = "Maufeat",
                },
                Members = new ArrayCollection
                {
                    new Member
                    {
                        SummonerId              = 1,
                        SummonerName            = "Maufeat",
                        HasDelegatedInvitePower = false
                    }
                },
                Invitees = new ArrayCollection
                {
                },
                InvitationId = "",
                GameMetaData = "{\"mapId\":11,\"gameMode\":\"CLASSIC\",\"gameMutators\":[],\"gameType\":\"NORMAL_GAME\",\"queueId\":2,\"isRanked\":false,\"gameId\":1,\"groupFinderId\":\"00000000-0000-0000-0000-000000000000\",\"gameTypeConfigId\":18}",
            };

            e.ReturnRequired = true;
            e.Data           = payload;

            return(e);
        }
コード例 #4
0
 private void Accept_Click(object sender, RoutedEventArgs e)
 {
     if (_gameType == "PRACTICE_GAME")
     {
         Client.PVPNet.Accept(_invitationId);
         Client.SwitchPage(new CustomGameLobbyPage(tempDTO));
     }
     //goddammit teambuilder
     else if (_gameType == "NORMAL_GAME" && _queueId != 61)
     {
         Client.SwitchPage(new TeamQueuePage(_invitationId));
     }
     else if (_gameType == "NORMAL_GAME" && _queueId == 61)
     {
         LobbyStatus newLobby = Client.PVPNet.InviteLobby;
         Client.SwitchPage(new TeamBuilderPage(false, newLobby));
     }
     else if (_gameType == "RANKED_GAME")
     {
         Client.SwitchPage(new TeamQueuePage(_invitationId));
     }
     else if (_gameType == "RANKED_TEAM_GAME")
     {
         Client.SwitchPage(new TeamQueuePage(_invitationId));
     }
     Visibility = Visibility.Hidden;
     Client.InviteData.Remove(_invitationId);
 }
コード例 #5
0
 public LobbyListItem(int id, string host_name, LobbyStatus status, int player_count)
 {
     this.id     = id;
     hostName    = host_name;
     this.status = status;
     playerCount = player_count;
 }
コード例 #6
0
 private void Update_OnMessageReceived(object sender, MessageReceivedEventArgs message)
 {
     if (message.Body.GetType() == typeof(LobbyStatus))
     {
         var Lobby = message.Body as LobbyStatus;
         CurrentLobby = Lobby;
         RenderLobbyData();
     }
     else if (message.Body is GameDTO)
     {
         var QueueDTO = message.Body as GameDTO;
         Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
         {
             if (QueueDTO.GameState == "TERMINATED")
             {
                 Client.HasPopped = false;
                 Client.RiotConnection.MessageReceived += GotQueuePop;
             }
         }));
     }
     else if (message.Body is GameNotification)
     {
         Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
         {
             setStartButtonText("Start Game");
             inQueue = false;
             Client.inQueueTimer.Visibility = Visibility.Hidden;
         }));
     }
     else if (message.Body is SearchingForMatchNotification)
     {
         Dispatcher.BeginInvoke(DispatcherPriority.Input,
                                new ThreadStart(() => { EnteredQueue(message.Body as SearchingForMatchNotification); }));
     }
     else if (message.Body is InvitePrivileges)
     {
         Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
         {
             var priv = message.Body as InvitePrivileges;
             if (priv.canInvite)
             {
                 var tr  = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd);
                 tr.Text = "You may invite players to this game." + Environment.NewLine;
                 tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Yellow);
                 InviteButton.IsEnabled = true;
             }
             else
             {
                 var tr  = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd);
                 tr.Text = "You may no longer invite players to this game." + Environment.NewLine;
                 tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Yellow);
                 InviteButton.IsEnabled = false;
             }
         }));
     }
     else if (message.Body is LcdsServiceProxyResponse)
     {
         parseLcdsMessage(message.Body as LcdsServiceProxyResponse); //Don't look there, its ugly!!! :)))
     }
 }
コード例 #7
0
ファイル: Lobby.cs プロジェクト: Crystallinqq/osu-2005
        private void OnCreateGame(object sender, EventArgs e)
        {
            if (!BanchoClient.Connected)
            {
                GameBase.ShowMessage("You must be connected to bancho before creating a game.");
                return;
            }

            if (Status == LobbyStatus.PendingCreate)
            {
                return;
            }


            if (BeatmapManager.BeatmapAvailable.Count == 0)
            {
                GameBase.ShowMessage("No beatmaps available!");
                return;
            }
            if (BeatmapManager.Current == null)
            {
                BeatmapManager.Current = BeatmapManager.BeatmapAvailable[0];
            }

            Status = LobbyStatus.PendingCreate;
            BanchoClient.SendRequest(RequestType.Osu_MatchCreate,
                                     new bMatch(MatchType.RankedVs, ConfigManager.sUsername + "'s game", BeatmapManager.Current.DisplayTitle, BeatmapManager.Current.BeatmapChecksum,
                                                BeatmapManager.Current.BeatmapId, Mods.None));
        }
コード例 #8
0
 public LobbyInfo(Guid LobbyId, int LobbyPort, Guid LobbyLeader)
 {
     this.LobbyId     = LobbyId;
     this.LobbyPort   = LobbyPort;
     this.LobbyLeader = LobbyLeader;
     this.LobbyStatus = LobbyStatus.AWAITING_START;
 }
コード例 #9
0
        internal static void LeaveLobby(bool changeMode)
        {
            if (!Joined)
            {
                return;
            }
            Joined = false;

            Matches.Clear();
            BanchoClient.SendRequest(RequestType.Osu_LobbyPart, null);

            if (Status == LobbyStatus.Idle)
            {
                ChatEngine.RemoveChannel(@"#lobby");

                if (!chatOpenOnStart)
                {
                    ChatEngine.HideChat();
                }

                Status = LobbyStatus.NotJoined;
            }

            if (changeMode)
            {
                AudioEngine.PlaySamplePositional(@"menuback");
                Status = LobbyStatus.NotJoined;
                GameBase.ChangeMode(OsuModes.Menu);
            }
        }
コード例 #10
0
ファイル: Lobby.cs プロジェクト: MexicanMan/Trapping
 private void EndStartCount(object obj)
 {
     if (players.Count == 2)
     {
         List <Player> gamePlayers = players.Values.ToList();
         for (int i = 0; i < gamePlayers.Count; i++)
         {
             if (gamePlayers[i].Status != PlayerStatus.Ready)
             {
                 return;
             }
         }
         status = LobbyStatus.Started;
         GM     = new GameManager(this);
         Field f = GM.InitializeSimpleGame(gamePlayers[0].PlayerToken, gamePlayers[0].Nickname,
                                           gamePlayers[1].PlayerToken, gamePlayers[1].Nickname);
         for (int i = 0; i < gamePlayers.Count; i++)
         {
             Player p = gamePlayers[i];
             Router.SendMessage(p.WSContext, "START_GAME", new WSStartGame(f));
         }
         TimerCallback tm = new TimerCallback(StartRun);
         StartCount = new Timer(tm, null, (int)PrepareTime.TotalMilliseconds, Timeout.Infinite);
     }
 }
コード例 #11
0
ファイル: Lobby.cs プロジェクト: Crystallinqq/osu-2005
        internal static void LeaveLobby(bool changeMode)
        {
            if (!Joined)
            {
                return;
            }
            Joined = false;

            Matches.Clear();
            BanchoClient.SendRequest(RequestType.Osu_LobbyPart, null);

            if (Status == LobbyStatus.Idle)
            {
                if (!chatOpenOnStart && ChatEngine.IsVisible)
                {
                    ChatEngine.Toggle(true);
                }
                Status = LobbyStatus.NotJoined;
            }

            if (changeMode)
            {
                AudioEngine.PlaySample(AudioEngine.s_MenuBack);
                GameBase.ChangeMode(Modes.Menu);
            }
        }
コード例 #12
0
        public async void LoadStats()
        {
            i                  = 10;
            PingTimer          = new Timer(1000);
            PingTimer.Elapsed += new ElapsedEventHandler(PingElapsed);
            PingTimer.Enabled  = true;
            PingElapsed(1, null);
            InviteButton.IsEnabled    = false;
            StartGameButton.IsEnabled = false;

            if (CurrentLobby == null)
            {
                //Yay fixed lobby. Riot hates me still though. They broke this earlier, except I have fixed it
                CurrentLobby = await Client.PVPNet.getLobbyStatus();
            }
            string ObfuscatedName = Client.GetObfuscatedChatroomName(CurrentLobby.InvitationID.Replace("INVID", "invid"), ChatPrefixes.Arranging_Game); //Why do you need to replace INVID with invid Riot?
            string JID            = Client.GetChatroomJID(ObfuscatedName, CurrentLobby.ChatKey, false);

            newRoom                    = Client.ConfManager.GetRoom(new jabber.JID(JID));
            newRoom.Nickname           = Client.LoginPacket.AllSummonerData.Summoner.Name;
            newRoom.OnRoomMessage     += newRoom_OnRoomMessage;
            newRoom.OnParticipantJoin += newRoom_OnParticipantJoin;
            newRoom.Join(CurrentLobby.ChatKey);


            ///Way smarter way then just putting the code here

            RenderLobbyData();
        }
コード例 #13
0
 private void Accept_Click(object sender, RoutedEventArgs e)
 {
     if (gameType == "PRACTICE_GAME")
     {
         Client.SwitchPage(new CustomGameLobbyPage());
     }
     //goddammit teambuilder
     else if (gameType == "NORMAL_GAME" && queueId != 61)
     {
         LobbyStatus NewLobby = Client.PVPNet.InviteLobby;
         Client.SwitchPage(new TeamQueuePage(InvitationId));
     }
     else if (gameType == "NORMAL_GAME" && queueId == 61)
     {
         LobbyStatus NewLobby = Client.PVPNet.InviteLobby;
         Client.SwitchPage(new TeamBuilderPage(false));
     }
     else if (gameType == "RANKED_GAME")
     {
         LobbyStatus NewLobby = Client.PVPNet.InviteLobby;
         //NewLobby = await Client.PVPNet.getLobbyStatus(InvitationId);
         Client.SwitchPage(new TeamQueuePage(InvitationId));
     }
     this.Visibility = Visibility.Hidden;
 }
コード例 #14
0
        protected override void GotLobbyStatus(LobbyStatus status)
        {
            lobbyStatus = status;

            if (ChatLobby == null)
            {
                ChatLobby = new GroupChat(RiotChat.GetLobbyRoom(status.InvitationID, status.ChatKey), status.ChatKey);
            }

            foreach (var raw in status.InvitedPlayers)
            {
                if (!Invitees.ContainsKey(raw.SummonerId))
                {
                    var invitee = new LobbyInvitee(raw, this);
                    Invitees.Add(invitee.SummonerID, invitee);
                    OnMemberJoined(invitee);
                }
            }

            if (GroupData != null)
            {
                UpdateSlots();
            }

            if (!loaded)
            {
                OnLoaded();
            }
        }
コード例 #15
0
        /// <summary>
        /// When invited to a team
        /// </summary>
        /// <param name="Message"></param>
        public TeamQueuePage(string Invid, LobbyStatus NewLobby = null, bool IsReturningToLobby = false, bool isranked = false)
        {
            InitializeComponent();
            Client.InviteListView            = InviteListView;
            Client.PVPNet.OnMessageReceived += Update_OnMessageReceived;

            //MainWindow Window = new MainWindow();
            //Window.Hide();
            //Opps
            Invite       = Invid;
            CurrentLobby = NewLobby;
            if (!IsReturningToLobby)
            {
                LoadStats();
            }

            if (isranked)
            {
                DevMode = true;
            }

            Client.CurrentPage             = this;
            Client.ReturnButton.Visibility = Visibility.Visible;
            Client.ReturnButton.Content    = "Return to Lobby";
        }
コード例 #16
0
        private async void QueueButton_Click(object sender, RoutedEventArgs e)
        {
            //to queue
            if (InQueue == false)
            {
                LastSender = (Button)sender;
                GameQueueConfig config = (GameQueueConfig)LastSender.Tag;
                //Make TeamBuilder Work for solo
                if (config.Id != 61)
                {
                    if (Queues.Contains(config.Id))
                    {
                        return;
                    }
                    Queues.Add(config.Id);
                    MatchMakerParams parameters = new MatchMakerParams();
                    parameters.QueueIds = new Int32[] { Convert.ToInt32(config.Id) };
                    Client.QueueId      = config.Id;
                    Client.PVPNet.AttachToQueue(parameters, new SearchingForMatchNotification.Callback(EnteredQueue));
                }
                else if (config.Id == 61)
                {
                    LobbyStatus Lobby = await Client.PVPNet.createArrangedTeamLobby(Convert.ToInt32(config.Id));

                    Client.ClearPage(typeof(TeamBuilderPage));
                    Client.SwitchPage(new TeamBuilderPage(false, Lobby));
                }
                return;
            }
            else if (InQueue == true)
            {
                InQueue = false;
                await LeaveAllQueues();
            }
        }
コード例 #17
0
        public static void OnJoinFail()
        {
            MatchSetup.Match = null;

            NotificationManager.ShowMessageMassive(LocalisationManager.GetString(OsuString.Lobby_Join_Fail), 2000);
            AudioEngine.PlaySample(@"match-leave");
            Status = GameBase.Mode == OsuModes.Lobby ? LobbyStatus.Idle : LobbyStatus.NotJoined;
        }
コード例 #18
0
 private void Update_OnMessageReceived(object sender, object message)
 {
     if (message.GetType() == typeof(LobbyStatus))
     {
         //why did I do this... I don't actually know
         LobbyStatus Lobbystatus = message as LobbyStatus;
     }
 }
コード例 #19
0
        private async void TeamQueueButton_Click(object sender, RoutedEventArgs e)
        {
            if (IsInGame())
            {
                return;
            }
            //To leave all other queues
            await LeaveAllQueues();

            InQueue    = false;
            LastSender = (Button)sender;
            var settings = (QueueButtonConfig)LastSender.Tag;
            var config   = settings.GameQueueConfig;

            //Make Teambuilder work for duo
            if (config.Id == 41 || config.Id == 42)
            {
                if (Queues.Contains(config.Id))
                {
                    return;
                }

                Queues.Add(config.Id);
                Client.QueueId = config.Id;
                TeamSelect teamSelectWindow = new TeamSelect();

                Client.FullNotificationOverlayContainer.Content    = teamSelectWindow.Content;
                Client.FullNotificationOverlayContainer.Visibility = Visibility.Visible;
            }
            else if (config.Id != 61 && !config.TypeString.Contains("BOT"))
            {
                if (Queues.Contains(config.Id))
                {
                    return;
                }

                Queues.Add(config.Id);
                Client.QueueId = config.Id;
                LobbyStatus lobby = await RiotCalls.CreateArrangedTeamLobby(config.Id);

                Client.ClearPage(typeof(TeamQueuePage));
                Client.SwitchPage(new TeamQueuePage(lobby.InvitationID, lobby));
            }
            else if (config.TypeString.Contains("BOT"))
            {
                Queues.Add(config.Id);
                LobbyStatus lobby = await RiotCalls.CreateArrangedBotTeamLobby(config.Id, settings.BotLevel);

                Client.ClearPage(typeof(TeamQueuePage));
                Client.SwitchPage(new TeamQueuePage(lobby.InvitationID, lobby, false, null, settings.BotLevel));
            }
            else
            {
                LobbyStatus lobby = await RiotCalls.CreateArrangedTeamLobby(config.Id);

                Client.SwitchPage(new TeamBuilderPage(true, lobby));
            }
        }
コード例 #20
0
ファイル: Instance.cs プロジェクト: doivosevic/Summoning
        private void OnLobbyStatus(object lobbyStatus)
        {
            if (_inQueue)
            {
                return;
            }
            var status = lobbyStatus as LobbyStatus;

            var players = Globals.Configuration.Dominion ? 10 : 6;

            if (Globals.Configuration.Dominion3v3)
            {
                players = 6;
            }

            if (Globals.Configuration.MaxBots == 1)
            {
                players = 1;
            }
            if (Globals.Configuration.CoopVsAI)
            {
                _lobbyStatus = status;
                players      = 5;
            }

            if (status.Owner.SummonerName == _account.Username && !_inQueue && status.Members.Length != players)
            {
                Log.Write("[{2}] Waiting on bots to join {0}/{1}", status.Members.Length, players, _account.Username);
                return;
            }

            if (status.Members.Length == players && Master && !Globals.Configuration.CoopVsAI && _currentGame != null)
            {
                Log.Write("[{0}] Starting Champion Select! ({1}/{2} players)", _account.Username, players, status.Members.Length);
                _client.StartChampionSelect(_currentGame.id, _currentGame.optimisticLock);
                return;
            }

            lock (_queueLock)
            {
                if (Globals.Configuration.CoopVsAI && status.Members.Length == players && Master && !_inQueue && status.InvitedPlayers.Length == players)
                {
                    var mmp = new MatchMakerParams();
                    mmp.InvitationId = _lobbyStatus.InvitationID;
                    mmp.QueueIds     = new Int32[1] {
                        (int)_queueId
                    };
                    mmp.BotDifficulty = "MEDIUM";
                    mmp.Team          = new List <int>();

                    status.Members.ForEach(m => mmp.Team.Add((int)m.SummonerId));
                    Log.Write("Attaching to queue");
                    var attachTask = _client.attachTeamToQueue(mmp);
                    _inQueue = true;
                }
            }
        }
コード例 #21
0
ファイル: Lobby.cs プロジェクト: harrisonheld/Discord-Hex-Bot
        public void SuspendGame(UserInfo info)
        {
            if (instance == null)
            {
                return;
            }

            //instance.End(info);
            status = LobbyStatus.Waiting;
        }
コード例 #22
0
        private async void SelectTeam_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            LobbyStatus lobby = await Client.PVPNet.createArrangedRankedTeamLobby(Client.QueueId, TeamList.SelectedItem.ToString());

            TeamId SelectedTeamId = TeamIdList[TeamList.SelectedIndex];

            Client.ClearPage(typeof(TeamQueuePage));
            Client.SwitchPage(new TeamQueuePage(lobby.InvitationID, lobby, false, SelectedTeamId));
            Client.FullNotificationOverlayContainer.Visibility = Visibility.Hidden;
        }
コード例 #23
0
ファイル: StartPage.xaml.cs プロジェクト: Stijnn/DrawniteIO
        private async void OnConnectBttn(object sender, RoutedEventArgs e)
        {
            string username = await(Application.Current.MainWindow as MainWindow).ShowInputAsync("Connect", "You clicked connect");

            this.NetworkConnection.Write(new DrawniteCore.Networking.Data.Message("player/join", new
            {
                LobbyId = Guid.Parse(txtLobbyId.Text)
            }));

            DrawniteCore.Networking.Data.Message returnMessage = null;
            ManualResetEvent receivedSignal = new ManualResetEvent(false);

            this.NetworkConnection.OnReceived += async(client, message) =>
            {
                returnMessage = message;
                receivedSignal.Set();
            };
            receivedSignal.WaitOne();

            int  lobbyPort = returnMessage.Data.LobbyInfo.LobbyPort;
            bool result    = this.NetworkClient.Forward(new System.Net.IPEndPoint(IPAddress.Parse(Constants.SERVER_IP), lobbyPort));

            if (result)
            {
                this.NetworkConnection.Write(new Message("player/join", new
                {
                    Username = username,
                    GUID     = returnMessage.Data.PlayerGuid
                }));
            }

            LobbyStatus gameState   = returnMessage.Data.LobbyInfo.LobbyStatus;
            Guid        lobbyId     = returnMessage.Data.LobbyInfo.LobbyId;
            Guid        playerId    = returnMessage.Data.PlayerGuid;
            Guid        lobbyLeader = returnMessage.Data.LobbyInfo.LobbyLeader;

            switch (gameState)
            {
            case LobbyStatus.AWAITING_START:
                this.NavigationService.Navigate(new LobbyPage(lobbyId, playerId, playerId == lobbyLeader));
                break;

            case LobbyStatus.PLAYING:
                this.NavigationService.Navigate(new GamePage(lobbyId, playerId));
                break;

            case LobbyStatus.AWAITING_RESTART:

                break;

            default:

                break;
            }
        }
コード例 #24
0
        public static void JoinMatch(int matchId, string password = null)
        {
            if (Status == LobbyStatus.PendingJoin)
            {
                return;
            }

            NotificationManager.ShowMessageMassive(LocalisationManager.GetString(OsuString.Lobby_Join), 1500);
            BanchoClient.SendRequest(RequestType.Osu_MatchJoin, new bMatchJoin(matchId, password ?? MatchSetup.Match.gamePassword));
            Status = LobbyStatus.PendingJoin;
        }
コード例 #25
0
ファイル: Lobby.cs プロジェクト: Crystallinqq/osu-2005
 private static void JoinLobby()
 {
     if (Joined)
     {
         return;
     }
     Joined = true;
     Matches.Clear();
     Status = LobbyStatus.Idle;
     BanchoClient.SendRequest(RequestType.Osu_LobbyJoin, null);
 }
コード例 #26
0
        internal static void JoinLobby()
        {
            if (Joined)
            {
                return;
            }
            Joined = true;
            Matches.Clear();
            Status = LobbyStatus.Idle;
            BanchoClient.SendRequest(RequestType.Osu_LobbyJoin, null);

            ChatEngine.SwapChannel(ChatEngine.AddChannel(@"#lobby"));
        }
コード例 #27
0
ファイル: Lobby.cs プロジェクト: MexicanMan/Trapping
 public void ConnectPlayer(Player pl)
 {
     if (!players.ContainsKey(pl.PlayerToken))
     {
         players.Add(pl.PlayerToken, pl);
         Router.RegisterLobbyRoute(pl.PlayerToken, this);
         pl.Status = PlayerStatus.Connecting;
         TimerCallback tm = new TimerCallback(ConnectTimeout);
         t = new Timer(tm, pl.PlayerToken, (int)ConnectTime.TotalMilliseconds, Timeout.Infinite);
         if (PlayersNumber == 2)
         {
             status = LobbyStatus.Full;
         }
     }
 }
コード例 #28
0
        private bool OnLobbyStatus(LobbyStatus status)
        {
            if (state == null)
            {
                return(true);
            }
            state.IsCaptain = status.Owner.SummonerId == session.Me.SummonerId;

            state.Invitees = (from old in status.Invitees
                              where old.InviteeState != "CREATOR"
                              select new LobbyInvitee(old)).ToList();

            OnStateChanged();
            return(true);
        }
コード例 #29
0
ファイル: QueueLobby.cs プロジェクト: GooogleTHT/LGcl2
        protected virtual void GotLobbyStatus(LobbyStatus status)
        {
            lobbyStatus = status;

            if (ChatLobby == null)
            {
                ChatLobby = new GroupChat(RiotChat.GetLobbyRoom(status.InvitationID, status.ChatKey), status.ChatKey);
            }

            var todo = status.Members.ToDictionary(m => m.SummonerId);

            foreach (var member in Members)
            {
                Member raw;
                if (todo.TryGetValue(member.SummonerID, out raw))
                {
                    member.Update(raw);
                    todo.Remove(member.SummonerID);
                }
                else
                {
                    Members.Remove(member);
                    OnMemberLeft(member);
                }
            }

            foreach (var raw in todo.Values)
            {
                var member = new QueueLobbyMember(raw, this);
                Members.Add(member);
                OnMemberJoined(member);
            }

            foreach (var raw in status.InvitedPlayers)
            {
                if (!Invitees.ContainsKey(raw.SummonerId))
                {
                    var invitee = new LobbyInvitee(raw, this);
                    Invitees.Add(invitee.SummonerID, invitee);
                    OnMemberJoined(invitee);
                }
            }
            if (!loaded)
            {
                OnLoaded();
            }
        }
コード例 #30
0
ファイル: Lobby.cs プロジェクト: Crystallinqq/osu-2005
        public static void OnJoinSuccess()
        {
            AudioEngine.PlaySample("match-join");
            switch (Status)
            {
            case LobbyStatus.PendingCreate:
                MatchSetup.IsHost = true;
                Status            = LobbyStatus.Setup;
                break;

            case LobbyStatus.PendingJoin:
                MatchSetup.IsHost = false;
                Status            = LobbyStatus.Setup;
                break;
            }
            GameBase.ChangeMode(Modes.MatchSetup);
        }
コード例 #31
0
 private void clickedStart()
 {
     this.form.Close();
     this.status = LobbyStatus.Starting;
 }