Пример #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();
        }
Пример #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));
        }
Пример #3
0
        static void ParseLocaleBasedSceneSettings(AtomEntryCollection entries, ref BibaSpecialSceneSettings settings)
        {
            foreach (ListEntry row in entries)
            {
                var idText = row.Elements[0].Value;
                if (string.IsNullOrEmpty(idText))
                {
                    continue;
                }

                var sceneText = row.Elements[1].Value;
                if (string.IsNullOrEmpty(sceneText))
                {
                    continue;
                }

                var centerText = row.Elements[2].Value;
                if (string.IsNullOrEmpty(centerText))
                {
                    continue;
                }

                var centerMatchGroups = Regex.Match(centerText, REGEX_VECTOR2).Groups;
                if (centerMatchGroups.Count == 0)
                {
                    continue;
                }

                var latitude   = Convert.ToDouble(centerMatchGroups[REGEX_LATITUDE].Value);
                var longtitude = Convert.ToDouble(centerMatchGroups[REGEX_LONGTITUDE].Value);

                var radiusText = row.Elements[3].Value;
                if (string.IsNullOrEmpty(radiusText))
                {
                    continue;
                }

                var sceneSetting = new GeoSceneSetting();

                sceneSetting.Id        = idText;
                sceneSetting.SceneName = sceneText;
                sceneSetting.Center    = new Vector2((float)latitude, (float)longtitude);
                sceneSetting.Radius    = Convert.ToInt32(radiusText);

                settings.GeoSceneSettings.Add(sceneSetting);
            }
        }
Пример #4
0
        static void ParseTimedSceneSettings(AtomEntryCollection entries, ref BibaSpecialSceneSettings settings)
        {
            foreach (ListEntry row in entries)
            {
                var idText = row.Elements[0].Value;
                if (string.IsNullOrEmpty(idText))
                {
                    continue;
                }

                var sceneText = row.Elements[1].Value;
                if (string.IsNullOrEmpty(sceneText))
                {
                    continue;
                }

                var durationText = row.Elements[2].Value;
                if (string.IsNullOrEmpty(durationText))
                {
                    continue;
                }

                var dateMatchGroups = Regex.Match(durationText, BibaEditorConstants.REGEX_STARTDATE_ENDDATE).Groups;
                if (dateMatchGroups.Count == 0)
                {
                    continue;
                }

                var startDate = DateTime.ParseExact(dateMatchGroups[BibaEditorConstants.REGEX_GROUP_STARTDATE].Value, BibaEditorConstants.DATETIME_PARSE_EXACT_FORMAT, CultureInfo.InvariantCulture);
                var endDate   = DateTime.ParseExact(dateMatchGroups[BibaEditorConstants.REGEX_GROUP_ENDDATE].Value, BibaEditorConstants.DATETIME_PARSE_EXACT_FORMAT, CultureInfo.InvariantCulture);

                var sceneSetting = new TimedSceneSetting();

                sceneSetting.Id        = idText;
                sceneSetting.SceneName = sceneText;
                sceneSetting.StartDate = startDate;
                sceneSetting.EndDate   = endDate;

                settings.TimedSceneSettings.Add(sceneSetting);
            }
        }