Beispiel #1
0
        public override void Update(GameTime gameTime)
        {
            if (!BanchoClient.Connected && GameBase.FadeState == FadeStates.Idle)
            {
                GameBase.ChangeMode(Modes.Menu);
                GameBase.ShowMessage("Multiplayer will not work unless Bancho is connected!");
            }

            if (LobbyUpdatePending)
            {
                string lobbyUsers = "";
                lock (BanchoClient.Users)
                {
                    List <User> users = BanchoClient.Users.FindAll(u => u.InLobby);
                    foreach (User user in users)
                    {
                        lobbyUsers += user.Name + "\n";
                    }
                }

                lobbyUserList.Text = lobbyUsers.Trim('\n');

                int x = 0;

                lock (Matches)
                {
                    Matches.Sort();

                    if (Matches.Count > 0)
                    {
                        foreach (Match m in Matches)
                        {
                            if (m.DrawAt(new Vector2(0, x)))
                            {
                                gameList.spriteManager.Add(m.SpriteCollection);
                            }
                            x += 27;
                        }
                        noMatches.FadeOut(0);
                    }
                    else
                    {
                        noMatches.FadeIn(500);
                    }
                }

                gameList.SetContentDimensions(new Vector2(540, x + 50));

                LobbyUpdatePending = false;
            }

            gameList.Update(gameTime);

            base.Update(gameTime);
        }
Beispiel #2
0
        public override void Update()
        {
            if (scrollableArea == null)
            {
                return;
            }

#if ARCADE
            IdleHandler.Check(10000);
#endif
            scrollableArea.Update();

            if (onlineRankingButton != null)
            {
                if (scrollableArea.ScrollPosition.Y > 20)
                {
                    onlineRankingButton.Hide();
                }
                else
                {
                    onlineRankingButton.Show();
                }
            }

            int currentTime = GameBase.Time - startTime;

            int digitsVisible = currentTime / 500;

            if (s_score1 != null)
            {
                string built = string.Empty;
                for (int i = 0; i < stringTotalScore.Length; i++)
                {
                    if (i >= digitsVisible)
                    {
                        built += RNG.Next(0, 9).ToString()[0];
                    }
                    else
                    {
                        built += stringTotalScore[i];
                    }
                }

                s_score1.Text = built;
            }

            if (currentTime > 4400 && !ReplayMode)
            {
                PopupRecord();
            }

            base.Update();
        }
Beispiel #3
0
        public override void Update()
        {
            UpdateSelected();
            base.Update();
            scrollableView.Update();

            MusicControl.SpriteManager.Alpha = 1;

            if (!searchBox.HasFocus || !searchBox.InputControl.AcceptText)
            {
                searchBox.Focus(true);
            }

            if (searchTime > 0 && searchTime < GameBase.Time)
            {
                searchTime = -1;
                layout();
            }
        }
Beispiel #4
0
 public override void Update()
 {
     area.Update();
     base.Update();
 }
 public override void Update()
 {
     base.Update();
     pa.Update();
 }
Beispiel #6
0
 public override void Update()
 {
     channelButtonList.Update();
     base.Update();
 }
Beispiel #7
0
        public override void Update()
        {
            if (!BanchoClient.Connected && GameBase.FadeState == FadeStates.Idle)
            {
                GameBase.ChangeMode(OsuModes.Menu);
                NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Lobby_Bancho_Fail));
            }

            spriteManager.Blackness = LobbyStatus.Idle != Status ? 0.6f : 0;

            if (LobbyUpdatePending)
            {
                int x = 0;

                lock (Matches)
                {
                    Matches.Sort();

                    int visibleMatches = 0;

                    foreach (LobbyMatch m in Matches)
                    {
                        if (CheckFilter(m))
                        {
                            visibleMatches++;

                            bool firstDraw = m.DrawAt(new Vector2(3, x));

                            if (firstDraw || m.Filtered)
                            {
                                m.SpriteCollection.ForEach(s => s.FadeInFromZero(500));
                            }

                            if (firstDraw)
                            {
                                areaGameList.ContentSpriteManager.Add(m.SpriteCollection);
                            }

                            m.Filtered = false;

                            x += 49;
                        }
                        else
                        {
                            if (!m.Filtered)
                            {
                                if (m.SpriteCollection != null)
                                {
                                    m.SpriteCollection.ForEach(s => s.FadeOut(300));
                                }
                                m.Filtered = true;
                            }
                        }
                    }

                    headerText2.Text = string.Format(LocalisationManager.GetString(OsuString.Lobby_FilteredMatches), visibleMatches, Matches.Count);

                    if (visibleMatches > 0)
                    {
                        noMatches.FadeOut(50);
                    }
                    else
                    {
                        noMatches.Text = BanchoClient.InitializationComplete ? text_noMatchFound : text_loading;
                        noMatches.FadeIn(50);
                    }
                }

                areaGameList.SetContentDimensions(new Vector2(640, x + 50));

                LobbyUpdatePending = false;
            }

            areaGameList.Update();
            base.Update();
        }
