Unity-jump-proj

This commit is contained in:
2024-09-09 11:07:16 +03:00
parent 2c29906bbf
commit fd96a5627d
13707 changed files with 866380 additions and 0 deletions

View File

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace UnityEditor.TestTools.CodeCoverage
{
[Serializable]
internal class CoverageEventDataImplementation
{
[SerializeField]
private SessionMode m_CoverageSessionMode;
[SerializeField]
private List<string> m_CoverageSessionResultPaths;
public void StartSession(SessionMode coverageSessionMode)
{
m_CoverageSessionMode = coverageSessionMode;
m_CoverageSessionResultPaths = new List<string>();
}
public void AddSessionResultPath(string path)
{
if (m_CoverageSessionResultPaths != null)
{
m_CoverageSessionResultPaths.Add(path);
}
}
public SessionMode CoverageSessionMode
{
get { return m_CoverageSessionMode; }
}
public List<string> CoverageSessionResultPaths
{
get { return m_CoverageSessionResultPaths; }
}
}
[Serializable]
internal class CoverageEventData : ScriptableSingleton<CoverageEventData>
{
[SerializeField]
private CoverageEventDataImplementation m_CoverageEventDataImplementation = null;
protected CoverageEventData() : base()
{
m_CoverageEventDataImplementation = new CoverageEventDataImplementation();
}
public void StartSession(SessionMode coverageSessionMode)
{
m_CoverageEventDataImplementation.StartSession(coverageSessionMode);
}
public void AddSessionResultPath(string path)
{
m_CoverageEventDataImplementation.AddSessionResultPath(path);
}
public SessionEventInfo GetCoverageSessionInfo()
{
SessionEventInfo info = new SessionEventInfo(m_CoverageEventDataImplementation.CoverageSessionMode, m_CoverageEventDataImplementation.CoverageSessionResultPaths);
return info;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cc233d649a6d0ea479f4e4fd4af4e4a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,110 @@
using System;
using UnityEditor.TestTools.CodeCoverage.Analytics;
namespace UnityEditor.TestTools.CodeCoverage
{
/// <summary>
/// Events invoked during a code coverage session. A code coverage session is the period between starting and finishing capturing code coverage data.
/// </summary>
/// <example>
/// In the following example we create event handler methods which subscribe to the <see cref="Events.onCoverageSessionStarted"/>, <see cref="Events.onCoverageSessionFinished"/>, <see cref="Events.onCoverageSessionPaused"/> and <see cref="Events.onCoverageSessionUnpaused"/> events.
/// We use the <see href="https://docs.unity3d.com/ScriptReference/InitializeOnLoadAttribute.html">InitializeOnLoad</see> attribute to make sure that they will resubscribe on Domain Reload, when we enter Play Mode for example.
/// <code>
/// using UnityEngine;
/// using UnityEditor;
/// using UnityEditor.TestTools.CodeCoverage;
///
/// [InitializeOnLoad]
/// public class CoverageSessionListener
/// {
/// static CoverageSessionListener()
/// {
/// Events.onCoverageSessionStarted += OnSessionStarted;
/// Events.onCoverageSessionFinished += OnSessionFinished;
/// Events.onCoverageSessionPaused += OnSessionPaused;
/// Events.onCoverageSessionUnpaused += OnSessionUnpaused;
/// }
///
/// static void OnSessionStarted(SessionEventInfo args)
/// {
/// Debug.Log($"{args.SessionMode} Code Coverage Session Started");
/// }
/// static void OnSessionFinished(SessionEventInfo args)
/// {
/// Debug.Log($"{args.SessionMode} Code Coverage Session Finished");
///
/// string paths = string.Empty;
/// foreach (string path in args.SessionResultPaths)
/// paths = string.Concat(paths, "\n", path);
///
/// Debug.Log($"Code Coverage Results were saved in: {paths}");
/// }
///
/// static void OnSessionPaused(SessionEventInfo args)
/// {
/// Debug.Log($"{args.SessionMode} Code Coverage Session Paused");
/// }
///
/// static void OnSessionUnpaused(SessionEventInfo args)
/// {
/// Debug.Log($"{args.SessionMode} Code Coverage Session Unpaused");
/// }
/// }
/// </code>
/// </example>
public static class Events
{
/// <summary>
/// This event is invoked when a code coverage session is started.
/// </summary>
public static event Action<SessionEventInfo> onCoverageSessionStarted;
/// <summary>
/// This event is invoked when a code coverage session is finished.
/// </summary>
public static event Action<SessionEventInfo> onCoverageSessionFinished;
/// <summary>
/// This event is invoked when a code coverage session is paused.
/// </summary>
public static event Action<SessionEventInfo> onCoverageSessionPaused;
/// <summary>
/// This event is invoked when a code coverage session is unpaused.
/// </summary>
public static event Action<SessionEventInfo> onCoverageSessionUnpaused;
internal static void InvokeOnCoverageSessionStarted()
{
if (onCoverageSessionStarted != null)
{
CoverageAnalytics.instance.CurrentCoverageEvent.useEvent_onCoverageSessionStarted = true;
onCoverageSessionStarted.Invoke(CoverageEventData.instance.GetCoverageSessionInfo());
}
}
internal static void InvokeOnCoverageSessionFinished()
{
if (onCoverageSessionFinished != null)
{
CoverageAnalytics.instance.CurrentCoverageEvent.useEvent_onCoverageSessionFinished = true;
onCoverageSessionFinished.Invoke(CoverageEventData.instance.GetCoverageSessionInfo());
}
}
internal static void InvokeOnCoverageSessionPaused()
{
if (onCoverageSessionPaused != null)
{
CoverageAnalytics.instance.CurrentCoverageEvent.useEvent_onCoverageSessionPaused = true;
onCoverageSessionPaused.Invoke(CoverageEventData.instance.GetCoverageSessionInfo());
}
}
internal static void InvokeOnCoverageSessionUnpaused()
{
if (onCoverageSessionUnpaused != null)
{
CoverageAnalytics.instance.CurrentCoverageEvent.useEvent_onCoverageSessionUnpaused = true;
onCoverageSessionUnpaused.Invoke(CoverageEventData.instance.GetCoverageSessionInfo());
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8d51cefca684e6d49b7dc6e963541e41
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
using System.Collections.Generic;
namespace UnityEditor.TestTools.CodeCoverage
{
/// <summary>
/// The code coverage session information retuned by the coverage session <see cref="Events"/>.
/// </summary>
public class SessionEventInfo
{
/// <summary>
/// The code coverage session mode.
/// </summary>
public SessionMode SessionMode { get; internal set; }
/// <summary>
/// The coverage results paths of the files or folders created during the code coverage session.
/// </summary>
public List<string> SessionResultPaths { get; internal set; }
internal SessionEventInfo(SessionMode mode, List<string> resultPaths)
{
SessionMode = mode;
SessionResultPaths = resultPaths;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 73017ca5f5e11bd49adb6c1d1d3c5bb6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
namespace UnityEditor.TestTools.CodeCoverage
{
/// <summary>
/// The code coverage session mode.
/// </summary>
public enum SessionMode
{
/// <summary>
/// Describes a code coverage session triggered by automated testing, using the Test Runner.
/// </summary>
TestRunner = 0,
/// <summary>
/// Describes a code coverage session triggered by Coverage Recording.
/// </summary>
Recording = 1
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e527bb4ce87bf945b91e3d46cc73202
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: