Beispiel #1
0
    public void OnDeleteMapClicked()
    {
        if (!LibPlacenote.Instance.Initialized())
        {
            Debug.Log("SDK not yet initialized");
            ToastManager.ShowToast("SDK not yet initialized", 2f);
            return;
        }

        mLabelText.text = "Deleting Map ID: " + mSelectedMapId;
        LibPlacenote.Instance.DeleteMap(mSelectedMapId, (deleted, errMsg) =>
        {
            if (deleted)
            {
                mMapSelectedPanel.SetActive(false);
                mLabelText.text = "Deleted ID: " + mSelectedMapId;
                OnListMapClick();
            }
            else
            {
                mLabelText.text = "Failed to delete ID: " + mSelectedMapId;
            }
        });
    }
    void SaveCurrentMap()
    {
        if (shouldSaveMap)
        {
            shouldSaveMap = false;
            if (!LibPlacenote.Instance.Initialized())
            {
                Debug.Log("SDK not yet initialized");
                ToastManager.ShowToast("SDK not yet initialized", 2f);
                return;
            }

            bool         useLocation  = Input.location.status == LocationServiceStatus.Running;
            LocationInfo locationInfo = Input.location.lastData;

            Debug.Log("Saving...");
            debugText.text = "uploading...";
            LibPlacenote.Instance.SaveMap(
                (mapId1) => {
                Debug.Log("mapid");

                LibPlacenote.Instance.StopSession();

                LibPlacenote.MapMetadataSettable metadata = new LibPlacenote.MapMetadataSettable();
                metadata.name = MAP_NAME;
                Debug.Log("Saved Map Name: " + metadata.name);
                Debug.Log("mapid and mapname" + mapid1 + MAP_NAME);

                JObject userdata  = new JObject();
                metadata.userdata = userdata;

                JObject shapeList = GetComponent <ShapeManager>().Shapes2JSON();

                userdata["shapeList"] = shapeList;

                if (useLocation)
                {
                    metadata.location           = new LibPlacenote.MapLocation();
                    metadata.location.latitude  = locationInfo.latitude;
                    metadata.location.longitude = locationInfo.longitude;
                    metadata.location.altitude  = locationInfo.altitude;
                }
                LibPlacenote.Instance.SetMetadata(mapId1, metadata);
                mCurrMapDetails = metadata;
            },
                (completed, faulted, percentage) => {
                if (completed)
                {
                    Debug.Log("Upload Complete:" + mCurrMapDetails.name);
                    debugText.text = "upload complete!!";
                }
                else if (faulted)
                {
                    Debug.Log("Upload of Map Named: " + mCurrMapDetails.name + "faulted");
                }
                else
                {
                    Debug.Log("Uploading Map Named: " + mCurrMapDetails.name + "(" + percentage.ToString("F2") + "/1.0)");
                }
            }
                );
        }
    }
Beispiel #3
0
    public void OnLoadMapClicked()
    {
        if (!LibPlacenote.Instance.Initialized())
        {
            Debug.Log("SDK not yet initialized");
            ToastManager.ShowToast("SDK not yet initialized", 2f);
            return;
        }
        mCurrMapId = LoadMapIDFromFile();
        if (mCurrMapId == null)
        {
            Debug.Log("No map available");
            return;
        }
        mCurrMapInfo = null;


        LibPlacenote.Instance.ListMaps((mapList) => {
            // render the map list!
            foreach (LibPlacenote.MapInfo mapId in mapList)
            {
                if (mapId.userData != null)
                {
                    if (mapId.placeId == mCurrMapId)
                    {
                        Debug.Log("Got map meta data");
                        mCurrMapInfo = mapId;
                        break;
                    }
                }
                else
                {
                }
            }

            if (mCurrMapInfo == null)
            {
                Debug.LogError("MapId not on map List. Click 'New Map'");
                return;
            }


            mLabelText.text = "Loading Map ID: " + mCurrMapId;
            LibPlacenote.Instance.LoadMap(mCurrMapId,
                                          (completed, faulted, percentage) => {
                if (completed)
                {
                    mInitButtonPanel.SetActive(false);
                    mExitButton.SetActive(true);

                    LibPlacenote.Instance.StartSession();
                    mLabelText.text = "Loaded ID: " + mCurrMapId;
                }
                else if (faulted)
                {
                    mLabelText.text = "Failed to load ID: " + mCurrMapId;
                }
            }
                                          );
        });
    }
