Ejemplo n.º 1
0
        protected void LoadReplay()
        {
            if (score.isOnline)
            {
                OnlineLoadReplay(score_GotReplayData);
            }
            else
            {
                if (score.replay == null || score.replay.Count == 0)
                {
                    score.ReadReplayData();
                }

                if (score.replay != null && score.replay.Count > 0)
                {
                    AudioEngine.PlaySample(AudioEngine.s_MenuHit);

                    StreamingManager.StopSpectating(false);

                    InputManager.ReplayMode  = true;
                    InputManager.ReplayScore = score;
                    GameBase.ChangeMode(Modes.Play);
                }
                else
                {
                    GameBase.ShowMessage("This score has no replay data saved!", Color.Red, 5000);
                }
            }
        }
Ejemplo n.º 2
0
        public void SetSpectate(int userId)
        {
            if (!GameBase.Tournament || GameBase.FadeState != FadeStates.Idle)
            {
                return;
            }

            GameBase.Scheduler.Add(delegate
            {
                User found = BanchoClient.GetUserById(userId);
                if (found != null && found == StreamingManager.CurrentlySpectating)
                {
                    if (GameBase.TourneySpectatorName != null)
                    {
                        GameBase.TourneySpectatorName.Text = found.Name;
                    }
                    return;
                }

                StreamingManager.StopSpectating();
                if (found != null)
                {
                    found.BeatmapId              = 0;
                    found.BeatmapName            = string.Empty;
                    found.CurrentBeatmapChecksum = string.Empty;
                    StreamingManager.StartSpectating(found);
                }
            });
        }
Ejemplo n.º 3
0
        protected void score_GotReplayData(object sender)
        {
            score.GotReplayData -= score_GotReplayData;


            LoadingReplay = false;

            if (score.Replay != null && score.Replay.Count > 0)
            {
                NotificationManager.ClearMessageMassive();

                StreamingManager.StopSpectating(false);

                AudioEngine.PlaySamplePositional(@"menuhit");
                InputManager.ReplayMode  = true;
                InputManager.ReplayScore = score;
                Player.Seed = score.Seed;
                GameBase.ChangeMode(OsuModes.Play);
            }
            else
            {
                NotificationManager.ShowMessageMassive("Replay data is not available for this play!", 2000);
                spriteManagerWideScrolling.BlacknessTarget = 0;
                b_replay.FadeOut(100);
                b_replay.HandleInput = false;
            }
        }
Ejemplo n.º 4
0
        protected void LoadReplay()
        {
            if (score.IsOnline)
            {
                OnlineLoadReplay(score_GotReplayData);
            }
            else
            {
                if (score.Replay == null || score.Replay.Count == 0)
                {
                    if (score.ReplayCompressed == null) //SaveToDisk nulls this when it activates.
                    {
                        score.LoadLocalData();
                    }

                    score.ReadReplayData();
                }

                if (score.Replay != null && score.Replay.Count > 0)
                {
                    AudioEngine.PlaySamplePositional(@"menuhit");

                    StreamingManager.StopSpectating(false);

                    InputManager.ReplayMode  = true;
                    InputManager.ReplayScore = score;
                    Player.Seed = score.Seed;
                    GameBase.ChangeMode(OsuModes.Play);
                }
                else
                {
                    NotificationManager.ShowMessage("This score has no replay data saved!", Color.Red, 5000);
                }
            }
        }
Ejemplo n.º 5
0
        protected void score_GotReplayData(object sender)
        {
            score.GotReplayData -= score_GotReplayData;

            LoadingReplay = false;

            if (score.replay != null)
            {
                StreamingManager.StopSpectating(false);

                AudioEngine.PlaySample(AudioEngine.s_MenuHit);
                InputManager.ReplayMode  = true;
                InputManager.ReplayScore = score;
                GameBase.ChangeMode(Modes.Play);
            }
            else
            {
                Console.WriteLine("error");
            }
        }
