Exemplo n.º 1
0
        private static void UpdateModIconStatus(pSprite modButton, bool status)
        {
            modButton.Transformations.Clear();

            Transformation t =
                new Transformation(TransformationType.Fade, (float)modButton.CurrentColour.A / 255, (status ? 1 : 0.6F),
                                   GameBase.Time, GameBase.Time + 200);

            modButton.Transformations.Add(t);

            float currentScale = modButton.CurrentScale;

            if (status)
            {
                Transformation t1 =
                    new Transformation(TransformationType.Scale, currentScale, 1.5F,
                                       GameBase.Time, GameBase.Time + 120);
                t1.Easing = EasingTypes.In;


                modButton.Transformations.Add(t1);
                modButton.HoverEffect = null;
            }
            else
            {
                Transformation t2 =
                    new Transformation(TransformationType.Scale, currentScale, 1,
                                       GameBase.Time, GameBase.Time + 120);
                t2.Easing = EasingTypes.Out;
                modButton.Transformations.Add(t2);
                modButton.HoverEffect = new Transformation(TransformationType.Fade, 0.6F, 0.8F, 0, 80);
            }
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            base.Initialize();

            NeedsFrequencySpectrum = true;

            for (int i = 0; i < sample_size; i++)
            {
                float angle = (OsuMathHelper.Pi * 2) * (0.4f + ((float)i / sample_size * (Overshoot * width)));
                angles[i]            = angle;
                angularDirections[i] = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));

                Vector2 pos = new Vector2(0, width * i);
                pSprite p   = new pSprite(TextureManager.Load(@"menu-vis", SkinSource.Osu), Fields.TopLeft, Origins.CentreLeft, Clocks.Game, pos)
                {
                    Alpha         = 0.2f,
                    Additive      = true,
                    VectorScale   = new Vector2(0, width),
                    AlwaysDraw    = true,
                    InitialColour = default_colour
                };

                spriteManager.Add(p);
                sprites.Add(p);
            }
        }
Exemplo n.º 3
0
        internal override void ComboBurst()
        {
            mascot.SetState(TaikoMascotStates.Clear, true);

            if (comboBurstSprites != null && comboBurstSprites.Length > 0)
            {
                pSprite cb = new pSprite(comboBurstSprites[comboBurstNumber], Origins.BottomCentre, new Vector2(54, TAIKO_BAR_Y + 6), 0.05f, false, Color.White);

                cb.Transformations.Add(new Transformation(TransformationType.Fade, 0, 1, GameBase.Time + 0,
                                                          GameBase.Time + 200));

                /*
                 *              cb.Transformations.Add(new Transformation(TransformationType.Rotation, -1, 0, GameBase.Time + 0,
                 *                                                        GameBase.Time + 600, EasingTypes.In));
                 */
                cb.Transformations.Add(new Transformation(TransformationType.Scale, 0.6f, 1f, GameBase.Time + 0,
                                                          GameBase.Time + 800, EasingTypes.Out));

                cb.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, GameBase.Time + 1600,
                                                          GameBase.Time + 1900, EasingTypes.In));
                player.spriteManagerBelowHitObjectsWidescreen.Add(cb);

                comboBurstNumber = (comboBurstNumber + 1) % comboBurstSprites.Length;
            }

            comboBurstStars();
        }
        internal ScoreboardEntryExtended(int rank, User user, int score) : base(rank, user.Name, score)
        {
            this.user = user;
            bool hasAvatar = user.CheckAvatar();

            if (!hasAvatar)
            {
                user.AvatarLoadComplete += user_AvatarLoadComplete;
            }

            foreach (pSprite p in SpriteCollection)
            {
                p.OriginPosition += new Vector2(-50, 0);
            }

            spriteAvatar = new pSprite(hasAvatar ? user.spriteAvatar.Texture : null, FieldTypes.Window,
                                       OriginTypes.Centre,
                                       ClockTypes.Game,
                                       position + new Vector2(16.8f, 15f), 0.920001f, true,
                                       Color.White);
            spriteAvatar.CurrentColour = Color.TransparentWhite;
            SpriteCollection.Add(spriteAvatar);
            if (hasAvatar)
            {
                spriteAvatar.CurrentScale = 51F / Math.Max(spriteAvatar.Width, spriteAvatar.Height);
            }
        }
Exemplo n.º 5
0
        internal static void NotificationClicked(object sender, EventArgs e)
        {
            pSprite p = sender as pSprite;

            p.FadeOut(50);
            p.AlwaysDraw = false;
        }
Exemplo n.º 6
0
 internal override void Bind(Event evt, TriggerLoop loop, pSprite sprite)
 {
     EventManager.OnPassing += delegate
     {
         Trigger(evt, loop, sprite, true);
     };
 }
