using Chernobyl.App.Layout;
using Chernobyl.ComponentModel;
using Chernobyl.Creation;
using Chernobyl.Generation;
namespace Chernobyl.App.Patterns
{
///
/// View model for creating conflicted patterns.
///
public class PatternFactory : Builder, IFactory
{
/// The instance capable of creating a pattern that is being represented.
/// The instance that will create the player.
public PatternFactory(IConflictedPatternFactory factory, IWavePlayerFactory wavePlayerFactory)
{
Factory = factory;
_wavePlayerFactory = wavePlayerFactory;
}
///
public Content Create()
{
var config = new ConflictedPatternConfig(20);
var pattern = Factory.Create(config);
var control = new PatternControl(pattern, _wavePlayerFactory);
var view = new PatternViewModel(pattern);
var result = new Content(new[] {control}, "Pattern", view);
ReportCreation(result);
return result;
}
///
/// The instance used in creation.
///
public IConflictedPatternFactory Factory { get; }
readonly IWavePlayerFactory _wavePlayerFactory;
}
}