Ejemplo n.º 1
0
        internal BackgroundManager(Tournament tournament, SpriteManager spriteManager, float depth)
        {
            this.tournament = tournament;

            var remoteBackgroundSprite = new pSpriteDynamic(Tournament.Config.GetValue(@"background", @"https://osu.ppy.sh/images/tournament/default.png"), null, 0, Vector2.Zero, 0.1f)
            {
                AlwaysDraw = true,
                Alpha      = 0
            };

            remoteBackgroundSprite.OnTextureLoaded += () => remoteBackgroundSprite.ScaleToScreen(false, true);
            spriteManager.Add(remoteBackgroundSprite);

            foreach (string bg in backgroundNames)
            {
                var tex = TextureManager.Load(Path.Combine(Tournament.SkinDirectory, bg));
                if (tex != null)
                {
                    var bgSprite = new pSprite(tex, Fields.TopLeft, Origins.TopLeft, Clocks.Game, Vector2.Zero, depth, true, Color.White)
                    {
                        Alpha = 0
                    };
                    bgSprite.ScaleToScreen(false, true);

                    modeBackgroundSprites.Add(bg, bgSprite);
                    spriteManager.Add(bgSprite);
                }

                var tempVideo = new pVideo(Path.Combine(Tournament.SkinDirectory, bg), SkinSource.Skin, Clocks.Game);
                if (tempVideo.Texture != null)
                {
                    tempVideo.Field  = Fields.TopLeft;
                    tempVideo.Origin = Origins.TopLeft;
                    // Make sure videos are above backgrounds in all cases
                    tempVideo.Depth = depth + 0.0001f;
                    tempVideo.Alpha = 0;
                    tempVideo.Loop  = true;
                    tempVideo.ScaleToScreen(false, true);
                    tempVideo.UpdateTextureAlignment();

                    modeBackgroundVideos.Add(bg, tempVideo);
                    spriteManager.Add(tempVideo);
                }

                depth += 0.00001f;
            }

            if (!modeBackgroundSprites.ContainsKey(backgroundNames[0]))
            {
                modeBackgroundSprites.Add(backgroundNames[0], remoteBackgroundSprite);
            }

            loadBackground(@"background");
        }
Ejemplo n.º 2
0
        internal EventManager()
        {
            backgroundColour = new Color(163, 162, 255);

            spriteDrawDepth = 0;

            spriteManagerBG = new SpriteManager();
            spriteManagerFG = new SpriteManager();

            storyLayerSets = new List <Event> [Enum.GetValues(typeof(StoryLayer)).Length];

            for (int i = 0; i < storyLayerSets.Length; i++)
            {
                storyLayerSets[i] = new List <Event>();
            }

            videoSprites = new List <pVideo>();
            eventSamples = new List <EventSample>();
            eventBreaks  = new List <EventBreak>();

            events = new List <Event>();

            backgroundTexture =
                new pSprite(SkinManager.Load("playfield"), FieldTypes.Window, OriginTypes.TopLeft,
                            ClockTypes.Audio, Vector2.Zero, 0, true, backgroundColour, "debug");
            spriteManagerBG.Add(backgroundTexture);


            /*foregroundTexture =
             * new pSprite(GameBase.White, FieldTypes.WindowNone, OriginTypes.TopLeft,
             *  ClockTypes.Game, Vector2.Zero, 0.99F, true, Color.TransparentBlack);
             * spriteManager.Add(foregroundTexture);
             * foregroundTexture.UseVectorScale = true;
             * foregroundTexture.VectorScale = new Vector2(GameBase.WindowWidth, GameBase.WindowHeight);
             */

            breakTop =
                new pSprite(GameBase.WhitePixel, FieldTypes.WindowNone, OriginTypes.TopLeft,
                            ClockTypes.Game, new Vector2(0, 0), 0.5f, true, Color.TransparentBlack);
            spriteManagerBG.Add(breakTop);
            breakTop.UseVectorScale = true;
            breakTop.VectorScale    = new Vector2(GameBase.WindowWidth, GameBase.WindowHeight * 0.125F);

            breakBottom =
                new pSprite(GameBase.WhitePixel, FieldTypes.WindowNone, OriginTypes.TopLeft,
                            ClockTypes.Game, new Vector2(0, (float)(GameBase.WindowDefaultHeight * 0.875)), 0.5f, true,
                            Color.TransparentBlack);
            spriteManagerBG.Add(breakBottom);
            breakBottom.UseVectorScale = true;
            breakBottom.VectorScale    = new Vector2(GameBase.WindowWidth, GameBase.WindowHeight * 0.125F);

            BackgroundDrawDepth = 0.4F;
        }