Beispiel #8
0
        public override void Update()
        {
            searchTextBox.MaintainFocus = !ChatEngine.IsVisible;

            bool searchReady;

            if (lastSearch == null)
            {
                lastSearch = @"Newest";
                searching  = false;

                ExecuteSearch(true);
                searchReady = false;
            }
            else
            {
                searchReady = nextSearchUpdate >= 0 && nextSearchUpdate <= GameBase.Time;
            }

            if (searchReady)
            {
                bool newData = searchTextBox.Text != lastSearch;
                if (searchTextBox.Text.Length == 0)
                {
                    if (newData && lastSearch != @"Newest" && lastSearch != @"Top Rated" && lastSearch != @"Most Played")
                    {
                        lastSearch = @"Newest";
                        ExecuteSearch(true);
                    }
                }
                else if (!searching && newData)
                {
                    lastSearch = searchTextBox.Text;
                    ExecuteSearch(true);

                    nextSearchUpdate = -1;
                }
            }
            resultsPane.Update();

            if (resultsPane.ScrollPosition.Y > resultsPane.ContentDimensions.Y - resultsPane.DisplayRectangle.Height && canLoadMore && !searching)
            {
                pageOffset++;
                ExecuteSearch(false);
            }

            if (newResults)
            {
                loadingText.FadeOut(200);
                int i = 0;
                lock (Beatmaps)
                {
                    foreach (OnlineBeatmap b in Beatmaps)
                    {
                        if (b.DrawAt(new Vector2(10, i)))
                        {
                            resultsPane.ContentSpriteManager.Add(b.SpriteCollection);
                        }
                        i += 30;
                    }
                }
                resultsPane.SetContentDimensions(new Vector2(640, i + 30));

                searching  = false;
                newResults = false;
            }
            base.Update();
        }
Beispiel #9
0
        public override void Update()
        {
            downloadListPanel.Update();

            if (sampleTrack != null)
            {
                if (sampleTrack.IsPlaying && !disallowAudioPreview)
                {
                    sampleTrack.Volume = AudioEngine.VolumeMusicAdjusted / 100f;

                    if (!AudioEngine.Paused)
                    {
                        WasPlayingAudio = true;
                        AudioEngine.TogglePause();
                    }
                }
                else
                {
                    ResetAudioPreview();
                }
            }

            if (ResponseQueue.Count > 0)
            {
                ShowResponseDialog(ResponseQueue.Dequeue());
            }

            if (GameBase.Mode == OsuModes.Play && !Player.Paused && !InputManager.ReplayMode) //allow showing response dialog only in pause
            {
                HideResponseDialog();
            }

            if (ActiveDownloads.Count > 0 || RespondingBeatmap != null)
            {
                delayClose = true;
            }
            else if (GameBase.Mode == OsuModes.OnlineSelection)
            {
                delayClose = false;
            }

            alwaysShow = GameBase.Mode == OsuModes.OnlineSelection || RespondingBeatmap != null;
            mustHide   = ActiveDownloads.Count == 0 && !alwaysShow;

            if (!mustHide &&
                (alwaysShow ||
                 (!Player.Playing &&
                  (background.drawRectangle.Contains(MouseManager.MousePoint) ||
                   MouseManager.MousePosition.X > GameBase.WindowManager.Width))))
            {
                Show();
            }
            else
            {
                Hide();
            }

            if (UpdatePending)
            {
                int y = 0;

                int ActiveCount = ActiveDownloads.FindAll(d => d.Status > DownloadStatus.Waiting).Count;

                UpdatePending = false;

                for (int i = 0; i < ActiveDownloads.Count; i++)
                {
                    OsuDirectDownload d = ActiveDownloads[i];

                    if (d.Status == DownloadStatus.Waiting && ActiveCount < MAX_CONCURRENT_DOWNLOADS)
                    {
                        d.Start();
                        ActiveCount++;
                    }
                    else if (d.Status == DownloadStatus.Completed)
                    {
                        if (d.SpriteCollection != null)
                        {
                            foreach (pSprite p in d.SpriteCollection)
                            {
                                if (Visible || (Player.Playing && !ConfigManager.sPopupDuringGameplay.Value))
                                {
                                    p.FadeOut(300);
                                }
                                else
                                {
                                    downloadListPanel.ContentSpriteManager.Remove(p);
                                    GameBase.spriteManagerOverlay.Add(p);

                                    p.Field = Fields.TopRight;

                                    p.Position = new Vector2(XPOSHIDDEN, p.Position.Y + YPOS + 20);

                                    p.FadeOut(2500);
                                    p.MoveTo(new Vector2(XPOS, p.Position.Y), 800, EasingTypes.Out);
                                }
                                p.AlwaysDraw = false;
                            }
                        }
                        ActiveDownloads.RemoveAt(i--);

                        //loop from start again
                        UpdatePending = true;

                        continue;
                    }

                    if (d.DrawAt(new Vector2(0, y)))
                    {
                        downloadListPanel.ContentSpriteManager.Add(d.SpriteCollection);
                        Show(true);
                    }

                    y += 20;
                }

                downloadListPanel.SetContentDimensions(new Vector2(WIDTH, y));
            }

            base.Update();
        }
