コード例 #1
0
        internal void ChangeColour(Difficulty difficulty, float dimAmount)
        {
            Color4 colour;

            switch (difficulty)
            {
            default:
            case Difficulty.Easy:
                colour = COLOUR_EASY;
                break;

            case Difficulty.Normal:
                colour = COLOUR_STANDARD;
                break;

            case Difficulty.Hard:
                colour = COLOUR_HARD;
                break;

            case Difficulty.Expert:
                colour = COLOUR_EXPERT;
                break;
            }

            colour = ColourHelper.Darken(colour, dimAmount * 0.5f);
            if (currentColour == colour)
            {
                return;
            }
            currentColour = colour;

            FadeColour(currentColour, 300);
        }
コード例 #2
0
        /// <summary>
        /// Helper function to turn a single colour into a lighter and darker shade for use with the slider's gradient.
        /// </summary>
        /// <param name="colour">HitObject colour</param>
        /// <param name="InnerColour">Track center</param>
        /// <param name="OuterColour">Track edges</param>
        internal static void ComputeSliderColour(Color colour, out Color InnerColour, out Color OuterColour)
        {
            Color col = new Color(colour.R, colour.G, colour.B, (byte)180);

            InnerColour = ColourHelper.Lighten2(col, 0.5f);
            OuterColour = ColourHelper.Darken(col, 0.1f);
        }
コード例 #3
0
        public override void Update()
        {
            base.Update();

            if (Velocity != 0)
            {
                Move(Velocity);
                Velocity *= 1 - (0.1f * Clock.ElapsedRatioToSixty);
                if (Math.Abs(Velocity) < 0.01f)
                {
                    Velocity = 0;
                }
            }

#if NO_PIN_SUPPORT
            float *colours = (float *)handle_colours_pointer;
#endif
            Color4 col = Colour;
            for (int i = 0; i < (line_count + 1) * 4; i++)
            {
                //change to the darker colour for bottom vertices and diagonals
                if (i == 2)
                {
                    col = ColourHelper.Darken(Colour, 0.85f);
                }

                if (SpriteManager.UniversalDim > 0)
                {
                    float mult = 1 - SpriteManager.UniversalDim;
                    colours[i * 4]     = col.R * mult;
                    colours[i * 4 + 1] = col.G * mult;
                    colours[i * 4 + 2] = col.B * mult;
                    colours[i * 4 + 3] = col.A;
                }
                else
                {
                    colours[i * 4]     = col.R;
                    colours[i * 4 + 1] = col.G;
                    colours[i * 4 + 2] = col.B;
                    colours[i * 4 + 3] = col.A;
                }
            }
        }
コード例 #4
0
ファイル: pDropdown.cs プロジェクト: notperry1234567890/osu
        void HoverLostEffect(object sender, EventArgs e)
        {
            pText senderText = sender as pText;

            if (senderText != null)
            {
                if (senderText.Tag is Color) // OH GOD this is a HAAACKKKK!
                {
                    senderText.BackgroundColour = ColourHelper.Darken(senderText.BackgroundColour, 0.1f);
                }
                else if (senderText == SpriteMainBox)
                {
                    senderText.BackgroundColour = new Color(0, 0, 0, 128);
                }
                else
                {
                    senderText.BackgroundColour = default_background_colour;
                }

                senderText.TextChanged = true;
            }
        }
