1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 07:43:00 +08:00

Merge pull request #16 from peppy/beatmap_framework

Beatmap framework
This commit is contained in:
Dean Herbert 2016-10-01 16:53:58 +09:00 committed by GitHub
commit 24837a0af3
39 changed files with 989 additions and 0 deletions

View File

@ -0,0 +1,95 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.GameModes.Testing;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.GameModes.Play.Catch;
using osu.Game.GameModes.Play.Mania;
using osu.Game.GameModes.Play.Osu;
using osu.Game.GameModes.Play.Taiko;
using System.Collections.Generic;
using osu.Framework.Timing;
namespace osu.Desktop.Tests
{
class TestCaseGamefield : TestCase
{
public override string Name => @"Gamefield";
public override string Description => @"Showing hitobjects and what not.";
FramedOffsetClock localClock;
protected override IFrameBasedClock Clock => localClock;
public override void Reset()
{
base.Reset();
///create a new clock offset to 0.
localClock = new FramedOffsetClock(base.Clock) { Offset = -base.Clock.CurrentTime };
List<HitObject> objects = new List<HitObject>();
int time = 500;
for (int i = 0; i < 100; i++)
{
objects.Add(new Circle()
{
StartTime = time,
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384))
});
time += RNG.Next(50, 500);
}
Beatmap beatmap = new Beatmap
{
HitObjects = objects
};
Add(new Drawable[]
{
new OsuHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.5f),
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft
},
new TaikoHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.5f),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
},
new CatchHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.5f),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
new ManiaHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.5f),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight
}
});
}
protected override void Update()
{
base.Update();
localClock.ProcessFrame();
}
}
}

View File

@ -150,6 +150,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Tests\TestCaseGamefield.cs" />
<Compile Include="Tests\TestCaseKeyCounter.cs" />
<Compile Include="Tests\TestCaseMenuButtonSystem.cs" />
<Compile Include="Tests\TestCaseTextAwesome.cs" />

View File

@ -0,0 +1,20 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Timing;
using osu.Game.Users;
namespace osu.Game.Beatmaps
{
public class Beatmap
{
public List<HitObject> HitObjects;
public List<ControlPoint> ControlPoints;
public string Difficulty;
public User Creator;
}
}

View File

@ -0,0 +1,20 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Users;
namespace osu.Game.Beatmaps
{
/// <summary>
/// A beatmap set contains multiple beatmap (difficulties).
/// </summary>
public class BeatmapSet
{
public List<Beatmap> Beatmaps { get; protected set; }
public Metadata Metadata;
public User Creator;
}
}

View File

@ -0,0 +1,11 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps
{
public class Metadata
{
public string Artist;
public string Title;
}
}

View File

@ -0,0 +1,10 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Objects.Catch
{
public abstract class CatchBaseHit : HitObject
{
public float Position;
}
}

View File

@ -0,0 +1,9 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Objects.Catch
{
public class Droplet : CatchBaseHit
{
}
}

View File

@ -0,0 +1,9 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Objects.Catch
{
public class Fruit : CatchBaseHit
{
}
}

View File

@ -0,0 +1,20 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps.Samples;
namespace osu.Game.Beatmaps.Objects
{
/// <summary>
/// A hitobject describes a point in a beatmap
/// </summary>
public abstract class HitObject
{
public double StartTime;
public double? EndTime;
public double Duration => (EndTime ?? StartTime) - StartTime;
public HitSampleInfo Sample;
}
}

View File

@ -0,0 +1,9 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Objects.Mania
{
public class HoldNote : Note
{
}
}

View File

@ -0,0 +1,10 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Objects.Mania
{
public abstract class ManiaBaseHit : HitObject
{
public int Column;
}
}

View File

@ -0,0 +1,9 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Objects.Mania
{
public class Note : ManiaBaseHit
{
}
}

View File

@ -0,0 +1,9 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Objects.Osu
{
public class Circle : OsuBaseHit
{
}
}

View File

@ -0,0 +1,12 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
namespace osu.Game.Beatmaps.Objects.Osu
{
public abstract class OsuBaseHit : HitObject
{
public Vector2 Position;
}
}

View File

@ -0,0 +1,15 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using OpenTK;
namespace osu.Game.Beatmaps.Objects.Osu
{
public class Slider : OsuBaseHit
{
public List<Vector2> Path;
public int RepeatCount;
}
}

View File

@ -0,0 +1,9 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Objects.Osu
{
public class Spinner
{
}
}

View File

@ -0,0 +1,18 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Objects.Taiko
{
class TaikoBaseHit : HitObject
{
public float Scale = 1;
public TaikoColour Type;
}
public enum TaikoColour
{
Red,
Blue
}
}