Exemplo n.º 7
0
        public ChangelogOverlay(Game game, bool fullscreen = false)
            : base(game)
        {
            if (fullscreen)
            {
                Width       = GameBase.WindowManager.WidthScaled;
                Height      = 226;
                startHeight = 0;
            }

            area = new pScrollableArea(new Rectangle(0, GameBase.WindowManager.HeightScaled - Height, Width, Height), Vector2.Zero, true);
            area.HeaderHeight = startHeight;

            int year  = General.VERSION / 10000;
            int month = General.VERSION / 100 - year * 100;
            int day   = General.VERSION - year * 10000 - month * 100;

            int version_dated   = Int32.Parse(new DateTime(year, month, day).AddDays(-14).ToString("yyyyMMdd"));
            int version_current = Int32.Parse(new DateTime(year, month, day).ToString("yyyyMMdd"));

            pWebRequest snr = new pWebRequest(General.WEB_ROOT + "/p/changelog?updater=3" + (!string.IsNullOrEmpty(General.SUBVERSION) ? "&test=1" : "&current=" + version_current + "&from=" + version_dated));

            snr.Finished += snr_onFinish;
            snr.Perform();

            pSprite bg = new pSprite(GameBase.WhitePixel, Vector2.Zero, 0.5f, true, Color.Black);

            bg.Scale            = 1.6f;
            bg.ViewOffsetImmune = true;
            bg.VectorScale      = new Vector2(Width, Height);
            bg.Alpha            = 0.5f;

            area.ContentSpriteManager.Add(bg);

            if (!fullscreen)
            {
                pText t = new pText(LocalisationManager.GetString(OsuString.Update_RecentChanges), 10, new Vector2(3, 3), Vector2.Zero, 0.9992f, true, Color.White, false);
                t.ViewOffsetImmune = true;
                t.TextBold         = true;

                area.ContentSpriteManager.Add(t);

                bg                  = new pSprite(GameBase.WhitePixel, Vector2.Zero, 0.9991f, true, SkinManager.NEW_SKIN_COLOUR_SECONDARY);
                bg.Scale            = 1.6f;
                bg.ViewOffsetImmune = true;
                bg.VectorScale      = new Vector2(Width, startHeight);
                bg.Alpha            = 0.8f;
                bg.HandleInput      = true;

                bg.HoverEffect = new Transformation(Color.DarkBlue, Color.LightBlue, 0, 50);

                bg.OnClick += delegate
                {
                    area.ContentSpriteManager.SpriteList.ForEach(s => s.FadeOut(100));
                    GameBase.Scheduler.AddDelayed(delegate { area.Hide(); }, 100);
                };

                area.ContentSpriteManager.Add(bg);
            }
        }
        internal ScoreboardEntryExtended(int rank, User user, MatchScoringTypes scoreType, PlayModes playMode, SlotTeams team, Mods mods = Mods.None)
            : base(rank, user.Name, playMode)
        {
            PositionOffset = new Vector2(32.4f, 0);

            Team           = team;
            this.scoreType = scoreType;
            this.mods      = mods;


            //SpriteCollection.AddRange(ModManager.ShowModSprites(mods, new Vector2(34, 6), 0.5f));

            SpriteAvatar = new pSpriteDynamic(null, null, 0, new Vector2(-15.6f, 12.51f), 0.920001f)
            {
                Alpha = 0
            };
            user.LoadAvatarInto(SpriteAvatar, 51f);

            SpriteSkip = new pSprite(TextureManager.Load(@"multi-skipped"), Fields.TopLeft, Origins.BottomRight, Clocks.Game, new Vector2(86, 30), SpriteBackground.Depth + 0.000001f, true, Color.White)
            {
                Alpha  = 0,
                Bypass = true
            };

            SpriteCollection.Add(SpriteSkip);
            SpriteCollection.Add(SpriteAvatar);

            UpdateSpriteLayout();
        }
Exemplo n.º 9
0
        public override void Initialize()
        {
            background = new pSprite(GameBase.WhitePixel, Fields.TopRight, Origins.TopLeft,
                                     Clocks.Game,
                                     new Vector2(XPOSHIDDEN, YPOS), 0.68f, true,
                                     new Color(0, 0, 0, 180));
            background.Scale       = 1.6f;
            background.VectorScale = new Vector2(WIDTH, HEIGHT);
            spriteManager.Add(background);


            pText header = new pText(@"osu!direct", 14, new Vector2(XPOSHIDDEN, YPOS), 1, true, Color.YellowGreen)
            {
                Field    = Fields.TopRight,
                TextBold = true
            };

            spriteManager.Add(header);

            pText header2 = new pText(@"panel", 12, new Vector2(XPOSHIDDEN - 40, YPOS + 8), 1, true, Color.White);

            header2.Field    = Fields.TopRight;
            header2.TextBold = true;
            spriteManager.Add(header2);

            spriteManager.FirstDraw = false; //Don't do skippy stuff for this spritemanager.

            base.Initialize();
        }