Ejemplo n.º 3
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.º 4
0
        internal ProgressBar(SpriteManager spriteManager, ProgressBarTypes type, float topRightVerticalOffset = 34)
        {
            this.spriteManager = spriteManager;
            Fields field;

            switch (type)
            {
            case ProgressBarTypes.Bottom:
                Position = new Vector2(0, 477);
                length   = GameBase.WindowManager.Width / GameBase.WindowManager.Ratio;
                field    = Fields.TopLeft;
                break;

            case ProgressBarTypes.TopRight:
            default:
                Position = new Vector2(178, topRightVerticalOffset - 2);
                length   = 170;
                field    = Fields.TopRight;
                break;

            case ProgressBarTypes.BottomRight:
                Position = new Vector2(118, 460);
                length   = 118;
                field    = Fields.TopRight;
                break;

            case ProgressBarTypes.Pie:
                return;     //Extended class handles this fully.
            }

            progressBarBackground = new pSprite(GameBase.WhitePixel, field, Origins.TopLeft,
                                                Clocks.Game,
                                                Position, 0.938f, true,
                                                new Color(255, 255, 255, 20));
            progressBarBackground.Scale       = 1.6f;
            progressBarBackground.VectorScale = new Vector2(length, height);
            progressBarBackground.Additive    = true;

            spriteManager.Add(progressBarBackground);


            progressBarForeground = new pSprite(GameBase.WhitePixel, field, Origins.TopLeft,
                                                Clocks.Game,
                                                Position, 0.94f, true,
                                                new Color(255, 255, 128, 128));
            progressBarForeground.Scale       = 1.6f;
            progressBarForeground.VectorScale = new Vector2(0, height);
            progressBarForeground.Additive    = true;

            spriteManager.Add(progressBarForeground);
        }
Ejemplo n.º 5
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.º 6
0
        internal pSliderBar(SpriteManager spriteManager, double min, double max, double initial, Vector2 position, int length)
        {
            Min        = min;
            Max        = max;
            Current    = Initial = OsuMathHelper.Clamp(initial, Min, Max);
            Length     = length;
            lineColour = SkinManager.NEW_SKIN_COLOUR_MAIN;

            lineLeft                  = new pSpriteSliderBarLine(GameBase.WhitePixel, position, 0.992f, lineColour, length);
            lineLeft.HandleInput      = true;
            lineLeft.ExactCoordinates = true;
            lineLeft.VectorScale      = new Vector2(length * 1.6f, 1.5f);

            lineRight = new pSprite(GameBase.WhitePixel, position, 0.991f, true, lineColour);
            lineRight.ExactCoordinates = true;
            lineRight.HandleInput      = true;
            lineRight.Alpha            = 0.5f;
            lineRight.VectorScale      = new Vector2(length * 1.6f, 1.5f);

            Seekbar =
                new pSprite(TextureManager.Load(@"circle-empty", SkinSource.Osu), Fields.TopLeft, Origins.Centre,
                            Clocks.Game, seekPosition, 0.99f, true, lineColour, null);
            Seekbar.HandleInput = true;

            Seekbar.OnUpdate += delegate
            {
                float v1         = Seekbar.drawRectangle.X - lineLeft.drawRectangle.X;
                float halfCircle = Seekbar.DrawWidth / 1.6f / 2;

                lineLeft.VectorScale.X  = Math.Max(0, v1 / GameBase.WindowManager.RatioInverse);
                lineRight.VectorScale.X = Math.Max(0, length * 1.6f - (v1 + Seekbar.DrawWidth) / GameBase.WindowManager.RatioInverse);
                lineRight.Position.X    = Seekbar.Position.X + halfCircle;
            };

            SpriteCollection.Add(Seekbar);
            SpriteCollection.Add(lineLeft);
            SpriteCollection.Add(lineRight);

            lineLeft.OnHover     += sprite_OnHover;
            lineLeft.OnHoverLost += sprite_OnHoverLost;

            if (spriteManager != null)
            {
                spriteManager.Add(Seekbar);
                spriteManager.Add(lineLeft);
                spriteManager.Add(lineRight);
            }

            updatePosition();
        }
