private TimeSpan generateNewEndTime(TimingAnalytics analytics, RunManuals manuals)
        {
            var timeWithoutEnd = analytics.Events.Where(x => x.IsSubSplit == false).Where(x => x.Section != Sections.TheEnd).Sum(x => x.Time.TotalMilliseconds);
            var timeInEnd      = manuals.RuntimeInMs.Value - timeWithoutEnd;

            return(TimeSpan.FromMilliseconds(timeInEnd));
        }
예제 #2
0
        /// <summary>
        /// Logs the game result.
        /// </summary>
        /// <param name="result">Result.</param>
        /// <param name="rating">Rating.</param>
        /// <param name="multiplayer">If set to <c>true</c> multiplayer.</param>
        private static void LogGameResult(string result, int rating, bool multiplayer)
        {
            // MenuController.ConfigToLoad won't get set while testing specific games in editor
            if (MenuController.ConfigToLoad == null)
            {
                return;
            }

            PillarConfig    config = MenuController.ConfigToLoad;
            ActionAnalytics action = new ActionAnalytics(result,
                                                         GameModeFromConfig(config) + result,
                                                         config.PillarNumber,
                                                         rating.ToString(),
                                                         multiplayer ? "multiplayer" : "single_player",
                                                         MenuController.DifficultyToLoad.ToString(),
                                                         config.ContextForAnalytics());

            string stepName = result;

            if (config.Game == Game.Assault || config.Game == Game.Duel)
            {
                // difficulty is only used for Duel and Assault. Not for Holochess and Tower Defense.
                stepName += "_" + MenuController.DifficultyToLoad.ToString();
            }
            TimingAnalytics timingAction = new TimingAnalytics((int)(UnityEngine.Time.time - timeGameStarted),
                                                               GameModeFromConfig(config).TrimEnd('.'),
                                                               config.ContextForAnalytics(),
                                                               config.PillarNumber,
                                                               stepName);

            Analytics.LogAction(action);
            Analytics.LogTimingAction(timingAction);
            LogToConsole("LogGameResult: " + result + " " + rating.ToString());
        }
        private TimingAnalytics applyManualInput(TimingAnalytics analytics, RunManuals manuals)
        {
            if (!manuals.RuntimeInMs.HasValue)
            {
                return(analytics);
            }

            if (!analytics.FinishedOn.HasValue)
            {
                return(analytics);
            }

            if (!analytics.Events.Any(x => x.Section == Sections.TheEnd))
            {
                return(analytics);
            }

            var newTimeInEnd = generateNewEndTime(analytics, manuals);

            if (newTimeInEnd.TotalSeconds <= 30)
            {
                return(analytics);
            }

            analytics.RunTime = TimeSpan.FromMilliseconds(manuals.RuntimeInMs.Value);
            analytics.Events.First(x => x.Section == Sections.TheEnd).Time = newTimeInEnd;
            analytics.Events.First(x => x.Section == Sections.TheEnd).End  = analytics.Events.First(x => x.Section == Sections.TheEnd).Start + newTimeInEnd;
            analytics.ManualOverride = true;

            return(analytics);
        }
        private void writeSection(TimingAnalytics timings, RunImport run, Sections section, MetaFeatures feature)
        {
            var timing = timings.Events.FirstOrDefault(x => x.Section == section);

            if (timing != null)
            {
                var meta = new RunMeta <int>(run.Worldname, timing.Start, feature, (int)timing.Time.TotalMilliseconds);
                _writer.Upsert(meta);
            }
        }
        private void extractRuntime(TimingAnalytics analytics)
        {
            var runtime = analytics.RunTime;
            var meta    = new RunMeta <int>(
                analytics.Worldname,
                analytics.StartedOn,
                MetaFeatures.Runtime,
                (int)runtime.TotalMilliseconds);

            _runtimeWriter.Upsert(meta);
        }
        public TimingAnalytics Adjust(TimingAnalytics timings)
        {
            var manuals = _manualsReader.Get(timings.Worldname);

            if (manuals == null)
            {
                return(timings);
            }

            timings = applyManualInput(timings, manuals);
            return(timings);
        }
예제 #7
0
 public void LogTimingAction(TimingAnalytics analytics)
 {
     SwrveManager.Log("Logging TimingAction: " + analytics.ToString());
     this.GenericSendLogAction(analytics);
 }
예제 #8
0
 public void LogTimingAction(TimingAnalytics analytics)
 {
 }
예제 #9
0
 public static void LogTimingAction(TimingAnalytics analytics)
 {
     instance.LogTimingAction(analytics);
 }
예제 #10
0
 public void LogTimingAction(TimingAnalytics analytics)
 {
     Log("Logging TimingAction: " + analytics.ToString());
     GenericSendLogAction(analytics);
 }