Exemplo n.º 10
0
        private void updateBackgroundAlignment(pSprite s, AlignmentMode alignmentMode, BackgroundAdjustmentDelegate backgroundAdjustment)
        {
            if (s == null || BackgroundTexture == null)
            {
                return;
            }

            if ((alignmentMode & AlignmentMode.Storyboard) != 0)
            {
                s.ScaleToScreen((alignmentMode & AlignmentMode.Widescreen) != 0);
            }
            else
            {
                //first align based on height
                s.Scale = (float)GameBase.WindowManager.SpriteRes / BackgroundTexture.DisplayHeight;

                //if it isn't wide enough, let's make it so.
                if (s.Width * s.Scale * GameBase.WindowManager.RatioInverse < GameBase.WindowManager.Width)
                {
                    s.Scale = GameBase.WindowManager.Width / ((float)s.Width * GameBase.WindowManager.RatioInverse);
                }
            }

            if (backgroundAdjustment != null)
            {
                backgroundAdjustment(BackgroundSprite);
            }

            currentAlignmentMode        = alignmentMode;
            currentBackgroundAdjustment = backgroundAdjustment;
        }
Exemplo n.º 11
0
        internal pCheckbox(string text, float size, Vector2 position, float depth, bool defaultStatus, float maxWidth = 0)
        {
            pos = position;

            localChecked = defaultStatus;
            this.size    = size;

            t_checked   = TextureManager.Load(@"circle-full", SkinSource.Osu);
            t_unchecked = TextureManager.Load(@"circle-empty", SkinSource.Osu);

            sBox             = new pSprite(localChecked ? t_checked : t_unchecked, Fields.TopLeft, Origins.Centre, Clocks.Game, position + new Vector2(8, 8), depth, true, SkinManager.NEW_SKIN_COLOUR_MAIN);
            sBox.HandleInput = true;
            sBox.Scale       = size;
            sBox.OnClick    += p_OnClick;
            sBox.ClickRequiresConfirmation = true;

            sText        = new pText(text, 15 * size, position + (new Vector2(20 * size, 8)), new Vector2(Math.Max(0, maxWidth - 20 * size), 0), depth, true, Color.White, true);
            sText.Origin = Origins.CentreLeft;
            sText.ClickRequiresConfirmation = true;
            sText.HandleInput = true;
            sText.OnClick    += p_OnClick;


            SpriteCollection.Add(sBox);
            SpriteCollection.Add(sText);
        }
Exemplo n.º 12
0
        internal override void Initialize()
        {
            base.Initialize();

            spriteManager.Add(coinsBuyButton = new pSprite(@"coins-buy", new Vector2(-35, -10), SkinSource.All, Origins.Centre, Fields.TopCentre)
            {
                Depth = 0.88f
            });
            spriteManager.Add(coinsBg = new pSprite(@"coins-bg", new Vector2(0, -10), SkinSource.All, Origins.Centre, Fields.TopCentre)
            {
                Depth = 0.9f
            });
            spriteManager.Add(coinsFg = new pSprite(@"coins", new Vector2(0, -15), SkinSource.All, Origins.Centre, Fields.TopCentre)
            {
                Depth = 0.98f, Scale = 0.55f
            });

            coinsBuyButton.OnClick    += buyMore;
            coinsBuyButton.HandleInput = true;
            coinsBuyButton.HoverEffect = new Transformation(Color.White, Color.HotPink, 0, 100);

            spriteManager.Add(coinsCount = new pText(string.Empty, 16, new Vector2(0, 0), 1, true, Color.White)
            {
                Field = Fields.TopCentre, Origin = Origins.Centre, TextShadow = false
            });

            spriteManager.SpriteList.ForEach(s => { s.Alpha = 0; });

            pWebRequest snr = new pWebRequest(string.Format(General.WEB_ROOT + "/web/coins.php?action=check&u={0}&h={1}&c={2}&cs={3}", ConfigManager.sUsername, ConfigManager.sPassword, Count, Checksum));

            snr.Finished += snr_onFinish;
            snr.Perform();
        }
