Esempio n. 1
0
        private void Awake()
        {
            // Important to not crash in editor
            if (Application.isEditor)
            {
                GameObject.Find("ARCore Device").active = false;
            }


            ActiveScreens = new List <GameObject>();

            logger = LogManager.GetInstance().GetLogger(GetType());
            logger.Debug("Awake!");
            currentState = State.IDLE;

            // Use Awake instead of ctor
            nativeLocation = LocationAwarenessPlugin.GetInstance();
            logger.Debug("Created LocationAwarenessPlugin");

            gameObject.AddComponent <UnityLocationService>();
            unityLocation = gameObject.GetComponent <UnityLocationService>();
            logger.Debug("Added UnityLocationService to Controller");


            gameObject.AddComponent <CineastApi>();
            cineast = gameObject.GetComponent <CineastApi>();
            logger.Debug("Added CineastApi to Controller");

            headingDictionary = new HeadingDictionary();

            uiManager.controller = this;

            logger.Debug("CineastApi Config: " + JsonUtility.ToJson(CineastUtils.Configuration));
        }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        #if UNITY_ANDROID
        if (Session.Status == SessionStatus.ErrorApkNotAvailable)
        {
            AsyncTask <ApkInstallationStatus> task = Session.RequestApkInstallation(true);
            task.ThenAction(status => { logger.Debug("Status: {0}", status); });
        }
        #endif
        logger.Debug("AR CORE STATUS: {0}", Session.Status);

        if (GameObject.FindWithTag("MainCamera") != null &&
            GameObject.FindWithTag("MainCamera").GetComponent <ARCoreBackgroundRenderer>() != null)
        {
            logger.Debug("TAG APPROACH WORKING");
        }

        /*if (GameObject.Find("First person Camera") == null) {
         *  logger.Error("No first Person Camera Found!");
         *  return;
         * }*/
        CalibrationUtility = GetComponent <CalibrationUtility>();
        arCoreCam          = GameObject.FindWithTag("MainCamera").GetComponent <Camera>();
        ShowDebugUI(false);
    }
Esempio n. 3
0
    public void HandleInputUpdate(string input)
    {
        logger.Debug("Handling input with index  (str) " + index);
        this.index = int.Parse(input);

        if (controller.ExistsResultIndex(this.index))
        {
            DisplayPositiveMsg(index);
        }
        else
        {
            DisplayNegativeMsg(this.index);
        }
    }
Esempio n. 4
0
    public void Present(MultimediaObject mmo, bool loadInRange = true)
    {
        Debug.Log("Presenting " + mmo.id);
        //panelSwitcher.SwitchToDisplay();

        panelManager.ShowPanel("display");

        presenter.LoadImage(CineastUtils.GetImageUrl(mmo));
        logger.Debug("URL: " + CineastUtils.GetImageUrl(mmo));


        alphaController.SetAlpha(0.5f);

        if (controller.GetHeading(mmo) != -1)
        {
            headingDisplay.targetHeading = controller.GetHeading(mmo);
        }

        infoText.text = string.Format("Index: {0}\nDate: {1}", mmo.resultIndex, FormatDate(mmo));
        activeMmo     = mmo;

        if (loadInRange)
        {
            Debug.Log("LOAD IN RANGE");
            List <MultimediaObject> inRangeList = controller.GetInRange(activeMmo);
            temporalSlider.Setup(inRangeList, activeMmo); // ArgumentNull in DatetimeParser, parameter name s
        }

        controller.StopLocationServices();
        // TODO Remove activeMMO and restart location service
    }
Esempio n. 5
0
 private void GatherTimeRange()
 {
     lowerBound = defaultMinValue;
     upperBound = defaultMaxValue;
     if (!string.IsNullOrEmpty(lowerInput.text))
     {
         try {
             lowerBound = int.Parse(lowerInput.text);
             logger.Debug("Lower Bound {0}(str), parsed: {1}", lowerInput.text, lowerBound);
         } catch (ArgumentException e) {
             // Silently ignore, since value is set smartyl
         } catch (FormatException ex) {
             // Silently ignore, since value is set smartly
         }
     }
     if (!string.IsNullOrEmpty(upperInput.text))
     {
         try {
             upperBound = int.Parse(upperInput.text);
             logger.Debug("Upper Bound {0}(str), parsed: {1}", upperInput.text, upperBound);
         } catch (ArgumentException e) {
             // Silently ignoring
         } catch (FormatException ex) {
             // Silently ignoring
         }
     }
     logger.Debug("Gathered time range. From {0} to {1}", lowerBound, upperBound);
 }
Esempio n. 6
0
 public void ShowPopup(bool show)
 {
     popupShown = show;
     if (popupShown)
     {
         popupPanel.SetActive(true);
     }
     else
     {
         popupPanel.SetActive(false);
     }
     logger.Debug("Set popup to {0}", popupShown ? "active" : "inactive");
 }
Esempio n. 7
0
        public static SaveState LoadData(bool deleteAfterRead = false)
        {
            SaveState state = null;

            if (ExistsPersitentData())
            {
                state = ReadJson <SaveState>(GetFilePath());
                logger.Debug("Read savestate from file");
                if (deleteAfterRead)
                {
                    File.Delete(GetFilePath());
                    logger.Debug("Deleted savestate file after reading");
                }
            }
            return(state);
        }
Esempio n. 8
0
 public void EnableDoubleTap(bool enabled)
 {
     logger.Debug("Changing doubletap enabled from {0} to {1}",
                  doubleTapEnabled, enabled);
     doubleTapEnabled = enabled;
 }
Esempio n. 9
0
 // maxDist in km
 public void SetMaxDistance(float maxDist)
 {
     logger.Debug("Max distance pre query filter: " + maxDist * 1000 + "m");
     cineast.AddCineastFilter(new SpatialMaxDistanceFilter(maxDist * 1000, initialGeoLocation.latitude,
                                                           initialGeoLocation.longitude));
 }
Esempio n. 10
0
 public void SetGeoLocation(GeoLocation loc)
 {
     logger.Debug("Setting target location {0}" + loc);
     TargetLocation = loc;
     SetLocationLabel(TargetLocation);
 }
Esempio n. 11
0
 private void Awake()
 {
     logger = LogManager.GetInstance().GetLogger(GetType());
     logger.Debug("Awake");
 }
Esempio n. 12
0
        public void HandleSliding(float value)
        {
            logger.Debug("Handling value: " + value);
            if (!setupFinished)
            {
                logger.Debug("Setup not finished, returning");
                return;
            }

            int index = GetClosestIndex(value);
            int key   = new List <int>(dict.Keys)[index];

            logger.Debug("Found key:" + key);
            if (dict.ContainsKey(key))
            {
                logger.Debug("Current index: {0}, new index: {1}", currentIndex, index);
                if (currentIndex != index)
                {
                    logger.Debug("Going to present new");
                    uiManger.Present(dict[key], false);
                    currentIndex = index;
                    SetSilderValue(currentIndex);
                }
            }
            else
            {
                logger.Debug("Was not in dict");
            }
        }