Beispiel #1
0
 public override void OnFinishedLoad()
 {
     if (GameManager.IsServer)
     {
         CurrentFabricator = XmlSaveLoad.GetReferenceable(_savedId) as SimpleFabricatorBase;
     }
 }
        public async Task PostSave(IHttpContext context, PostSavePayload body)
        {
            Authenticator.VerifyAuth(context);

            if (body == null)
            {
                throw new BadRequestException("A body with a fileName must be specified.");
            }

            if (body.fileName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                throw new BadRequestException("Filename contains invalid characters.");
            }

            string worldDirectory = Path.Combine(XmlSaveLoad.CheckFiles(), "saves/" + body.fileName);

            UnityMainThreadDispatcher.Instance().Enqueue(XmlSaveLoad.Instance.ForceWriteWorld(worldDirectory));
            await context.SendResponse(HttpStatusCode.OK, body);
        }