Ejemplo n.º 1
0
        void pb_OnClick(pText p, pText pname)
        {
            string attemptJoin = p.Tag.ToString();

            Channel c = ChatEngine.channels.Find(s => s.Name == attemptJoin);

            if (c == null)
            {
                NotificationManager.ShowMessageMassive(LocalisationManager.GetString(OsuString.ChannelListDialog_CantRejoinThisChannel), 1500);
                return;
            }

            if (InputManager.rightButtonLast == ButtonState.Pressed)
            {
                if (!c.Joined || !c.Closeable)
                {
                    return;
                }
                ChatEngine.RemoveChannel(c);
                NotificationManager.ShowMessageMassive(string.Format(LocalisationManager.GetString(OsuString.ChannelListDialog_Left), c.Name), 1500);
                p.FadeColour(SkinManager.NEW_SKIN_COLOUR_SECONDARY, 300);
                pname.FadeColour(SkinManager.NEW_SKIN_COLOUR_SECONDARY, 300);
            }
            else
            {
                if (!c.Joined)
                {
                    Channel chan = null;

                    try
                    {
                        chan = ChatEngine.AddChannel(attemptJoin, false, true);
                        if (chan == null)
                        {
                            NotificationManager.ShowMessageMassive(string.Format(LocalisationManager.GetString(OsuString.ChannelListDialog_JoiningTooFast), attemptJoin), 1500);
                            return;
                        }

                        ChatEngine.channelTabs.SetSelected(chan);
                        NotificationManager.ShowMessageMassive(string.Format(LocalisationManager.GetString(OsuString.ChannelListDialog_Joined), chan.Name), 1500);
                        p.FadeColour(SkinManager.NEW_SKIN_COLOUR_MAIN, 300);
                        pname.FadeColour(SkinManager.NEW_SKIN_COLOUR_MAIN, 300);
                    }
                    catch
                    {
                    }
                }
                else
                {
                    NotificationManager.ShowMessageMassive(LocalisationManager.GetString(OsuString.ChannelListDialog_AlreadyJoined), 1500);
                }
            }

            Update();
        }
Ejemplo n.º 2
0
        public JumpTo()
            : base(LocalisationManager.GetString(OsuString.JumpToDialog_Title), true)
        {
            spriteManager.Add(new pBox(new Vector2(PADDING, 79), new Vector2(GameBase.WindowManager.WidthScaled - (PADDING * 2), 1), 1, Color.White));
            spriteManager.Add(new pBox(new Vector2(PADDING, 440), new Vector2(GameBase.WindowManager.WidthScaled - (PADDING * 2), 1), 1, Color.White));
            Rectangle scrollableArea = new Rectangle(PADDING, 80, (int)(640 * GameBase.WindowManager.WidthWidescreenRatio) - (PADDING * 2), 360);

            scrollableView = new pScrollableArea(scrollableArea, Vector2.Zero, true, 0, defaultTargetType);
            mapManager     = new SpriteManager(true);
            topLayer       = new SpriteManager(true);
            mapManager.SetWidescreen(GameBase.WindowManager.IsWidescreen);
            collectionLabel = new pText(LocalisationManager.GetString(OsuString.SongSelection_Collections) + ":", 20, new Vector2(PADDING, 30), 2, true, new Color(254, 220, 97));
            collections     = new pDropdown(topLayer, "All", new Vector2(PADDING, 55), 140, 3);
            searchBox       = new pSearchBox(20, new Vector2(PADDING, 50), 20, Graphics.Renderers.TextAlignment.Right);
            searchTime      = -1;
            spriteManager.Add(searchBox.SpriteCollection);
            spriteManager.Add(collectionLabel);
            scrollableView.AddChild(mapManager);

            searchBox.OnChange += delegate(pTextBox sender, bool newText)
            {
                if (!newText)
                {
                    return;
                }

                if (searchBox.IsDefault && searchBox.textBeforeCommit.Length == 1)
                {
                    searchTime = GameBase.Time;
                }
                else if (!searchBox.IsDefault)
                {
                    searchTime = GameBase.Time + 300;
                }
            };

            Closed += delegate
            {
                MusicControl.ClearPool();
            };

            collections.AddOption("All", "All");
            collections.SetSelected("All", true);

            foreach (string c in CollectionManager.Collections.Keys)
            {
                collections.AddOption(c, c);
            }

            collections.OnSelect += collections_OnSelect;

            SelectedMap = BeatmapManager.Current;

            layout();
        }
