コード例 #1
0
        public virtual void HandleULoadedKevinball(GhostNetConnection con, GhostNetFrame frame)
        {
            ChunkULoadedKevinball press = frame;

            ChunkMPlayer otherPlayer;

            if (!PlayerMap.TryGetValue(press.With, out otherPlayer) || otherPlayer == null ||
                frame.MPlayer.SID != otherPlayer.SID ||
                frame.MPlayer.Mode != otherPlayer.Mode
                )
            {
                // Player not in the same room.
                return;
            }

            if (!KevinballPlayerIDs.Contains(press.With))
            {
                KevinballPlayerIDs.Add(press.With);
                KevinballQueue.Add(press.With);

                //TESTING
                //KevinballPlayerIDs.Add(press.With);
                //KevinballQueue.Add(press.With);
            }

            if (!KevinballScores.ContainsKey(press.With))
            {
                KevinballScores.Add(press.With, new Vector2(0, 0));
            }

            if (ActiveKevinballMatch)
            {
                return;
            }

            if (KevinballPlayerIDs.Count - SpectatingPlayers.Count >= 2)
            {
                StartKevinball(con, frame);
            }
        }
コード例 #2
0
        public virtual void HandleULoadedKevinball(GhostNetConnection con, GhostNetFrame frame)
        {
            ChunkULoadedKevinball press = frame;

            ChunkMPlayer otherPlayer;

            if (!PlayerMap.TryGetValue(press.With, out otherPlayer) || otherPlayer == null ||
                frame.MPlayer.SID != otherPlayer.SID ||
                frame.MPlayer.Mode != otherPlayer.Mode
                )
            {
                // Player not in the same room.
                return;
            }

            if (!KevinballPlayerIDs.Contains(press.With))
            {
                KevinballPlayerIDs.Add(press.With);
                KevinballQueue.Add(press.With);

                // TESTING
                //KevinballPlayerIDs.Add(press.With);
                //KevinballQueue.Add(press.With);
            }

            if (!KevinballScores.ContainsKey(press.With))
            {
                KevinballScores.Add(press.With, new Vector2(0, 0));
            }

            if (ActiveKevinballMatch)
            {
                return;
            }

            if (KevinballPlayerIDs.Count - SpectatingPlayers.Count >= 2)
            {
                if (FirstKevinballMatch)
                {
                    GhostNetFrame shuffle_frame = new GhostNetFrame
                    {
                        HHead = new ChunkHHead
                        {
                            PlayerID = uint.MaxValue
                        }
                    };

                    uint randomLevel = PickRandomLevel();
                    CurrentKevinballLevel = randomLevel;

                    ChunkMKevinballShuffle chunk = new ChunkMKevinballShuffle
                    {
                        NextLevel = randomLevel
                    };

                    shuffle_frame.Add(chunk);
                    PropagateM(shuffle_frame);
                    FirstKevinballMatch = false;
                }

                StartKevinball(con, frame);
            }
        }