Exemplo n.º 13
0
        private bool onClick(object sender, EventArgs e)
        {
            if (coinsDialog != null && coinsDialog.Alpha == 1)
            {
                if (coinsDialog.Hovering)
                {
                    pSprite error;
                    spriteManagerDialog.Add(error = new pSprite(@"coins-error", new Vector2(0, 0), SkinSource.All, Origins.Centre, Fields.Centre)
                    {
                        Depth = 0.9f, Scale = 1.4f
                    });
                    error.AlwaysDraw = false;
                    error.FadeOut(5000, EasingTypes.InExpo);
                    error.ScaleTo(1, 200, EasingTypes.OutElastic);

                    Recharge();
                }
                else
                {
                    coinsDialog.FadeOut(100);
                }

                coinsDialog.AlwaysDraw = false;
                coinsDialog            = null;

                return(true);
            }

            return(false);
        }
Exemplo n.º 14
0
        internal bool EarnCoin()
        {
            if (!GameBase.HasLogin)
            {
                return(true);
            }

            pSprite coin = coinSingular.Clone();

            coin.Position = InputManager.CursorPosition / GameBase.WindowManager.Ratio;
            coin.Depth    = 0.99f;
            coin.FadeOut(1500);

            spriteManagerDialog.Add(coin);
            physics.Add(coin, new Vector2((float)RNG.NextDouble() * 100, (float)RNG.NextDouble() * -100));

            pSprite coinShine = coinSingular.Clone();

            coinShine.Additive  = true;
            coinShine.OnUpdate += delegate { coinShine.Position = coin.Position; };
            coinShine.FadeOut(500);

            spriteManagerDialog.Add(coinShine);

            AudioEngine.PlaySample(@"coins-earn", 80);

            Count++;

            pWebRequest snr = new pWebRequest(string.Format(General.WEB_ROOT + "/web/coins.php?action=earn&u={0}&h={1}&c={2}&cs={3}", ConfigManager.sUsername, ConfigManager.sPassword, Count, Checksum));

            snr.Finished += snr_onFinish;
            snr.Perform();

            return(true);
        }
Exemplo n.º 15
0
        internal pSliderBar(SpriteManager spriteManager, double min, double max, double initial, Vector2 position,
                            int length)
        {
            this.min      = min;
            this.max      = max;
            this.initial  = initial;
            current       = initial;
            this.position = position;
            this.length   = length;
            lineColour    = Color.White;

            MouseHandler.OnClick        += GameBase_OnClick;
            MouseHandler.OnDrag         += MouseHandler_OnDrag;
            MouseHandler.OnEndDrag      += MouseHandler_OnEndDrag;
            KeyboardHandler.OnKeyRepeat += GameBase_OnKeyRepeat;

            seekbar1 =
                new pSprite(GameBase.content.Load <Texture2D>("seekbar-over"), FieldTypes.Window, OriginTypes.Centre,
                            ClockTypes.Game, seekPosition, 1, true, Color.White, null);
            seekbar1.CurrentColour = new Color(255, 255, 255, 180);
            seekbar1.HoverEffect   = new Transformation(TransformationType.Fade, 0.7f, 1, 0, 50);
            seekbar1.IsClickable   = true;

            line = new pSprite(GameBase.WhitePixel, position, 0.9f, true, lineColour);
            line.UseVectorScale   = true;
            line.ExactCoordinates = true;
            line.VectorScale      = new Vector2(length * 1.6f, 1);


            SpriteCollection.Add(line);
            SpriteCollection.Add(seekbar1);

            spriteManager.Add(line);
            spriteManager.Add(seekbar1);
        }
Exemplo n.º 16
0
        internal override void InitializeModSettings()
        {
            HitObjectManagerMania manager = (HitObjectManagerMania)hitObjectManager;

            //Don't consider score increase mods to not go over mania max
            double multiplier = ModManager.ScoreMultiplier(Player.currentScore.EnabledMods & ~(Mods.ScoreIncreaseMods), Player.Mode, manager.Beatmap);

            ScoreMultiplier = (double)JudgementMania.ScoreMax / manager.CountTotal * multiplier;

            if (!ModManager.CheckActive(Player.currentScore.EnabledMods, Mods.SuddenDeath))
            {
                if (ModManager.CheckActive(Player.currentScore.EnabledMods, Mods.Easy))
                {
                    Recoveries = 2;
                }
            }

            if (ModManager.CheckActive(Player.currentScore.EnabledMods, Mods.Flashlight))
            {
                spriteManagerFlashlight = new SpriteManager(true);

                s_Flashlight       = new pSprite(null, Fields.Storyboard, Origins.CentreLeft, Clocks.Game, new Vector2(0, 220), 1, true, Color.White);
                s_Flashlight.Scale = 1.4F;

                spriteManagerFlashlight.Add(s_Flashlight);
                loadFlashlight();
            }
        }
