Ejemplo n.º 1
0
        private static void ImportEventSettings()
        {
            //Reset Settings
            _achievementSettings  = new BibaAchievementSettings();
            _specialSceneSettings = new BibaSpecialSceneSettings();
            _pointEventSettings   = new BibaPointEventSettings();

            //Import Data
            ImportEventType();
            ImportParameterType();

            ImportEventSheet(COMMON_WORKSHEET_NAME);
            ImportEventSheet(BibaContentConstants.CI_GAME_ID, true);

            //Save Settings
            HelperMethods.WriteConstStringFile(BIBAGAME_NAMESPACE, typeof(BibaPointEvents).Name, _pointEventSettings.BibaPointSettings.Select(setting => setting.Id).ToList(), POINTEVENTS_CONSTANTS_FILEPATH);

            var jsonDataService = new JSONDataService();

            jsonDataService.WriteToDisk <BibaAchievementSettings>(_achievementSettings, BibaEditorConstants.GetContentOutputPath(BibaContentConstants.ACHIEVEMENT_SETTINGS_FILE));
            jsonDataService.WriteToDisk <BibaSpecialSceneSettings>(_specialSceneSettings, BibaEditorConstants.GetContentOutputPath(BibaContentConstants.SPECIAL_SCENE_SETTINGS_FILE));
            jsonDataService.WriteToDisk <BibaPointEventSettings>(_pointEventSettings, BibaEditorConstants.GetContentOutputPath(BibaContentConstants.POINTEVENT_SETTINGS_FILE));

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Ejemplo n.º 2
0
        static void ImportSpecialSceneSettings()
        {
            var settings = new BibaSpecialSceneSettings();

            var timedEntries = GoogleSpreadsheetImporter.GetListEntries(TIMEDSCENE_SPREADSHEET_NAME, WORKSHEET_NAME);

            if (timedEntries == null)
            {
                return;
            }

            ParseTimedSceneSettings(timedEntries, ref settings);

            var localeBasedEntries = GoogleSpreadsheetImporter.GetListEntries(LOCALESCENE_SPREADSHEET_NAME, WORKSHEET_NAME);

            if (localeBasedEntries == null)
            {
                return;
            }

            ParseLocaleBasedSceneSettings(localeBasedEntries, ref settings);

            var jsonDataService = new JSONDataService();

            jsonDataService.WriteToDisk <BibaSpecialSceneSettings>(settings, BibaEditorConstants.GetContentOutputPath(BibaContentConstants.SPECIAL_SCENE_SETTINGS_FILE));
        }
Ejemplo n.º 3
0
        static void ImportLocalizationSettings()
        {
            _settings = new BibaLocalizationSettings();

            ParseSettingsForSheet(LOCALIZATION_SETTINGS_COMMON_WORKSHEET_NAME);
            ParseSettingsForSheet(LOCALIZATION_SETTINGS_WORKSHEET_NAME);

            var jsonDataService = new JSONDataService();

            jsonDataService.WriteToDisk <BibaLocalizationSettings>(_settings, BibaEditorConstants.GetContentOutputPath(BibaContentConstants.LOCALIZATION_SETTINGS_FILE));
        }
Ejemplo n.º 4
0
        static void StoreBuildNumber()
        {
            var jsonService     = new JSONDataService();
            var versionFilePath = BibaEditorConstants.GetResourceFilePath(BibaContentConstants.BIBAVERSION_FILE);
            var version         = jsonService.ReadFromDisk <BibaVersion> (versionFilePath);

            version.BuildNumber = JenkinsBuildNumber.ToString();

            jsonService.WriteToDisk <BibaVersion> (version, versionFilePath);

            AssetDatabase.Refresh();
        }
Ejemplo n.º 5
0
    void Start()
    {
        if (BibaContentConstants.ENVIRONMENT == Environment.Development)
        {
            var jsonService = new JSONDataService();
            var version     = jsonService.ReadFromDisk <BibaVersion> (BibaContentConstants.GetResourceFilePath(BibaContentConstants.BIBAVERSION_FILE));

            GetComponent <Text> ().text = version.Version + "." +
                                          version.BuildNumber + " " +
                                          BibaContentConstants.ENVIRONMENT.ToString().Substring(0, 3);
        }
    }
Ejemplo n.º 6
0
        public static void CreateAchievementSettings()
        {
            _achievementSettings = new BibaAchievementSettings();

            ImportBasicAchievementSettings();
            ImportSeasonalAchievementSettings();

            var jsonDataService = new JSONDataService();

            jsonDataService.WriteToDisk <BibaAchievementSettings>(_achievementSettings, BibaEditorConstants.GetContentOutputPath(BibaContentConstants.ACHIEVEMENT_SETTINGS_FILE));

            AssetDatabase.Refresh();
        }
        /// <summary>
        /// Retrieve user search query from text box and GET possible artists from API
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void getArtists(object sender, RoutedEventArgs e)
        {
            // Get the search query
            var searchQuery = searchBox.Text;

            // Statically set type => could let user specify in future versions
            ItemType type = ItemType.artist;

            // Statically set limit => could let user specify in future versions
            int limit = 10;

            // Define our data service
            JSONDataService jsonDataService = new JSONDataService();

            // Create a new Artist BLL and pass our DataService
            ArtistsBLL artistBLL = new ArtistsBLL(jsonDataService);

            // Get a list of artists from the search query input
            List <Artist> artists = artistBLL.GetArtists(searchQuery, type, limit);

            // Add artist(s) ID to public list for use in reccommendation search
            if (artists == null)
            {
                MessageBox.Show("Not found!");
                return;
            }
            foreach (Artist artist in artists)
            {
                if (artist != null)
                {
                    artistSeeds.Add(artist.id);
                }
            }

            //Append the results to the search bar
            seedStackPanel.Children.Insert(0,
                                           new Label
            {
                Content    = artists[0].name,
                Foreground = Brushes.White
            }
                                           );
        }
Ejemplo n.º 8
0
        /// <summary>
        /// "Login" button => Refresh token using client id and secred
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_Click(object sender, RoutedEventArgs e)
        {
            // Define our data service
            JSONDataService jsonDataService = new JSONDataService();

            // Get the access token
            string accessToken = jsonDataService.getAccessToken();

            // Store token in app config
            ConfigurationManager.AppSettings.Set("ACCESS_TOKEN", accessToken);
            // 64 encoded auth
            //YWE0ZjZiZDIyYjc3NGFiMzk2ODI1NzQ5NzNjYjIyNWY6MzhiODYwMDhmOGJkNDhkNDkzYjMzZDI1NTA0NmQzNzk=

            // close window and show main
            MainWindow mainWindow = new MainWindow();

            mainWindow.Show();
            this.Close();
        }
        /// <summary>
        /// Take all user form inputs and fetch recommendations from API
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void getReccommendationsButton_Click(object sender, RoutedEventArgs e)
        {
            // Return if artistSeeds is empty
            if (artistSeeds == null || artistSeeds.Count() == 0)
            {
                MessageBox.Show("Please enter some artists!");
                return;
            }

            // Get artist seeds from the stack panel
            foreach (var artistId in artistSeeds)
            {
                Console.WriteLine(artistId);
            }

            // Get remaining form values
            string danceability = danceabilitySlider.Value.ToString();
            string energy       = energySlider.Value.ToString();
            string popularity   = popularitySlider.Value.ToString();
            string resultLimit  = resultLimitSlider.Value.ToString();

            JSONDataService dataService = new JSONDataService();


            List <TrackRecommendation> trackRecommendations = new List <TrackRecommendation>();


            // Call results windows containing reccommendations
            JObject recommendationsObject = dataService.getRecommendations(artistSeeds, danceability, energy, popularity, resultLimit);

            if (recommendationsObject == null)
            {
                MessageBox.Show("Something went wrong! Please clear your selection and try again.");
            }
            foreach (var recommendationObject in recommendationsObject["tracks"])
            {
                TrackRecommendation trackRecommendation = new TrackRecommendation();

                // Get track name and link
                string trackName = recommendationObject["name"].ToString();
                string trackLink = recommendationObject["external_urls"]["spotify"].ToString();
                trackRecommendation.track = new string[, ]
                {
                    { trackName, trackLink } // Add the track name and link to the list of recommendations
                };

                // Get album name and link
                string albumName = recommendationObject["album"]["name"].ToString();
                string albumLink = recommendationObject["album"]["external_urls"]["spotify"].ToString();
                trackRecommendation.album = new string[, ]
                {
                    { albumName, albumLink } // Add the album name and link to the list of recommendations
                };

                // Get the album images
                trackRecommendation.images = new List <string>();
                foreach (var image in recommendationObject["album"]["images"])
                {
                    string imageUrl = image["url"].ToString();
                    trackRecommendation.images.Add(imageUrl); // Add the image urls to the list of recommendations
                }

                // Get the artists featured on the track
                foreach (var artist in recommendationObject["artists"])
                {
                    string artistName = "";
                    string artistLink = "";

                    artistName = artist["name"].ToString();
                    artistLink = artist["external_urls"]["spotify"].ToString();

                    string[,] artistNameAndLink = new string[, ] {
                        { artistName, artistLink }
                    };

                    trackRecommendation.artists = new List <string[, ]>();
                    trackRecommendation.artists.Add(artistNameAndLink);

                    // Add artist list to list of track recommendations
                    //trackRecommendations.Add(trackRecommendation);
                }

                // Add track recommendation to the list of track recommendations
                trackRecommendations.Add(trackRecommendation);
            }

            // Display the results window
            Window solutionWindow = new SolutionWindow(trackRecommendations);

            solutionWindow.Show();

            //string artistName = (string)recommendationsObject["artists"][0]["name"];
            //string artistId = (string)recommendationsObject["artists"]["items"][0]["id"];

            Console.WriteLine();
        }
        static void ReloadSettings()
        {
            var dataService = new JSONDataService();

            settings = dataService.ReadFromDisk <BibaLocalizationSettings>(BibaEditorConstants.GetResourceFilePath(BibaContentConstants.LOCALIZATION_SETTINGS_FILE));
        }