Beispiel #10
0
 public override void Update()
 {
     base.Update();
     sa_chartList.Update();
 }
Beispiel #11
0
        private void UpdateEventList()
        {
            eventList.Update();

            if (eventListDragging != null)
            {
                eventListDragging.Position = eventListDragging.InitialPosition +
                                             (MouseManager.MousePosition - eventListDraggingStart) /
                                             GameBase.WindowManager.Ratio;

                foreach (pSprite p in eventList.ContentSpriteManager.SpriteList.FindAll(t => t.TagNumeric > 0))
                {
                    pText pt = p as pText;
                    if (eventListDragging == p || (pt != null && pt.Text == @"Background"))
                    {
                        continue;
                    }

                    if (p.InitialPosition.Y > eventListDragging.Position.Y - eventDrawHeight / 2)
                    {
                        if (p.Position == p.InitialPosition)
                        {
                            p.MoveTo(p.InitialPosition + new Vector2(0, eventDrawHeight), 80);
                        }
                    }
                    else if (p.InitialPosition.Y < eventListDragging.Position.Y)
                    {
                        if (p.Position != p.InitialPosition)
                        {
                            p.MoveTo(p.InitialPosition, 80);
                        }
                    }
                }
            }

            if (EventListUpdateRequired)
            {
                eventList.ClearSprites();
                eventListDictionary.Clear();

                float y = 0;

                float drawDepth = 0.5f;

                float scale = DpiHelper.DPI(GameBase.Form) / 96.0f;
                for (int i = 0; i < eventManager.storyLayerSprites.Length; i++)
                {
                    bool layerIsEnabled = eventManager.storyLayerEnabled[i];

                    List <Event> l = eventManager.storyLayerSprites[i];

                    StoryLayer layer = (StoryLayer)i;

                    pText pt = new pText(layer.ToString(), 8 * scale, new Vector2(0, y), drawDepth, true, layerIsEnabled ? Color.Orange : Color.LightGray);
                    pt.TextRenderSpecific = false;
                    pt.TextAa             = false;
                    pt.TextShadow         = true;
                    pt.TagNumeric         = 1;
                    pt.HandleInput        = true;
                    pt.OnHover           += delegate
                    {
                        if (selectedEvent != null)
                        {
                            pt.TextBold    = true;
                            pt.TextChanged = true;
                        }
                    };
                    pt.OnHoverLost += delegate
                    {
                        pt.TextBold    = false;
                        pt.TextChanged = true;
                    };
                    pt.OnClick += delegate
                    {
                        if (selectedEvent != null)
                        {
                            moveEventToLayer(selectedEvent, layer);
                        }
                        else
                        {
                            ToggleLayer(layer);
                        }
                    };
                    eventList.ContentSpriteManager.Add(pt);
                    if (eventDrawHeight == 0)
                    {
                        eventDrawHeight = (pt.MeasureText().Y + 4 * scale) / GameBase.WindowManager.Ratio;
                    }
                    y += eventDrawHeight;

                    drawDepth += 0.0001f;

                    if (!layerIsEnabled)
                    {
                        continue; //don't display the events if this layer is hidden.
                    }
                    foreach (Event e in l)
                    {
                        if (e.Sprite == null)
                        {
                            continue;
                        }

                        pText pt1 = new pText(e.Filename.Length >= 4 ? e.Filename.Remove(e.Filename.Length - 4) : e.Filename + @" ", 8 * scale, new Vector2(2, y), drawDepth,
                                              true, Color.White);
                        pt1.TextRenderSpecific = false;
                        pt1.TextAa             = false;
                        pt1.HandleInput        = true;
                        pt1.TextShadow         = true;
                        pt1.Tag        = e;
                        pt1.TagNumeric = 2;
                        pt1.OnHover   += delegate
                        {
                            pt1.BackgroundColour = new Color(92, 92, 92);
                            pt1.TextChanged      = true;
                        };
                        pt1.OnHoverLost += delegate
                        {
                            pt1.BackgroundColour = Color.TransparentWhite;
                            pt1.TextChanged      = true;
                        };
                        if (e == selectedEvent)
                        {
                            pt1.TextBold      = true;
                            pt1.TextUnderline = true;
                        }
                        Event e1 = e;
                        pt1.OnClick += delegate
                        {
                            if (editor.CurrentMode != EditorModes.Design)
                            {
                                return;
                            }

                            if ((!e1.Sprite.IsVisible || MouseManager.DoubleClick) &&
                                e1.Sprite.Transformations.Count > 0)
                            {
                                AudioEngine.SeekTo(e1.Sprite.Transformations[0].Time1);
                            }
                            SetSelectedEvent(e1, false);
                        };

                        eventList.ContentSpriteManager.Add(pt1);
                        y += (pt1.MeasureText().Y + 4 * scale) / GameBase.WindowManager.Ratio;

                        eventListDictionary.Add(e, pt1);

                        drawDepth += 0.0001f;
                    }
                }

                eventList.SetContentDimensions(new Vector2(66, y));
                EventListUpdateRequired = false;
            }
        }