Exemplo n.º 17
0
        internal override void Initialize()
        {
            base.Initialize();

            float left = CentrePosition.X - Width / 2;

            float piece = Width;

            pSprite bg = new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.Centre, Clocks.Audio, CentrePosition, 0.79f, true, Color.Black);

            bg.Alpha       = 0.4f;
            bg.VectorScale = new Vector2(piece, barHeight * 24) * 1.6f;
            spriteManager.Add(bg);

            HitCircleOsuTarget h = new HitCircleOsuTarget(hitObjectManager, new Vector2(256, 365), 0, false, HitObjectSoundType.None, 0); // Needs to associate this hitobject to a HitObjectManager! NullPointerException otherwise! (HitCircleOsu ctor)

            h.SetColour(Color.Red);
            h.SpriteCollection.ForEach(s =>
            {
                s.AlwaysDraw = true;
                s.Transformations.Clear();
                s.Alpha = 1;
            });

            spriteManager.Add(h.SpriteCollection);
        }
Exemplo n.º 18
0
        internal Group(SpriteManager spriteManager, int groupID)
        {
            this.spriteManager = spriteManager;
            this.name          = (char)('A' + groupID);

            xPos     = GROUP_WIDTH / 2f + 1 + (float)Math.Floor(groupID / (float)(groupsPerColumn - 1)) * (GROUP_WIDTH + 1);
            groupID %= groupsPerColumn - 1;
            yPos     = (GROUP_SPACING / 2f + 1) + groupID * (GROUP_SPACING + 1);
            yPos    += groupID * totalGroupHeight;

            spriteManager.Add(background = new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.TopCentre, Clocks.Game,
                                                       new Vector2(xPos, yPos), 1.005f, true, Color.Black)
            {
                Scale       = 1.6f,
                VectorScale = new Vector2(GROUP_WIDTH, totalGroupHeight + GROUP_SPACING),
                Alpha       = 0.5f
            });

            spriteManager.Add(new pText(string.Format("Group {0}", name), GROUP_NAME_HEIGHT, new Vector2(xPos, yPos), 1.01f, true, Color.White)
            {
                Origin = Origins.TopCentre
            });

            yPos       += GROUP_NAME_HEIGHT;
            initialYPos = yPos;
        }
Exemplo n.º 19
0
        protected void Trigger(Event evt, TriggerLoop loop, pSprite sprite, bool alwaysClearLoops)
        {
            if (alwaysClearLoops)
            {
                evt.RemoveAllLoops(TriggerGroup);
            }

            if (loop.TriggerEndTime != 0 &&
                (AudioEngine.Time < loop.TriggerStartTime || AudioEngine.Time > loop.TriggerEndTime))
            {
                return;
            }

            if (!alwaysClearLoops)
            {
                if (HasSpecificTriggerGroup)
                {
                    evt.RemoveAllLoops(TriggerGroup);
                }
                else
                {
                    evt.RemoveLoop(loop);
                }
            }

            loop.StartTime = AudioEngine.Time;
            sprite.MakeLoopStatic(loop);
        }
Exemplo n.º 20
0
        internal BeatmapPanel(Beatmap beatmap)
        {
            backingPlate            = pSprite.FullscreenWhitePixel;
            backingPlate.Alpha      = 1;
            backingPlate.AlwaysDraw = true;
            backingPlate.Colour     = Color4.OrangeRed;
            backingPlate.Scale.Y    = 80;
            backingPlate.Scale.X   *= 0.8f;
            backingPlate.DrawDepth  = 0.8f;
            SpriteCollection.Add(backingPlate);

            this.beatmap = beatmap;

            backingPlate.OnClick += delegate {
                backingPlate.MoveTo(backingPlate.Position - new Vector2(50, 0), 600);
                backingPlate.Transform(new Transformation(TransformationType.VectorScale, backingPlate.Scale,
                                                          new Vector2(backingPlate.Scale.X * 1.2f, backingPlate.Scale.Y),
                                                          backingPlate.ClockingNow, backingPlate.ClockingNow + 600));

                backingPlate.UnbindAllEvents();

                Player.SetBeatmap(beatmap);
                Director.ChangeMode(OsuMode.Play);
            };

            backingPlate.HandleClickOnUp = true;

            backingPlate.OnHover     += delegate { backingPlate.Colour = Color4.YellowGreen; };
            backingPlate.OnHoverLost += delegate { backingPlate.Colour = Color4.OrangeRed; };

            text = new pText(Path.GetFileNameWithoutExtension(beatmap.BeatmapFilename), 18, Vector2.Zero, Vector2.Zero, 1, true, Color4.White, false);
            SpriteCollection.Add(text);
        }