Ejemplo n.º 3
0
        public void ShowStatus(string s)
        {
            if (statusMessage != null)
            {
                statusMessage.FadeOut(100);
            }

            statusMessage          = new pText(s, 12, topLeft + offset * displayCount, 1, false, Color.White);
            statusMessage.TextBold = true;
            statusMessage.FadeOut(6000);
            spriteManager.Add(statusMessage);
        }
Ejemplo n.º 4
0
        internal override void Display()
        {
            pText pt = new pText("Press a key to change the binding..\nHit 'esc' to cancel.", 40, new Vector2(320, 240), 1, true, Color.White);

            pt.TextShadow    = true;
            pt.TextBounds    = new Vector2(1024, 0);
            pt.TextAlignment = Alignment.Centre;
            pt.OriginType    = OriginTypes.Centre;
            SpriteCollection.Add(pt);

            base.Display();
        }
Ejemplo n.º 5
0
        public void ShowStatus(string s)
        {
            if (statusMessage != null)
            {
                statusMessage.FadeOut(100);
            }

            statusMessage          = new pText(s, 12, topLeft + (DisplayOnRight ? rightOffset : Vector2.Zero) - new Vector2(0, 5), 1, false, Color.White);
            statusMessage.Origin   = Origins.BottomLeft;
            statusMessage.TextBold = true;
            statusMessage.FadeOut(6000);
            spriteManager.Add(statusMessage);
        }
Ejemplo n.º 6
0
        public pStatusDialog(string initialStatus)
        {
            status        = new pText("", 14, new Vector2(GameBase.WindowManager.WidthScaled / 2, 240), 1, true, Color.White);
            status.Origin = Origins.Centre;

            spriteManager.Add(new pSprite(TextureManager.Load(@"beatmapimport-top", SkinSource.Osu), Vector2.Zero, 1, true, Color.White));
            spinner = CreateSpinner(new Color(255, 96, 171));
            spinner.FadeInFromZero(2000);
            spinner.Position.Y += 70;
            spriteManager.Add(spinner);

            SetStatus(initialStatus);
        }
Ejemplo n.º 7
0
        public pTextBox(string text, float size, Vector2 pos, float length, float depth = 1, bool passwordBox = false)
        {
            TextSize = size;

            Length = length;

            Box                           = new pText(string.Empty, size, pos, new Vector2(length, 0), depth, true, Color.White, false);
            Box.TextBold                  = true;
            Box.BackgroundColour          = backgroundUnfocused;
            Box.TextColour                = Color.White;
            Box.TextAlignment             = TextAlignment.LeftFixed;
            Box.HandleInput               = true;
            Box.ClickRequiresConfirmation = true;
            Box.BorderColour              = new Color(180, 180, 180);
            Box.BorderWidth               = 2;

            cursor = new pSprite(GameBase.WhitePixel, Fields.TopLeft,
                                 Origins.TopLeft, Clocks.Game, pos, depth + 0.001f, true, Color.TransparentWhite);
            cursor.VectorScale = new Vector2(2, size * 1.5f);
            cursor.Bypass      = true;
            cursor.Position.Y += CURSOR_Y_OFFSET;
            SpriteCollection.Add(cursor);

            if (passwordBox)
            {
                InputControl = new PasswordInputControl(this);
            }
            else
            {
                InputControl = new TextInputControl(this);
            }
            InputControl.OnNewImeComposition += InputControl_OnNewImeComposition;
            InputControl.OnImeStart          += new VoidDelegate(InputControl_OnImeStart);
            InputControl.OnImeEnd            += new VoidDelegate(InputControl_OnImeEnd);

            ImeLine = new pText(string.Empty, size, cursor.Position, depth + 0.002f, true, Color.PaleVioletRed);
            SpriteCollection.Add(ImeLine);

            enabled = true;

            InputControl.pTextBox = this;

            Box.OnClick += box_OnClick;
            InputManager.Bind(InputEventType.OnClick, onClick, InputTargetPriority.Highest, BindLifetime.Manual); //todo: this is too global
            InputControl.OnNewText += TextInputControl_OnNewText;
            InputControl.OnKey     += UpdateCursorPositionScheduled;

            SpriteCollection.Add(Box);

            Text = text;
        }
Ejemplo n.º 8
0
        internal override void Update()
        {
            base.Update();

            if (spriteManager != null)
            {
                spriteManager.Alpha = Visible ? 1 : 0;
            }

            foreach (string s in listener.GetPendingMessages())
            {
                if (s == null || s.Length == 0)
                {
                    continue;
                }

                Logger.Log(s, LoggingTarget.Debug, LogLevel.Debug);

                pText text = new pText(s, 9, padding, 1, true, Color.White)
                {
                    Field              = Fields.BottomLeft,
                    Origin             = Origins.BottomLeft,
                    TextRenderSpecific = false,
                    BackgroundColour   = bg_new,
                    TextAa             = false,
                    TextShadow         = true
                };

                spriteManager.SpriteList.ForEach(spr =>
                {
                    spr.Position.Y += padding.Y + text.MeasureText().Y / 0.625f / GameBase.WindowManager.Ratio;
                });

                //Remove any sprites above the screen
                if (spriteManager.SpriteList.Count > 0 && spriteManager.SpriteList[0].Position.Y > 480)
                {
                    spriteManager.Remove(spriteManager.SpriteList[0]);
                }

                spriteManager.Add(text);

                GameBase.Scheduler.AddDelayed(delegate
                {
                    text.AlwaysDraw = false;
                    text.FadeOut(200, EasingTypes.InExpo);
                    text.MoveToX(-text.MeasureText().X, 200, EasingTypes.InExpo);
                }, text.Text.Length * 100);

                GameBase.Scheduler.AddDelayed(delegate { text.BackgroundColour = bg_black; }, 320);
            }
        }
Ejemplo n.º 9
0
        internal pSprite AddOption(string text, object value, int tagNumeric, Color bgColour, bool enabled = true)
        {
            pText option = new pText(text, SpriteMainBox.TextSize - 1, boxOffset, new Vector2(width + 2, 14 + 3), depth + 0.003f, true, Color.TransparentWhite, true);

            option.TextAlignment = CentreText ? TextAlignment.Centre : TextAlignment.LeftFixed;

            pText option2 = new pTextAwesome(FontAwesome.chevron_right, 10, boxOffset + new Vector2(6, 9))
            {
                Depth         = depth + 0.004f,
                InitialColour = Color.TransparentBlack,
                Alpha         = 0,
                TextShadow    = false
            };

            option.BackgroundColour = bgColour;
            option.Padding          = new Vector2(12, 3);

            option.Bypass  = true;
            option2.Bypass = true;

            if (enabled)
            {
                option.HandleInput = true;
                option.ClickRequiresConfirmation = true;

                if (value != null)
                {
                    option.OnClick     += optionClicked;
                    option.OnHover     += HoverGainedEffect;
                    option.OnHoverLost += HoverLostEffect;
                }

                option.Tag           = value;
                option.TagNumeric    = tagNumeric;
                option.HoverPriority = -1000;
            }

            OptionsSprites.Add(option);
            OptionsSprites.Add(option2);

            SpriteCollection.Add(option);
            SpriteCollection.Add(option2);

            if (SpriteManager != null)
            {
                SpriteManager.Add(option);
                SpriteManager.Add(option2);
            }

            return(option);
        }
Ejemplo n.º 10
0
        internal pButton(string text, Vector2 position, Vector2 dimensions, float drawdepth,
                         Color colour, EventHandler onclick)
        {
            litUp = colour;
            orig  = new Color((byte)Math.Max(0, litUp.R - 20), (byte)Math.Max(0, litUp.G - 20), (byte)Math.Max(0, litUp.B - 20));


            SpriteCollection = new List <pSprite>();

            pSprite p =
                new pSprite(SkinManager.Load("button-left"), FieldTypes.Window, OriginTypes.TopLeft, ClockTypes.Game, position,
                            drawdepth, true,
                            orig, this);

            p.CurrentScale = dimensions.Y / (p.DrawHeight * 0.625f);
            p.IsClickable  = true;
            p.OnClick     += onclick;
            p.OnHover     += pButton_OnHover;
            p.OnHoverLost += pButton_OnHoverLost;
            SpriteCollection.Add(p);

            float wd = SpriteCollection[0].DrawWidth * 0.625f * SpriteCollection[0].CurrentScale;

            p =
                new pSprite(SkinManager.Load("button-right"), FieldTypes.Window, OriginTypes.TopLeft, ClockTypes.Game, position + new Vector2(dimensions.X - wd, 0),
                            drawdepth, true,
                            orig, this);
            p.CurrentScale = dimensions.Y / (p.DrawHeight * 0.625f);
            p.IsClickable  = true;
            p.OnClick     += onclick;
            p.OnHover     += pButton_OnHover;
            p.OnHoverLost += pButton_OnHoverLost;
            SpriteCollection.Add(p);

            p =
                new pSprite(SkinManager.Load("button-middle"), FieldTypes.Window, OriginTypes.TopLeft, ClockTypes.Game,
                            position + new Vector2(wd, 0), drawdepth + 0.01F, true,
                            orig, this);
            p.UseVectorScale = true;
            p.IsClickable    = true;
            p.OnClick       += onclick;
            p.OnHover       += pButton_OnHover;
            p.OnHoverLost   += pButton_OnHoverLost;
            p.VectorScale    = new Vector2((dimensions.X - (wd * 2)) * 1.6f, SpriteCollection[1].CurrentScale);
            SpriteCollection.Add(p);

            Text            = new pText(text, 14 * dimensions.Y / 18f, position + dimensions / 2, drawdepth + 0.02F, true, Color.White);
            Text.OriginType = OriginTypes.Centre;
            SpriteCollection.Add(Text);
        }
Ejemplo n.º 11
0
        public OptionTextbox(string title, bool passwordBox = false)
        {
            header = new pText(title, 12, Vector2.Zero, 1, true, Color.White);
            spriteManager.Add(header);

            Textbox           = new pTextBox(string.Empty, 12, new Vector2(0, header.MeasureText().Y + 5), ELEMENT_SIZE - 5, 1, passwordBox);
            Textbox.OnChange += delegate { calculateHeight(); };
            Textbox.OnCommit += delegate { calculateHeight(); };
            spriteManager.Add(Textbox.SpriteCollection);

            addKeyword(title);

            calculateHeight();
        }
Ejemplo n.º 12
0
        public OptionDropdown(OsuString title, IEnumerable <pDropdownItem> items = null, HasObjectValue binding = null, EventHandler onChange = null)
        {
            this.binding = binding;

            ValueChangedObservable changeObservation = binding as ValueChangedObservable;

            if (changeObservation != null)
            {
                changeObservation.ValueChanged += changeObservation_ValueChanged;
            }

            string text   = LocalisationManager.GetString(title);
            pText  header = new pText(text, 12, Vector2.Zero, 1, true, Color.White);

            spriteManager.Add(header);

            Size = header.MeasureText() + new Vector2(5, 0);

            Dropdown = new pDropdown(spriteManager, String.Empty, new Vector2(Size.X, 0), ELEMENT_SIZE - Size.X, 1)
            {
                ColumnLimit = 10
            };
            Dropdown.OnSelect         += Dropdown_OnSelect;
            Dropdown.OnDisplayChanged += Dropdown_OnDisplayChanged;

            Dropdown.SpriteMainBox.ClickRequiresConfirmation = true;

            if (onChange != null)
            {
                Dropdown.OnSelect += onChange;
            }

            if (items != null)
            {
                foreach (pDropdownItem i in items)
                {
                    Dropdown.AddOption(i);
                    addKeyword(i.Text);
                }
            }

            if (binding != null)
            {
                Dropdown.SetSelected(binding.ObjectValue, true);
            }


            addKeyword(text);
            addKeyword(title.ToString());
        }
Ejemplo n.º 13
0
        internal VolumeControl(BindableInt volume, string text, Vector2 pos, Vector2 textOffset, float scale, bool active, EventHandler onReceivedHover, EventHandler renewVisibleTime) : base(GameBase.Instance)
        {
            Visible = false;

            this.volume = volume;

            volume.ValueChanged += renewVisibleTime;

            receivedHover         += onReceivedHover;
            this.renewVisibleTime += renewVisibleTime;
            Scale = scale;

            background             = new pSprite(TextureManager.Load(@"volume-circle-bg", SkinSource.Osu), Fields.BottomRight, Origins.Centre, Clocks.Game, pos, 0.968f, true, colourInactive);
            background.HandleInput = true;
            background.OnHover    += background_OnHover;
            background.OnClick    += Background_OnClick;
            spriteManager.Add(background);

            backgroundMax = new pSprite(TextureManager.Load(@"volume-circle-bg-max", SkinSource.Osu), Fields.BottomRight, Origins.Centre, Clocks.Game, pos, 0.97f, true, Color.TransparentWhite);
            spriteManager.Add(backgroundMax);

            spriteManager.Add(progress = new CircularProgressBar()
            {
                Radius    = 50,
                LineWidth = 8,
                Depth     = 0.971f
            });

            percentageDisplay = new pText(string.Empty, 14, pos, 0.991f, true, Color.White)
            {
                Field  = Fields.BottomRight,
                Origin = Origins.Centre
            };
            spriteManagerFg.Add(percentageDisplay);

            pText textSprite = new pText(text, 12, new Vector2(pos.X + 36 * scale, pos.Y) - textOffset, 0.991f, true, Color.White)
            {
                Field  = Fields.BottomRight,
                Origin = Origins.CentreRight
            };

            spriteManagerText.Add(textSprite);

            spriteManagerFg.SpriteList.ForEach(s => s.Alpha   = 0);
            spriteManager.SpriteList.ForEach(s => s.Alpha     = 0);
            spriteManagerText.SpriteList.ForEach(s => s.Alpha = 0);

            Active = active;
        }
Ejemplo n.º 14
0
        public override void Initialize()
        {
            base.Initialize();

            if (HitObjectManager != null)
            {
                t_currentStream            = new pText(HitObjectManager.ActiveStream.ToString(), 64, new Vector2(20, 20), 1, true, Color4.White);
                t_currentStream.Field      = FieldTypes.StandardSnapBottomRight;
                t_currentStream.Origin     = OriginTypes.BottomRight;
                t_currentStream.TextShadow = true;
                spriteManager.Add(t_currentStream);

                topMostSpriteManager.Add(new BackButton(delegate { Director.ChangeMode(OsuMode.Store); }, false));
            }
        }
Ejemplo n.º 15
0
        public override void Initialize()
        {
            descriptiveText = new pText("Please click to start the benchmark.\nWhile running do not move your mouse or switch windows.", 20, new Vector2(0, 0), new Vector2(600, 0), 1, true, Color.White, true)
            {
                TextAlignment = TextAlignment.Right,
                Origin        = Origins.Centre,
                Field         = Fields.Centre
            };
            spriteManager.Add(descriptiveText);

            base.Initialize();

            KeyboardHandler.OnKeyPressed += KeyboardHandler_OnKeyPressed;
            InputManager.Bind(InputEventType.OnClick, onClick);

            progressBar = new ProgressBar(spriteManager, ProgressBarTypes.Bottom);
        }
Ejemplo n.º 16
0
 internal InputCandidate(SpriteManager spriteManager, Vector2 position, ImeTextBox imeTextbox)
 {
     background = new pSprite(
         GameBase.WhitePixel, Fields.TopLeft, Origins.TopLeft, Clocks.Game, position, 0.999F, true, Color.Gray);
     background.Scale = 1.6F;
     background.Alpha = 0;
     spriteManager.Add(background);
     this.imeTextbox = imeTextbox;
     StartPosition   = position;
     text            = new pText[10];
     for (int i = 0; i < 10; i++)
     {
         text[i]       = new pText("", 15, position + new Vector2(0, 15 * i), 1F, true, Color.White);
         text[i].Alpha = 0;
         spriteManager.Add(text[i]);
     }
 }
Ejemplo n.º 17
0
        internal ScoreboardEntry(int rank, string name, PlayModes playMode)
        {
            this.rank     = rank;
            this.playMode = playMode;
            this.name     = name ?? @"-";
            creationOrder = creationCount++;

            float depth = 0.92f;

            SpriteBackground = new pSprite(TextureManager.Load(@"menu-button-background"), Fields.TopLeft, Origins.Custom, Clocks.Game, Vector2.Zero, depth, true, new Color(0, 0, 0, 150))
            {
                Alpha = 0,
                Scale = 0.62f
            };

            SpriteName = new pText(name, 14, new Vector2(0, -2), Vector2.Zero, depth + 0.000003f, true, new Color(255, 255, 255, 0), true);

            SpriteScore = new pSpriteText(string.Empty, @"scoreentry", 2.5f, Fields.TopLeft, Origins.TopLeft, Clocks.Game, new Vector2(2, 18), depth + 0.000003f, true, new Color(255, 255, 255, 0))
            {
                TextConstantSpacing = true
            };

            SpriteCombo = new pSpriteText(string.Empty, @"scoreentry", 2.5f, Fields.TopLeft, Origins.TopRight, Clocks.Game, new Vector2(82, 18), depth + 0.000003f, true, new Color(153, 251, 255, 0))
            {
                TextConstantSpacing = true
            };

            SpriteRank = new pSpriteText(rank > 0 ? rank.ToString() : string.Empty, @"scoreentry", 3, Fields.TopLeft, Origins.TopRight, Clocks.Game, new Vector2(82, -2), depth + 0.000002f, true,
                                         new Color(255, 255, 255, 80))
            {
                Scale = 2.2f,
                Alpha = 0
            };

            SpriteCollection = new List <pSprite>
            {
                SpriteBackground,
                SpriteName,
                SpriteScore,
                SpriteCombo,
                SpriteRank
            };

            UpdateSpriteLayout();
        }
