private IEnumerator LoadFirstSceneCoroutine() { var path = subSceneNames.FirstOrDefault(); if (string.IsNullOrEmpty(path)) { throw new InvalidOperationException("[Juniper.MasterSceneController::LoadFirstScene] No subscenes defined."); } else { var name = GetSceneNameFromPath(path); if (string.IsNullOrEmpty(name)) { throw new InvalidOperationException("[Juniper.MasterSceneController::LoadFirstScene] Could not find scene " + path); } else { IProgress prog; if (StreamingAssetsCacheLayer.NeedsUnpack) { loadingBar.Activate(); var unpackProg = loadingBar.Subdivide(0, 0.25f); prog = loadingBar.Subdivide(0.25f, 0.75f); yield return(StreamingAssetsCacheLayer .UnpackAPKAsync(unpackProg) .AsCoroutine()); } else { prog = loadingBar; } yield return(SwitchToSceneCoroutine(name, true, false, true, false, prog)); } } }
private void createAccountButton_Click(object sender, EventArgs e) { RegisterModel register = new RegisterModel(); register.RegisterProcess(_data); LogInModel login = new LogInModel(); LogInData loginData = new LogInData(); LogInData.ViaAction = "REGISTER"; loginData.Username = _data.Username; loginData.Password = _data.Password; bool isConnected = login.LogInProcess(loginData); if (isConnected) { notificationLabel.ForeColor = Color.Green; notificationLabel.Text = "Connected"; notificationLabel.Visible = true; } else { notificationLabel.ForeColor = Color.Red; notificationLabel.Text = "Account does NOT Exist!"; notificationLabel.Visible = true; } var loadingBar = new LoadingBar(); loadingBar.Activate(131, 383, this); Refresh(); notificationLabel.Visible = false; if (isConnected) { Close(); Dispose(); AppProjForm appProjForm = new AppProjForm(); appProjForm.ShowDialog(); } }
private async Task CaptureCubemap(PhotosphereJig photosphere) { try { var fileRef = photosphere.name + codec.ContentType; if (cache.IsCached(fileRef)) { Debug.Log("Cubemap already cached"); } else { loadingBar.Activate(); const int dim = 2048; Cubemap cubemap = null; Texture2D img = null; await loadingBar.RunAsync( ("Rendering cubemap", async(prog) => { cubemap = await JuniperSystem.OnMainThreadAsync(() => { prog.Report(0); var cb = new Cubemap(dim, TextureFormat.RGB24, false); cb.Apply(); var curMask = DisplayManager.MainCamera.cullingMask; DisplayManager.MainCamera.cullingMask = LayerMask.GetMask(Photosphere.PHOTOSPHERE_LAYER_ARR); var curRotation = DisplayManager.MainCamera.transform.rotation; DisplayManager.MainCamera.transform.rotation = Quaternion.identity; DisplayManager.MainCamera.RenderToCubemap(cb, 63); DisplayManager.MainCamera.cullingMask = curMask; DisplayManager.MainCamera.transform.rotation = curRotation; prog.Report(1); return(cb); }); } ), ("Copying cubemap faces", async(prog) => { for (var f = 0; f < CAPTURE_CUBEMAP_FACES.Length; ++f) { await JuniperSystem.OnMainThreadAsync(() => { prog.Report(f, CAPTURE_CUBEMAP_FACES.Length, CAPTURE_CUBEMAP_FACES[f].ToString()); var pixels = cubemap.GetPixels(CAPTURE_CUBEMAP_FACES[f]); var texture = new Texture2D(cubemap.width, cubemap.height); texture.SetPixels(pixels); texture.Apply(); CAPTURE_CUBEMAP_SUB_IMAGES[f] = texture; prog.Report(f + 1, CAPTURE_CUBEMAP_FACES.Length); }); } } ), ("Concatenating faces", async(prog) => { img = await JuniperSystem.OnMainThreadAsync(() => processor.Concatenate(ImageData.CubeCross(CAPTURE_CUBEMAP_SUB_IMAGES), prog)); } ), ("Saving image", (prog) => JuniperSystem.OnMainThreadAsync(() => cache.Save(codec, fileRef, img)))); loadingBar.Deactivate(); } await JuniperSystem.OnMainThreadAsync(photosphere.DestroyJig); var anyDestroyed = await JuniperSystem.OnMainThreadAsync(() => { var any = false; foreach (var texture in CAPTURE_CUBEMAP_SUB_IMAGES) { if (texture != null) { any = true; Destroy(texture); } } return(any); }); if (anyDestroyed) { Resources.UnloadUnusedAssets(); GC.Collect(); } photosphere.enabled = false; await Task.Yield(); photosphere.enabled = true; } catch (Exception exp) { Debug.LogError("Cubemap capture error"); Debug.LogException(exp, this); throw; } }
private void logInButton_Click(object sender, EventArgs e) { LogInData.ViaAction = "LOGIN"; LogInModel model = new LogInModel(); bool isConnected = model.LogInProcess(_data); if (isConnected) { welcomeLabel.Location = new Point(welcomeLabel.Location.X - usernameTextBox.Text.Length, welcomeLabel.Location.Y); welcomeLabel.Text = "Welcome, " + usernameTextBox.Text; notificationLabel.ForeColor = Color.Green; notificationLabel.Text = "Connected"; notificationLabel.Visible = true; //if (rememberMeCheckBox.Checked) //{ // XmlTextWriter textWriter = new XmlTextWriter("rememberMe.xml", null); // textWriter.WriteStartDocument(); // textWriter.WriteWhitespace("\n"); // textWriter.WriteStartElement("Username"); // //textWriter.WriteAttributeString("Username", _data.Username); // textWriter.WriteWhitespace("\n\t"); // textWriter.WriteElementString("Username", _data.Username); // textWriter.WriteEndElement(); // textWriter.WriteStartElement("Checked"); // textWriter.WriteWhitespace("\n\t"); // textWriter.WriteElementString("Checked", "true"); // textWriter.WriteEndElement(); // textWriter.WriteEndDocument(); // textWriter.Flush(); // textWriter.Close(); //} //else //{ // XmlTextWriter textWriter = new XmlTextWriter("rememberMe.xml", null); // textWriter.WriteStartDocument(); // textWriter.WriteWhitespace("\n"); // textWriter.WriteStartElement("Username"); // //textWriter.WriteAttributeString("Username", _data.Username); // textWriter.WriteWhitespace("\n\t"); // textWriter.WriteElementString("Username", "Username"); // textWriter.WriteEndElement(); // textWriter.WriteStartElement("Checked"); // textWriter.WriteWhitespace("\n\t"); // textWriter.WriteElementString("Checked", "false"); // textWriter.WriteEndElement(); // textWriter.WriteEndDocument(); // textWriter.Flush(); // textWriter.Close(); //} } else { notificationLabel.ForeColor = Color.Red; notificationLabel.Text = "Account does NOT Exist!"; notificationLabel.Visible = true; } var loadingBar = new LoadingBar(); loadingBar.Activate(131, 383, this); Refresh(); notificationLabel.Visible = false; if (isConnected) { Close(); Dispose(); AppProjForm appProjForm = new AppProjForm(); appProjForm.ShowDialog(); } }