Ejemplo n.º 7
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.º 8
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);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();

            Background = new Background(this);

            Background.ChangeBackground("BackgroundTextureOne");
            SpriteManager.Add(Background);

            TextureManager = new Managers.ContentManager(this);

            /* Top Wall */
            SpriteManager.Add(new WallSprite(this, new Vector2(0, -HUD.Height / 2f), HUD.Width, 30));

            /* Left Wall */
            SpriteManager.Add(new WallSprite(this, new Vector2(-HUD.Width / 2f, 0), 30, HUD.Height));

            /* Right Wall */
            SpriteManager.Add(new WallSprite(this, new Vector2(HUD.Width / 2f - 15, 0), 30, HUD.Height));

            /* Bottom Wall */
            SpriteManager.Add(new WallSprite(this, new Vector2(0, HUD.Height / 2f - 15), HUD.Width, 30));


            ToolBox = new Display.ToolBox(this);
            HUD.HUDObjects.Add(ToolBox);
            Player = new Player(this);



            Prefabs.CreatePrefabs(this);

            SetupDebug();
        }
Ejemplo n.º 10
0
        internal pScrollableArea(RectangleF displayRectangle, Vector2 contentDimensions, bool widescreenAware, float headerHeight = 0,
                                 InputTargetPriority inputTarget = InputTargetPriority.Default)
            : base(GameBase.Instance)
        {
            this.inputTarget = inputTarget;
            bindEvents();

            ContentSpriteManager           = new SpriteManager(widescreenAware);
            ContentSpriteManagerBackground = new SpriteManager(widescreenAware);

            scrollDraggerSprite = new pSprite(GameBase.WhitePixel, Fields.TopLeft,
                                              Origins.TopLeft, Clocks.Game, Vector2.Zero, 1.1f, true, Color.TransparentWhite);
            scrollDraggerSprite.HandleInput      = true;
            scrollDraggerSprite.HoverEffect      = new Transformation(Color.White, Color.YellowGreen, 0, 0);
            scrollDraggerSprite.ViewOffsetImmune = true;
            scrollDraggerSprite.Scale            = 1.6f;

            ContentSpriteManager.Add(scrollDraggerSprite);

            HeaderHeight = headerHeight;

            SetContentDimensions(contentDimensions);

            SetDisplayRectangle(displayRectangle);
        }
Ejemplo n.º 11
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();
            }
        }
Ejemplo n.º 12
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);
            }
        }
Ejemplo n.º 13
0
        public void SetStatus(string statusText)
        {
            if (!didDrawAFrame)
            {
                return;
            }
            didDrawAFrame = false;

            GameBase.Scheduler.Add(delegate
            {
                pText newStatus = (pText)status.Clone();
                newStatus.Text  = statusText;

                spriteManagerProgressText.Add(newStatus);

                foreach (pSprite p in spriteManagerProgressText.SpriteList)
                {
                    if (p.Position.Y < 0)
                    {
                        p.Transformations.Clear();
                        p.AlwaysDraw = false;
                    }
                    else if (p.Alpha > 0.01)
                    {
                        p.MoveToRelative(new Vector2(0, -20), 500);
                        p.FadeOut(10000);
                        p.AlwaysDraw = false;
                    }
                }
            });
        }