Ejemplo n.º 18
0
        internal pDialog(string title, bool modeSpecific) : base(GameBase.Instance)
        {
            pSprite ps =
                new pSprite(GameBase.WhitePixel, FieldTypes.WindowNoneNone, OriginTypes.TopLeft, ClockTypes.Game,
                            Vector2.Zero, 0.91F,
                            true,
                            new Color(0, 0, 0, 200));

            ps.UseVectorScale = true;
            ps.VectorScale    = new Vector2(GameBase.WindowWidth, GameBase.WindowHeight + GameBase.WindowVOffset);
            SpriteCollection.Add(ps);
            GameModeSpecific = modeSpecific;
            pText p = new pText(title, 24, new Vector2(2, 2), new Vector2(638, 300), 0.92F, true, Color.White, true);

            SpriteCollection.Add(p);

            currentVerticalSpace = p.MeasureText().Y + p.CurrentPosition.Y + 50;
        }
Ejemplo n.º 19
0
        public pTextBox(string text, int size, Vector2 pos, Vector2 bounds, float depth)
        {
            Box                  = new pText(text, size, pos, bounds, depth, true, Color.White, false);
            Box.TextBold         = true;
            Box.BackgroundColour = new Color(255, 255, 255, 20);
            Box.TextColour       = Color.White;
            Box.TextAlignment    = Alignment.LeftFixed;
            Box.IsClickable      = true;
            Box.BorderColour     = Color.Black;
            Box.BorderWidth      = 2;

            Box.OnClick                  += box_OnClick;
            MouseHandler.OnClick         += MouseHandler_OnClick;
            KeyboardHandler.OnKeyPressed += KeyboardHandler_OnKeyPressed;
            TextInputControl.OnNewText   += TextInputControl_OnNewText;

            SpriteCollection.Add(Box);
        }
Ejemplo n.º 20
0
        internal JumpToItem(JumpTo parent, Beatmap thisMap, int index)
        {
            set     = parent;
            map     = thisMap;
            mapText = new pText(thisMap.SortTitleAuto, 20, new Vector2(0, index * ITEM_HEIGHT + 5), 2, true, Color.White);

            colourBackground = new pBox(new Vector2(0, index * ITEM_HEIGHT), new Vector2((640 * GameBase.WindowManager.WidthWidescreenRatio) - JumpTo.PADDING * 3, ITEM_HEIGHT), 1, new Color(50, 50, 50))
            {
                Alpha       = 0.01f,
                Additive    = true,
                HandleInput = true,
                ClickRequiresConfirmation = true,
            };

            colourBackground.OnHover     += colourBackground_OnHover;
            colourBackground.OnHoverLost += colourBackground_OnHoverLost;
            colourBackground.OnClick     += colourBackground_OnClick;
        }
Ejemplo n.º 21
0
        protected override void InitializeSpecifics()
        {
            Player.ScoreBoard.topLeft = new Vector2(515, 120);
            Player.ScoreBoard.spriteManager.WidescreenAutoOffset = true;

            foreach (ScoreboardEntry sbe in Player.ScoreBoard.Entries)
            {
                sbe.SpriteBackground.Texture        = TextureManager.Load(@"menu-button-background");
                sbe.SpriteBackground.OriginPosition = new Vector2(26, 20);
                sbe.SpriteBackground.Tag            = sbe;
                sbe.UpdateRank(-1);
                sbe.SpriteBackground.HoverEffect = new Transformation(sbe.SpriteBackground.InitialColour,
                                                                      Color.YellowGreen, 0, 100);
            }

            Player.ScoreBoard.spriteManager.RemoveTagged("extra");
            Player.ScoreBoard.Reposition(true);

            Player.ScoreBoard.spriteManager.Alpha = 1;

            score.Pass = true; //force a pass.

            LoadScore(score);

            startTime = GameBase.Time + 300;

            pText pt =
                new pText("Multiplayer Results", 22, new Vector2(0, 0), Vector2.Zero, 0.991F, true,
                          Color.White, false);

            pt.ViewOffsetImmune = true;
            spriteManagerWideScrolling.Add(pt);

            pt =
                new pText("Beatmap: " + BeatmapManager.Current.DisplayTitle, 16, new Vector2(1, 20), Vector2.Zero, 0.991F,
                          true, Color.White, false);
            pt.ViewOffsetImmune = true;
            spriteManagerWideScrolling.Add(pt);
            pt = new pText("Match played at " +
                           score.Date.ToString("yy/MM/dd hh:mm:ss", GameBase.nfi), 16, new Vector2(1, 34), Vector2.Zero,
                           0.991F, true, Color.White, false);
            pt.ViewOffsetImmune = true;
            spriteManagerWideScrolling.Add(pt);
        }
Ejemplo n.º 22
0
        public OptionText(string text, VoidDelegate onClick = null)
        {
            int extraHeight = 0;

            textSprite = new pText(text, 12, new Vector2(0, extraHeight / 2), new Vector2(ELEMENT_SIZE, 0), 1, true, Color.White);
            textSprite.TextAlignment             = TextAlignment.Left;
            textSprite.HandleInput               = true;
            textSprite.OnClick                  += textSprite_OnClick;
            textSprite.ClickRequiresConfirmation = true;
            spriteManager.Add(textSprite);

            Size = textSprite.MeasureText() + new Vector2(0, extraHeight);
            addKeyword(text);

            if (onClick != null)
            {
                OnClick = onClick;
            }
        }
Ejemplo n.º 23
0
        public OptionVersion(string title)
        {
            int extraHeight = 20;

            header = new pText(title, 12, new Vector2(0, extraHeight / 2), new Vector2(ELEMENT_SIZE, 0), 1, true, Color.White);
            header.TextAlignment = TextAlignment.Centre;
            header.HandleInput   = true;
            header.OnClick      += delegate
            {
                GameBase.ProcessStart(@"https://osu.ppy.sh/p/changelog?v=" + General.BUILD_NAME);
            };

            header.ClickRequiresConfirmation = true;

            spriteManager.Add(header);

            Size = Size + new Vector2(0, extraHeight);
            addKeyword("version");
        }
Ejemplo n.º 24
0
        internal override void Display()
        {
            pText searchLabel = new pText(LocalisationManager.GetString(OsuString.Lobby_Search), 15, new Vector2(elementOffsetX, 35), 0.95f, true, Color.White);

            spriteManager.Add(searchLabel);

            Vector2 textLength         = searchLabel.MeasureText();
            float   searchLabelPadding = 2.5f; //distance between label and text box

            searchInput = new pTextBox(string.Empty, 15, new Vector2(searchLabel.Position.X + textLength.X + searchLabelPadding, 35), 100, 0.94f);
            searchInput.CommitOnLeave = false;
            searchInput.OnChange     += new pTextBox.OnCommitHandler(searchInput_OnChange);
            searchInput.OnCommit     += new pTextBox.OnCommitHandler(searchInput_OnCommit);
            spriteManager.Add(searchInput.SpriteCollection);

            spawnChannelListing();
            searchInput.Focus(true);
            base.Display();
        }
Ejemplo n.º 25
0
        internal void Show(bool extended = false, bool instant = false)
        {
            if (GameBase.Tournament)
            {
                return;
            }

            if (LastShow == 0)
            {
                spriteManager.SpriteList.ForEach(s =>
                {
                    pText t = s as pText;
                    if (t != null && t.localTexture == null)
                    {
                        t.MeasureText();
                    }
                });
            }

            lastShowExtended = extended;

            LastShow = GameBase.Time;
            if (extended)
            {
                LastShow += 500;
            }

            if (Activated)
            {
                return;
            }

            if (instant)
            {
                spriteManager.SpriteList.ForEach(s => s.Position.Y = s.InitialPosition.Y - extended_display);
            }
            else
            {
                spriteManager.SpriteList.ForEach(s => s.MoveToY(s.InitialPosition.Y - extended_display, 400, EasingTypes.Out));
            }

            Activated = true;
        }
Ejemplo n.º 26
0
        private void pointAt(Vector2 vector2)
        {
            pSprite sp = new pSprite(TextureManager.Load(OsuTexture.finger_inner), vector2)
            {
                Origin      = OriginTypes.Centre,
                Colour      = new Color4(50, 50, 50, 255),
                ScaleScalar = 0.5f
            };

            sp.OnHover     += delegate { sp.FadeColour(Color4.White, 100); };
            sp.OnHoverLost += delegate { sp.FadeColour(new Color4(50, 50, 50, 255), 100); };

            pText text = new pText(vector2.ToString(), 12, vector2, 1, true, Color4.White)
            {
                Origin = OriginTypes.Centre
            };

            spriteManager.Add(text);
            spriteManager.Add(sp);
        }
Ejemplo n.º 27
0
        void HoverGainedEffect(object sender, EventArgs e)
        {
            pText senderText = sender as pText;

            if (senderText != null)
            {
                if (senderText.Tag is Color)
                {
                    senderText.BackgroundColour = ColourHelper.Lighten(senderText.BackgroundColour, 0.1f);
                }
                else
                {
                    senderText.BackgroundColour = HighlightColour;
                }

                AudioEngine.Click(null, @"click-short");

                senderText.TextChanged = true;
            }
        }