Ejemplo n.º 6
0
        public void ReloadDatabase()
        {
            GameBase.Scheduler.Add(delegate
            {
                if (!GameBase.Tournament)
                {
                    return;
                }
                if (GameBase.FadeState != FadeStates.Idle)
                {
                    return;
                }

                BeatmapManager.Initialize(true);

                if (GameBase.Mode != OsuModes.Play)
                {
                    StreamingManager.StopSpectating();
                    StreamingManager.StartSpectating(StreamingManager.CurrentlySpectating);
                }
            });
        }
Ejemplo n.º 7
0
        public override void Initialize()
        {
            StreamingManager.StopSpectating(false);

            content = new ResourceContentManager(GameBase.Instance.Services, ResourcesStore.ResourceManager);

            spriteManager = new SpriteManager();

            BanchoClient.OnConnect      += BanchoClient_OnConnect;
            KeyboardHandler.OnKeyRepeat += KeyboardHandler_OnKeyRepeat;

            pText headerText =
                new pText("Multiplayer Lobby", 30, new Vector2(0, 0), 0.955F, true, new Color(255, 255, 255, 255));

            spriteManager.Add(headerText);

            pText headerText2 = new pText("Let's play together!", 16, new Vector2(4, 26), 0.955F, true,
                                          new Color(255, 255, 255, 255));

            spriteManager.Add(headerText2);

            pSprite bgf =
                new pSprite(content.Load <Texture2D>("lobby-background"), FieldTypes.Window, OriginTypes.TopLeft,
                            ClockTypes.Game, Vector2.Zero, 0, true, Color.White);

            spriteManager.Add(bgf);

            pAnimation back =
                new pAnimation(SkinManager.LoadAll("menu-back"), FieldTypes.Window,
                               OriginTypes.TopLeft,
                               ClockTypes.Game,
                               new Vector2(0, 480), 0.8F, true, new Color(255, 255, 255, (byte)(255 * 0.6)));

            back.SetFramerateFromSkin();
            back.OriginPosition = new Vector2(0, 146);
            back.OnClick       += back_OnClick;
            back.IsClickable    = true;
            back.HoverEffect    = new Transformation(TransformationType.Fade, 0.6F, 1, 0, 300);
            spriteManager.Add(back);

            pButton pbut = new pButton("New Game", new Vector2(270, 285), new Vector2(350, 30), 0.92f, new Color(99, 139, 228), OnCreateGame);

            spriteManager.Add(pbut.SpriteCollection);

            //pbut = new pButton("Join Game", new Vector2(270, 285), new Vector2(140, 30), 0.92f, new Color(99, 139, 228), OnCreateGame);
            //spriteManager.Add(pbut.SpriteCollection);

            pbut = new pButton("Back to Menu", new Vector2(10, 285), new Vector2(250, 30), 0.92f, new Color(235, 160, 62), back_OnClick);
            spriteManager.Add(pbut.SpriteCollection);

            lobbyUserList =
                new pText("", 12, new Vector2(560, 65), 1, true, Color.White);
            lobbyUserList.TextBold = true;
            spriteManager.Add(lobbyUserList);

            noMatches               = new pText("There are no matches available.\nClick 'New Game' to start a new game!", 20, new Vector2(280, 115), new Vector2(400, 0), 1, true, Color.White, false);
            noMatches.TextBold      = true;
            noMatches.CurrentColour = Color.TransparentWhite;
            noMatches.TextAlignment = Alignment.Centre;
            noMatches.OriginType    = OriginTypes.Centre;
            gameList.spriteManager.Add(noMatches);

            base.Initialize();

            JoinLobby();

            LobbyUpdatePending = true;

            GameBase.LoadComplete();

            if (!ChatEngine.IsVisible)
            {
                if (ChatEngine.IsFullVisible)
                {
                    ChatEngine.ToggleFull();
                }
                ChatEngine.Toggle();
            }
        }
