Support for all languages! (letters and numbers). Shapes and colors supported for Russian. Upgraded to .NET 4.6.1.
This commit is contained in:
Родитель
8b8581481c
Коммит
0a120f6ff2
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
|
@ -10,14 +10,14 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>BabySmash</RootNamespace>
|
||||
<AssemblyName>BabySmash</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ManifestCertificateThumbprint>E4355A6B46BE61300D217B56C346651E03BEB47F</ManifestCertificateThumbprint>
|
||||
<ManifestKeyFile>private.pfx</ManifestKeyFile>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
<SignManifests>true</SignManifests>
|
||||
<SignManifests>false</SignManifests>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<ApplicationIcon>App.ico</ApplicationIcon>
|
||||
<FileUpgradeFlags>
|
||||
|
@ -56,6 +56,7 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
@ -65,9 +66,34 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Extensions\ObjectExtensions.cs" />
|
||||
<Compile Include="Shapes\BabySmashShape.cs" />
|
||||
<Compile Include="WordFinder.cs" />
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationFramework.Luna">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
|
@ -78,9 +104,10 @@
|
|||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Speech">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Speech.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
|
@ -275,14 +302,23 @@
|
|||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.config" />
|
||||
<None Include="app.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="BabySmash_TemporaryKey.pfx" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="private.pfx" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
<None Include="Resources\Strings\ru-RU.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Resources\Strings\en-EN.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
|
@ -360,9 +396,8 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
<!-- THIS IS WHERE I ACTUALLY RELEASE IT TO PRODUCTION -->
|
||||
<!--<Target Name="BeforePublish">
|
||||
<Exec Command=""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\signtool.exe" sign /f "$(ProjectDir)\private.pfx" /p PASSWORD /v "$(ProjectDir)obj\$(ConfigurationName)\$(TargetFileName)"" />
|
||||
</Target>-->
|
||||
</Project>
|
||||
</Project>
|
|
@ -1,20 +1,26 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.22609.0
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BabySmash", "BabySmash.csproj", "{FB378E07-FDE4-4FC7-9210-68F80B561164}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FB378E07-FDE4-4FC7-9210-68F80B561164}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FB378E07-FDE4-4FC7-9210-68F80B561164}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FB378E07-FDE4-4FC7-9210-68F80B561164}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FB378E07-FDE4-4FC7-9210-68F80B561164}.Debug|x64.Build.0 = Debug|x64
|
||||
{FB378E07-FDE4-4FC7-9210-68F80B561164}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB378E07-FDE4-4FC7-9210-68F80B561164}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FB378E07-FDE4-4FC7-9210-68F80B561164}.Release|x64.ActiveCfg = Release|x64
|
||||
{FB378E07-FDE4-4FC7-9210-68F80B561164}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
983
Controller.cs
983
Controller.cs
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,71 @@
|
|||
namespace BabySmash.Extensions
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
|
||||
/// <summary>
|
||||
/// Contains extension methods for objects
|
||||
/// </summary>
|
||||
public static class ObjectExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Uses reflection to find a private field and validate its type.
|
||||
/// </summary>
|
||||
/// <param name="ownerType">The type that declares the field. FlattenHierarchy doesn't work for private fields, so you have to pass the base type that declares the field.</param>
|
||||
/// <param name="valueType">Expected field type.</param>
|
||||
/// <param name="fieldName">Name of the field to read.</param>
|
||||
/// <returns>Field information.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"/>
|
||||
/// <exception cref="CatalystException">When field is not found or it is of incorrect type.</exception>
|
||||
|
||||
public static FieldInfo GetField(this Type ownerType, Type valueType, string fieldName)
|
||||
{
|
||||
FieldInfo field = ownerType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (field == null)
|
||||
{
|
||||
throw new ArgumentException($"Failed to find field '{fieldName}' on type {ownerType.FullName}.");
|
||||
}
|
||||
|
||||
if (!valueType.IsAssignableFrom(field.FieldType))
|
||||
{
|
||||
throw new ArgumentException($"Field '{fieldName}' on type {ownerType.FullName} is {field.FieldType.FullName}, but expected {valueType.FullName}.");
|
||||
}
|
||||
|
||||
return field;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uses reflection to read a value of a private field.
|
||||
/// </summary>
|
||||
/// <typeparam name="TOwner">The type that declares the field. FlattenHierarchy doesn't work for private fields, so you have to pass the base type that declares the field.</typeparam>
|
||||
/// <typeparam name="TValue">Expected field type.</typeparam>
|
||||
/// <param name="owner">The instance to read the field value from.</param>
|
||||
/// <param name="fieldName">Name of the field to read.</param>
|
||||
/// <returns>Field value.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"/>
|
||||
/// <exception cref="CatalystException">When field is not found or it is of incorrect type.</exception>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "ReadField", Justification = "'Read' is a clear verb and 'field value' is the subject.")]
|
||||
public static TValue ReadFieldValue<TOwner, TValue>(this TOwner owner, string fieldName)
|
||||
{
|
||||
FieldInfo field = GetField(typeof(TOwner), typeof(TValue), fieldName);
|
||||
return (TValue)field.GetValue(owner);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uses reflection to set a value of a private field.
|
||||
/// </summary>
|
||||
/// <typeparam name="TOwner">The type that declares the field. FlattenHierarchy doesn't work for private fields, so you have to pass the base type that declares the field.</typeparam>
|
||||
/// <typeparam name="TValue">Expected field type.</typeparam>
|
||||
/// <param name="owner">The instance to write the field value to.</param>
|
||||
/// <param name="fieldName">Name of the field to write.</param>
|
||||
/// <param name="value">The value to set.</param>
|
||||
/// <exception cref="System.ArgumentNullException"/>
|
||||
/// <exception cref="CatalystException">When field is not found or it is of incorrect type.</exception>
|
||||
public static void WriteFieldValue<TOwner, TValue>(this TOwner owner, string fieldName, TValue value)
|
||||
{
|
||||
FieldInfo field = GetField(typeof(TOwner), typeof(TValue), fieldName);
|
||||
field.SetValue(owner, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Speech.Synthesis;
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using BabySmash.Properties;
|
||||
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BabySmash
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18444
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18444
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
@ -12,7 +12,7 @@ namespace BabySmash.Properties {
|
|||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
@ -50,12 +50,12 @@ namespace BabySmash.Properties {
|
|||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool UseEffects {
|
||||
public bool BitmapEffects {
|
||||
get {
|
||||
return ((bool)(this["UseEffects"]));
|
||||
return ((bool)(this["BitmapEffects"]));
|
||||
}
|
||||
set {
|
||||
this["UseEffects"] = value;
|
||||
this["BitmapEffects"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"Circle": "Circle",
|
||||
"Oval": "Oval",
|
||||
"Rectangle": "Rectangle",
|
||||
"Hexagon": "Hexagon",
|
||||
"Trapezoid": "Trapezoid",
|
||||
"Star": "Star",
|
||||
"Square": "Square",
|
||||
"Triangle": "Triangle",
|
||||
"Heart": "Heart",
|
||||
|
||||
"Red": "Red",
|
||||
"Blue": "Blue",
|
||||
"Yellow": "Yellow",
|
||||
"Green": "Green",
|
||||
"Purple": "Purple",
|
||||
"Pink": "Pink",
|
||||
"Orange": "Orange",
|
||||
"Tan": "Tan",
|
||||
"Gray": "Gray"
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"Circle": "Круг",
|
||||
"Oval": "Овал",
|
||||
"Rectangle": "Прямоугольник",
|
||||
"Hexagon": "Шестиугольник",
|
||||
"Trapezoid": "Трапеция",
|
||||
"Star": "Звезда",
|
||||
"Square": "Квадрат",
|
||||
"Triangle": "Треугольник",
|
||||
"Heart": "Сердце",
|
||||
|
||||
"Red": "красный",
|
||||
"Blue": "синий",
|
||||
"Yellow": "желтый",
|
||||
"Green": "зеленый",
|
||||
"Purple": "фиолетовый",
|
||||
"Pink": "розовый",
|
||||
"Orange": "оранжевый",
|
||||
"Tan": "желтовато-коричневый",
|
||||
"Gray": "серый"
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
namespace BabySmash.Shapes
|
||||
{
|
||||
public enum BabySmashShape
|
||||
{
|
||||
Circle,
|
||||
Oval,
|
||||
Rectangle,
|
||||
Hexagon,
|
||||
Trapezoid,
|
||||
Star,
|
||||
Square,
|
||||
Triangle,
|
||||
Heart
|
||||
}
|
||||
}
|
|
@ -6,86 +6,97 @@ using System.Windows.Media;
|
|||
using System.Windows.Media.Effects;
|
||||
using BrushControlFunc = System.Func<System.Windows.Media.Brush, System.Windows.Controls.UserControl>;
|
||||
using BabySmash.Properties;
|
||||
using BabySmash.Shapes;
|
||||
|
||||
namespace BabySmash
|
||||
{
|
||||
public class FigureTemplate
|
||||
{
|
||||
public Brush Fill { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public BrushControlFunc GeneratorFunc { get; set; }
|
||||
public Effect Effect { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Letter { get; set; }
|
||||
}
|
||||
public class FigureTemplate
|
||||
{
|
||||
public Brush Fill { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public BrushControlFunc GeneratorFunc { get; set; }
|
||||
public Effect Effect { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Letter { get; set; }
|
||||
}
|
||||
|
||||
public class FigureGenerator
|
||||
{
|
||||
private static readonly List<KeyValuePair<string, BrushControlFunc>> hashTableOfFigureGenerators = new List<KeyValuePair<string, BrushControlFunc>>
|
||||
{
|
||||
new KeyValuePair<string, BrushControlFunc>("Circle", x => new CoolCircle(x) ),
|
||||
new KeyValuePair<string, BrushControlFunc>("Oval", x => new CoolOval(x) ),
|
||||
new KeyValuePair<string, BrushControlFunc>("Rectangle", x => new CoolRectangle(x) ),
|
||||
new KeyValuePair<string, BrushControlFunc>("Hexagon", x => new CoolHexagon(x) ),
|
||||
new KeyValuePair<string, BrushControlFunc>("Trapezoid", x => new CoolTrapezoid(x) ),
|
||||
new KeyValuePair<string, BrushControlFunc>("Star", x => new CoolStar(x) ),
|
||||
new KeyValuePair<string, BrushControlFunc>("Square", x => new CoolSquare(x) ),
|
||||
new KeyValuePair<string, BrushControlFunc>("Triangle", x => new CoolTriangle(x) ),
|
||||
new KeyValuePair<string, BrushControlFunc>("Heart", x => new CoolHeart(x) )
|
||||
};
|
||||
public class FigureGenerator
|
||||
{
|
||||
private static readonly List<KeyValuePair<BabySmashShape, BrushControlFunc>> hashTableOfFigureGenerators = new List<KeyValuePair<BabySmashShape, BrushControlFunc>>
|
||||
{
|
||||
new KeyValuePair<BabySmashShape, BrushControlFunc>(BabySmashShape.Circle, x => new CoolCircle(x) ),
|
||||
new KeyValuePair<BabySmashShape, BrushControlFunc>(BabySmashShape.Oval, x => new CoolOval(x) ),
|
||||
new KeyValuePair<BabySmashShape, BrushControlFunc>(BabySmashShape.Rectangle, x => new CoolRectangle(x) ),
|
||||
new KeyValuePair<BabySmashShape, BrushControlFunc>(BabySmashShape.Hexagon, x => new CoolHexagon(x) ),
|
||||
new KeyValuePair<BabySmashShape, BrushControlFunc>(BabySmashShape.Trapezoid, x => new CoolTrapezoid(x) ),
|
||||
new KeyValuePair<BabySmashShape, BrushControlFunc>(BabySmashShape.Star, x => new CoolStar(x) ),
|
||||
new KeyValuePair<BabySmashShape, BrushControlFunc>(BabySmashShape.Square, x => new CoolSquare(x) ),
|
||||
new KeyValuePair<BabySmashShape, BrushControlFunc>(BabySmashShape.Triangle, x => new CoolTriangle(x) ),
|
||||
new KeyValuePair<BabySmashShape, BrushControlFunc>(BabySmashShape.Heart, x => new CoolHeart(x) )
|
||||
};
|
||||
|
||||
public static UserControl NewUserControlFrom(FigureTemplate template)
|
||||
{
|
||||
UserControl retVal = null;
|
||||
|
||||
if (template.Letter.Length == 1 && Char.IsLetterOrDigit(template.Letter[0]))
|
||||
{
|
||||
retVal = new CoolLetter(template.Fill.Clone(), template.Letter[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal = template.GeneratorFunc(template.Fill.Clone());
|
||||
}
|
||||
public static UserControl NewUserControlFrom(FigureTemplate template)
|
||||
{
|
||||
UserControl retVal = null;
|
||||
|
||||
var randomTransition1 = (Tweener.TransitionType)Utils.RandomBetweenTwoNumbers(1, (int)Tweener.TransitionType.EaseOutInBounce);
|
||||
var ani1 = Tweener.Tween.CreateAnimation(randomTransition1, 0, 1, new TimeSpan(0, 0, 0, 1), 30);
|
||||
var randomTransition2 = (Tweener.TransitionType)Utils.RandomBetweenTwoNumbers(1, (int)Tweener.TransitionType.EaseOutInBounce);
|
||||
var ani2 = Tweener.Tween.CreateAnimation(randomTransition2, 360, 0, new TimeSpan(0, 0, 0, 1), 30);
|
||||
retVal.RenderTransformOrigin = new Point(0.5, 0.5);
|
||||
var group = new TransformGroup();
|
||||
group.Children.Add(new ScaleTransform());
|
||||
group.Children.Add(new RotateTransform());
|
||||
retVal.RenderTransform = group;
|
||||
group.Children[0].BeginAnimation(ScaleTransform.ScaleXProperty, ani1);
|
||||
group.Children[0].BeginAnimation(ScaleTransform.ScaleYProperty, ani1);
|
||||
group.Children[1].BeginAnimation(RotateTransform.AngleProperty, ani2);
|
||||
if (template.Letter.Length == 1 && Char.IsLetterOrDigit(template.Letter[0]))
|
||||
{
|
||||
retVal = new CoolLetter(template.Fill.Clone(), template.Letter[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal = template.GeneratorFunc(template.Fill.Clone());
|
||||
}
|
||||
|
||||
if (Settings.Default.UseEffects)
|
||||
{
|
||||
retVal.Effect = template.Effect.Clone();
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
var randomTransition1 = (Tweener.TransitionType)Utils.RandomBetweenTwoNumbers(1, (int)Tweener.TransitionType.EaseOutInBounce);
|
||||
var ani1 = Tweener.Tween.CreateAnimation(randomTransition1, 0, 1, new TimeSpan(0, 0, 0, 1), 30);
|
||||
var randomTransition2 = (Tweener.TransitionType)Utils.RandomBetweenTwoNumbers(1, (int)Tweener.TransitionType.EaseOutInBounce);
|
||||
var ani2 = Tweener.Tween.CreateAnimation(randomTransition2, 360, 0, new TimeSpan(0, 0, 0, 1), 30);
|
||||
retVal.RenderTransformOrigin = new Point(0.5, 0.5);
|
||||
var group = new TransformGroup();
|
||||
group.Children.Add(new ScaleTransform());
|
||||
group.Children.Add(new RotateTransform());
|
||||
retVal.RenderTransform = group;
|
||||
group.Children[0].BeginAnimation(ScaleTransform.ScaleXProperty, ani1);
|
||||
group.Children[0].BeginAnimation(ScaleTransform.ScaleYProperty, ani1);
|
||||
group.Children[1].BeginAnimation(RotateTransform.AngleProperty, ani2);
|
||||
|
||||
//TODO: Should this be in XAML? Would that make it better?
|
||||
//TODO: Should I change the height, width and stroke to be relative to the screen size?
|
||||
//TODO: Where can I get REALLY complex shapes like animal vectors or custom pics? Where do I store them?
|
||||
if (Settings.Default.BitmapEffects)
|
||||
{
|
||||
retVal.Effect = template.Effect.Clone();
|
||||
}
|
||||
|
||||
public static FigureTemplate GenerateFigureTemplate(char displayChar)
|
||||
{
|
||||
Color c = Utils.GetRandomColor();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
var nameFunc = hashTableOfFigureGenerators[Utils.RandomBetweenTwoNumbers(0, hashTableOfFigureGenerators.Count - 1)];
|
||||
return new FigureTemplate
|
||||
{
|
||||
Color = c,
|
||||
Name = Char.IsLetterOrDigit(displayChar) ? displayChar.ToString() : nameFunc.Key,
|
||||
GeneratorFunc = nameFunc.Value,
|
||||
Fill = Utils.GetGradientBrush(c),
|
||||
Letter = displayChar.ToString(),
|
||||
Effect = Animation.GetRandomBitmapEffect()
|
||||
};
|
||||
}
|
||||
}
|
||||
//TODO: Should this be in XAML? Would that make it better?
|
||||
//TODO: Should I change the height, width and stroke to be relative to the screen size?
|
||||
//TODO: Where can I get REALLY complex shapes like animal vectors or custom pics? Where do I store them?
|
||||
|
||||
public static FigureTemplate GenerateFigureTemplate(char displayChar)
|
||||
{
|
||||
Color c = Utils.GetRandomColor();
|
||||
|
||||
string name = null;
|
||||
KeyValuePair<BabySmashShape, BrushControlFunc> nameFunc = hashTableOfFigureGenerators[Utils.RandomBetweenTwoNumbers(0, hashTableOfFigureGenerators.Count - 1)];
|
||||
if (Char.IsLetterOrDigit(displayChar))
|
||||
{
|
||||
name = displayChar.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
name = Controller.GetLocalizedString(nameFunc.Key.ToString());
|
||||
}
|
||||
|
||||
return new FigureTemplate
|
||||
{
|
||||
Color = c,
|
||||
Name = name,
|
||||
GeneratorFunc = nameFunc.Value,
|
||||
Fill = Utils.GetGradientBrush(c),
|
||||
Letter = displayChar.ToString(),
|
||||
Effect = Animation.GetRandomBitmapEffect()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -58,5 +58,5 @@
|
|||
</setting>
|
||||
</BabySmash.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup/>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup>
|
||||
</configuration>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net461" />
|
||||
</packages>
|
Загрузка…
Ссылка в новой задаче