Exemplo n.º 21
0
        public override void Initialize()
        {
            int y_start = GameBase.WindowManager.HeightScaled / 2 +
                          (PlayerVs.Match != null && (PlayerVs.Match.matchTeamType == MatchTeamTypes.TagTeamVs || PlayerVs.Match.matchTeamType == MatchTeamTypes.TeamVs) ? 40 : -40);

            pSprite background = new pSprite(TextureManager.Load(@"inputoverlay-background"), Fields.TopLeft, Origins.TopLeft, Clocks.Game, new Vector2(GameBase.WindowManager.WidthScaled, y_start))
            {
                Rotation    = OsuMathHelper.PiOver2,
                VectorScale = new Vector2(1.05f, 1),
                AlwaysDraw  = true,
                Depth       = 0.9f
            };

            spriteManager.Add(background);

            float yOffset = 0;

            foreach (ButtonType b in Enum.GetValues(typeof(ButtonType)))
            {
                Vector2            pos    = new Vector2(GameBase.WindowManager.WidthScaled - 15, y_start + 19f + yOffset);
                InputOverlayButton button = new InputOverlayButton(b, pos);

                buttons.Add(button);
                spriteManager.Add(button.Sprites);

                yOffset += 29.5f;
            }

            base.Initialize();
        }
Exemplo n.º 22
0
        public SliderControl(string text, float initialValue, Vector2 position, FloatDelegate onValueChanged)
        {
            action = onValueChanged;

            BackingPlate = new pSprite(TextureManager.Load(OsuTexture.sliderbar), position)
            {
                Colour = new Color4(50, 50, 50, 255)
            };
            Add(BackingPlate);

            FrontPlate = new pSprite(TextureManager.Load(OsuTexture.sliderbar), position)
            {
                DrawDepth = BackingPlate.DrawDepth + 0.01f,
                Colour    = new Color4(97, 159, 0, 255),
                Additive  = true
            };
            Add(FrontPlate);

            Vector2 offset = new Vector2(-BackingPlate.DisplayRectangle.Width / 2, -BackingPlate.DisplayRectangle.Height / 2);

            BackingPlate.Offset = offset;
            FrontPlate.Offset   = offset;

            Text = new pText(text, 24, position, BackingPlate.DrawDepth + 0.02f, true, Color4.White)
            {
                Origin     = OriginTypes.Centre,
                TextShadow = true
            };
            Add(Text);

            BackingPlate.OnClick += SliderControl_OnClick;

            UpdateValue(initialValue);
        }
Exemplo n.º 23
0
        internal override void UpdateGeneral()
        {
            caughtFruits.ForEach(hf => hf.ModifyPosition(catcher1.Position + hf.CatchOffset));
            caughtSprites.ForEach(s => s.Position = catcher1.Position + s.InitialPosition);
            caughtSprites.RemoveAll(s => !s.IsVisible);

            if (Dashing && GameBase.Time - lastDashSpriteTime > 16)
            {
                pSprite catcher1a = new pSprite(catcher1.Texture, Fields.Gamefield, Origins.TopCentre,
                                                Clocks.Game, catcher1.Position, 0.84f, false, catcher1.InitialColour);
                catcher1a.Alpha             = 0.5f;
                catcher1a.FlipHorizontal    = catcher1.FlipHorizontal;
                catcher1a.Additive          = true;
                catcher1a.OriginPosition.Y += 16;
                catcher1a.Scale             = 0.71f;
                catcher1a.FadeOut(catcher1.Position.X != catcherPositionLastFrame.X ? 250 : 100);

                hitObjectManager.spriteManager.Add(catcher1a);

                catcherPositionLastFrame = catcher1.Position;
                lastDashSpriteTime       = GameBase.Time;
            }

            if (catcher1.TextureArray != catcherFail)
            {
                catcher1.TextureArray = AudioEngine.KiaiEnabled ? catcherKiai : catcherIdle;
            }
        }
Exemplo n.º 24
0
        internal override void Disarm()
        {
            bool hidden = ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.Hidden);

            if (hidden)
            {
                return;
            }

            base.Disarm();

            for (int i = 0; i < SpriteCollection.Count; i++)
            {
                pSprite p = SpriteCollection[i];
                if (p.Clock == Clocks.Game)
                {
                    continue;
                }

                p.Transformations.RemoveAll(t => t.TagNumeric == ARMED);
                p.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, StartTime, StartTime)
                {
                    TagNumeric = ARMED
                });
            }
        }
Exemplo n.º 25
0
        public override void Update()
        {
            base.Update();

            if (GameBase.Tournament)
            {
                velocityAdjustment = 0.5f;
            }
            else
            {
                velocityAdjustment = velocityAdjustment * 0.97f + 0.03f * (float)Math.Max(0, 1 - Math.Max(0, (Math.Pow((GameBase.ElapsedMilliseconds / GameBase.SIXTY_FRAME_TIME), 4) - 1)));
            }

            float decayFactor = (float)Math.Pow(decay, GameBase.FrameRatio);

            for (int i = 0; i < sample_size; i++)
            {
                pSprite s = sprites[i];
                s.Alpha = Math.Max(0, Alpha * MaxAlpha * Math.Min(1, (s.VectorScale.X - cutoff) / (cutoff * 2)));

                float newValue = data[i] * velocityAdjustment * max_velocity;

                if (newValue <= s.VectorScale.X)
                {
                    newValue = s.VectorScale.X * decayFactor;
                }

                if (newValue < Visualisation.decay_cutoff)
                {
                    newValue = 0;
                }

                s.VectorScale.X = newValue;
            }
        }
