public override void LoadLocation(int locationId) { LocationPrefab locationPrefab = GetLocationPrefab(locationId); RequestUri requestManifest = new RequestUri(ProjectData.IsMobileVr() ? locationPrefab.AndroidManifestResource : locationPrefab.ManifestResource); requestManifest.OnFinish += response => { ResponseUri responseManifest = (ResponseUri)response; DownloadLocationFiles(locationPrefab, responseManifest.ByteData); }; requestManifest.OnError += s => { Helper.ShowErrorLoadScene(); }; }
public override void LoadProjectStructure(int projectId, Action <ProjectStructure> onFinish) { string structureRequestString = string.Format(ApiRoutes.ProjectStructureRequest, projectId); var structureRequest = new RequestApi(structureRequestString); Logger.Info("API request: " + structureRequestString); structureRequest.OnFinish += response => { ResponseApi structureResponseApi = (ResponseApi)response; if (!Helper.IsResponseGood(structureResponseApi)) { Logger.Fatal("Can not get " + structureRequestString); onFinish.Invoke(null); return; } string projectStructureJson = structureResponseApi.Data.ToString(); ProjectStructure currentProjectStructure = projectStructureJson.JsonDeserialize <ProjectStructure>(); foreach (var scene in currentProjectStructure.Scenes) { var logicRequest = new RequestUri(scene.LogicResource); logicRequest.OnFinish += response1 => { ResponseUri logicResponse = (ResponseUri)response1; scene.AssemblyBytes = logicResponse.ByteData; }; } onFinish.Invoke(currentProjectStructure); }; }