Exemplo n.º 1
0
        /// <summary>
        /// Adds the or update recordable date.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="recordableDate">The recordable date.</param>
        /// <param name="loggedInUserId">The logged in user identifier.</param>
        private void AddOrUpdateRecordable(Target target, DateTime recordableDate, int loggedInUserId)
        {
            var scorecardRecordable = recordableRepository.GetAll()
                                      .Where(x => x.ScorecardId == target.ScorecardId &&
                                             x.RecordableDate == recordableDate && !x.IsManual).FirstOrDefault();

            if (scorecardRecordable == null)
            {
                scorecardRecordable = new Recordable
                {
                    ScorecardId    = target.ScorecardId,
                    RecordableDate = recordableDate,
                    IsManual       = false,
                    IsActive       = true,
                    CreatedBy      = loggedInUserId,
                    LastModifiedBy = loggedInUserId,
                    CreatedOn      = TimeZoneUtility.GetCurrentTimestamp(),
                    LastModifiedOn = TimeZoneUtility.GetCurrentTimestamp()
                };
            }
            else
            {
                // update recordable date
                scorecardRecordable.IsManual       = false;
                scorecardRecordable.IsActive       = true;
                scorecardRecordable.RecordableDate = recordableDate;
                scorecardRecordable.LastModifiedBy = loggedInUserId;
                scorecardRecordable.LastModifiedOn = TimeZoneUtility.GetCurrentTimestamp();
            }

            recordableRepository.AddOrUpdate(scorecardRecordable);
        }
Exemplo n.º 2
0
    private static void RecordData(Type t, UnityEngine.Object o)
    {
        List <Type> list;

        if (m_TypeToRecordable.TryGetValue(t, out list))
        {
            foreach (var type in list)
            {
                var recordable = (Recordable)Activator.CreateInstance(type);

                Recordable previous = null;
                if (!m_sync)
                {
                    m_sessionRecords.TryGetValue(o.GetInstanceID(), out previous);
                }

                if (recordable.OnRecord(previous, o))
                {
                    var component  = o as Component;
                    var gameObject = component == null ? null : component.gameObject;
                    m_frameRecords[m_frame].records.Add(new RecordableInfo(o.GetInstanceID(), GameDebuggerSerializer.GetID(o), recordable));
                    m_sessionRecords[o.GetInstanceID()] = recordable;
                }
            }
        }
    }
        static void DrawRecorderInfo(VisualElement panel, Recordable recorder)
        {
            var transformRecordable = recorder as TransformRecordable;

            if (transformRecordable != null)
            {
                panel.Add(new Label(TransformToString(transformRecordable)));
            }
        }
        static InputsForTime GetInputsForFrame(Recordable recordable, int frame)
        {
            var inputRec = recordable as InputRecordable;

            if (inputRec == null)
            {
                return(new InputsForTime());
            }
            return(new InputsForTime(GameDebuggerDatabase.GetRecords(frame).time, inputRec.inputs));
        }
        public static RecordableInfo FromJson(string json)
        {
            int    index        = json.IndexOf("&");
            int    localFileID  = Int32.Parse(json.Substring(0, index));
            int    indexForType = json.IndexOf("&", index + 1, StringComparison.Ordinal);
            string type         = json.Substring(index + 1, indexForType - index - 1);

            Recordable rec = (Recordable)JsonUtility.FromJson(json.Substring(indexForType + 1), Type.GetType(type));

            return(new RecordableInfo(localFileID, rec));
        }
        static string GetStateNameForRecordable(Recordable rec)
        {
            var animRec = rec as AnimatorRecordable;

            if (animRec == null)
            {
                return(string.Empty);
            }
            var name = animRec.layerNames.FirstOrDefault();

            return(name == null? string.Empty : name);
        }
Exemplo n.º 7
0
        static void DrawRecorderInfo(VisualElement panel, Recordable recorder)
        {
            var rr = recorder as RigidBodyRecordable;

            if (rr != null)
            {
                var text = string.Format(
                    "Speed:\n    {3:F2} m/s\n\nVelocity:\n    x: {0:F2}\n    y: {1:F2}\n    z: {2:F2}",
                    rr.speed.magnitude,
                    rr.speed.x, rr.speed.y, rr.speed.z);
                panel.Add(new Label(text));
            }
        }
Exemplo n.º 8
0
        static ScreenshotForTime GetScreenshotForFrame(Recordable recordable, int frame)
        {
            var screenshotRec = recordable as ScreenShotRecordable;

            if (screenshotRec == null)
            {
                return(new ScreenshotForTime());
            }

            var screenShot = screenshotRec.tex;

            return(new ScreenshotForTime {
                time = GameDebuggerDatabase.GetRecords(frame).time, screenshot = screenShot
            });
        }
Exemplo n.º 9
0
        public double?GetNumberOfDaysWithOutRecordables(Scorecard scorecard)
        {
            bool isNumberOfDaysWithOutRecordablesEnabled = Convert.ToBoolean(
                ConfigurationManager.AppSettings[AppSettingsKeys.
                                                 EnableNumberOfDaysWithoutRecordables]);

            if (isNumberOfDaysWithOutRecordablesEnabled && scorecard.Recordables != null && scorecard.Recordables.Any(x => x.IsActive))
            {
                Recordable recordable = scorecard.Recordables.Where(x => x.IsActive)
                                        .OrderByDescending(x => x.RecordableDate).First();

                DateTime currentDate = TimeZoneUtility.GetCurrentTimestamp().Date;
                double   numberofDaysWithoutRecordables = (currentDate - recordable.RecordableDate).TotalDays;
                return(numberofDaysWithoutRecordables);
            }

            return(null);
        }
 public RecordableInfo(int localIdentifierInFile, Recordable recordable)
 {
     GameDebuggerSerializer.localFileIDToInstanceID.TryGetValue(localIdentifierInFile, out this.instanceID);
     this.recordable            = recordable;
     this.localIdentifierInFile = localIdentifierInFile;
 }
 public RecordableInfo(int instanceID, int localIdentifierInFile, Recordable recordable)
 {
     this.instanceID            = instanceID;
     this.recordable            = recordable;
     this.localIdentifierInFile = localIdentifierInFile;
 }
Exemplo n.º 12
0
 internal void AddRecordable(Recordable recordable)
 {
     recordables.Add(recordable.Id, recordable);
 }