View File

@ -0,0 +1,10 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Samples
{
public class HitSampleInfo : SampleInfo
{
SampleType Type;
}
}

View File

@ -0,0 +1,12 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Samples
{
public enum SampleBank
{
Default = 0,
Custom1 = 1,
Custom2 = 2
}
}

View File

@ -0,0 +1,11 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Samples
{
public class SampleInfo
{
public SampleBank Bank;
public SampleSet Set;
}
}

View File

@ -0,0 +1,13 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps.Samples
{
public enum SampleSet
{
None = 0,
Normal = 1,
Soft = 2,
Drum = 3
}
}

View File

@ -0,0 +1,17 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
namespace osu.Game.Beatmaps.Samples
{
[Flags]
public enum SampleType
{
None = 0,
Normal = 1,
Whistle = 2,
Finish = 4,
Clap = 8
};
}

View File

@ -0,0 +1,16 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Beatmaps.Timing
{
public class ControlPoint
{
public double Time;
}
}

View File

@ -0,0 +1,17 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Beatmaps.Samples;
namespace osu.Game.Beatmaps.Timing
{
class SampleChange : ControlPoint
{
public SampleInfo Sample;
}
}

View File

@ -0,0 +1,18 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Beatmaps.Timing
{
class TimingChange : ControlPoint
{
public double BeatLength;
public double BPM => 60000 / BeatLength;
}
}

View File

@ -0,0 +1,84 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.Beatmaps.Objects.Catch;
using OpenTK;
namespace osu.Game.GameModes.Play.Catch
{
public class CatchHitRenderer : HitRenderer
{
List<CatchBaseHit> objects;
private CatchPlayfield playfield;
public override List<HitObject> Objects
{
set
{
//osu! mode requires all objects to be of CatchBaseHit type.
objects = value.ConvertAll(convertForCatch);
if (Parent != null)
Load();
}
}
private CatchBaseHit convertForCatch(HitObject input)
{
CatchBaseHit h = input as CatchBaseHit;
if (h == null)
{
OsuBaseHit o = input as OsuBaseHit;
if (o == null) throw new Exception(@"Can't convert!");
h = new Fruit()
{
StartTime = o.StartTime,
Position = o.Position.X
};
}
return h;
}
public override void Load()
{
base.Load();
if (playfield == null)
Add(playfield = new CatchPlayfield());
else
playfield.Clear();
if (objects == null) return;
foreach (CatchBaseHit h in objects)
{
//render stuff!
Sprite s = new Sprite
{
Texture = Game.Textures.Get(@"menu-osu"),
Origin = Anchor.Centre,
Scale = new Vector2(0.1f),
PositionMode = InheritMode.Y,
Position = new Vector2(h.Position, -0.1f)
};
s.Transforms.Add(new TransformPosition(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
s.Expire(true);
playfield.Add(s);
}
}
}
}

View File

@ -0,0 +1,30 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.GameModes.Play.Catch
{
public class CatchPlayfield : Playfield
{
public CatchPlayfield()
{
SizeMode = InheritMode.Y;
Size = new Vector2(512, 0.9f);
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
}
public override void Load()
{
base.Load();
Add(new Box { SizeMode = InheritMode.XY, Alpha = 0.5f });
}
}
}

View File

@ -0,0 +1,25 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Batches;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Game.Beatmaps.Objects;
using OpenTK;
namespace osu.Game.GameModes.Play
{
public abstract class HitRenderer : LargeContainer
{
public abstract List<HitObject> Objects { set; }
public override void Load()
{
base.Load();
Add(new Box() { SizeMode = InheritMode.XY, Alpha = 0.1f, Scale = new Vector2(0.99f) });
}
}
}

View File

@ -0,0 +1,90 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.Beatmaps.Objects.Mania;
using OpenTK;
namespace osu.Game.GameModes.Play.Mania
{
public class ManiaHitRenderer : HitRenderer
{
private readonly int columns;
List<ManiaBaseHit> objects;
private ManiaPlayfield playfield;
public ManiaHitRenderer(int columns = 5)
{
this.columns = columns;
}
public override List<HitObject> Objects
{
set
{
//osu! mode requires all objects to be of ManiaBaseHit type.
objects = value.ConvertAll(convertForMania);
if (Parent != null)
Load();
}
}
private ManiaBaseHit convertForMania(HitObject input)
{
ManiaBaseHit h = input as ManiaBaseHit;
if (h == null)
{
OsuBaseHit o = input as OsuBaseHit;
if (o == null) throw new Exception(@"Can't convert!");
h = new Note()
{
StartTime = o.StartTime,
Column = (int)Math.Round(o.Position.X / 512 * columns)
};
}
return h;
}
public override void Load()
{
base.Load();
if (playfield == null)
Add(playfield = new ManiaPlayfield(columns));
else
playfield.Clear();
if (objects == null) return;
foreach (ManiaBaseHit h in objects)
{
//render stuff!
Sprite s = new Sprite
{
Texture = Game.Textures.Get(@"menu-osu"),
Origin = Anchor.Centre,
Scale = new Vector2(0.1f),
PositionMode = InheritMode.XY,
Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f)
};
s.Transforms.Add(new TransformPositionY(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = -0.1f, EndValue = 0.9f });
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
s.Expire(true);
playfield.Add(s);
}
}
}
}

View File

@ -0,0 +1,44 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.GameModes.Play.Mania
{
public class ManiaPlayfield : Playfield
{
private readonly int columns;
public ManiaPlayfield(int columns)
{
this.columns = columns;
SizeMode = InheritMode.XY;
Size = new Vector2(columns / 20f, 1f);
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
}
public override void Load()
{
base.Load();
Add(new Box() { SizeMode = InheritMode.XY, Alpha = 0.5f });
for (int i = 0; i < columns; i++)
Add(new Box()
{
SizeMode = InheritMode.Y,
Size = new Vector2(2, 1),
PositionMode = InheritMode.XY,
Position = new Vector2((float)i / columns, 0),
Alpha = 0.5f,
Colour = Color4.Black
});
}
}
}

View File

@ -0,0 +1,62 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using OpenTK;
namespace osu.Game.GameModes.Play.Osu
{
public class OsuHitRenderer : HitRenderer
{
List<OsuBaseHit> objects;
private OsuPlayfield playfield;
public override List<HitObject> Objects
{
set
{
//osu! mode requires all objects to be of OsuBaseHit type.
objects = value.ConvertAll(o => (OsuBaseHit)o);
if (Parent != null)
Load();
}
}
public override void Load()
{
base.Load();
if (playfield == null)
Add(playfield = new OsuPlayfield());
else
playfield.Clear();
if (objects == null) return;
foreach (OsuBaseHit h in objects)
{
//render stuff!
Sprite s = new Sprite
{
Texture = Game.Textures.Get(@"menu-osu"),
Origin = Anchor.Centre,
Scale = new Vector2(0.1f),
Alpha = 0,
Position = h.Position
};
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 0, EndValue = 1 });
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
s.Expire(true);
playfield.Add(s);
}
}
}
}

