IEnumerator DoAsyncVersionCheck(float fDelay) { bool bShowUpdateMessage = false; yield return(new WaitForSeconds(fDelay)); UnityWebRequest webRequest = UnityWebRequest.Get("http://www.gradientspace.com/s/simplex_version.txt"); yield return(webRequest.Send()); try { if (webRequest.isNetworkError) { DebugUtil.Warning("AutoUpdate : webRequest failed : " + webRequest.error); } else { byte[] data = webRequest.downloadHandler.data; string xml = Encoding.UTF8.GetString(data); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); bool bOK = false; XmlNode n1 = doc.SelectSingleNode("SimplexVersion"); if (n1 != null) { XmlNode n2 = n1.SelectSingleNode("Current"); if (n2 != null) { string version = n2.InnerText; int nVersion; if (int.TryParse(version, out nVersion)) { bOK = true; if (nVersion > SimplexConfig.CurrentVersion) { bShowUpdateMessage = true; } } } } if (!bOK) { DebugUtil.Warning("AutoUpdate : error reading/parsing downloaded data"); } } } catch (Exception e) { DebugUtil.Warning("AutoUpdate : exception trying to hande webreqeuest response : " + e.Message); } if (bShowUpdateMessage) { HUDUtil.ShowToastPopupMessage("A new version of Simplex is available! You should update!", parent); } UnityEngine.Component.Destroy(parent.RootGameObject.GetComponent <AutoUpdateBehavior>()); }
public void RegisterMessageHandlers(Cockpit cockpit) { MessageStream.Get.RegisterHandler(new DelegateMessageHandler( m => { return(cockpit.IsActive && m.Code == FileBrowserMessageCodes.MESHES_TOO_LARGE); }, m => { HUDUtil.ShowToastPopupMessage("Sorry, this mesh is too large!", cockpit); return(MessageHandlerResult.MessageHandled_Remove); } )); }
public override Capture UpdateCapture(InputState input, CaptureData data) { //CaptureControl.doSurroundCapture = false; #if false if (input.bLeftMenuButtonPressed) { press_time = FPlatform.RealTime(); if (input.bLeftShoulderDown) { CaptureControl.EnableSurroundCapture = true; } else { CaptureControl.EnableSurroundCapture = false; } } else if (input.bLeftMenuButtonReleased) { if (in_video_capture) { CaptureControl.EndVideoCapture(); string s = string.Format("Captured {0} video!", CaptureControl.EnableSurroundCapture ? "360" : "WideAngle"); HUDUtil.ShowToastPopupMessage(s, FContext.ActiveContext_HACK.ActiveCockpit); in_video_capture = false; press_time = 0; } else if (FPlatform.RealTime() - press_time > 1.0f) { CaptureControl.BeginVideoCapture(); in_video_capture = true; } else { CaptureControl.CaptureScreen(); string s = string.Format("Captured {0} screenshot!", CaptureControl.EnableSurroundCapture ? "360" : "WideAngle"); HUDUtil.ShowToastPopupMessage(s, FContext.ActiveContext_HACK.ActiveCockpit); } } #endif return(Capture.Ignore); }
public override void SaveFile(string sNewPath) { DebugUtil.Log(1, "Exporting scene to path " + sNewPath); SceneGraphConfig.LastFileOpenPath = ListView.FolderPath; string sTargetFolder = ""; bool use_auto = sNewPath.EndsWith(GetDefaultFileName()); if (use_auto == false) { sTargetFolder = Path.GetFileName(sNewPath); } string sSavePath = Path.Combine(ListView.FolderPath, sNewPath); JanusVRExporter export = new JanusVRExporter() { GlobalTranslation = -20 * Vector3f.AxisZ }; export.WriteInBackgroundThreads = true; export.BackgroundWriteCompleteF = (exp, status) => { if (status.Ok) { ActiveCockpit.Context.RegisterNextFrameAction(() => { FContext context = ActiveCockpit.Context; ActiveCockpit.Context.PopCockpit(true); //HUDUtil.ShowCenteredPopupMessage("Done!", "Exported to subfolder " + export.ExportPath, context.ActiveCockpit); HUDUtil.ShowToastPopupMessage("Exported JanusVR Room to subfolder " + export.ExportPath, context.ActiveCockpit, 1.25f, 0.8f); }); } else { ActiveCockpit.Context.RegisterNextFrameAction(() => { Debug.Log("[JanusExportScene] save at " + sNewPath + " failed: " + export.LastErrorMessage); HUDUtil.ShowCenteredPopupMessage("Export Failed", "Sorry, could not export to path " + sNewPath, ActiveCockpit); }); } }; export.Export(ActiveCockpit.Context.Scene, ListView.FolderPath, sTargetFolder); }