Skip to content

Commit

Permalink
Filemanager updates and Serialziable experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
NimbusFox committed Mar 5, 2018
1 parent c39d9e1 commit cf18446
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
12 changes: 11 additions & 1 deletion NimbusFox.FoxCore/Classes/VectorCubeD.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Plukit.Base;
using System;
using Plukit.Base;

namespace NimbusFox.FoxCore.Classes {
[Serializable]
public class VectorCubeD {
private Vector3D Start { get; }
private Vector3D End { get; }
Expand Down Expand Up @@ -37,5 +39,13 @@ public bool IsInside(Vector3D position) {
&& Y.End > position.Y
&& Z.End > position.Z;
}

public Vector3D GetStart() {
return new Vector3D(X.Start, Y.Start, Z.Start);
}

public Vector3D GetEnd() {
return new Vector3D(X.End, Y.End, Z.End);
}
}
}
18 changes: 11 additions & 7 deletions NimbusFox.FoxCore/Classes/VectorCubeI.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
using Plukit.Base;
using System;
using Plukit.Base;

namespace NimbusFox.FoxCore.Classes {
[Serializable]
public class VectorCubeI {
private Vector3I Start { get; }
private Vector3I End { get; }

public AreaI X { get; }
public AreaI Y { get; }
public AreaI Z { get; }

public VectorCubeI(Vector3I start, Vector3I end) {
Start = start;
End = end;

X = new AreaI(start.X, end.X);

Y = new AreaI(start.Y, end.Y);
Expand Down Expand Up @@ -41,5 +37,13 @@ public bool IsInside(Vector3D position) {
public long GetTileCount() {
return (X.End - X.Start) * (Z.End - Z.Start) * (Y.End - Y.Start);
}

public Vector3I GetStart() {
return new Vector3I(X.Start, Y.Start, Z.Start);
}

public Vector3I GetEnd() {
return new Vector3I(X.End, Y.End, Z.End);
}
}
}
5 changes: 4 additions & 1 deletion NimbusFox.FoxCore/Managers/FileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void WriteFile<T>(string fileName, T data, bool outputAsText = false) {
}

public void WriteFileStream(string filename, Stream stream) {
stream.Seek(0L, SeekOrigin.Begin);
GameContext.ContentLoader.WriteLocalStream(LocalContentLocation + filename, stream);
}

Expand Down Expand Up @@ -65,7 +66,9 @@ public void WriteFileStream(string filename, Stream stream) {
}

public Stream ReadFileStream(string filename, bool required = false) {
return GameContext.ContentLoader.ReadLocalStream(LocalContentLocation + filename, required);
var stream = GameContext.ContentLoader.ReadLocalStream(LocalContentLocation + filename, required);
stream.Seek(0L, SeekOrigin.Begin);
return stream;
}

public bool FileExists(string filename) {
Expand Down

0 comments on commit cf18446

Please sign in to comment.