Exemplo n.º 26
0
        internal void OnClick(HitObject h)
        {
            if ((h != null && h is HitCircle) || Player.IsSliding)
            {
                pSprite s =
                    new pSprite(SkinManager.Load("hitcircle"), FieldTypes.Gamefield, OriginTypes.Centre,
                                ClockTypes.Audio, new Vector2(100, 150), SpriteManager.drawOrderBwd(h != null ? h.StartTime : 0.1f), true, h != null ? h.Colour : new Color(252, 184, 6));
                s.CurrentScale = h != null ? h.SpriteCollection[0].CurrentScale : 0.7f;
                HitObjectManager.spriteManager.Add(s);
                s.StartPosition.X = GameBase.DisplayToGamefieldX(player.s_scoreKi.CurrentPosition.X);

                s.TagNumeric = 180;
                flyingCircles.Add(s);

                s =
                    new pSprite(SkinManager.Load("hitcircleoverlay"), FieldTypes.Gamefield, OriginTypes.Centre,
                                ClockTypes.Audio, new Vector2(100, 150), SpriteManager.drawOrderBwd(h != null ? h.StartTime - 1 : 0.11f), true, Color.White);
                s.CurrentScale    = h != null ? h.SpriteCollection[0].CurrentScale : 0.7f;
                s.StartPosition.X = GameBase.DisplayToGamefieldX(player.s_scoreKi.CurrentPosition.X);
                s.TagNumeric      = 180;
                HitObjectManager.spriteManager.Add(s);
                flyingCircles.Add(s);
            }

            if (InputManager.leftButton == ButtonState.Pressed && !InputManager.leftButtonLastBool)
            {
                AudioEngine.PlaySample(AudioEngine.s_HitNormal);

                if (InputManager.leftButton1i)
                {
                    taikoInnerLeft.Transformations.Clear();
                    taikoInnerLeft.Transformations.Add(new Transformation(TransformationType.Fade, taikoInnerLeft.CurrentColour.A / 255f, 1, GameBase.Time, GameBase.Time + (int)((1 - taikoInnerLeft.CurrentColour.A / 255f) * 80), EasingTypes.In));
                    taikoInnerLeft.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, GameBase.Time + 100, GameBase.Time + 150));
                }
                if (InputManager.leftButton2i)
                {
                    taikoInnerRight.Transformations.Clear();
                    taikoInnerRight.Transformations.Add(new Transformation(TransformationType.Fade, taikoInnerRight.CurrentColour.A / 255f, 1, GameBase.Time, GameBase.Time + (int)((1 - taikoInnerRight.CurrentColour.A / 255f) * 80), EasingTypes.In));
                    taikoInnerRight.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, GameBase.Time + 100, GameBase.Time + 150));
                }
            }
            if (InputManager.rightButton == ButtonState.Pressed && !InputManager.rightButtonLastBool)
            {
                AudioEngine.PlaySample(AudioEngine.s_HitWhistle);

                if (InputManager.rightButton1i)
                {
                    taikoOuterLeft.Transformations.Clear();
                    taikoOuterLeft.Transformations.Add(new Transformation(TransformationType.Fade, taikoOuterLeft.CurrentColour.A / 255f, 1, GameBase.Time, GameBase.Time + (int)((1 - taikoOuterLeft.CurrentColour.A / 255f) * 80), EasingTypes.In));
                    taikoOuterLeft.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, GameBase.Time + 100, GameBase.Time + 150));
                }

                if (InputManager.rightButton2i)
                {
                    taikoOuterRight.Transformations.Clear();
                    taikoOuterRight.Transformations.Add(new Transformation(TransformationType.Fade, taikoOuterRight.CurrentColour.A / 255f, 1, GameBase.Time, GameBase.Time + (int)((1 - taikoOuterRight.CurrentColour.A / 255f) * 80), EasingTypes.In));
                    taikoOuterRight.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, GameBase.Time + 100, GameBase.Time + 150));
                }
            }
        }
