-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
432 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Alex.ResourcePackLib.Abstraction | ||
{ | ||
public interface IColor | ||
{ | ||
byte R { get; set; } | ||
byte G { get; set; } | ||
byte B { get; set; } | ||
uint PackedValue { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Alex.ResourcePackLib.IO.Abstract; | ||
|
||
namespace Alex.ResourcePackLib.Bedrock | ||
{ | ||
public class MCPackModule | ||
{ | ||
public virtual string Name | ||
{ | ||
get | ||
{ | ||
return Entry.Name; | ||
} | ||
} | ||
|
||
protected IFilesystem Entry { get; } | ||
protected MCPackModule(IFilesystem entry) | ||
{ | ||
Entry = entry; | ||
} | ||
|
||
internal virtual bool Load() | ||
{ | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Alex.ResourcePackLib.IO.Abstract; | ||
|
||
namespace Alex.ResourcePackLib.Bedrock | ||
{ | ||
public class ResourceModule : MCPackModule | ||
{ | ||
/// <inheritdoc /> | ||
public ResourceModule(IFilesystem entry) : base(entry) | ||
{ | ||
|
||
} | ||
|
||
/// <inheritdoc /> | ||
internal override bool Load() | ||
{ | ||
return base.Load(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Alex.ResourcePackLib/Exceptions/UnknownModuleException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
namespace Alex.ResourcePackLib.Exceptions | ||
{ | ||
public class UnknownModuleException : Exception | ||
{ | ||
public UnknownModuleException(string message) : base(message) | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/Alex.ResourcePackLib/Json/Bedrock/Particles/Components/Flipbook.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Alex.MoLang.Parser; | ||
using Alex.ResourcePackLib.Json.Bedrock.MoLang; | ||
using Microsoft.Xna.Framework; | ||
using Newtonsoft.Json; | ||
|
||
namespace Alex.ResourcePackLib.Json.Bedrock.Particles.Components | ||
{ | ||
public class Flipbook | ||
{ | ||
[JsonProperty("base_UV")] | ||
public MoLangVector2Expression Base { get; set; } | ||
|
||
[JsonProperty("size_UV")] | ||
public Vector2? Size { get; set; } = null; | ||
|
||
[JsonProperty("step_UV")] | ||
public Vector2 Step { get; set; } = Vector2.Zero; | ||
|
||
[JsonProperty("frames_per_second")] public float? FPS { get; set; } = 8; | ||
|
||
[JsonProperty("max_frame")] public IExpression[] MaxFrame { get; set; } | ||
|
||
[JsonProperty("stretch_to_lifetime")] public bool StretchToLifetime { get; set; } | ||
|
||
[JsonProperty("loop")] public bool Loop { get; set; } = true; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/Alex.ResourcePackLib/Json/Bedrock/Particles/Components/ParticleUV.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Alex.MoLang.Runtime; | ||
using Alex.ResourcePackLib.Json.Bedrock.MoLang; | ||
using Microsoft.Xna.Framework; | ||
using Newtonsoft.Json; | ||
|
||
namespace Alex.ResourcePackLib.Json.Bedrock.Particles.Components | ||
{ | ||
public class ParticleUV | ||
{ | ||
[JsonProperty("texture_width")] | ||
public float TextureWidth { get; set; } | ||
|
||
[JsonProperty("texture_height")] | ||
public float TextureHeight { get; set; } | ||
|
||
[JsonProperty("uv")] | ||
public MoLangVector2Expression Uv { get; set; } = null; | ||
|
||
[JsonProperty("uv_size")] | ||
public MoLangVector2Expression Size { get; set; } = null; | ||
|
||
[JsonProperty("flipbook")] | ||
public Flipbook Flipbook { get; set; } | ||
|
||
public Vector2 GetUv(MoLangRuntime runtime) | ||
{ | ||
if (Flipbook?.Base != null) | ||
{ | ||
return Flipbook.Base.Evaluate(runtime, Vector2.Zero); | ||
} | ||
|
||
return Uv?.Evaluate(runtime, Vector2.Zero) ?? Vector2.Zero; | ||
} | ||
|
||
public Vector2 GetSize(MoLangRuntime runtime) | ||
{ | ||
if (Flipbook?.Size != null) | ||
{ | ||
return Flipbook.Size.Value; | ||
} | ||
|
||
return (Size?.Evaluate(runtime, Vector2.One) ?? (Vector2.One)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.