Beispiel #12
0
        internal void Update()
        {
            chatArea.Alpha = chatBg.Alpha;

            chatArea.Update();
        }
Beispiel #13
0
        public override void Update()
        {
            if (loadingSprites && GameBase.Time - lastLoad > 40)
            {
                if (files.Count > 0)
                {
                    x = 80 + 100 * (count % 6);
                    y = 50 + (count / 6) * 100;

                    count++;
                    string filename = files[0].Replace(Folder + Path.DirectorySeparatorChar, string.Empty);

                    pSprite p          = null;
                    int     frameDelay = 0;

                    if (files.Count > 1 && filename[filename.Length - 5] == '0')
                    {
                        List <pTexture> textures = new List <pTexture>();

                        int j = 0;
                        while (true)
                        {
                            string   testFilename = filename.Replace("0.", j++ + ".");
                            pTexture test         = TextureManager.Load(testFilename, SkinSource.Beatmap);
                            if (test == null)
                            {
                                break;
                            }
                            files.Remove(testFilename);
                            textures.Add(test);
                        }

                        if (textures.Count > 1)
                        {
                            pAnimation a =
                                new
                                pAnimation(textures.ToArray(), Fields.StandardGamefieldScale, Origins.Centre,
                                           Clocks.Game, new Vector2(x, y),
                                           0.98f, true, Color.White, null);

                            a.Scale = 98f / Math.Max(a.Width, a.Height);
                            spriteList.ContentSpriteManager.Add(a);

                            p = a;

                            filename = filename.Replace("0.", ".");

                            frameDelay   = (int)(AudioEngine.ActiveControlPoint != null ? (AudioEngine.ActiveControlPoint.BeatLength * 2) / textures.Count : 500);
                            a.FrameDelay = frameDelay;
                        }
                    }

                    if (p == null)
                    {
                        p = new pSprite(TextureManager.Load(filename, SkinSource.Beatmap), Fields.StandardGamefieldScale,
                                        Origins.Centre, Clocks.Game,
                                        new Vector2(x, y), 0.98f, true, Color.White);
                        p.Scale = 98f / Math.Max(p.Width, p.Height);
                        spriteList.ContentSpriteManager.Add(p);
                    }

                    pSprite p2 = new pSprite(GameBase.WhitePixel, Fields.StandardGamefieldScale, Origins.TopLeft,
                                             Clocks.Game,
                                             new Vector2(x - 39, y - 39), 0.9f, true, new Color(15, 15, 15, 255));
                    p2.HoverEffect = new Transformation(p2.InitialColour, new Color(50, 50, 50, 255), 0, 100);
                    p2.Tag         = p;
                    p2.OnClick    += delegate
                    {
                        IsAnimation      = p is pAnimation;
                        SelectedFilename = filename;

                        if (IsAnimation)
                        {
                            SelectedFrameDelay  = frameDelay;
                            AnimationFrameCount = ((pAnimation)p).TextureCount;
                        }
                        Close();
                    };

                    p2.HandleInput = true;
                    p2.VectorScale = new Vector2(100, 100);
                    spriteList.ContentSpriteManager.Add(p2);

                    pText pt = new pText(filename, 8, new Vector2(x - 39, y - 50), new Vector2(100, 100), 1, true, Color.White, true);
                    pt.TextRenderSpecific = false;
                    pt.TextAa             = false;
                    pt.TextShadow         = true;
                    spriteList.ContentSpriteManager.Add(pt);

                    files.RemoveAt(0);
                }

                spriteList.SetContentDimensions(new Vector2(x + 100, y + 100));

                lastLoad = GameBase.Time;

                if (files.Count == 0)
                {
                    loadingSprites = false;
                }
            }

            spriteList.Update();

            base.Update();
        }