Exemplo n.º 27
0
        private void updateSlidingBar()
        {
            if (taikoSlider == null)
            {
                return;
            }

            float oldXpos = 0;

            while ((oldXpos = (taikoSlider.Position.X + (taikoSlider.DrawWidth * taikoSlider.Scale * 0.625f)) * GameBase.WindowManager.Ratio) <= GameBase.WindowManager.Width)
            {
                pSprite old = taikoSlider;
                taikoSlider = taikoSlider.Clone();

                taikoSliderActiveCollection.Add(taikoSlider);

                float startX = oldXpos / GameBase.WindowManager.Ratio;
                float endX   = old.Transformations[0].EndVector.X;

                taikoSlider.Position.X = startX;
                taikoSlider.Transformations[0].StartVector.X = startX;
                taikoSlider.Transformations[0].EndVector.X   = endX;

                taikoSlider.Transformations[0].Time1 = (int)(AudioEngine.Time);
                taikoSlider.Transformations[0].Time2 = (int)(AudioEngine.Time + (endX - startX) / (old.Transformations[0].EndVector.X - old.Transformations[0].StartVector.X) * old.Transformations[0].Duration);

                player.spriteManagerBelowHitObjectsWidescreen.Add(taikoSlider);
            }
        }
Exemplo n.º 28
0
        public NewsButton()
        {
            newsButton          = new pSprite(TextureManager.Load(OsuTexture.news_button), FieldTypes.StandardSnapBottomLeft, OriginTypes.BottomLeft, ClockTypes.Mode, Vector2.Zero, 0.8f, true, Color4.White);
            newsButton.OnClick += newsButton_OnClick;
            Add(newsButton);

            newsLight          = new pSprite(TextureManager.Load(OsuTexture.news_light), FieldTypes.StandardSnapBottomLeft, OriginTypes.BottomLeft, ClockTypes.Mode, new Vector2(3, 13f), 0.81f, true, Color4.White);
            newsLight.Additive = true;

            newsLight.Transform(new TransformationF(TransformationType.Fade, 0, 1, 0, 300, EasingTypes.Out)
            {
                Looping = true, LoopDelay = 1500
            });
            newsLight.Transform(new TransformationF(TransformationType.Fade, 1, 0, 300, 1500, EasingTypes.Out)
            {
                Looping = true, LoopDelay = 600
            });
            Add(newsLight);

            newsLight.Bypass = true;

            string lastRead      = GameBase.Config.GetValue("NewsLastRead", string.Empty);
            string lastRetrieved = GameBase.Config.GetValue("NewsLastRetrieved", string.Empty);

            if (lastRead == string.Empty || lastRetrieved != lastRead)
            {
                HasNews = true;
            }

            StringNetRequest nr = new StringNetRequest(@"https://osustream.com/misc/news.php?v=2");

            nr.onFinish += newsCheck_onFinish;
            NetManager.AddRequest(nr);
        }
Exemplo n.º 29
0
        protected override void PopulateSprites()
        {
            if (SpriteCollection == null)
            {
                SpriteCollection = new List <pDrawable>();
            }

            backgroundSprite =
                new pSprite(s_menuButtonBackground, Fields.TopLeft,
                            Origins.CentreLeft,
                            Clocks.Game,
                            new Vector2((float)Position.X, (float)Position.Y), StartDepth, true, BackgroundColour,
                            this);
            backgroundSprite.HandleInput = true;
            SpriteCollection.Add(backgroundSprite);

            textTitle        = new pText(nameWithCount, 24, Vector2.Zero, Vector2.Zero, StartDepth + DEPTH_INCREASE_STEP, true, colourTextInactive, false);
            textTitle.Origin = Origins.CentreLeft;
            textTitle.Tag    = new Vector2(15, 0);

            blackSprites.Add(textTitle);
            SpriteCollection.Add(textTitle);

            UpdateCount();
        }
Exemplo n.º 30
0
        private SpriteManager m_sprite_manager; // ^

        internal pSpriteMenuItem(pSpriteMenu menu, SpriteManager sprite_manager, Vector2 size, Vector2 location, bool selected)
        {
            m_size           = size;
            m_location       = location;
            m_menu           = menu;
            m_sprite_manager = sprite_manager;
            m_selected       = selected;
            m_visible        = false;

            Color backcol = selected ? SelectedColour : BackgroundColour;

            Background = new pSprite(TextureManager.Load(@"opaque-white", SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                     Clocks.Game, new Vector2(location.X, location.Y), 0.99f, true, Color.TransparentBlack, null);
            Background.VectorScale = new Vector2((float)size.X / 16.0f, (float)size.Y / 16.0f);

            Background.HoverEffects = new List <Transformation>();
            Background.HoverEffects.Add(new Transformation(backcol, HighlightColour, 0, 10));

            Background.HoverLostEffects = new List <Transformation>();
            Background.HoverLostEffects.Add(new Transformation(HighlightColour, backcol, 0, 100));

            Background.OnClick += Click;

            m_sprite_manager.Add(Background);
        }