コード例 #5
0
        void spawnChannelListing()
        {
            Vector2 pos = new Vector2(elementOffsetX, 0);

            channels = new List <Channel>(ChatEngine.channels);

            channels.Sort(
                delegate(Channel c1, Channel c2)
            {
                return(c1.Name.CompareTo(c2.Name));
            });

            foreach (Channel c in channels)
            {
                if (!c.Name.StartsWith(@"#"))
                {
                    continue;
                }

                string description = string.Format(LocalisationManager.GetString(OsuString.ChannelListDialog_TopicAndUserCount), string.IsNullOrEmpty(c.Topic) ? LocalisationManager.GetString(OsuString.ChannelListDialog_NoDescriptionAvailable) : c.Topic, c.UserCount);
                pText  pb          = new pText(string.Empty, 12, pos, 0.95f, true, c.Joined ? SkinManager.NEW_SKIN_COLOUR_MAIN : SkinManager.NEW_SKIN_COLOUR_SECONDARY);

                pb.HandleInput  = true;
                pb.Tag          = c.Name;
                pb.CornerBounds = Vector4.One * 4;
                pb.ClickRequiresConfirmation = true;
                pb.TextBounds       = new Vector2(445, 30);
                pb.BackgroundColour = Color.Black;
                pb.BorderWidth      = 2;
                pb.BorderColour     = Color.White;
                pb.TextAlignment    = TextAlignment.LeftFixed;

                Vector2 posName = pos;
                posName.Y += 8;
                posName.X += 10;

                pText pname = new pText(c.Name, 12, posName, 0.99f, true, c.Joined ? SkinManager.NEW_SKIN_COLOUR_MAIN : SkinManager.NEW_SKIN_COLOUR_SECONDARY);
                pname.HandleInput = false;

                pText pdesc = new pText(description, 12, new Vector2(pos.X + 100, pos.Y + 8), 0.99f, true, Color.White);
                pdesc.TextBounds    = new Vector2(345, 30);
                pdesc.TextAlignment = TextAlignment.LeftFixed;
                pdesc.HandleInput   = false;

                pb.OnClick += delegate { pb_OnClick(pb, pname); };

                pb.OnHover += delegate
                {
                    if (!pb.IsVisible || pb.Alpha != 1)
                    {
                        return;
                    }

                    pb.BackgroundColour = ColourHelper.Darken(pb.BorderColour, 4f);

                    pname.TextBold    = true;
                    pname.TextChanged = true;
                    pdesc.TextChanged = true;
                };

                pb.OnHoverLost += delegate
                {
                    if (!pb.IsVisible || pb.Alpha != 1)
                    {
                        return;
                    }

                    pb.BackgroundColour = Color.Black;

                    pname.TextBold    = false;
                    pname.TextChanged = true;
                    pdesc.TextChanged = true;
                };

                pos.Y += spacing;
                channelButtonList.ContentSpriteManager.Add(pb);
                channelButtonList.ContentSpriteManager.Add(pname);
                channelButtonList.ContentSpriteManager.Add(pdesc);

                channelSprites[c] = new List <pSprite>()
                {
                    pb, pname, pdesc
                };
            }

            channelButtonList.SetContentDimensions(new Vector2(160, pos.Y));
        }
コード例 #6
0
        internal override void Display()
        {
            descriptionTexts     = new List <pText>();
            currentVerticalSpace = 300;
            const int width = 450;
            int       horizontalPosition = -width / 2;
            Fields    fields             = Fields.Centre;

            pText reportedUserText = new pText(LocalisationManager.GetString(OsuString.UserReportDialog_ReportedUser), 15, new Vector2(horizontalPosition, -100), 0.92f, true, Color.White);

            reportedUserText.Field  = fields;
            reportedUserText.Origin = Origins.TopLeft;
            descriptionTexts.Add(reportedUserText);
            spriteManager.Add(reportedUserText);

            pText reportReasonText = new pText(LocalisationManager.GetString(OsuString.UserReportDialog_SelectReason), 15, new Vector2(horizontalPosition, -70), 0.92f, true, Color.White);

            reportReasonText.Field  = fields;
            reportReasonText.Origin = Origins.TopLeft;
            descriptionTexts.Add(reportReasonText);
            spriteManager.Add(reportReasonText);

            pText reportReasonInfoText = new pText(LocalisationManager.GetString(OsuString.UserReportDialog_AdditionalInfo), 15, new Vector2(horizontalPosition, -40), 0.92f, true, Color.White);

            reportReasonInfoText.Field  = fields;
            reportReasonInfoText.Origin = Origins.TopLeft;
            descriptionTexts.Add(reportReasonInfoText);
            spriteManager.Add(reportReasonInfoText);

            int biggestText = descriptionTexts.Max(e => (int)e.MeasureText().X);

            descriptionTexts.ForEach(e => e.MoveToX(e.CurrentPositionActual.X + ((float)biggestText - e.MeasureText().X), 0));
            int widthOfBoxes = width - biggestText;
            int horizontalPositionOfBoxes = horizontalPosition + biggestText + 5;

            pText reportedUserName = new pText(reportedUser.Name, 15, new Vector2(horizontalPositionOfBoxes - 1, -100), 0.92f, true, Color.White);

            reportedUserName.TextBold = true;
            reportedUserName.Field    = fields;
            reportedUserName.Origin   = Origins.TopLeft;
            spriteManager.Add(reportedUserName);

            reportReason = new pDropdown(null, string.Empty, new Vector2(horizontalPositionOfBoxes, -70), widthOfBoxes, 0.96f);
            reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonSpamming), Reasons.Spam);
            reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonInsults), Reasons.Insults);
            reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonFoulPlay), Reasons.Cheating);
            reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonUnwantedContent), Reasons.UnwantedContent);
            reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonNonsense), Reasons.Nonsense);
            reportReason.AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_ReasonOther), Reasons.Other);
            reportReason.SetSelected(Reasons.Spam, true);
            reportReason.SpriteManager = spriteManager;
            reportReason.SpriteCollection.ForEach(s => s.Field = fields);
            reportReason.SpriteMainBox.BorderColour            = ColourHelper.Darken(reportReason.HighlightColour, 0.2f);
            reportReason.SpriteMainBox.BorderWidth             = 1;
            spriteManager.Add(reportReason.SpriteCollection);

            reportReasonInfo = new pTextBox(string.Empty, 15, new Vector2(horizontalPositionOfBoxes, -40), widthOfBoxes, 0.92f);
            reportReasonInfo.SpriteCollection.ForEach(s => s.Field = fields);
            reportReasonInfo.Focus(true);
            reportReasonInfo.InputControl.OnKey += InputControl_OnKey;
            spriteManager.Add(reportReasonInfo.SpriteCollection);

            AddOption(LocalisationManager.GetString(OsuString.UserReportDialog_SendReport), Color.Red, OnReportClick, true);
            AddCancel(LocalisationManager.GetString(OsuString.General_Cancel), Color.LightGray, null);
            base.Display();
        }
