コード例 #1
0
 public static void switchToAddGlyphScene()
 {
     //if (ApplicationFileManager.addGlyphFileExists()) {
     //	SceneManager.LoadScene ("Scenes/AddGlyph");
     //} else {
     ApplicationFileManager.DeleteAddGlyphFile();
     SceneManager.LoadScene("Scenes/TakePicture");
     //}
 }
コード例 #2
0
        private IEnumerator uploadGlyph()
        {
            if (HardwareController.Instance.getLastLocation().Equals(GPSLocation.UNDEFINED))
            {
                statusPanel.showErrorStatus(CANNOT_ACCESS_LOCATION_ERROR);
                yield return(null);
            }
            else if (LoggedInUser.GetLoggedInUser() == null)
            {
                statusPanel.showErrorStatus(NO_LOGGED_IN_USER_ERROR);
                yield return(null);
            }
            else
            {
                statusPanel.showLoadingStatus("Creating Glyph");

                double latitude  = HardwareController.Instance.getLastLocation().latitude;
                double longitude = HardwareController.Instance.getLastLocation().longitude;
                double altitude  = HardwareController.Instance.getLastLocation().altitude;

                ServerCall uploadGlyphCall;
                if (!publicToggle.isOn)
                {
                    uploadGlyphCall = new ServerCall(ServerInteract.INSTANCE.AddPrivateGlyph(latitude, longitude, altitude));
                }
                else
                {
                    uploadGlyphCall = new ServerCall(ServerInteract.INSTANCE.AddPublicGlyph(latitude, longitude, altitude, dateTimePicker.getSelectedDateTime()));
                }

                yield return(StartCoroutine(uploadGlyphCall.call()));

                if (uploadGlyphCall.ReturnException != null)
                {
                    statusPanel.showErrorStatus(uploadGlyphCall.ReturnException.Message);
                }
                else
                {
                    OwnedGlyphEvent ownedGlyph = (OwnedGlyphEvent)uploadGlyphCall.ObjectResponse;
                    LoggedInUser.GetLoggedInUser().ownedGlyphs.Add(ownedGlyph);

                    statusPanel.showLoadingStatus("Uploading Picture");

                    ServerCall uploadToFirebaseCall = new ServerCall(ServerInteract.INSTANCE.UploadAddGlyphFileToFirebase(ownedGlyph.GetGlyph()));
                    yield return(StartCoroutine(uploadToFirebaseCall.call()));

                    if (uploadToFirebaseCall.ReturnException != null)
                    {
                        statusPanel.showErrorStatus(uploadToFirebaseCall.ReturnException.Message);
                    }
                    else
                    {
                        statusPanel.showStatus("Glyph Created!");
                        ApplicationFileManager.DeleteAddGlyphFile();

                        yield return(new WaitForSeconds(3));

                        SceneManager.LoadScene("Scenes/GroundViewScene");
                    }
                }
            }

            yield return("Done");
        }