Ejemplo n.º 28
0
        public Notification(string title, string description, NotificationStyle style, BoolDelegate action = null)
        {
            Clocking = ClockTypes.Game;

            pSprite back = new pSprite(TextureManager.Load(OsuTexture.notification_background), FieldTypes.StandardSnapCentre, OriginTypes.Centre, ClockTypes.Game, Vector2.Zero, 0.98f, true, Color4.White)
            {
                DimImmune = true
            };

            pText titleText = new pText(title, 36, new Vector2(0, -130), new Vector2(500 * GameBase.SpriteToBaseRatio, 0), 1, true, Color4.White, true)
            {
                Field         = FieldTypes.StandardSnapCentre,
                Origin        = OriginTypes.Centre,
                TextAlignment = TextAlignment.Centre,
                Clocking      = ClockTypes.Game,
                DimImmune     = true
            };

            pText descText = new pText(description, 24, new Vector2(0, -90), new Vector2(500 * GameBase.SpriteToBaseRatio, 0), 1, true, Color4.White, false)
            {
                Field         = FieldTypes.StandardSnapCentre,
                Origin        = OriginTypes.TopCentre,
                TextAlignment = TextAlignment.Centre,
                Clocking      = ClockTypes.Game,
                DimImmune     = true
            };

            Alpha     = 0;
            DrawDepth = 1;

            Action = action;


            Style = style;

            AddControls(style);

            Add(back);
            Add(descText);
            Add(titleText);
        }
Ejemplo n.º 29
0
        internal TeamplayOverlay(PlayerVs playerVs, SpriteManager spriteManager)
        {
            player             = playerVs;
            this.spriteManager = spriteManager;

            team1header            = new pText("Blue Team", 16, new Vector2(0, 100), 1, true, Color.White);
            team1header.TextBold   = true;
            team1header.TextShadow = true;
            spriteManager.Add(team1header);

            team2header            = new pText("Red Team", 16, new Vector2(GameBase.WindowManager.WidthScaled, 100), 1, true, Color.White);
            team2header.TextShadow = true;
            team2header.TextBold   = true;
            team2header.Origin     = Origins.TopRight;
            spriteManager.Add(team2header);

            accuracyMatch = PlayerVs.Match.matchScoringType == MatchScoringTypes.Accuracy;

            team1display = new ScoreDisplay(spriteManager, new Vector2(0, 120), false, 0.7f, !accuracyMatch, accuracyMatch);
            team2display = new ScoreDisplay(spriteManager, new Vector2(0, 120), true, 0.7f, !accuracyMatch, accuracyMatch);

            metre = new pSprite(TextureManager.Load(@"lobby-crown", SkinSource.Osu), Origins.Centre,
                                new Vector2(GameBase.WindowManager.WidthScaled / 2, 90), 0.99f, true, Color.Yellow);
            metre.Scale = 1.2f;
            spriteManager.Add(metre);

            metre2 = new pSprite(TextureManager.Load(@"lobby-crown", SkinSource.Osu), Origins.Centre,
                                 new Vector2(GameBase.WindowManager.WidthScaled / 2, 90), 1, true, Color.Yellow);
            metre2.Additive = true;
            Transformation t = new Transformation(TransformationType.Scale, 1.2f, 1.3f, GameBase.Time, GameBase.Time + 1000, EasingTypes.In);

            t.Loop      = true;
            t.LoopDelay = 1000;
            metre2.Transformations.Add(t);
            t           = new Transformation(TransformationType.Scale, 1.3f, 1.2f, GameBase.Time + 1000, GameBase.Time + 2000, EasingTypes.Out);
            t.Loop      = true;
            t.LoopDelay = 1000;
            metre2.Transformations.Add(t);
            metre2.Scale = 1.2f;
            spriteManager.Add(metre2);
        }
Ejemplo n.º 30
0
        internal void RemoveAllOptions()
        {
            while (OptionsSprites.Count > 0)
            {
                pText sprite = OptionsSprites[0];
                OptionsSprites.Remove(sprite);
                SpriteCollection.Remove(sprite);
                if (SpriteManager != null)
                {
                    SpriteManager.Remove(sprite);
                }

                sprite.Dispose();
            }

            ResetBoxOffset();

            SelectedNumeric = 0;
            SelectedObject  = null;
            SelectedString  = null;
        }