Initial Commit
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
internal class OVRConfigurationTaskFixer : OVRConfigurationTaskProcessor
|
||||
{
|
||||
public override int AllocatedTimeInMs => 10;
|
||||
public override ProcessorType Type => ProcessorType.Fixer;
|
||||
|
||||
protected override Func<IEnumerable<OVRConfigurationTask>, List<OVRConfigurationTask>> OpenTasksFilter =>
|
||||
(Func<IEnumerable<OVRConfigurationTask>, List<OVRConfigurationTask>>)(tasksToFilter => tasksToFilter
|
||||
.Where(task => task.FixAction != null
|
||||
&& !task.IsDone(BuildTargetGroup)
|
||||
&& !task.IsIgnored(BuildTargetGroup))
|
||||
.ToList());
|
||||
|
||||
private const int LoopExitCount = 4;
|
||||
|
||||
private bool _hasFixedSome = false;
|
||||
private int _counter = LoopExitCount;
|
||||
|
||||
public OVRConfigurationTaskFixer(
|
||||
OVRConfigurationTaskRegistry registry,
|
||||
BuildTargetGroup buildTargetGroup,
|
||||
Func<IEnumerable<OVRConfigurationTask>, List<OVRConfigurationTask>> filter,
|
||||
OVRProjectSetup.LogMessages logMessages,
|
||||
bool blocking,
|
||||
Action<OVRConfigurationTaskProcessor> onCompleted)
|
||||
: base(registry, buildTargetGroup, filter, logMessages, blocking, onCompleted)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void ProcessTask(OVRConfigurationTask task)
|
||||
{
|
||||
_hasFixedSome |= task.Fix(BuildTargetGroup);
|
||||
}
|
||||
|
||||
protected override void PrepareTasks()
|
||||
{
|
||||
_hasFixedSome = false;
|
||||
base.PrepareTasks();
|
||||
}
|
||||
|
||||
protected override void Validate()
|
||||
{
|
||||
_counter--;
|
||||
|
||||
if (_counter <= 0)
|
||||
{
|
||||
Debug.LogWarning("[Oculus Settings] Fixing Tasks has exited after too many iterations. " +
|
||||
"(There might be some contradictory rules leading to a loop)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_hasFixedSome)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Preparing a new Run
|
||||
PrepareTasks();
|
||||
if (Blocking)
|
||||
{
|
||||
Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e1fe0a245064a44b8b080a115da8c1d
|
||||
timeCreated: 1663596864
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
internal abstract class OVRConfigurationTaskProcessor
|
||||
{
|
||||
public enum ProcessorType
|
||||
{
|
||||
Updater,
|
||||
Fixer
|
||||
}
|
||||
|
||||
public virtual int AllocatedTimeInMs => 10;
|
||||
protected abstract void ProcessTask(OVRConfigurationTask task);
|
||||
public abstract ProcessorType Type { get; }
|
||||
|
||||
private BuildTargetGroup _buildTargetGroup;
|
||||
private OVRProjectSetup.LogMessages _logMessages;
|
||||
private readonly OVRConfigurationTaskRegistry _registry;
|
||||
private Func<IEnumerable<OVRConfigurationTask>, List<OVRConfigurationTask>> _filter;
|
||||
protected abstract Func<IEnumerable<OVRConfigurationTask>, List<OVRConfigurationTask>> OpenTasksFilter { get; }
|
||||
private List<OVRConfigurationTask> _tasks;
|
||||
private IEnumerator<OVRConfigurationTask> _enumerator;
|
||||
private int _startTime;
|
||||
|
||||
public bool Blocking { get; set; }
|
||||
public event Action<OVRConfigurationTaskProcessor> OnComplete;
|
||||
|
||||
public BuildTargetGroup BuildTargetGroup => _buildTargetGroup;
|
||||
public OVRProjectSetup.LogMessages LogMessages => _logMessages;
|
||||
|
||||
// Status
|
||||
public bool Started => _startTime != -1;
|
||||
public bool Processing => _enumerator != null;
|
||||
public bool Completed => Started && (_enumerator == null || _enumerator.Current == null);
|
||||
public List<OVRConfigurationTask> Tasks => _tasks;
|
||||
|
||||
protected OVRConfigurationTaskProcessor(OVRConfigurationTaskRegistry registry, BuildTargetGroup buildTargetGroup,
|
||||
Func<IEnumerable<OVRConfigurationTask>, List<OVRConfigurationTask>> filter,
|
||||
OVRProjectSetup.LogMessages logMessages,
|
||||
bool blocking,
|
||||
Action<OVRConfigurationTaskProcessor> onCompleted)
|
||||
{
|
||||
_registry = registry;
|
||||
_enumerator = null;
|
||||
_buildTargetGroup = buildTargetGroup;
|
||||
_logMessages = logMessages;
|
||||
Blocking = blocking;
|
||||
_filter = filter;
|
||||
_startTime = -1;
|
||||
|
||||
OnComplete += onCompleted;
|
||||
}
|
||||
|
||||
protected virtual void PrepareTasks()
|
||||
{
|
||||
// Get all the tasks from the Setup Tool
|
||||
var tasks = _registry.GetTasks(_buildTargetGroup, true);
|
||||
|
||||
// Apply the caller-provided filter
|
||||
_tasks = _filter != null ? _filter(tasks) : tasks.ToList();
|
||||
// When not forced, apply the OpenTaskFilter as well
|
||||
_tasks = (OpenTasksFilter != null) ? OpenTasksFilter(_tasks) : _tasks;
|
||||
|
||||
// Prepare the Enumerator
|
||||
_enumerator = _tasks.GetEnumerator();
|
||||
_enumerator.MoveNext();
|
||||
}
|
||||
|
||||
public virtual void OnRequested()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
PrepareTasks();
|
||||
_startTime = Environment.TickCount;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
var updateTime = Environment.TickCount;
|
||||
var currentTime = updateTime;
|
||||
while ((Blocking || (currentTime - updateTime < AllocatedTimeInMs)) && _enumerator?.Current != null)
|
||||
{
|
||||
ProcessTask(_enumerator.Current);
|
||||
currentTime = Environment.TickCount;
|
||||
_enumerator.MoveNext();
|
||||
}
|
||||
|
||||
if (Completed)
|
||||
{
|
||||
Validate();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Validate()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Complete()
|
||||
{
|
||||
_enumerator = null;
|
||||
OnComplete?.Invoke(this);
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da7a8c3cbcb14aba8b02a89bc05e136f
|
||||
timeCreated: 1663596850
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
internal class OVRConfigurationTaskProcessorQueue
|
||||
{
|
||||
public event Action<OVRConfigurationTaskProcessor> OnProcessorCompleted;
|
||||
|
||||
private readonly Queue<OVRConfigurationTaskProcessor> _queue = new Queue<OVRConfigurationTaskProcessor>();
|
||||
|
||||
public bool Busy => _queue.Count > 0;
|
||||
public bool Blocked => Busy && _queue.Peek().Blocking;
|
||||
|
||||
public bool BlockedBy(OVRConfigurationTaskProcessor.ProcessorType processorType)
|
||||
{
|
||||
foreach (var processor in _queue)
|
||||
{
|
||||
if (processor.Type == processorType && processor.Blocking)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool BusyWith(OVRConfigurationTaskProcessor.ProcessorType processorType)
|
||||
{
|
||||
foreach (var processor in _queue)
|
||||
{
|
||||
if (processor.Type == processorType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Request(OVRConfigurationTaskProcessor processor)
|
||||
{
|
||||
if (!OVRProjectSetup.Enabled.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Enqueue(processor);
|
||||
}
|
||||
|
||||
private void Enqueue(OVRConfigurationTaskProcessor processor)
|
||||
{
|
||||
if (!Busy)
|
||||
{
|
||||
// If was empty, then register to editor update
|
||||
EditorApplication.update += Update;
|
||||
}
|
||||
|
||||
// Enqueue
|
||||
_queue.Enqueue(processor);
|
||||
|
||||
processor.OnRequested();
|
||||
|
||||
if (processor.Blocking)
|
||||
{
|
||||
// In the case where the newly added processor is blocking
|
||||
// we'll make all the previously queued processor blocking as well
|
||||
foreach (var otherProcessor in _queue)
|
||||
{
|
||||
otherProcessor.Blocking = true;
|
||||
}
|
||||
|
||||
// Force an update, this will be The blocking update
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
private void Dequeue(OVRConfigurationTaskProcessor processor)
|
||||
{
|
||||
// We should only dequeue the current processor
|
||||
if (processor != _queue.Peek())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Dequeue
|
||||
_queue.Dequeue();
|
||||
|
||||
if (!Busy)
|
||||
{
|
||||
// Now that it is empty, unregister to editor update
|
||||
EditorApplication.update -= Update;
|
||||
}
|
||||
|
||||
// Trigger specific callbacks
|
||||
processor.Complete();
|
||||
|
||||
// Trigger global callbacks
|
||||
OnProcessorCompleted?.Invoke(processor);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var processor = _queue.Count > 0 ? _queue.Peek() : null;
|
||||
|
||||
while (processor != null)
|
||||
{
|
||||
if (!processor.Started)
|
||||
{
|
||||
processor.Start();
|
||||
}
|
||||
|
||||
processor.Update();
|
||||
|
||||
if (processor.Completed)
|
||||
{
|
||||
Dequeue(processor);
|
||||
|
||||
// Move to the next processor
|
||||
processor = _queue.Count > 0 ? _queue.Peek() : null;
|
||||
}
|
||||
|
||||
if (!(processor?.Blocking ?? false))
|
||||
{
|
||||
// Is the processor is not blocking, we can stop the update until the next update call
|
||||
processor = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97ad6b63e1e34a329c0b5b3a69e7d8e7
|
||||
timeCreated: 1663597510
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
internal class OVRConfigurationTaskUpdater : OVRConfigurationTaskProcessor
|
||||
{
|
||||
public override int AllocatedTimeInMs => 10;
|
||||
private readonly OVRConfigurationTaskUpdaterSummary _summary;
|
||||
|
||||
protected override Func<IEnumerable<OVRConfigurationTask>, List<OVRConfigurationTask>> OpenTasksFilter =>
|
||||
(Func<IEnumerable<OVRConfigurationTask>, List<OVRConfigurationTask>>)(tasksToFilter => tasksToFilter
|
||||
.Where(task => !task.IsIgnored(BuildTargetGroup))
|
||||
.ToList());
|
||||
|
||||
public override ProcessorType Type => ProcessorType.Updater;
|
||||
public OVRConfigurationTaskUpdaterSummary Summary => _summary;
|
||||
|
||||
public OVRConfigurationTaskUpdater(
|
||||
OVRConfigurationTaskRegistry registry,
|
||||
BuildTargetGroup buildTargetGroup,
|
||||
Func<IEnumerable<OVRConfigurationTask>, List<OVRConfigurationTask>> filter,
|
||||
OVRProjectSetup.LogMessages logMessages,
|
||||
bool blocking,
|
||||
Action<OVRConfigurationTaskProcessor> onCompleted)
|
||||
: base(registry, buildTargetGroup, filter, logMessages, blocking, onCompleted)
|
||||
{
|
||||
_summary = new OVRConfigurationTaskUpdaterSummary(BuildTargetGroup);
|
||||
}
|
||||
|
||||
protected override void PrepareTasks()
|
||||
{
|
||||
_summary.Reset();
|
||||
base.PrepareTasks();
|
||||
}
|
||||
|
||||
protected override void ProcessTask(OVRConfigurationTask task)
|
||||
{
|
||||
var changedState = task.UpdateAndGetStateChanged(BuildTargetGroup);
|
||||
Summary.AddTask(task, changedState);
|
||||
|
||||
if (task.IsDone(BuildTargetGroup))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LogMessages == OVRProjectSetup.LogMessages.All
|
||||
|| (LogMessages == OVRProjectSetup.LogMessages.Changed && changedState))
|
||||
{
|
||||
task.LogMessage(BuildTargetGroup);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Complete()
|
||||
{
|
||||
Summary.Validate();
|
||||
|
||||
if (LogMessages >= OVRProjectSetup.LogMessages.Summary)
|
||||
{
|
||||
Summary.Log();
|
||||
}
|
||||
|
||||
base.Complete();
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36d246eb26384ec88c5d849668cf29a7
|
||||
timeCreated: 1663591461
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
internal class OVRConfigurationTaskUpdaterSummary
|
||||
{
|
||||
private readonly List<OVRConfigurationTask> _doneTasks;
|
||||
private readonly List<OVRConfigurationTask> _outstandingTasks;
|
||||
private readonly Dictionary<OVRProjectSetup.TaskLevel, List<OVRConfigurationTask>> _outstandingTasksPerLevel;
|
||||
private bool HasNewOutstandingTasks { get; set; }
|
||||
private bool HasAnyChange { get; set; }
|
||||
|
||||
public bool HasAvailableFixes => _outstandingTasks.Count > 0;
|
||||
public bool HasFixes(OVRProjectSetup.TaskLevel taskLevel) => _outstandingTasksPerLevel[taskLevel].Count > 0;
|
||||
public int GetNumberOfFixes(OVRProjectSetup.TaskLevel taskLevel) => _outstandingTasksPerLevel[taskLevel].Count;
|
||||
public int GetTotalNumberOfFixes() => _outstandingTasks.Count;
|
||||
private readonly BuildTargetGroup _buildTargetGroup;
|
||||
|
||||
public BuildTargetGroup BuildTargetGroup => _buildTargetGroup;
|
||||
|
||||
public OVRConfigurationTaskUpdaterSummary(BuildTargetGroup buildTargetGroup)
|
||||
{
|
||||
_buildTargetGroup = buildTargetGroup;
|
||||
_doneTasks = new List<OVRConfigurationTask>();
|
||||
_outstandingTasks = new List<OVRConfigurationTask>();
|
||||
_outstandingTasksPerLevel = new Dictionary<OVRProjectSetup.TaskLevel, List<OVRConfigurationTask>>();
|
||||
for (var i = OVRProjectSetup.TaskLevel.Required; i >= OVRProjectSetup.TaskLevel.Optional; i--)
|
||||
{
|
||||
_outstandingTasksPerLevel.Add(i, new List<OVRConfigurationTask>());
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_doneTasks.Clear();
|
||||
_outstandingTasks.Clear();
|
||||
for (var i = OVRProjectSetup.TaskLevel.Required; i >= OVRProjectSetup.TaskLevel.Optional; i--)
|
||||
{
|
||||
_outstandingTasksPerLevel[i].Clear();
|
||||
}
|
||||
|
||||
HasNewOutstandingTasks = false;
|
||||
HasAnyChange = false;
|
||||
}
|
||||
|
||||
public void AddTask(OVRConfigurationTask task, bool changedState)
|
||||
{
|
||||
if (task.IsDone(_buildTargetGroup))
|
||||
{
|
||||
_doneTasks.Add(task);
|
||||
}
|
||||
else
|
||||
{
|
||||
_outstandingTasks.Add(task);
|
||||
_outstandingTasksPerLevel[task.Level.GetValue(_buildTargetGroup)].Add(task);
|
||||
HasNewOutstandingTasks |= changedState;
|
||||
}
|
||||
|
||||
HasAnyChange |= changedState;
|
||||
}
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if (HasAnyChange)
|
||||
{
|
||||
LogEvent();
|
||||
}
|
||||
|
||||
var interactionFlowEvent = OVRProjectSetupSettingsProvider.InteractionFlowEvent;
|
||||
if (interactionFlowEvent == null)
|
||||
{
|
||||
if (GetTotalNumberOfFixes() > 0)
|
||||
{
|
||||
interactionFlowEvent = OVRTelemetry
|
||||
.Start(OVRProjectSetupTelemetryEvent.EventTypes.InteractionFlow)
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.Level,
|
||||
HighestFixLevel?.ToString() ?? "None")
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.Count,
|
||||
GetNumberOfFixes(HighestFixLevel ?? OVRProjectSetup.TaskLevel.Required).ToString())
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.Level,
|
||||
HighestFixLevel?.ToString() ?? "None")
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.Value,
|
||||
GetTotalNumberOfFixes().ToString())
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.BuildTargetGroup,
|
||||
BuildTargetGroup.ToString());
|
||||
|
||||
OVRProjectSetupSettingsProvider.InteractionFlowEvent = interactionFlowEvent;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
interactionFlowEvent = interactionFlowEvent?.AddAnnotation(
|
||||
OVRProjectSetupTelemetryEvent.AnnotationTypes.BuildTargetGroupAfter,
|
||||
BuildTargetGroup.ToString())
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.ValueAfter,
|
||||
GetTotalNumberOfFixes().ToString());
|
||||
|
||||
OVRProjectSetupSettingsProvider.InteractionFlowEvent = interactionFlowEvent;
|
||||
}
|
||||
}
|
||||
|
||||
public OVRProjectSetup.TaskLevel? HighestFixLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
for (var i = OVRProjectSetup.TaskLevel.Required; i >= OVRProjectSetup.TaskLevel.Optional; i--)
|
||||
{
|
||||
if (HasFixes(i))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string GenerateReport(string outputPath = null, string fileName = null)
|
||||
{
|
||||
var sortedTasks = _outstandingTasks.Concat(_doneTasks);
|
||||
return OVRProjectSetupReport.GenerateJson(
|
||||
sortedTasks,
|
||||
_buildTargetGroup,
|
||||
outputPath,
|
||||
fileName
|
||||
);
|
||||
}
|
||||
|
||||
public string ComputeNoticeMessage()
|
||||
{
|
||||
var highestLevel = HighestFixLevel;
|
||||
var level = highestLevel ?? OVRProjectSetup.TaskLevel.Optional;
|
||||
var count = GetNumberOfFixes(level);
|
||||
if (count == 0)
|
||||
{
|
||||
return $"Oculus-Ready for {_buildTargetGroup}";
|
||||
}
|
||||
else
|
||||
{
|
||||
var message = GetLogMessage(level, count);
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
public string ComputeLogMessage()
|
||||
{
|
||||
var highestLevel = HighestFixLevel;
|
||||
var level = highestLevel ?? OVRProjectSetup.TaskLevel.Optional;
|
||||
var count = GetNumberOfFixes(level);
|
||||
var message = GetFullLogMessage(level, count);
|
||||
return message;
|
||||
}
|
||||
|
||||
public void LogEvent()
|
||||
{
|
||||
OVRTelemetry.Start(OVRProjectSetupTelemetryEvent.EventTypes.Summary)
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.Level, HighestFixLevel?.ToString() ?? "None")
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.Count,
|
||||
GetNumberOfFixes(HighestFixLevel ?? OVRProjectSetup.TaskLevel.Required).ToString())
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.BuildTargetGroup, BuildTargetGroup.ToString())
|
||||
.AddAnnotation(OVRProjectSetupTelemetryEvent.AnnotationTypes.Value, GetTotalNumberOfFixes().ToString())
|
||||
.Send();
|
||||
}
|
||||
|
||||
|
||||
public void Log()
|
||||
{
|
||||
if (!HasNewOutstandingTasks)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var highestLevel = HighestFixLevel;
|
||||
var message = ComputeLogMessage();
|
||||
|
||||
switch (highestLevel)
|
||||
{
|
||||
case OVRProjectSetup.TaskLevel.Optional:
|
||||
{
|
||||
Debug.Log(message);
|
||||
}
|
||||
break;
|
||||
|
||||
case OVRProjectSetup.TaskLevel.Recommended:
|
||||
{
|
||||
Debug.LogWarning(message);
|
||||
}
|
||||
break;
|
||||
|
||||
case OVRProjectSetup.TaskLevel.Required:
|
||||
{
|
||||
if (OVRProjectSetup.RequiredThrowErrors.Value)
|
||||
{
|
||||
Debug.LogError(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning(message);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetLogMessage(OVRProjectSetup.TaskLevel level, int count)
|
||||
{
|
||||
switch (count)
|
||||
{
|
||||
case 0:
|
||||
return $"There are no outstanding {level.ToString()} fixes.";
|
||||
|
||||
case 1:
|
||||
return $"There is 1 outstanding {level.ToString()} fix.";
|
||||
|
||||
default:
|
||||
return $"There are {count} outstanding {level.ToString()} fixes.";
|
||||
}
|
||||
}
|
||||
|
||||
internal static string GetFullLogMessage(OVRProjectSetup.TaskLevel level, int count)
|
||||
{
|
||||
return
|
||||
$"[Oculus Settings] {GetLogMessage(level, count)}\nFor more information, go to <a href=\"{OVRConfigurationTask.ConsoleLinkHref}\">Edit > Project Settings > {OVRProjectSetupSettingsProvider.SettingsName}</a>";
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1baa7891a0f4c63ad746d7e1b35faef
|
||||
timeCreated: 1660745160
|
||||
Reference in New Issue
Block a user