Ejemplo n.º 14
0
        internal void Add(Event e)
        {
            if (e.EndTime > lastEventTime)
            {
                lastEventTime = e.EndTime;
            }
            if (e.StartTime < firstEventTime)
            {
                firstEventTime = e.StartTime;
            }

            events.Add(e);
            if (e.Sprite != null)
            {
                if (e.Layer == StoryLayer.Background)
                {
                    spriteManagerBG.Add(e.Sprite);
                }
                else
                {
                    spriteManagerFG.Add(e.Sprite);
                }
            }

            switch (e.Type)
            {
            case EventTypes.Break:
                eventBreaks.Add((EventBreak)e);
                eventBreaks.Sort();
                break;

            case EventTypes.Video:
                videoSprites.Add((pVideo)e.Sprite);
                break;

            case EventTypes.Sample:
                storyLayerSets[(int)e.Layer].Add(e);
                AudioEngine.SampleEvents.Add(((EventSample)e).SampleCache);
                eventSamples.Add((EventSample)e);
                break;

            case EventTypes.Sprite:
            case EventTypes.Animation:
                storyLayerSets[(int)e.Layer].Add(e);
                break;
            }
        }
Ejemplo n.º 15
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.º 16
0
        public override void Initialize()
        {
            //background
            baseSpriteManager.Add(new pSprite(GameBase.WhitePixel, Fields.Native, Origins.TopLeft, Clocks.Game, Vector2.Zero, 0, true, c_background)
            {
                VectorScale = new Vector2(GameBase.WindowManager.Width, GameBase.WindowManager.Height)
            });

            //header
            pText textCharts = new pText("Charts" + @" /", 28, new Vector2(PADDING, 60), 1, true, Color.White)
            {
                Origin = Origins.BottomLeft
            };

            baseSpriteManager.Add(textCharts);

            t_currentCategory = new pText("All Charts", 20, new Vector2(120f, 58), 1, true, new Color(254, 220, 97))
            {
                Origin = Origins.BottomLeft
            };
            baseSpriteManager.Add(t_currentCategory);

            searchBox           = new pSearchBox(18, new Vector2(PADDING, 33), 20, Graphics.Renderers.TextAlignment.Right);
            searchBox.OnChange += searchBox_OnChange;
            baseSpriteManager.Add(searchBox.SpriteCollection);

            baseSpriteManager.Add(new pBox(new Vector2(PADDING, 62), new Vector2(GameBase.WindowManager.WidthScaled - (PADDING * 2), 1), 1, Color.White));

            t_categorySelection = new pText("All  /  Monthly  /  Themed  /  Special", 14, new Vector2(PADDING, 70), 1, true, Color.White)
            {
                Origin = Origins.TopLeft
            };
            baseSpriteManager.Add(t_categorySelection);

            //list

            sa_chartList = new pScrollableArea(new RectangleF(PADDING / 2, 90, GameBase.WindowManager.WidthScaled - PADDING, GameBase.WindowManager.HeightScaled - PADDING - 90), Vector2.Zero, true);

            pWebRequest req = new pWebRequest("https://osu.ppy.sh/web/osu-getcharts.php?u={0}&h={1}", ConfigManager.sUsername, ConfigManager.sPassword);

            req.Finished += delegate(pWebRequest r, Exception e)
            {
                charts = JsonConvert.DeserializeObject <List <Chart> >(r.ResponseString);

                DoLayout();
            };

            req.Perform();

            //footer
            backButton = new BackButton(delegate { GameBase.ChangeMode(OsuModes.Menu); });

            spriteManagerTop.Add(backButton.SpriteCollection);

            KeyboardHandler.OnKeyPressed += onKeyPressed;

            base.Initialize();
        }
