mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
[server] Fix loading saves
This commit is contained in:
parent
192e25f27e
commit
aca12a3012
3 changed files with 11 additions and 2 deletions
|
@ -51,7 +51,7 @@ namespace Nibriboard
|
||||||
FilePrefix = "Nibriboard.ClientFiles",
|
FilePrefix = "Nibriboard.ClientFiles",
|
||||||
ClientSettings = clientSettings,
|
ClientSettings = clientSettings,
|
||||||
SpaceManager = planeManager
|
SpaceManager = planeManager
|
||||||
}, IPAddress.IPv6Any, Port);
|
}, IPAddress.Any, Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Start()
|
public async Task Start()
|
||||||
|
|
|
@ -221,7 +221,13 @@ namespace Nibriboard.RippleSpace
|
||||||
}
|
}
|
||||||
public static async Task<Chunk> FromStream(Plane plane, StreamReader chunkSource)
|
public static async Task<Chunk> FromStream(Plane plane, StreamReader chunkSource)
|
||||||
{
|
{
|
||||||
Chunk loadedChunk = JsonConvert.DeserializeObject<Chunk>(await chunkSource.ReadToEndAsync());
|
Chunk loadedChunk = JsonConvert.DeserializeObject<Chunk>(
|
||||||
|
await chunkSource.ReadToEndAsync(),
|
||||||
|
new JsonSerializerSettings() {
|
||||||
|
MissingMemberHandling = MissingMemberHandling.Ignore,
|
||||||
|
NullValueHandling = NullValueHandling.Ignore
|
||||||
|
}
|
||||||
|
);
|
||||||
loadedChunk.plane = plane;
|
loadedChunk.plane = plane;
|
||||||
loadedChunk.Location.Plane = plane;
|
loadedChunk.Location.Plane = plane;
|
||||||
foreach(DrawnLine line in loadedChunk.lines)
|
foreach(DrawnLine line in loadedChunk.lines)
|
||||||
|
|
|
@ -14,6 +14,9 @@ namespace Nibriboard.RippleSpace
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ChunkReference ContainingChunk {
|
public ChunkReference ContainingChunk {
|
||||||
get {
|
get {
|
||||||
|
if(Plane == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
return new ChunkReference(
|
return new ChunkReference(
|
||||||
Plane,
|
Plane,
|
||||||
X / Plane.ChunkSize,
|
X / Plane.ChunkSize,
|
||||||
|
|
Loading…
Reference in a new issue