コード例 #7
0
        public override void Initialize()
        {
            startTime = Clock.Time;

            background = new pSprite(TextureManager.Load(OsuTexture.cleared), FieldTypes.StandardSnapCentre, OriginTypes.CentreLeft,
                                     ClockTypes.Game, Vector2.Zero, 1, true, Color4.White);
            background.Position.X -= background.DrawWidth * GameBase.SpriteToBaseRatio / 2;

            background.Alpha = 0;
            background.Transform(new TransformationF(TransformationType.Fade, 0, 1, Clock.Time, Clock.Time + 1700, EasingTypes.OutDouble));

            background.Additive = true;
            spriteManager.Add(background);

            pDrawable fill = pSprite.FullscreenWhitePixel;

            fill.Clocking = ClockTypes.Game;
            fill.Scale.X *= (float)Results.RankableScore.count300 / Results.RankableScore.totalHits + 0.001f;
            fill.Colour   = new Color4(1, 0.63f, 0.01f, 1);
            fillSprites.Add(fill);

            fill          = pSprite.FullscreenWhitePixel;
            fill.Clocking = ClockTypes.Game;
            fill.Scale.X *= (float)Results.RankableScore.count100 / Results.RankableScore.totalHits + 0.001f;
            fill.Colour   = new Color4(0.55f, 0.84f, 0, 1);
            fillSprites.Add(fill);

            fill          = pSprite.FullscreenWhitePixel;
            fill.Clocking = ClockTypes.Game;
            fill.Scale.X *= (float)Results.RankableScore.count50 / Results.RankableScore.totalHits + 0.001f;
            fill.Colour   = new Color4(0.50f, 0.29f, 0.635f, 1);
            fillSprites.Add(fill);

            fill          = pSprite.FullscreenWhitePixel;
            fill.Clocking = ClockTypes.Game;
            fill.Scale.X *= (float)Results.RankableScore.countMiss / Results.RankableScore.totalHits + 0.001f;
            fill.Colour   = new Color4(0.10f, 0.10f, 0.10f, 1);
            fillSprites.Add(fill);

            int i = 0;

            foreach (pDrawable p in fillSprites)
            {
                p.Alpha = 1;
                //p.Additive = true;
                p.DrawDepth  = 0.98f;
                p.AlwaysDraw = true;

                int offset = Clock.Time + i++ *time_between_fills;

                p.Transform(new TransformationC(ColourHelper.Darken(p.Colour, 0.4f), ColourHelper.Darken(p.Colour, 0.7f), Clock.Time, Clock.Time + 1400));
                p.Transform(new TransformationC(Color4.White, p.Colour, Clock.Time + 1600, Clock.Time + 3000));
                //force the initial colour to be an ambiguous gray.

                p.Transform(new TransformationBounce(offset, offset + end_bouncing * 2, p.Scale.X, p.Scale.X, 5));
            }

            GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.RankBling); }, 1600);

            spriteManager.Add(fillSprites);

            base.Initialize();
        }