Ejemplo n.º 17
0
        internal EventManager(HitObjectManager hitObjectManager)
        {
            Instance = this;

            this.hitObjectManager = hitObjectManager;

            backgroundColour = new Color(163, 162, 255);

            breakTop = new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.TopLeft,
                                   Clocks.Game, new Vector2(0, 0), 0.9f, true, Color.TransparentBlack);
            breakTop.ScaleToWindowRatio = false;
            breakTop.VectorScale        = new Vector2(GameBase.WindowManager.Width, GameBase.WindowManager.Height * 0.125F);

            breakBottom = new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.TopLeft,
                                      Clocks.Game, new Vector2(0, (float)(WindowManager.DEFAULT_HEIGHT * 0.875)), 0.9f, true,
                                      Color.TransparentBlack);
            breakBottom.ScaleToWindowRatio = false;
            breakBottom.VectorScale        = new Vector2(GameBase.WindowManager.Width, GameBase.WindowManager.Height * 0.125F);

            spriteManagerMasking.Add(new pSprite(TextureManager.Load("masking-border", SkinSource.Osu | SkinSource.Skin), Fields.TopCentre, Origins.TopRight, Clocks.Game, new Vector2(-319.5f, 0))
            {
                AlwaysDraw       = true,
                ExactCoordinates = true,
            });

            spriteManagerMasking.Add(new pSprite(TextureManager.Load("masking-border", SkinSource.Osu | SkinSource.Skin), Fields.TopCentre, Origins.TopLeft, Clocks.Game, new Vector2(319.5f, 0))
            {
                FlipHorizontal   = true,
                AlwaysDraw       = true,
                ExactCoordinates = true,
            });

            float x = 1 + Math.Max(0, GameBase.WindowManager.WidthScaled * 1.6f / 2 - 172 - 512) / 170f;

            spriteManagerMasking.SpriteList.ForEach(s =>
            {
                pSprite sp = s as pSprite;
                if (sp != null)
                {
                    s.VectorScale = new Vector2(s.VectorScale.X < 0 ? -x : x, 768f / sp.Height);
                }
            });

            Reset();
        }
Ejemplo n.º 18
0
        private void AddMenuButton(string name, Vector2 position, EventHandler clickFunction, Tiers tier)
        {
            pSprite sprite =
                new pSprite(content.Load <Texture2D>("menu-button-" + name), FieldTypes.Window, OriginTypes.TopLeft,
                            ClockTypes.Game, position, 0.8F - (float)tier / 10, true,
                            (tier == currentTier ? Color.White : Color.TransparentWhite));
            pSprite hoverSprite =
                new pSprite(content.Load <Texture2D>("menu-button-" + name + "-over"), FieldTypes.Window,
                            OriginTypes.TopLeft, ClockTypes.Game, position, 0.81F - (float)tier / 10, true,
                            Color.TransparentWhite);

            List <Transformation> effects = new List <Transformation>();
            Transformation        move    =
                new Transformation(sprite.CurrentPosition, sprite.CurrentPosition + new Vector2(30, 0), 0, 140);

            move.Easing = EasingTypes.In;
            effects.Add(move);
            move        = new Transformation(move.EndVector, sprite.CurrentPosition + new Vector2(20, 0), 140, 280);
            move.Easing = EasingTypes.Out;
            effects.Add(move);
            sprite.HoverEffects = effects;

            effects     = new List <Transformation>();
            move        = new Transformation(Vector2.Zero, sprite.CurrentPosition, 0, 400);
            move.Easing = EasingTypes.In;
            effects.Add(move);
            sprite.HoverLostEffects = effects;
            sprite.OnHover         += s_Hover;
            sprite.OnHoverLost     += s_HoverLost;
            sprite.Tag        = hoverSprite;
            sprite.TagNumeric = (int)tier;

            sprite.IsClickable = true;
            sprite.OnClick    += clickFunction;

            hoverSprite.TagNumeric = -1; //Ensure it doesnt match a tier

            spriteManager.Add(sprite);
            spriteManager.Add(hoverSprite);

            tierSprites[tier].Add(sprite);
            tierSprites[tier].Add(hoverSprite);
        }
Ejemplo n.º 19
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.º 20
0
        internal void AddTeam(string name)
        {
            teamNameSprites.Add(new pText(name, TEAM_NAME_HEIGHT, new Vector2(xPos, yPos), 1.01f, true, Color.White)
            {
                Origin     = Origins.TopCentre,
                TextBounds = new Vector2(GROUP_WIDTH, TEAM_NAME_HEIGHT)
            });

            yPos += TEAM_NAME_HEIGHT;

            spriteManager.Add(teamNameSprites[teamNameSprites.Count - 1]);
        }