View File

@ -0,0 +1,34 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using OpenTK;
namespace osu.Game.GameModes.Play.Osu
{
public class OsuPlayfield : Playfield
{
public OsuPlayfield()
{
SizeMode = InheritMode.None;
Size = new Vector2(512, 384);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
public override void Load()
{
base.Load();
Add(new Box()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
SizeMode = InheritMode.XY,
Alpha = 0.5f
});
}
}
}

View File

@ -0,0 +1,17 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
namespace osu.Game.GameModes.Play
{
public class Playfield : Container
{
public override void Load()
{
base.Load();
Masking = true;
}
}
}

View File

@ -0,0 +1,83 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.Beatmaps.Objects.Taiko;
using OpenTK;
namespace osu.Game.GameModes.Play.Taiko
{
public class TaikoHitRenderer : HitRenderer
{
List<TaikoBaseHit> objects;
private TaikoPlayfield playfield;
public override List<HitObject> Objects
{
set
{
//osu! mode requires all objects to be of TaikoBaseHit type.
objects = value.ConvertAll(convertForTaiko);
if (Parent != null)
Load();
}
}
private TaikoBaseHit convertForTaiko(HitObject input)
{
TaikoBaseHit h = input as TaikoBaseHit;
if (h == null)
{
OsuBaseHit o = input as OsuBaseHit;
if (o == null) throw new Exception(@"Can't convert!");
h = new TaikoBaseHit()
{
StartTime = o.StartTime
};
}
return h;
}
public override void Load()
{
base.Load();
if (playfield == null)
Add(playfield = new TaikoPlayfield());
else
playfield.Clear();
if (objects == null) return;
foreach (TaikoBaseHit h in objects)
{
//render stuff!
Sprite s = new Sprite
{
Texture = Game.Textures.Get(@"menu-osu"),
Origin = Anchor.Centre,
Scale = new Vector2(0.2f),
PositionMode = InheritMode.XY,
Position = new Vector2(1.1f, 0.5f)
};
s.Transforms.Add(new TransformPositionX(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f });
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
s.Expire(true);
playfield.Add(s);
}
}
}
}

