2019-08-30 06:10:11 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-06-22 16:14:29 +00:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
|
|
|
|
using osu.Game.Tests.Visual;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Game.Skinning;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
using osu.Framework.Audio.Sample;
|
2019-09-03 08:57:34 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2019-06-22 16:14:29 +00:00
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2019-08-23 12:18:56 +00:00
|
|
|
|
using osu.Game.Audio;
|
2019-06-22 16:14:29 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2019-06-24 04:47:37 +00:00
|
|
|
|
public class TestSceneCatcher : OsuTestScene
|
2019-06-22 16:14:29 +00:00
|
|
|
|
{
|
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(CatcherSprite),
|
|
|
|
|
};
|
|
|
|
|
|
2019-06-22 16:23:20 +00:00
|
|
|
|
private readonly Container container;
|
2019-06-22 16:14:29 +00:00
|
|
|
|
|
2019-06-24 04:47:37 +00:00
|
|
|
|
public TestSceneCatcher()
|
2019-06-22 16:14:29 +00:00
|
|
|
|
{
|
|
|
|
|
Child = container = new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
2019-06-24 06:09:28 +00:00
|
|
|
|
AddStep("show default catcher implementation", () => { container.Child = new CatcherSprite(); });
|
2019-06-22 16:14:29 +00:00
|
|
|
|
|
|
|
|
|
AddStep("show custom catcher implementation", () =>
|
|
|
|
|
{
|
|
|
|
|
container.Child = new CatchCustomSkinSourceContainer
|
|
|
|
|
{
|
|
|
|
|
Child = new CatcherSprite()
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class CatcherCustomSkin : Container
|
|
|
|
|
{
|
|
|
|
|
public CatcherCustomSkin()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Blue
|
|
|
|
|
},
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "custom"
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-24 04:37:06 +00:00
|
|
|
|
[Cached(typeof(ISkinSource))]
|
2019-06-22 16:14:29 +00:00
|
|
|
|
private class CatchCustomSkinSourceContainer : Container, ISkinSource
|
|
|
|
|
{
|
2019-06-22 16:23:20 +00:00
|
|
|
|
public event Action SourceChanged
|
|
|
|
|
{
|
|
|
|
|
add { }
|
|
|
|
|
remove { }
|
|
|
|
|
}
|
2019-06-22 16:14:29 +00:00
|
|
|
|
|
2019-08-30 05:39:02 +00:00
|
|
|
|
public Drawable GetDrawableComponent(ISkinComponent component)
|
2019-06-24 06:09:28 +00:00
|
|
|
|
{
|
2019-08-30 05:39:02 +00:00
|
|
|
|
switch (component.LookupName)
|
2019-06-24 06:09:28 +00:00
|
|
|
|
{
|
2019-09-04 01:44:24 +00:00
|
|
|
|
case "Gameplay/catch/fruit-catcher-idle":
|
2019-06-24 06:09:28 +00:00
|
|
|
|
return new CatcherCustomSkin();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2019-06-22 16:14:29 +00:00
|
|
|
|
|
2019-08-23 11:32:43 +00:00
|
|
|
|
public SampleChannel GetSample(ISampleInfo sampleInfo) =>
|
2019-06-24 06:09:28 +00:00
|
|
|
|
throw new NotImplementedException();
|
2019-06-22 16:14:29 +00:00
|
|
|
|
|
2019-06-24 06:09:28 +00:00
|
|
|
|
public Texture GetTexture(string componentName) =>
|
|
|
|
|
throw new NotImplementedException();
|
2019-06-22 16:14:29 +00:00
|
|
|
|
|
2019-09-03 08:57:34 +00:00
|
|
|
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
|
2019-06-22 16:14:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|