Ejemplo n.º 21
0
        internal HpBar(SpriteManager spriteManager)
        {
            this.spriteManager = spriteManager;

            pTexture[] fillTextures = loadSpritesFromSource(@"scorebar-colour");
            pTexture[] markerSprite = loadSpritesFromSource(@"scorebar-marker");
            newDefault = (fillTextures[0].Source == SkinSource.Osu || markerSprite[0].Source == SkinSource.Skin);

            if (newDefault)
            {
                if (fillTextures[0].AssetName == @"scorebar-colour-0" && fillTextures[0].Source == SkinSource.Osu)
                {
                    fillTextures = new pTexture[] { loadSpriteFromSource(@"scorebar-colour") }; // replace the old ugly bar if osu! tries to load it
                }
                t_kiNormal        = markerSprite[0];
                t_kiDanger        = markerSprite[0];
                t_kiDanger2       = markerSprite[0];
                s_barFill         = new pAnimation(fillTextures, Fields.TopLeft, Origins.TopLeft, Clocks.Game, new Vector2(7.5f, 7.8f), 0.965F, true, Color.White, null);
                s_kiIcon          = new pSprite(t_kiNormal, Fields.NativeStandardScale, Origins.Centre, Clocks.Game, new Vector2(CurrentXPosition, (8.125f + 2.5f) * GameBase.WindowManager.Ratio), 0.97F, true, Color.White, null);
                s_kiIcon.Additive = true;
            }
            else
            {
                t_kiNormal  = loadSpriteFromSource(@"scorebar-ki");
                t_kiDanger  = loadSpriteFromSource(@"scorebar-kidanger");
                t_kiDanger2 = loadSpriteFromSource(@"scorebar-kidanger2");
                s_barFill   = new pAnimation(fillTextures, Fields.TopLeft, Origins.TopLeft, Clocks.Game, new Vector2(3, 10), 0.965F, true, Color.White, null);
                s_kiIcon    = new pSprite(t_kiNormal, Fields.NativeStandardScale, Origins.Centre, Clocks.Game, new Vector2(0, 10 * GameBase.WindowManager.Ratio), 0.97F, true, Color.White, null);
            }

            s_barFill.DrawWidth = 0;
            s_barFill.SetFramerateFromSkin();
            s_barFill.DrawDimensionsManualOverride = true;



            s_barBg = new pSprite(loadSpriteFromSource(@"scorebar-bg"), Fields.TopLeft, Origins.TopLeft, Clocks.Game, Vector2.Zero, 0.96F, true, Color.White, null);

            SpriteCollection.Add(s_barBg);
            SpriteCollection.Add(s_barFill);
            SpriteCollection.Add(s_kiIcon);

            if (Player.Relaxing || Player.Relaxing2)
            {
                Visible = false;
            }
            else if (spriteManager != null)
            {
                spriteManager.Add(SpriteCollection);
            }

            Update();
        }
Ejemplo n.º 22
0
        internal pChannelTabCollection(SpriteManager spriteManager, int tabsWide, Vector2 bottomLeft, float baseDepth, bool skinnable, Color colour)
            : base(spriteManager, tabsWide, bottomLeft, baseDepth, skinnable, colour)
        {
            Vector2 position = new Vector2(bottomLeft.X + (Tabs.Count % MaxTabsWide) * 74 + (Tabs.Count / MaxTabsWide) * 10,
                                           bottomLeft.Y + 6 - (14 * (1 + Tabs.Count / MaxTabsWide)));

            pTabAdd          = new pTabAdd(position, 1, false, false);
            pTabAdd.OnClick += pTabAdd_OnClick;
            Sprites.AddRange(pTabAdd.SpriteCollection);
            spriteManager.Add(pTabAdd.SpriteCollection);
            Tabs.Insert(0, pTabAdd);
        }
Ejemplo n.º 23
0
        public void ClearSprites(bool resetDimensions = true, bool dispose = true)
        {
            ContentSpriteManager.Clear(dispose);
            ContentSpriteManagerBackground.Clear(dispose);
            ContentSpriteManager.Add(scrollDraggerSprite);
            if (resetDimensions)
            {
                SetContentDimensions(Vector2.Zero);
            }

            Children.ForEach(s => s.Clear(dispose));
        }
Ejemplo n.º 24
0
        internal ProgressBarCircular(SpriteManager spriteManager, Vector2 position)
            : base(spriteManager, ProgressBarTypes.Pie)
        {
            Position = position;

            overlay = new pSprite(TextureManager.Load(@"circularmetre", SkinSource.Osu), Fields.TopRight,
                                  Origins.Centre, Clocks.Game, position, 0.95f, true, Color.White);

            spriteManager.Add(overlay);

            progress.Position = new Vector2(GameBase.WindowManager.Width / GameBase.WindowManager.Ratio - position.X, position.Y);
            progress.Radius   = 10;
        }
