Ejemplo n.º 1
0
        /// <summary>
        /// The view for the SongSelect Screen.
        /// TODO: Cleanup this initializer
        /// </summary>
        /// <param name="screen"></param>
        /// <param name="beatmaps">The list of beatmaps to show on this screen.</param>
        /// <param name="search">The starting string value of the SearchBar. Default is ""</param>
        public SongSelectionView(Screen screen, List <Beatmap> beatmaps, string search = "") : base(screen)
        {
            songSelectScreen = GetSongSelection();

            cards  = songSelectScreen.Cards;
            scores = new List <ScoreCard>();

            // Prepare backgrounds
            CurrentBackground = DefaultBackground;
            OldBackground     = DefaultBackground;

            // Set up beatmap cards
            for (int i = 0; i < beatmaps.Count; i++)
            {
                cards.Add(new BeatmapCard(beatmaps[i], i));
            }

            Anchor  searchBoxAnchor        = GetSkinnablePropertyAnchor("SearchBarAnchor");
            Vector2 searchBarStartPosition = Skin.GetConfigStartPosition("song_select", "Properties", "SearchBarStartPos");

            SearchBox = new SearchBox(search, searchBarStartPosition, searchBoxAnchor);

            int searchBarX = GetSkinnablePropertyInt("SearchBarX");
            int searchBarY = GetSkinnablePropertyInt("SearchBarY");

            SearchBox.Move(searchBarX, searchBarY);

            button_back = new ReturnButton("select_button_back", AnchorUtil.FindScreenPosition(Anchor.BottomLeft));
        }
Ejemplo n.º 2
0
        private void AddButtons()
        {
            buttonBack     = new ReturnButton("result_button_back", AnchorUtil.FindScreenPosition(Anchor.BottomLeft));
            buttonRetry    = new RetryButton("result_button_retry", AnchorUtil.FindScreenPosition(Anchor.BottomRight));
            buttonAdvanced = new ButtonAdvanced(AnchorUtil.FindScreenPosition(Anchor.BottomLeft));

            // Move the advanced button to the right spot
            float width  = buttonAdvanced.Texture.Width;
            float height = buttonAdvanced.Texture.Height;

            buttonAdvanced.Move(new Vector2(width, -height));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a FillBar that is used to represent the time spent in a map.
 /// </summary>
 /// <param name="totalTime">The total time the map will play for (in ms).</param>
 /// <param name="fillDirection">The direction this will fill in.</param>
 /// <param name="startingTime">The current time (in ms) of the map.
 /// Change this if starting at a point in the map that isn't the start. Default is 0.</param>
 public MapTimer(double totalTime, FillBarDirection fillDirection, double startingTime = 0)
     : base
     (
         DefaultTexture,
         AnchorUtil.FindScreenPosition(Anchor.TopRight),
         0,
         (float)totalTime,
         (float)startingTime,
         anchor: Anchor.TopRight,
         fillDirection: fillDirection
     )
     => Resize(new Vector2(DefaultTexture.Width, Pulsarc.CurrentHeight));
Ejemplo n.º 4
0
        public SettingsScreenView(Screen screen) : base(screen)
        {
            background  = new Background("settings_background");
            button_back = new ReturnButton("settings_button_back", AnchorUtil.FindScreenPosition(Anchor.BottomLeft));
            button_save = new SaveButton("settings_button_save", AnchorUtil.FindScreenPosition(Anchor.BottomRight));

            Groups = new List <SettingsGroup>();

            Groups.Add(new GameplaySettings(new Vector2(400, GetNextGroupPos())));
            Groups.Add(new AudioSettings(new Vector2(400, GetNextGroupPos())));
            Groups.Add(new BindingsSettings(new Vector2(400, GetNextGroupPos())));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// HitObject is an "Arc", the main gameplay element for Pulsarc.
        /// They move from the outer edges of the screen towards the center to
        /// the crosshair. The player can press corresponding keys to "hit" these arcs.
        /// </summary>
        /// <param name="time">The time (in ms) from the start of the audio to a Perfect hit</param>
        /// <param name="angle">The direction this HitObject is "falling" from.</param>
        /// <param name="keys">How many keys are in the current Beatmap. Only 4 keys is working right now.</param>
        /// <param name="baseSpeed">The user-defined base speed for this arc.</param>
        /// <param name="hidden">Whether or not this arc should fade before reaching the crosshair.</param>
        public HitObject(int time, double angle, int keys, double baseSpeed, bool hidden) : base(Skin.Assets["arcs"])
        {
            Time      = time;
            Angle     = angle;
            BaseSpeed = baseSpeed;
            Hidden    = hidden;

            // Find the origin (center) of this Crosshair
            int width  = Pulsarc.CurrentWidth;
            int height = Pulsarc.CurrentHeight;

            origin.X = (width / 2) + ((Texture.Width - width) / 2);
            origin.Y = (height / 2) + ((Texture.Height - height) / 2);

            // Position this HitOjbect
            ChangePosition(AnchorUtil.FindScreenPosition(Anchor.Center));

            drawnPart.Width  = Texture.Width / 2;
            drawnPart.Height = Texture.Height / 2;

            // Should be changed if we want different than 4 keys.
            // Currently no solution available with drawn rectangles
            switch (angle)
            {
            case 0:
                drawnPart.X = Texture.Width / 2;
                origin.X   -= Texture.Width / 2;
                break;

            case 180:
                drawnPart.Y = Texture.Height / 2;
                origin.Y   -= Texture.Height / 2;
                break;

            case 90:
                drawnPart.X = Texture.Width / 2;
                drawnPart.Y = Texture.Height / 2;
                origin.X   -= Texture.Width / 2;
                origin.Y   -= Texture.Height / 2;
                break;
            }

            // Set the rotation of the object
            // TODO: Make this customizeable by the beatmap.
            Rotation = (float)(45 * (Math.PI / 180));

            // Set the HitObject's position
            ChangePosition(TruePosition);
        }
Ejemplo n.º 6
0
        private void SetUpBackgroundAndIcon()
        {
            background = new Background("menu_background");

            gameIcon = new GameIcon(
                Skin.GetConfigStartPosition("main_menu", "Properties", "IconStartPos"),
                GetSkinnablePropertyAnchor("IconAnchor"));

            Vector2 offset = new Vector2(
                GetSkinnablePropertyInt("IconX"),
                GetSkinnablePropertyInt("IconY"));

            gameIcon.Move(offset);

            version = new VersionCounter(AnchorUtil.FindScreenPosition(Anchor.BottomRight));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// The crosshair, or "Judgement Circle" of Pulsarc.
        /// </summary>
        /// <param name="baseCrosshairDiameter">The base diameter for this Crosshair. Default is 300 (the diameter of Intralism's crosshair)</param>
        public Crosshair(float baseCrosshairDiameter = 300, bool hidden = false) : base(Skin.Assets["crosshair"])
        {
            this.hidden = hidden;

            // Find the origin (center) of this Crosshair
            int width  = Pulsarc.CurrentWidth;
            int height = Pulsarc.CurrentHeight;

            origin.X = (width / 2) + ((Texture.Width - width) / 2);
            origin.Y = (height / 2) + ((Texture.Height - height) / 2);

            // Set the diameter and resize
            Resize(baseCrosshairDiameter * Pulsarc.HeightScale);

            ChangePosition(AnchorUtil.FindScreenPosition(Anchor.Center));

            // Set the rotation of the object.
            // TODO: Make this customizeable by the beatmap/user setting.
            Rotation = (float)(45 * (Math.PI / 180));
        }