Beispiel #4
0
        /// <summary>
        /// FileOpenButton_Click
        /// Opens FileOpenPicker to load tracks
        /// </summary>
        private async void FileOpenButton_Click(object sender, RoutedEventArgs e)
        {
            //check if was playing and flag it
            bool wasPlaying;

            if (MP3Player.CurrentState == MediaElementState.Playing)
            {
                MP3Player.Pause();
                wasPlaying = true;
            }
            else
            {
                wasPlaying = false;
            }
            //create file open picker to select new files to open
            Windows.Storage.Pickers.FileOpenPicker fop = new Windows.Storage.Pickers.FileOpenPicker();
            //adding file types
            fop.FileTypeFilter.Add(".mp3");
            fop.FileTypeFilter.Add(".wav");
            fop.FileTypeFilter.Add(".wma");
            fop.FileTypeFilter.Add(".aac");
            fop.FileTypeFilter.Add(".asf");
            //if this.plyalist is empty create new list
            if (_Playlist == null)
            {
                _Playlist = new List <Windows.Storage.StorageFile>();
            }
            //open fop window
            IReadOnlyList <Windows.Storage.StorageFile> files = await fop.PickMultipleFilesAsync();

            //check if list of selected files isn't empty
            if (files.Count > 0)
            {
                //object for music properties that contains artist,title,duration etc
                MusicProperties musicProperties;
                int             i = 0;
                //foreach chosen file add it to _Playlist(files) and _Tracklist(list of titles)
                foreach (var f in files)
                {
                    _Playlist.Add(f);
                    musicProperties = await f.Properties.GetMusicPropertiesAsync();

                    _Tracklist.Add(new Track(_Tracklist.Music.Count, musicProperties.Artist, musicProperties.Title, f.Name, musicProperties.Duration));
                    i++;
                }
                //refresh track listbox
                TrackListBox.ItemsSource = null;
                TrackListBox.ItemsSource = _Tracklist.Music;
                // if wasn't playing set new source for MediaElement and update some UI elements
                if (!wasPlaying)
                {
                    var stream = await _Playlist[0].OpenAsync(Windows.Storage.FileAccessMode.Read);
                    MP3Player.SetSource(stream, _Playlist[0].ContentType);
                    //mark currently played file
                    _CurrentId = 0;
                    int time = _Tracklist.GetDurationIntById(_CurrentId);
                    TitleBox.Text = _Tracklist.TrackToString(0);
                    TileManager.UpdateTile(TitleBox.Text, time);
                    ToastManager.ShowToast(TitleBox.Text);
                }
                //if shuffle was on, shuffle list
                if (_Shuffle)
                {
                    Shuffle();
                }
                //select currently played song on list
                TrackListBox.SelectedIndex = _CurrentId;
                _Empty = false;
                MP3Player.Play();
                //set button icon to pause
                PlayButton.Icon = new SymbolIcon(Symbol.Pause);
            }
            else //if any file was chosen then continue
            {
                if (wasPlaying)
                {
                    MP3Player.Play();
                }
            }
        }
    public void OnSaveMapClick()
    {
        if (!LibPlacenote.Instance.Initialized())
        {
            Debug.Log("SDK not yet initialized");
            ToastManager.ShowToast("SDK not yet initialized", 2f);
            return;
        }

        bool         useLocation  = Input.location.status == LocationServiceStatus.Running;
        LocationInfo locationInfo = Input.location.lastData;

        mLabelText.text = "Saving...";
        LibPlacenote.Instance.SaveMap(
            (mapId) => {
            LibPlacenote.Instance.StopSession();
            mSaveMapId = mapId;
            mInitButtonPanel.SetActive(true);
            mMappingButtonPanel.SetActive(false);
            mPlaneDetectionToggle.SetActive(false);

            //clear all existing planes
            mPNPlaneManager.ClearPlanes();
            mPlaneDetectionToggle.GetComponent <Toggle>().isOn = false;

            LibPlacenote.MapMetadataSettable metadata = new LibPlacenote.MapMetadataSettable();
            metadata.name   = RandomName.Get();
            mLabelText.text = "Saved Map Name: " + metadata.name;

            JObject userdata  = new JObject();
            metadata.userdata = userdata;

            JObject shapeList     = Shapes2JSON();
            userdata["shapeList"] = shapeList;

            if (useLocation)
            {
                metadata.location           = new LibPlacenote.MapLocation();
                metadata.location.latitude  = locationInfo.latitude;
                metadata.location.longitude = locationInfo.longitude;
                metadata.location.altitude  = locationInfo.altitude;
            }
            LibPlacenote.Instance.SetMetadata(mapId, metadata);
            mCurrMapDetails = metadata;
        },
            (completed, faulted, percentage) => {
            if (completed)
            {
                mLabelText.text = "Upload Complete:" + mCurrMapDetails.name;
            }
            else if (faulted)
            {
                mLabelText.text = "Upload of Map Named: " + mCurrMapDetails.name + "faulted";
            }
            else
            {
                mLabelText.text = "Uploading Map Named: " + mCurrMapDetails.name + "(" + percentage.ToString("F2") + "/1.0)";
            }
        }
            );
    }
 public void ToggleFeaturesVisualizer()
 {
     coffee.enabled = !coffee.enabled;
     ToastManager.ShowToast("Coffee features vis;" + coffee.enabled);
 }
 public void ToggleOnionHelper()
 {
     oh.enabled = !oh.enabled;
     ToastManager.ShowToast("Onion helper:" + oh.enabled);
 }
 public void ToggleRaycast()
 {
     od.enabled = !od.enabled;
     ToastManager.ShowToast("Raycats:" + od.enabled);
 }
Beispiel #9
0
 //MapManager에서 사용
 public void Prevent(int num)
 {
     TM.ShowToast("'Stage" + num + "'부터 입장해주세요!");
 }