Ejemplo n.º 25
0
        internal override void Display()
        {
            spriteManager.HandleOverlayInput = true;
            pa.HandleOverlayInput            = true;

            BackButton back = new BackButton(delegate { Close(); }, false, true);

            spriteManager.Add(back.SpriteCollection);

            bindTextKey               = new pText(string.Empty, 40, new Vector2(GameBase.WindowManager.WidthScaled / 2, 120), 1, true, Color.Orange);
            bindTextKey.TextShadow    = true;
            bindTextKey.TextBold      = true;
            bindTextKey.TextBounds    = new Vector2(1024, 0);
            bindTextKey.TextAlignment = TextAlignment.Centre;
            bindTextKey.Origin        = Origins.Centre;
            bindingManager.Add(bindTextKey);

            bindText1               = new pText(LocalisationManager.GetString(OsuString.OptionsBindKey_ChangeBinding), 40, new Vector2(GameBase.WindowManager.WidthScaled / 2, 240), 1, true, Color.White);
            bindText1.TextShadow    = true;
            bindText1.TextBounds    = new Vector2(1024, 0);
            bindText1.TextAlignment = TextAlignment.Centre;
            bindText1.Origin        = Origins.Centre;
            bindingManager.Add(bindText1);

            bindText2               = new pText(LocalisationManager.GetString(OsuString.OptionsBindKey_ConflictsWarning), 30, new Vector2(GameBase.WindowManager.WidthScaled / 2, 360), 1, true, Color.LightYellow);
            bindText2.TextShadow    = true;
            bindText2.TextBounds    = new Vector2(1024, 0);
            bindText2.TextAlignment = TextAlignment.Centre;
            bindText2.Origin        = Origins.Centre;
            bindingManager.Add(bindText2);

            pSprite background = new pSprite(GameBase.WhitePixel, Fields.Native, Origins.TopLeft, Clocks.Game, Vector2.Zero, 0.91F, true, new Color(0, 0, 0, 220));

            background.VectorScale = new Vector2(GameBase.WindowManager.Width, GameBase.WindowManager.Height);
            bindingManager.Add(background);

            RefreshDisplay();
            base.Display();
        }
Ejemplo n.º 26
0
        public override void Initialize()
        {
            SpriteManager = new SpriteManager(true);

            SpriteManager.Add(
                new pSprite(TextureManager.Load(@"editor-metronome-bg", SkinSource.Osu), Fields.TopRight,
                            Origins.TopLeft,
                            Clocks.Game, Position, 0, true, Color.White));

            float posX = Position.X - 179,
                  posY = Position.Y + 18;

            beatSquares = new[]
            {
                new pBeatSquare(new Vector2(posX + Padding * 3, posY)),     //Includes padding between each square
                new pBeatSquare(new Vector2(posX + Padding * 2, posY)),
                new pBeatSquare(new Vector2(posX + Padding, posY)),
                new pBeatSquare(new Vector2(posX, posY))
            };

            SpriteManager.Add(beatSquares);

            posX = Position.X - 60;
            posY = Position.Y + Padding;

            pButton tapButton = new pButton(LocalisationManager.GetString(OsuString.EditorModeTiming_TapHere), new Vector2(posX, posY), new Vector2(136, 25), 1, Color.SkyBlue, tapButton_OnClick, true, true, 12);

            tapButton.SoundsEnabled = false;
            tapButton.ToolTip       = LocalisationManager.GetString(OsuString.EditorModeTiming_TapHereTooltip);
            SpriteManager.Add(tapButton.SpriteCollection);

            posX = Position.X - 3;
            posY = Position.Y + 4;

            pButton resetButton = new pButton(LocalisationManager.GetString(OsuString.General_Reset), new Vector2(posX, posY), new Vector2(58, 58), 1, Color.Orange, resetButton_OnClick, true, true, 12);

            SpriteManager.Add(resetButton.SpriteCollection);
        }