Ejemplo n.º 8
0
        public override void Initialize()
        {
            MatchSetup.Match = null;

            StreamingManager.StopSpectating(false);

            text_noMatchFound = LocalisationManager.GetString(OsuString.Lobby_NoMatch);
            text_loading      = LocalisationManager.GetString(OsuString.General_Loading);

            spriteManager = new SpriteManager(true);

            spriteManagerFilters = new SpriteManager(true);
            //spriteManagerFilters.Alpha = 0;
            spriteManagerFilters.SetVisibleArea(new RectangleF(0, content_y - filters_height, 640, filters_height));

            BanchoClient.OnConnect      += BanchoClient_OnConnect;
            KeyboardHandler.OnKeyRepeat += KeyboardHandler_OnKeyRepeat;

            pText headerText =
                new pText(LocalisationManager.GetString(OsuString.Lobby_Header), 24, new Vector2(0, 0), 0.955F, true, new Color(255, 255, 255, 255));

            spriteManager.Add(headerText);

            headerText2 = new pText(text_loading, 12, new Vector2(170, 8), 0.955F, true,
                                    new Color(255, 255, 255, 255));
            spriteManager.Add(headerText2);


            //pSprite bgf =
            //    new pSprite(TextureManager.Load(@"lobby-background"), Fields.TopLeft, Origins.TopLeft,
            //                Clocks.Instance, Vector2.Zero, 0, true, Color.White);
            //spriteManager.Add(bgf);

            pSprite p = new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.TopLeft, Clocks.Game, new Vector2(0, content_y - filters_height), 0.1f, true, new Color(0, 0, 0, 180));

            p.Scale       = 1.6f;
            p.VectorScale = new Vector2(GameBase.WindowManager.WidthScaled, content_height + filters_height + 30);
            spriteManager.Add(p);

            int button_height = content_y + content_height + 2;

            pButton pbut = new pButton(LocalisationManager.GetString(OsuString.Lobby_NewGame), new Vector2(GameBase.WindowManager.WidthScaled / 2 - 100, button_height), new Vector2(200, 25), 0.92f, new Color(99, 139, 228), OnCreateGame);

            spriteManager.Add(pbut.SpriteCollection);

            pbut = new pButton(LocalisationManager.GetString(OsuString.Lobby_QuickJoin), new Vector2(GameBase.WindowManager.WidthScaled / 2 + 110, button_height), new Vector2(200, 25), 0.92f, Color.YellowGreen, OnQuickJoin);
            spriteManager.Add(pbut.SpriteCollection);

            pbut = new pButton(LocalisationManager.GetString(OsuString.Lobby_BackToMenu), new Vector2(GameBase.WindowManager.WidthScaled / 2 - 310, button_height), new Vector2(200, 25), 0.92f, new Color(235, 160, 62), back_OnClick);
            spriteManager.Add(pbut.SpriteCollection);

            noMatches               = new pText(text_loading, 18, new Vector2(GameBase.WindowManager.WidthScaled / 2, 180), new Vector2(400, 0), 1, true, Color.White, false);
            noMatches.TextBold      = true;
            noMatches.Alpha         = 0;
            noMatches.TextAlignment = TextAlignment.Centre;
            noMatches.Origin        = Origins.Centre;
            spriteManager.Add(noMatches);

            sortingTabs = new pTabCollection(spriteManager, 6, new Vector2(50, 40), 0.98f, false,
                                             Color.Crimson);
            sortingTabs.Add(LocalisationManager.GetString(OsuString.Lobby_All), -1);
            sortingTabs.Add(OsuCommon.PlayModeString(PlayModes.Osu), (int)PlayModes.Osu);
            sortingTabs.Add(OsuCommon.PlayModeString(PlayModes.Taiko), (int)PlayModes.Taiko);
            sortingTabs.Add(OsuCommon.PlayModeString(PlayModes.CatchTheBeat), (int)PlayModes.CatchTheBeat);
            sortingTabs.Add(OsuCommon.PlayModeString(PlayModes.OsuMania), (int)PlayModes.OsuMania);
            sortingTabs.SetSelected(ConfigManager.sLobbyPlayMode.Value, true);
            sortingTabs.OnTabChanged += delegate { ConfigManager.sLobbyPlayMode.Value = (int)sortingTabs.SelectedTab.Tag; LobbyUpdatePending = true; };

            checkExistingMaps = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_ExistMapOnly), 0.8f, new Vector2(5, 2), 1, ConfigManager.sLobbyShowExistingOnly);
            spriteManagerFilters.Add(checkExistingMaps.SpriteCollection);

            checkExistingMaps.OnCheckChanged +=
                delegate(object sender, bool status)
            {
                ConfigManager.sLobbyShowExistingOnly.Value = status;
                LobbyUpdatePending = true;
            };

            checkFriendsOnly = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_FriendOnly), 0.8f, new Vector2(5, 19), 1, ConfigManager.sLobbyShowFriendsOnly);
            spriteManagerFilters.Add(checkFriendsOnly.SpriteCollection);

            checkFriendsOnly.OnCheckChanged +=
                delegate(object sender, bool status)
            {
                ConfigManager.sLobbyShowFriendsOnly.Value = status;
                LobbyUpdatePending = true;
            };

            checkInProgress = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_InProgress), 0.8f, new Vector2(360, 19), 1, ConfigManager.sLobbyShowInProgress);
            spriteManagerFilters.Add(checkInProgress.SpriteCollection);

            checkInProgress.OnCheckChanged +=
                delegate(object sender, bool status)
            {
                ConfigManager.sLobbyShowInProgress.Value = status;
                LobbyUpdatePending = true;
            };

            checkShowFullGames = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_ShowFull), 0.8f, new Vector2(180, 2), 1, ConfigManager.sLobbyShowFull);
            spriteManagerFilters.Add(checkShowFullGames.SpriteCollection);

            checkShowFullGames.OnCheckChanged += delegate(object sender, bool status)
            {
                ConfigManager.sLobbyShowFull.Value = status;
                LobbyUpdatePending = true;
            };

            checkShowPasswordedGames = new pCheckbox(LocalisationManager.GetString(OsuString.Lobby_ShowLocked), 0.8f, new Vector2(180, 19), 1, ConfigManager.sLobbyShowPassworded);
            spriteManagerFilters.Add(checkShowPasswordedGames.SpriteCollection);

            checkShowPasswordedGames.OnCheckChanged +=
                delegate(object sender, bool status)
            {
                ConfigManager.sLobbyShowPassworded.Value = status;
                LobbyUpdatePending = true;
            };

            pText pt = new pText(LocalisationManager.GetString(OsuString.Lobby_Search), 14, new Vector2(360, 2), 1, true, Color.White);

            spriteManagerFilters.Add(pt);

            filterTextBox             = new pTextBox(string.Empty, 14, new Vector2(360 + pt.MeasureText().X, 2), 134, 1);
            filterTextBox.LengthLimit = 20;
            filterTextBox.OnChange   += delegate
            {
                LobbyUpdatePending = true;

                if (filterTextBox.Text.Length > 0)
                {
                    checkFriendsOnly.Hide();
                    checkShowFullGames.Hide();
                    checkShowPasswordedGames.Hide();
                    checkExistingMaps.Hide();
                    sortingTabs.SetSelected(-1, true);
                }
                else
                {
                    checkFriendsOnly.Show();
                    checkShowFullGames.Show();
                    checkShowPasswordedGames.Show();
                    checkExistingMaps.Show();
                    sortingTabs.SetSelected(ConfigManager.sLobbyPlayMode.Value, true);
                }
            };
            spriteManagerFilters.Add(filterTextBox.SpriteCollection);

            //buttonFilters = new pButton(LocalisationManager.GetString(OsuString.Lobby_Filters), new Vector2(390, 32), new Vector2(100, 20), 1, Color.YellowGreen, toggleFilters);
            //spriteManager.Add(buttonFilters.SpriteCollection);

            base.Initialize();

            if (BeatmapManager.Current == null || string.IsNullOrEmpty(BeatmapManager.Current.ContainingFolder) || !BeatmapManager.Current.BeatmapPresent)
            {
                MusicControl.ChooseRandomSong(true);
            }

            JoinLobby();

            LobbyUpdatePending = true;
        }
Ejemplo n.º 9
0
 private void buttonEndReplay_OnClick(object sender, EventArgs e)
 {
     StreamingManager.StopSpectating(true);
     player.Status = PlayerStatus.ExitingSpectator;
 }