Refactoring

This commit is contained in:
Harrison Deng 2019-01-15 17:33:55 -06:00
parent a62ec1bd38
commit 441a4d1a36
16 changed files with 35 additions and 36 deletions

View File

@ -53,17 +53,21 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="NinePatch\NinePatchImporter.cs" /> <Compile Include="NinePatch\NinePatchImporter.cs" />
<Compile Include="NinePatch\NinePatchData.cs" />
<Compile Include="NinePatch\NinePatchProcessor.cs" /> <Compile Include="NinePatch\NinePatchProcessor.cs" />
<Compile Include="NinePatch\NinePatchWriter.cs" /> <Compile Include="NinePatch\NinePatchWriter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TextureAtlas\TextureAtlasWriter.cs" /> <Compile Include="TextureAtlas\TextureAtlasWriter.cs" />
<Compile Include="TextureAtlas\TextureAtlasImporter.cs" /> <Compile Include="TextureAtlas\TextureAtlasImporter.cs" />
<Compile Include="TextureAtlas\TextureAtlasProcessor.cs" /> <Compile Include="TextureAtlas\TextureAtlasProcessor.cs" />
<Compile Include="TextureAtlas\TextureAtlasData.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RecrownedAthenaeum\RecrownedAthenaeum.csproj">
<Project>{95a926dc-1482-4368-91da-8d30ac04740a}</Project>
<Name>RecrownedAthenaeum</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -20,7 +20,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\RecrownedAthenaeum.Pipeline\RecrownedAthenaeum.Pipeline.csproj" /> <ProjectReference Include="..\RecrownedAthenaeum\RecrownedAthenaeum.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,4 +1,4 @@
using RecrownedAthenaeum.DataTypes; using RecrownedAthenaeum.SpecialTypes;
namespace RecrownedAthenaeum.ContentSystem.ContentResolvers namespace RecrownedAthenaeum.ContentSystem.ContentResolvers
{ {

View File

@ -1,6 +1,6 @@
using RecrownedAthenaeum.Pipeline.TextureAtlas; using RecrownedAthenaeum.Pipeline.TextureAtlas;
namespace RecrownedAthenaeum.Pipeline.NinePatch namespace RecrownedAthenaeum.Pipeline
{ {
/// <summary> /// <summary>
/// Represents a data structure for 9patches. /// Represents a data structure for 9patches.

View File

@ -4,14 +4,14 @@ using System.Text;
namespace RecrownedAthenaeum.Pipeline namespace RecrownedAthenaeum.Pipeline
{ {
class NinePatchDataReader : ContentTypeReader<DataTypes.NinePatch> class NinePatchDataReader : ContentTypeReader<SpecialTypes.NinePatch>
{ {
protected override DataTypes.NinePatch Read(ContentReader input, DataTypes.NinePatch existingInstance) protected override SpecialTypes.NinePatch Read(ContentReader input, SpecialTypes.NinePatch existingInstance)
{ {
int length = input.ReadInt32(); int length = input.ReadInt32();
byte[] bytes = input.ReadBytes(length); byte[] bytes = input.ReadBytes(length);
return JsonConvert.DeserializeObject<DataTypes.NinePatch>(Encoding.UTF8.GetString(bytes)); return JsonConvert.DeserializeObject<SpecialTypes.NinePatch>(Encoding.UTF8.GetString(bytes));
} }
} }
} }

View File

@ -1,7 +1,6 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using RecrownedAthenaeum.Pipeline.NinePatch;
namespace RecrownedAthenaeum.Pipeline.TextureAtlas namespace RecrownedAthenaeum.Pipeline
{ {
/// <summary> /// <summary>
/// Data transfer object for a texture atlas. /// Data transfer object for a texture atlas.

View File

@ -7,31 +7,31 @@ using System.Text;
namespace RecrownedAthenaeum.Pipeline namespace RecrownedAthenaeum.Pipeline
{ {
class TextureAtlasDataReader : ContentTypeReader<DataTypes.TextureAtlas> class TextureAtlasDataReader : ContentTypeReader<SpecialTypes.TextureAtlas>
{ {
protected override DataTypes.TextureAtlas Read(ContentReader input, DataTypes.TextureAtlas existingInstance) protected override SpecialTypes.TextureAtlas Read(ContentReader input, SpecialTypes.TextureAtlas existingInstance)
{ {
string serialized = input.ReadString(); string serialized = input.ReadString();
TextureAtlasData atlasData = JsonConvert.DeserializeObject<TextureAtlasData>(serialized); TextureAtlasData atlasData = JsonConvert.DeserializeObject<TextureAtlasData>(serialized);
DataTypes.TextureAtlas atlas; SpecialTypes.TextureAtlas atlas;
Texture2D atlasTexture = input.ContentManager.Load<Texture2D>(atlasData.textureName); Texture2D atlasTexture = input.ContentManager.Load<Texture2D>(atlasData.textureName);
DataTypes.TextureAtlas.TextureAtlasRegion[] regions = new DataTypes.TextureAtlas.TextureAtlasRegion[atlasData.regions.Length]; SpecialTypes.TextureAtlas.TextureAtlasRegion[] regions = new SpecialTypes.TextureAtlas.TextureAtlasRegion[atlasData.regions.Length];
for (int regionID = 0; regionID < regions.Length; regionID++) for (int regionID = 0; regionID < regions.Length; regionID++)
{ {
TextureAtlasData.AtlasRegionData regionData = atlasData.regions[regionID]; TextureAtlasData.AtlasRegionData regionData = atlasData.regions[regionID];
DataTypes.NinePatch nPatch = null; SpecialTypes.NinePatch nPatch = null;
if (regionData.ninePatchData != null) if (regionData.ninePatchData != null)
{ {
NinePatchData nPatchData = regionData.ninePatchData; NinePatchData nPatchData = regionData.ninePatchData;
nPatch = new DataTypes.NinePatch(atlasTexture, nPatchData.left, nPatchData.right, nPatchData.bottom, nPatchData.bottom); nPatch = new SpecialTypes.NinePatch(atlasTexture, nPatchData.left, nPatchData.right, nPatchData.bottom, nPatchData.bottom);
} }
regions[regionID] = new DataTypes.TextureAtlas.TextureAtlasRegion(regionData.name, regionData.location, nPatch, atlasTexture); regions[regionID] = new SpecialTypes.TextureAtlas.TextureAtlasRegion(regionData.name, regionData.location, nPatch, atlasTexture);
} }
atlas = new DataTypes.TextureAtlas(atlasTexture, regions); atlas = new SpecialTypes.TextureAtlas(atlasTexture, regions);
return atlas; return atlas;
} }

View File

@ -58,16 +58,18 @@
<Compile Include="ContentSystem\ContentResolvers\ResolutionContentResolver.cs" /> <Compile Include="ContentSystem\ContentResolvers\ResolutionContentResolver.cs" />
<Compile Include="ContentSystem\IContentPathModifier.cs" /> <Compile Include="ContentSystem\IContentPathModifier.cs" />
<Compile Include="ContentSystem\ContentResolvers\NormalContentResolver.cs" /> <Compile Include="ContentSystem\ContentResolvers\NormalContentResolver.cs" />
<Compile Include="DataTypes\ISpecialDrawable.cs" /> <Compile Include="SpecialTypes\ISpecialDrawable.cs" />
<Compile Include="DataTypes\NinePatch.cs" /> <Compile Include="SpecialTypes\NinePatch.cs" />
<Compile Include="DataTypes\Resolution.cs" /> <Compile Include="SpecialTypes\Resolution.cs" />
<Compile Include="DataTypes\TextureAtlas.cs" /> <Compile Include="SpecialTypes\TextureAtlas.cs" />
<Compile Include="Input\IInputListener.cs" /> <Compile Include="Input\IInputListener.cs" />
<Compile Include="Input\InputListener.cs" /> <Compile Include="Input\InputListener.cs" />
<Compile Include="Input\InputUtilities.cs" /> <Compile Include="Input\InputUtilities.cs" />
<Compile Include="ParticleSystem\Particle.cs" /> <Compile Include="ParticleSystem\Particle.cs" />
<Compile Include="Persistence\PreferencesManager.cs" /> <Compile Include="Persistence\PreferencesManager.cs" />
<Compile Include="Pipeline\NinePatchData.cs" />
<Compile Include="Pipeline\NinePatchDataReader.cs" /> <Compile Include="Pipeline\NinePatchDataReader.cs" />
<Compile Include="Pipeline\TextureAtlasData.cs" />
<Compile Include="Pipeline\TextureAtlasDataReader.cs" /> <Compile Include="Pipeline\TextureAtlasDataReader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Render\RectangleRenderer.cs" /> <Compile Include="Render\RectangleRenderer.cs" />
@ -94,11 +96,5 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RecrownedAthenaeum.Pipeline\RecrownedAthenaeum.Pipeline.csproj">
<Project>{b38f9812-b1d1-4bfe-89ee-fc4dd4ebaa3f}</Project>
<Name>RecrownedAthenaeum.Pipeline</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -1,7 +1,7 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
namespace RecrownedAthenaeum.DataTypes namespace RecrownedAthenaeum.SpecialTypes
{ {
/// <summary> /// <summary>
/// A wrapper that makes sure anything implementing can be drawn with options. /// A wrapper that makes sure anything implementing can be drawn with options.

View File

@ -2,7 +2,7 @@
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using System; using System;
namespace RecrownedAthenaeum.DataTypes namespace RecrownedAthenaeum.SpecialTypes
{ {
/// <summary> /// <summary>
/// An object that represents a ninepatch. /// An object that represents a ninepatch.

View File

@ -1,6 +1,6 @@
using System; using System;
namespace RecrownedAthenaeum.DataTypes namespace RecrownedAthenaeum.SpecialTypes
{ {
/// <summary> /// <summary>
/// Holds a width and height while allowing for easier comparison between other <see cref="Resolution"/>s. /// Holds a width and height while allowing for easier comparison between other <see cref="Resolution"/>s.

View File

@ -4,7 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace RecrownedAthenaeum.DataTypes namespace RecrownedAthenaeum.SpecialTypes
{ {
/// <summary> /// <summary>
/// Holds information about an image file that contains various textures in various regions in the file. /// Holds information about an image file that contains various textures in various regions in the file.

View File

@ -1,6 +1,6 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.DataTypes; using RecrownedAthenaeum.SpecialTypes;
using System; using System;
namespace RecrownedAthenaeum.UI.Modular.Modules namespace RecrownedAthenaeum.UI.Modular.Modules

View File

@ -1,6 +1,6 @@
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using RecrownedAthenaeum.DataTypes; using RecrownedAthenaeum.SpecialTypes;
using RecrownedAthenaeum.Input; using RecrownedAthenaeum.Input;
using RecrownedAthenaeum.UI.Skin.Definitions; using RecrownedAthenaeum.UI.Skin.Definitions;

View File

@ -1,6 +1,6 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.DataTypes; using RecrownedAthenaeum.SpecialTypes;
using RecrownedAthenaeum.UI.Skin.Definitions; using RecrownedAthenaeum.UI.Skin.Definitions;
namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive

View File

@ -1,6 +1,6 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.DataTypes; using RecrownedAthenaeum.SpecialTypes;
using RecrownedAthenaeum.UI.Skin.Definitions; using RecrownedAthenaeum.UI.Skin.Definitions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;