View File

@ -0,0 +1,40 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.GameModes.Play.Taiko
{
public class TaikoPlayfield : Playfield
{
public TaikoPlayfield()
{
SizeMode = InheritMode.X;
Size = new Vector2(1, 100);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
public override void Load()
{
base.Load();
Add(new Box { SizeMode = InheritMode.XY, Alpha = 0.5f });
Add(new Sprite
{
Texture = Game.Textures.Get(@"menu-osu"),
Origin = Anchor.Centre,
Scale = new Vector2(0.2f),
PositionMode = InheritMode.XY,
Position = new Vector2(0.1f, 0.5f),
Colour = Color4.Gray
});
}
}
}

View File

@ -0,0 +1,28 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Containers;
namespace osu.Game.Graphics.Components
{
class FpsDisplay : OsuComponent
{
SpriteText fpsText;
public override void Load()
{
base.Load();
Add(fpsText = new SpriteText());
fpsText.Text = "...";
}
protected override void Update()
{
fpsText.Text = ((int)(1000 / Clock.ElapsedFrameTime)).ToString();
base.Update();
}
}
}

View File

@ -6,6 +6,7 @@ using osu.Game.GameModes.Menu;
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.OS;
using osu.Game.GameModes.Play;
namespace osu.Game
{

17
osu.Game/Users/User.cs Normal file
View File

@ -0,0 +1,17 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Users
{
public class User
{
public int Id;
public string Username;
}
}

View File

@ -45,9 +45,42 @@
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="Beatmaps\Beatmap.cs" />
<Compile Include="Beatmaps\BeatmapSet.cs" />
<Compile Include="Beatmaps\Metadata.cs" />
<Compile Include="Beatmaps\Objects\HitObject.cs" />
<Compile Include="Beatmaps\Objects\Catch\CatchBaseHit.cs" />
<Compile Include="Beatmaps\Objects\Catch\Droplet.cs" />
<Compile Include="Beatmaps\Objects\Catch\Fruit.cs" />
<Compile Include="Beatmaps\Objects\Mania\HoldNote.cs" />
<Compile Include="Beatmaps\Objects\Mania\ManiaBaseHit.cs" />
<Compile Include="Beatmaps\Objects\Mania\Note.cs" />
<Compile Include="Beatmaps\Objects\Osu\Circle.cs" />
<Compile Include="Beatmaps\Objects\Osu\OsuBaseHit.cs" />
<Compile Include="Beatmaps\Objects\Osu\Slider.cs" />
<Compile Include="Beatmaps\Objects\Osu\Spinner.cs" />
<Compile Include="Beatmaps\Objects\Taiko\TaikoBaseHit.cs" />
<Compile Include="Beatmaps\Samples\HitSampleInfo.cs" />
<Compile Include="Beatmaps\Samples\SampleBank.cs" />
<Compile Include="Beatmaps\Samples\SampleInfo.cs" />
<Compile Include="Beatmaps\Samples\SampleSet.cs" />
<Compile Include="Beatmaps\Samples\SampleType.cs" />
<Compile Include="Beatmaps\Timing\ControlPoint.cs" />
<Compile Include="Beatmaps\Timing\SampleChange.cs" />
<Compile Include="Beatmaps\Timing\TimingChange.cs" />
<Compile Include="Configuration\OsuConfigManager.cs" />
<Compile Include="GameModes\Menu\ButtonSystem.cs" />
<Compile Include="GameModes\Menu\MainMenu.cs" />
<Compile Include="GameModes\Play\Catch\CatchHitRenderer.cs" />
<Compile Include="GameModes\Play\Catch\CatchPlayfield.cs" />
<Compile Include="GameModes\Play\HitRenderer.cs" />
<Compile Include="GameModes\Play\Mania\ManiaHitRenderer.cs" />
<Compile Include="GameModes\Play\Mania\ManiaPlayfield.cs" />
<Compile Include="GameModes\Play\Osu\OsuHitRenderer.cs" />
<Compile Include="GameModes\Play\Osu\OsuPlayfield.cs" />
<Compile Include="GameModes\Play\Playfield.cs" />
<Compile Include="GameModes\Play\Taiko\TaikoHitRenderer.cs" />
<Compile Include="GameModes\Play\Taiko\TaikoPlayfield.cs" />
<Compile Include="Graphics\Containers\OsuComponent.cs" />
<Compile Include="Graphics\Containers\OsuGameMode.cs" />
<Compile Include="Graphics\Containers\OsuLargeComponent.cs" />
@ -70,6 +103,7 @@
<Compile Include="OsuGame.cs" />
<Compile Include="OsuGameBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Users\User.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">