/// <summary> /// Ctor /// </summary> /// <param name="screen"></param> /// <param name="ruleset"></param> public GameplayPlayfieldKeys(GameplayScreen screen, GameplayRulesetKeys ruleset) { Screen = screen; Ruleset = ruleset; Container = new Container(); // Create background container BackgroundContainer = new Container { Parent = Container, Size = new ScalableVector2(Width, WindowManager.Height), Alignment = Alignment.TopCenter, X = SkinManager.Skin.Keys[screen.Map.Mode].ColumnAlignment }; // Create the foreground container. ForegroundContainer = new Container { Parent = Container, Size = new ScalableVector2(Width, WindowManager.Height), Alignment = Alignment.TopCenter, X = BackgroundContainer.X }; Stage = new GameplayPlayfieldKeysStage(Screen, this); }
/// <inheritdoc /> /// <summary> /// Ctor - /// </summary> /// <param name="ruleset"></param> /// <param name="info"></param> public GameplayHitObjectKeys(HitObjectInfo info, GameplayRulesetKeys ruleset, HitObjectManagerKeys manager) { HitObjectManager = manager; Ruleset = ruleset; InitializeSprites(ruleset, info.Lane - 1); InitializeObject(manager, info); }
/// <summary> /// Ctor /// </summary> /// <param name="screen"></param> /// <param name="ruleset"></param> public GameplayPlayfieldKeys(GameplayScreen screen, GameplayRulesetKeys ruleset) { Screen = screen; Ruleset = ruleset; Container = new Container(); SetLaneScrollDirections(); SetReferencePositions(); CreateElementContainers(); }
/// <summary> /// /// </summary> /// <param name="map"></param> /// <param name="ruleset"></param> public TimingLineManager(GameplayRulesetKeys ruleset, ScrollDirection direction, float targetY, float size, float offset) { TrackOffset = targetY; SizeX = size; PositionX = offset; ScrollDirection = direction; Ruleset = ruleset; HitObjectManager = (HitObjectManagerKeys)ruleset.HitObjectManager; GenerateTimingLineInfo(ruleset.Map); InitializeObjectPool(); }
/// <inheritdoc /> /// <summary> /// Ctor - /// </summary> /// <param name="ruleset"></param> /// <param name="info"></param> public GameplayHitObjectKeys(HitObjectInfo info, GameplayRulesetKeys ruleset, HitObjectManagerKeys manager) { HitObjectManager = manager; Ruleset = ruleset; var lane = info.Lane - 1; var playfield = (GameplayPlayfieldKeys)ruleset.Playfield; LongNoteSizeDifference = playfield.LongNoteSizeAdjustment[lane]; InitializeSprites(ruleset, lane, playfield.ScrollDirections[lane]); InitializeObject(manager, info); }
/// <summary> /// Initialize HitObject Sprite used for Object Pooling. Only gets initialized once upon object creation. /// </summary> /// <param name="info"></param> /// <param name="ruleset"></param> private void InitializeSprites(GameplayRulesetKeys ruleset, int lane) { // Reference variables var playfield = (GameplayPlayfieldKeys)ruleset.Playfield; var posX = playfield.Stage.Receptors[lane].X; // Create the base HitObjectSprite HitObjectSprite = new Sprite() { Alignment = Alignment.TopLeft, Position = new ScalableVector2(posX, 0), SpriteEffect = !GameplayRulesetKeys.IsDownscroll && SkinManager.Skin.Keys[MapManager.Selected.Value.Mode].FlipNoteImagesOnUpscroll ? SpriteEffects.FlipVertically : SpriteEffects.None, Image = UserInterface.BlankBox, }; // Update hit body's size to match image ratio HitObjectSprite.Size = new ScalableVector2(playfield.LaneSize, playfield.LaneSize * HitObjectSprite.Image.Height / HitObjectSprite.Image.Width); LongNoteBodyOffset = HitObjectSprite.Height / 2; // Create Hold Body var bodies = SkinManager.Skin.Keys[ruleset.Mode].NoteHoldBodies[lane]; LongNoteBodySprite = new AnimatableSprite(bodies) { Alignment = Alignment.TopLeft, Size = new ScalableVector2(playfield.LaneSize, 0), Position = new ScalableVector2(posX, 0), Parent = playfield.Stage.HitObjectContainer }; // Create the Hold End LongNoteEndSprite = new Sprite() { Alignment = Alignment.TopLeft, Position = new ScalableVector2(posX, 0), Size = new ScalableVector2(playfield.LaneSize, 0), Parent = playfield.Stage.HitObjectContainer, SpriteEffect = !GameplayRulesetKeys.IsDownscroll && SkinManager.Skin.Keys[MapManager.Selected.Value.Mode].FlipNoteEndImagesOnUpscroll ? SpriteEffects.FlipVertically : SpriteEffects.None, }; // Set long note end properties. LongNoteEndSprite.Image = SkinManager.Skin.Keys[ruleset.Mode].NoteHoldEnds[lane]; LongNoteEndSprite.Height = playfield.LaneSize * LongNoteEndSprite.Image.Height / LongNoteEndSprite.Image.Width; LongNoteEndOffset = LongNoteEndSprite.Height / 2f; // We set the parent of the HitObjectSprite **AFTER** we create the long note // so that the body of the long note isn't drawn over the object. HitObjectSprite.Parent = playfield.Stage.HitObjectContainer; }
/// <summary> /// Sets the ruleset for this current game mode. /// </summary> private void SetRuleset() { switch (Map.Mode) { case GameMode.Keys4: case GameMode.Keys7: Ruleset = new GameplayRulesetKeys(this, Map); break; default: throw new InvalidEnumArgumentException(); } }
/// <inheritdoc /> /// <summary> /// Creates and initializes a new Timing Line Object /// </summary> /// <param name="ruleset"></param> /// <param name="info"></param> public TimingLine(GameplayRulesetKeys ruleset, TimingLineInfo info) { var playfield = (GameplayPlayfieldKeys)ruleset.Playfield; Ruleset = ruleset; Info = info; // Initialize Sprite Alignment = Alignment.TopLeft; Width = playfield.Width; Height = 2; Parent = playfield.Stage.TimingLineContainer; }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="ruleset"></param> /// <param name="size"></param> public HitObjectManagerKeys(GameplayRulesetKeys ruleset, Qua map) : base(map) { Ruleset = ruleset; // Initialize SV UpdatePoolingPositions(); InitializeScrollVelocities(map); InitializePositionMarkers(); UpdateCurrentTrackPosition(); // Initialize Object Pool InitializeInfoPool(map); InitializeObjectPool(); }
/// <summary> /// Initialize HitObject Sprite used for Object Pooling. Only gets initialized once upon object creation. /// </summary> /// <param name="info"></param> /// <param name="ruleset"></param> private void InitializeSprites(GameplayRulesetKeys ruleset, int lane, ScrollDirection direction) { // Reference variables var playfield = (GameplayPlayfieldKeys)ruleset.Playfield; var posX = playfield.Stage.Receptors[lane].X; var flipNoteBody = direction.Equals(ScrollDirection.Up) && SkinManager.Skin.Keys[MapManager.Selected.Value.Mode].FlipNoteImagesOnUpscroll; var flipNoteEnd = direction.Equals(ScrollDirection.Up) && SkinManager.Skin.Keys[MapManager.Selected.Value.Mode].FlipNoteEndImagesOnUpscroll; ScrollDirection = direction; // Create the base HitObjectSprite HitObjectSprite = new Sprite() { Alignment = Alignment.TopLeft, Position = new ScalableVector2(posX, 0), SpriteEffect = flipNoteBody ? SpriteEffects.FlipVertically : SpriteEffects.None }; // Create Hold Body var bodies = SkinManager.Skin.Keys[ruleset.Mode].NoteHoldBodies[lane]; LongNoteBodySprite = new AnimatableSprite(bodies) { Alignment = Alignment.TopLeft, Size = new ScalableVector2(playfield.LaneSize, 0), Position = new ScalableVector2(posX, 0), Parent = playfield.Stage.HitObjectContainer }; // Create the Hold End LongNoteEndSprite = new Sprite() { Alignment = Alignment.TopLeft, Position = new ScalableVector2(posX, 0), Size = new ScalableVector2(playfield.LaneSize, 0), Parent = playfield.Stage.HitObjectContainer, SpriteEffect = flipNoteEnd ? SpriteEffects.FlipVertically : SpriteEffects.None }; // Set long note end properties. LongNoteEndSprite.Image = SkinManager.Skin.Keys[ruleset.Mode].NoteHoldEnds[lane]; LongNoteEndSprite.Height = playfield.LaneSize * LongNoteEndSprite.Image.Height / LongNoteEndSprite.Image.Width; LongNoteEndOffset = LongNoteEndSprite.Height / 2f; // We set the parent of the HitObjectSprite **AFTER** we create the long note // so that the body of the long note isn't drawn over the object. HitObjectSprite.Parent = playfield.Stage.HitObjectContainer; }
/// <inheritdoc /> /// <summary> /// Creates and initializes a new Timing Line Object /// </summary> /// <param name="ruleset"></param> /// <param name="info"></param> public TimingLine(GameplayRulesetKeys ruleset, TimingLineInfo info, ScrollDirection direction, float targetY, float size, float offsetX) { var playfield = (GameplayPlayfieldKeys)ruleset.Playfield; TrackOffset = targetY; Ruleset = ruleset; Info = info; ScrollDirection = direction; // Initialize Sprite Alignment = Alignment.TopLeft; Width = size; X = offsetX; Height = 2; Parent = playfield.Stage.TimingLineContainer; Tint = SkinManager.Skin.Keys[MapManager.Selected.Value.Mode].TimingLineColor; }
/// <summary> /// Ctor - /// </summary> /// <param name="ruleset"></param> /// <param name="mode"></param> internal KeysInputManager(GameplayRulesetKeys ruleset, GameMode mode) { switch (mode) { case GameMode.Keys4: // Initialize 4K Input button container. BindingStore = new List <InputBindingKeys> { new InputBindingKeys(ConfigManager.KeyMania4K1), new InputBindingKeys(ConfigManager.KeyMania4K2), new InputBindingKeys(ConfigManager.KeyMania4K3), new InputBindingKeys(ConfigManager.KeyMania4K4) }; break; case GameMode.Keys7: // Initialize 7K input button container. BindingStore = new List <InputBindingKeys> { new InputBindingKeys(ConfigManager.KeyMania7K1), new InputBindingKeys(ConfigManager.KeyMania7K2), new InputBindingKeys(ConfigManager.KeyMania7K3), new InputBindingKeys(ConfigManager.KeyMania7K4), new InputBindingKeys(ConfigManager.KeyMania7K5), new InputBindingKeys(ConfigManager.KeyMania7K6), new InputBindingKeys(ConfigManager.KeyMania7K7) }; break; default: throw new ArgumentOutOfRangeException(nameof(mode), mode, null); } Ruleset = ruleset; // Init replay if (Ruleset.Screen != null && Ruleset.Screen.InReplayMode) { ReplayInputManager = new ReplayInputManagerKeys(Ruleset.Screen); } }