Ejemplo n.º 27
0
        internal pScrollableArea(Rectangle displayRectangle, Vector2 contentDimensions) : base(GameBase.Instance)
        {
            MouseHandler.OnDrag           += MouseHandler_OnDrag;
            MouseHandler.OnEndDrag        += MouseHandler_OnEndDrag;
            MouseHandler.OnMouseWheelUp   += MouseHandler_OnMouseWheelUp;
            MouseHandler.OnMouseWheelDown += MouseHandler_OnMouseWheelDown;
            spriteManager = new SpriteManager();

            scrollBarV = new pSprite(GameBase.WhitePixel, FieldTypes.Window,
                                     OriginTypes.TopLeft, ClockTypes.Game, Vector2.Zero, 0.998F, true,
                                     grey);
            scrollBarV.UseVectorScale   = true;
            scrollBarV.ViewOffsetImmune = true;
            scrollBarV.CatchUniversal   = true;
            scrollBarV.IsClickable      = true;

            scrollBarV.OnClick     += scrollBarV_OnClick;
            scrollBarV.CurrentScale = 1.6f;

            scrollDraggerV = new pSprite(GameBase.WhitePixel, FieldTypes.Window,
                                         OriginTypes.TopLeft, ClockTypes.Game, Vector2.Zero, 0.999F, true, Color.White);
            scrollDraggerV.UseVectorScale   = true;
            scrollDraggerV.IsClickable      = true;
            scrollDraggerV.HoverEffect      = new Transformation(Color.White, Color.YellowGreen, 0, 0);
            scrollDraggerV.CatchUniversal   = true;
            scrollDraggerV.ViewOffsetImmune = true;
            scrollDraggerV.CurrentScale     = 1.6f;

            spriteManager.Add(scrollDraggerV);

            spriteManager.Add(scrollBarV);

            ContentDimensions = contentDimensions;

            Visible = true;

            SetDisplayRectangle(displayRectangle);
        }
Ejemplo n.º 28
0
        internal void Add(ScoreboardEntry s)
        {
            Entries.Add(s);
            if (DisplayOnRight)
            {
                s.AlignedToRight = DisplayOnRight;
            }
            s.scoreboard = this;

            if (s.allowUpdateRank)
            {
                if (s.rank == 0 && ShowLeader)
                {
                    s.SpriteBackground.InitialColour = new Color(97, 190, 255, 150);
                }
                else
                {
                    s.SpriteBackground.InitialColour = new Color(31, 115, 153, 150);
                }
            }

            spriteManager.Add(s.SpriteCollection);
        }
Ejemplo n.º 29
0
        internal pDialog(string title, bool modeSpecific)
            : base(GameBase.Instance)
        {
            Background =
                new pSprite(GameBase.WhitePixel, Fields.Native, Origins.TopLeft, Clocks.Game,
                            Vector2.Zero, 0.1F,
                            true,
                            new Color(0, 0, 0, FINAL_ALPHA));
            Background.VectorScale = new Vector2(GameBase.WindowManager.Width, GameBase.WindowManager.Height);
            Background.HandleInput = true;

            spriteManager.Add(Background);

            GameModeSpecific = modeSpecific;
            if (!string.IsNullOrEmpty(title))
            {
                pText p = new pText(title, 24, new Vector2(2, 2), new Vector2(GameBase.WindowManager.WidthScaled - 2, 0), 0.92F, true, Color.White, true);
                spriteManager.Add(p);
                currentVerticalSpace = p.MeasureText().Y + p.Position.Y + 50;
            }

            bindEvents();
        }
Ejemplo n.º 30
0
        internal TournamentClient(SpriteManager spriteManager, float depth, short id)
        {
            this.id   = id;
            ipcClient = null;

            tryRecover();

            background = new pSprite(GameBase.WhitePixel, TournamentLayout.ClientPositions[id], depth, true, Color.TransparentWhite)
            {
                VectorScale = TournamentLayout.ClientSize, Field = Fields.Native
            };
            spriteManager.Add(background);

            FlashColour(Color.White);
        }
Ejemplo n.º 31
0
 public void AddSpriteManager(SpriteManager sm)
 {
     sm.Add(_Item.ID);
 }